  /* ---------------------------------------------------------------
     Layout concept: la página es un sendero de montaña que se sube.
     El hero es el primer mirador. Los poemas destacados son piedras
     del camino conectadas por una línea. La sección de años es una
     línea de tiempo horizontal (hitos del sendero) donde el tamaño
     del número refleja cuántos poemas tiene ese año.
     --------------------------------------------------------------- */
  :root {
    /* paleta extraída de la foto: nieve, roca y sombra pizarra */
    --bg: #EDF1F6;
    --bg-raised: #DEE4EC;
    --ink: #15161B;
    --ink-soft: #586166;
    --leather: #8C8478;
    --moss: #6C757C;
    --ember: #3D434F;
    --line: #C7CDD6;
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color-scheme: light;
  }

  * { box-sizing: border-box; }

  html { scroll-padding-top: 76px; }

  body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-ui);
    margin: 0;
    -webkit-font-smoothing: antialiased;
  }

  img { max-width: 100%; }

  a { color: inherit; }

  .wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding-left: max(24px, env(safe-area-inset-left, 0px));
    padding-right: max(24px, env(safe-area-inset-right, 0px));
  }

  /* ---------- NAV ---------- */

  nav {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 20;
    background: rgba(237, 241, 246, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    height: env(safe-area-inset-top, 0px);
    z-index: 21;
    background: rgba(237, 241, 246, 0.92);
  }

  .nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-block: 18px;
  }

  .brand {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
  }

  .brand span {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--ink-soft);
    letter-spacing: 0.03em;
    margin-top: 1px;
  }

  .nav-links {
    display: flex;
    gap: clamp(14px, 3vw, 28px);
    font-size: 0.88rem;
    font-weight: 500;
  }

  .nav-links a {
    text-decoration: none;
    color: var(--ink-soft);
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
  }

  .nav-links a:hover,
  .nav-links a:focus-visible {
    color: var(--ink);
    border-color: var(--ember);
  }

  /* ---------- HERO ---------- */

  .hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    min-height: min(88vh, 780px);
    background: #15161B;
    color: #EDF1F6;
    padding-block: clamp(56px, 9vw, 112px) clamp(40px, 6vw, 72px);
  }

  /* Escritorio: el video ocupa todo el hero (cover) */
  .hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 0;
  }

  .hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
      linear-gradient(180deg, rgba(12, 13, 16, 0.35) 0%, rgba(12, 13, 16, 0.2) 40%, rgba(12, 13, 16, 0.8) 100%),
      linear-gradient(90deg, rgba(12, 13, 16, 0.55) 0%, transparent 60%);
  }

  .hero-grid {
    position: relative;
    z-index: 1;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: end;
  }

  /* El video cuadrado de aullidos sólo se usa en móvil */
  .hero-media {
    display: none;
    position: relative;
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 360px; /* tamaño nativo del video (360x360): sin agrandar, sin pixelar */
    border-radius: 6px;
    overflow: hidden;
    background: #0C0D10;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  }

  /* El video se ve completo: contain, nunca cover */
  .hero-media img,
  .hero-media video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .hero-content {
    position: relative;
    z-index: 1;
  }

  .hero-eyebrow {
    font-size: 0.82rem;
    color: #A9B3C0;
    margin: 0 0 10px;
    font-weight: 500;
  }

  .hero h1 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2.6rem, 6.5vw, 4.8rem);
    line-height: 0.98;
    margin: 0 0 18px;
    max-width: 14ch;
    text-wrap: balance;
  }

  .hero-sub {
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    color: #C9D1DC;
    max-width: 46ch;
    line-height: 1.55;
    margin: 0;
  }

  @media (max-width: 820px) {
    /* Móvil: la foto vertical 03 de fondo, oscurecida para que el texto se lea */
    .hero {
      background:
        linear-gradient(180deg, rgba(21, 22, 27, 0.55) 0%, rgba(21, 22, 27, 0.72) 55%, rgba(21, 22, 27, 0.9) 100%),
        url("03.jpeg") center top / cover no-repeat,
        #15161B;
    }
    .hero { display: block; min-height: 0; padding-block: clamp(40px, 7vw, 88px); }
    .hero::after { display: none; }
    .hero-bg { display: none; }
    .hero-grid { gap: clamp(28px, 6vw, 72px); }
    .hero-media { display: block; justify-self: center; order: 2; }
  }

  /* ---------- SECTION SHELL ---------- */

  section {
    padding-block: clamp(56px, 8vw, 96px);
  }

  .section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: clamp(28px, 4vw, 44px);
    flex-wrap: wrap;
  }

  .section-head h2 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2.05rem);
    margin: 0;
  }

  .section-head p {
    font-size: 0.9rem;
    color: var(--ink-soft);
    margin: 0;
    max-width: 38ch;
  }

  /* ---------- DESTACADOS (piedras del camino) ---------- */

  .trail {
    position: relative;
  }

  .trail-path {
    display: block;
    width: 100%;
    height: 14px;
    margin-bottom: 4px;
  }

  .poem-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: clamp(14px, 2vw, 22px);
  }

  .poem-stone {
    text-decoration: none;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
  }

  .stone-marker {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--leather);
    margin-left: 2px;
    transition: background 0.15s ease, transform 0.15s ease;
  }

  .poem-stone:hover .stone-marker,
  .poem-stone:focus-visible .stone-marker {
    background: var(--ember);
    border-color: var(--ember);
    transform: scale(1.15);
  }

  .stone-date {
    font-size: 0.72rem;
    color: var(--ink-soft);
    font-weight: 500;
    letter-spacing: 0.02em;
  }

  .stone-title {
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 500;
    line-height: 1.25;
    text-wrap: balance;
  }

  .poem-stone:hover .stone-title,
  .poem-stone:focus-visible .stone-title {
    color: var(--ember);
  }

  .stone-frag {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.92rem;
    color: var(--ink-soft);
    line-height: 1.5;
  }

  /* ---------- AÑOS (hitos del camino) ---------- */

  .years-scroll {
    overflow-x: auto;
    margin-inline: max(-24px, calc(-1 * max(16px, env(safe-area-inset-left, 0px)) - 8px));
    padding-inline: max(24px, env(safe-area-inset-left, 0px));
    padding-bottom: 8px;
    scrollbar-width: thin;
  }

  .years-row {
    display: flex;
    align-items: baseline;
    gap: clamp(18px, 2.4vw, 30px);
    position: relative;
    padding-top: 6px;
    padding-bottom: 18px;
    min-width: max-content;
  }

  .years-row::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8px;
    height: 1px;
    background: var(--line);
  }

  .year-btn {
    appearance: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-display);
    color: var(--ink-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 4px 2px 0;
    position: relative;
  }

  .year-btn .num {
    font-weight: 400;
    line-height: 1;
    transition: color 0.15s ease;
  }

  .year-btn .count {
    font-family: var(--font-ui);
    font-size: 0.66rem;
    color: var(--ink-soft);
    opacity: 0.75;
  }

  .year-btn::after {
    content: "";
    position: absolute;
    bottom: -18px;
    left: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--line);
    transform: translateX(-50%);
    transition: background 0.15s ease, transform 0.15s ease;
  }

  .year-btn:hover .num,
  .year-btn:focus-visible .num {
    color: var(--ember);
  }

  .year-btn:hover::after,
  .year-btn:focus-visible::after {
    background: var(--leather);
    transform: translateX(-50%) scale(1.3);
  }

  .year-btn[aria-expanded="true"] .num {
    color: var(--ember);
  }

  .year-btn[aria-expanded="true"]::after {
    background: var(--ember);
    transform: translateX(-50%) scale(1.4);
  }

  .year-panel {
    margin-top: clamp(28px, 4vw, 40px);
    border-top: 1px solid var(--line);
    padding-top: clamp(24px, 3vw, 32px);
  }

  .year-panel[hidden] { display: none; }

  .year-panel-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 20px;
  }

  .year-panel-head .big-year {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--ember);
  }

  .year-link {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1px;
    white-space: nowrap;
  }

  .year-link:hover { color: var(--ember); border-color: var(--ember); }

  .year-panel-head .meta {
    font-size: 0.85rem;
    color: var(--ink-soft);
  }

  .poem-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 2px;
  }

  .poem-list li {
    border-bottom: 1px solid var(--line);
  }

  .poem-list a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    text-decoration: none;
    padding: 13px 4px;
    color: var(--ink);
  }

  .poem-list .ptitle {
    font-family: var(--font-display);
    font-size: 1.02rem;
  }

  .poem-list a:hover .ptitle,
  .poem-list a:focus-visible .ptitle {
    color: var(--ember);
  }

  .poem-list .pdate {
    font-size: 0.78rem;
    color: var(--ink-soft);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }

  .empty-note {
    font-size: 0.9rem;
    color: var(--ink-soft);
    font-style: italic;
    font-family: var(--font-display);
  }

  /* ---------- ABOUT / FOOTER ---------- */

  .about {
    background: var(--bg-raised);
    border-top: 1px solid var(--line);
  }

  .about-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: clamp(32px, 6vw, 72px);
    align-items: start;
  }

  .about h2 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2.05rem);
    margin: 0 0 18px;
  }

  .about p {
    font-size: 0.98rem;
    line-height: 1.7;
    color: var(--ink-soft);
    max-width: 58ch;
    margin: 0 0 14px;
  }

  .about-fact {
    border-left: 2px solid var(--moss);
    padding-left: 18px;
  }

  .about-fact dt {
    font-size: 0.72rem;
    color: var(--ink-soft);
    margin-bottom: 2px;
  }

  .about-fact dd {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin: 0 0 18px;
  }

  .about-social {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--ink);
    border-bottom: 1px solid var(--ember);
    padding-bottom: 2px;
    transition: color 0.15s ease, border-color 0.15s ease;
  }

  .about-social:hover,
  .about-social:focus-visible {
    color: var(--ember);
  }

  .about-social svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }

  footer {
    padding-block: 28px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--ink-soft);
  }

  /* ---------- TARJETAS DE POEMAS ---------- */

  #poemas { padding-block: clamp(48px, 7vw, 88px); }

  .cards {
    columns: 2 340px;
    column-gap: 22px;
    margin-top: clamp(24px, 4vw, 40px);
  }

  .poem-card {
    break-inside: avoid;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: clamp(22px, 3vw, 32px);
    margin: 0 0 22px;
  }

  .poem-card .card-date {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 0 0 8px;
  }

  .poem-card h3 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.4rem;
    line-height: 1.2;
    margin: 0 0 16px;
  }

  .poem-card .card-text {
    font-family: var(--font-display);
    font-size: 1rem;
    line-height: 1.7;
    white-space: pre-line;
    margin: 0 0 18px;
  }

  .poem-card .card-src {
    font-size: 0.78rem;
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1px;
  }

  .poem-card .card-src:hover { color: var(--ember); border-color: var(--ember); }

  /* ---------- LECTOR DE POEMAS ---------- */

  dialog.reader {
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink);
    padding: 0;
    width: min(680px, calc(100vw - 24px));
    max-height: calc(100vh - 32px);
    border-radius: 6px;
    box-shadow: 0 24px 60px rgba(21, 22, 27, 0.25);
  }

  dialog.reader::backdrop { background: rgba(21, 22, 27, 0.55); }

  .reader-inner {
    padding: clamp(28px, 5vw, 52px);
    overflow-y: auto;
    max-height: calc(100vh - 34px);
  }

  .reader-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: 0;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--ink-soft);
    cursor: pointer;
    padding: 6px 10px;
  }

  .reader-close:hover, .reader-close:focus-visible { color: var(--ember); }

  .reader-date {
    font-size: 0.75rem;
    color: var(--ink-soft);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0 0 10px;
  }

  .reader h3 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    line-height: 1.15;
    margin: 0 0 26px;
  }

  .reader-text {
    font-family: var(--font-display);
    font-size: 1.08rem;
    line-height: 1.75;
    white-space: pre-line;
    margin: 0 0 30px;
  }

  .reader-src {
    font-size: 0.82rem;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    padding-bottom: 2px;
  }

  .reader-src:hover { color: var(--ember); border-color: var(--ember); }

  @media (max-width: 760px) {
    .poem-row { grid-template-columns: repeat(2, 1fr); }
    .poem-stone:nth-child(5) { grid-column: 1 / -1; }
    .about-grid { grid-template-columns: 1fr; }
    .nav-links { font-size: 0.8rem; gap: 14px; }
  }

  @media (max-width: 480px) {
    .poem-row { grid-template-columns: 1fr; }
    .poem-stone:nth-child(5) { grid-column: auto; }
  }

  @media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
  }

  /* ---------- INTERACCIÓN (patrón tomado de electrotest) ---------- */

  :focus-visible {
    outline: 2px solid var(--ember);
    outline-offset: 3px;
  }

  .skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 40;
    background: var(--ink);
    color: var(--bg);
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 0.85rem;
    transform: translateY(-160%);
    transition: transform 0.2s ease;
  }

  .skip-link:focus { transform: none; }

  .scroll-progress {
    position: fixed;
    inset: 0 0 auto;
    height: 3px;
    z-index: 30;
    background: var(--ember);
    transform: scaleX(0);
    transform-origin: 0 50%;
    pointer-events: none;
  }

  nav[data-scrolled="true"] {
    background: rgba(237, 241, 246, 0.98);
    box-shadow: 0 1px 12px rgba(21, 22, 27, 0.08);
  }

  .nav-links a[aria-current="true"] {
    color: var(--ink);
    border-color: var(--ember);
  }

  .scroll-top {
    position: fixed;
    right: max(18px, env(safe-area-inset-right, 0px));
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
    z-index: 25;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--bg);
    color: var(--ink);
    cursor: pointer;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, color 0.15s ease;
  }

  .scroll-top svg { width: 18px; height: 18px; }
  .scroll-top:hover { color: var(--ember); }

  .scroll-top[data-visible="true"] {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  /* Revelado al entrar en pantalla: sólo si hay JS (si falla, todo se ve) */
  .js [data-reveal],
  .js [data-reveal-group] > [data-reveal] {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.8s cubic-bezier(.22,.61,.36,1), transform 0.8s cubic-bezier(.22,.61,.36,1);
    transition-delay: var(--reveal-delay, 0s);
  }

  .js [data-reveal].is-visible {
    opacity: 1;
    transform: none;
  }

  .js [data-hero-item] {
    animation: hero-in 1s cubic-bezier(.22,.61,.36,1) both;
  }

  .js [data-hero-item]:nth-child(2) { animation-delay: 0.14s; }
  .js [data-hero-item]:nth-child(3) { animation-delay: 0.28s; }

  @keyframes hero-in {
    from { opacity: 0; transform: translateY(32px); }
    to { opacity: 1; transform: none; }
  }

  .js .hero-media img {
    opacity: 0;
    transition: opacity 0.9s ease;
  }

  .js .hero-media img.is-loaded { opacity: 1; }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .js [data-reveal],
    .js [data-reveal-group] > [data-reveal],
    .js .hero-media img { opacity: 1 !important; transform: none !important; transition: none !important; }
    .js [data-hero-item] { animation: none; }
  }

  /* ---------- IMÁGENES DE LOS POEMAS ---------- */
  .poem-card .card-img {
    display: block;
    width: 100%;
    max-height: 340px;
    object-fit: cover;
    border-radius: 4px;
    margin: 0 0 18px;
    background: var(--bg);
  }

  .reader-img {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    border-radius: 4px;
    margin: 0 0 22px;
  }

  /* ---------- BOTÓN INGRESAR (acceso al panel) ---------- */
  .nav-links { align-items: center; }

  .nav-links a.nav-login {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--ink);
    border: 1px solid var(--ink-soft);
    border-radius: 99px;
    padding: 6px 14px 6px 11px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }

  .nav-links a.nav-login svg { width: 16px; height: 16px; flex-shrink: 0; }

  .nav-links a.nav-login:hover,
  .nav-links a.nav-login:focus-visible {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
  }

  @media (max-width: 480px) {
    /* En pantallas muy chicas queda solo el ícono (el nombre sigue en aria-label) */
    .nav-links a.nav-login { padding: 7px; }
    .nav-links a.nav-login span { display: none; }
    .nav-links { gap: 12px; }
  }

  @media (max-width: 480px) {
    /* El menú tiene que entrar en una sola fila: el nombre se parte en dos líneas y los enlaces se ajustan */
    .nav-inner { gap: 10px; }
    .brand { white-space: normal; line-height: 1.12; font-size: 0.95rem; max-width: 112px; }
    .brand span { white-space: nowrap; }
    .nav-links { gap: 10px; font-size: 0.76rem; }
  }

  @media (max-width: 360px) {
    .nav-links a[href="#sobre"] { display: none; }
  }
