/* site.css — shared chrome + tokens for the redesigned public site
 * (the "paper" theme, #4 redesign).
 *
 * Scoped to body.site so the legacy dark pages (still on Layout) are
 * untouched until their slice migrates. Holds the paper design
 * tokens, the site nav, the site footer, and the shared primitives
 * (container, section header, buttons) every redesigned marketing
 * page reuses. Page-specific styles live in css/<surface>.css.
 *
 * Loaded with css/fonts.css (self-hosted DM Serif Display / IBM Plex
 * Mono / Geist). No Google Fonts <link> at runtime (RFC 006).
 */

/* ── Paper tokens ───────────────────────────────────────────────── */

body.site {
  color-scheme: light;

  /* Restrained, cool, light system — modelled on premium product
   * sites (near-monochrome, one accent used sparingly, semantic
   * color quarantined to artifacts). Deliberately not the warm
   * cream + terracotta of the source mockups. */
  --ink: #11141b;          /* primary text + dark surfaces */
  --paper: #f7f8fa;        /* page background (cool near-white) */
  --paper-2: #eef0f4;      /* raised panels */
  --paper-3: #e2e5ec;      /* deeper panels / hovers */

  --surface-dark: #111318;      /* dark bands — graphite */
  --surface-dark-2: #171A20;   /* cards on dark bands */

  /* One brand accent — amber/gold, premium and controlled.
   * Used sparingly: eyebrow, one key phrase per heading,
   * interactive hovers, border signals. Never as decoration. */
  --accent: #FF9A1A;           /* primary amber */
  --accent-light: #FFC24A;     /* bright gold highlight */
  --accent-pale: rgba(255, 154, 26, 0.10); /* warm amber tint */
  --accent-border: rgba(255, 154, 26, 0.22);

  /* Extended graphite palette for premium dark surfaces */
  --graphite: #111318;
  --graphite-deep: #08090B;
  --graphite-card: #171A20;
  --amber-border-dark: rgba(255, 184, 64, 0.14);

  /* Text on dark */
  --fg-on-dark: #F8F4EA;
  --muted-on-dark: #B8AA96;

  /* Semantic — amber replaces warn/yellow; deep red for block */
  --green-signal: #1f7a47;
  --green-pale: #e6f1ea;
  --red-signal: #8A2E22;
  --red-pale: rgba(130, 38, 28, 0.10);
  --warn: #B65A12;            /* burnt amber for pause/hold */

  --muted: #7B746A;
  --muted-2: #A09890;
  --border: rgba(17, 20, 27, 0.10);
  --border-strong: rgba(17, 20, 27, 0.22);

  --serif: 'DM Serif Display', Georgia, serif;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
  --sans: 'Geist', system-ui, sans-serif;

  --site-radius: 4px;
  --site-max: 1200px;

  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Compatibility aliases: the prose-heavy secondary pages (docs,
 * whitepaper, security, legal, receipt) were authored against the
 * dark base tokens (--fg/--bg/--rule/...). Rather than rewrite each
 * file, map those names to the paper palette inside body.site so the
 * same CSS renders correctly on the light theme. Page-specific files
 * stay token-driven; only these aliases differ between themes. */
body.site {
  --fg: var(--ink);
  --fg-soft: #3b424f;
  --fg-muted: var(--muted);
  --bg: var(--paper);
  --bg-elev: #ffffff;
  --bg-code: #08090B;
  --rule: var(--border-strong);
  --rule-soft: var(--border);
  --rule-width: 1px;
  --accent-soft: var(--accent);
  --danger: var(--red-signal);
  --warn: #B65A12;
  --ok: var(--green-signal);
  --max-page: var(--site-max);
  --max-prose: 68ch;
}

/* Paint the document element too, so short pages and scroll
 * overscroll never reveal the legacy dark app.css html background
 * below the footer. */
html:has(body.site) {
  background: #f7f8fa;
}

body.site h1,
body.site h2,
body.site h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ink);
}

/* Heading em — add a thin space before italic phrases so they don't
 * collide with the preceding upright text at large sizes. The
 * word-spacing on em only affects the gap before it; the italic
 * portion itself keeps normal word-spacing. */
body.site h1 em,
body.site h2 em,
body.site h3 em {
  font-style: italic;
  color: var(--accent);
  padding-left: 0.18em;
}

body.site a {
  color: inherit;
  text-decoration: none;
}

/* ── Shared layout primitives ───────────────────────────────────── */

.site-container {
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 0 3rem;
}

.site-section {
  border-bottom: 0.5px solid var(--border);
}

.site-section-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 1rem;
}

.site-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-pale);
  border: 0.5px solid var(--accent-border);
  padding: 5px 12px;
  border-radius: 999px;
}

.site-eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Buttons ────────────────────────────────────────────────────── */
/* Colors are scoped under body.site so they win over the generic
 * `body.site a { color: inherit }` rule (which otherwise made the
 * solid primary button render dark-on-dark). */

.site-btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: var(--site-radius);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

body.site .site-btn-primary {
  background: var(--graphite, #111318);
  color: #F8F4EA;
  border-color: var(--graphite, #111318);
}

body.site .site-btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

body.site .site-btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-strong);
  font-weight: 400;
}

body.site .site-btn-secondary:hover {
  background: var(--accent-pale);
  border-color: var(--accent-border);
  color: var(--accent);
}

body.site .site-btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

body.site .site-btn-accent:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: #111318;
}

/* ── Site nav ───────────────────────────────────────────────────── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 0.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3rem;
  height: 56px;
}

/* Logo image variant (replaces text logo on public pages) */
.site-logo-img {
  height: 36px;
  width: auto;
  display: block;
}

.site-logo-img-sm {
  height: 28px;
}

.site-footer-logo {
  display: inline-block;
  margin-bottom: 0.75rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.site-logo img {
  height: 36px;
  width: auto;
  display: block;
}

.site-logo-text {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.site-logo-text span { color: var(--accent); }

.site-nav-disclosure {
  display: none; /* desktop: burger hidden; nav shows via .site-primary-nav */
}

.site-nav-disclosure > summary {
  display: none;
  list-style: none;
  cursor: pointer;
  padding: 8px;
}

.site-nav-disclosure > summary::-webkit-details-marker { display: none; }

.site-primary-nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.site-nav-link,
.site-primary-nav a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 400;
  letter-spacing: 0.01em;
  transition: color 0.15s;
}

.site-nav-link:hover,
.site-primary-nav a:hover {
  color: var(--accent);
}

.site-nav-active {
  color: var(--accent);
  font-weight: 500;
}

.site-nav-cta {
  background: var(--graphite, #111318);
  color: #F8F4EA !important;
  padding: 6px 16px;
  border-radius: var(--site-radius);
  font-weight: 500 !important;
  font-size: 13px !important;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.site-nav-cta:hover {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

.burger {
  display: inline-block;
  width: 1.25rem;
  height: 0.875rem;
  position: relative;
}

.burger::before,
.burger::after,
.burger {
  background: linear-gradient(var(--ink), var(--ink)) no-repeat;
  background-size: 100% 2px;
}

.burger { background-position: 0 50%; }

.burger::before,
.burger::after {
  content: '';
  position: absolute;
  inset: 0;
  background-position: 0 0;
}

.burger::after { background-position: 0 100%; }

/* ── Site footer ────────────────────────────────────────────────── */

.site-footer {
  border-top: 0.5px solid var(--border-strong);
  padding: 3rem;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 0.8fr);
  gap: 2rem;
  background: var(--paper);
}

.site-footer-brand .site-logo {
  display: block;
  margin-bottom: 0.75rem;
}

.site-footer-tagline {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 300;
}

.site-footer-badge {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted-2);
  background: var(--accent-pale);
  padding: 3px 8px;
  border-radius: 2px;
  border: 0.5px solid var(--accent-border);
}

.site-footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.site-footer-col-title {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--ink);
  letter-spacing: 0.03em;
}

.site-footer-col a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
  font-weight: 300;
}

.site-footer-col a:hover { color: var(--ink); }

/* ── Responsive chrome ──────────────────────────────────────────── */

@media (max-width: 900px) {
  .site-nav { padding: 0 1.5rem; }
  .site-container { padding: 0 1.5rem; }

  .site-nav-disclosure { display: block; }

  /* Burger toggle stays pinned top-right; it sits above the overlay
     so it doubles as the close (X) control without moving. */
  .site-nav-disclosure > summary {
    display: inline-flex;
    align-items: center;
    position: relative;
    z-index: 110;
  }

  /* Closed: the panel is hidden. */
  .site-primary-nav {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 1.5rem;
  }

  /* Open: full-viewport overlay below the 56px header bar, with its
     own opaque background so it no longer bleeds into the page. The
     nav is a sibling of the disclosure, so target it with ~. */
  .site-nav-disclosure[open] ~ .site-primary-nav {
    display: flex;
    position: fixed;
    inset: 56px 0 0 0;
    z-index: 105;
    background: var(--paper);
    border-top: 0.5px solid var(--border-strong);
    overflow-y: auto;
    gap: 0.5rem;
    padding: 1.5rem;
  }

  /* Larger tap targets inside the overlay. */
  .site-nav-disclosure[open] ~ .site-primary-nav a {
    font-size: 17px;
    width: 100%;
    padding: 0.75rem 0;
    border-bottom: 0.5px solid var(--border);
  }

  .site-nav-disclosure[open] ~ .site-primary-nav a:last-child { border-bottom: none; }

  /* CTA reads as a button, not a list row. */
  .site-nav-disclosure[open] ~ .site-primary-nav .site-nav-cta {
    margin-top: 1rem;
    padding: 0.85rem 1rem !important;
    text-align: center;
    border-bottom: none;
    font-size: 15px !important;
  }

  /* Morph the burger into an X while open. */
  .site-nav-disclosure[open] .burger { background-image: none; }
  .site-nav-disclosure[open] .burger::before,
  .site-nav-disclosure[open] .burger::after {
    background-position: 0 50%;
  }
  .site-nav-disclosure[open] .burger::before { transform: rotate(45deg); }
  .site-nav-disclosure[open] .burger::after { transform: rotate(-45deg); }
}

.burger::before,
.burger::after,
.burger { transition: transform 0.15s ease, background-image 0.15s ease; }

@media (max-width: 720px) {
  .site-footer { grid-template-columns: 1fr 1fr; }
  .site-footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 460px) {
  .site-footer { grid-template-columns: 1fr; }
}
