/* OpenLegal public website — canonical stylesheet (Part 21C) */
:root {
  --bg: #f5f1e8;
  --bg-soft: #ece7db;
  --surface: #fffdf7;
  --ink: #1c1917;
  --muted: #6b6357;
  --accent: #8a4b0e;
  --accent-strong: #6f3a08;
  --accent-ink: #fff9f0;
  --accent-bg: #f4e7d3;
  --border: #e2dccb;
  --success: #22633a;
  --success-bg: #dcefe2;
  --warn: #8a5a00;
  --warn-bg: #f7ecd0;
  --plan: #4c3d86;
  --plan-bg: #e8e3f5;
  --exp: #1d5a77;
  --exp-bg: #dbeaf1;
  --code-bg: #17181f;
  --code-fg: #e3e1d8;
  --code-accent: #d9ab5c;
  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, 'Cascadia Code', 'Source Code Pro', monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.05), 0 8px 24px rgba(28, 25, 23, 0.06);
  --maxw: 1160px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101014;
    --bg-soft: #17171d;
    --surface: #191a21;
    --ink: #ece9e2;
    --muted: #9b9589;
    --accent: #d9ab5c;
    --accent-strong: #e6bd76;
    --accent-ink: #1c1420;
    --accent-bg: #2b2315;
    --border: #2c2d36;
    --success: #7fd59a;
    --success-bg: #16301f;
    --warn: #e3bc5c;
    --warn-bg: #33291a;
    --plan: #b3a7e8;
    --plan-bg: #26213f;
    --exp: #7fc3e3;
    --exp-bg: #162a38;
    --code-bg: #0c0d12;
    --code-fg: #d9d7cf;
    --code-accent: #e0b15f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  font-size: 1rem;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.6rem 1rem; border-radius: 0 0 6px 0; font-weight: 600;
}
.skip-link:focus { left: 0; text-decoration: none; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }
section { padding: 3.25rem 0; }

/* Brand */
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: var(--accent-ink); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; line-height: 1;
}
.brand-name { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.02em; font-family: var(--font-display); }
.brand-name span { color: var(--accent); }

/* Header */
.site-header {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.75rem 0; }
.header-nav { display: flex; gap: 1.1rem; align-items: center; }
.header-nav a {
  color: var(--muted); font-size: 0.85rem; font-weight: 500; white-space: nowrap;
  transition: color 0.2s;
}
.header-nav a:hover { color: var(--ink); text-decoration: none; }
.header-nav a.external::after { content: '↗'; margin-left: 0.2rem; font-size: 0.75em; opacity: 0.7; }
.menu-toggle {
  display: none; background: none; border: 1px solid var(--border); color: var(--ink);
  font-size: 1.15rem; cursor: pointer; padding: 0.3rem 0.55rem; border-radius: 6px;
}

/* Hero (home) */
.hero { text-align: center; padding: 5.5rem 0 4rem; position: relative; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(600px 300px at 50% 0%, var(--accent-bg), transparent 70%);
  opacity: 0.5;
}
.hero .eyebrow {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: 1.25rem; display: inline-block;
  border: 1px solid var(--border); background: var(--surface); padding: 0.35rem 0.9rem; border-radius: 999px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 700; letter-spacing: -0.025em; line-height: 1.08; max-width: 900px; margin: 0 auto 1.25rem;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .subtitle {
  font-size: 1.15rem; color: var(--muted); max-width: 720px; margin: 0 auto 2.25rem;
}
.cta-group { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.cta-note { margin-top: 1rem; font-size: 0.82rem; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.68rem 1.5rem; border-radius: 8px;
  font-weight: 600; font-size: 0.9rem; border: 1px solid transparent;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn-primary { background: linear-gradient(135deg, var(--accent-strong), var(--accent)); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(138, 75, 14, 0.28); text-decoration: none; }
.btn-ghost { background: var(--surface); color: var(--accent); border-color: var(--border); }
.btn-ghost:hover { background: var(--accent-bg); text-decoration: none; }

/* Page hero (subpages) */
.page-hero { padding: 3.5rem 0 2rem; }
.page-hero .crumb { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }
.page-hero h1 { font-family: var(--font-display); font-size: clamp(1.9rem, 4vw, 2.8rem); font-weight: 700; letter-spacing: -0.02em; margin: 0.4rem 0 0.6rem; }
.page-hero .lede { color: var(--muted); max-width: 760px; font-size: 1.05rem; }

/* Sections + headings */
.section-header { margin-bottom: 1.75rem; }
.section-header h2 {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 0.35rem;
}
.section-header p { color: var(--muted); max-width: 680px; }
h2[id], h3[id], h4[id] { scroll-margin-top: 90px; }

/* Cards / feature grid */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow); transition: border-color 0.2s, transform 0.15s;
}
.card:hover { border-color: var(--accent); }
.card h3 { font-size: 1.02rem; font-weight: 700; margin-bottom: 0.45rem; font-family: var(--font-display); }
.card p { font-size: 0.9rem; color: var(--muted); }
.card a.card-link { display: inline-block; margin-top: 0.75rem; font-size: 0.85rem; font-weight: 600; }
.card-link::after { content: ' →'; }

/* Badges */
.badge, .tag {
  display: inline-block; font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700;
  padding: 0.18rem 0.55rem; border-radius: 5px; letter-spacing: 0.06em; text-transform: uppercase;
  vertical-align: middle;
}
.badge + .badge, .tag + .tag, .badge + span, .tag + span { margin-left: 0.35rem; }
.b-impl { background: var(--success-bg); color: var(--success); }
.b-dev { background: var(--warn-bg); color: var(--warn); }
.b-plan { background: var(--plan-bg); color: var(--plan); }
.b-exp { background: var(--exp-bg); color: var(--exp); }

/* Pipeline (architecture) */
.pipeline { display: flex; flex-direction: column; margin: 2rem 0; }
.pipeline-step {
  display: flex; align-items: flex-start; gap: 1rem; padding: 1.15rem 1.5rem;
  background: var(--surface); border: 1px solid var(--border);
}
.pipeline-step:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.pipeline-step:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.pipeline-step:not(:last-child) { border-bottom: none; }
.pipeline-step .step-num {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; color: var(--accent);
  min-width: 2.4rem; padding-top: 0.2rem; letter-spacing: 0.06em;
}
.pipeline-step h3 { font-size: 0.92rem; font-weight: 700; margin-bottom: 0.15rem; letter-spacing: 0.02em; }
.pipeline-step p { font-size: 0.85rem; color: var(--muted); }
.pipeline-arrow { text-align: center; color: var(--accent); font-size: 1.1rem; line-height: 1.6; opacity: 0.55; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: 0.88rem; }
table.data th, table.data td { padding: 0.7rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); }
table.data th { font-weight: 600; color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; }
table.data td:first-child { font-weight: 500; }
table.data tr:hover td { background: var(--bg-soft); }

/* Code */
.code-block {
  background: var(--code-bg); color: var(--code-fg); border-radius: 8px;
  padding: 1.15rem 1.35rem; margin: 1rem 0; overflow-x: auto;
  font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.65;
  border: 1px solid var(--border);
}
.code-block .cmt { color: #8b92a0; }
.code-block .kw { color: var(--code-accent); }
code, kbd {
  font-family: var(--font-mono); font-size: 0.85em;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 5px; padding: 0.08rem 0.35rem;
}
pre code, .code-block code { background: none; border: none; padding: 0; font-size: inherit; }

/* Callouts */
.callout {
  border-left: 3px solid var(--accent); margin: 1.75rem 0; padding: 1rem 1.35rem;
  background: var(--accent-bg); border-radius: 0 var(--radius) var(--radius) 0;
}
.callout-safety { border-left-color: var(--success); background: var(--success-bg); }
.callout-note { border-left-color: var(--warn); background: var(--warn-bg); }
.callout h3 { font-size: 0.95rem; margin-bottom: 0.25rem; font-family: var(--font-display); }

blockquote {
  border-left: 3px solid var(--accent); margin: 1.5rem 0; padding: 1rem 1.5rem;
  background: var(--accent-bg); border-radius: 0 6px 6px 0; font-style: italic; color: var(--muted);
}

/* Lists */
ul, ol { margin: 0.5rem 0 1rem 1.4rem; }
li { margin: 0.25rem 0; }
.term-list { list-style: none; margin: 1.25rem 0; }
.term-list li { padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
.term-list li:last-child { border-bottom: none; }
.term-list strong { font-family: var(--font-display); font-size: 1rem; display: block; }
.term-list span { color: var(--muted); font-size: 0.9rem; }

/* Page nav (in-page) */
.page-nav { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1.5rem 0; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.page-nav a { padding: 0.4rem 0.8rem; border-radius: 6px; font-size: 0.8rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); transition: all 0.2s; }
.page-nav a:hover, .page-nav a.active { color: var(--ink); background: var(--accent-bg); border-color: var(--accent); text-decoration: none; }

/* Footer */
.site-footer { margin-top: 4rem; padding: 3rem 0 2rem; border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 2fr 1fr 1fr 1fr; }
.footer-brand p { font-size: 0.85rem; color: var(--muted); max-width: 340px; margin-top: 0.6rem; }
.footer-col h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 0.6rem; }
.footer-col a { display: block; font-size: 0.85rem; color: var(--muted); padding: 0.18rem 0; }
.footer-col a:hover { color: var(--ink); }
.footer-bottom { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--muted); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Forms (sparingly used) */
form { display: flex; flex-direction: column; gap: 1rem; max-width: 480px; }
input, textarea { padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink); font-family: var(--font-body); font-size: 0.9rem; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { font-size: 0.85rem; font-weight: 600; }

/* Responsive */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  /* Without JS the nav stays visible (static fallback); with JS it becomes a toggle. */
  html.js .menu-toggle { display: block; }
  html:not(.js) .menu-toggle { display: none; }
  html.js .header-nav { display: none; flex-direction: column; gap: 0.25rem; position: absolute; top: 100%; left: 0; right: 0; }
  html.js .header-nav.open { display: flex; }
  .header-nav {
    flex-direction: column; gap: 0.25rem; padding: 0.25rem 0 0.5rem;
  }
  html.js .header-nav {
    background: var(--surface); padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .header-nav a { padding: 0.5rem 0; font-size: 0.95rem; }
  .hero { padding: 3.5rem 0 2.5rem; }
  section { padding: 2.5rem 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; }
}