/* Grubi Works. Paleta real del sitio en producción: tinta casi negra, blanco cálido y beige.
   main.js reescribe estas variables desde KIT al arrancar; los valores de aquí son el respaldo. */

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/inter-normal-100_900-latin.v1.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url("fonts/inter-italic-100_900-latin.v1.woff2") format("woff2");
}
@font-face {
  font-family: "Anton"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/anton-normal-400-latin.v1.woff2") format("woff2");
}
@font-face {
  font-family: "Gilda Display"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/gilda-display-normal-400-latin.v1.woff2") format("woff2");
}
@font-face {
  font-family: "Pathway Extreme"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/pathway-extreme-normal-100_900-latin.v1.woff2") format("woff2");
}
@font-face {
  font-family: "Kanit"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/kanit-normal-400-latin.v1.woff2") format("woff2");
}

:root {
  --ink: #0f0f0e;
  --ink-2: #1b1a18;
  --paper: #ebe8e1;
  --signal: #8a877f;
  --beige-2: #dfdcd2;
  --muted: #8a877f;
  --muted-paper: #6f6c65;
  --ink-soft: #4b4943;
  --paper-soft: #c9c6be;
  --hot: #ffffff;
  --sans: "Inter", system-ui, sans-serif;
  --display: "Anton", Impact, sans-serif;
  --serif: "Gilda Display", Georgia, serif;
  --body: "Pathway Extreme", system-ui, sans-serif;
  --mono: "Inter", system-ui, sans-serif;
  --pad: clamp(16px, 2.4vw, 32px);
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; overscroll-behavior: none; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

.page { position: fixed; inset: 0; }

/* ─── escenario ──────────────────────────────────────────────────────────── */
.stage { position: absolute; inset: 0; cursor: grab; touch-action: none; }
.stage canvas { display: block; width: 100%; height: 100%; }
.stage.is-dragging { cursor: grabbing; }
.stage.is-link { cursor: pointer; }

.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, color-mix(in srgb, var(--ink) 85%, transparent), transparent 120px),
    linear-gradient(to top, color-mix(in srgb, var(--ink) 85%, transparent), transparent 110px),
    radial-gradient(120% 90% at 50% 50%, transparent 60%, color-mix(in srgb, var(--ink) 55%, transparent));
}

.cross {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  pointer-events: none; opacity: 0.45; mix-blend-mode: difference;
  background:
    linear-gradient(var(--paper), var(--paper)) center / 1px 100% no-repeat,
    linear-gradient(var(--paper), var(--paper)) center / 100% 1px no-repeat;
}

/* Puntero de teclado: etiqueta pequeña abajo a la derecha de la mira. */
.aim {
  position: absolute; left: 50%; top: 50%; z-index: 3; pointer-events: none;
  transform: translate(14px, 14px);
  font-family: var(--sans); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
  padding: 6px 9px; border-radius: 4px; background: color-mix(in srgb, var(--ink-2) 82%, transparent); color: var(--paper);
  border: 1px solid color-mix(in srgb, var(--paper) 16%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transition: opacity 0.2s;
}
.aim.is-on { opacity: 1; transition-delay: 0.15s; }
.aim b { color: var(--signal); font-weight: 600; margin-right: 4px; }

/* ─── HUD ────────────────────────────────────────────────────────────────── */
.hud {
  position: absolute; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: var(--pad);
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud--top { top: 0; padding-top: max(var(--pad), env(safe-area-inset-top)); }
.hud--bottom { bottom: 0; align-items: flex-end; padding-bottom: max(var(--pad), env(safe-area-inset-bottom)); }
.hud--bottom > * { pointer-events: none; }

.mark { display: inline-flex; align-items: center; }
.mark__logo { display: block; height: 24px; width: auto; }

.hud__right { display: flex; gap: 6px; }
.hud__nav { display: flex; gap: 6px; }
.hud__nav button, .pill {
  font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: 0.01em;
  padding: 9px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 60%, transparent);
  border: 1px solid color-mix(in srgb, var(--paper) 14%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.hud__nav button:hover, .hud__nav button.is-active, .pill:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); }

/* Sonido: cuatro barras, bailan cuando está encendido. */
.sound { display: inline-flex; align-items: center; gap: 8px; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i {
  display: block; width: 2px; height: 100%; background: currentColor; border-radius: 1px;
  transform: scaleY(0.18); transform-origin: bottom;
}
.sound.is-on .eq i:first-child { color: var(--signal); }

.hint, .coords {
  margin: 0; font-family: var(--sans); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); display: flex; align-items: center; gap: 10px;
}
.hint__pad {
  width: 22px; height: 22px; border: 1px solid color-mix(in srgb, var(--paper) 35%, transparent); border-radius: 50%;
  display: grid; place-items: center;
}
.hint__pad span { width: 6px; height: 6px; border-radius: 50%; background: var(--signal); }
.coords b { font-weight: 500; color: var(--paper); min-width: 5ch; font-variant-numeric: tabular-nums; }
.coords .coords__clock { min-width: 8ch; }
.coords__xy { display: contents; }

/* Etiqueta flotante junto al cursor. */
.cursor-label {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none;
  font-family: var(--sans); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 7px 10px; border-radius: 4px; background: var(--paper); color: var(--ink);
  opacity: 0; transform: translate(-999px, -999px); transition: opacity 0.2s;
  white-space: nowrap;
}
.cursor-label.is-on { opacity: 1; }
.cursor-label b { color: var(--ink-soft); font-weight: 700; }

/* ─── hoja (detalle de proyecto / servicio / FAQ) ──────────────────────── */
.sheet { position: absolute; inset: 0; z-index: 5; visibility: hidden; }
.sheet__backdrop {
  position: absolute; inset: 0; background: color-mix(in srgb, var(--ink) 62%, transparent);
  opacity: 0; transition: opacity 0.35s;
}
.sheet__panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(500px, calc(100% - 24px));
  background: var(--paper); color: var(--ink); border-radius: 14px;
  overflow: auto; overscroll-behavior: contain;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.1, 1);
}
.sheet.is-open { visibility: visible; }
.sheet.is-open .sheet__backdrop { opacity: 1; }
.sheet.is-open .sheet__panel { transform: none; }
.sheet__close {
  position: sticky; top: 14px; float: right; margin: 14px 14px 0 0; z-index: 1;
  font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 8px 12px; border-radius: 999px; background: var(--ink); color: var(--paper);
}
.sheet__body { padding: 22px 28px 32px; }
.sheet__media {
  margin: 44px 0 26px; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: var(--ink);
  display: grid; place-items: center;
}
.sheet__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sheet__kicker {
  font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-paper);
  margin: 0 0 12px;
}
.sheet h2 {
  font-family: var(--sans); font-size: clamp(30px, 3.6vw, 42px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.08; margin: 0 0 14px;
}
.sheet__cats {
  font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-soft); margin: 0 0 22px;
}
.sheet__desc { font-family: var(--body); font-size: 17px; line-height: 1.55; margin: 0 0 26px; max-width: 34em; color: var(--ink-soft); }
.sheet__quote { font-family: var(--serif); font-size: 19px; line-height: 1.5; }
.sheet__cta {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font-family: var(--sans); font-weight: 600; font-size: 15px; padding: 15px 22px; border-radius: 999px;
  background: var(--ink); color: var(--paper); transition: background 0.25s, color 0.25s;
}
.sheet__cta:hover { background: var(--ink-soft); }
.sheet__cta span { transition: transform 0.3s; }
.sheet__cta:hover span { transform: translate(3px, -3px); }

.sheet--contact .sheet__panel { width: min(680px, calc(100% - 24px)); bottom: auto; }
.sheet--contact h2 { font-size: clamp(34px, 4.4vw, 56px); }
.sheet--contact .sheet__body { padding-top: 64px; }
.sheet__mail {
  display: block; font-family: var(--display); text-transform: uppercase; letter-spacing: 0;
  font-size: clamp(30px, 4.2vw, 52px); line-height: 1; text-decoration: none; margin: 8px 0 26px;
  word-break: break-word;
  background: linear-gradient(var(--ink), var(--ink)) 0 100% / 0 4px no-repeat; transition: background-size 0.5s;
}
.sheet__mail:hover { background-size: 100% 4px; }
/* Hoja de "por qué elegir": tres ventajas en fila */
.sheet__rows { display: grid; gap: 14px; margin: 0 0 26px; }
.sheet__row { display: grid; grid-template-columns: 2.4em 1fr; gap: 10px; border-top: 1px solid color-mix(in srgb, var(--ink) 14%, transparent); padding-top: 12px; }
.sheet__row span { font-family: var(--display); font-size: 22px; color: var(--signal); line-height: 1.1; }
.sheet__row strong { display: block; font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.sheet__row p { margin: 0; font-family: var(--body); font-size: 15px; line-height: 1.5; color: var(--ink-soft); }

/* Hoja de FAQ: las seis preguntas seguidas */
.sheet__qas { margin: 0 0 20px; }
.sheet__qa { border-top: 1px solid color-mix(in srgb, var(--ink) 14%, transparent); padding: 16px 0 4px; }
.sheet__qn { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; color: var(--signal); }
.sheet__qa h3 { font-size: 17px; font-weight: 600; line-height: 1.3; margin: 4px 0 8px; letter-spacing: -0.01em; }
.sheet__qa p { margin: 0 0 10px; font-family: var(--body); font-size: 15px; line-height: 1.55; color: var(--ink-soft); }

.sheet__small { margin: 20px 0 0; font-family: var(--body); font-size: 16px; line-height: 1.55; color: var(--ink-soft); }
.sheet__privacy { margin: 22px 0 0; font-family: var(--sans); font-size: 11px; line-height: 1.6; color: var(--muted-paper); }

@media (max-width: 760px) {
  .hud { padding: 12px; }
  .hud--top { padding-top: max(12px, env(safe-area-inset-top)); gap: 6px; }
  .hud--bottom { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .mark__logo { height: 15px; }
  .hud__nav { gap: 2px; }
  .hud__nav button { font-size: 10px; letter-spacing: 0; padding: 5px 7px; }
  .hud__right { gap: 4px; }
  .pill { padding: 7px 9px; }
  .sound__txt { display: none; }
  .coords__xy { display: none; }
  .sheet__panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 86svh; }
  .sheet--contact .sheet__panel { width: auto; bottom: 8px; }
  .sheet__body { padding: 16px 20px 26px; }
}

/* Teléfonos estrechos: el HUD completo mide ~388 px; a partir de aquí se aprieta. */
@media (max-width: 420px) {
  .hud__nav button { font-size: 9px; padding: 5px 6px; }
  .mark__logo { height: 13px; }
  .pill { padding: 6px; }
}
@media (max-width: 355px) {
  .sound { display: none; } /* el sonido es opcional: en pantallas mínimas cede el sitio */
}

/* ─── índice plano: lectores de pantalla siempre, videntes sólo como respaldo ── */
.index {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.page.is-fallback { position: static; }
.page.is-fallback .stage, .page.is-fallback .vignette, .page.is-fallback .cross,
.page.is-fallback .hud, .page.is-fallback .cursor-label, .page.is-fallback .aim { display: none; }
.page.is-fallback .index {
  position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal;
  max-width: 760px; margin: 0 auto; padding: 10vh 24px; font-size: 18px; line-height: 1.55;
}
html:has(.is-fallback), body:has(.is-fallback) { overflow: auto; height: auto; }
.index h1 { font-family: var(--sans); font-weight: 700; text-transform: uppercase; letter-spacing: -0.03em;
  font-size: clamp(44px, 9vw, 96px); line-height: 0.98; margin: 0 0 20px; }
.index h2 { font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted-paper); margin: 56px 0 8px; }
.index h3 { font-family: var(--display); font-size: 26px; font-weight: 400; margin: 24px 0 4px; }
.index p { font-family: var(--body); margin: 0; color: var(--ink-soft); }
.index a { color: var(--ink); }
.index footer { margin-top: 56px; font-family: var(--sans); font-size: 12px; color: var(--muted-paper); }
.page.is-fallback { background: var(--paper); color: var(--ink); }
.sheet:not(.is-open) { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .sheet__panel, .sheet__backdrop { transition-duration: 0.01ms; }
  .eq i { transition: transform 0.3s; }
  .sound.is-on .eq i { transform: scaleY(0.9); }
  .sound.is-on .eq i:nth-child(2) { transform: scaleY(0.5); }
  .sound.is-on .eq i:nth-child(4) { transform: scaleY(0.7); }
}
