/* Starscape Account. Night is the sky; day (light mode) is the printed chart.
 * Tokens follow starscape.biz (Starscape v4). Fonts are self-hosted OFL; see fonts/LICENSE-*.
 * No inline styles anywhere: the page CSP is style-src 'self'. */

@font-face { font-family: "Mona Sans"; src: url("/assets/fonts/mona-sans.woff2") format("woff2"); font-weight: 400 700; font-stretch: 100%; font-style: normal; font-display: swap; }
@font-face { font-family: "Hubot Sans"; src: url("/assets/fonts/hubot-sans.woff2") format("woff2"); font-weight: 750 800; font-stretch: 100% 125%; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("/assets/fonts/newsreader.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("/assets/fonts/newsreader-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 400 500; font-style: normal; font-display: swap; }

:root {
  color-scheme: dark light;
  --c-starlight: 168 192 255;
  --c-cyan-lit: 92 196 236;
  --c-ember: 240 178 110;
  --c-teal: 15 118 110;
  --c-amber-ink: 150 82 20;
  --c-paper: 245 236 214;
  --c-ink: 29 37 40;
  --c-night: 10 15 32;

  --font-wordmark: "Hubot Sans", "Mona Sans", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-sans: "Mona Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-lg: 22px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --bg: rgb(var(--c-night));
  --bg-2: rgb(19 28 60);
  --surface: rgb(16 23 48 / 0.72);
  --surface-solid: rgb(16 23 48);
  --text: rgb(234 239 255);
  --text-muted: rgb(234 239 255 / 0.72);
  --text-faint: rgb(234 239 255 / 0.56);   /* >= 4.5:1 on night and its surfaces */
  --line: rgb(var(--c-starlight) / 0.14);
  --line-strong: rgb(var(--c-starlight) / 0.3);
  --accent: rgb(var(--c-starlight));
  --accent-2: rgb(var(--c-ember));
  --live: rgb(var(--c-cyan-lit));
  --focus: rgb(var(--c-cyan-lit));
  --btn-bg: rgb(232 238 255);
  --btn-text: rgb(9 13 28);
  --ok: rgb(var(--c-cyan-lit));
  --warn: rgb(var(--c-ember));
  --star: 234 239 255;
  --star-warm: var(--c-ember);
  --star-cool: var(--c-starlight);
  --sky-opacity: 1;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: rgb(var(--c-paper));
    --bg-2: rgb(250 244 228);
    --surface: rgb(255 251 241 / 0.82);
    --surface-solid: rgb(255 251 241);
    --text: rgb(var(--c-ink));
    --text-muted: rgb(var(--c-ink) / 0.76);
    --text-faint: rgb(var(--c-ink) / 0.68);  /* >= 4.5:1 on parchment */
    --line: rgb(var(--c-ink) / 0.13);
    --line-strong: rgb(var(--c-ink) / 0.3);
    --accent: rgb(var(--c-teal));
    --accent-2: rgb(var(--c-amber-ink));
    --live: rgb(var(--c-teal));
    --focus: rgb(var(--c-teal));
    --btn-bg: rgb(var(--c-ink));
    --btn-text: rgb(var(--c-paper));
    --ok: rgb(var(--c-teal));
    --warn: rgb(var(--c-amber-ink));
    --star: 29 37 40;
    --star-warm: var(--c-amber-ink);
    --star-cool: var(--c-teal);
    --sky-opacity: 0.45;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
body.is-busy { cursor: progress; }
::selection { background: rgb(var(--c-cyan-lit) / 0.3); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ---- sky: a fixed, composited layer (not background-attachment: fixed, which
 * repaints on every scroll and is ignored by iOS) with two drifting starfields --- */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: radial-gradient(130% 70% at 50% -12%, var(--bg-2), var(--bg) 62%); }
.stars { position: absolute; inset: -640px; opacity: var(--sky-opacity); }
.stars-far {
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgb(var(--star) / 0.55), transparent 70%),
    radial-gradient(1px 1px at 68% 42%, rgb(var(--star) / 0.45), transparent 70%),
    radial-gradient(1px 1px at 34% 76%, rgb(var(--star) / 0.5), transparent 70%),
    radial-gradient(1px 1px at 86% 88%, rgb(var(--star) / 0.4), transparent 70%),
    radial-gradient(1px 1px at 52% 8%, rgb(var(--star) / 0.35), transparent 70%),
    radial-gradient(1px 1px at 92% 30%, rgb(var(--star) / 0.3), transparent 70%);
  background-size: 320px 320px;
  animation: drift-far 260s linear infinite;
}
.stars-near {
  background-image:
    radial-gradient(1.5px 1.5px at 22% 64%, rgb(var(--star-cool) / 0.85), transparent 70%),
    radial-gradient(1.5px 1.5px at 78% 22%, rgb(var(--star-warm) / 0.75), transparent 70%),
    radial-gradient(1.2px 1.2px at 46% 46%, rgb(var(--star) / 0.7), transparent 70%),
    radial-gradient(1.2px 1.2px at 8% 92%, rgb(var(--star) / 0.5), transparent 70%);
  background-size: 640px 640px;
  animation: drift-near 180s linear infinite, twinkle 9s ease-in-out infinite alternate;
}
@keyframes drift-far { to { transform: translate3d(-320px, -320px, 0); } }
@keyframes drift-near { to { transform: translate3d(640px, -640px, 0); } }
@keyframes twinkle { from { opacity: calc(var(--sky-opacity) * 0.65); } to { opacity: var(--sky-opacity); } }

/* ---- chrome ---------------------------------------------------------------- */
.wrap { width: min(100% - 2.5rem, 68rem); margin-inline: auto; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem clamp(1.25rem, 4vw, 3rem); }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--text); text-decoration: none; }
.brand-star { width: 34px; height: 34px; filter: drop-shadow(0 0 14px rgb(var(--c-cyan-lit) / 0.35)); }
.wordmark { font-family: var(--font-wordmark); font-size: 0.95rem; font-weight: 800; font-stretch: 118%; letter-spacing: 0.14em; text-transform: uppercase; }
.brand-tag { padding-left: 0.7rem; border-left: 1px solid var(--line-strong); color: var(--text-faint); font: 500 0.7rem/1 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; }
.pilot { padding: 0.25rem 0.65rem; border: 1px solid currentColor; border-radius: 999px; color: var(--accent-2); font: 500 0.66rem/1.2 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; }
main { flex: 1; padding-block: clamp(2rem, 8vh, 5.5rem) 3.5rem; }
.foot { padding-block: 1.75rem 2.5rem; border-top: 1px solid var(--line); color: var(--text-faint); font-size: 0.85rem; }
.foot p { margin: 0; }
.foot a { color: var(--text-muted); }

/* ---- type ------------------------------------------------------------------ */
.hero { max-width: 46rem; }
.eyebrow { margin: 0 0 1rem; color: var(--accent); font: 500 0.72rem/1.4 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; }
.display { margin: 0; font-family: var(--font-display); font-size: clamp(2.6rem, 2rem + 3.8vw, 4.8rem); font-weight: 400; line-height: 1.03; letter-spacing: -0.015em; text-wrap: balance; }
.display em { color: var(--accent-2); font-style: italic; }
.hero-compact .display { font-size: clamp(2.3rem, 1.8rem + 2.8vw, 3.8rem); }
.lede { max-width: 36rem; margin: 1.25rem 0 0; color: var(--text-muted); font-size: clamp(1.06rem, 1rem + 0.35vw, 1.25rem); text-wrap: pretty; }
.fine { margin: 1rem 0 0; color: var(--text-faint); font-size: 0.875rem; }

/* ---- controls -------------------------------------------------------------- */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0.7rem 1.3rem;
  border: 1px solid transparent; border-radius: 999px;
  font: 600 0.95rem/1 var(--font-sans); letter-spacing: 0.01em; text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease), opacity 0.2s;
}
.btn-primary { background: var(--btn-bg); color: var(--btn-text); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 32px -14px rgb(var(--c-cyan-lit) / 0.6); }
.btn-quiet { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-quiet:hover { border-color: var(--accent); color: var(--accent); }
.btn[disabled] { opacity: 0.55; cursor: progress; transform: none; box-shadow: none; }
.arrow { transition: transform 0.3s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* ---- signed out -------------------------------------------------------------- */
.promises { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.5rem 1.75rem; margin-top: clamp(3.5rem, 9vh, 6rem); }
.promise { padding-top: 1.25rem; border-top: 1px solid var(--line-strong); }
.promise h2 { margin: 0 0 0.5rem; color: var(--accent-2); font: 500 0.72rem/1.4 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; }
.promise p { margin: 0; color: var(--text-muted); }

/* ---- signed in --------------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-top: 2.75rem; }
.card { padding: clamp(1.25rem, 3vw, 1.9rem); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.card-wide { grid-column: 1 / -1; }
.card h2 { margin: 0 0 1.1rem; color: var(--text-faint); font: 500 0.72rem/1.4 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; }
.card > p { margin: 0; color: var(--text-muted); }
.card > .actions { margin-top: 1.25rem; }

.facts { display: grid; gap: 0.85rem; margin: 0; }
.facts div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 1rem; align-items: baseline; padding-bottom: 0.85rem; border-bottom: 1px solid var(--line); }
.facts div:last-child { padding-bottom: 0; border-bottom: 0; }
.facts dt { color: var(--text-faint); font-size: 0.875rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.mono { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.78rem; }

.badge { display: inline-flex; align-items: center; padding: 0.15rem 0.6rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text-muted); font: 500 0.66rem/1.5 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; vertical-align: 0.12em; }
.badge-ok { color: var(--ok); border-color: currentColor; }
.badge-warn { color: var(--warn); border-color: currentColor; }

.devices { display: grid; margin: 0; padding: 0; list-style: none; }
.device { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.9rem; align-items: center; padding: 0.85rem 0; border-bottom: 1px solid var(--line); transition: opacity 0.28s var(--ease), transform 0.28s var(--ease); }
.device:first-child { padding-top: 0; }
.device:last-child { padding-bottom: 0; border-bottom: 0; }
.device-text { display: grid; gap: 0.1rem; min-width: 0; }
.device-text strong { font-weight: 600; }
.device-text span { color: var(--text-muted); font-size: 0.9rem; }
.device-text .fine { margin: 0.2rem 0 0; font-size: 0.8rem; }
.device-mark { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--line-strong); }
.is-current .device-mark { background: var(--live); box-shadow: 0 0 0 4px rgb(var(--c-cyan-lit) / 0.12), 0 0 14px rgb(var(--c-cyan-lit) / 0.7); animation: pulse 3.2s ease-in-out infinite; }
.is-current .badge { color: var(--live); border-color: currentColor; }
.device.is-leaving { opacity: 0; transform: translateX(12px); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgb(var(--c-cyan-lit) / 0), 0 0 20px rgb(var(--c-cyan-lit) / 0.9); } }

.more { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.more summary { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text-muted); cursor: pointer; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: ""; width: 0.42rem; height: 0.42rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.25s var(--ease); }
.more[open] summary::before { transform: rotate(45deg); }
.more summary:hover { color: var(--text); }
.more-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.25rem 1.75rem; margin-top: 1.1rem; }
.option .fine { margin-top: 0.5rem; }

/* ---- feedback ------------------------------------------------------------------ */
.notice { max-width: 46rem; margin: 0 0 2rem; padding: 0.85rem 1.1rem; border: 1px solid var(--line); border-left: 3px solid var(--ok); border-radius: var(--radius); background: var(--surface); }
.notice-warn { border-left-color: var(--warn); }
.toast { position: fixed; bottom: 1.5rem; left: 50%; z-index: 10; max-width: min(92vw, 30rem); margin: 0; padding: 0.8rem 1.1rem; border: 1px solid var(--line-strong); border-left: 3px solid var(--warn); border-radius: var(--radius); background: var(--surface-solid); box-shadow: 0 20px 50px -20px rgb(0 0 0 / 0.6); transform: translateX(-50%); }
.toast[hidden] { display: none; }

/* ---- responsive & motion ------------------------------------------------------ */
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .brand-tag, .pilot { display: none; }
  .facts div { grid-template-columns: 1fr; gap: 0.15rem; }
  .device { grid-template-columns: auto minmax(0, 1fr); }
  .device > .btn, .device > .badge { grid-column: 2; justify-self: start; }
  .actions .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero, .notice, .promise, .card { animation: rise 0.8s var(--ease) both; }
  .promise:nth-child(2), .card:nth-child(2) { animation-delay: 0.08s; }
  .promise:nth-child(3), .card:nth-child(3) { animation-delay: 0.16s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  .stars, .is-current .device-mark { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
@media (forced-colors: active) {
  .device-mark, .is-current .device-mark { background: CanvasText; box-shadow: none; }
  .card, .notice, .toast { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
