/* ==========================================================================
   ChromaRise - shared stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design tokens
   -------------------------------------------------------------------------- */
:root {
  --bg: #0b0d10;
  --bg-deep: #07080a;
  --surface: #11141a;
  --surface-elev: #161a22;
  --text: #e6e8eb;
  --muted: #9aa3ad;
  --muted-2: #6c7681;
  --accent: #7c9cff;
  --accent-2: #b794ff;
  --accent-3: #76e4f7;
  --rule: rgba(255, 255, 255, 0.06);
  --rule-strong: rgba(255, 255, 255, 0.12);
  --selection: rgba(124, 156, 255, 0.28);
  --code-bg: rgba(255, 255, 255, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fafafa;
    --bg-deep: #f0f1f3;
    --surface: #ffffff;
    --surface-elev: #ffffff;
    --text: #14171c;
    --muted: #5b6470;
    --muted-2: #828c97;
    --accent: #3656d1;
    --accent-2: #7a3fc9;
    --accent-3: #1f8aa6;
    --rule: rgba(0, 0, 0, 0.08);
    --rule-strong: rgba(0, 0, 0, 0.14);
    --selection: rgba(54, 86, 209, 0.18);
    --code-bg: rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  }
}

/* --------------------------------------------------------------------------
   Reset + base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--selection); }

/* --------------------------------------------------------------------------
   Typography (shared)
   -------------------------------------------------------------------------- */
.eyebrow {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

h1 {
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  font-weight: 700;
}

h2 {
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin: 56px 0 12px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  font-weight: 600;
}

h3 {
  font-size: 16px;
  margin: 28px 0 8px;
  font-weight: 600;
  color: var(--text);
}

p,
ul,
ol { margin: 0 0 16px; }
ul,
ol { padding-left: 22px; }
li { margin-bottom: 6px; }
li::marker { color: var(--muted); }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease, color 120ms ease;
}
a:hover { border-bottom-color: var(--accent); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

strong { color: var(--text); font-weight: 600; }
em { color: var(--muted); font-style: normal; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
}

/* Skip link (accessibility) */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--rule-strong);
  font-size: 14px;
  z-index: 1000;
  transition: top 150ms ease;
}
.skip-link:focus { top: 16px; }

/* ==========================================================================
   Home page
   ========================================================================== */
.home-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  overflow-x: hidden;
}

/* Animated background canvas */
.bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Atmospheric gradient orbs (CSS, layered above canvas) */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  filter: blur(120px);
  background-image:
    radial-gradient(160% 170% at -30% -30%,
      color-mix(in srgb, var(--accent) 48%, transparent) 0%,
      transparent 75%),
    radial-gradient(115% 120% at 130% 130%,
      color-mix(in srgb, var(--accent-2) 48%, transparent) 0%,
      transparent 75%),
    radial-gradient(90% 95% at 120% -15%,
      color-mix(in srgb, var(--accent-3) 30%, transparent) 0%,
      transparent 75%);
}

.home-main {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(32px, 6vw, 64px) clamp(20px, 5vw, 32px);
}

.hero {
  width: 100%;
  max-width: 640px;
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 36px;
  font-size: 16px;
  letter-spacing: 0.22em;
  color: var(--muted);
  font-weight: 500;
}
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(from 180deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  box-shadow: 0 0 18px rgba(124, 156, 255, 0.5);
}

.hero h1 {
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 20px;
  padding-bottom: 0.15em;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 60%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .lede {
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.6;
  margin: 0 auto 40px;
  max-width: 480px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 14px;
  margin: 0 0 32px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 0 0 rgba(118, 228, 247, 0.6);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(118, 228, 247, 0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(118, 228, 247, 0); }
  100% { box-shadow: 0 0 0 0 rgba(118, 228, 247, 0); }
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 22px;
  font-size: 14px;
  color: var(--muted-2);
}
.hero-links a {
  color: var(--text);
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 2px;
}
.hero-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.home-footer {
  position: relative;
  z-index: 2;
  padding: 24px clamp(20px, 5vw, 32px);
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
  letter-spacing: 0.02em;
}

/* Honor reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .status-dot { animation: none; }
  * { transition-duration: 0ms !important; }
}

/* ==========================================================================
   Privacy page
   ========================================================================== */
.privacy-main {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) clamp(20px, 5vw, 32px) 160px;
}

.privacy-main h1 + .lede {
  color: var(--muted);
  margin: 0 0 40px;
  font-size: 17px;
}
.privacy-main h1::after {
  content: "";
  display: block;
  width: 48px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  margin: 20px 0 0;
}

.privacy-main section:first-of-type h2 {
  margin-top: 8px;
  padding-top: 0;
  border-top: 0;
}

.meta-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 0 0 40px;
  font-size: 15px;
  color: var(--muted);
}
.meta-card div { margin: 2px 0; }
.meta-card strong { color: var(--text); font-weight: 500; margin-right: 6px; }

.toc {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 16px 22px;
  margin: 0 0 48px;
  font-size: 14px;
}
.toc summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  list-style: none;
  user-select: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after {
  content: " ›";
  transition: transform 150ms ease;
  display: inline-block;
}
.toc[open] summary::after { transform: rotate(90deg); }
.toc ol {
  margin: 14px 0 4px;
  padding-left: 22px;
  columns: 2;
  column-gap: 32px;
}
.toc li { margin-bottom: 4px; break-inside: avoid; }
.toc a { color: var(--text); border-bottom: 0; }
.toc a:hover { color: var(--accent); }

@media (max-width: 540px) {
  .toc ol { columns: 1; }
}

.signature {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 15px;
}
.signature strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

/* ==========================================================================
   Screencast page
   ========================================================================== */
.screencast-body {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 48px);
  font-size: 16px;
  line-height: 1.6;
}
html.screencast-html,
.screencast-body { min-height: 100%; }

.screencast-main {
  width: 100%;
  max-width: 960px;
}
.screencast-main h1 {
  font-size: clamp(24px, 3.5vw, 32px);
  line-height: 1.2;
  margin: 0 0 6px;
}
.screencast-main .lede {
  color: var(--muted);
  margin: 0 0 28px;
  font-size: 15px;
}

.player {
  position: relative;
  background: #000;
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: var(--shadow-lg);
}
.player video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.actions {
  margin-top: 20px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}
.actions a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
}
.actions a:hover { border-bottom-color: var(--accent); }

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.6;
}
