/* ==========================================================================
   Riquelio Vargas Suárez — hoja de estilos
   --------------------------------------------------------------------------
   PALETA: cambia estas variables para ajustar todo el sitio a los colores
   exactos del logo. (--ink = color principal, --sun = acento cálido)
   ========================================================================== */
:root {
  --ink: #1b2a4a;        /* azul tinta: color principal, encabezados, portada */
  --ink-2: #263a63;      /* variación del principal para superficies */
  --sun: #f4b63f;        /* amarillo girasol: botones y acentos */
  --sun-soft: #fdecc4;   /* versión suave del acento */
  --leaf: #2f7d6d;       /* verde hoja: etiquetas de grado y detalles */
  --berry: #b8325e;      /* frambuesa: marca de "Nuevo" */

  --paper: #ffffff;
  --sky: #eef3f9;        /* fondo de secciones alternas */
  --text: #1e2536;
  --muted: #5b6579;
  --line: #d9e0ea;
  --wood: #c7965a;       /* repisa de la biblioteca */
  --wood-dark: #9c7040;

  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius-s: 6px;
  --radius-m: 14px;
  --radius-l: 28px;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--sun); color: var(--ink); padding: 10px 16px; border-radius: var(--radius-s); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; border-radius: 4px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 0 1.4em;
  border: 2px solid transparent; border-radius: 999px;
  font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer;
  transition: transform .2s var(--ease), background-color .2s, color .2s, border-color .2s;
}
.btn:active { transform: translateY(1px); }
.btn-sun { background: var(--sun); color: var(--ink); }
.btn-sun:hover { background: #ffc55a; }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--ink-2); }
.btn-ghost { border-color: rgba(255,255,255,.45); color: #fff; }
.btn-ghost:hover { border-color: #fff; background: rgba(255,255,255,.08); }
.btn-line { border-color: var(--line); background: transparent; color: var(--ink); }
.btn-line:hover { border-color: var(--ink); }
.btn-block { width: 100%; }

/* ---------- encabezado ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink);
  transition: box-shadow .25s;
}
.site-header.is-scrolled { box-shadow: 0 6px 24px rgba(10, 18, 38, .25); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 16px; }
.brand { display: flex; align-items: center; text-decoration: none; color: #fff; min-width: 0; }
.brand-logo { height: 46px; width: auto; }
.brand-text { display: none; font-family: var(--font-display); font-size: 1.25rem; white-space: nowrap; }
.brand.has-missing .brand-logo { display: none; }
.brand.has-missing .brand-text { display: inline; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: rgba(255,255,255,.86); text-decoration: none; font-weight: 500;
  padding: 10px 14px; border-radius: 999px; transition: background-color .2s, color .2s;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.is-current { color: var(--sun); }
.nav .nav-cta { background: var(--sun); color: var(--ink); margin-left: 8px; }
.nav .nav-cta:hover { background: #ffc55a; color: var(--ink); }

.nav-toggle { display: none; width: 46px; height: 46px; border: 0; background: transparent; cursor: pointer; border-radius: 10px; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; position: relative; margin: auto;
  transition: transform .25s var(--ease), background-color .2s;
}
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -7px; }
.nav-toggle-bars::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; left: 0; right: 0; top: 72px;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--ink); padding: 8px var(--gutter) 20px;
    border-top: 1px solid rgba(255,255,255,.08);
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity .2s, transform .2s var(--ease), visibility .2s;
  }
  .nav.is-open { opacity: 1; transform: none; visibility: visible; }
  .nav a { padding: 14px 6px; border-radius: 0; border-bottom: 1px solid rgba(255,255,255,.08); }
  .nav .nav-cta { margin: 14px 0 0; text-align: center; border-radius: 999px; border: 0; }
  .brand-logo { height: 40px; }
}

/* ---------- portada ---------- */
.hero {
  background: var(--ink);
  color: #fff;
  padding: clamp(40px, 7vw, 88px) 0 0;
  position: relative;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.hero-kicker { color: var(--sun); font-weight: 600; font-size: 1.0625rem; margin-bottom: 18px; }
.hero-title {
  font-size: clamp(3rem, 8.4vw, 6.4rem);
  line-height: .95;
  letter-spacing: -0.025em;
}
.hero-lead { margin-top: 26px; max-width: 34em; color: rgba(255,255,255,.82); font-size: 1.125rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

.hero-art { position: relative; min-height: 520px; display: flex; justify-content: flex-end; align-items: flex-end; }
.hero-art::before {   /* el "sol" detrás del retrato */
  content: ""; position: absolute; right: 2%; top: 4%;
  width: min(78%, 400px); aspect-ratio: 1; border-radius: 50%;
  background: var(--sun);
}
.hero-portrait {
  position: relative; margin: 0;
  width: min(72%, 360px);
  aspect-ratio: 3 / 4;
  border-radius: 999px 999px var(--radius-m) var(--radius-m);
  overflow: hidden;
  background: var(--ink-2);
  margin-right: 6%;
  box-shadow: 0 30px 60px rgba(5, 10, 25, .35);
}
.hero-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.hero-portrait.has-missing { background: linear-gradient(160deg, var(--ink-2), #33508a); }
.hero-portrait .is-missing { display: none; }

.hero-fan { position: absolute; left: 0; bottom: 34px; width: 56%; height: 230px; }
.fan-book {
  position: absolute; bottom: 0; left: 0;
  width: 128px; aspect-ratio: 2 / 3;
  border-radius: 4px 8px 8px 4px; overflow: hidden;
  box-shadow: 0 18px 30px rgba(5, 10, 25, .45);
  transform-origin: 50% 110%;
  background: var(--ink-2);
}
.fan-book img { width: 100%; height: 100%; object-fit: cover; }
.fan-book .is-missing { display: none; }
.fan-book.has-missing { background: linear-gradient(165deg, #33508a, var(--ink-2)); }
.fan-book:nth-child(1) { transform: translateX(0) rotate(-14deg); }
.fan-book:nth-child(2) { transform: translateX(74px) rotate(-3deg); z-index: 2; }
.fan-book:nth-child(3) { transform: translateX(150px) rotate(9deg); }

/* Única animación automática del sitio: el abanico de libros al cargar */
@media (prefers-reduced-motion: no-preference) {
  .fan-book { animation: fan-in .9s var(--ease) both; }
  .fan-book:nth-child(1) { animation-delay: .25s; --to: translateX(0) rotate(-14deg); }
  .fan-book:nth-child(2) { animation-delay: .4s;  --to: translateX(74px) rotate(-3deg); }
  .fan-book:nth-child(3) { animation-delay: .55s; --to: translateX(150px) rotate(9deg); }
  @keyframes fan-in {
    from { opacity: 0; transform: translateX(60px) translateY(40px) rotate(0); }
    to   { opacity: 1; transform: var(--to); }
  }
}

.honors {
  list-style: none; margin: clamp(40px, 6vw, 72px) auto 0; padding-top: 0; padding-bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid rgba(255,255,255,.14);
}
.honors li { padding: 22px 18px 26px 0; display: flex; flex-direction: column; gap: 2px; }
.honors li + li { padding-left: 22px; border-left: 1px solid rgba(255,255,255,.14); }
.honors strong { font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; color: #fff; }
.honors span { color: rgba(255,255,255,.66); font-size: .95rem; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { min-height: 420px; justify-content: center; }
  .hero-art::before { right: 50%; transform: translateX(50%); width: min(80%, 340px); }
  .hero-portrait { margin-right: 0; width: min(64%, 300px); margin-left: 18%; }
  .hero-fan { width: 60%; left: 0; height: 190px; }
  .fan-book { width: 100px; }
  .fan-book:nth-child(2) { --to: translateX(54px) rotate(-3deg); transform: var(--to); }
  .fan-book:nth-child(3) { --to: translateX(110px) rotate(9deg); transform: var(--to); }
  .honors { grid-template-columns: repeat(2, 1fr); }
  .honors li:nth-child(3) { padding-left: 0; border-left: 0; }
  .honors li:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,.14); }
}
@media (max-width: 480px) {
  .hero-art { min-height: 360px; }
  .hero-portrait { width: 62%; margin-left: 30%; }
  .fan-book { width: 84px; }
  .fan-book:nth-child(2) { --to: translateX(44px) rotate(-3deg); }
  .fan-book:nth-child(3) { --to: translateX(88px) rotate(9deg); }
  .honors strong { font-size: 1.05rem; }
  .honors li { padding-right: 10px; }
  .honors li + li { padding-left: 14px; }
}

/* ---------- títulos de sección ---------- */
.section-head { display: grid; gap: 14px; max-width: 46rem; margin-bottom: 36px; }
.section-head h2, .colegios h2, .tray-copy h2, .contacto h2 { font-size: clamp(2.2rem, 5vw, 3.4rem); color: var(--ink); }
.section-head p { color: var(--muted); font-size: 1.125rem; }

/* ---------- obras ---------- */
.obras { padding: clamp(64px, 9vw, 120px) 0; }

/* selector de grado: una regla escolar */
.grade-picker {
  display: flex; gap: 0;
  overflow-x: auto; scrollbar-width: none;
  border: 2px solid var(--ink); border-radius: var(--radius-m);
  background:
    repeating-linear-gradient(90deg, transparent 0 11px, rgba(27,42,74,.14) 11px 12px) bottom / 100% 9px no-repeat,
    var(--paper);
  scroll-snap-type: x proximity;
}
.grade-picker::-webkit-scrollbar { display: none; }
.grade {
  flex: 1 0 auto; min-width: 58px; min-height: 64px;
  padding: 8px 10px 16px;
  border: 0; border-right: 1px solid var(--line); background: transparent;
  font-weight: 600; font-size: 1.05rem; color: var(--ink); cursor: pointer;
  scroll-snap-align: start;
  transition: background-color .2s, color .2s;
  position: relative;
}
.grade:last-child { border-right: 0; }
.grade:hover { background: var(--sun-soft); }
.grade.is-active { background: var(--sun); color: var(--ink); }
.grade small { display: block; font-size: .72rem; font-weight: 500; color: var(--muted); line-height: 1.1; }
.grade.is-active small { color: var(--ink); }
.grade[disabled] { color: #a9b1c0; cursor: not-allowed; background: transparent; }

.filters { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; margin-top: 22px; }
.topics { display: flex; flex-wrap: wrap; gap: 8px; }
.topic {
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
  border-radius: 999px; padding: 7px 14px; font-size: .95rem; font-weight: 500; cursor: pointer;
  transition: border-color .2s, background-color .2s, color .2s;
}
.topic:hover { border-color: var(--ink); }
.topic[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.search { position: relative; flex: 0 1 300px; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input {
  width: 100%; min-height: 46px; padding: 0 16px 0 42px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper);
}
.search input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--sun-soft); }

.results-note { margin: 26px 0 8px; color: var(--muted); min-height: 1.6em; }
.results-note strong { color: var(--ink); }

/* la biblioteca: cada fila termina en una repisa de madera continua */
.shelf {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  column-gap: 0; row-gap: 52px;
}
.book { display: flex; flex-direction: column; }
.book-btn {
  all: unset; cursor: pointer; display: flex; flex-direction: column; height: 100%;
}
.book-btn:focus-visible { outline: 3px solid var(--sun); outline-offset: 4px; border-radius: 6px; }
.book-stand {
  height: 290px; padding: 0 18px;
  display: flex; align-items: flex-end; justify-content: center;
  position: relative;
}
.book-stand::after {    /* la repisa */
  content: ""; position: absolute; left: 0; right: 0; bottom: -14px; height: 14px;
  background: linear-gradient(var(--wood), var(--wood-dark));
  box-shadow: 0 8px 14px -6px rgba(60, 40, 15, .45);
}
.cover {
  position: relative; width: 100%; max-width: 172px;
  border-radius: 3px 7px 7px 3px; overflow: hidden;
  background: var(--ink);
  box-shadow: -3px 0 0 rgba(0,0,0,.08) inset, 0 14px 22px -10px rgba(15, 22, 40, .55);
  transform-origin: bottom center;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.cover.is-vertical { aspect-ratio: 2 / 3; }
.cover.is-square { aspect-ratio: 1; }
.cover img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 1; }
.cover .is-missing { display: none; }
.book-btn:hover .cover, .book-btn:focus-visible .cover {
  transform: translateY(-10px) rotate(-1.5deg);
  box-shadow: 0 26px 30px -12px rgba(15, 22, 40, .55);
}
/* portada de reemplazo cuando la imagen aún no existe */
.cover-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between;
  padding: 16px 14px; color: #fff;
  background:
    radial-gradient(circle at 80% 18%, var(--sun) 0 16%, transparent 16.5%),
    linear-gradient(165deg, var(--ink-2), var(--ink));
}
.cover-fallback b { font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; line-height: 1.1; margin-top: auto; }
.cover-fallback i { font-style: normal; font-size: .72rem; opacity: .75; margin-top: 10px; }

.badge {
  position: absolute; z-index: 2; top: 10px; left: -4px;
  background: var(--berry); color: #fff; font-size: .74rem; font-weight: 700;
  padding: 3px 10px 3px 12px; border-radius: 0 999px 999px 0;
  box-shadow: 0 3px 8px rgba(0,0,0,.25);
}
.badge.is-award { background: var(--sun); color: var(--ink); }

.book-info { padding: 30px 18px 0; }
.book-title { font-family: var(--font-display); font-size: 1.18rem; line-height: 1.2; color: var(--ink); }
.book-sub { font-size: .92rem; color: var(--muted); margin-top: 2px; }
.book-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font-size: .8rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: #e3f1ee; color: var(--leaf);
}
.chip.is-age { background: var(--sky); color: var(--ink-2); }

.empty { text-align: center; padding: 48px 16px; display: grid; justify-items: center; gap: 18px; color: var(--muted); }

@media (max-width: 560px) {
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; }
  .book-stand { height: 220px; padding: 0 10px; }
  .book-info { padding: 26px 10px 0; }
  .book-title { font-size: 1.02rem; }
  .search { flex-basis: 100%; }
}

/* ---------- colegios ---------- */
.colegios { background: var(--sky); padding: clamp(64px, 9vw, 112px) 0; }
.colegios-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.colegios-lead { color: var(--muted); font-size: 1.125rem; margin: 18px 0 28px; max-width: 30em; }

.ladder { display: grid; gap: 14px; }
.rung {
  display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center;
  background: var(--paper); border-radius: var(--radius-m); padding: 16px 18px;
  border-left: 6px solid var(--leaf);
}
.rung:nth-child(2) { border-left-color: var(--sun); }
.rung:nth-child(3) { border-left-color: var(--berry); }
.rung:nth-child(4) { border-left-color: var(--ink); }
.rung h3 { font-size: 1.2rem; color: var(--ink); }
.rung p { font-size: .9rem; color: var(--muted); }
.rung-books { display: flex; flex-wrap: wrap; gap: 8px; }
.mini-btn { all: unset; cursor: pointer; display: flex; align-items: flex-end; border-radius: 4px; }
.mini-btn:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.mini-btn:hover .mini { transform: translateY(-4px); }
.mini {
  display: block; width: 46px; border-radius: 2px 4px 4px 2px; overflow: hidden;
  background: var(--ink); box-shadow: 0 4px 8px -3px rgba(15,22,40,.5);
  transition: transform .2s var(--ease);
  position: relative;
}
.mini.is-vertical { aspect-ratio: 2/3; }
.mini.is-square { aspect-ratio: 1; }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.mini .is-missing { display: none; }
.mini.has-missing::after { content: ""; position: absolute; inset: 0; background: linear-gradient(165deg, var(--ink-2), var(--ink)); }
.rung-books { align-items: flex-end; }

@media (max-width: 900px) {
  .colegios-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .rung { grid-template-columns: 1fr; gap: 10px; }
}

/* ---------- trayectoria ---------- */
.trayectoria { padding: clamp(64px, 9vw, 120px) 0; }
.tray-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.tray-photos { position: sticky; top: 100px; }
.tray-main {
  margin: 0; aspect-ratio: 3/4; border-radius: var(--radius-l); overflow: hidden; background: var(--sky);
}
.tray-main img { width: 100%; height: 100%; object-fit: cover; object-position: center top; transition: opacity .3s; }
.tray-main .is-missing { display: none; }
.tray-thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 12px; }
.thumb {
  padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden;
  aspect-ratio: 1; cursor: pointer; background: var(--sky);
  transition: border-color .2s, opacity .2s; opacity: .7;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.thumb .is-missing { display: none; }
.thumb:hover { opacity: 1; }
.thumb[aria-pressed="true"] { border-color: var(--ink); opacity: 1; }

.tray-copy > p { margin-top: 18px; font-size: 1.125rem; max-width: 36em; }
.tray-copy h2 { margin-bottom: 6px; }

.tray-intro { margin-top: 14px; font-size: 1.2rem; color: var(--muted); max-width: 34em; }

/* hoja de vida: tres bloques con su propio color */
.cv { display: grid; gap: 18px; margin-top: 34px; }
.cv-group {
  border-radius: var(--radius-m); padding: 22px 24px 20px;
  background: var(--sky); border-top: 5px solid var(--sun);
}
.cv-studies { border-top-color: var(--leaf); }
.cv-now { border-top-color: var(--ink); }
.cv-group h3 { font-size: 1.45rem; color: var(--ink); margin-bottom: 12px; }
.cv-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cv-group li { display: grid; gap: 2px; padding-left: 20px; position: relative; }
.cv-group li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 8px; height: 8px; border-radius: 50%; background: var(--sun);
}
.cv-studies li::before { background: var(--leaf); }
.cv-now li::before { background: var(--ink); }
.cv-group strong { font-weight: 600; color: var(--ink); line-height: 1.35; }
.cv-group span { color: var(--muted); font-size: .95rem; line-height: 1.45; }

@media (max-width: 900px) {
  .tray-grid { grid-template-columns: 1fr; }
  .tray-photos { position: static; max-width: 460px; }
}

/* ---------- contacto ---------- */
.contacto { background: var(--ink); color: #fff; padding: clamp(64px, 9vw, 112px) 0; }
.contacto h2 { color: #fff; }
.contacto-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.contacto-copy > p { margin-top: 18px; color: rgba(255,255,255,.8); font-size: 1.125rem; max-width: 30em; }
.channels { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 10px; }
.channels a {
  display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: #fff;
  font-weight: 500; padding: 6px 0;
}
.channels a:hover { color: var(--sun); }
.channels svg { width: 22px; height: 22px; flex: none; fill: currentColor; }

.form { background: var(--paper); color: var(--text); border-radius: var(--radius-l); padding: clamp(22px, 4vw, 36px); display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: .95rem; color: var(--ink); }
.opt { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  padding: 12px 14px; min-height: 48px;
}
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--sun-soft); }
.field [aria-invalid="true"] { border-color: var(--berry); }
.form-error { color: var(--berry); font-weight: 500; font-size: .95rem; }

@media (max-width: 900px) { .contacto-grid { grid-template-columns: 1fr; } }

/* ---------- pie ---------- */
.site-footer { background: #142039; color: rgba(255,255,255,.75); padding: 48px 0 28px; }
.footer-inner { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 32px; align-items: start; }
.footer-name { font-family: var(--font-display); font-size: 1.4rem; color: #fff; }
.footer-text { margin-top: 8px; max-width: 30em; font-size: .95rem; }
.footer-nav { display: grid; gap: 6px; }
.footer-nav a { text-decoration: none; }
.footer-nav a:hover { color: var(--sun); }
.footer-social { list-style: none; padding: 0; margin: 0; display: flex; gap: 10px; }
.footer-social a {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2); color: #fff; transition: background-color .2s, color .2s;
}
.footer-social a:hover { background: var(--sun); color: var(--ink); border-color: var(--sun); }
.footer-social svg { width: 18px; height: 18px; fill: currentColor; }
.footer-legal { margin-top: 36px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: .88rem; }
@media (max-width: 720px) { .footer-inner { grid-template-columns: 1fr; } }

/* ---------- ficha del libro (diálogo) ---------- */
.book-dialog {
  width: min(960px, calc(100% - 24px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 0; border-radius: var(--radius-l);
  background: var(--paper); color: var(--text);
  box-shadow: 0 40px 80px rgba(5, 10, 25, .4);
  overflow: hidden;
}
.book-dialog::backdrop { background: rgba(14, 22, 42, .72); backdrop-filter: blur(3px); }
@media (prefers-reduced-motion: no-preference) {
  .book-dialog[open] { animation: dlg-in .35s var(--ease); }
  @keyframes dlg-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
}
.dlg-inner { display: grid; grid-template-columns: 340px 1fr; max-height: calc(100dvh - 32px); }
.dlg-cover {
  background: var(--sky); display: flex; align-items: center; justify-content: center;
  padding: 40px 34px;
}
.dlg-cover .cover { max-width: 260px; transform: none; box-shadow: 0 24px 40px -14px rgba(15,22,40,.6); }
.dlg-body { padding: 40px 40px 28px; overflow-y: auto; }
.dlg-flag { font-size: .9rem; font-weight: 600; color: var(--berry); min-height: 1.4em; }
.dlg-flag.is-award { color: var(--wood-dark); }
.dlg-title { font-size: clamp(1.8rem, 3.6vw, 2.5rem); color: var(--ink); margin-top: 4px; }
.dlg-sub { font-size: 1.15rem; color: var(--muted); margin-top: 6px; font-style: italic; }
.dlg-sub:empty { display: none; }
.dlg-facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 4px 28px; margin: 22px 0 0; padding: 16px 0; border-block: 1px solid var(--line); }
.dlg-facts div { display: grid; }
.dlg-facts dt { font-size: .8rem; color: var(--muted); }
.dlg-facts dd { margin: 0; font-weight: 600; color: var(--ink); }
.dlg-synopsis { margin-top: 22px; display: grid; gap: 14px; max-width: 38em; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.dlg-nav { display: flex; justify-content: space-between; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
.dlg-step { border: 0; background: none; color: var(--muted); font-weight: 600; cursor: pointer; padding: 8px 4px; }
.dlg-step:hover { color: var(--ink); }
.dlg-close {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--paper);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.dlg-close svg { width: 20px; height: 20px; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; fill: none; }

@media (max-width: 760px) {
  .book-dialog { border-radius: var(--radius-m); }
  .dlg-inner { grid-template-columns: 1fr; overflow-y: auto; }
  .dlg-cover { padding: 28px 24px 24px; }
  .dlg-cover .cover { max-width: 170px; }
  .dlg-body { padding: 24px 22px 20px; overflow: visible; }
  .dlg-facts { grid-template-columns: repeat(2, auto); }
}

/* ---------- aviso ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 200;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  transition: opacity .25s, transform .25s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- encuentros (galería) ---------- */
.encuentros { padding: clamp(64px, 9vw, 120px) 0; }
.gallery {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: clamp(150px, 17vw, 220px);
  grid-auto-flow: dense; gap: 12px;
}
.g-item { border-radius: var(--radius-m); overflow: hidden; background: var(--sky); }
.g-big  { grid-column: span 2; grid-row: span 2; }
.g-tall { grid-row: span 2; }
.g-wide { grid-column: span 2; }
.g-btn { all: unset; display: block; width: 100%; height: 100%; cursor: zoom-in; }
.g-btn:focus-visible { outline: 3px solid var(--sun); outline-offset: -3px; }
.g-btn img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.g-btn:hover img { transform: scale(1.04); }
.g-item .is-missing { display: none; }
@media (max-width: 700px) {
  .gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 42vw; gap: 8px; }
  .g-item { border-radius: 10px; }
}

.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0;
  padding: 0; border: 0; background: rgba(10, 16, 32, .94);
  display: none; align-items: center; justify-content: center;
}
.lightbox[open] { display: flex; }
.lightbox::backdrop { background: transparent; }
.lb-figure { margin: 0; max-width: min(1200px, 92vw); display: grid; gap: 12px; justify-items: center; }
.lb-figure img { max-width: 100%; max-height: 80dvh; object-fit: contain; border-radius: 8px; }
.lb-figure figcaption { color: rgba(255,255,255,.85); text-align: center; font-size: 1rem; }
.lb-close, .lb-step {
  position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.12); display: grid; place-items: center;
}
.lb-close:hover, .lb-step:hover { background: rgba(255,255,255,.24); }
.lb-close svg, .lb-step svg { width: 22px; height: 22px; stroke: #fff; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
@media (max-width: 700px) {
  .lb-prev, .lb-next { top: auto; bottom: 20px; transform: none; }
  .lb-prev { left: calc(50% - 60px); }
  .lb-next { right: calc(50% - 60px); }
}

/* foto de la galería con todos los libros: enfocar la parte de abajo */
.g-item img[src*="con-sus-libros"] { object-position: center 85%; }

/* en celular y tableta, la foto del autor va primero */
@media (max-width: 900px) {
  .hero { padding-top: 24px; }
  .hero-art { order: -1; min-height: 400px; }
}
@media (max-width: 480px) {
  .hero-art { min-height: 380px; }
}
