/* Glyphos. Un solo protagonista: un campo de partículas fijo detrás de todo, que forma la palabra,
   el agente y el flujo. El texto es mínimo y el ámbar se reserva para lo que está en movimiento. */
:root {
  --ink: #0b0d12;
  --text: #e8eaf0;
  --mute: #8b93a5;
  --signal: #fbbf24;

  --display: "Anybody", "Arial Black", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter-l: max(clamp(16px, 3vw, 44px), env(safe-area-inset-left, 0px));
  --gutter-r: max(clamp(16px, 3vw, 44px), env(safe-area-inset-right, 0px));
  color-scheme: dark;
}

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

html { background: var(--ink); -webkit-text-size-adjust: 100%; touch-action: pan-y; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  position: relative;
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 1rem/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 6px; }

.campo {
  position: fixed; left: 0; top: 0;
  width: 100%; height: 100vh; height: 100lvh;
  display: block;
  pointer-events: none;
}

main { position: relative; }

.marca {
  position: fixed; z-index: 2;
  left: var(--gutter-l); top: max(18px, env(safe-area-inset-top, 0px));
  width: 28px; height: 28px;
  transition: transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
.marca svg { display: block; width: 100%; height: 100%; }
.marca:hover { transform: rotate(-8deg) scale(1.08); }

/* ---------- Portada: la palabra la dibujan las partículas, en el espacio libre sobre el texto ---------- */

.hero {
  position: relative;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 100vh; min-height: 100svh;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  padding-block: 64px clamp(22px, 5vh, 44px);
}

/* Sin partículas (sin WebGL o sin JavaScript) la marca se ve como texto. */
.wordmark {
  flex: 1 1 auto;
  display: grid; place-items: center;
  font-family: var(--display);
  font-size: 17vw;
  font-variation-settings: "wdth" 125, "wght" 800;
  line-height: 1;
}
.js .wordmark { opacity: 0; animation: aparece .4s 4s forwards; }
@keyframes aparece { to { opacity: 1; } }
.has-field .wordmark {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%);
  animation: none;
}

.hero__copy {
  position: relative;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px 32px;
}

.hero__def {
  font-family: var(--display);
  font-variation-settings: "wdth" 96, "wght" 520;
  font-size: clamp(1.5rem, 2.7vw, 2.625rem);
  line-height: 1.12;
  max-width: 19em;
  text-wrap: balance;
}

.hint { display: none; }
.has-field .hint {
  flex: none;
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--mute);
  font-size: .9375rem;
  line-height: 1.2;
  padding-bottom: .3em;
}
.hint__dot {
  position: relative;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--signal);
}
.hint__dot::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--signal);
  animation: late 1.8s ease-out infinite;
}
@keyframes late { to { transform: scale(3.4); opacity: 0; } }

/* ---------- Capítulos: el texto queda fijo mientras las partículas cambian de forma ---------- */

.chapter { position: relative; height: 200vh; height: 200svh; }
.chapter--flow { height: 150vh; height: 150svh; }

.chapter__pin {
  position: sticky; top: 0;
  display: flex; align-items: center;
  height: 100vh; height: 100svh;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  padding-block: 72px 32px;
}
.chapter--flow .chapter__pin { align-items: flex-start; }

.chapter__text {
  display: flex; flex-direction: column; gap: 12px;
  width: min(38vw, 30rem);
  min-width: 0;
}
.chapter--flow .chapter__text { width: min(92vw, 44rem); }

.chapter h2 {
  font-family: var(--display);
  font-variation-settings: "wdth" 118, "wght" 760;
  font-size: clamp(2.5rem, 5.6vw, 5.25rem);
  line-height: 1;
}
.chapter p {
  color: var(--mute);
  font-size: clamp(1.0625rem, 1.45vw, 1.3125rem);
  line-height: 1.45;
  max-width: 34ch;
  text-wrap: pretty;
}
.chapter--flow p { max-width: none; }

/* ---------- Pie: apoyado sobre el final de la página, así no le quita el lugar al último capítulo ---------- */

.pie {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px var(--gutter-r) max(16px, env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  background: var(--ink);
  border-top: 1px solid rgba(232, 234, 240, .1);
  color: var(--mute);
  font-size: .875rem;
  line-height: 1.4;
}

@media (max-width: 820px) {
  .hero__copy { flex-direction: column; align-items: flex-start; }
  .chapter__text { width: 100%; }
  .chapter--agent .chapter__pin { align-items: flex-end; padding-bottom: clamp(28px, 7vh, 64px); }
  .chapter p { max-width: 38ch; }
}

@media (prefers-reduced-motion: reduce) {
  .has-field .hint { display: none; }
  .marca { transition: none; }
}
