/* ── Custom properties ─────────────────────────────────────── */
:root {
  /* Light theme */
  --bg:             #fafaf8;
  --bg-elevated:    #ffffff;
  --bg-card:        #ffffff;
  --bg-callout:     #f0f4ff;
  --bg-subtle:      #f0eeeb;
  --text:           #1a1918;
  --text-muted:     #64615c;
  --text-faint:     #9b9891;
  --border:         #e2e0dc;
  --border-hover:   #d0cec9;
  --accent:         #2563eb;
  --accent-hover:   #1d4ed8;
  --accent-soft:    rgba(37, 99, 235, .08);
  --accent-blue:    #2563eb;
  --accent-teal:    #0d9488;
  --accent-amber:   #d97706;
  --callout-stripe: #3b82f6;
  --cta-bg:         #1d4ed8;
  --cta-text:       #ffffff;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.04), 0 2px 6px rgba(0,0,0,.03);
  --shadow-md:      0 4px 12px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
  --shadow-lg:      0 8px 24px rgba(0,0,0,.08), 0 16px 48px rgba(0,0,0,.06);

  --radius:    .625rem;
  --radius-lg: 1rem;
  --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', ui-monospace, 'Cascadia Code', 'Fira Code', Menlo, monospace;
  --max-w:     68rem;
  --max-w-narrow: 52rem;
}

[data-theme="dark"] {
  --bg:             #0f0f0e;
  --bg-elevated:    #1a1918;
  --bg-card:        #1a1918;
  --bg-callout:     #162033;
  --bg-subtle:      #161514;
  --text:           #eae8e5;
  --text-muted:     #a8a49e;
  --text-faint:     #716d67;
  --border:         #2a2928;
  --border-hover:   #3d3b39;
  --accent:         #60a5fa;
  --accent-hover:   #93c5fd;
  --accent-soft:    rgba(96, 165, 250, .08);
  --accent-blue:    #60a5fa;
  --accent-teal:    #2dd4bf;
  --accent-amber:   #fbbf24;
  --callout-stripe: #3b82f6;
  --cta-bg:         #1e3a8a;
  --cta-text:       #e0e7ff;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.2), 0 2px 6px rgba(0,0,0,.15);
  --shadow-md:      0 4px 12px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.2);
  --shadow-lg:      0 8px 24px rgba(0,0,0,.35), 0 16px 48px rgba(0,0,0,.3);
}

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

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background .25s ease, color .25s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── Accessibility ─────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: .5rem 1.1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 200;
  transition: top .1s ease;
}
.skip-link:focus { top: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Layout ────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}

/* ── Scroll offset for sticky header ───────────────────────── */
[id] {
  scroll-margin-top: 6rem;
}

/* ── Reveal animation ─────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity .6s cubic-bezier(.25,.46,.45,.94),
              transform .6s cubic-bezier(.25,.46,.45,.94);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: .1s; }
.reveal-delay-2 { transition-delay: .2s; }
.reveal-delay-3 { transition-delay: .3s; }

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.site-header.is-scrolled {
  box-shadow: var(--shadow-sm);
}

.header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-height: 3.75rem;
  padding-block: .5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: .625rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -.01em;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 2.125rem;
  height: 2.125rem;
  background: var(--text);
  color: var(--bg);
  border-radius: .4375rem;
  font-size: .9rem;
  font-weight: 800;
  flex-shrink: 0;
  user-select: none;
  transition: background .25s ease, color .25s ease, transform .15s ease;
}
.logo:hover .logo-mark {
  transform: scale(1.05);
}

/* ── Site navigation ──────────────────────────────────────── */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .125rem .75rem;
  order: 3;
  width: 100%;
  padding-top: .5rem;
  margin-top: .25rem;
  border-top: 1px solid var(--border);
}

.site-nav a {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: .25rem 0;
  transition: color .15s ease;
}

.site-nav a:hover {
  color: var(--text);
}

@media (min-width: 48rem) {
  .header-bar {
    flex-wrap: nowrap;
    padding-block: 0;
    height: 3.75rem;
  }

  .site-nav {
    order: 2;
    width: auto;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
    margin-left: auto;
    gap: .25rem 1.5rem;
  }

  .site-nav a {
    font-size: .875rem;
  }
}

/* ── Theme toggle ──────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: .3rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .35rem .8rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
  line-height: 1;
  order: 2;
  margin-left: auto;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.theme-toggle:hover {
  background: var(--bg-subtle);
  border-color: var(--border-hover);
  transform: scale(1.03);
}

@media (min-width: 48rem) {
  .theme-toggle {
    order: 3;
    margin-left: 1.25rem;
  }
}

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

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .9375rem;
  font-weight: 600;
  text-decoration: none;
  padding: .75rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background .15s ease, color .15s ease,
              transform .15s ease, box-shadow .15s ease,
              border-color .15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.btn-on-accent {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: #fff;
  color: var(--cta-bg);
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  padding: .75rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn-on-accent:hover {
  background: #f0f4ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  padding-block: clamp(3.5rem, 12vw, 7rem) clamp(2.5rem, 7vw, 4rem);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: min(700px, 100vw);
  height: min(700px, 100vw);
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.hero > .container {
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

@media (min-width: 48rem) {
  .hero-grid {
    grid-template-columns: 1fr 20rem;
    gap: 3rem;
  }
}
@media (min-width: 64rem) {
  .hero-grid {
    grid-template-columns: 1fr 22rem;
  }
}

.hero-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: .3rem .9rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: clamp(2.25rem, 7vw, 4rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.05;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.hero-lead {
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 42ch;
  line-height: 1.65;
  margin-bottom: .5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.5rem;
}

/* Hero panel (right column) */
.hero-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.75rem 1.5rem 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: background .25s ease, border-color .25s ease;
}
.hero-panel::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  border-radius: 4px 0 0 4px;
}

.hero-panel-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.015em;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

.hero-facts {
  display: grid;
  gap: 0;
}

.hero-fact {
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}
.hero-fact:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.hero-fact dt {
  font-weight: 700;
  font-size: .9375rem;
  color: var(--text);
  letter-spacing: -.01em;
}

.hero-fact dd {
  font-size: .8125rem;
  color: var(--text-muted);
  margin-top: .125rem;
}

/* ── Section shared ───────────────────────────────────────── */
.section-alt {
  background: var(--bg-subtle);
  transition: background .25s ease;
}

.section-heading {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
  margin-bottom: .625rem;
}

.section-lead {
  color: var(--text-muted);
  font-size: clamp(.9375rem, 2vw, 1.05rem);
  max-width: 52ch;
  margin-bottom: 2rem;
}

.section-divider {
  border: none;
  height: 1px;
  background: var(--border);
  max-width: var(--max-w);
  margin-inline: auto;
}

/* ── Projects ─────────────────────────────────────────────── */
.projects {
  padding-block: clamp(3rem, 8vw, 5.5rem);
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  list-style: none;
}

@media (min-width: 36rem) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 56rem) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease,
              background .25s ease, border-color .2s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--card-accent, var(--accent));
}

@media (prefers-reduced-motion: reduce) {
  .card { transform: none !important; }
}

.card-accent-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-accent, var(--accent));
}

.card-icon {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: .25rem;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border-radius: var(--radius);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.card-desc {
  color: var(--text-muted);
  font-size: .9375rem;
  line-height: 1.6;
  flex: 1;
}

.card-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-faint);
  letter-spacing: .02em;
  margin-top: .5rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}

/* ── Principles ───────────────────────────────────────────── */
.principles {
  padding-block: clamp(3.5rem, 9vw, 6rem);
}

.principles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 40rem) {
  .principles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

.principle {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: background .25s ease, border-color .2s ease, box-shadow .2s ease;
}
.principle:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-hover);
}

.principle-marker {
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: .375rem;
  margin-bottom: .75rem;
  letter-spacing: .05em;
}

.principle h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: .5rem;
}

.principle p {
  color: var(--text-muted);
  font-size: .9375rem;
  line-height: 1.6;
}

/* ── Approach ─────────────────────────────────────────────── */
.approach {
  padding-block: clamp(3.5rem, 9vw, 6rem);
}

.approach-grid {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 48rem) {
  .approach-grid {
    grid-template-columns: 1fr 18rem;
    gap: 3rem;
  }
}
@media (min-width: 64rem) {
  .approach-grid {
    grid-template-columns: 1fr 20rem;
  }
}

.approach-steps {
  display: grid;
  gap: 0;
}

.approach-step {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}
.approach-step:first-child {
  padding-top: 0;
}
.approach-step:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.step-marker {
  color: var(--accent);
  font-size: .75rem;
  flex-shrink: 0;
  margin-top: .35rem;
}

.approach-step h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.015em;
  margin-bottom: .375rem;
}

.approach-step p {
  color: var(--text-muted);
  font-size: .9375rem;
  line-height: 1.6;
}

.approach-aside {
  align-self: start;
}

.approach-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: background .25s ease, border-color .25s ease;
}
.approach-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.approach-panel h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.015em;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

.approach-panel ul {
  list-style: none;
}

.approach-panel li {
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.approach-panel li::before {
  content: '\2713';
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.approach-panel li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* ── CTA section ──────────────────────────────────────────── */
.cta-section {
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 8vw, 5.5rem);
}

.cta-panel {
  background: var(--cta-bg);
  color: var(--cta-text);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 2rem;
  box-shadow: var(--shadow-md);
}

.cta-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.cta-body {
  flex: 1;
  min-width: 14rem;
}

.cta-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: .375rem;
}

.cta-body p {
  font-size: .9375rem;
  line-height: 1.6;
  opacity: .9;
}

.cta-actions {
  flex-shrink: 0;
}

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  transition: border-color .25s ease;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.footer-copy {
  color: var(--text-faint);
  font-size: .8125rem;
  font-family: var(--font-mono);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-nav a {
  color: var(--text-muted);
  font-size: .875rem;
  text-decoration: none;
  transition: color .15s ease;
}
.footer-nav a:hover {
  color: var(--text);
}

/* ── Shared link styles ───────────────────────────────────── */
.text-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  transition: color .15s ease;
}
.text-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ── Subpage layout ───────────────────────────────────────── */
.page-section {
  padding-block: clamp(3.5rem, 9vw, 6rem);
}

.page-header {
  max-width: var(--max-w-narrow);
  margin-bottom: 2.5rem;
}

.page-title {
  font-size: clamp(2.25rem, 7vw, 3.75rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.04em;
  margin-bottom: 1rem;
}

.page-lead {
  color: var(--text-muted);
  font-size: clamp(1rem, 2.3vw, 1.15rem);
  max-width: 62ch;
  line-height: 1.65;
}

.content-stack {
  display: grid;
  gap: 1.25rem;
  max-width: var(--max-w-narrow);
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 1.625rem;
  transition: background .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.info-card h2,
.info-card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: .75rem;
}

.info-card p {
  color: var(--text-muted);
  font-size: .9375rem;
  line-height: 1.7;
}

.info-card p + p,
.info-card ul,
.info-card ol {
  margin-top: .75rem;
}

.info-card ul,
.info-card ol {
  padding-left: 1.2rem;
  color: var(--text-muted);
  font-size: .9375rem;
}

.info-card li + li {
  margin-top: .5rem;
}

.note-box {
  background: var(--bg-callout);
  border-color: transparent;
  position: relative;
  overflow: hidden;
}
.note-box::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--callout-stripe);
}

.inline-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  margin-top: 1.25rem;
}

.inline-nav a {
  color: var(--accent);
  font-weight: 600;
  font-size: .875rem;
  text-decoration: none;
  transition: color .15s ease;
}

.inline-nav a:hover {
  color: var(--accent-hover);
}
