/* ═══════════════════════════════════════════════════════════════════
   Lectio · lectio.wiki Static Website
   Stone-Paper Atelier Light & Deep-Sea Observatory Dark (90/10 Neutral)
   Strict 2-font editorial pairing · 3 body sizes · Zero !important
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'PingFang SC', 'Noto Sans SC', 'Segoe UI', sans-serif;
  --font-serif: 'Iowan Old Style', 'Source Serif 4', 'Noto Serif SC', Georgia, serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Stone-Paper Atelier Light */
  --bg-canvas: #F8F6F1;
  --bg-surface: #EFECE5;
  --bg-sheet: #FFFDFB;
  --bg-header-scrolled: rgba(248, 246, 241, 0.9);
  --bg-hover: rgba(25, 24, 22, 0.045);

  --ink-1: #191816;
  --ink-2: #57534C;
  --ink-3: #6C665E;

  --border: rgba(25, 24, 22, 0.09);
  --border-strong: rgba(25, 24, 22, 0.16);
  --specular-top: inset 0 1px 0 rgba(255, 255, 255, 0.85);

  /* Deep Pine-Teal Primary Accent */
  --accent: #0E6F68;
  --accent-hover: #0A5852;
  --accent-soft: rgba(14, 111, 104, 0.09);
  --accent-on: #FFFFFF;
  --ochre: #9A6B2F;
  --ochre-soft: rgba(154, 107, 47, 0.11);

  --shadow-stage:
    0 2px 6px rgba(25, 24, 22, 0.045),
    0 18px 44px rgba(25, 24, 22, 0.085),
    0 0 0 1px rgba(25, 24, 22, 0.08);
  --shadow-focus: 0 0 0 2px var(--bg-canvas), 0 0 0 4px var(--accent);

  /* Strict 3-size body scale (Hero H1 & Brand wordmark exempt) */
  --text-heading: 1.375rem;
  --text-body: 1rem;
  --text-sm: 0.875rem;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-pill: 999px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 150ms;
  --dur-base: 210ms;

  --container: 1120px;
  color-scheme: light;
}

[data-theme='dark'] {
  --bg-canvas: #080E17;
  --bg-surface: #0E1624;
  --bg-sheet: #131E30;
  --bg-header-scrolled: rgba(8, 14, 23, 0.88);
  --bg-hover: rgba(226, 238, 255, 0.06);

  --ink-1: #EBF0F7;
  --ink-2: #A8B7CD;
  --ink-3: #8C9EB8;

  --border: rgba(226, 238, 255, 0.09);
  --border-strong: rgba(226, 238, 255, 0.17);
  --specular-top: inset 0 1px 0 rgba(226, 238, 255, 0.08);

  --accent: #2DD4BF;
  --accent-hover: #5EEAD4;
  --accent-soft: rgba(45, 212, 191, 0.13);
  --accent-on: #04211E;
  --ochre: #D4A359;
  --ochre-soft: rgba(212, 163, 89, 0.14);

  --shadow-stage:
    0 4px 12px rgba(2, 6, 14, 0.45),
    0 24px 64px rgba(2, 6, 14, 0.58),
    0 0 0 1px rgba(226, 238, 255, 0.11);

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--bg-canvas);
  color: var(--ink-1);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.theme-transitioning body,
.theme-transitioning .site-header,
.theme-transitioning .stage-frame,
.theme-transitioning .curve-panel,
.theme-transitioning .code-shell {
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), border-color 200ms var(--ease-out);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

code,
pre {
  font-family: var(--font-mono);
}

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-on);
  font-size: var(--text-sm);
  font-weight: 600;
}

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

:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

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

/* ── Header (Borderless at y=0, crisp separation on scroll) ──────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}

.site-header.is-scrolled {
  background: var(--bg-header-scrolled);
  border-bottom-color: var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 64px;
}

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

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.brand-wordmark {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink-1);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-2);
  transition: color var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a[aria-current='page'] {
  color: var(--ink-1);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-2);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.nav-control:hover {
  background: var(--bg-hover);
  color: var(--ink-1);
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

[data-theme='light'] .theme-icon-sun,
[data-theme='dark'] .theme-icon-moon {
  display: none;
}

.nav-launch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-on);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.nav-launch:hover {
  background: var(--accent-hover);
}

.nav-launch:active {
  transform: scale(0.98);
}

.nav-menu-btn {
  display: none;
}

/* Mobile drawer */
.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(8, 14, 23, 0.45);
}

.mobile-drawer {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--bg-sheet);
  border-bottom: 1px solid var(--border-strong);
  padding: 20px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mobile-drawer[hidden],
.mobile-drawer-backdrop[hidden] {
  display: none;
}

.mobile-drawer nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-drawer nav a {
  padding: 10px 4px;
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--ink-1);
  border-bottom: 1px solid var(--border);
}

/* ── Hero: Centered Monumental Editorial Type + Wide Real Product Stage ── */
.hero {
  position: relative;
  margin-top: -64px;
  padding: 132px 0 88px;
  overflow-x: clip;
  background:
    radial-gradient(ellipse 76% 48% at 50% 0%, var(--accent-soft), transparent 72%),
    var(--bg-canvas);
}

.hero-header {
  max-width: 840px;
  margin: 0 auto 44px;
  text-align: center;
}

.hero h1 {
  margin: 0 0 20px;
  font-family: var(--font-serif);
  font-size: clamp(2.85rem, 6.2vw, 5.1rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--ink-1);
  text-wrap: balance;
}

.hero-subtitle {
  max-width: 54ch;
  margin: 0 auto 30px;
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--ink-2);
  text-wrap: pretty;
}

.hero-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 24px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--accent-on);
  font-size: var(--text-body);
  font-weight: 600;
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

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

.btn-primary:active {
  transform: scale(0.985);
}

.hero-secondary-note {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.hero-secondary-note a {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
  transition: color var(--dur-fast) var(--ease-out), text-decoration-color var(--dur-fast) var(--ease-out);
}

.hero-secondary-note a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Interactive real-product stage */
.stage-wrap {
  max-width: 1020px;
  margin: 0 auto;
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.segmented [role='tab'] {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-2);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.segmented [role='tab'][aria-selected='true'] {
  background: var(--bg-sheet);
  color: var(--ink-1);
  box-shadow: 0 1px 2px rgba(25, 24, 22, 0.08);
}

.stage-caption {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.stage-frame {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--bg-sheet);
  box-shadow: var(--shadow-stage);
}

.stage-panel[hidden] {
  display: none;
}

.stage-panel img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
}

/* ── Editorial Sections (Whitespace + 1px architectural hairlines) ── */
.section {
  padding: 88px 0;
  border-top: 1px solid var(--border);
}

.section-muted {
  background: var(--bg-surface);
}

.section-head {
  max-width: 62ch;
  margin-bottom: 48px;
}

.section-head h2 {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 3.2vw, 2.55rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--ink-1);
}

.section-head p {
  margin: 0;
  font-size: var(--text-body);
  color: var(--ink-2);
  max-width: 60ch;
}

/* Asymmetric editorial rows (zero card cages) */
.editorial-list {
  display: flex;
  flex-direction: column;
}

.editorial-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.4fr);
  gap: 24px 56px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
  align-items: start;
}

.editorial-row:last-child {
  border-bottom: 1px solid var(--border);
}

.editorial-row h3 {
  margin: 0;
  font-size: var(--text-heading);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--ink-1);
}

.editorial-row p {
  margin: 0;
  font-size: var(--text-body);
  color: var(--ink-2);
  max-width: 62ch;
}

/* ── Dual-Track Memory Engine Interactive Lab ────────────────────── */
.engine-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  gap: 48px;
  align-items: center;
}

.curve-panel {
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--bg-sheet);
  border: 1px solid var(--border);
  box-shadow: var(--specular-top);
}

.curve-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.curve-controls-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-1);
}

.curve-svg {
  width: 100%;
  height: auto;
  display: block;
}

.curve-area {
  color: var(--accent);
}

.curve-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--ink-2);
  flex-wrap: wrap;
}

.legend-group {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 16px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--accent);
}

.legend-swatch.is-secondary {
  background: var(--ochre);
}

.engine-points {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.engine-point h3 {
  margin: 0 0 8px;
  font-size: var(--text-heading);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.engine-point p {
  margin: 0;
  color: var(--ink-2);
  max-width: 54ch;
}

/* ── Deployment / Three Ways to Run ──────────────────────────────── */
.deploy-panel {
  margin-top: 28px;
  padding: 28px 0 8px;
  border-top: 1px solid var(--border);
}

.deploy-panel[hidden] {
  display: none;
}

.deploy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 36px;
  align-items: center;
}

.deploy-copy h3 {
  margin: 0 0 12px;
  font-size: var(--text-heading);
  font-weight: 600;
}

.deploy-copy p {
  margin: 0 0 22px;
  color: var(--ink-2);
  max-width: 52ch;
}

.deploy-meta-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deploy-meta-list li {
  font-size: var(--text-body);
  color: var(--ink-2);
  padding-left: 18px;
  position: relative;
}

.deploy-meta-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.code-shell {
  border-radius: var(--r-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  overflow: hidden;
}

.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.copy-btn {
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-2);
  background: var(--bg-sheet);
  border: 1px solid var(--border);
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.copy-btn:hover {
  color: var(--ink-1);
  border-color: var(--border-strong);
}

.copy-btn[data-copied='true'] {
  color: var(--accent);
  border-color: var(--accent);
}

.code-shell pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--ink-1);
}

.copy-fallback {
  position: fixed;
  top: -1000px;
  left: -1000px;
  opacity: 0;
}

/* ── Docs & Privacy Pages (Open directly into content, zero hero banner) ── */
.doc-shell {
  padding: 44px 0 96px;
}

.doc-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.docs-toc {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.docs-toc-title {
  margin: 0 0 10px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-1);
}

.docs-toc a {
  padding: 6px 10px;
  border-left: 2px solid var(--border);
  font-size: var(--text-sm);
  color: var(--ink-2);
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.docs-toc a:hover,
.docs-toc a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.prose {
  max-width: 68ch;
}

.prose h1 {
  margin: 0 0 16px;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.prose h2 {
  margin: 48px 0 14px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: var(--text-heading);
  font-weight: 600;
  scroll-margin-top: 88px;
}

.prose h3 {
  margin: 28px 0 10px;
  font-size: var(--text-body);
  font-weight: 600;
}

.prose p,
.prose li {
  font-size: var(--text-body);
  color: var(--ink-2);
}

.prose ul,
.prose ol {
  padding-left: 22px;
  margin: 14px 0 20px;
}

.prose li + li {
  margin-top: 8px;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose code {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-surface);
  font-size: var(--text-sm);
  color: var(--ink-1);
}

.prose .code-shell {
  margin: 18px 0 24px;
}

.prose .code-shell code {
  padding: 0;
  background: transparent;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0 28px;
  font-size: var(--text-sm);
}

.prose th,
.prose td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.prose th {
  color: var(--ink-1);
  font-weight: 600;
  border-bottom-color: var(--border-strong);
}

.prose td {
  color: var(--ink-2);
}

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

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

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

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .nav-links {
    display: none;
  }

  .nav-menu-btn {
    display: inline-flex;
  }

  .editorial-row,
  .engine-split,
  .deploy-grid,
  .doc-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .docs-toc {
    position: static;
    border-bottom: 1px solid var(--border);
    padding-bottom: 18px;
  }
}

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

  .hero {
    margin-top: -64px;
    padding: 104px 0 60px;
  }

  .hero-header {
    margin-bottom: 32px;
  }

  .section {
    padding: 60px 0;
  }

  .deploy-panel {
    padding: 22px 0 4px;
  }

  .nav-launch {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    transition-duration: 0.01ms;
  }
}
