/* ============================================================================
   TETRAPOD TRADING — COMPONENT STYLES & TOKENS
   Tokens first (CSS custom properties), then component classes below.
   Fonts ship separately and are wired in via styles.css @import.
   ============================================================================ */

:root {
  /* --- Colour: Ink (deep-ocean backgrounds) — brand tokens --- */
  --tp-ink: #0A1622;          /* deepest background */
  --tp-ink-panel: #14304A;    /* raised panels / cards */
  --tp-ink-on-paper: #0A1622; /* wordmark / text on gold or light */
  --tp-hairline: rgba(198, 161, 91, 0.34); /* thin gold hairline — brand signature */
  /* --- Colour: Tide → folded into the single gold accent + Mist neutral --- */
  --tp-tide: #C6A15B;         /* accents/glyphs: the held-back gold */
  --tp-tide-soft: #9DB0C0;    /* Mist — secondary / muted labels */
  /* --- Colour: Gold (held-back accent — the mark + one key figure per view) --- */
  --tp-gold: #C6A15B;
  --tp-gold-bright: #E3C079;
  /* --- Colour: Paper (warm off-white text) --- */
  --tp-paper: #F4F1E8;
  --tp-paper-dim: #9DB0C0;    /* Mist */
  /* --- Semantic aliases --- */
  --tp-bg: var(--tp-ink);
  --tp-surface: var(--tp-ink-panel);
  --tp-border: var(--tp-hairline);
  --tp-text: var(--tp-paper);
  --tp-text-muted: var(--tp-paper-dim);
  --tp-accent: var(--tp-tide);
  --tp-highlight: var(--tp-gold);
  /* --- Typography families --- */
  --tp-font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --tp-font-body: 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --tp-font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', monospace;
  /* --- Type scale --- */
  --tp-text-hero: clamp(2.4rem, 6vw, 4.2rem);
  --tp-text-display: clamp(1.8rem, 4vw, 2.8rem);
  --tp-text-title: 1.5rem;
  --tp-text-lg: 1.25rem;
  --tp-text-body: 1rem;
  --tp-text-sm: 0.875rem;
  --tp-text-xs: 0.75rem;
  --tp-text-mono: 0.72rem;
  /* --- Weights --- */
  --tp-weight-body: 400;
  --tp-weight-medium: 500;
  --tp-weight-semibold: 600;
  --tp-weight-bold: 700;
  /* --- Letter-spacing --- */
  --tp-tracking-hero: -0.02em;
  --tp-tracking-tight: -0.01em;
  --tp-tracking-mono: 0.18em;
  --tp-tracking-mono-tight: 0.1em;
  /* --- Spacing scale --- */
  --tp-space-1: 0.25rem;
  --tp-space-2: 0.5rem;
  --tp-space-3: 0.75rem;
  --tp-space-4: 1rem;
  --tp-space-5: 1.5rem;
  --tp-space-6: 2rem;
  --tp-space-7: 3rem;
  --tp-space-8: 4rem;
  --tp-space-9: 6rem;
  /* --- Radius (restrained — engineered, not soft) --- */
  --tp-radius-none: 0;
  --tp-radius-sm: 2px;
  --tp-radius: 4px;
  /* --- Borders --- */
  --tp-border-hairline: 1px solid var(--tp-hairline);
  --tp-border-tide: 1px solid var(--tp-tide);
  --tp-border-gold: 1px solid var(--tp-gold);
  /* --- Layout --- */
  --tp-maxw: 72rem;
  --tp-maxw-narrow: 44rem;
  /* --- Motion (minimal by principle) --- */
  --tp-transition: 140ms ease; /* @kind other */
}

/* ---------------------------------------------------------------------------
   Surface — the brand root. Sets ink background, paper text, body font.
   Wrap any composition in <Surface> so tokens + base type apply.
   --------------------------------------------------------------------------- */
.tp-surface {
  background: var(--tp-ink);
  color: var(--tp-paper);
  font-family: var(--tp-font-body);
  font-weight: var(--tp-weight-body);
  font-size: var(--tp-text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.tp-surface--panel { background: var(--tp-ink-panel); }
.tp-surface--pad { padding: var(--tp-space-6); }
.tp-surface *,
.tp-surface *::before,
.tp-surface *::after { box-sizing: border-box; }

/* ---------------------------------------------------------------------------
   Mark — the concrete tetrapod. Uses currentColor; size via prop.
   --------------------------------------------------------------------------- */
.tp-mark { display: inline-block; vertical-align: middle; color: var(--tp-gold); }
.tp-mark--tide { color: var(--tp-tide); }
.tp-mark--paper { color: var(--tp-paper); }
.tp-mark--watermark { color: var(--tp-tide); opacity: 0.05; }

/* ---------------------------------------------------------------------------
   Typography primitives
   --------------------------------------------------------------------------- */
.tp-eyebrow {
  font-family: var(--tp-font-mono);
  font-size: var(--tp-text-mono);
  font-weight: var(--tp-weight-bold);
  letter-spacing: var(--tp-tracking-mono);
  text-transform: uppercase;
  color: var(--tp-gold);
  margin: 0;
  display: block;
}
.tp-eyebrow--tide { color: var(--tp-tide); }
.tp-eyebrow--paper { color: var(--tp-paper-dim); }

.tp-mono {
  font-family: var(--tp-font-mono);
  font-size: var(--tp-text-mono);
  letter-spacing: var(--tp-tracking-mono-tight);
  text-transform: uppercase;
  color: var(--tp-paper-dim);
}

.tp-display {
  font-family: var(--tp-font-display);
  font-weight: var(--tp-weight-bold);
  letter-spacing: var(--tp-tracking-hero);
  line-height: 1.02;
  color: var(--tp-paper);
  margin: 0;
  text-wrap: balance;
}
.tp-display--hero { font-size: var(--tp-text-hero); text-transform: uppercase; }
.tp-display--xl { font-size: var(--tp-text-display); }
.tp-display--lg { font-size: var(--tp-text-title); font-weight: var(--tp-weight-semibold); }
.tp-display--uppercase { text-transform: uppercase; }

.tp-prose {
  font-family: var(--tp-font-body);
  font-size: var(--tp-text-body);
  line-height: 1.65;
  color: var(--tp-paper);
  margin: 0;
  max-width: 60ch;
}
.tp-prose--muted { color: var(--tp-paper-dim); }
.tp-prose--sm { font-size: var(--tp-text-sm); }
.tp-prose--lg { font-size: var(--tp-text-lg); line-height: 1.5; }

/* ---------------------------------------------------------------------------
   Hairline — thin teal rule between sections
   --------------------------------------------------------------------------- */
.tp-hairline {
  border: 0;
  border-top: var(--tp-border-hairline);
  margin: 0;
  height: 0;
}
.tp-hairline--tide { border-top-color: var(--tp-tide); }
.tp-hairline--strong { border-top-width: 2px; }

/* ---------------------------------------------------------------------------
   Spec strip — mono key/value pairs separated by slashes
   --------------------------------------------------------------------------- */
.tp-spec-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tp-space-3);
  font-family: var(--tp-font-mono);
  font-size: var(--tp-text-mono);
  letter-spacing: var(--tp-tracking-mono-tight);
  text-transform: uppercase;
  padding: var(--tp-space-3) 0;
  border-top: var(--tp-border-hairline);
  border-bottom: var(--tp-border-hairline);
}
.tp-spec-strip__item { display: inline-flex; align-items: baseline; gap: 0.4em; }
.tp-spec-strip__key { color: var(--tp-paper-dim); }
.tp-spec-strip__val { color: var(--tp-tide-soft); font-weight: var(--tp-weight-bold); }
.tp-spec-strip__sep { color: var(--tp-hairline); padding: 0 0.2em; user-select: none; }

/* ---------------------------------------------------------------------------
   Badge — mono uppercase, squared, hairline. Engineered, not soft.
   --------------------------------------------------------------------------- */
.tp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--tp-font-mono);
  font-size: var(--tp-text-mono);
  font-weight: var(--tp-weight-bold);
  letter-spacing: var(--tp-tracking-mono-tight);
  text-transform: uppercase;
  padding: 0.35em 0.7em;
  border: var(--tp-border-hairline);
  border-radius: var(--tp-radius-sm);
  color: var(--tp-tide-soft);
  background: transparent;
  white-space: nowrap;
}
.tp-badge--tide { border-color: var(--tp-hairline); color: var(--tp-paper-dim); }
.tp-badge--gold { border-color: var(--tp-gold); color: var(--tp-gold-bright); }
.tp-badge--solid { background: var(--tp-ink-panel); }

/* ---------------------------------------------------------------------------
   Button — primary / secondary / ghost
   --------------------------------------------------------------------------- */
.tp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--tp-font-mono);
  font-size: var(--tp-text-sm);
  font-weight: var(--tp-weight-bold);
  letter-spacing: var(--tp-tracking-mono-tight);
  text-transform: uppercase;
  padding: 0.75em 1.4em;
  border: 1px solid transparent;
  border-radius: var(--tp-radius);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--tp-transition), border-color var(--tp-transition), color var(--tp-transition);
  line-height: 1;
}
.tp-btn--primary { background: var(--tp-gold); color: var(--tp-ink-on-paper); border-color: var(--tp-gold); }
.tp-btn--primary:hover { background: var(--tp-gold-bright); border-color: var(--tp-gold-bright); }
.tp-btn--secondary { background: transparent; color: var(--tp-paper); border-color: var(--tp-tide); }
.tp-btn--secondary:hover { background: rgba(198, 161, 91, 0.14); }
.tp-btn--ghost { background: transparent; color: var(--tp-tide-soft); border-color: transparent; padding-left: 0.4em; padding-right: 0.4em; }
.tp-btn--ghost:hover { color: var(--tp-paper); }
.tp-btn--sm { font-size: var(--tp-text-xs); padding: 0.55em 1em; }
.tp-btn--lg { font-size: var(--tp-text-body); padding: 0.9em 1.8em; }
.tp-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------------------------------------------------------------------------
   Panel & Card — ink-panel surfaces with hairline structure
   --------------------------------------------------------------------------- */
.tp-panel {
  background: var(--tp-ink-panel);
  border: var(--tp-border-hairline);
  border-radius: var(--tp-radius);
  padding: var(--tp-space-5);
}
.tp-panel--flush { padding: 0; }

.tp-card {
  background: var(--tp-ink-panel);
  border: var(--tp-border-hairline);
  border-radius: var(--tp-radius);
  padding: var(--tp-space-5);
  display: flex;
  flex-direction: column;
  gap: var(--tp-space-3);
}
.tp-card__title { font-family: var(--tp-font-display); font-weight: var(--tp-weight-semibold); font-size: var(--tp-text-lg); color: var(--tp-paper); margin: 0; }

/* ---------------------------------------------------------------------------
   Glyph list — behaviour lines with tetrapod-glyph bullets
   --------------------------------------------------------------------------- */
.tp-glyph-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--tp-space-3); }
.tp-glyph-list__item { display: flex; align-items: flex-start; gap: var(--tp-space-3); color: var(--tp-paper); line-height: 1.5; }
.tp-glyph-list__glyph { flex: none; margin-top: 0.15em; color: var(--tp-tide); }

/* ---------------------------------------------------------------------------
   Section — a page band with an eyebrow label and a top hairline
   --------------------------------------------------------------------------- */
.tp-section { padding: var(--tp-space-7) 0; border-top: var(--tp-border-hairline); }
.tp-section--flush { border-top: 0; }
.tp-section__inner { max-width: var(--tp-maxw); margin: 0 auto; padding: 0 var(--tp-space-5); }
.tp-section__head { display: flex; flex-direction: column; gap: var(--tp-space-2); margin-bottom: var(--tp-space-5); }

/* ---------------------------------------------------------------------------
   Hero — watermark mark, eyebrow, display headline, tagline, spec strip
   --------------------------------------------------------------------------- */
.tp-hero { position: relative; overflow: hidden; padding: var(--tp-space-9) var(--tp-space-5); background: var(--tp-ink); }
.tp-hero__watermark { position: absolute; right: -4%; top: 50%; transform: translateY(-50%); pointer-events: none; z-index: 0; }
.tp-hero__inner { position: relative; z-index: 1; max-width: var(--tp-maxw); margin: 0 auto; display: flex; flex-direction: column; gap: var(--tp-space-5); }
.tp-hero__kicker { display: flex; align-items: center; gap: var(--tp-space-3); }
.tp-hero__tagline { color: var(--tp-paper-dim); font-size: var(--tp-text-lg); max-width: 46ch; }
.tp-hero__actions { display: flex; flex-wrap: wrap; gap: var(--tp-space-3); }

/* ---------------------------------------------------------------------------
   Bot card — one bot in "the line": number, name, essence, link
   --------------------------------------------------------------------------- */
.tp-bot-card {
  display: flex; flex-direction: column; gap: var(--tp-space-3);
  background: var(--tp-ink-panel);
  border: var(--tp-border-hairline);
  border-radius: var(--tp-radius);
  padding: var(--tp-space-5);
  transition: border-color var(--tp-transition);
}
.tp-bot-card:hover { border-color: var(--tp-tide); }
.tp-bot-card__number { font-family: var(--tp-font-mono); font-size: var(--tp-text-mono); letter-spacing: var(--tp-tracking-mono); text-transform: uppercase; color: var(--tp-gold); }
.tp-bot-card__name { font-family: var(--tp-font-display); font-weight: var(--tp-weight-bold); font-size: var(--tp-text-title); text-transform: uppercase; color: var(--tp-paper); margin: 0; }
.tp-bot-card__essence { color: var(--tp-paper-dim); font-size: var(--tp-text-sm); margin: 0; flex: 1; }
.tp-bot-card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--tp-space-3); margin-top: var(--tp-space-2); }
.tp-bot-card__link { font-family: var(--tp-font-mono); font-size: var(--tp-text-xs); text-transform: uppercase; letter-spacing: var(--tp-tracking-mono-tight); color: var(--tp-tide-soft); text-decoration: none; }
.tp-bot-card__link:hover { color: var(--tp-paper); }

/* ---------------------------------------------------------------------------
   Offer panel — the visual peak: bordered, gold accent
   --------------------------------------------------------------------------- */
.tp-offer {
  position: relative;
  background: var(--tp-ink-panel);
  border: var(--tp-border-gold);
  border-radius: var(--tp-radius);
  padding: var(--tp-space-6);
  display: flex; flex-direction: column; gap: var(--tp-space-4);
}
.tp-offer::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tp-gold); border-radius: var(--tp-radius) 0 0 var(--tp-radius); }
.tp-offer__label { color: var(--tp-gold); }
.tp-offer__headline { font-family: var(--tp-font-display); font-weight: var(--tp-weight-bold); font-size: var(--tp-text-display); color: var(--tp-paper); margin: 0; line-height: 1.1; }
.tp-offer__body { color: var(--tp-paper-dim); }

/* ---------------------------------------------------------------------------
   Safeguard tile — a single protective control
   --------------------------------------------------------------------------- */
.tp-safeguard {
  display: flex; flex-direction: column; gap: var(--tp-space-2);
  background: var(--tp-ink-panel);
  border: var(--tp-border-hairline);
  border-left: 2px solid var(--tp-tide);
  border-radius: var(--tp-radius);
  padding: var(--tp-space-4);
}
.tp-safeguard__head { display: flex; align-items: center; gap: var(--tp-space-2); }
.tp-safeguard__title { font-family: var(--tp-font-display); font-weight: var(--tp-weight-semibold); font-size: var(--tp-text-body); color: var(--tp-paper); margin: 0; }
.tp-safeguard__desc { color: var(--tp-paper-dim); font-size: var(--tp-text-sm); margin: 0; }

/* ---------------------------------------------------------------------------
   Hero figure — one gold key figure with a label
   --------------------------------------------------------------------------- */
.tp-figure { display: flex; flex-direction: column; gap: var(--tp-space-1); }
.tp-figure__value { font-family: var(--tp-font-display); font-weight: var(--tp-weight-bold); font-size: var(--tp-text-hero); line-height: 1; color: var(--tp-gold); letter-spacing: var(--tp-tracking-hero); }
.tp-figure__value--paper { color: var(--tp-paper); }
.tp-figure__label { font-family: var(--tp-font-mono); font-size: var(--tp-text-mono); letter-spacing: var(--tp-tracking-mono); text-transform: uppercase; color: var(--tp-paper-dim); }

/* ---------------------------------------------------------------------------
   Nav — mark + links + CTA
   --------------------------------------------------------------------------- */
.tp-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--tp-space-5); padding: var(--tp-space-4) var(--tp-space-5); border-bottom: var(--tp-border-hairline); background: var(--tp-ink); }
.tp-nav__brand { display: flex; align-items: center; gap: var(--tp-space-3); }
.tp-nav__wordmark { font-family: var(--tp-font-display); font-weight: var(--tp-weight-bold); text-transform: uppercase; letter-spacing: var(--tp-tracking-tight); color: var(--tp-paper); font-size: var(--tp-text-lg); }
.tp-nav__links { display: flex; align-items: center; gap: var(--tp-space-5); list-style: none; margin: 0; padding: 0; }
.tp-nav__link { font-family: var(--tp-font-mono); font-size: var(--tp-text-xs); text-transform: uppercase; letter-spacing: var(--tp-tracking-mono-tight); color: var(--tp-paper-dim); text-decoration: none; }
.tp-nav__link:hover { color: var(--tp-paper); }
.tp-nav__actions { display: flex; align-items: center; gap: var(--tp-space-3); }

/* ---------------------------------------------------------------------------
   Footer — badges + mark + tagline + risk line
   --------------------------------------------------------------------------- */
.tp-footer { border-top: var(--tp-border-hairline); background: var(--tp-ink); padding: var(--tp-space-7) var(--tp-space-5) var(--tp-space-6); }
.tp-footer__inner { max-width: var(--tp-maxw); margin: 0 auto; display: flex; flex-direction: column; gap: var(--tp-space-5); }
.tp-footer__badges { display: flex; flex-wrap: wrap; gap: var(--tp-space-2); }
.tp-footer__brand { display: flex; align-items: center; gap: var(--tp-space-3); }
.tp-footer__wordmark { font-family: var(--tp-font-display); font-weight: var(--tp-weight-bold); text-transform: uppercase; color: var(--tp-paper); }
.tp-footer__tagline { font-family: var(--tp-font-mono); font-size: var(--tp-text-mono); letter-spacing: var(--tp-tracking-mono); text-transform: uppercase; color: var(--tp-gold); }
.tp-footer__dm { color: var(--tp-paper-dim); font-size: var(--tp-text-sm); }

/* ---------------------------------------------------------------------------
   Risk disclaimer — small, muted, always present
   --------------------------------------------------------------------------- */
.tp-risk {
  font-family: var(--tp-font-body);
  font-size: var(--tp-text-xs);
  line-height: 1.5;
  color: var(--tp-paper-dim);
  border-top: var(--tp-border-hairline);
  padding-top: var(--tp-space-3);
  max-width: 70ch;
}
.tp-risk__label { font-family: var(--tp-font-mono); text-transform: uppercase; letter-spacing: var(--tp-tracking-mono-tight); color: var(--tp-tide-soft); display: block; margin-bottom: var(--tp-space-1); }

/* ---------------------------------------------------------------------------
   Bot page template — flyer/page spine composed of the above
   --------------------------------------------------------------------------- */
.tp-bot-page { display: flex; flex-direction: column; }
.tp-bot-page__grid { display: grid; gap: var(--tp-space-5); }
@media (min-width: 720px) { .tp-bot-page__grid--2 { grid-template-columns: 1fr 1fr; } }

/* ── Accessibility: visible keyboard focus + reduced motion ─────────────────── */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, .tp-btn:focus-visible, .tp-nav__link:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--tp-gold);
  outline-offset: 2px;
  border-radius: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .lift:hover { transform: none !important; }
}

/* ── Light mode ──────────────────────────────────────────────────────────────
   Default is dark (the brand's native look). Light tokens apply when the visitor
   picks light (data-theme="light") or their OS prefers light and they haven't
   explicitly chosen dark. Same palette, re-roled for a paper background. */
:root[data-theme="light"] {
  --tp-ink: #F4F1E8;          /* paper becomes the page background */
  --tp-ink-panel: #FFFFFF;    /* white raised panels / cards */
  --tp-ink-on-paper: #FFFFFF; /* text on the gold button (gold is darker in light) */
  --tp-hairline: rgba(160, 124, 46, 0.30);
  --tp-tide: #9A7628;         /* gold accents, darkened for contrast on paper */
  --tp-tide-soft: #5C6B74;    /* slate — secondary / muted labels */
  --tp-gold: #9A7628;
  --tp-gold-bright: #7E601F;
  --tp-paper: #14202B;        /* deep ink text on paper */
  --tp-paper-dim: #5C6B74;    /* slate muted text */
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --tp-ink: #F4F1E8;
    --tp-ink-panel: #FFFFFF;
    --tp-ink-on-paper: #FFFFFF;
    --tp-hairline: rgba(160, 124, 46, 0.30);
    --tp-tide: #9A7628;
    --tp-tide-soft: #5C6B74;
    --tp-gold: #9A7628;
    --tp-gold-bright: #7E601F;
    --tp-paper: #14202B;
    --tp-paper-dim: #5C6B74;
  }
}
/* Theme toggle button in the nav */
.tp-theme-btn { background: transparent; border: 1px solid var(--tp-hairline); color: var(--tp-paper-dim);
  border-radius: var(--tp-radius); width: 38px; height: 34px; display: inline-flex; align-items: center;
  justify-content: center; cursor: pointer; }
.tp-theme-btn:hover { color: var(--tp-gold); border-color: var(--tp-gold); }
