/* ==========================================================================
   CAFEX — Base compartida
   1. Normalize  2. Tokens  3. Fuentes  4. Base global  5. Temas de página
   6. Shell de subpágina  7. Componentes compartidos  8. Animaciones  9. A11y
   ========================================================================== */

/* Transición nativa entre navegaciones multi-página (Chrome/Edge). Degrada
   sin efecto en navegadores que no la soportan. */
@view-transition {
  navigation: auto;
}

/* --- 1. Normalize (modern-normalize v3.0.1, recortado) -------------------- */

*,
::before,
::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
}

b,
strong {
  font-weight: bolder;
}

small {
  font-size: 80%;
}

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

table {
  border-color: currentcolor;
}

button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
}

button,
[type='button'],
[type='reset'],
[type='submit'] {
  -webkit-appearance: button;
  appearance: button;
}

summary {
  display: list-item;
}

ul {
  list-style: none;
}

img,
svg {
  max-width: 100%;
}

/* --- 2. Tokens ------------------------------------------------------------ */

:root {
  --page-bg: #0b312c;
  --page-bg-deep: #082a24;
  --page-surface: #0e342f;
  --page-surface-strong: #dd6827;
  --page-surface-soft: #e8e9db;
  --page-accent: #dd6827;
  --page-accent-soft: #de6929;
  --page-text: #ffffff;
  --page-text-dark: #1f291d;
  --page-cream: #eaebdd;
  --page-dark: #03251f;
  --page-blue: #26427f;
  --page-olive: #8ba547;
  --font-brand: 'Arquitecta', sans-serif;
  --viewport-block: 100vh;

  /* Color por salón: mismo código en todas las páginas (programa,
     expositores, salones) para que el usuario identifique el lugar de un
     vistazo sin importar en qué página esté. */
  --venue-presidentes: var(--page-accent);
  --venue-oro: var(--page-olive);
  --venue-pergamino: #7b9be0;
  --venue-tazza: #d7a53f;
  --venue-catacion: #4fb6a8;
}

@supports (height: 100svh) {
  :root {
    --viewport-block: 100svh;
  }
}

/* --- 3. Fuentes ------------------------------------------------------------ */

@font-face {
  font-family: 'Arquitecta';
  src:
    url('../fonts/arquitecta/ArquitectaThin.woff2') format('woff2'),
    url('../fonts/arquitecta/ArquitectaThin.otf') format('opentype');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Arquitecta';
  src:
    url('../fonts/arquitecta/ArquitectaLight.woff2') format('woff2'),
    url('../fonts/arquitecta/ArquitectaLight.otf') format('opentype');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Arquitecta';
  src:
    url('../fonts/arquitecta/ArquitectaBook.woff2') format('woff2'),
    url('../fonts/arquitecta/ArquitectaBook.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Arquitecta';
  src:
    url('../fonts/arquitecta/Arquitecta.woff2') format('woff2'),
    url('../fonts/arquitecta/Arquitecta.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Arquitecta';
  src:
    url('../fonts/arquitecta/ArquitectaMedium.woff2') format('woff2'),
    url('../fonts/arquitecta/ArquitectaMedium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Arquitecta';
  src:
    url('../fonts/arquitecta/ArquitectaBold.woff2') format('woff2'),
    url('../fonts/arquitecta/ArquitectaBold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Arquitecta';
  src:
    url('../fonts/arquitecta/ArquitectaBlack.woff2') format('woff2'),
    url('../fonts/arquitecta/ArquitectaBlack.otf') format('opentype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Arquitecta';
  src:
    url('../fonts/arquitecta/ArquitectaHeavy.woff2') format('woff2'),
    url('../fonts/arquitecta/ArquitectaHeavy.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'festivoletters';
  src: url('../fonts/festivo/FESTIVOLETTERS.otf') format('opentype');
  font-weight: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gotham-book';
  src: url('../fonts/gotham/Gotham-Book.otf') format('opentype');
  font-weight: normal;
  font-display: swap;
}

/* --- 4. Base global --------------------------------------------------------- */

html {
  scrollbar-gutter: stable;
}

html,
body {
  height: 100%;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

/* Scrollbar translúcido, apenas perceptible */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 0;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.3);
  background-clip: padding-box;
}

body {
  font-family: var(--font-brand);
  background-color: var(--page-bg);
  color: var(--page-text);
}

/* --- 5. Temas de página ------------------------------------------------------
   Cada subpágina declara su tema en <body class="subpage page-*">. */

.page-wave {
  --page-surface: transparent;
  background-color: var(--page-bg);
}

.page-rooms {
  background-color: var(--page-accent);
}

.page-cream {
  --page-surface: var(--page-cream);
  background-color: var(--page-surface);
  color: var(--page-text-dark);
}

.page-cream .page-header h1 {
  color: var(--page-text-dark);
}

.page-dark {
  --page-surface: var(--page-dark);
  background-color: var(--page-surface);
}

.page-blue {
  --page-surface: var(--page-blue);
  background-color: var(--page-surface);
}

.page-olive {
  background-color: var(--page-olive);
}

/* --- 6. Shell de subpágina ---------------------------------------------------- */

.subpage main {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

.page-wave .wave-container {
  position: fixed;
  inset: 0;
  z-index: -1;
}

/* Scrim para que el contenido largo siga siendo legible sobre la ola
   decorativa del fondo (fixed, detrás del texto). Semitransparente: atenúa
   la ola lo justo para el contraste sin ocultarla del todo. */
.page-wave .wave-container::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(11, 49, 44, 0.78) 100%);
  pointer-events: none;
}

.page-container {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 40px 24px 30px;
  text-align: center;
}

.page-header h1 {
  font-family: var(--font-brand);
  font-weight: 600;
  font-size: 48px;
  color: var(--page-text);
  letter-spacing: 1px;
  line-height: 1.2;
  text-wrap: balance;
}

.page-header .page-subtitle {
  font-family: var(--font-brand);
  font-weight: 400;
  font-size: 24px;
  color: var(--page-text);
  letter-spacing: 2px;
  margin-top: -16px;
}

.page-header:not(:has(.logo-header)) h1 {
  margin-top: 40px;
}

.btn-back {
  position: absolute;
  top: 24px;
  left: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  text-decoration: none;
  transition: background 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-back:active {
  background: rgba(255, 255, 255, 0.2);
}

@media (hover: hover) {
  .btn-back:hover {
    background: rgba(255, 255, 255, 0.18);
  }

  .page-cream .btn-back:hover {
    background: rgba(0, 0, 0, 0.45);
  }
}

.btn-back svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
}

.page-cream .btn-back {
  background: rgba(0, 0, 0, 0.35);
}

.logo-header {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.page-content {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
  margin-bottom: 160px;
  width: 100%;
}

/* Tablet */
@media (min-width: 768px) {
  .page-header {
    padding: 60px 50px 40px;
    gap: 32px;
  }

  .page-header h1 {
    font-size: 56px;
  }

  .logo-header {
    width: 80px;
    height: 80px;
  }

  .btn-back {
    top: 40px;
    left: 40px;
    width: 48px;
    height: 48px;
  }

  .page-content {
    padding: 40px 50px;
    gap: 40px;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .page-header {
    padding: 80px 80px 50px;
    gap: 40px;
  }

  .page-header h1 {
    font-size: 64px;
  }

  .logo-header {
    width: 100px;
    height: 100px;
  }

  .btn-back {
    top: 50px;
    left: 50px;
    width: 56px;
    height: 56px;
  }

  .page-content {
    padding: 60px 80px;
    gap: 48px;
  }
}

/* --- 7. Componentes compartidos ------------------------------------------------ */

.wave-container {
  position: relative;
  width: 100%;
  height: var(--viewport-block);
  overflow: hidden;
  z-index: 0;
  display: flex;
  flex-direction: column;
  background-image: url('../images/backgrounds/background.svg');
  background-size: cover;
  background-position: bottom;
}

.main {
  position: absolute;
  width: 100%;
  height: var(--viewport-block);
}

/* --- 8. Animaciones compartidas -------------------------------------------------- */

/* Entrada por scroll: reveal.js observa .puff-in-top y agrega .is-revealed
   al entrar al viewport, con --reveal-delay escalonado por lote para que los
   elementos visibles al mismo tiempo entren en cascada. El movimiento es un
   fade + rise corto (ease-out expo): sutil, rápido y sin blur/escala.
   Sin JS (.no-js en <html>), el contenido queda visible de inmediato. */
.puff-in-top {
  opacity: 0;
  transform: translateY(18px);
}

.puff-in-top.is-revealed {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0s);
}

.no-js .puff-in-top {
  opacity: 1;
  transform: none;
}

/* --- 9. Accesibilidad -------------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.page-rooms :focus-visible,
.page-blue :focus-visible {
  outline-color: var(--page-text);
}

@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
