/* ============================================================
   legacy-compat.css — 1:1 static-site port compensations (2026-07-05)

   The ported legacy marketing pages (wrapped in div.legacy-site) now render
   inside the Next.js app shell, which the old static HTML never loaded:
     1. Tailwind v4 preflight (globals.css) zeroes the UA margins/paddings
        the old pages relied on.
     2. The root layout's ThemeProvider sets data-theme on <html> (system
        dark), and globals.css/marketing.css redefine the same CSS custom
        properties (--paper, --ink, --accent, ...) the legacy styles.css
        uses — including higher-specificity dark/accent variants.
     3. marketing.css's `.marketing-shell .wrap` (0,2,0) beats the legacy
        `.wrap` (0,1,0) and shrinks the container 1200px → 1180px.

   Rules here are scoped to .legacy-site and compensate ONLY for properties
   the legacy styles.css/editorial.css/waitlist.css do NOT set themselves.
   Element-level compensations use :where() so their specificity (0,1,0)
   beats preflight but loses to every real rule in the legacy stylesheets.
   This file must be linked AFTER the page's legacy stylesheets.
   ============================================================ */

/* (2) Pin the old styles.css :root light tokens on the wrapper. The old
   pages hard-coded <body data-theme="light"> and were light for every
   visitor; element-level custom properties win over any html-level
   redefinition (dark theme, data-accent variants), including during the
   pre-hydration frame before LegacyTheme() re-pins <html>. Values are
   byte-identical to marketing-static/styles.css :root. */
.legacy-site {
  --cyan: #9FE0E2;
  --cyan-strong: #6DCDD0;
  --cyan-deep: #2BA2A6;
  --ink: #0A0A0A;
  --ink-2: #1A1A1A;
  --paper: #FBFAF7;
  --paper-2: #F2EFE8;
  --line: rgba(10,10,10,.10);
  --line-soft: rgba(10,10,10,.06);
  --muted: rgba(10,10,10,.58);
  --muted-2: rgba(10,10,10,.42);
  --accent: var(--cyan);
  --display: "Space Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --body: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --maxw: 1200px;
  --gutter: 32px;
  --radius: 14px;
  --radius-lg: 22px;
  /* Old <body> painted var(--paper); .marketing-shell sits OUTSIDE this
     wrapper and may paint the app-shell (possibly dark) paper token. */
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
}

/* (2b) The app root layout paints the app's (dark) body background; the
   old site's <body> painted var(--paper) (styles.css:49-54), which showed
   in overscroll/rubber-band regions and any viewport taller than the
   content. body sits OUTSIDE the .legacy-site token scope, so the value
   is duplicated literally. :has() is supported by all evergreen browsers;
   non-supporting engines just keep the app body color behind the (fully
   opaque, 100vh) wrapper — invisible except during overscroll. */
body:has(.legacy-site) {
  background: #FBFAF7;
}

/* (1) Preflight zeroes UA margins — but do NOT restore UA paragraph
   margins here. Ground truth (2026-07-05 welcome-page port audit): every
   legacy page (index, about, contact, dpa, founding-100, pricing, privacy,
   standards, terms, welcome) loaded styles.css, whose global
   `p { margin: 0 }` (styles.css:151) meant UA paragraph margins NEVER
   applied on the old site — paragraph rhythm came only from explicit
   legacy rules (.ed-lede, .wl-sub, .foot-brand p, …). Preflight's zeroing
   therefore matches the legacy baseline exactly. A blanket
   `.legacy-site :where(p) { margin-block: 1em }` (0,1,0) would ALSO
   out-cascade the 0,1,0 legacy rules linked earlier (.wl-sub,
   .founding-desc, .modal-sub, .modal-foot, .founding-fallback, …) and
   visibly shift the ported pages. */

/* (1) Preflight's universal margin reset kills the UA `dialog { margin:
   auto }` that centered the legacy <dialog> modals (DPA counter-signature,
   welcome-page domain-checklist + ICP-template popups). */
.legacy-site :where(dialog) { margin: auto; }

/* (3) Restore the legacy container width; same specificity (0,2,0) as
   marketing.css `.marketing-shell .wrap` but linked later, so it wins. */
.legacy-site .wrap {
  max-width: var(--maxw);
  padding: 0 var(--gutter);
}

/* ============================================================
   (marketing) route-group additions — founding-100 / about / contact
   (2026-07-05, same 1:1 port program).

   These three ported pages render INSIDE the (marketing) layout's
   .marketing-shell, whose marketing.css descendant rules
   (.marketing-shell .wrap / h1-h5 / .eyebrow — specificity 0,2,0 and
   0,1,1) outrank the legacy stylesheet regardless of link order.
   Compensations below restore the legacy cascade result at
   deterministically higher specificity, replicating the old
   contextual overrides that the blanket rules would otherwise mask.
   ============================================================ */

/* Old body { } type context (legacy styles.css:49-52). The app-shell
   resolves --body/--font tokens against the app's next/font chain;
   setting the font context ON the wrapper resolves it against the
   pinned legacy tokens above (the Google-Fonts families the ported
   pages load) and restores the 17px / 1.55 inheritance baseline. */
.legacy-site {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
}

/* marketing.css caps .wrap at 1180px and tightens padding to 16px
   under 640px; the legacy sheet is 1200px / 32px at every width. */
.marketing-shell .legacy-site .wrap {
  max-width: var(--maxw);
  padding: 0 var(--gutter);
}
/* Contact page's own contextual cap (from its in-page style block)
   would otherwise lose to the higher-specificity rule above. */
.marketing-shell .legacy-site .contact-form-wrap .wrap {
  max-width: 600px;
}

/* marketing.css: 10.5px / var(--muted-fg-2); legacy: 12px / var(--muted) */
.marketing-shell .legacy-site .eyebrow {
  font-size: 12px;
  color: var(--muted);
}

/* marketing.css forces letter-spacing -0.02em on h1-h5; restore the
   legacy per-level values, including their contextual overrides. */
.marketing-shell .legacy-site h1 { letter-spacing: -0.035em; }
.marketing-shell .legacy-site h2 { letter-spacing: -0.028em; }
.marketing-shell .legacy-site .ed-prose h2 { letter-spacing: -0.022em; }
.marketing-shell .legacy-site .cta-final h2 { letter-spacing: -0.035em; }
@media (max-width: 720px) {
  .marketing-shell .legacy-site .hero h1 { letter-spacing: -0.03em; }
}

/* Legacy footer column headings are mono/500/uppercase-muted; the
   marketing shell's blanket h5 rule would flip them to display/700/ink. */
.marketing-shell .legacy-site .foot-col h5 {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

/* ---- /pricing (1:1 port, 2026-07-05) ------------------------------------
   pricing.css contextual overrides that the blanket compensations above
   would otherwise out-cascade (same class of fix as .contact-form-wrap):
   - section/enterprise/final h2 letter-spacing (pricing.css :310/:593/:848)
     vs the blanket h2 -0.028em restoration;
   - the Enterprise-band eyebrow is cyan (pricing.css :586), but the
     blanket eyebrow rule above ties it at 0,3,0 and wins on link order. */
.marketing-shell .legacy-site .pr-section-head h2 { letter-spacing: -0.025em; }
.marketing-shell .legacy-site .pr-ent-card h2 { letter-spacing: -0.025em; }
.marketing-shell .legacy-site .pr-final h2 { letter-spacing: -0.035em; }
.marketing-shell .legacy-site .pr-ent-card .left .eyebrow { color: var(--cyan); }

/* ============================================================
   /blog + /compare (legacy-chrome port, 2026-07-05).

   The blog/compare surfaces render the legacy editorial treatment via
   LegalShell, but carry three structures the OLD static pages never had,
   so the legacy stylesheets have no rules for them:
     - the post FAQ <dl> (blog-post.tsx) — editorial.css never styled
       definition lists and preflight zeroes the UA dl/dd margins;
     - the compare feature-matrix <table> (compare-page.tsx) — the old
       site's only matrix was CSS-grid divs (pricing.css .pr-table), so
       real table elements have no legacy rules;
     - index entry titles as links (.cl-body h3 a) — the legacy changelog
       entries were plain text.
   All rules are scoped under .legacy-site and use only legacy tokens
   (mono uppercase heads, var(--line) frame, var(--line-soft) row rules,
   paper-2 header band — the pricing.css matrix idiom).
   ============================================================ */

/* Post FAQ definition list — prose-consistent treatment. */
.legacy-site .ed-faq dl { margin: 0; }
.legacy-site .ed-faq dl > div + div { margin-top: 18px; }
.legacy-site .ed-faq dt {
  font-weight: 600;
  color: var(--ink);
}
.legacy-site .ed-faq dd { margin: 6px 0 0; }

/* Compare feature matrix — accessible <table> inside an overflow-x
   wrapper so the page body never scrolls sideways. */
.legacy-site .ed-table-wrap {
  margin: 32px 0 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.legacy-site .ed-table-wrap table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.5;
}
/* Visually-hidden caption (accessible name for the matrix; the legacy
   scope has no .sr-only utility and must not use Tailwind classes). */
.legacy-site .ed-table-wrap caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.legacy-site .ed-table-wrap th,
.legacy-site .ed-table-wrap td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--line-soft);
}
.legacy-site .ed-table-wrap thead th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  background: var(--paper-2);
  border-top: 0;
}
.legacy-site .ed-table-wrap tbody th {
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
}

/* Raw tables as DIRECT prose children (the blog writer contract allows
   them; none of the 8 launch posts uses one yet). display:block gives
   the table its own horizontal scroll context. Direct-child selector on
   purpose: it must NOT hit the wrapped compare matrix above. */
.legacy-site .ed-prose > table {
  display: block;
  overflow-x: auto;
  margin: 32px 0 0;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.5;
}
.legacy-site .ed-prose > table th,
.legacy-site .ed-prose > table td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--line-soft);
}
.legacy-site .ed-prose > table thead th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  background: var(--paper-2);
}

/* Index entry titles are links; legacy a { color: inherit } keeps them
   ink — add the legacy footer-link hover affordance only. */
.legacy-site .cl-body h3 a:hover { color: var(--cyan-deep); }

/* marketing.css blanket h3 (-0.02em, specificity tie 0,1,1 with
   editorial.css .cl-body h3 — link order indeterminate): pin the legacy
   value, same class of fix as the h1/h2 restorations above. */
.marketing-shell .legacy-site .cl-body h3 { letter-spacing: -0.022em; }

/* ============================================================
   "Keep reading" related-links block (2026-07-05, component-layer SEO
   pass). Rendered by both blog-post.tsx and compare-page.tsx after the
   FAQ/sources section, reusing the .ed-prose h2/ul idiom for the list
   markup but pulled slightly tighter than a normal prose list so it
   reads as a distinct trailing block rather than more article body copy.
   ============================================================ */
.legacy-site .ed-related {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--line-soft);
}
.legacy-site .ed-related h2 { margin-top: 0; }
.legacy-site .ed-related ul li { margin-top: 10px; }
