/* Trading AI — public site
 * Editorial-financial. Paper warmth + ink gravitas. Fraunces display + Inter
 * body + JetBrains Mono numerals. Light by default; dark optional.
 *
 * Designprinsipp: equity-kurven er helten. Alt annet underordnes typografi
 * og hairline-linjer. Ingen iconography-støy, ingen marketing-fluff.
 */

:root {
  /* Paper-warm palette (light) */
  --paper:        oklch(0.985 0.008 80);
  --paper-2:      oklch(0.965 0.010 78);
  --paper-3:      oklch(0.945 0.011 76);
  --ink:          oklch(0.20 0.012 50);
  --ink-2:        oklch(0.36 0.012 55);
  --ink-3:        oklch(0.54 0.010 60);
  --ink-4:        oklch(0.68 0.009 65);
  --hairline:     oklch(0.86 0.010 70);
  --hairline-soft: oklch(0.92 0.008 70);

  --pos:          oklch(0.46 0.130 145);
  --pos-soft:     oklch(0.46 0.130 145 / 0.10);
  --neg:          oklch(0.50 0.180 28);
  --neg-soft:     oklch(0.50 0.180 28 / 0.10);
  --accent:       oklch(0.42 0.140 60);   /* gold-ink for status accents */

  --font-display: 'Fraunces', 'Iowan Old Style', 'Apple Garamond', Georgia, serif;
  --font-body:    'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --container: 1180px;
  --r-md: 6px;
  --r-lg: 12px;
  --r-xl: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    oklch(0.16 0.010 60);
    --paper-2:  oklch(0.19 0.010 60);
    --paper-3:  oklch(0.22 0.010 60);
    --ink:      oklch(0.96 0.005 80);
    --ink-2:    oklch(0.78 0.008 75);
    --ink-3:    oklch(0.62 0.008 70);
    --ink-4:    oklch(0.46 0.008 65);
    --hairline: oklch(0.30 0.012 60);
    --hairline-soft: oklch(0.24 0.012 60);
    --pos:      oklch(0.78 0.180 145);
    --pos-soft: oklch(0.78 0.180 145 / 0.14);
    --neg:      oklch(0.74 0.190 28);
    --neg-soft: oklch(0.74 0.190 28 / 0.14);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "ss01" 1, "cv11" 1;
  letter-spacing: -0.005em;
}

a { color: inherit; text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent); }

em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
}

/* ---------------------------------------------------------------- container */

.container {
  max-width: var(--container);
  padding: 0 32px;
  margin: 0 auto;
}

@media (max-width: 720px) {
  .container { padding: 0 20px; }
}

/* ------------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in oklch, var(--paper) 90%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--hairline-soft);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  letter-spacing: -0.01em;
  font-weight: 500;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background:
    radial-gradient(120% 120% at 30% 20%, var(--paper-2) 0%, transparent 60%),
    linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--ink) 15%, transparent);
}

.brand em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
}

.topnav {
  display: flex;
  gap: 28px;
  font-size: 14px;
  color: var(--ink-2);
}

.topnav a { letter-spacing: 0; }

@media (max-width: 720px) {
  .topnav { display: none; }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--hairline);
}

.status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-4);
  box-shadow: 0 0 0 0 currentColor;
}

.status[data-state="ok"] .dot {
  background: var(--pos);
  animation: pulse 2.4s ease-in-out infinite;
}
.status[data-state="ok"] { color: var(--pos); }

.status[data-state="killed"] .dot { background: var(--neg); }
.status[data-state="killed"] { color: var(--neg); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--pos) 60%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in oklch, var(--pos) 0%, transparent); }
}

/* --------------------------------------------------------------------- hero */

.hero {
  padding: 80px 32px 64px;
  position: relative;
}

@media (min-width: 900px) {
  .hero { padding: 120px 32px 88px; }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 28px;
}

.display {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(40px, 7vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--ink);
  max-width: 14ch;
}

.display em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.lede {
  margin-top: 28px;
  max-width: 56ch;
  font-size: clamp(17px, 1.4vw, 19px);
  line-height: 1.55;
  color: var(--ink-2);
}

.hero-figures {
  margin-top: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 32px;
  align-items: end;
  max-width: 920px;
}

@media (max-width: 720px) {
  .hero-figures {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .hero-figures .rule { display: none; }
}

.figure-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}

.figure-value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 3.5vw, 44px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.figure-sub {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0;
}

.figure-value.up { color: var(--pos); }
.figure-value.down { color: var(--neg); }
.figure-sub.up { color: var(--pos); }
.figure-sub.down { color: var(--neg); }

.rule {
  width: 1px;
  height: 60px;
  background: var(--hairline);
  align-self: end;
  margin-bottom: 8px;
}

/* ------------------------------------------------------------- section heads */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 2.2vw, 30px);
  letter-spacing: -0.015em;
  color: var(--ink);
}

.section-sub {
  font-size: 14px;
  color: var(--ink-3);
  max-width: 48ch;
  text-align: right;
}

/* ----------------------------------------------------------------- journey */

.journey { padding: 64px 32px; }

.range-toggle {
  display: inline-flex;
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px;
  font-family: var(--font-mono);
}

.range-toggle button {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-radius: 999px;
  transition: all .15s;
}

.range-toggle button.active {
  background: var(--ink);
  color: var(--paper);
}

.range-toggle button:hover:not(.active) { color: var(--ink); }

.chart-card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 24px;
  position: relative;
}

.chart-mount {
  width: 100%;
  height: 380px;
  position: relative;
}

@media (min-width: 900px) {
  .chart-mount { height: 460px; }
}

.chart-mount svg { width: 100%; height: 100%; display: block; }

.chart-caption {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--hairline);
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* Chart visual styles (used by chart.js) */
.chart-line { fill: none; stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart-area { fill: var(--pos-soft); }
.chart-line.neg { stroke: var(--ink); }
.chart-area.neg { fill: var(--neg-soft); }
.chart-axis-label { fill: var(--ink-3); font: 11px var(--font-mono); }
.chart-grid-line { stroke: var(--hairline-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-baseline { stroke: var(--ink-4); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.chart-final-dot { fill: var(--ink); }
.chart-final-label { fill: var(--ink); font: 11px var(--font-mono); font-weight: 500; }

/* -------------------------------------------------------------------- stats */

.stats { padding: 64px 32px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--paper);
  overflow: hidden;
}

@media (max-width: 720px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat {
  padding: 28px 24px;
  border-right: 1px solid var(--hairline-soft);
  border-bottom: 1px solid var(--hairline-soft);
}

.stats-grid .stat:nth-child(4n) { border-right: none; }
.stats-grid .stat:nth-last-child(-n+1),
.stats-grid .stat:nth-last-child(2):nth-child(odd) { border-bottom: none; }

@media (max-width: 720px) {
  .stats-grid .stat:nth-child(2n) { border-right: none; }
  .stats-grid .stat:nth-child(4n) { border-right: 1px solid var(--hairline-soft); }
  .stats-grid .stat:nth-last-child(-n+2) { border-bottom: none; }
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------- months */

.months { padding: 64px 32px; }

.months-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
}

@media (max-width: 720px) {
  .months-grid { grid-template-columns: repeat(6, 1fr); }
}

.month-cell {
  aspect-ratio: 1.4;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline-soft);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--paper-2);
  cursor: default;
  transition: transform .15s;
}

.month-cell:hover { transform: translateY(-2px); }

.month-cell .month-key {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.month-cell .month-pct {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.month-cell.empty { opacity: 0.35; }
.month-cell.empty .month-pct::before { content: '—'; color: var(--ink-4); }

.month-cell.pos { background: var(--pos-soft); }
.month-cell.pos .month-pct { color: var(--pos); }
.month-cell.neg { background: var(--neg-soft); }
.month-cell.neg .month-pct { color: var(--neg); }

/* --------------------------------------------------------------- philosophy */

.philosophy { padding: 96px 32px; }

.essay {
  max-width: 64ch;
  margin: 0 auto;
}

.essay h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 2.0vw, 28px);
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: 48px;
  margin-bottom: 16px;
}

.essay h3:first-child { margin-top: 0; }

.essay p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-2);
  margin-bottom: 16px;
}

.essay em {
  color: var(--accent);
  font-weight: 500;
}

/* ----------------------------------------------------------------- subscribe */

.subscribe { padding: 64px 32px; }

.subscribe-card {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: 48px 32px;
  position: relative;
  overflow: hidden;
}

.subscribe-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 60% at 50% 0%, var(--pos-soft), transparent 70%);
  pointer-events: none;
}

.subscribe-card .section-title { margin-bottom: 12px; }
.subscribe-card .section-sub { text-align: center; margin: 0 auto 28px; }

.signup {
  display: flex;
  gap: 8px;
  max-width: 440px;
  margin: 0 auto;
  position: relative;
}

.signup input {
  flex: 1;
  padding: 14px 18px;
  font: inherit;
  font-size: 15px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.signup input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ink) 8%, transparent);
}

.signup button {
  padding: 14px 22px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .15s, background .15s;
}

.signup button:hover { transform: translateY(-1px); }
.signup button:active { transform: translateY(0); }

.signup-note {
  margin-top: 16px;
  font-size: 13px;
  color: var(--ink-3);
  min-height: 1.2em;
}

.signup-note.success { color: var(--pos); }
.signup-note.error { color: var(--neg); }

/* ----------------------------------------------------------------- disclaimer */

.disclaimer {
  padding: 32px 32px 64px;
  max-width: 800px;
  margin: 0 auto;
}

.disclaimer p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-3);
  font-style: italic;
}

.disclaimer strong {
  color: var(--ink-2);
  font-weight: 500;
  font-style: normal;
}

/* --------------------------------------------------------------------- footer */

.footer {
  border-top: 1px solid var(--hairline-soft);
  padding: 32px 0;
  background: var(--paper-2);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ink-3);
  gap: 24px;
}

.footer-brand {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: -0.01em;
}

.footer-brand em {
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 500;
}

.footer-meta {
  display: flex;
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.footer-meta a { color: var(--ink-3); }
.footer-meta a:hover { color: var(--ink); }

/* ------------------------------------------------------------------ utilities */

.is-loading { opacity: 0.4; transition: opacity .3s; }
.is-loaded  { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
