@import url('https://fonts.googleapis.com/css2?family=Saira:wght@400;500;600;700;800;900&family=Intel+One+Mono:wght@400;500;600;700&display=swap');

:root {
  /* ---- Choose K's own tokens, taken directly from choosek.com ---- */
  --void: #000000;
  --surface: #f3f3f3;
  --surface-2: #e3e3e3;
  --bevel: #d2d2d2;
  --shadow: #717171;
  --ink-on-light: #323232;
  --ink-on-dark: #f2f2f2;

  /* ---- Extended for a full dark console (not present on the marketing
     site, but derived to stay within the same grayscale family) ---- */
  --ink-on-dark-dim: #9a9a9a;
  --ink-on-dark-faint: #7d7d7d;
  --ink-on-light-dim: #656565;
  --line-on-dark: rgba(242, 242, 242, 0.16);
  --screen: #0a0a0a;
  --screen-line: rgba(242, 242, 242, 0.12);
  --glow: rgba(255, 255, 255, 0.55);

  /* ---- Type ---- */
  --font-display: 'Saira', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Intel One Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* ---- Elevation: Choose K's signature hard, unblurred offset shadow ---- */
  --lift: 6px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--void);
  color: var(--ink-on-dark);
  font-family: var(--font-display);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--ink-on-dark); color: var(--void); }

:focus-visible {
  outline: 2px solid var(--ink-on-dark);
  outline-offset: 2px;
}
.panel :focus-visible, .module-card :focus-visible {
  outline: 2px solid var(--ink-on-light);
  outline-offset: 2px;
}

.bg-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--void);
}
#bgStatic { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.9; }
.bg-field::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, transparent 30%, #000 100%);
}

/* ==========================================================================
   Top navigation — kept off the card system on purpose: Choose K's own
   site has no header chrome at all, so this stays a bare strip on the void.
   ========================================================================== */

.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-on-dark);
}
.topnav-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand { display: flex; align-items: baseline; gap: 9px; margin-right: auto; }
.brand-word {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.01em;
  color: var(--ink-on-dark);
  white-space: nowrap;
}
.brand-word .thin { font-weight: 500; color: var(--ink-on-dark-dim); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line-on-dark);
}
.nav-link {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--ink-on-dark-dim);
  padding: 9px 18px;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-link:hover { color: var(--ink-on-dark); }
.nav-link.active { color: var(--void); background: var(--ink-on-dark); }

.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-on-dark-faint);
  white-space: nowrap;
}
.status-dot {
  width: 6px; height: 6px;
  background: var(--ink-on-dark-dim);
  animation: statusBlink 1.8s steps(1) infinite;
  flex-shrink: 0;
}
.status-dot.dot-live { background: var(--ink-on-dark); animation: statusPulse 2.2s ease-in-out infinite; }
@keyframes statusBlink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.25; } }
@keyframes statusPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.nav-status .status-text { display: none; }
@media (min-width: 560px) { .nav-status .status-text { display: inline; } }

/* ==========================================================================
   Type helpers
   ========================================================================== */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-on-dark-faint);
  margin: 0 0 10px;
}
.panel .eyebrow, .module-card .eyebrow { color: var(--ink-on-light-dim); }
.tabular { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Buttons — matched to Choose K's own subscribe button: a black block,
   light text, thin light border. No radius, no color, ever.
   ========================================================================== */

.btn {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 13px 20px;
  border-radius: 0;
  border: 1px solid var(--void);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active { transform: translate(2px, 2px); }
.btn:disabled { cursor: not-allowed; opacity: 0.35; transform: none; }

/* Primary: black block, on either a light card or the dark void */
.btn-primary {
  background: var(--void);
  color: var(--ink-on-dark);
  border-color: var(--ink-on-light);
  box-shadow: 4px 4px 0 0 var(--shadow);
}
.btn-primary:hover:not(:disabled) { background: #1a1a1a; }
.btn-primary:active:not(:disabled) { box-shadow: 1px 1px 0 0 var(--shadow); }

/* Inverted: used as the "engaged / stop" state — same button, flipped */
.btn-invert {
  background: var(--ink-on-dark);
  color: var(--void);
  border-color: var(--void);
  box-shadow: 4px 4px 0 0 var(--shadow);
}
.btn-invert:hover:not(:disabled) { background: #d8d8d8; }
.btn-invert:active:not(:disabled) { box-shadow: 1px 1px 0 0 var(--shadow); }

/* Ghost: outline only, sits on light cards */
.btn-ghost {
  background: transparent;
  border-color: var(--ink-on-light);
  color: var(--ink-on-light);
}
.btn-ghost:hover:not(:disabled) { background: var(--ink-on-light); color: var(--surface); }
.btn-ghost:disabled { border-color: var(--bevel); color: var(--bevel); }

.btn-block { width: 100%; }

/* ==========================================================================
   Inputs
   ========================================================================== */

.input {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--ink-on-light);
  color: var(--ink-on-light);
  border-radius: 0;
  padding: 12px 14px;
  width: 100%;
}
.input:focus { outline: 2px solid var(--ink-on-light); outline-offset: 1px; }
.input::placeholder { color: var(--ink-on-light-dim); }

/* ==========================================================================
   Panels — the card system. Light surface, sharp corners, a hard unblurred
   offset shadow. This is Choose K's own elevation technique, reimplemented
   with a single box-shadow instead of nested offset divs.
   ========================================================================== */

.panel {
  background: var(--surface);
  color: var(--ink-on-light);
  border-radius: 0;
  box-shadow: var(--lift) var(--lift) 0 0 var(--shadow);
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.panel-head .eyebrow { margin: 0; }

.stat-big {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.1;
  color: var(--ink-on-light);
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  word-break: break-all;
}
.stat-big .unit { font-size: 15px; font-weight: 500; color: var(--ink-on-light-dim); }
.stat-big .eth-glyph { font-weight: 500; color: var(--ink-on-light-dim); }
.stat-caption { margin: 6px 0 0; font-size: 12px; color: var(--ink-on-light-dim); }
.stat-big.flash, .stat-big .flash { animation: statFlash 0.9s ease; }
@keyframes statFlash {
  0% { color: var(--ink-on-light); background: #000; }
  15% { color: var(--surface); background: #000; }
  100% { color: var(--ink-on-light); background: transparent; }
}

.field-row { display: flex; gap: 10px; margin-top: 16px; }
.field-row .input { flex: 1; min-width: 0; }

.panel-foot-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--ink-on-light-dim);
  line-height: 1.55;
}

/* ==========================================================================
   Throne status line
   ========================================================================== */

.throne-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-on-light-dim);
}
.throne-glyph {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.3;
  color: var(--ink-on-light-dim);
}
.throne-glyph.st-mine { color: var(--ink-on-light); animation: glyphPulse 1.6s ease-in-out infinite; }
.throne-glyph.st-theirs { color: var(--ink-on-light-dim); }
@keyframes glyphPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.throne-status .throne-text b { color: var(--ink-on-light); font-family: var(--font-mono); font-weight: 600; }

/* ==========================================================================
   Screens — the black inset displays for the visualization and the log,
   set into their light housings like a CRT into an instrument's bezel.
   ========================================================================== */

.screen-housing { padding: 16px; }
.screen-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.screen {
  background: var(--screen);
  border: 1px solid #000;
}

.log-console {
  height: 220px;
  overflow-y: auto;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--ink-on-dark-dim);
}
.log-line { display: flex; gap: 10px; white-space: pre-wrap; word-break: break-word; }
.log-time { color: var(--ink-on-dark-faint); flex-shrink: 0; }
.log-tag { flex-shrink: 0; color: var(--ink-on-dark-dim); }
.log-msg { color: var(--ink-on-dark-dim); }
.log-success .log-tag, .log-success .log-msg { color: var(--ink-on-dark); font-weight: 600; }
.log-warn .log-msg { color: var(--ink-on-dark); }
.log-error .log-tag, .log-error .log-msg { color: var(--ink-on-dark); font-weight: 700; }
.log-accent .log-tag { color: var(--ink-on-dark); font-weight: 600; }

.log-console::-webkit-scrollbar { width: 8px; }
.log-console::-webkit-scrollbar-thumb { background: var(--ink-on-dark-faint); }
.log-console::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  padding: 20px;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  color: var(--ink-on-light);
  border-radius: 0;
  padding: 26px;
  box-shadow: 8px 8px 0 0 var(--shadow);
  transform: translate(-4px, -4px);
  transition: transform 0.15s ease;
}
.modal-overlay.open .modal { transform: translate(0, 0); }

.modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  margin: 0 0 14px;
}
.modal-body { font-size: 14px; color: var(--ink-on-light-dim); line-height: 1.6; }
.modal-body .kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bevel);
}
.modal-body .kv:last-child { border-bottom: none; }
.modal-body .kv b { color: var(--ink-on-light); font-weight: 600; word-break: break-all; text-align: right; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.modal-actions .btn { width: 100%; }

/* ==========================================================================
   App shell (index.html)
   ========================================================================== */

.shell { max-width: 1240px; margin: 0 auto; padding: 40px 28px 80px; }

.workspace-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 22px;
  align-items: start;
}
@media (max-width: 900px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .mode-sidebar { position: static !important; }
}

.mode-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 84px;
}

.mode-card {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink-on-light);
  border: 1px solid transparent;
  border-radius: 0;
  box-shadow: var(--lift) var(--lift) 0 0 var(--shadow);
  padding: 24px 22px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.mode-card:hover { background: var(--surface-2); }
.mode-card:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 0 var(--shadow); }
.mode-card.active {
  background: var(--void);
  color: var(--ink-on-dark);
  border-color: var(--ink-on-dark);
}
.mode-card.active:hover { background: #141414; }

.mode-card-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.mode-card-desc {
  display: block;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-on-light-dim);
}
.mode-card.active .mode-card-desc { color: var(--ink-on-dark-dim); }

.mode-content { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

/* ---- Search node panel ---- */

.search-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.search-line { margin: 2px 0 0; color: var(--ink-on-light-dim); font-size: 13.5px; }

/* ==========================================================================
   About page
   ========================================================================== */

.about-hero { padding: 56px 0 20px; }
.about-hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 42px;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  color: var(--ink-on-dark);
}
.about-hero h1 u {
  text-decoration: none;
  border-bottom: 4px solid var(--ink-on-dark);
}
.about-lede { font-size: 17px; line-height: 1.7; color: var(--ink-on-dark-dim); margin: 0; }

.section-gap { margin-top: 64px; }
.section-head { max-width: 62ch; margin-bottom: 28px; }
.section-head h2 { font-family: var(--font-display); font-weight: 700; font-size: 24px; color: var(--ink-on-dark); margin: 0 0 10px; }
.section-head p { color: var(--ink-on-dark-dim); font-size: 14.5px; line-height: 1.65; margin: 0; }

/* ---- Full-width math sections ---- */
.math-section { margin-top: 40px; }
.math-section .panel { padding: 32px 34px; }
.math-section h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  margin: 0 0 6px;
  color: var(--ink-on-light);
}
.math-section .sub {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-on-light-dim);
  margin: 0 0 20px;
}
.math-section p {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink-on-light);
  margin: 0 0 16px;
  max-width: 74ch;
}
.math-section p:last-child { margin-bottom: 0; }
.math-section .dim { color: var(--ink-on-light-dim); }
.math-section strong { font-weight: 700; color: var(--ink-on-light); }
.math-section code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 1px 5px;
  border: 1px solid var(--bevel);
}
.math-section ul { margin: 0 0 16px; padding-left: 22px; max-width: 74ch; }
.math-section li { font-size: 15px; line-height: 1.7; color: var(--ink-on-light); margin-bottom: 8px; }

/* General/background sections (not module-specific) go the full container
   width instead of the readability-capped measure used for the long-form
   module write-ups. */
.math-section.full-width p,
.math-section.full-width ul,
.math-section.full-width li { max-width: none; }

/* Display-math callout: a boxed equation block that survives on the light card */
.math-callout {
  background: var(--surface-2);
  border-left: 3px solid var(--ink-on-light);
  padding: 18px 22px;
  margin: 0 0 20px;
  overflow-x: auto;
  overflow-y: hidden;
}
.math-callout p { margin: 0; font-size: 15px; }

/* Sup/reference citation markers */
.ref-cite {
  font-family: var(--font-mono);
  font-size: 0.72em;
  vertical-align: super;
  color: var(--ink-on-light-dim);
  text-decoration: none;
  padding: 0 1px;
}
.ref-cite:hover { color: var(--ink-on-light); }

/* Reference list — now nested inside each module's light content panel
   (rather than a standalone dark section), so it uses the on-light ink
   tokens and separates from the prose above with a rule instead of a
   page-level heading. */
.ref-list {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--bevel);
}
.ref-list-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-on-light-dim);
  margin: 0 0 16px;
}
.ref-list ol { margin: 0; padding-left: 0; list-style: none; counter-reset: ref; }
.ref-list li {
  counter-increment: ref;
  position: relative;
  padding-left: 38px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-on-light-dim);
}
.ref-list li:last-child { margin-bottom: 0; }
.ref-list li::before {
  content: "[" counter(ref) "]";
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-on-light);
}
.ref-list li .authors { color: var(--ink-on-light); }
.ref-list li .venue { font-style: italic; color: var(--ink-on-light-dim); }
.ref-list li a { color: var(--ink-on-light-dim); text-decoration: underline; text-underline-offset: 2px; }
.ref-list li a:hover { color: var(--ink-on-light); }

.flow-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
@media (max-width: 760px) { .flow-row { grid-template-columns: 1fr; gap: 24px; } .flow-step::after { display: none; } }
.flow-step { position: relative; padding: 0 20px 0 0; }
.flow-step:first-child { padding-left: 0; }
.flow-step::after { content: ''; position: absolute; top: 14px; right: 0; width: 20px; height: 1px; background: var(--line-on-dark); }
.flow-step:last-child::after { display: none; }
.flow-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--void);
  background: var(--ink-on-dark);
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.flow-step h4 { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--ink-on-dark); margin: 0 0 8px; }
.flow-step p { font-size: 13.5px; line-height: 1.65; color: var(--ink-on-dark-dim); margin: 0; }

.note-panel { border: 1px solid var(--line-on-dark); padding: 20px 22px; }
.note-panel p { font-size: 13.5px; line-height: 1.7; color: var(--ink-on-dark-dim); margin: 0; }
.note-panel .note-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-on-dark); margin: 0 0 10px; }

.about-cta { display: flex; align-items: center; gap: 18px; padding: 40px 0 20px; flex-wrap: wrap; }
.about-cta p { margin: 0; color: var(--ink-on-dark-dim); font-size: 14px; }

/* ==========================================================================
   Responsive + motion
   ========================================================================== */

@media (max-width: 900px) {
  .topnav-inner { padding: 0 16px; gap: 12px; }
}
@media (max-width: 480px) {
  .topnav-inner { gap: 8px; }
  .brand-word .thin { display: none; }
  .brand-word { font-size: 14px; }
  .nav-link { padding: 8px 12px; font-size: 11px; }
}
@media (max-width: 640px) {
  .panel { box-shadow: 4px 4px 0 0 var(--shadow); }
  .btn-primary, .btn-invert { box-shadow: 3px 3px 0 0 var(--shadow); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
