/* CENAMAD · home and project library (#inicio), UC Kit Digital look.
 * Tokens from css/tokens.css; breakpoints ≤ 600 / ≤ 1024. Every animation stops under prefers-reduced-motion. */
.lib {
  width: 100%;
}
.lib-cuerpo {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 clamp(var(--gutter), 4vw, var(--sp-8)) var(--sp-8);
}

/* ------------------------------------------------------------------ hero */
.lib-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--uc-azul-osc);
  color: #fff;
}
.lib-hero-arte {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(62%, 760px);
  z-index: -2;
}
.hero-svg {
  width: 100%;
  height: 100%;
  display: block;
}
/* UC's blue hero gradient: solid behind the text, clearing towards the illustration on the right. */
.lib-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    90deg,
    #03122e 0%,
    #03122e 32%,
    rgb(3 18 46 / 0.82) 48%,
    rgb(3 18 46 / 0.18) 74%,
    rgb(3 18 46 / 0.05) 100%
  );
}
.lib-hero-in {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: clamp(var(--sp-7), 5vw, 72px) clamp(var(--gutter), 4vw, var(--sp-8));
}
.lib-hero-tag {
  display: inline-block;
  margin: 0 0 var(--sp-4);
  padding: 4px var(--sp-3);
  border-radius: var(--r-2);
  background: var(--uc-azul);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.lib h1 {
  max-width: 16ch;
  margin: 0 0 var(--sp-4);
  font-family: var(--uc-font-slab);
  font-weight: 700;
  font-size: var(--fs-4xl);
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: #fff;
}
.lib h1::after {
  content: "";
  display: block;
  width: 72px;
  height: 5px;
  margin-top: var(--sp-4);
  background: var(--uc-amarillo);
}
.lib-lead {
  max-width: 58ch;
  margin: 0;
  font-size: var(--fs-lg);
  line-height: var(--lh-base);
  color: #dde6f2;
}
.lib-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
  margin: var(--sp-6) 0 var(--sp-4);
}
.cen-btn--fantasma {
  background: rgb(255 255 255 / 0.08);
  border-color: rgb(255 255 255 / 0.65);
  color: #fff;
}
.cen-btn--fantasma:hover {
  background: rgb(255 255 255 / 0.18);
  border-color: #fff;
}
.cen-btn--fantasma.cen-btn--flecha::after {
  background-color: rgb(255 255 255 / 0.25);
}
.cen-btn--enlace-claro {
  padding: 0 var(--sp-2);
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.cen-btn--enlace-claro:hover {
  color: var(--uc-amarillo);
}
.lib-hero :focus-visible {
  outline-color: var(--uc-amarillo);
}
.lib-note {
  max-width: 64ch;
  margin: 0;
  color: #b9c6da;
  font-size: var(--fs-sm);
}

/* hero motion: layers settle in, the heat path draws itself, the carbon river drifts */
@keyframes hero-capa-in {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes hero-traza {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes hero-punto {
  to {
    offset-distance: 100%;
  }
}
@keyframes hero-deriva {
  0%,
  100% {
    transform: translate(0, 0);
    opacity: 0.55;
  }
  50% {
    transform: translate(26px, -10px);
    opacity: 1;
  }
}
.hero-reja line {
  stroke: #2a4573;
  stroke-width: 1;
  opacity: 0.45;
}
.hero-capa,
.hero-veta {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: hero-capa-in 700ms var(--ease) backwards;
  animation-delay: calc(150ms * var(--i));
}
.hero-capa--madera {
  fill: #c98f4e;
}
.hero-capa--osb {
  fill: #8a6433;
}
.hero-capa--aisla {
  fill: #1b4fa0;
  stroke: #3f7ad4;
  stroke-width: 1.5;
}
.hero-theta {
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 700;
  stroke-dashoffset: 700;
  animation: hero-traza 2.4s var(--ease) 400ms forwards;
}
.hero-theta-punto {
  offset-path: path("M24 86 C 96 96, 124 108, 150 136 S 232 212, 320 236 S 420 258, 466 262");
  offset-distance: 0%;
  animation: hero-punto 7s linear 2.2s infinite;
}
.hero-grano {
  fill: #5cc8ff;
  opacity: 0.7;
  animation: hero-deriva 9s ease-in-out infinite;
  animation-delay: calc(-620ms * var(--i));
}
@media (prefers-reduced-motion: reduce) {
  .hero-capa,
  .hero-veta,
  .hero-theta,
  .hero-grano,
  .hero-theta-punto {
    animation: none;
  }
  .hero-theta {
    stroke-dashoffset: 0;
  }
  .hero-theta-punto {
    display: none;
  }
}

/* ------------------------------------------------------------------ calculator cards */
.lib-section {
  padding: var(--sp-8) 0 0;
}
.lib-section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
}
.lib-section-sub {
  max-width: 62ch;
  margin: var(--sp-3) 0 var(--sp-2);
  color: var(--c-ink-2);
}
.lib-calcs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: var(--sp-5);
  margin-top: var(--sp-5);
}
.lib-calc {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--c-surface);
  border: 1px solid var(--uc-gris-a);
  border-radius: var(--r-2);
  box-shadow: var(--uc-sombra);
  transition:
    transform var(--t-base) var(--ease),
    box-shadow var(--t-base) var(--ease);
}
.lib-calc:hover {
  transform: translateY(-5px);
  box-shadow: var(--uc-sombra-alta);
}
.lib-calc-arte {
  height: 132px;
  background: var(--uc-azul-osc);
  border-bottom: 4px solid var(--uc-azul);
}
.lib-calc[data-mod="termica"] .lib-calc-arte {
  background: linear-gradient(120deg, #03122e, #173f8a);
}
.lib-calc-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.lib-calc-cuerpo {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5);
}
.lib-calc-kicker {
  margin: 0;
  color: var(--c-muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.lib-calc-tit {
  margin: 0;
  font-family: var(--uc-font-slab);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--uc-azul-2);
}
/* what the calculator answers, before how it is used */
.lib-calc-pregunta {
  margin: 0;
  color: var(--c-ink);
  font-size: var(--fs-lg);
  font-weight: 500;
  line-height: var(--lh-snug);
}
.lib-calc-bajada {
  margin: 0;
  color: var(--c-ink-2);
}
.lib-calc-pie {
  max-width: 88ch;
  margin: var(--sp-4) 0 0;
  color: var(--c-muted);
  font-size: var(--fs-sm);
}
.lib-calc-acc {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: auto;
  padding-top: var(--sp-2);
}
.lib-calc-acc .cen-btn {
  flex: 1 1 150px;
}

/* card artwork motion */
@keyframes lib-barra {
  from {
    transform: scaleY(0.2);
  }
  to {
    transform: none;
  }
}
@keyframes lib-flota {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(14px);
  }
}
@keyframes lib-flujo {
  to {
    stroke-dashoffset: -32;
  }
}
.lib-rejilla line {
  stroke: #2a4573;
  stroke-width: 1;
  opacity: 0.6;
}
.lib-barras rect {
  fill: #2f66c2;
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: lib-barra 800ms var(--ease) backwards;
  animation-delay: calc(110ms * var(--i));
}
.lib-barras rect:nth-child(even) {
  fill: #1b4fa0;
}
.lib-rio-linea {
  stroke: var(--uc-amarillo);
  stroke-width: 2.5;
  stroke-dasharray: 5 8;
  opacity: 0.9;
}
.lib-rio circle {
  fill: #5cc8ff;
  opacity: 0.85;
  animation: lib-flota 6s ease-in-out infinite;
  animation-delay: calc(-420ms * var(--i));
}
.lib-capas rect {
  fill: #c98f4e;
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: hero-capa-in 700ms var(--ease) backwards;
  animation-delay: calc(130ms * var(--i));
}
.lib-capas rect:nth-child(2),
.lib-capas rect:nth-child(4) {
  fill: #8a6433;
}
.lib-capas rect:nth-child(3) {
  fill: #1b4fa0;
  stroke: #3f7ad4;
  stroke-width: 1.5;
}
.lib-theta {
  stroke: var(--uc-amarillo);
  stroke-width: 3.5;
  stroke-linecap: round;
}
.lib-flujo path {
  stroke: #5cc8ff;
  stroke-width: 1.8;
  stroke-dasharray: 10 22;
  opacity: 0.55;
  animation: lib-flujo 2.6s linear infinite;
  animation-delay: calc(-700ms * var(--i));
}
@media (prefers-reduced-motion: reduce) {
  .lib-calc,
  .lib-barras rect,
  .lib-theta,
  .lib-rio circle,
  .lib-capas rect,
  .lib-flujo path {
    animation: none;
    transition: none;
  }
  .lib-calc:hover {
    transform: none;
  }
}

/* ------------------------------------------------------------------ project cards */
.lib-count {
  color: var(--c-muted);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.lib-storage {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
  color: var(--c-muted);
  font-size: var(--fs-sm);
}
.lib-storage::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-ok);
}
.lib-storage[data-ok="false"]::before {
  background: var(--c-danger);
}
.lib-sinmotor {
  max-width: 72ch;
  margin: var(--sp-6) 0 0;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--c-warn-line);
  border-left: 4px solid var(--c-warn);
  border-radius: var(--r-2);
  background: var(--c-warn-soft);
  color: var(--c-highlight-text);
  font-size: var(--fs-md);
}
.lib-sinmotor[hidden] {
  display: none;
}
.lib-list {
  display: grid;
  gap: var(--sp-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.lib-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: var(--sp-4);
  align-items: center;
  padding: var(--sp-4);
  border: 1px solid var(--uc-gris-a);
  border-radius: var(--r-2);
  background: var(--c-surface);
  box-shadow: var(--uc-sombra);
  transition:
    transform var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}
.lib-row:hover {
  transform: translateY(-3px);
  border-color: var(--uc-azul);
  box-shadow: var(--uc-sombra-alta);
}
.lib-row--muestra {
  border-left: 4px solid var(--uc-amarillo);
}
.lib-row-model {
  display: block;
  width: 96px;
  height: 72px;
}
.lib-row-main {
  min-width: 0;
}
.lib-row-main h3 {
  margin: 0 0 var(--sp-1);
  font-family: var(--uc-font-slab);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--uc-azul-2);
  overflow-wrap: anywhere;
}
.lib-row-meta,
.lib-row-note {
  margin: 0;
  color: var(--c-muted);
  font-size: var(--fs-sm);
}
.lib-row-note {
  margin-top: var(--sp-1);
  color: var(--c-ink-2);
}
.lib-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: flex-end;
}
.lib-status {
  margin: 0 0 var(--sp-3);
  color: var(--c-ink-2);
  font-size: var(--fs-md);
}
.lib-status:empty {
  display: none;
}
.lib-delete {
  color: var(--c-danger);
}
.lib-confirm {
  display: grid;
  gap: var(--sp-2);
  max-width: 460px;
  padding: var(--sp-3);
  border: 1px solid var(--c-danger-line);
  border-radius: var(--r-2);
  background: var(--c-danger-soft);
}
.lib-confirm p {
  margin: 0;
  color: var(--c-ink);
  font-size: var(--fs-md);
}
.lib-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.lib-import {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-5);
  color: var(--c-muted);
  font-size: var(--fs-sm);
}
.lib-import p {
  margin: 0;
  min-width: 0;
}

/* ------------------------------------------------------------------ create dialog */
.lib-dialog-wrap {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: var(--gutter);
}
.lib-backdrop {
  position: absolute;
  inset: 0;
  background: var(--c-overlay);
  animation: lib-fade var(--t-base) var(--ease);
}
.lib-dialog {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100dvh - 2 * var(--gutter));
  overflow: auto;
  padding: var(--sp-6);
  border-top: 5px solid var(--uc-azul);
  border-radius: var(--r-2);
  background: var(--c-surface);
  box-shadow: var(--sh-3);
  animation: lib-sube var(--t-base) var(--ease);
}
.lib-dialog h2 {
  font-family: var(--uc-font-slab);
  font-size: var(--fs-2xl);
  color: var(--uc-azul-2);
}
@keyframes lib-fade {
  from {
    opacity: 0;
  }
}
@keyframes lib-sube {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .lib-backdrop,
  .lib-dialog,
  .lib-row {
    animation: none;
    transition: none;
  }
  .lib-row:hover {
    transform: none;
  }
}
.lib-close {
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  width: var(--tap);
  font-size: var(--fs-xl);
  text-decoration: none;
}
.lib-dialog form {
  display: grid;
  gap: var(--sp-4);
}
.lib-types {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  border: 0;
}
.lib-types legend {
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-ink-2);
}
.lib-type {
  position: relative;
  cursor: pointer;
}
.lib-type input {
  position: absolute;
  opacity: 0;
}
.lib-type span {
  display: grid;
  gap: var(--sp-1);
  justify-items: center;
  padding: var(--sp-2);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-2);
  transition:
    border-color var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease);
}
.lib-type maqueta-madera {
  display: block;
  width: 100%;
  height: 64px;
}
.lib-type input:checked + span {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 1px var(--c-accent);
  background: var(--c-accent-soft);
}
.lib-type input:focus-visible + span {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}
.lib-form-note {
  margin: 0;
  color: var(--c-muted);
  font-size: var(--fs-sm);
}
.lib-form-note[role="alert"] {
  color: var(--c-danger);
}
.lib-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}
.lib-fail-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

@media (max-width: 1024px) {
  .lib-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .lib-row-model {
    width: 72px;
    height: 56px;
  }
  .lib-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}
/* Narrow screens: the section moves under the copy instead of behind it, so the lead stays easy to read. */
@media (max-width: 900px) {
  .lib-hero-arte {
    inset: auto 0 0 auto;
    width: 100%;
    height: 58%;
  }
  .lib-hero::after {
    background: linear-gradient(
      180deg,
      #03122e 0%,
      #03122e 46%,
      rgb(3 18 46 / 0.93) 66%,
      rgb(3 18 46 / 0.62) 100%
    );
  }
}
@media (max-width: 600px) {
  .lib-hero-in {
    padding-block: var(--sp-7);
  }
  .lib h1 {
    max-width: none;
  }
  .lib-actions .cen-btn {
    flex: 1 1 100%;
    justify-content: space-between;
  }
  .lib-calc-arte {
    height: 104px;
  }
  .lib-row {
    grid-template-columns: minmax(0, 1fr);
    padding: var(--sp-3);
  }
  .lib-row-model {
    display: none;
  }
  .lib-row-actions .cen-btn {
    flex: 1 1 auto;
  }
  .lib-confirm {
    max-width: none;
    width: 100%;
  }
  .lib-types {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lib-dialog {
    padding: var(--sp-5) var(--sp-4);
  }
}
