/* ==========================================================================
   Fundación UPTAK — Stylesheet
   Tokens de diseño, tipografía Antarctica y micro-ajustes editoriales
   (Complemento para Tailwind CSS)
   ========================================================================== */

/* ── Tipografía local Antarctica ────────────────────────────────────────── */
@font-face {
  font-family: 'Antarctica';
  src: url('../fonts/Antarctica-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Antarctica';
  src: url('../fonts/Antarctica-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Antarctica';
  src: url('../fonts/Antarctica-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens de diseño y escalado proporcional (1920 px Artboard) ────────── */
:root {
  --c-ink: #1d1c1a;
  --c-bone: #e8e8e2;
  --c-lime: #ddff01;
  --c-purple: #7e00ff;
  --c-magenta: #d118ff;
  --c-coral: #ff6759;
  --c-blue: #308bf4;
  --c-green: #5fcf9d;
  --c-white: #ffffff;
  --c-ink-55: rgba(29, 28, 26, 0.55);

  --font-sans: 'Antarctica', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --fw-regular: 400;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Escala tipográfica y espaciado Mobile */
  --fs-h0: min(22vw, 168px);
  --fs-num: 64px;
  --fs-h1: clamp(34px, 9.4vw, 48px);
  --fs-h1-alt: 34px;
  --fs-h2: 24px;
  --fs-h3: 20px;
  --fs-body: 16px;
  --fs-small: 14px;

  --margin: 24px;
  --bleed: 0px;
  --header-height: 64px;
  --gutter: 16px;
  --line: 2px;
  --hairline: 1px;
  --optical: -0.05em;
  --justify-squeeze: -0.04em;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 768px) {
  :root {
    --fs-h0: min(19vw, 220px);
    --fs-num: clamp(60px, 7vw, 84px);
    --fs-h1: clamp(44px, 5vw, 64px);
    --fs-h1-alt: clamp(34px, 3.8vw, 48px);
    --fs-h2: clamp(24px, 2.6vw, 32px);
    --fs-h3: clamp(19px, 2vw, 24px);
    --fs-body: 17px;
    --fs-small: 14px;
    --margin: clamp(40px, 5vw, 64px);
    --gutter: 24px;
    --header-height: 80px;
  }
}

/* Escalado proporcional Desktop (>= 1280px) */
@media (min-width: 1280px) {
  :root {
    --module-h: 961.5;
    --module-max: 900px;
    --header-h: 96;
    --u: min(
      100cqw / 1920,
      (var(--module-max) - 5px) / var(--module-h),
      (100svh - 5px) / (var(--module-h) + var(--header-h))
    );
    --header-height: calc(var(--header-h) * var(--u));
    --artboard: calc(1920 * var(--u));
    --bleed: max(0px, (100cqw - var(--artboard)) / 2);
    --fs-h0: calc(288 * var(--u));
    --fs-num: calc(120 * var(--u));
    --fs-h1: calc(96 * var(--u));
    --fs-h1-alt: calc(72 * var(--u));
    --fs-h2: calc(48 * var(--u));
    --fs-h3: calc(36 * var(--u));
    --fs-body: calc(24 * var(--u));
    --fs-small: max(13px, calc(18 * var(--u)));
    --margin: calc(var(--bleed) + 120 * var(--u));
    --gutter: calc(24 * var(--u));
  }
}

/* ── Reset básico y comportamiento global ────────────────────────────────── */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--header-height);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--c-ink);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  line-height: 1.2;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Contenedor principal con container queries (cqw) */
.page {
  container-type: inline-size;
  max-width: 2560px;
  margin-inline: auto;
  background: var(--c-bone);
  overflow-x: clip;
}

/* Hero con título en páginas interiores */
.hero--titled {
  --hero-extra: 158.9;
}

/* Sombra dinámica de cabecera fija controlada por JS */
.site-header {
  box-shadow: 0 var(--line) 0 transparent;
}
.site-header.is-scrolled {
  box-shadow: 0 var(--line) 0 var(--c-ink);
}

/* ── Micro-ajustes editoriales y tipográficos ────────────────────────────── */
.optical {
  margin-left: var(--optical);
}

@media (min-width: 1280px) {
  .title-band__title.optical {
    margin-left: 0;
  }
}

@media (min-width: 768px) {
  .justify {
    text-align: justify;
    text-wrap: wrap;
    hyphens: auto;
  }
}

@media (min-width: 1280px) {
  .justify {
    hyphens: manual;
    word-spacing: var(--justify-squeeze);
  }
}

.fl {
  display: inline;
}

.fl--always {
  display: block;
}

@media (min-width: 768px) {
  .fl--tablet {
    display: block;
  }
}

@media (min-width: 1280px) {
  .fl {
    display: block;
  }
  .justify .fl {
    text-align-last: justify;
  }
}

@media (max-width: 1279px) {
  h1, h2 {
    text-wrap: balance;
  }
  p {
    text-wrap: pretty;
  }
}

/* ── Checkbox personalizado accesible (con marca vectorial) ─────────────── */
.check__box {
  display: grid;
  place-content: center;
  width: 22px;
  height: 22px;
  margin: 0;
  background: transparent;
  border: var(--hairline) solid var(--c-ink);
  border-radius: 0;
  appearance: none;
  cursor: pointer;
  flex: none;
}

@media (min-width: 1280px) {
  .check__box {
    width: calc(25 * var(--u));
    height: calc(25 * var(--u));
  }
}

.check__box::before {
  content: "";
  width: 13px;
  height: 13px;
  background: var(--c-ink);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
  transform: scale(0);
  transition: transform 0.15s ease-in-out;
}

@media (min-width: 1280px) {
  .check__box::before {
    width: calc(15 * var(--u));
    height: calc(15 * var(--u));
  }
}

.check__box:checked::before {
  transform: scale(1);
}

.check__box:focus-visible {
  outline: 2px solid var(--c-ink);
  outline-offset: 2px;
}

/* ==========================================================================
   Animaciones editoriales y efectos de entrada
   ========================================================================== */
.reveal-words {
  display: contents;
}

.rw,
.rw__i {
  display: inline-block;
}

@media (prefers-reduced-motion: no-preference) {
  .reveal-lines .rw {
    clip-path: inset(-0.3em -0.2em -0.35em);
  }

  .reveal-lines .rw__i {
    transform: translateY(calc(100% + 0.5em));
  }

  .reveal-lines.in-view .rw__i,
  .in-view .reveal-lines .rw__i {
    transition: transform 1s var(--ease-out);
    transition-delay: calc(var(--reveal-delay, 0s) + var(--line, 0) * var(--reveal-stagger, 80ms));
    transform: none;
  }

  .hero .reveal-lines {
    --reveal-delay: 0.1s;
  }

  .hero__actions {
    --fade-delay: 0.45s;
  }

  .fade-up {
    opacity: 0;
    transform: translateY(0.75em);
  }

  .in-view .fade-up,
  .fade-up.in-view {
    opacity: 1;
    transition: opacity 0.7s ease var(--fade-delay, 0s), transform 0.9s var(--ease-out) var(--fade-delay, 0s);
    transform: none;
  }

  .key-figure__fill {
    transform-origin: 0;
    transform: scaleX(0);
  }

  .key-figure.in-view .key-figure__fill,
  .key-figure__fill.in-view {
    transition: transform 1.9s var(--ease-out) 0.15s;
    transform: none;
  }
}

/* ── Odómetro numérico de cifras (Roll) ─────────────────────────────────── */
.roll {
  position: relative;
}

.roll.is-rolling .roll__digit {
  color: transparent;
}

.roll__overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.roll__col {
  box-sizing: content-box;
  height: 1em;
  margin-left: -0.3em;
  padding: 0 0.3em;
  position: absolute;
  top: 0;
  overflow: hidden;
}

.roll__strip {
  white-space: pre;
  line-height: 1em;
  display: block;
}

.roll.is-playing .roll__strip {
  transform: translateY(calc(-1em * (var(--rows) - 1)));
  transition: transform var(--roll-duration) var(--ease-out) var(--roll-delay);
}

@media print {
  .rw__i,
  .fade-up,
  .key-figure__fill {
    opacity: 1 !important;
    transform: none !important;
  }
  .roll__overlay {
    display: none;
  }
  .roll .roll__digit {
    color: inherit !important;
  }
}

/* ── Formularios de descarga: validaciones y confirmación in-situ ────────── */
.download-form__status {
  transition: all 0.2s ease;
}

.download-form__status.is-error {
  border-left-color: #dc2626 !important;
  color: #b91c1c !important;
  background-color: rgba(254, 226, 226, 0.75) !important;
}

input[aria-invalid="true"] {
  border-color: #dc2626 !important;
  outline: 2px solid #dc2626 !important;
  outline-offset: -1px;
}

.check__box[aria-invalid="true"] {
  border-color: #dc2626 !important;
  outline: 2px solid #dc2626 !important;
  outline-offset: 2px;
}

.download-confirmation {
  width: 100%;
  animation: confirmationFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes confirmationFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Banner y Modal de Cookies (Estilo uptak.com) ────────────────────────── */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background-color: #1f1f1f;
  color: #e8e8e2;
  border-top: 2px solid #1d1c1a;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
  font-family: var(--font-sans);
  animation: cookieBannerSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cookieBannerSlideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.cookie-banner__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 860px) {
  .cookie-banner__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    gap: 24px;
  }
}

.cookie-banner__text {
  font-size: 13.5px;
  line-height: 1.45;
  color: #e8e8e2;
  margin: 0;
}

@media (min-width: 768px) {
  .cookie-banner__text {
    font-size: 14px;
    line-height: 1.5;
  }
}

.cookie-banner__text a {
  color: #ddff01;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.15s ease;
}

.cookie-banner__text a:hover {
  opacity: 0.85;
}

.cookie-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .cookie-banner__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .cookie-banner__actions .cookie-btn--settings {
    grid-column: span 2;
    text-align: center;
  }
}

/* Botones con el mismo peso visual según AEPD y diseño uptak.com */
.cookie-btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 16px;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.cookie-btn:focus-visible {
  outline: 2px solid #ddff01;
  outline-offset: 2px;
}

.cookie-btn--accept,
.cookie-btn--decline {
  background-color: #2b2b2b;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.cookie-btn--accept:hover,
.cookie-btn--decline:hover {
  background-color: #ffffff;
  color: #1d1c1a;
  border-color: #ffffff;
}

.cookie-btn--settings {
  background-color: transparent;
  color: #e8e8e2;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cookie-btn--settings:hover {
  color: #ddff01;
  border-color: #ddff01;
}

/* Modal de Preferencias de Cookies */
.cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: cookieModalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cookieModalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.cookie-modal__dialog {
  background-color: #1f1f1f;
  color: #e8e8e2;
  border: 2px solid #1d1c1a;
  border-radius: 4px;
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  font-family: var(--font-sans);
  overflow: hidden;
}

.cookie-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.cookie-modal__title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.cookie-modal__close {
  background: transparent;
  border: none;
  color: #e8e8e2;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.cookie-modal__close:hover {
  color: #ddff01;
  background-color: rgba(255, 255, 255, 0.08);
}

.cookie-modal__body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cookie-modal__intro {
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(232, 232, 226, 0.88);
  margin: 0;
}

.cookie-category {
  background-color: #282828;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cookie-category__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cookie-category__title {
  font-size: 14.5px;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
}

.cookie-category__badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  background-color: rgba(221, 255, 1, 0.15);
  color: #ddff01;
  border: 1px solid rgba(221, 255, 1, 0.4);
  border-radius: 2px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cookie-category__desc {
  font-size: 13px;
  line-height: 1.45;
  color: rgba(232, 232, 226, 0.8);
  margin: 0;
}

/* Switch toggle interactivo */
.cookie-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.cookie-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.cookie-switch__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #444444;
  transition: background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.cookie-switch__slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
}

.cookie-switch input:checked + .cookie-switch__slider {
  background-color: #ddff01;
  border-color: #ddff01;
}

.cookie-switch input:checked + .cookie-switch__slider::before {
  transform: translateX(20px);
  background-color: #1d1c1a;
}

.cookie-switch input:focus-visible + .cookie-switch__slider {
  outline: 2px solid #ddff01;
  outline-offset: 2px;
}

.cookie-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  background-color: #181818;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  .cookie-modal__footer {
    flex-direction: column;
    align-items: stretch;
  }
  .cookie-modal__footer .cookie-btn {
    width: 100%;
  }
}

/* ── Badge 40dB (SVG Oficial) ───────────────────────────────────────────── */
.badge-oval {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 7.4em;
  height: auto;
  color: var(--c-ink);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 1280px) {
  .badge-oval {
    width: calc(140.8 * var(--u));
  }
}

.badge-oval .badge-oval__bg {
  fill: transparent;
  transition: fill 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.badge-oval:hover {
  color: var(--c-lime);
}

.badge-oval:hover .badge-oval__bg {
  fill: var(--c-ink);
}

