/* ============================================================
   1. CSS Variables
   ============================================================ */
:root {
  --ink: #f4f7f8;
  --ink-soft: #a9bdc7;
  --paper: #10191e;
  --paper-dim: #17252c;
  --paper-dim2: #233842;
  --teal: #2f7694;
  --teal-deep: #8fc6df;
  --gold: #b7ddea;
  --line: rgba(143, 198, 223, 0.16);
  --nav-tint: #121d23;
  --paper-veil: rgba(16, 25, 30, 0.78);
  --street-color: var(--ink);
}

[data-theme="light"] {
  --ink: #18262d;
  --ink-soft: #61747e;
  --paper: #f7fafb;
  --paper-dim: #eaf1f4;
  --paper-dim2: #d7e5ea;
  --teal: #4b8da7;
  --teal-deep: #093f59;
  --gold: #d2eaf3;
  --line: rgba(9, 63, 89, 0.16);
  --nav-tint: rgba(247, 250, 251, 0.96);
  --paper-veil: rgba(247, 250, 251, 0.82);
  --street-color: var(--ink);
}


/* ============================================================
   2. Reset & Base Styles
   ============================================================ */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans', sans-serif;
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
  transition: background-color .25s ease, color .25s ease;
}

a {
  color: inherit;
}

/* Shared page container used by nav, sections, and footer */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 28px;
}

/* Keeps header/section/footer content stacked above the decorative
   line art and text backdrops defined in Typography and Hero Section */
header.hero,
section,
footer {
  position: relative;
  z-index: 1;
}


/* ============================================================
   3. Typography
   ============================================================ */
h1,
h2,
h3 {
  font-family: 'Fraunces', serif;
  font-optical-sizing: auto;
  margin: 0 0 0.4em 0;
  letter-spacing: -0.01em;
}

/* Readable backdrop: sits behind exposed headings/paragraphs, scales with
   each element's own font-size (em), stays translucent, and fades out
   softly at its edges instead of a hard box. Applied to section
   headings/descriptions and about-grid body copy. The hero heading/lead
   use a wider fade bar instead — see .hero-copy in Hero Section. */
.section-head h2,
.section-head p,
.about-grid>div>p:not(.quote) {
  position: relative;
  isolation: isolate;
}

.section-head h2::before,
.section-head p::before,
.about-grid>div>p:not(.quote)::before {
  content: "";
  position: absolute;
  inset: -0.4em -0.7em;
  background: radial-gradient(ellipse at center,
      var(--paper-veil) 0%,
      var(--paper-veil) 50%,
      transparent 100%);
  z-index: -1;
  pointer-events: none;
  border-radius: 0.5em;
}


/* ============================================================
   4. Navigation
   ============================================================ */
nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-tint);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  transform: translateY(0);
  transition: transform .3s ease, box-shadow .3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
}

nav.nav-collapsed {
  transform: translateY(-100%);
  box-shadow: none;
}

/* Brand / logo (swaps light-dark logo art by theme) */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  height: 64px;
  width: auto;
  display: block;
}

.brand .logo-dark {
  display: none;
}

.brand .logo-light {
  display: block;
}

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

[data-theme="light"] .brand .logo-light {
  display: none;
}

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

nav ul {
  list-style: none;
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
  letter-spacing: 0.03em;
}

/* Theme toggle button (swaps sun/moon icon by theme) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 2px;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color .15s, border-color .25s, color .25s;
}

.theme-toggle:hover {
  background: var(--paper-dim);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--teal-deep);
  outline-offset: 3px;
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
  display: block;
}

.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;
}

nav a {
  text-decoration: none;
  opacity: 0.75;
  transition: opacity .15s;
}

nav a:hover {
  opacity: 1;
}


/* ============================================================
   5. Hero Section
   ============================================================ */
header.hero {
  padding: 88px 0 68px;
  overflow: hidden;
  /* position: relative is already applied above, shared with section/footer */
}

/* Decorative line art flanking the hero. The paths are drawn at runtime by
   street-art.js from public/data/streets.json (no large SVG file is loaded
   or inlined here), so the color can be controlled entirely through CSS. */
.street-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100vw;
  height: 100vh;
  opacity: 0.06;
  color: var(--street-color);
  pointer-events: none;
  transform: translateY(var(--street-offset-y, -600px)) scale(var(--street-scale, 3));
}

.street-background path {
  fill: none;
  stroke: currentColor;
  stroke-width: 0.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

header.hero>.wrap {
  position: relative;
  z-index: 1;
}

header.hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.8rem);
  max-width: 16ch;
  font-weight: 600;
}

header.hero p.lead {
  font-size: 1.15rem;
  max-width: 52ch;
  opacity: 0.82;
  margin-top: 18px;
}

.cta-row {
  margin-top: 34px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* Hero stat blocks */
.hero-stats {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  max-width: 620px;
}

.hero-stats div {
  background: var(--paper);
  padding: 18px 20px;
}

.hero-stats .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--teal-deep);
}

.hero-stats .lab {
  font-size: 0.78rem;
  opacity: 0.65;
  margin-top: 4px;
}

/* ============================================================
   6. Buttons
   ============================================================ */
.btn {
  display: inline-block;
  padding: 14px 26px;
  border-radius: 1px;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s, background-color .15s, color .15s;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--teal-deep);
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary::after {
  content: "›";
  font-size: 1.1em;
  line-height: 1;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.btn-ghost {
  border-color: var(--ink-soft);
  color: var(--ink);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--teal-deep);
  color: var(--teal-deep);
}


/* ============================================================
   7. Section Headers (shared by About, Simulator, etc.)
   ============================================================ */
section {
  padding: 80px 0;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}

.section-head .idx {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--teal-deep);
}

.section-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.section-head p {
  max-width: 46ch;
  opacity: 0.7;
  font-size: 0.95rem;
}


/* ============================================================
   8. About Section
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
}

.about-grid p {
  opacity: 0.85;
  margin-bottom: 1.1em;
}

.about-grid .quote {
  position: relative;
  border-left: 2px solid var(--teal-deep);
  padding-left: 24px;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.4;
}

.usp-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.usp {
  border: 1px solid var(--line);
  padding: 18px 20px;
  background: var(--paper-dim);
}

.usp .tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--teal-deep);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.usp h3 {
  font-size: 1.02rem;
  margin: 6px 0 4px;
}

.usp p {
  font-size: 0.88rem;
  opacity: 0.72;
  margin: 0;
}



/* ============================================================
   10. Footer
   ============================================================ */
footer {
  padding: 56px 0;
  border-top: 1px solid var(--line);
}

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

footer .f-links {
  display: flex;
  gap: 20px;
  font-size: 0.85rem;
  opacity: 0.75;
}

footer .f-links a {
  text-decoration: none;
}


/* ============================================================
   11. Responsive Styles
   ============================================================ */
/* Hero + About — hide decorative line art and stack the about grid */
@media (max-width: 820px) {
  .street-background {
    display: none;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }
}
