:root {
  color-scheme: light dark;
  --bg: #fbfbf9;
  --fg: #14161a;
  --muted: #6b7078;
  --line: #e2e2dd;
  --accent: #9c3f22;
  --accent-fg: #ffffff;
  --stage: #f4f4f0;
  --stage-line: #e6e6e0;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f10;
    --fg: #f2f2ef;
    --muted: #9aa0a6;
    --line: #26282b;
    --accent: #d4704a;
    --accent-fg: #14161a;
    --stage: #16181a;
    --stage-line: #24272a;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  min-height: 100svh;
  max-width: 78rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1.25rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 5vh, 3.5rem);
}

/* Marca ------------------------------------------------------------- */

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand__mark { font-weight: 650; letter-spacing: 0.22em; }

.brand__divider {
  width: 2.5rem;
  height: 1px;
  background: var(--line);
}

.brand__label { color: var(--muted); }

/* Titular ----------------------------------------------------------- */

.hero { max-width: 46rem; }

.hero__title {
  margin: 0;
  font-size: clamp(2.1rem, 7vw, 4.4rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.hero__title em {
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
}

.hero__lead {
  margin: clamp(1.25rem, 3vh, 1.75rem) 0 0;
  max-width: 34rem;
  font-size: clamp(0.95rem, 1.7vw, 1.0625rem);
  line-height: 1.7;
  color: var(--muted);
}

.hero__action {
  margin-top: clamp(1.75rem, 4vh, 2.5rem);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0 1.75rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.95rem;
  font-weight: 550;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: transform 160ms ease, opacity 160ms ease;
}

.button:hover { opacity: 0.9; }
.button:active { transform: scale(0.985); }

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

.button__note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.button[aria-disabled="true"] {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
  pointer-events: none;
}

/* Escenario de letras ----------------------------------------------- */

.stage { flex: 1 1 auto; display: flex; }

.stage__frame {
  flex: 1 1 auto;
  min-height: clamp(11rem, 26vh, 18rem);
  border: 1px solid var(--stage-line);
  border-radius: 1.25rem;
  background: var(--stage);
  overflow: hidden;
}

.gravity {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: clamp(11rem, 26vh, 18rem);
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}

.gravity__hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 400ms ease;
}

/* Especificidad deliberadamente mayor que la de la regla base para que el
   aviso desaparezca en cuanto cae la primera letra. */
.gravity.gravity[data-active="true"] .gravity__hint { opacity: 0; }

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

.glyph {
  position: absolute;
  top: 0;
  left: 0;
  line-height: 1;
  font-weight: 600;
  will-change: transform;
  transition: opacity 300ms ease;
}

.glyph > span {
  display: inline-block;
  transform-origin: bottom center;
}

/* Pie --------------------------------------------------------------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.foot__credit { letter-spacing: 0.06em; }

.foot a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

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

/* Movil: menos altura de escenario y titular mas ajustado ------------ */

@media (max-width: 30rem) {
  .brand { font-size: 0.72rem; gap: 0.7rem; }
  .brand__divider { width: 1.5rem; }
  .stage__frame, .gravity { min-height: 12rem; }
  .foot { font-size: 0.66rem; }
}
