/* regol.org — lightweight static stylesheet with adaptive light & dark themes */

:root {
  color-scheme: light dark;

  /* Light theme (warm parchment & regal teal derived from the regol emblem) */
  --bg: #faf7f1;
  --bg-alt: #f2ece0;
  --surface: #ffffff;
  --surface-subtle: #f6f1e7;
  --border: #e3d9c8;
  --border-strong: #cfc2ac;

  --ink: #152625;
  --ink-soft: #3f5554;
  --ink-muted: #617574;

  --accent: #1a736b;
  --accent-hover: #135a54;
  --accent-soft: #e4f3ef;
  --accent-border: #9bd0c5;
  --on-accent: #ffffff;

  --gold: #a97518;
  --gold-soft: #fbf2de;

  /* Code surface */
  --code-bg: #152223;
  --code-header: #1c2c2d;
  --code-border: #273c3d;
  --code-ink: #e8f0ee;
  --code-muted: #8ea8a6;
  --tok-comment: #88a4a1;
  --tok-keyword: #f2b766;
  --tok-string: #7de0c8;
  --tok-func: #a5d8ff;
  --tok-prompt: #e67d8e;

  --shadow-sm: 0 1px 2px rgba(21, 38, 37, 0.06);
  --shadow-md: 0 8px 28px rgba(21, 38, 37, 0.07);

  --radius: 12px;
  --radius-sm: 8px;
  --container: 1120px;

  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1717;
    --bg-alt: #122020;
    --surface: #172828;
    --surface-subtle: #1c3030;
    --border: #253d3c;
    --border-strong: #355453;

    --ink: #edf4f2;
    --ink-soft: #a9bebc;
    --ink-muted: #7f9896;

    --accent: #6ed3bc;
    --accent-hover: #8be0cc;
    --accent-soft: rgba(110, 211, 188, 0.13);
    --accent-border: rgba(110, 211, 188, 0.35);
    --on-accent: #091817;

    --gold: #e4b65c;
    --gold-soft: rgba(228, 182, 92, 0.14);

    --code-bg: #0a1212;
    --code-header: #101d1d;
    --code-border: #233a39;
    --code-ink: #e8f0ee;
    --code-muted: #8ea8a6;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.32);
  }
}

:root[data-theme="dark"] {
  --bg: #0d1717;
  --bg-alt: #122020;
  --surface: #172828;
  --surface-subtle: #1c3030;
  --border: #253d3c;
  --border-strong: #355453;

  --ink: #edf4f2;
  --ink-soft: #a9bebc;
  --ink-muted: #7f9896;

  --accent: #6ed3bc;
  --accent-hover: #8be0cc;
  --accent-soft: rgba(110, 211, 188, 0.13);
  --accent-border: rgba(110, 211, 188, 0.35);
  --on-accent: #091817;

  --gold: #e4b65c;
  --gold-soft: rgba(228, 182, 92, 0.14);

  --code-bg: #0a1212;
  --code-header: #101d1d;
  --code-border: #233a39;
  --code-ink: #e8f0ee;
  --code-muted: #8ea8a6;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.32);
}

/* Wordmark theme swap (works with pure CSS prefers-color-scheme and data-theme) */
.brand-wordmark-dark { display: none; }
.brand-wordmark-light { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-wordmark-light { display: none; }
  :root:not([data-theme="light"]) .brand-wordmark-dark { display: block; }
}

:root[data-theme="dark"] .brand-wordmark-light { display: none; }
:root[data-theme="dark"] .brand-wordmark-dark { display: block; }

/* Theme toggle icon visibility */
.theme-icon { display: none; }
:root:not([data-theme]) .theme-icon-auto { display: block; }
:root[data-theme="light"] .theme-icon-light { display: block; }
:root[data-theme="dark"] .theme-icon-dark { display: block; }

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-subtle));
  color: var(--ink);
  border-radius: 5px;
  padding: 0.1em 0.34em;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

h1, h2 {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
}

h3 {
  font-weight: 650;
  color: var(--ink);
  margin: 0;
}

p { margin: 0 0 1rem; color: var(--ink-soft); }
p:last-child { margin-bottom: 0; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--accent);
  color: var(--on-accent);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 100;
}

.skip-link:focus { left: 16px; }

/* Header */
.site-header {
  position: relative;
  z-index: 40;
  background: var(--bg);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding-top: 10px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-wordmark {
  height: 60px;
  width: auto;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav a:hover {
  color: var(--ink);
  background: var(--bg-alt);
  text-decoration: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink);
  background: var(--bg-alt);
}

.nav-toggle { display: none; }
.menu-icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .menu-icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .menu-icon-close { display: block; }

/* Hero */
.hero {
  padding: 40px 0 68px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 44px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.15rem, 3.8vw, 3.15rem);
  line-height: 1.12;
  margin-bottom: 18px;
}

.lead {
  font-size: clamp(1.04rem, 1.4vw, 1.16rem);
  line-height: 1.65;
  color: var(--ink-soft);
  margin-bottom: 26px;
}

.lead strong { color: var(--ink); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.actions-center { justify-content: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.96rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-alt);
  border-color: var(--accent);
}

.btn-ghost {
  color: var(--ink-soft);
  padding-inline: 14px;
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--bg-alt);
}

.meta-note {
  margin-top: 18px;
  font-size: 0.87rem;
  color: var(--ink-muted);
}

/* Code Card */
.code-card {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  min-width: 0;
}

.code-card-compact {
  box-shadow: var(--shadow-sm);
}

.code-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--code-header);
  border-bottom: 1px solid var(--code-border);
}

.code-card-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--code-muted);
  padding-left: 4px;
}

.tab-list {
  display: flex;
  gap: 4px;
}

.tab-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--code-muted);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tab-btn:hover { color: var(--code-ink); }

.tab-btn.is-active {
  background: rgba(110, 211, 188, 0.16);
  color: #7de0c8;
}

.copy-btn {
  appearance: none;
  border: 1px solid var(--code-border);
  background: transparent;
  color: var(--code-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.copy-btn:hover {
  color: var(--code-ink);
  border-color: var(--code-muted);
}

.copy-btn.is-copied {
  color: #7de0c8;
  border-color: #7de0c8;
}

.code-panel pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  color: var(--code-ink);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.6;
  tab-size: 4;
}

.tok-c { color: var(--tok-comment); }
.tok-k { color: var(--tok-keyword); }
.tok-s { color: var(--tok-string); }
.tok-f { color: var(--tok-func); }
.tok-p { color: var(--tok-prompt); user-select: none; }

/* Pillars strip */
.pillars-band {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 40px 0;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.pillar h2 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.pillar p {
  font-size: 0.92rem;
  line-height: 1.55;
}

/* Alternating feature sections */
.feature-section {
  padding: 72px 0;
}

.feature-section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 48px;
  align-items: center;
}

.split-reverse .split-copy { order: 2; }
.split-reverse .split-visual { order: 1; }

.feature-section h2,
.quickstart-section h2,
.cta-band h2 {
  font-size: clamp(1.65rem, 2.6vw, 2.2rem);
  line-height: 1.2;
  margin-bottom: 14px;
}

.detail-list {
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--ink-soft);
}

.detail-list li {
  margin-bottom: 10px;
}

.detail-list li:last-child { margin-bottom: 0; }
.detail-list strong { color: var(--ink); }

/* Visual cards & adaptive inline SVG diagrams */
.visual-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.diagram {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font-sans);
}

.d-surface { fill: var(--surface); }
.d-stroke { stroke: var(--border-strong); stroke-width: 1.5; }
.d-stroke-thin { stroke: var(--border); stroke-width: 1.2; }
.d-stroke-accent { stroke: var(--accent); stroke-width: 1.75; }
.d-stroke-accent-thin { stroke: var(--accent-border); stroke-width: 1.25; }
.d-accent { fill: var(--accent); }
.d-accent-soft { fill: var(--accent-soft); }
.d-chip { fill: var(--surface-subtle); stroke: var(--border); stroke-width: 1; }
.d-block { fill: var(--surface-subtle); stroke: var(--border); stroke-width: 1; }
.d-block-gold { fill: var(--gold-soft); stroke: var(--gold); stroke-width: 1; }

.d-title { fill: var(--ink); font-size: 14px; font-weight: 700; }
.d-muted { fill: var(--ink-muted); font-size: 11.5px; }
.d-label-accent { fill: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
.d-label-gold { fill: var(--gold); font-size: 11px; font-weight: 650; }
.d-on-accent { fill: var(--on-accent); font-size: 12.5px; font-weight: 700; }
.d-mono { fill: var(--ink); font-family: var(--font-mono); font-size: 11px; }
.d-mono-sm { fill: var(--ink); font-family: var(--font-mono); font-size: 11px; font-weight: 500; }
.d-mono-xs { fill: var(--accent); font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.d-tiny { fill: var(--ink-soft); font-size: 11px; }

.d-arrow { stroke: var(--border-strong); stroke-width: 2; }
.d-arrow-head { fill: var(--border-strong); }

/* Benchmarks table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.bench-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  min-width: 580px;
}

.bench-table th,
.bench-table td {
  text-align: left;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.bench-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  background: var(--surface-subtle);
  font-weight: 700;
}

.bench-table tbody tr:last-child td { border-bottom: 0; }
.bench-table td strong { color: var(--ink); }
.bench-table td.num { white-space: nowrap; }

.bench-footnote {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* Quick Start */
.section-header {
  max-width: 720px;
  margin-bottom: 28px;
}

.quickstart-section {
  background: var(--bg);
  padding: 72px 0;
}

.quickstart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.qs-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.qs-card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.qs-card > p {
  font-size: 0.94rem;
  margin-bottom: 16px;
}

.qs-foot {
  margin-top: 16px;
  margin-bottom: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

/* Bottom CTA */
.cta-band {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 64px 0;
  text-align: center;
}

.cta-inner {
  max-width: 680px;
}

.cta-inner p {
  margin-bottom: 24px;
  font-size: 1.03rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 44px 0 40px;
  background: var(--bg);
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: 360px;
}

.footer-brand img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.footer-brand strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--ink);
  margin-bottom: 2px;
}

.footer-brand p {
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.footer-links-group {
  display: flex;
  flex-wrap: wrap;
  gap: 44px;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li { margin-bottom: 8px; }
.footer-links li:last-child { margin-bottom: 0; }

.footer-links a {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.footer-links a:hover { color: var(--accent); }

.footer-legal {
  padding-top: 22px;
}

.footer-legal p {
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.footer-legal p:last-child { margin-bottom: 0; }

/* Responsive */
@media (max-width: 960px) {
  .hero-grid,
  .split,
  .quickstart-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .split-reverse .split-copy { order: 0; }
  .split-reverse .split-visual { order: 0; }

  .pillars-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .container { padding: 0 18px; }

  .header-inner { min-height: 76px; padding-top: 8px; }
  .brand-wordmark { height: 50px; }

  .nav-toggle { display: inline-flex; }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 18px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }

  .site-nav.is-open { display: flex; }

  .site-nav a {
    padding: 12px 14px;
    font-size: 1rem;
  }

  .hero { padding: 28px 0 48px; }
  .feature-section,
  .quickstart-section { padding: 52px 0; }
  .cta-band { padding: 48px 0; }

  .pillars-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .code-panel pre { padding: 14px 16px; font-size: 0.8rem; }
  .qs-card { padding: 18px; }
  .visual-card { padding: 12px; }
  .footer-links-group { gap: 28px; }
}
