:root {
  --paper: #F6F5FB;
  --paper-2: #EEECF7;
  --ink: #17142B;
  --muted: #6B6787;
  --line: #DCD8EC;
  --violet: #6E4BF2;
  --violet-ink: #4B2FC4;

  --display: "Unbounded", "Segoe UI", system-ui, sans-serif;
  --text: "Instrument Sans", "Segoe UI", system-ui, sans-serif;

  --gutter: clamp(16px, 4vw, 56px);
  --max: 1240px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }

:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; text-decoration: none;
}
.skip:focus { top: 16px; }

/* ---------- navegación ---------- */
.nav {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand span { font-family: var(--display); font-weight: 600; font-size: 1.15rem; letter-spacing: -0.02em; }
.nav nav { display: flex; gap: clamp(14px, 3vw, 32px); font-size: 0.95rem; }
.nav nav a { text-decoration: none; color: var(--muted); }
.nav nav a:hover { color: var(--ink); }
@media (max-width: 560px) {
  .nav nav a:not(:first-child) { display: none; }
}

/* ---------- portada ---------- */
.hero {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(40px, 7vw, 96px) var(--gutter) clamp(56px, 8vw, 112px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  grid-template-areas: "copy system" "detail system";
  grid-template-rows: auto 1fr;
  column-gap: clamp(32px, 5vw, 80px);
  row-gap: 40px;
  align-items: start;
}
.hero-copy { grid-area: copy; }
.system-wrap { grid-area: system; align-self: center; padding: 0 clamp(20px, 4vw, 36px); }
main { overflow-x: clip; }
.detail { grid-area: detail; }

h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.75rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.lede { margin-top: 24px; max-width: 34em; color: var(--muted); font-size: clamp(1.1rem, 1.5vw, 1.25rem); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 24px;
  border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 1rem;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #2A2545; }
.btn-quiet { color: var(--violet-ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-quiet:hover { box-shadow: inset 0 0 0 1.5px var(--violet); }

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "copy" "system" "detail";
    grid-template-rows: none;
    row-gap: 32px;
  }
}

/* ---------- sistema orbital ---------- */
.system {
  position: relative;
  width: min(100%, 640px);
  aspect-ratio: 1;
  margin: 0 auto;
  container-type: inline-size;
}
.ring {
  --t: 120s;
  position: absolute; left: 50%; top: 50%;
  width: calc(var(--d) * 100%); aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  border: 1px solid var(--line);
  animation: spin var(--t) linear infinite;
}
.ring[data-ring="1"] { --d: 0.46; --t: 70s; }
.ring[data-ring="2"] { --d: 0.71; --t: 105s; }
.ring[data-ring="3"] { --d: 0.96; --t: 150s; }

.core {
  position: absolute; left: 50%; top: 50%;
  width: 21cqi; height: 21cqi; translate: -50% -50%;
  filter: drop-shadow(0 10px 30px rgba(110, 75, 242, 0.28));
}

.planet {
  --size: clamp(40px, 10cqi, 66px);
  position: absolute; left: 50%; top: 50%;
  width: var(--size); height: var(--size);
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  transform: rotate(var(--a)) translateX(calc(var(--d) * 50cqi)) rotate(calc(-1 * var(--a)));
  padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 24%;
}
.planet-spin { width: 100%; height: 100%; animation: spin var(--t) linear infinite reverse; }

.tile {
  display: block; width: 100%; height: 100%;
  border-radius: 22.5%; overflow: hidden;
  background: var(--bg, #fff);
  box-shadow: 0 6px 18px rgba(23, 20, 43, 0.16), inset 0 0 0 1px rgba(23, 20, 43, 0.06);
}
.tile img { width: 100%; height: 100%; object-fit: cover; transform: scale(var(--zoom, 1)); }
.tile.contain img { object-fit: contain; }

.planet .tile { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.planet:hover .tile { transform: scale(1.08); }
.planet[aria-pressed="true"] .tile {
  transform: scale(1.12);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--violet), 0 10px 26px rgba(110, 75, 242, 0.35);
}

.system.is-paused .ring,
.system.is-paused .planet-spin,
.system:hover .ring,
.system:hover .planet-spin,
.system:focus-within .ring,
.system:focus-within .planet-spin { animation-play-state: paused; }

@keyframes spin { to { rotate: 360deg; } }

@media (prefers-reduced-motion: reduce) {
  .ring, .planet-spin { animation: none; }
  .motion-toggle { display: none; }
}

.motion-toggle {
  display: block; margin: 16px auto 0; padding: 8px 14px;
  border: 0; background: none; color: var(--muted);
  font: 500 0.875rem var(--text); cursor: pointer; border-radius: 999px;
}
.motion-toggle:hover { color: var(--ink); background: var(--paper-2); }

/* ---------- ficha de la app ---------- */
.detail {
  display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start;
  padding: 24px; border-radius: 28px;
  background: #fff;
  box-shadow: 0 1px 0 var(--line), 0 18px 50px -24px rgba(23, 20, 43, 0.25);
  max-width: 520px;
}
.detail-icon { display: block; width: 72px; height: 72px; }
.detail-ring { color: var(--violet-ink); font-weight: 600; font-size: 0.9rem; }
.detail-name { font-size: 1.6rem; margin-top: 2px; }
.detail-text { margin-top: 10px; color: var(--ink); }
.detail-meta { margin-top: 12px; color: var(--muted); font-size: 0.95rem; }
.detail-meta a { color: var(--violet-ink); font-weight: 600; }
.detail.swap > * { animation: swap 0.35s cubic-bezier(.22, 1, .36, 1); }
@keyframes swap { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .detail.swap > * { animation: none; } }
@media (max-width: 900px) { .detail { max-width: none; } }

/* ---------- secciones ---------- */
.apps, .account, .story {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(56px, 9vw, 120px) var(--gutter);
}
.section-head { max-width: 40em; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head h2, .account h2, .story h2 { font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.08; }
.section-head p, .account-copy > p, .story-copy p { margin-top: 16px; color: var(--muted); max-width: 36em; }

/* directorio */
.group {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); gap: clamp(20px, 4vw, 64px);
  padding: 36px 0; border-top: 1px solid var(--line);
}
.group-head { display: flex; gap: 16px; align-items: flex-start; }
.group-head svg { flex: none; width: 52px; height: 52px; }
.group-head h3 { font-size: 1.15rem; line-height: 1.3; }
.group-head p { margin-top: 6px; color: var(--muted); font-size: 0.95rem; }
@media (min-width: 901px) { .group-head { position: sticky; top: 96px; } }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px; }
.row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 20px; align-items: start; }
.row .tile { width: 64px; height: 64px; }
.row h4 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 1.1rem; letter-spacing: -0.01em; }
.row p { margin-top: 4px; max-width: 38em; }
.row .meta { margin-top: 6px; color: var(--muted); font-size: 0.95rem; }
.row .meta a { color: var(--violet-ink); font-weight: 600; }
.row-link { text-decoration: none; }
.row-link:hover h4 { color: var(--violet-ink); }

@media (max-width: 900px) {
  .group { grid-template-columns: minmax(0, 1fr); }
}

/* cuenta */
.account {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: center;
}
.facts { margin: 32px 0 0; display: grid; gap: 20px; }
.facts div { padding-left: 20px; border-left: 2px solid var(--line); }
.facts dt { font-weight: 600; }
.facts dd { margin: 2px 0 0; color: var(--muted); }
.account-actions { margin-top: 36px; align-items: center; }
.text-link { margin-left: 8px; color: var(--violet-ink); font-weight: 600; font-size: 1rem; text-underline-offset: 4px; }
.text-link:hover { color: var(--violet); }
.account-art { margin: 0; }
.account-art svg { width: 100%; max-width: 460px; margin: 0 auto; display: block; }
@media (max-width: 900px) {
  .account { grid-template-columns: minmax(0, 1fr); }
  .account-art { order: -1; }
  .account-art svg { max-width: 340px; }
}

/* historia */
.story { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.story-copy p + p { margin-top: 12px; color: var(--ink); font-weight: 500; }
.video { border-radius: 24px; overflow: hidden; background: #000; box-shadow: 0 30px 70px -30px rgba(23, 20, 43, 0.5); }
.video video { display: block; width: 100%; aspect-ratio: 16 / 9; }
@media (max-width: 900px) { .story { grid-template-columns: minmax(0, 1fr); } }

/* pie */
.footer {
  max-width: var(--max); margin: 0 auto;
  padding: 40px var(--gutter) 56px;
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 0.95rem;
}
.footer .brand span { color: var(--ink); font-size: 1rem; }
