/* =========================================================
   Nuestra historia · 40 aniversario (página /historia y formulario /historia/comparte)
   Mismos colores y letras que el resto de la web: granate, azul marino y el oro como acento.
   ========================================================= */

.hx { --hx-azul-2: #1B2B50; --hx-azul-3: #0E1830; --hx-index-h: 56px; }
.hx section[id], .hx header[id] { scroll-margin-top: calc(var(--nav-h) + var(--hx-index-h) + 8px); }
.hx-pill-icon { gap: 10px; }
.hx-pill-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pill--outline.hx-on-light { border-color: var(--azul); color: var(--azul); }
.hx-kicker { display: inline-block; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 14px; color: var(--oro); }
.hx-kicker--dark { color: var(--granate); }

/* ---------- Cabecera ---------- */
.hx-hero { position: relative; overflow: hidden; background: var(--azul); color: var(--blanco); }
.hx-hero::before { content: '40'; position: absolute; right: -2vw; bottom: -0.18em; font-family: var(--display); font-weight: 900;
  font-size: clamp(260px, 40vw, 620px); line-height: 1; color: transparent; -webkit-text-stroke: 2px rgba(255,255,255,.07); pointer-events: none; }
.hx-hero__inner { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr); gap: 48px; align-items: center;
  padding-top: clamp(48px, 7vw, 96px); padding-bottom: clamp(72px, 9vw, 120px); }
.hx-crumbs { display: flex; gap: 10px; align-items: center; font-size: 15px; color: rgba(255,255,255,.62); margin-bottom: 18px; }
.hx-crumbs a { color: rgba(255,255,255,.75); text-decoration: none; }
.hx-crumbs a:hover { color: var(--blanco); }
.hx-hero h1 { font-family: var(--display); font-weight: 900; font-size: clamp(64px, 10vw, 150px); line-height: .84; margin: 12px 0 26px; letter-spacing: -.005em; }
.hx-hero h1 span { color: var(--oro); }
.hx-hero__lead { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.55; color: #C9CFDD; max-width: 58ch; }
.hx-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hx-hero__logo { justify-self: end; width: min(360px, 100%); height: auto; filter: drop-shadow(0 18px 30px rgba(0,0,0,.35)); }
.hx-hero__court { position: absolute; left: 0; right: 0; bottom: 0; height: 26px; border-top: 3px solid var(--naranja); opacity: .9; }
.hx-hero__court::before { content: ''; position: absolute; left: 50%; top: -3px; width: 220px; height: 110px; transform: translate(-50%, -100%);
  border: 3px solid var(--naranja); border-bottom: 0; border-radius: 110px 110px 0 0; opacity: .35; }

/* Fotos destacadas en la cabecera, como polaroids */
.hx-polaroids { position: relative; justify-self: end; width: min(440px, 100%); aspect-ratio: 1 / 1.02; }
.hx-polaroid { position: absolute; width: 62%; padding: 10px 10px 40px; background: #FBF8F1; border: 0; border-radius: 4px; cursor: zoom-in;
  box-shadow: 0 20px 40px rgba(0,0,0,.4); transition: transform .25s ease; }
.hx-polaroid img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 2px; }
.hx-polaroid span { position: absolute; left: 12px; right: 12px; bottom: 10px; font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--azul);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.hx-polaroid:nth-child(1) { left: 0; top: 6%; transform: rotate(-7deg); z-index: 1; }
.hx-polaroid:nth-child(2) { right: 0; top: 0; transform: rotate(5deg); z-index: 2; }
.hx-polaroid:nth-child(3) { left: 20%; bottom: 0; transform: rotate(-1.5deg); z-index: 3; }
.hx-polaroids--1 .hx-polaroid { left: 12%; top: 10%; width: 76%; transform: rotate(-3deg); }
.hx-polaroids--2 .hx-polaroid:nth-child(2) { top: 26%; }
.hx-polaroid:hover, .hx-polaroid:focus-visible { transform: rotate(0deg) scale(1.03); z-index: 5; }

/* ---------- Índice fijo ---------- */
.hx-index { position: sticky; top: var(--nav-h); z-index: 40; background: #0E1830; color: var(--blanco); border-top: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.hx-index__inner { display: flex; align-items: center; gap: 12px; min-height: var(--hx-index-h); }
.hx-index ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0;
  -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); }
.hx-index ul::-webkit-scrollbar { display: none; }
.hx-index a { display: block; white-space: nowrap; padding: 10px 14px; border-radius: 999px; color: rgba(255,255,255,.72); text-decoration: none; font-weight: 600; font-size: 15px; }
.hx-index a:hover { color: var(--blanco); background: rgba(255,255,255,.08); }
.hx-index a[aria-current="true"] { color: var(--azul); background: var(--oro); }
.hx-index a small { font-size: 12px; opacity: .75; margin-left: 2px; }
.hx-index__cta { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: var(--granate);
  color: var(--blanco) !important; font-weight: 700; font-size: 15px; text-decoration: none; border: 1.5px solid rgba(255,255,255,.18); }
.hx-index__cta:hover { background: var(--granate-osc); }
.hx-index__cta svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Cifras ---------- */
.hx-stats { background: var(--granate); color: var(--blanco); }
.hx-stats__grid { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); }
.hx-stats__grid--1 { --n: 1; } .hx-stats__grid--2 { --n: 2; } .hx-stats__grid--3 { --n: 3; } .hx-stats__grid--4 { --n: 4; }
.hx-stat { padding: 34px 26px 32px; border-left: 1px solid rgba(255,255,255,.16); display: flex; flex-direction: column; gap: 8px; }
.hx-stat:first-child { border-left: 0; padding-left: 0; }
.hx-stat b { font-family: var(--display); font-weight: 900; font-size: clamp(48px, 5.4vw, 76px); line-height: .9; color: var(--oro); }
.hx-stat span { font-weight: 600; font-size: 16px; line-height: 1.35; color: var(--rosa); max-width: 26ch; }

/* ---------- Capítulos ---------- */
.hx-ch { background: var(--fondo); padding: clamp(64px, 8vw, 112px) 0; border-bottom: 1px solid var(--linea); }
.hx-ch + .hx-ch:not(.hx-ch--dark) { background: var(--blanco); }
.hx-ch--dark + .hx-ch:not(.hx-ch--dark) { background: var(--fondo); }
.hx-ch__inner { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(28px, 5vw, 80px); }
.hx-ch__side { display: flex; flex-direction: column; gap: 14px; }
.hx-ch__num { font-family: var(--display); font-weight: 900; font-size: clamp(88px, 10vw, 140px); line-height: .8; color: transparent; -webkit-text-stroke: 2px var(--granate); }
.hx-ch__when { font-weight: 700; color: var(--naranja); letter-spacing: .08em; text-transform: uppercase; font-size: 14px; }
.hx-ch h2 { font-family: var(--display); font-weight: 900; font-size: clamp(44px, 5.4vw, 76px); line-height: .92; margin-bottom: 26px; max-width: 18ch; text-wrap: balance; }
.hx-prose { max-width: 860px; }
.hx-prose > p { max-width: 68ch; }
.hx-prose strong { color: var(--granate); }
.hx-prose blockquote { font-style: italic; font-size: 21px; max-width: 60ch; margin-top: 1.6em; }
.hx-prose blockquote em { display: block; font-style: normal; font-size: 15px; font-weight: 600; margin-top: 8px; opacity: .75; }
.hx-ch .prose > .cba-wide { width: auto; }

.hx-ch--dark { background: var(--azul); color: var(--blanco); border-bottom: 0; }
.hx-ch--dark .hx-ch__num { -webkit-text-stroke-color: var(--oro); }
.hx-ch--dark .hx-ch__when { color: var(--oro); }
.hx-ch--dark .hx-prose { color: rgba(255,255,255,.88); }
.hx-ch--dark .hx-prose strong { color: var(--blanco); }
.hx-ch--dark .hx-prose a { color: var(--oro); }

/* Fotos del álbum en el capítulo */
.hx-ch__photos { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 34px; }
.hx-ch__photo { width: 132px; aspect-ratio: 1 / 1; padding: 6px; background: #FBF8F1; border: 0; border-radius: 4px; cursor: zoom-in;
  box-shadow: 0 8px 20px rgba(19,33,63,.18); transform: rotate(-2deg); transition: transform .2s; }
.hx-ch__photo:nth-child(even) { transform: rotate(2deg); }
.hx-ch__photo:hover, .hx-ch__photo:focus-visible { transform: rotate(0) scale(1.05); }
.hx-ch__photo img { width: 100%; height: 100% !important; object-fit: cover; border-radius: 2px; }
.hx-ch__more { font-weight: 700; margin-left: 6px; }
.hx-ch--dark .hx-ch__more { color: var(--oro); }

/* ---------- Cronología ---------- */
.hx-time { background: var(--hx-azul-3); color: var(--blanco); padding: clamp(64px, 8vw, 112px) 0; }
.hx-time__head { margin-bottom: 44px; }
.hx-time h2 { font-family: var(--display); font-weight: 900; font-size: clamp(48px, 6vw, 88px); line-height: .9; }
.hx-time__head p { color: #AEB8CF; margin-top: 12px; font-size: 18px; }
.hx-tl { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 64px; }
.hx-tl li { position: relative; break-inside: avoid; padding: 0 0 28px 32px; border-left: 2px solid rgba(255,255,255,.14); }
.hx-tl li::before { content: ''; position: absolute; left: -8px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--hx-azul-3); border: 2px solid var(--oro); }
.hx-tl li.is-big::before { background: var(--oro); box-shadow: 0 0 0 5px rgba(242,179,61,.18); }
.hx-tl time { display: block; font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.05; color: var(--oro); }
.hx-tl span { display: block; color: rgba(255,255,255,.86); margin-top: 4px; }
.hx-tl li.is-big span { color: var(--blanco); font-weight: 600; }

/* ---------- Álbum ---------- */
.hx-album { background: var(--blanco); padding: clamp(64px, 8vw, 112px) 0; }
.hx-album__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.hx-album__head h2 { font-family: var(--display); font-weight: 900; font-size: clamp(48px, 6vw, 88px); line-height: .9; margin: 10px 0 14px; }
.hx-album__head p { max-width: 62ch; color: var(--suave); font-size: 18px; }
.hx-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.hx-filters button { min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--linea); background: var(--blanco); color: var(--azul);
  font-weight: 700; font-size: 15px; cursor: pointer; }
.hx-filters button small { font-weight: 600; opacity: .6; margin-left: 4px; }
.hx-filters button:hover { border-color: var(--azul); }
.hx-filters button[aria-pressed="true"] { background: var(--azul); border-color: var(--azul); color: var(--blanco); }
.hx-grid { columns: 4 250px; column-gap: 18px; }
.hx-card { break-inside: avoid; margin: 0 0 18px; background: var(--fondo); border-radius: 14px; overflow: hidden; }
.hx-card[hidden] { display: none; }
.hx-card button { display: block; width: 100%; padding: 0; border: 0; background: #DDD8DC; cursor: zoom-in; }
.hx-card img { width: 100%; height: auto; transition: transform .35s ease, filter .35s; }
.hx-card button:hover img { transform: scale(1.03); }
.hx-card figcaption { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; }
.hx-card strong { font-size: 16px; line-height: 1.3; }
.hx-card span { font-size: 14px; color: var(--suave); }

.hx-empty { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: center; padding: 40px; border-radius: 24px;
  background: var(--fondo); border: 2px dashed var(--linea); }
.hx-empty h3 { font-family: var(--display); font-weight: 800; font-size: 36px; line-height: 1; margin-bottom: 10px; }
.hx-empty p { color: var(--suave); max-width: 56ch; margin-bottom: 22px; }
.hx-empty__frames { position: relative; height: 180px; }
.hx-empty__frames span { position: absolute; width: 120px; height: 140px; background: #FBF8F1; border-radius: 4px; box-shadow: 0 10px 24px rgba(19,33,63,.16); }
.hx-empty__frames span::before { content: ''; position: absolute; inset: 8px 8px 30px; background: linear-gradient(160deg, var(--rosa), var(--rosa-2)); border-radius: 2px; }
.hx-empty__frames span:nth-child(1) { left: 0; top: 18px; transform: rotate(-9deg); }
.hx-empty__frames span:nth-child(2) { left: 50px; top: 0; transform: rotate(4deg); }
.hx-empty__frames span:nth-child(3) { left: 90px; top: 30px; transform: rotate(11deg); }
.hx-empty__frames span:nth-child(3)::before { background: linear-gradient(160deg, #F7DCA4, var(--oro)); }

/* ---------- Llamada final ---------- */
.hx-cta { position: relative; overflow: hidden; background: var(--granate); color: var(--blanco); }
.hx-cta::after { content: ''; position: absolute; right: -110px; top: 50%; width: 420px; height: 420px; transform: translateY(-50%);
  background: url('../img/escudo-clasico.png') center / contain no-repeat; opacity: .05; filter: grayscale(1) brightness(2); pointer-events: none; }
.hx-cta__inner { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 32px; padding-top: 72px; padding-bottom: 72px; }
.hx-cta h2 { font-family: var(--display); font-weight: 900; font-size: clamp(40px, 4.6vw, 68px); line-height: .92; max-width: 22ch; }
.hx-cta p { color: var(--rosa); font-size: 18px; max-width: 58ch; margin-top: 14px; }
.hx-cta__text { flex: 1 1 520px; }
.hx-cta__actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.hx-cta__actions .pill { min-height: 60px; padding: 16px 30px; font-size: 18px; }
.hx-cta__actions > span { font-size: 15px; color: var(--rosa); }

/* ---------- Visor de fotos ---------- */
.hx-viewer { position: fixed; inset: 0; z-index: 200; background: rgba(10,14,26,.94); display: grid; grid-template-columns: 72px minmax(0, 1fr) 72px; align-items: center; color: var(--blanco); }
.hx-viewer[hidden] { display: none; }
.hx-viewer__fig { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: center; max-height: 100svh; padding: 40px 0; }
.hx-viewer__fig img { max-width: 100%; max-height: calc(100svh - 80px); margin: 0 auto; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.hx-viewer figcaption { display: flex; flex-direction: column; gap: 8px; align-self: center; }
.hx-viewer__count { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--oro); font-weight: 700; }
.hx-viewer figcaption strong { font-family: var(--display); font-weight: 800; font-size: 32px; line-height: 1; }
.hx-viewer__meta { color: #C9CFDD; font-weight: 600; }
.hx-viewer__story { color: rgba(255,255,255,.86); line-height: 1.55; white-space: pre-line; max-height: 40svh; overflow: auto; }
.hx-viewer__credit { font-size: 14px; color: #AEB8CF; }
.hx-viewer__close { position: absolute; top: 14px; right: 18px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12);
  color: var(--blanco); font-size: 30px; line-height: 1; cursor: pointer; }
.hx-viewer__nav { justify-self: center; width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: var(--blanco); cursor: pointer; }
.hx-viewer__nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.hx-viewer__close:hover, .hx-viewer__nav:hover { background: var(--oro); color: var(--azul); }
.hx-viewer__nav[disabled] { visibility: hidden; }
body.hx-noscroll { overflow: hidden; }

/* ---------- Bloques del editor dentro de un capítulo oscuro ---------- */
.hx-ch--dark .cba-score { background: var(--hx-azul-2); }
.hx-ch--dark .cba-steps li { border-top-color: rgba(255,255,255,.14); }
.hx-ch--dark .cba-steps b { color: var(--oro); }
.hx-ch--dark .cba-moments--granate .cba-moment { background: var(--hx-azul-2); color: var(--blanco); border-color: rgba(255,255,255,.1); }
.hx-ch--dark .cba-moments--granate .cba-moment small { color: var(--oro); }
.hx-ch--dark .cba-moments--granate .cba-moment b { color: var(--blanco); }
.hx-ch--dark .cba-moments--granate .cba-moment p { color: #C9CFDD; }

/* ---------- Formulario /historia/comparte ---------- */
.hx-drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 20px; text-align: center; cursor: pointer;
  border: 2px dashed #C9C3CC; border-radius: 18px; background: #FAF8F9; transition: border-color .15s, background .15s; }
.hx-drop:hover, .hx-drop.is-over { border-color: var(--granate); background: #FBF2F4; }
.hx-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.hx-drop svg { width: 44px; height: 44px; fill: none; stroke: var(--granate); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hx-drop strong { font-size: 18px; }
.hx-drop small { color: var(--suave); }
.hx-drop.is-bad { border-color: #B3261E; }
.hx-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 14px; }
.hx-thumbs:empty { display: none; }
.hx-thumb { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: #EEE9EC; }
.hx-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hx-thumb button { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(19,33,63,.82); color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer; }
.hx-thumb button:hover { background: #B3261E; }
.hx-thumb span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; font-size: 12px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-progress { height: 8px; border-radius: 999px; background: #EEE9EC; overflow: hidden; margin-top: 14px; }
.hx-progress span { display: block; height: 100%; width: 0; background: var(--granate); transition: width .2s; }
.hx-tips { margin-top: 26px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.14); }
.hx-tips h3 { font-family: var(--display); font-weight: 800; font-size: 24px; margin-bottom: 10px; }
.hx-tips ul { margin: 0; padding-left: 1.1em; color: #C9CFDD; font-size: 15px; line-height: 1.5; }
.hx-tips li + li { margin-top: 6px; }
.hx-back { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 18px; }

/* ---------- Móvil ---------- */
@media (max-width: 1100px) {
  .hx { --hx-index-h: 52px; }
  .hx-viewer { grid-template-columns: 48px minmax(0, 1fr) 48px; }
  .hx-viewer__fig { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 64px 0 24px; overflow: auto; }
  .hx-viewer__fig img { max-height: 62svh; }
  .hx-viewer figcaption { padding: 0 4px; }
  .hx-viewer__nav { width: 40px; height: 40px; }
}
@media (max-width: 900px) {
  .hx-hero__inner { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .hx-hero__logo { justify-self: start; width: 190px; order: -1; }
  .hx-polaroids { justify-self: center; width: min(340px, 86%); margin-bottom: 10px; }
  .hx-stats__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hx-stat { padding: 26px 18px; }
  .hx-stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .hx-stat:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,.16); }
  .hx-ch__inner { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .hx-ch__side { flex-direction: row; align-items: flex-end; gap: 16px; }
  .hx-ch__num { font-size: 72px; }
  .hx-ch__when { padding-bottom: 6px; }
  .hx-tl { columns: 1; }
  .hx-empty { grid-template-columns: minmax(0, 1fr); padding: 28px; gap: 20px; }
  .hx-index__cta span { display: none; }
  .hx-index__cta { padding: 10px; }
}
@media (max-width: 560px) {
  .hx-stat { padding: 20px 12px; }
  .hx-stat:nth-child(odd) { padding-left: 0; }
  .hx-stat b { font-size: 44px; }
  .hx-stat span { font-size: 14px; }
  .hx-hero__actions .pill { width: 100%; }
  .hx-grid { columns: 2 150px; column-gap: 12px; }
  .hx-card { margin-bottom: 12px; }
  .hx-card figcaption { padding: 10px; }
  .hx-card strong { font-size: 14px; }
  .hx-card span { font-size: 13px; }
  .hx-ch__photo { width: calc(50% - 8px); }
}
@media (prefers-reduced-motion: reduce) {
  .hx-polaroid, .hx-ch__photo, .hx-card img { transition: none !important; }
}
