:root {
  --fayenza: #62BFAD;
  --fayenza-oscura: #2E7A6D;
  --coral: #E87567;
  --piedra: #7F7A74;
  --piedra-texto: #6B665F;   /* piedra con contraste suficiente para texto pequeño */
  --arenisca: #E9E1D3;
  --arenisca-clara: #F1EBE0;
  --basalto: #24211F;
  --linea: rgba(36, 33, 31, .16);

  --display: 'DM Serif Display', Georgia, serif;
  --goudy: 'Sorts Mill Goudy', Georgia, serif;
  --util: 'Jost', system-ui, sans-serif;

  --ancho: 1240px;
  --lado: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { background: var(--arenisca); color: var(--basalto); font-family: var(--util); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, canvas { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

.display { font-family: var(--display); font-weight: 400; line-height: 1; letter-spacing: -.005em; }
.etiqueta { font-family: var(--util); font-weight: 600; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--piedra-texto); }
.o { position: relative; display: inline-block; }
.o::after { content: ''; position: absolute; left: 50%; top: 50%; width: .13em; height: .13em; background: var(--coral); transform: translate(-50%, -50%) rotate(45deg); }

/* ---------- Barra superior ---------- */
.barra { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px var(--lado); background: rgba(233, 225, 211, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--linea); }
.marca { display: flex; align-items: center; gap: 12px; text-decoration: none; font-size: 24px; }
.marca img { height: 35px; width: auto; }
.barra nav { display: flex; gap: clamp(14px, 3vw, 32px); }
.barra nav a { text-decoration: none; font-weight: 500; font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; }
.barra nav a:hover { border-color: var(--coral); }

/* ---------- Portada ---------- */
.portada, .seccion { max-width: var(--ancho); margin: 0 auto; padding-left: var(--lado); padding-right: var(--lado); }
.portada { padding-top: clamp(48px, 8vw, 96px); padding-bottom: 24px; }
.portada h1 { font-size: clamp(44px, 8vw, 104px); margin-top: 14px; max-width: 14ch; }
.entradilla { font-family: var(--goudy); font-size: clamp(19px, 2.2vw, 24px); line-height: 1.4; margin-top: 22px; max-width: 46ch; }
.datos { display: flex; flex-wrap: wrap; gap: 0; margin-top: 40px; border-top: 2px solid var(--basalto); }
.datos div { padding: 16px 32px 0 0; margin-right: 32px; }
.datos div + div { border-left: 2px solid var(--basalto); padding-left: 24px; }
.datos dt { font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--piedra-texto); }
.datos dd { font-family: var(--display); font-size: 28px; margin-top: 4px; }
@media (max-width: 640px) {
  .datos { display: grid; grid-template-columns: 1fr 1fr; }
  .datos div, .datos div + div { border-left: 0; padding: 16px 12px 0 0; margin: 0; }
  .datos dd { font-size: 22px; }
}

/* ---------- Secciones ---------- */
.seccion { padding-top: clamp(64px, 9vw, 112px); }
.cabecera-seccion { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; padding-bottom: 22px; margin-bottom: 28px; border-bottom: 2px solid var(--basalto); }
.cabecera-seccion h2 { font-size: clamp(36px, 5vw, 60px); margin-top: 8px; }
.nota { font-family: var(--goudy); font-style: italic; font-size: 18px; color: var(--piedra-texto); }

.boton { display: inline-flex; align-items: center; gap: 8px; background: var(--basalto); color: var(--arenisca); text-decoration: none; font-weight: 500; font-size: 15px; padding: 12px 22px; border-radius: 999px; border: 0; cursor: pointer; white-space: nowrap; }
.boton:hover { background: var(--fayenza-oscura); }
.boton.secundario { background: transparent; color: var(--basalto); box-shadow: inset 0 0 0 2px var(--basalto); }
.boton.secundario:hover { background: var(--basalto); color: var(--arenisca); }
.boton.pequeno { padding: 8px 16px; font-size: 14px; }
.redondo { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--basalto); color: var(--arenisca); font-size: 18px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.redondo:hover { background: var(--fayenza-oscura); }
.redondo:disabled { opacity: .3; cursor: default; }
.texto { border: 0; background: none; font: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; color: inherit; }
.pagina { font-variant-numeric: tabular-nums; font-weight: 500; min-width: 64px; text-align: center; }

/* ---------- Visor ---------- */
.visor { background: var(--basalto); border-radius: 18px; padding: clamp(10px, 2vw, 22px); }
.lienzo { position: relative; display: flex; align-items: center; justify-content: center; min-height: 200px; }
canvas[hidden] { display: none; }
.lienzo canvas { border-radius: 4px; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .6); background: #fff; }
.lienzo .estado { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; color: var(--arenisca); font-family: var(--goudy); font-style: italic; font-size: 20px; }
.lienzo .estado[hidden] { display: none; }
.visor-dossier .lienzo { aspect-ratio: 16 / 9; min-height: 0; width: 100%; }
.visor .controles { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; color: var(--arenisca); }
.visor .controles .texto { margin-left: 12px; }
.visor .controles .redondo { background: var(--arenisca); color: var(--basalto); }
.visor .controles .redondo:hover { background: var(--fayenza); }

.tira { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 16px; }
.tira button { width: 100%; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 2px transparent; transition: box-shadow .15s; }
.tira button[aria-current="true"] { box-shadow: 0 0 0 3px var(--coral); }
.tira img { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; }

/* ---------- Tarjetas ---------- */
.rejilla { display: grid; gap: 28px 24px; }
.rejilla-imprenta { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.rejilla-redes { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tarjeta { display: flex; flex-direction: column; }
.tarjeta .miniatura { position: relative; display: flex; align-items: center; justify-content: center; background: var(--arenisca-clara); border-radius: 14px; padding: 18px; aspect-ratio: 1; border: 0; cursor: zoom-in; width: 100%; overflow: hidden; }
.tarjeta .miniatura img { max-height: 100%; object-fit: contain; border-radius: 3px; box-shadow: 0 14px 30px -16px rgba(36, 33, 31, .55); transition: transform .2s ease; }
.tarjeta .miniatura:hover img { transform: translateY(-3px); }
.rejilla-redes .miniatura { aspect-ratio: 4 / 5; padding: 14px; }
.tarjeta h3 { font-family: var(--util); font-weight: 500; font-size: 16px; margin-top: 14px; line-height: 1.3; }
.tarjeta .meta { font-size: 13px; color: var(--piedra-texto); margin-top: 2px; }
.tarjeta .acciones { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.filtros { display: flex; flex-wrap: wrap; gap: 8px; }
.filtros button { font: inherit; font-size: 14px; font-weight: 500; border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer; background: transparent; box-shadow: inset 0 0 0 1.5px var(--linea); color: var(--basalto); }
.filtros button[aria-selected="true"] { background: var(--basalto); color: var(--arenisca); box-shadow: none; }

/* ---------- Patrocinadores y pie ---------- */
.patrocinadores .logos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-top: 18px; }
.patrocinadores .logos div { aspect-ratio: 3 / 2; border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 12px; }
.patrocinadores .logos img { max-height: 100%; object-fit: contain; }
.pie { margin-top: clamp(80px, 10vw, 128px); background: var(--basalto); color: var(--arenisca); padding: 48px var(--lado); }
.pie .dentro { max-width: var(--ancho); margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; align-items: flex-end; }
.pie .display { font-size: 40px; }
.pie p { color: #C9C1B5; }
.pie a { color: var(--fayenza); }

/* ---------- Modal ---------- */
.modal { border: 0; padding: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: #171513; color: var(--arenisca); }
.modal::backdrop { background: rgba(23, 21, 19, .9); }
.modal[open] { display: flex; flex-direction: column; }
.modal-barra { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px var(--lado); border-bottom: 1px solid rgba(233, 225, 211, .14); }
.modal-barra h3 { font-family: var(--display); font-weight: 400; font-size: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-acciones { display: flex; align-items: center; gap: 12px; flex: none; }
.modal .boton { background: var(--arenisca); color: var(--basalto); }
.modal .boton:hover { background: var(--fayenza); }
.modal .redondo { background: rgba(233, 225, 211, .12); color: var(--arenisca); }
.modal .redondo:hover { background: rgba(233, 225, 211, .25); }
.modal-cuerpo { position: relative; flex: 1; min-height: 0; padding: 20px clamp(16px, 7vw, 88px); }
.modal-cuerpo .lienzo { height: 100%; }
.modal-cuerpo img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.modal-cuerpo img[hidden], .modal-cuerpo canvas[hidden], .flecha[hidden] { display: none; }
.flecha { position: absolute; top: 50%; transform: translateY(-50%); }
.flecha.izq { left: 16px; } .flecha.der { right: 16px; }
@media (max-width: 640px) {
  .flecha { top: auto; bottom: 16px; transform: none; }
  .modal-cuerpo { padding-bottom: 76px; }
  .modal-acciones .pagina { display: none; }
  .marca span { display: none; }
  .tira { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .visor .controles { gap: 10px; }
}
