/* ==========================================================================
   Lunary — estilos
   Sistema: retícula cuadrada, negro dominante, esquinas rectas, sin sombras.
   ========================================================================== */

:root {
  /* Paleta */
  --black: #000000;
  --text: #EFEFEF;
  --logo: #F2F2F2;
  --gray-1: #C9C9C9;
  --gray-2: #7A7A7A;
  --line: #1E1E1E;
  --line-2: #2A2A2A;
  --accent: #588F00;

  /* Tipografías: primero la de marca (Adobe Fonts), luego el reemplazo de Google Fonts */
  --font-display: "DotGothic16", monospace;
  --font-mono: "bdrmono-2006", "Share Tech Mono", ui-monospace, monospace;
  --font-body: "early-sans-variable", "Inter Tight", system-ui, sans-serif;
  --font-accent: "gunter", "DotGothic16", sans-serif;

  /* Retícula (JS la ajusta al tamaño exacto de la pantalla) */
  --cell: 48px;
  --gx: 0px;
  --gy: 0px;
  --logo-h: min(24svh, 46vw);

  --edge: 16px;
  --z-reveal: 1;
  --z-deco: 2;
  --z-cutters: 3;
  --z-grid: 4;
  --z-wire: 5;
  --z-ui: 6;
  --z-grain: 20;
  --z-cookie: 30;
}

@media (min-width: 900px) {
  :root { --edge: 24px; }
}

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

html, body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.home {
  height: 100svh;
  overflow: hidden;
  overscroll-behavior: none;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: none; }
.mono { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .12em; }
.display { font-family: var(--font-display); }

::selection { background: var(--accent); color: var(--black); }

/* --------------------------------------------------------------------------
   Capas de fondo
   -------------------------------------------------------------------------- */

.reveal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-reveal);
}

.grid-lines {
  position: fixed;
  inset: 0;
  z-index: var(--z-grid);
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  background-position: var(--gx) var(--gy);
}

.deco, .cutters {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.deco { z-index: var(--z-deco); }
.cutters { z-index: var(--z-cutters); }
.cutters span {
  position: absolute;
  background: var(--black);
}

:where(.deco) img {
  position: absolute;
  height: auto;
  user-select: none;
}

/* Enredadera colgando del borde superior */
.deco__vine {
  top: 0;
  left: 4vw;
  width: min(78vw, 420px);
  transform: translateY(-26%);
  opacity: .85;
}

/* Rama seca entrando por el costado (solo pantallas grandes) */
.deco__branch {
  display: none;
  left: 0;
  bottom: 20svh;
  width: min(34vw, 520px);
  transform: translateX(-38%) rotate(-6deg);
  opacity: .75;
}

/* Línea de árboles en el borde inferior */
.deco__treeline {
  left: 0;
  bottom: 0;
  width: 100%;
  height: clamp(80px, 16svh, 180px);
  object-fit: cover;
  object-position: center bottom;
  opacity: .22;
}

@media (min-width: 900px) {
  .deco__vine { left: 8vw; width: min(40vw, 620px); transform: translateY(-30%); }
  .deco__branch { display: block; }
}

/* Figuras en wireframe */
.wire {
  position: fixed;
  z-index: var(--z-wire);
  pointer-events: none;
}
.wire--torus {
  --s: clamp(150px, 34vmin, 380px);
  width: var(--s);
  height: var(--s);
  top: calc(var(--s) * -0.32);
  right: calc(var(--s) * -0.30);
}
.wire--hyper {
  --s: clamp(110px, 22vmin, 250px);
  width: var(--s);
  height: var(--s);
  left: calc(var(--s) * -0.28);
  bottom: calc(18svh);
}

/* Grano analógico */
.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  background: url("/assets/texture-glitch-grain.webp") repeat;
  background-size: 420px 420px;
  mix-blend-mode: screen;
  opacity: .06;
}

/* --------------------------------------------------------------------------
   Anotaciones en las esquinas
   -------------------------------------------------------------------------- */

.corner {
  position: fixed;
  z-index: var(--z-ui);
  font-size: 11px;
  line-height: 1;
  color: var(--gray-2);
  background: var(--black);
  padding: 5px 6px;
  white-space: nowrap;
}
.corner--tl { top: calc(var(--edge) + env(safe-area-inset-top)); left: var(--edge); }
.corner--tr { top: calc(var(--edge) + env(safe-area-inset-top)); right: var(--edge); }
.corner--bl { bottom: calc(var(--edge) + env(safe-area-inset-bottom)); left: var(--edge); }
.corner--br { bottom: calc(var(--edge) + env(safe-area-inset-bottom)); right: var(--edge); }
a.corner { transition: color .15s steps(2); }
a.corner:hover, a.corner:focus-visible { color: var(--text); }

.corner--tr time { color: var(--gray-1); }
.corner--br { color: var(--gray-1); }

/* En celular no caben las dos anotaciones de arriba completas */
@media (max-width: 480px) {
  .corner { font-size: 10px; letter-spacing: .1em; }
  .corner__brand { display: none; }
}

/* --------------------------------------------------------------------------
   Escenario principal: logo + frase + botón
   -------------------------------------------------------------------------- */

.stage {
  position: fixed;
  inset: 0;
  z-index: var(--z-ui);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--edge) + 28px) var(--edge) calc(var(--edge) + 64px);
  pointer-events: none;
}
.stage__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--cell) * .5);
  width: 100%;
}
.stage__inner > * { pointer-events: auto; }

.logo {
  margin: 0;
  line-height: 0;
  height: var(--logo-h);
}
.logo__svg {
  height: 100%;
  width: auto;
  fill: var(--logo);
  overflow: visible;
}

.panel {
  background: var(--black);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 14px 14px 0;
  width: min(100%, 400px);
}

.tagline {
  margin: 0;
  font-size: clamp(15px, 1.2vw + 10px, 24px);
  line-height: 1.25;
  color: var(--gray-1);
  text-align: center;
  min-height: 1.25em;
}
.tagline__caret {
  display: inline-block;
  width: .5em;
  height: .95em;
  margin-left: .12em;
  vertical-align: -.1em;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Botón principal */
.cta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 0 28px;
  background: var(--accent);
  color: var(--black);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  overflow: hidden;
  isolation: isolate;
}
.cta__fill {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--fc, 16), 1fr);
  grid-auto-rows: 1fr;
  z-index: -1;
}
.cta__fill i {
  background: var(--text);
  box-shadow: 0 0 0 .5px var(--text);
  opacity: 0;
  transition: opacity 0s linear var(--d, 0ms);
}
.cta__label { position: relative; white-space: nowrap; }
.cta__arrow {
  display: inline-block;
  margin-left: .35em;
  transition: transform .2s steps(2);
}
.cta:hover .cta__fill i,
.cta:focus-visible .cta__fill i { opacity: 1; }
.cta:hover .cta__arrow,
.cta:focus-visible .cta__arrow { transform: translateX(6px); }
.cta:active { transform: translateY(1px); }
.cta:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.cta + .ig { margin-top: -6px; }

/* Botón secundario: Instagram */
.ig {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--gray-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .12em;
  transition: background-color .16s steps(2), color .16s steps(2), border-color .16s steps(2), opacity .36s steps(4);
}
.ig__icon { width: 18px; height: 18px; flex: none; }
.ig__handle { color: var(--accent); transition: color .16s steps(2); }
.ig__arrow { font-family: var(--font-body); transition: transform .2s steps(2); }
.ig:hover, .ig:focus-visible { background: var(--text); color: var(--black); border-color: var(--text); }
.ig:hover .ig__handle, .ig:focus-visible .ig__handle { color: var(--black); }
.ig:hover .ig__arrow, .ig:focus-visible .ig__arrow { transform: translate(3px, -3px); }
.ig:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.ig:active { transform: translateY(1px); }

/* Pie de página */
.foot {
  position: fixed;
  z-index: var(--z-ui);
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--edge) + 30px + env(safe-area-inset-bottom));
  font-size: 10px;
  color: var(--gray-2);
  background: var(--black);
  padding: 5px 8px;
  white-space: nowrap;
}
.foot a { color: var(--gray-1); transition: color .15s steps(2); }
.foot a:hover, .foot a:focus-visible { color: var(--text); }
.foot__bar { margin: 0 .6em; color: var(--line-2); }
.foot__sep { margin: 0 .3em; }

@media (min-width: 900px) {
  .foot { bottom: calc(var(--edge) + env(safe-area-inset-bottom)); font-size: 11px; }
}

/* Pantallas anchas: misma composición centrada, panel un poco más ancho */
@media (min-width: 900px) {
  .panel { width: auto; min-width: 440px; padding: 18px 24px 0; }
  .tagline { font-size: 21px; white-space: nowrap; }
}

/* Pantallas angostas: acortar el pie */
@media (max-width: 420px) {
  .foot .foot__place { display: none; }
}

/* Pantallas bajas: se ocultan primero las figuras y luego las coordenadas */
@media (max-height: 640px) {
  .wire--hyper { display: none; }
}
@media (max-height: 560px) {
  .coords { display: none; }
  .deco__treeline { display: none; }
}

/* --------------------------------------------------------------------------
   Aviso de cookies
   -------------------------------------------------------------------------- */

.cookie {
  position: fixed;
  z-index: var(--z-cookie);
  left: var(--edge);
  right: var(--edge);
  bottom: calc(var(--edge) + env(safe-area-inset-bottom));
  margin: 0 auto;
  max-width: 560px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 14px;
  background: var(--black);
  border: 1px solid var(--line-2);
  font-size: 11px;
  line-height: 1.4;
  color: var(--gray-1);
  letter-spacing: .06em;
}
.cookie[hidden] { display: none; }
@media (min-width: 900px) {
  .cookie { left: auto; max-width: 440px; bottom: calc(var(--edge) + 34px); }
}
.cookie p { margin: 0; }
.cookie a { color: var(--text); border-bottom: 1px solid var(--gray-2); }
.cookie__ok {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--gray-1);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-transform: uppercase;
  letter-spacing: .12em;
  cursor: pointer;
  border-radius: 0;
}
.cookie__ok:hover, .cookie__ok:focus-visible { background: var(--text); color: var(--black); outline: none; }

/* --------------------------------------------------------------------------
   Intro (solo si el JS está activo; si falla, todo se ve normal)
   -------------------------------------------------------------------------- */

.js-intro:not(.intro-grid) .grid-lines,
.js-intro .logo:not(.is-building) .logo__svg,
.js-intro .deco,
.js-intro .wire,
.js-intro .corner,
.js-intro .foot,
.js-intro .cta,
.js-intro .ig { opacity: 0; }

.grid-lines, .deco, .wire, .corner, .foot, .cta {
  transition: opacity .36s steps(4);
}
.grid-lines { transition-duration: .24s; }

.logo-block { opacity: 0; animation: block-in 1ms steps(1) forwards; animation-delay: var(--d, 0ms); }
@keyframes block-in { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .tagline__caret { animation: none; }
  .cta__fill i { transition: none; }
  .grid-lines, .deco, .wire, .corner, .foot, .cta { transition: none; }
}

/* --------------------------------------------------------------------------
   Página de privacidad
   -------------------------------------------------------------------------- */

body.page {
  min-height: 100svh;
  background:
    linear-gradient(to right, var(--line) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(to bottom, var(--line) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--black);
}
@media (min-width: 900px) {
  body.page { background-size: 72px 72px, 72px 72px, auto; }
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--edge);
}
.page-head__logo { display: block; width: 44px; height: 44px; background: var(--black); }
.page-head__logo img { width: 100%; height: 100%; }
.page-head .mono { font-size: 11px; color: var(--gray-2); background: var(--black); padding: 5px 6px; }
.page-head a.mono:hover, .page-head a.mono:focus-visible { color: var(--text); }

.doc {
  max-width: 680px;
  margin: 24px auto 72px;
  padding: 32px var(--edge) 40px;
  background: var(--black);
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}
@media (min-width: 720px) {
  .doc { padding: 40px 48px 48px; border: 1px solid var(--line-2); }
}
.doc h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.1;
  margin: 0 0 8px;
}
.doc .mono.meta { font-size: 11px; color: var(--accent); margin: 0 0 32px; }
.doc h2 {
  font-family: var(--font-mono);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 13px;
  color: var(--gray-1);
  margin: 32px 0 10px;
}
.doc p, .doc li {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
}
.doc ul { padding-left: 1.1em; }
.doc a { color: var(--text); border-bottom: 1px solid var(--accent); }
.doc a:hover { color: var(--accent); }

.page-foot {
  text-align: center;
  padding: 0 var(--edge) 32px;
  font-size: 11px;
  color: var(--gray-2);
}
.page-foot span { background: var(--black); padding: 5px 8px; }
