/* carolinamoreno.ink — tema «Azul nocturno» */
:root {
  --bg: #0c1a2e;
  --bg-deep: #08121f;
  --surface: #13253f;
  --surface-2: #1a3050;
  --line: #2a4266;
  --text: #efe6d2;
  --muted: #b9b09b;
  --accent: #3a6aa6;
  --accent-light: #8db4e2;
  --ochre: #c99a4e;
  --ochre-strong: #ddb06a;
  --danger: #e08a76;
  --ok: #a9c27a;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px;
  --wrap: 1100px;
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.65 var(--sans);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ochre-strong); text-underline-offset: 3px; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--ochre-strong); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h3 { font-size: 1.5rem; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only, .hp {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--ochre); color: var(--bg); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-deep) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--serif); font-size: 1.35rem; }
.brand img { width: 40px; height: 40px; object-fit: contain; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; width: 44px; height: 44px; cursor: pointer; }
.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after {
  display: block; width: 20px; height: 2px; background: var(--text); margin: 0 auto; position: relative; transition: transform .2s;
}
.nav-toggle .bars::before, .nav-toggle .bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle .bars::before { top: -6px; }
.nav-toggle .bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.site-nav a { display: block; padding: 8px 12px; color: var(--muted); text-decoration: none; border-radius: 6px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); background: var(--surface); }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--bg-deep); border-bottom: 1px solid var(--line); }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; padding: 8px var(--gutter) 16px; }
  .site-nav a { padding: 12px; }
}

/* ---------- Secciones ---------- */
.section { padding: clamp(48px, 9vw, 96px) 0; border-top: 1px solid var(--line); }
.section:first-child { border-top: 0; }
.section-alt { background: var(--bg-deep); }
.eyebrow { font: 600 .78rem/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--accent-light); margin-bottom: 12px; }
.section-head { max-width: 680px; margin-bottom: 36px; }

/* ---------- Inicio: contenido + semblanza fija a la derecha ---------- */
.page-home main {
  background: radial-gradient(ellipse at 85% 0%, rgba(58, 106, 166, .22), transparent 50%);
}
.home-layout { display: grid; gap: 40px; padding-top: 32px; padding-bottom: 64px; }
.home-main { min-width: 0; display: grid; gap: 48px; align-content: start; }
.block-title {
  font-style: italic; font-size: clamp(1.8rem, 3.5vw, 2.3rem); color: var(--accent-light);
  padding-bottom: 12px; margin-bottom: 24px; border-bottom: 1px solid var(--line);
}
.aside-sticky { display: grid; gap: 16px; }
.aside-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.aside-hello { font: italic 500 1.6rem/1.1 var(--serif); color: var(--accent-light); margin: 0 0 4px; }
.aside-name { font: 600 1rem/1.4 var(--sans); margin: 0; }
.aside-role { display: block; font-weight: 400; font-size: .9rem; color: var(--muted); }
.aside-photo { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.aside-title { font-style: italic; font-size: 1.6rem; color: var(--accent-light); }
.aside-card .bio-text { font-size: 1.1rem; line-height: 1.55; }
.aside-card .social { margin: 16px 0 12px; }
.aside-cta { width: 100%; }
@media (min-width: 900px) {
  .home-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; }
  /* Siempre visible: se queda fija mientras se recorre la columna izquierda.
     Si la semblanza es más alta que la pantalla, la columna tiene su propio scroll. */
  .aside-sticky {
    position: sticky; top: 88px;
    max-height: calc(100vh - 104px); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: var(--line) transparent;
    padding-right: 2px;
  }
}
@media (min-width: 1100px) { .home-layout { grid-template-columns: minmax(0, 1fr) 360px; } }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: 999px;
  background: var(--ochre); color: #0c1a2e; border: 1px solid var(--ochre);
  font: 600 .95rem/1.2 var(--sans); text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--ochre-strong); border-color: var(--ochre-strong); color: #0c1a2e; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--accent-light); }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: .85rem; }
.btn svg { width: 18px; height: 18px; }
.btn[disabled] { opacity: .6; cursor: progress; }

.form { display: grid; gap: 14px; max-width: 560px; }
.form .row { display: grid; gap: 14px; }
@media (min-width: 640px) { .form .row { grid-template-columns: 1fr 1fr; } }
label { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 13px; min-height: 44px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ochre); box-shadow: 0 0 0 3px rgba(201, 154, 78, .25); }
textarea { min-height: 140px; resize: vertical; }
.form-status { min-height: 1.5em; margin: 0; font-size: .95rem; }
.form-status.ok { color: var(--ok); }
.form-status.error { color: var(--danger); }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; max-width: 560px; }
.inline-form input { flex: 1 1 200px; }

/* ---------- Eventos ---------- */
.events { display: grid; gap: 16px; }
.event-card { display: flex; gap: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.event-date {
  flex: 0 0 72px; height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid var(--accent); border-radius: 8px; background: var(--bg-deep);
}
.event-date .day { font: 500 2rem/1 var(--serif); color: var(--ochre-strong); }
.event-date .month { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.event-body { min-width: 0; flex: 1; }
.event-body h3 { margin-bottom: 4px; }
.event-when { margin: 0; color: var(--text); }
.event-where { margin: 0 0 12px; color: var(--muted); }
.event-notes { color: var(--muted); font-size: .95rem; }
.add-cal { position: relative; display: inline-block; }
.add-cal summary { list-style: none; }
.add-cal summary::-webkit-details-marker { display: none; }
.add-cal ul {
  position: absolute; z-index: 10; top: calc(100% + 6px); left: 0; min-width: 220px;
  list-style: none; margin: 0; padding: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
}
.add-cal ul a { display: block; padding: 10px 12px; color: var(--text); text-decoration: none; border-radius: 6px; }
.add-cal ul a:hover { background: var(--surface); }
@media (max-width: 480px) { .event-card { flex-direction: column; gap: 12px; } .event-date { flex-direction: row; align-items: baseline; gap: 8px; height: auto; padding: 6px 12px; width: max-content; } }

/* ---------- Poemas ---------- */
/* Un poema por fila */
.poems { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); }
.poem {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(22px, 4vw, 40px); position: relative;
}
.poem::before { content: ""; position: absolute; left: 0; top: 24px; bottom: 24px; width: 3px; background: var(--accent); border-radius: 0 3px 3px 0; }
.poem-title { font-size: 1.7rem; color: var(--ochre-strong); }
/* Respeta saltos, sangrías y espacios tal como se capturaron. */
.poem-body {
  white-space: pre-wrap; tab-size: 4;
  font: 400 1.22rem/1.7 var(--serif);
  overflow-wrap: break-word;
}
/* Efecto «se escribe al hacer scroll» (inicio): letras pendientes como texto fantasma */
.poem-body .pc { opacity: .15; transition: opacity .18s linear; }
.poem-body .pc.on { opacity: 1; }
.poem-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line); color: var(--muted); font-size: .9rem; }

/* ---------- Semblanza ---------- */
.bio-text { font-family: var(--serif); font-size: 1.2rem; }

/* ---------- Redes ---------- */
.social { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.social a {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--text); text-decoration: none;
}
.social a:hover { border-color: var(--ochre); color: var(--ochre-strong); }
.social svg { width: 20px; height: 20px; }

label.check { display: flex; align-items: flex-start; gap: 10px; color: var(--text); cursor: pointer; }
label.check input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; padding: 0; flex: none; accent-color: var(--ochre); }

/* ---------- Presentaciones ---------- */
.pres-grid { display: grid; gap: 24px; }
@media (min-width: 700px) { .pres-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .pres-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pres-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.pres-body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.pres-body h3 { font-size: 1.35rem; }
.pres-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }
.yt-lite, .yt-frame { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; padding: 0; background: #000; cursor: pointer; overflow: hidden; }
.yt-lite img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: opacity .2s; }
.yt-lite:hover img { opacity: 1; }
.yt-play {
  position: absolute; left: 50%; top: 50%; width: 68px; height: 48px; transform: translate(-50%, -50%);
  background: rgba(8, 18, 31, .85); border-radius: 12px; border: 1px solid var(--ochre);
}
.yt-play::after { content: ""; position: absolute; left: 27px; top: 14px; border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent var(--ochre-strong); }
.yt-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.empty { color: var(--muted); font-style: italic; }
/* Dónde conseguir el libro */
.stores { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.store-card {
  display: flex; flex-direction: column; height: 100%; overflow: hidden; text-decoration: none; color: var(--text);
  background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s, transform .15s;
}
a.store-card:hover { border-color: var(--ochre); transform: translateY(-2px); color: var(--text); }
.store-card img, .store-placeholder { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--bg-deep); }
.store-placeholder { display: grid; place-items: center; font: 500 3rem/1 var(--serif); color: var(--accent-light); }
.store-name { font: 500 1.35rem/1.2 var(--serif); padding: 14px 16px 4px; }
.store-link { padding: 0 16px 16px; color: var(--ochre-strong); font-size: .88rem; margin-top: auto; }
@media (prefers-reduced-motion: reduce) { a.store-card:hover { transform: none; } }

/* Galería de presentaciones */
.pres-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; background: var(--bg-deep); }
.pres-gallery.no-video .pres-thumb:first-child { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.pres-thumb { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 3px; }
.pres-thumb.is-hidden { display: none; }
.pres-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s, opacity .2s; }
.pres-thumb:hover img { transform: scale(1.04); }
.pres-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 18, 31, .65); color: var(--text); font: 500 1.6rem/1 var(--serif); }

/* Visor de imágenes */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(4, 9, 16, .92); }
.lightbox figure { margin: 0; height: 100%; display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 56px 16px 16px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain; border-radius: 4px; }
.lightbox figcaption { color: var(--text); font-family: var(--serif); font-size: 1.15rem; text-align: center; min-height: 1.5em; padding-top: 10px; }
.lb-btn { position: fixed; z-index: 2; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: rgba(19, 37, 63, .85); color: var(--text); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.lb-btn:hover { border-color: var(--ochre); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-count { position: fixed; top: 22px; left: 16px; color: var(--muted); font-size: .9rem; }

/* ---------- Carroña botánica ---------- */
.page-book { background-color: var(--bg); }
.ants-bg { position: relative; isolation: isolate; }
.ants-bg::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: url("../img/ants.svg"); background-size: 260px 260px; opacity: .09;
}
.book-hero { display: grid; gap: 40px; align-items: center; }
@media (min-width: 860px) { .book-hero { grid-template-columns: 2fr 3fr; } }
.book-cover { border-radius: 6px; box-shadow: 0 30px 60px rgba(0, 0, 0, .55); border: 1px solid var(--line); max-width: 420px; margin: 0 auto; width: 100%; }
.book-cover-placeholder {
  aspect-ratio: 2 / 3; display: grid; place-items: center; text-align: center; padding: 24px;
  background: linear-gradient(160deg, var(--surface-2), var(--bg-deep)); font: 500 2rem/1.1 var(--serif); color: var(--ochre-strong);
}
.book-desc { font-family: var(--serif); font-size: 1.2rem; }
.contact-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.random-poem { max-width: 760px; margin: 0 auto; }
.random-poem .poem { background: color-mix(in srgb, var(--surface) 92%, transparent); }
.random-poem-actions { text-align: center; margin-top: 18px; }
.interest-box { margin-top: 8px; }
.interest-box[hidden] { display: none; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-deep); padding: 36px 0; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.footer-inner p { margin: 0; color: var(--muted); }
