/* Constelia — sitio público con la estética Orbital del juego.
   Sin CDNs ni JS: fuentes servidas desde /fonts (SIL OFL 1.1, licencias junto a ellas).
   Animaciones solo con CSS y solo si el sistema no pide reducir movimiento. */
@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/ChakraPetch-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/ChakraPetch-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Rubik";
  src: url("/fonts/Rubik-VariableFont_wght.ttf") format("truetype");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --abyss: #06071a;
  --deep: #0a0c22;
  --night: #05060f;
  --surface: #141a3e;
  --surface-low: #0e1134;
  --surface-high: #181e4e;
  --surface-highest: #1d2258;
  --glass: rgba(20, 26, 70, 0.72);
  --hairline: rgba(150, 170, 255, 0.2);
  --hairline-mid: rgba(150, 170, 255, 0.3);
  --text: #eef0ff;
  --text-2: #c3c9f0;
  --muted: #9aa3d6;
  --accent: #69e2ff;
  --accent-soft: rgba(105, 226, 255, 0.14);
  --gold: #ffcc5c;
  --cta-top: #ffd77a;
  --cta-bottom: #ff9e44;
  --on-cta: #2a1200;
  --score: #ffe7b0;
  --warn-bg: #3a2a00;
  --warn: #ffd77a;
  --radius: 18px;
  --head: "Chakra Petch", "Rubik", system-ui, sans-serif;
  --body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--abyss);
  background-image:
    radial-gradient(90% 60% at 15% -5%, rgba(29, 34, 88, 0.95) 0%, rgba(10, 12, 34, 0) 70%),
    radial-gradient(70% 50% at 100% 30%, rgba(74, 36, 134, 0.28) 0%, rgba(6, 7, 26, 0) 70%),
    radial-gradient(80% 60% at 0% 100%, rgba(29, 79, 140, 0.22) 0%, rgba(6, 7, 26, 0) 70%),
    linear-gradient(180deg, var(--deep) 0%, var(--abyss) 60%, var(--night) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.65;
  overflow-x: hidden;
}

/* Campo de estrellas: dos capas fijas detrás del contenido. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-repeat: repeat;
}
body::before {
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 9%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 35% 62%, #dff7ff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 74%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 52% 31%, #c3c9f0 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 88%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 64% 92%, #c3c9f0 50%, transparent 51%),
    radial-gradient(1px 1px at 24% 41%, #fff 50%, transparent 51%);
  background-size: 420px 420px;
  opacity: 0.75;
}
body::after {
  background-image:
    radial-gradient(2px 2px at 30% 22%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 70% 48%, #69e2ff 50%, transparent 51%),
    radial-gradient(2px 2px at 14% 70%, #ffe7b0 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 90% 86%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 48% 8%, #fff 50%, transparent 51%);
  background-size: 640px 640px;
  opacity: 0.6;
}

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: #a5efff; }
a:focus-visible, summary:focus-visible, .btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}
img, svg { max-width: 100%; }
img { height: auto; }

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
}
.skip:focus { left: 16px; background: var(--surface); padding: 8px 12px; z-index: 10; border-radius: 8px; }

.wrap {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}
.wrap.narrow { max-width: 820px; }

/* Cabecera */
header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding-top: 16px;
  padding-bottom: 8px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-height: 44px; }
.brand img { width: 36px; height: 36px; }
.brand span { font-family: var(--head); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.32em; text-transform: uppercase; }
nav.site ul { list-style: none; display: flex; flex-wrap: wrap; gap: 2px 4px; margin: 0; padding: 0; }
nav.site a {
  display: inline-block;
  padding: 8px 10px;
  min-height: 40px;
  font-family: var(--head);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 999px;
}
nav.site a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
nav.site a[aria-current="page"] { color: var(--gold); background: rgba(255, 204, 92, 0.08); }

/* Tipografía */
h1, h2, h3 { font-family: var(--head); line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 6vw, 2.75rem); margin: 0.5em 0 0.35em; letter-spacing: 0.02em; }
h2 { font-size: clamp(1.35rem, 4vw, 1.8rem); margin: 2.2em 0 0.5em; color: var(--text); }
h3 { font-size: 1.12rem; margin: 1.4em 0 0.35em; color: var(--score); }
.eyebrow {
  display: inline-block;
  font-family: var(--head);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}
p, li { color: var(--text-2); }
strong { color: var(--text); font-weight: 600; }
.lead { font-size: 1.12rem; color: var(--text-2); }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
ul, ol { padding-left: 1.3em; }
li { margin: 0.35em 0; }
hr { border: 0; border-top: 1px solid var(--hairline); margin: 40px 0; }

/* Paneles y tarjetas */
.panel {
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
}
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
.card {
  background: linear-gradient(160deg, rgba(29, 34, 88, 0.85), rgba(14, 17, 52, 0.85));
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px;
}
.card h3 { margin-top: 0.2em; }
.card > :last-child { margin-bottom: 0; }
.card .icon { width: 64px; height: 64px; display: block; margin-bottom: 4px; }

/* Botones (enlaces con aspecto de botón) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 999px;
  font-family: var(--head);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}
.btn-cta { background: linear-gradient(180deg, var(--cta-top), var(--cta-bottom)); color: var(--on-cta); box-shadow: 0 6px 24px rgba(255, 158, 68, 0.28); }
.btn-cta:hover { color: var(--on-cta); filter: brightness(1.06); }
.btn-ghost { color: var(--text); border: 1px solid var(--hairline-mid); background: rgba(255, 255, 255, 0.04); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 0; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(105, 226, 255, 0.4);
  background: var(--accent-soft);
  color: var(--text);
  font-family: var(--head);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin: 0;
}
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); flex: none; }

/* Portada */
.hero { text-align: center; padding: 8px 0 24px; }
.hero-art { width: min(340px, 82vw); height: auto; display: block; margin: 0 auto -8px; overflow: visible; }
.wordmark {
  font-family: var(--head);
  font-weight: 700;
  font-size: clamp(2rem, 10.5vw, 4.2rem);
  letter-spacing: 0.3em;
  margin: 0 0 0 0.3em; /* compensa el interletraje del final */
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--text);
}
.tagline {
  font-family: var(--head);
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: clamp(0.85rem, 3.4vw, 1.05rem);
  margin: 6px 0 18px;
}
.hero .lead { max-width: 640px; margin: 0 auto 18px; }
.hero .actions { justify-content: center; }

.split { display: grid; gap: 24px; align-items: center; grid-template-columns: 1fr; }
figure.art { margin: 0; }
figure.art img { display: block; width: 100%; border-radius: var(--radius); border: 1px solid var(--hairline); background: var(--surface-low); }
figure.art.bare img { border: 0; background: none; }
figure.art.diagram img { max-width: 360px; margin: 0 auto; border: 0; background: none; }
figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
.tag {
  display: inline-block;
  font-family: var(--head);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(255, 204, 92, 0.45);
  border-radius: 999px;
  padding: 1px 8px;
  margin-right: 6px;
}
.gallery { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
.gallery .portrait img { max-width: 300px; margin: 0 auto; }

.steps { list-style: none; padding: 0; counter-reset: paso; display: grid; gap: 12px; }
.steps > li {
  counter-increment: paso;
  position: relative;
  padding: 14px 16px 14px 60px;
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  margin: 0;
}
.steps > li::before {
  content: counter(paso);
  position: absolute;
  left: 14px;
  top: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--head);
  font-weight: 700;
  color: var(--on-cta);
  background: linear-gradient(180deg, var(--cta-top), var(--cta-bottom));
}

/* Cielos del Viaje planetario */
.skies { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sky {
  position: relative;
  margin: 0;
  min-height: 132px;
  padding: 14px 14px 12px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.sky .n { font-family: var(--head); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.22em; color: var(--sky-accent, var(--accent)); display: block; position: relative; z-index: 1; }
.sky .name { font-family: var(--head); font-weight: 700; color: var(--text); font-size: 1.02rem; line-height: 1.25; display: block; margin-top: 2px; position: relative; z-index: 1; }
.sky .motif { color: var(--text-2); font-size: 0.85rem; display: block; position: relative; z-index: 1; }
.sky .range { color: var(--text-2); font-size: 0.78rem; display: block; position: relative; z-index: 1; }
.sky::before { /* planeta del cielo */
  content: "";
  position: absolute;
  right: -14px;
  bottom: -14px;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--pl-light) 0%, var(--pl-mid) 48%, var(--pl-dark) 100%);
  box-shadow: inset -10px -12px 18px rgba(0, 0, 20, 0.45);
  opacity: 0.9;
}
.sky.ringed::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: 14px;
  width: 116px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--sky-accent);
  opacity: 0.7;
  transform: rotate(-16deg);
}
.m-lava { --pl-light: #ffd88a; --pl-mid: #f26a3a; --pl-dark: #8c2333; }
.m-ice { --pl-light: #e0fbff; --pl-mid: #43b9e8; --pl-dark: #1d4f8c; }
.m-jungle { --pl-light: #dcff94; --pl-mid: #5cc04e; --pl-dark: #1e6a3d; }
.m-quartz { --pl-light: #f4f1ff; --pl-mid: #a9a3c9; --pl-dark: #4b4670; }
.m-nebula { --pl-light: #ffd4ff; --pl-mid: #b062ea; --pl-dark: #4a2486; }
.s1 { --sky-accent: #9fb0ff; background: linear-gradient(180deg, #1c1646, #0b0f2e); }
.s2 { --sky-accent: #5fe0d0; background: linear-gradient(180deg, #0b3040, #071a2a); }
.s3 { --sky-accent: #ffc35c; background: linear-gradient(180deg, #3e2812, #1c1208); }
.s4 { --sky-accent: #ff8ab0; background: linear-gradient(180deg, #401236, #1e0a22); }
.s5 { --sky-accent: #9ff0ff; background: linear-gradient(180deg, #0f2e4a, #081628); }
.s6 { --sky-accent: #ffa060; background: linear-gradient(180deg, #421c0c, #1e0c08); }
.s7 { --sky-accent: #7fa6ff; background: linear-gradient(180deg, #0e1c58, #060b2a); }
.s8 { --sky-accent: #9fffd6; background: linear-gradient(180deg, #0e3634, #061a1c); }
.s9 { --sky-accent: #ff6a78; background: linear-gradient(180deg, #460e1c, #1e060c); }
.s10 { --sky-accent: #ffe07a; background: linear-gradient(180deg, #3e320a, #1a1404); }

/* Modos */
.mode { border-top: 3px solid var(--mode-accent, var(--accent)); }
.mode .eyebrow { color: var(--mode-accent, var(--accent)); }
.mode-journey { --mode-accent: #ffd77a; }
.mode-drift { --mode-accent: #69e2ff; }
.mode-launch { --mode-accent: #ff8a5c; }
.mode-daily { --mode-accent: #ff8ad8; }

.elements { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: 1fr; }
.elements li { display: flex; gap: 14px; align-items: flex-start; margin: 0; padding: 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--hairline); }
.elements img { width: 56px; height: 56px; flex: none; }
.elements strong { display: block; font-family: var(--head); }

/* Textos legales */
table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--hairline); color: var(--text-2); }
th { color: var(--gold); font-family: var(--head); font-weight: 700; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.legal h2 { color: var(--gold); font-size: 1.3rem; margin-top: 1.8em; }
.legal dl { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0; }
.legal dt { font-family: var(--head); font-weight: 700; color: var(--text); margin-top: 8px; }
.legal dd { margin: 0; color: var(--text-2); }
.toc { columns: 1; }
.toc li { break-inside: avoid; }

.todo {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px dashed var(--warn);
  border-radius: 6px;
  padding: 0 6px;
  font-size: 0.92em;
}
.email {
  font-family: var(--head);
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--hairline-mid);
  border-radius: 8px;
  padding: 2px 8px;
  user-select: all;
  -webkit-user-select: all;
  word-break: break-all;
}

/* Preguntas frecuentes */
details { border-bottom: 1px solid var(--hairline); padding: 6px 0; }
summary { cursor: pointer; font-weight: 600; color: var(--text); padding: 10px 0; min-height: 44px; }
summary::marker { color: var(--accent); }
details p, details ul { margin-top: 0; }

/* Pie */
footer.site { margin-top: 56px; padding-top: 28px; padding-bottom: 32px; border-top: 1px solid var(--hairline); font-size: 0.9rem; }
footer.site p, footer.site li { color: var(--muted); }
footer.site ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0; margin: 0 0 12px; }
footer.site ul a { display: inline-block; padding: 6px 0; }
footer.site .brandline { font-family: var(--head); letter-spacing: 0.08em; color: var(--text-2); }

/* Ilustración animada del logo (SVG en línea, sin estilos en línea) */
.hero-art .orbit { fill: none; stroke: #69e2ff; stroke-opacity: 0.18; stroke-width: 0.006; stroke-dasharray: 0.02 0.035; }
.hero-art .orbit-2 { stroke: #ffcc5c; stroke-opacity: 0.14; }
.constellation-line { stroke-dasharray: 1; stroke-dashoffset: 0; }

/* Constelación decorativa de las páginas interiores */
.deco-constellation { display: block; width: 100%; max-width: 420px; height: auto; margin: 8px auto 0; }
.deco-constellation .ln { fill: none; stroke: #c3c9f0; stroke-opacity: 0.55; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.deco-constellation .st { fill: #ffffff; }
.deco-constellation .gl { fill: #69e2ff; fill-opacity: 0.18; }

@media (min-width: 560px) {
  .grid.two, .elements { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skies { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .legal dl { grid-template-columns: max-content 1fr; }
  .legal dt { margin-top: 0; }
  .toc { columns: 2; }
}
@media (min-width: 860px) {
  .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .split { grid-template-columns: 1.1fr 1fr; gap: 40px; }
  .split.rev > :first-child { order: 2; }
  .skies { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .gallery { grid-template-columns: 1fr 2fr; align-items: center; }
  header.site { padding-top: 22px; }
}

/* Movimiento: solo si el sistema no pide reducirlo. */
@media (prefers-reduced-motion: no-preference) {
  body::after { animation: twinkle 6s ease-in-out infinite alternate; }
  body::before { animation: twinkle-soft 9s ease-in-out infinite alternate; }
  .hero-art .orbit { transform-box: fill-box; transform-origin: center; animation: spin 90s linear infinite; }
  .hero-art .orbit-2 { animation-duration: 140s; animation-direction: reverse; }
  .hero-art .constellation-line { stroke-dashoffset: 1; animation: draw 2.4s 0.4s ease-out forwards; }
  .hero-art .tw { animation: pulse 3.2s ease-in-out infinite; }
  .hero-art .tw-2 { animation-delay: 1.1s; }
  .hero-art .tw-3 { animation-delay: 2.1s; }
  .hero-art .spark { transform-box: fill-box; transform-origin: center; animation: spark 4s ease-in-out infinite; }
  .hero-art .halo { animation: breathe 7s ease-in-out infinite alternate; }
  .deco-constellation .ln { stroke-dashoffset: 1; animation: draw 3s 0.3s ease-out forwards; }
  .deco-constellation .gl { animation: pulse 3.6s ease-in-out infinite; }
  .btn, nav.site a, .card { transition: border-color 0.2s, background-color 0.2s, filter 0.2s; }
}
@keyframes twinkle { from { opacity: 0.25; } to { opacity: 0.85; } }
@keyframes twinkle-soft { from { opacity: 0.55; } to { opacity: 0.85; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes spark { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes breathe { from { opacity: 0.75; } to { opacity: 1; } }

@media print {
  body { background: #fff; color: #000; }
  body::before, body::after, .hero-art, nav.site { display: none; }
  p, li, td, th, h1, h2, h3, strong { color: #000; }
}

/* Ritmo vertical: el antetítulo va pegado a su título y cada sección respira. */
main > section, main > .grid, main > article { margin-top: 48px; }
main > section:first-child, main > .hero { margin-top: 0; }
.eyebrow + h1, .eyebrow + h2 { margin-top: 0.25em; }

/* El planeta del cielo vive en el hueco inferior para no tapar el texto. */
.sky { padding-bottom: 60px; min-height: 0; }
.sky::before { width: 64px; height: 64px; right: -8px; bottom: -10px; }
.sky.ringed::after { right: -28px; bottom: 10px; width: 104px; height: 20px; }
