:root {
  --bg: #07090d;
  --bg-soft: #0c1118;
  --fg: #ecf0f7;
  --muted: #99a4b6;
  --accent: #8ec5ff;
  --accent-2: #b19cff;
  --accent-3: #c5f5d8;
  --rule: #1a212e;
  --max: 760px;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(1400px 700px at 50% -10%, #131a26 0%, transparent 60%),
    radial-gradient(900px 500px at 95% 10%, rgba(177, 156, 255, 0.08) 0%, transparent 70%),
    radial-gradient(900px 500px at 5% 80%, rgba(142, 197, 255, 0.06) 0%, transparent 70%),
    var(--bg);
  color: var(--fg);
  font: 17px/1.7 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* ===== starfield ===== */
.starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.star {
  position: absolute;
  width: 1.5px;
  height: 1.5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  opacity: 0;
  animation: twinkle 6s ease-in-out infinite;
}
.star.lg { width: 2px; height: 2px; background: rgba(177, 156, 255, 0.7); }
.star.xl { width: 2.5px; height: 2.5px; background: rgba(142, 197, 255, 0.8); }
@keyframes twinkle {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.9; }
}

/* ===== layout ===== */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 88px 24px 120px;
  position: relative;
}

/* ===== header ===== */
header {
  margin-bottom: 72px;
}
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 11.5px;
  color: var(--muted);
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.kicker::before {
  content: "";
  display: inline-block;
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-2), transparent);
}
h1 {
  font-size: clamp(44px, 7vw, 72px);
  line-height: 1.0;
  margin: 0 0 20px;
  letter-spacing: -0.035em;
  font-weight: 600;
  background: linear-gradient(180deg, #ffffff 0%, #c8d3e6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lede {
  font-size: clamp(20px, 2.6vw, 26px);
  color: var(--accent);
  margin: 0;
  letter-spacing: -0.015em;
  font-weight: 400;
  font-style: italic;
}

/* ===== sections ===== */
section { margin: 56px 0; }
section:first-of-type { margin-top: 8px; }

h2 {
  font-size: 24px;
  letter-spacing: -0.015em;
  margin: 0 0 20px;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}
h2::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-2);
}

h3 { font-size: 18px; letter-spacing: -0.01em; margin: 24px 0 8px; color: #ffffff; }

p { margin: 0 0 14px; }

ol, ul { padding-left: 1.3em; }
li { margin: 8px 0; }
ol li::marker { color: var(--accent-2); font-weight: 600; }
ul li::marker { color: var(--accent); }

strong { color: #ffffff; font-weight: 600; }
em { color: var(--accent); font-style: normal; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(142, 197, 255, 0.3);
  transition: all 200ms ease;
}
a:hover {
  border-bottom-color: var(--accent);
  color: #b3d8ff;
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 56px 0;
}

/* ===== card blocks ===== */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0));
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 28px 30px;
  margin: 24px 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(142, 197, 255, 0.4), transparent);
}

/* ===== three layers grid ===== */
.layers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.layer {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 20px;
  transition: all 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
.layer:hover {
  border-color: rgba(142, 197, 255, 0.4);
  background: rgba(142, 197, 255, 0.03);
  transform: translateY(-2px);
}
.layer__name {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-2);
  margin: 0 0 8px;
}
.layer__title {
  font-size: 17px;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 8px;
}
.layer__body {
  font-size: 14.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
}

/* ===== outcomes pills ===== */
.outcomes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 12px;
}
.outcome {
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(142, 197, 255, 0.08), rgba(177, 156, 255, 0.08));
  border: 1px solid rgba(142, 197, 255, 0.25);
  font-size: 13.5px;
  letter-spacing: 0.01em;
  color: var(--fg);
  transition: all 250ms ease;
}
.outcome:hover {
  border-color: rgba(177, 156, 255, 0.5);
  transform: translateY(-1px);
}

/* ===== surplus block ===== */
.surplus {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}
@media (max-width: 600px) {
  .surplus { grid-template-columns: 1fr; }
}
.surplus__cell {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 18px 20px;
  text-align: left;
}
.surplus__pct {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0 0 4px;
}
.surplus__label {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* ===== globe / world section ===== */
.world {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 16px 0;
}
.world__item {
  font-size: 13.5px;
  color: var(--fg);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--rule);
  border-radius: 8px;
  text-align: center;
  letter-spacing: 0.01em;
}

/* ===== pact block ===== */
.pact {
  background: linear-gradient(135deg, rgba(142, 197, 255, 0.04), rgba(177, 156, 255, 0.04));
  border: 1px solid rgba(177, 156, 255, 0.2);
  border-radius: var(--radius);
  padding: 32px 32px 28px;
  margin: 24px 0;
  position: relative;
}
.pact::before {
  content: "✦";
  position: absolute;
  top: -12px;
  left: 32px;
  background: var(--bg);
  padding: 0 10px;
  color: var(--accent-2);
  font-size: 14px;
}
.signoff {
  color: var(--muted);
  margin-top: 18px;
  font-size: 14px;
  letter-spacing: 0.02em;
  border-top: 1px solid var(--rule);
  padding-top: 14px;
}

/* ===== footer ===== */
footer {
  margin-top: 88px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 14px;
}
footer p { margin: 6px 0; }
.fineprint { font-size: 12.5px; color: var(--muted); }

/* ===== animations ===== */
@media (prefers-reduced-motion: no-preference) {
  h1 { animation: rise 700ms ease-out both; }
  .lede { animation: rise 800ms 100ms ease-out both; }
  section { animation: fade 900ms ease-out both; }
  section:nth-of-type(1) { animation-delay: 200ms; }
  section:nth-of-type(2) { animation-delay: 280ms; }
  section:nth-of-type(3) { animation-delay: 360ms; }
  section:nth-of-type(4) { animation-delay: 440ms; }
  section:nth-of-type(5) { animation-delay: 520ms; }
  section:nth-of-type(6) { animation-delay: 600ms; }
  section:nth-of-type(7) { animation-delay: 680ms; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== doctrine reading page ===== */
main.doctrine {
  max-width: 720px;
}
main.doctrine h1 { font-size: clamp(36px, 5vw, 52px); }
main.doctrine p { font-size: 16.5px; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 64px;
  font-size: 14px;
  color: var(--muted);
  border-bottom: none;
}
.back-link:hover { color: var(--accent); }

/* ===== FAQ ===== */
.faq { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.faq details {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px 18px;
  transition: border-color 220ms ease, background 220ms ease;
}
.faq details[open] {
  border-color: rgba(142,197,255,0.35);
  background: rgba(142,197,255,0.04);
}
.faq summary {
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  color: #fff;
  position: relative;
  padding-right: 20px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  color: var(--accent-2);
  font-weight: 400;
  transition: transform 200ms ease;
}
.faq details[open] summary::after { content: "−"; }
.faq p { margin: 12px 0 4px; color: var(--muted); font-size: 15.5px; }
.faq a { color: var(--accent); }

/* ===== log page ===== */
.log-list { display: flex; flex-direction: column; gap: 14px; margin: 24px 0; }
.log-entry {
  border-left: 2px solid var(--accent-2);
  padding: 4px 0 4px 18px;
}
.log-entry__date {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 4px;
}
.log-entry__body { margin: 0; color: var(--fg); font-size: 16px; }
.log-entry__body strong { color: #fff; }
