/* ============================================================
   Knomosis Website — Pure CSS, No Dependencies
   Neumorphic ("soft UI") theme in light and dark modes.
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ============================================================
   Neumorphic theme — palette anchors (decorative):
     #8ECC81 green · #81CC9A mint · #81CCC0 teal
     #C081CC purple · #CC818E rose
   Surfaces share the background colour and are shaped by paired
   soft shadows (light top-left + dark bottom-right). Pastels are
   used for fills/accents; darkened "ink" variants carry text so
   contrast stays accessible.
   :root holds the DARK theme; [data-theme="light"] the light one.
   ============================================================ */
:root {
  /* Colors — dark neumorphic plane (desaturated green-grey) */
  --bg:          #262d29;
  --bg-alt:      #222823;
  --surface:     #262d29;
  --surface-2:   #2c352f;
  --border:      rgba(150, 184, 164, 0.12);
  --text:        #c6d1ca;
  --text-muted:  #9caaa0;
  --text-bright: #e9f0eb;
  --heading:     #f1f6f2;
  --accent:      #81ccc0;
  --accent-dim:  #62b3a6;
  --accent-glow: rgba(129, 204, 192, 0.16);
  --on-accent:   #15201c;
  --green:       #8ecc81;
  --green-dim:   rgba(142, 204, 129, 0.14);
  --yellow:      #d8bd72;
  --yellow-dim:  rgba(216, 189, 114, 0.12);
  --red:         #cc818e;
  --red-dim:     rgba(204, 129, 142, 0.14);
  --purple:      #c081cc;
  --purple-dim:  rgba(192, 129, 204, 0.14);

  /* Neumorphic shadow seed colours (per theme) */
  --shadow-dark:  #191e1b;
  --shadow-light: #323b35;
  /* Flood colours for the SVG flow-node soft shadow (read by map.js) */
  --flow-shadow-dark:  rgba(0, 0, 0, 0.55);
  --flow-shadow-light: rgba(72, 86, 78, 0.55);

  /* Flow-chart lane/edge colours (read by map.js at render time). Light
     pastels read well on the dark canvas. */
  --flow-selected: #81ccc0;
  --flow-depends:  #8ecc81;
  --flow-usedby:   #c081cc;
  --flow-calls:    #81cc9a;
  --flow-neutral:  #9aa8a0;

  /* Flat, uniform background — neumorphism depends on an even surface */
  --bg-pattern: var(--bg);

  /* Assurance colours (legacy map tokens; unused but kept defined) */
  --assurance-linked:  #8ecc81;
  --assurance-partial: #c081cc;
  --assurance-local:   #81ccc0;
  --assurance-none:    #8b988f;

  /* Typography */
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:  "SFMono-Regular", "Cascadia Code", "Fira Code", Consolas, "Liberation Mono", Menlo, monospace;

  /* Layout — flat sections on the shared plane */
  --section-bg:     var(--bg);
  --section-alt-bg: var(--bg-alt);
  --footer-bg:      var(--bg-alt);

  /* Spacing & shape — generous radii read as soft, moulded forms */
  --section-pad: 5rem 0;
  --container-w: 72rem;
  --radius:      0.75rem;
  --radius-lg:   1.1rem;
  --nav-height: 3.75rem;
  --nav-scroll-offset: 4.5rem;

  /* Neumorphic shadow tokens — resolve lazily against the per-theme
     --shadow-* seeds, so a single definition serves both themes. */
  --neu-raised:    6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
  --neu-raised-sm: 4px 4px 9px var(--shadow-dark),  -4px -4px 9px var(--shadow-light);
  --neu-flat:      2px 2px 6px var(--shadow-dark),  -2px -2px 6px var(--shadow-light);
  --neu-inset:     inset 4px 4px 9px var(--shadow-dark), inset -4px -4px 9px var(--shadow-light);
  --neu-inset-sm:  inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
}

/* --- Light Theme (the canonical neumorphic surface) --- */
[data-theme="light"] {
  --bg:          #e6ece8;
  --bg-alt:      #e1e8e3;
  --surface:     #e6ece8;
  --surface-2:   #edf2ef;
  --border:      rgba(120, 150, 132, 0.22);
  --text:        #45514a;
  --text-muted:  #5d6a62;
  --text-bright: #2b342e;
  --heading:     #222a25;
  --accent:      #15705a;
  --accent-dim:  #0f5a47;
  --accent-glow: rgba(129, 204, 192, 0.32);
  --on-accent:   #ffffff;
  --green:       #2c7539;
  --green-dim:   rgba(142, 204, 129, 0.30);
  --yellow:      #856621;
  --yellow-dim:  rgba(204, 180, 120, 0.28);
  --red:         #a8434f;
  --red-dim:     rgba(204, 129, 142, 0.28);
  --purple:      #8a4796;
  --purple-dim:  rgba(192, 129, 204, 0.28);

  --shadow-dark:  #c5cfc9;
  --shadow-light: #fbfffc;
  --flow-shadow-dark:  rgba(150, 167, 158, 0.6);
  --flow-shadow-light: rgba(255, 255, 255, 0.9);

  /* Darkened lane/edge colours so 12px flow labels stay legible on the
     light canvas (all clear WCAG AA). */
  --flow-selected: #1a6e5e;
  --flow-depends:  #2c7539;
  --flow-usedby:   #8a4796;
  --flow-calls:    #24744b;
  --flow-neutral:  #5d6a62;

  --bg-pattern: var(--bg);

  --assurance-linked:  #3d8a47;
  --assurance-partial: #8a4796;
  --assurance-local:   #1f7d64;
  --assurance-none:    #6f7d74;

  --section-bg:     var(--bg);
  --section-alt-bg: var(--bg-alt);
  --footer-bg:      var(--bg-alt);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  scroll-padding-top: var(--nav-scroll-offset);
}

@supports not (scroll-behavior: smooth) {
  html {
    scroll-padding-top: 0;
  }
}

section[id],
header[id] {
  scroll-margin-top: var(--nav-scroll-offset);
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-shadow: none;
  overflow-x: clip;
}

@supports not (overflow: clip) {
  body {
    overflow-x: hidden;
  }
}

body.nav-open {
  overflow: visible;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--accent-dim);
}
[data-theme="light"] a:hover {
  color: var(--text-bright);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface-2);
  padding: 0.15em 0.45em;
  border-radius: 0.45rem;
  box-shadow: inset 1px 1px 2px var(--shadow-dark), inset -1px -1px 2px var(--shadow-light);
  color: var(--accent);
}

pre {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--neu-inset);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.65;
  tab-size: 2;
}
pre code {
  background: none;
  padding: 0;
  color: var(--text-bright);
  font-size: inherit;
}

ul {
  list-style: none;
  padding: 0;
}

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

strong {
  color: var(--text-bright);
  font-weight: 600;
}

em {
  font-style: italic;
}

/* --- Screen-reader-only utility --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: visible;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Skip Link (Accessibility) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 1001;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0.75rem;
  color: var(--on-accent);
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 1.5rem);
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition: background 0.3s, box-shadow 0.3s;
  background: transparent;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.nav.scrolled {
  background: var(--bg);
  box-shadow: 0 5px 16px var(--shadow-dark);
}

.nav-inner {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 1.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--nav-height);
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  border-radius: var(--radius);
  -webkit-tap-highlight-color: transparent;
}
.nav-logo:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
}

@media (min-width: 48.0625rem) {
  .nav-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: 0.75rem;
  }

  .nav-links {
    justify-self: center;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-controls {
    margin-left: 0;
    justify-self: end;
  }
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.6rem 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
  touch-action: manipulation;
}
.nav-links a:hover {
  color: var(--text-bright);
  background: var(--accent-glow);
}
.nav-links a:focus-visible {
  color: var(--text-bright);
  background: var(--accent-glow);
}
.nav-links a[aria-current="page"],
.nav-links a[aria-current="true"] {
  color: var(--accent);
  background: var(--accent-glow);
}

.nav-links a.nav-cta {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  padding: 0.45rem 1.1rem;
  box-shadow: var(--neu-raised-sm);
}
.nav-links a.nav-cta:hover {
  background: var(--accent-dim);
  color: var(--on-accent);
}
.nav-links a.nav-cta:active {
  box-shadow: var(--neu-inset-sm);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
  line-height: 0;
  touch-action: manipulation;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.nav-toggle.open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* --- Theme Toggle (neumorphic raised button) --- */
.theme-toggle {
  background: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 0.4rem;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  box-shadow: var(--neu-raised-sm);
  transition: color 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
  touch-action: manipulation;
}
.theme-toggle:hover {
  color: var(--accent);
}
.theme-toggle:active {
  color: var(--accent);
  box-shadow: var(--neu-inset-sm);
}
.theme-toggle svg {
  width: 1.125rem;
  height: 1.125rem;
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* --- Logo Image --- */
.logo-img {
  height: 4rem;
  width: auto;
  display: block;
}
.nav-logo .logo-img {
  height: clamp(2.2rem, 6vw, 2.8rem);
}
.logo-img-dark { display: block; }
.logo-img-light { display: none; }
[data-theme="light"] .logo-img-dark { display: none; }
[data-theme="light"] .logo-img-light { display: block; }
@media (prefers-color-scheme: light) {
  html:not([data-theme]) .logo-img-dark { display: none; }
  html:not([data-theme]) .logo-img-light { display: block; }
}

.hero-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
  filter: drop-shadow(0 6px 24px rgba(0, 0, 0, 0.65));
}

html:not([data-theme="light"]) .hero-logo {
  filter: drop-shadow(0 8px 32px rgba(0, 0, 0, 0.75));
}
.hero-logo .logo-img {
  width: 14rem;
  height: 14rem;
  width: clamp(7rem, 20vw, 14rem);
  height: clamp(7rem, 20vw, 14rem);
  object-fit: contain;
}

.footer-logo .logo-img {
  height: 4rem;
}

/* Architecture blocks as links */
a.arch-block {
  text-decoration: none;
  color: var(--text-bright);
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
}
a.arch-block:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(91, 160, 245, 0.15);
  color: var(--accent);
}
a.arch-block:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 30%, transparent);
}

/* Light theme overrides for backgrounds */
[data-theme="light"] .hero-bg {
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(43, 111, 208, 0.12), transparent),
    radial-gradient(ellipse 40% 30% at 70% 60%, rgba(22, 128, 75, 0.08), transparent);
}

/* --- Hero --- */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding: calc(var(--nav-height) + 2.25rem) 0 4rem;
}

/* Neumorphism uses a flat, even plane — the hero glow is intentionally off. */
.hero-bg {
  display: none;
}

/* Flat, fixed background plane behind all content. (Replaces the former WebGL
   canvas; pure CSS, no JS.) A uniform surface is what lets the paired
   neumorphic shadows read as raised/recessed. */
.site-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg-pattern);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

html:not([data-theme="light"]) .hero-label {
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
}


.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text);
  max-width: 38rem;
  margin: 0 auto 1rem;
  line-height: 1.8;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

html:not([data-theme="light"]) .hero-subtitle {
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
}

.hero-tagline {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 3rem;
}
.hero-tagline code {
  background: var(--green-dim);
  color: var(--green);
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 6rem;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 1.6rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  border: none;
  text-decoration: none;
  box-shadow: var(--neu-raised-sm);
}
.btn:active {
  box-shadow: var(--neu-inset-sm);
}

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

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

/* --- Sections --- */
.section {
  position: relative;
  z-index: 1;
  padding: var(--section-pad);
  background: var(--section-bg);
  content-visibility: auto;
  contain-intrinsic-size: auto 800px;
}
.section-alt {
  background: var(--section-alt-bg);
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  text-wrap: balance;
  overflow-wrap: break-word;
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  text-align: center;
}

.section-lead {
  font-size: 1.0625rem;
  color: var(--text);
  max-width: 42rem;
  margin: 0 auto 3rem;
  text-align: center;
  line-height: 1.8;
}

/* --- Grid --- */
.grid {
  display: grid;
  gap: 1.5rem;
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* --- Cards (neumorphic raised panels) --- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--neu-raised);
  padding: 2rem;
}
.card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.75rem;
}
.card h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.5rem;
}
.card-compact h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.card p {
  color: var(--text);
  line-height: 1.7;
}
.card ul {
  margin-top: 0.75rem;
}
.card ul li {
  padding: 0.25rem 0 0.25rem 1.25rem;
  position: relative;
  line-height: 1.6;
}
.card ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.card-compact {
  padding: 1.5rem;
}

.card-note {
  margin-top: 1rem;
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--text-muted);
}

/* --- Callout Box (neumorphic raised, accent-edged) --- */
.callout {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--neu-raised);
  padding: 2rem 2.5rem;
  margin: 2rem 0;
}
.callout h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1rem;
}
.callout p {
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 0.75rem;
}
.callout p:last-child {
  margin-bottom: 0;
}

/* --- Architecture Diagram --- */
.arch-diagram {
  margin: 3rem auto;
  max-width: 48rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.arch-layer {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  position: relative;
}

.arch-layer-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.arch-blocks {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.arch-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-bright);
  text-align: center;
  flex: 1 1 auto;
  min-width: 6rem;
  overflow: visible;
}

.arch-blocks .arch-block {
  max-width: calc(33.333% - 0.5rem);
}

/* File path hints inside architecture blocks */
.arch-hint {
  display: block;
  font-size: 0.625rem;
  font-weight: 400;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.25rem;
  letter-spacing: 0;
}

/* Theorem/file count annotations on arch blocks */
.arch-stat {
  display: block;
  font-size: 0.5625rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.1875rem;
  letter-spacing: 0;
  line-height: 1.3;
}

/* Layer-level stat annotation next to label */
.arch-layer-stat {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 0.5rem;
  opacity: 0.8;
}

.arch-api { background: rgba(91, 160, 245, 0.06); }
.arch-api .arch-block { border-color: rgba(91, 160, 245, 0.25); }

.arch-core { background: rgba(78, 201, 137, 0.04); }
.arch-core .arch-block { border-color: rgba(78, 201, 137, 0.2); }
.arch-core .arch-blocks .arch-block {
  max-width: calc(25% - 0.375rem);
  min-width: 0;
}

.arch-security { background: rgba(229, 192, 123, 0.04); }
.arch-security .arch-block { border-color: rgba(229, 192, 123, 0.2); }

.arch-hw { background: rgba(224, 108, 117, 0.04); }
.arch-hw .arch-block { border-color: rgba(224, 108, 117, 0.2); }
.arch-hw .arch-blocks .arch-block {
  min-width: 0;
}

.arch-model { background: rgba(91, 160, 245, 0.03); }
.arch-model .arch-block { border-color: rgba(91, 160, 245, 0.15); }
.arch-model .arch-blocks .arch-block {
  max-width: calc(25% - 0.375rem);
  min-width: 0;
}

.arch-platform { background: rgba(198, 120, 221, 0.04); }
.arch-platform .arch-block { border-color: rgba(198, 120, 221, 0.2); }

.arch-rust { background: rgba(222, 120, 60, 0.05); }
.arch-rust .arch-block { border-color: rgba(222, 120, 60, 0.25); }

/* --- Features Grid --- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.feature-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--neu-raised);
  padding: 2rem;
  transition: box-shadow 0.2s, color 0.2s;
}
a.feature-card:hover {
  box-shadow: var(--neu-inset);
  color: var(--accent);
}
a.feature-card:hover h3 {
  color: var(--accent);
}

.feature-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 1rem;
  color: var(--accent);
}
.feature-icon svg {
  width: 100%;
  height: 100%;
}

.feature-card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.5rem;
}
.feature-card p {
  overflow-wrap: anywhere;
  max-width: 65ch;
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.7;
}

/* --- Getting Started Steps --- */
.steps {
  max-width: 48rem;
  margin: 0 auto 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.step {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--accent);
  color: var(--bg);
  font-weight: 800;
  font-size: 1.125rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.25rem;
}

.step-content {
  flex: 1;
  min-width: 0;
}
.step-content h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.5rem;
}
.step-content p {
  font-size: 0.9375rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

/* --- Footer --- */
.footer {
  position: relative;
  z-index: 1;
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 4rem 0 2rem;
}

.footer-compact {
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.footer-compact a {
  color: var(--text);
  transition: color 0.2s;
}
.footer-compact a:hover {
  color: var(--accent);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 64rem) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 48rem) {
  :root {
    --nav-height: 3.5rem;
    --section-pad: 3.5rem 0;
  }


  .nav {
    background: color-mix(in oklab, var(--bg) 84%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .nav-inner {
    gap: 0.5rem;
  }

  /* Nav mobile */
  .nav-toggle {
    display: inline-flex;
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--neu-raised-sm);
  }
  .nav-toggle:active {
    box-shadow: var(--neu-inset-sm);
  }
  .nav-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.45rem;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: calc(var(--nav-height) + env(safe-area-inset-top));
    left: 0;
    right: 0;
    margin-left: 0;
    background: var(--bg);
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 0;
    max-height: calc(100vh - var(--nav-height));
    max-height: calc(100svh - var(--nav-height));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    box-shadow: var(--neu-raised);
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links a {
    padding: 0.85rem 0.2rem;
    min-height: 2.75rem;
    width: 100%;
    font-size: 1rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
  .nav-links li {
    width: 100%;
  }
  .nav-links a.nav-cta {
    margin-top: 0.5rem;
    text-align: center;
  }

  .nav-logo .logo-img {
    height: clamp(2rem, 8vw, 2.35rem);
  }

  .theme-toggle,
  .nav-toggle {
    width: 2.5rem;
    height: 2.5rem;
    touch-action: manipulation;
  }

  /* Grids */
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }

  /* Hero */
  .hero {
    min-height: auto;
    padding: calc(var(--nav-height) + 1.75rem) 0 3rem;
  }
  .hero-logo {
    margin-bottom: 1.5rem;
  }
  .hero-stats {
    gap: 1.25rem;
  }
  .stat-value {
    font-size: 1.625rem;
  }

  /* Callout */
  .callout {
    padding: 1.5rem;
  }

  /* Cards */
  .card {
    padding: 1.5rem;
  }
  .card-compact {
    padding: 1.25rem;
  }
  .card-compact p {
    font-size: 0.875rem;
  }
  .feature-card {
    padding: 1.5rem;
  }
  .feature-card p {
    font-size: 0.875rem;
  }

  /* Architecture */
  .arch-diagram {
    max-width: 100%;
  }
  .arch-layer {
    padding: 0.75rem 0.875rem;
  }
  .arch-blocks {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
  }
  .arch-blocks .arch-block {
    max-width: none;
  }
  .arch-core .arch-blocks .arch-block,
  .arch-model .arch-blocks .arch-block {
    max-width: none;
  }
  .arch-block {
    min-width: 0;
    min-height: 3.25rem;
    padding: 0.5rem 0.625rem;
    font-size: 0.75rem;
    overflow-wrap: anywhere;
    word-break: normal;
    text-wrap: pretty;
  }

  /* Keep Lean blocks legible: names + hints are dense on small screens. */
  .arch-model .arch-blocks {
    grid-template-columns: 1fr;
  }
  .arch-stat {
    font-size: 0.5rem;
  }
  .arch-layer-stat {
    display: block;
    margin-left: 0;
    font-size: 0.5625rem;
  }
  .arch-hint {
    font-size: 0.5625rem;
  }

  /* Steps */
  .step {
    gap: 1rem;
  }
}

@supports not (content-visibility: auto) {
  .section,
  .card {
    content-visibility: visible;
    contain-intrinsic-size: auto;
  }
}

@media (max-width: 30rem) {
  .hero-stats {
    flex-direction: column;
    gap: 1rem;
  }
  .stat {
    flex-direction: row;
    gap: 0.75rem;
    min-width: auto;
  }
  .stat-value {
    font-size: 1.5rem;
    min-width: 5rem;
    text-align: right;
  }
  .stat-label {
    margin-top: 0;
    text-align: left;
  }

  /* Architecture: single column on very small screens */
  .arch-blocks {
    grid-template-columns: 1fr;
  }
  .arch-layer {
    padding: 0.625rem 0.75rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
  .btn {
    width: 100%;
    justify-content: center;
    max-width: 16rem;
  }

}

/* --- Accessibility --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
}

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

/* Forced-colors / High-Contrast mode strips box-shadows, which is how this
   neumorphic theme conveys structure — restore real borders so surfaces and
   controls stay delineated. */
@media (forced-colors: active) {
  .nav.scrolled,
  .card,
  .feature-card,
  .callout,
  .btn,
  .theme-toggle,
  .nav-toggle,
  pre,
  code {
    border: 1px solid;
  }
}

/* Selection */
::selection {
  background: rgba(129, 204, 192, 0.3);
  color: var(--heading);
}
[data-theme="light"] ::selection {
  background: rgba(129, 204, 192, 0.4);
  color: var(--heading);
}

/* --- Live Data Transitions --- */
[data-live] {
  transition: opacity 0.3s;
}

/* Tier scripts as links */
a.tier-script {
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}
a.tier-script:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* --- Print --- */
@media print {
  --print-bg: #fff;
  --print-fg: #222;
  --print-muted: #333;
  --print-border: #ccc;
  --print-surface: #f5f5f5;

  .nav, .hero-bg, .skip-link, .site-backdrop {
    display: none;
  }
  body {
    background: var(--print-bg, #fff);
    color: var(--print-fg, #222);
  }
  .hero {
    min-height: auto;
    padding: 2rem 0;
  }
  .section, .section-alt {
    background: var(--print-bg, #fff);
    padding: 1.5rem 0;
  }
  a { color: var(--print-fg, #222); }
  code { background: var(--print-surface, #f5f5f5); color: var(--print-muted, #333); }
  pre { border: 1px solid var(--print-border, #ccc); box-shadow: none; background: #f9f9f9; }
  /* Neumorphic depth is shadow-based and shadows don't print, so restore real
     borders for paper so panels stay delineated. */
  .card, .feature-card, .callout,
  .stat-card, .code-map-hero-shell {
    border: 1px solid var(--print-border, #ccc);
    box-shadow: none;
    background: var(--print-bg, #fff);
  }
}
