/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

h1, h2 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

[hidden] { display: none !important; }

/* =============================================
   DESIGN TOKENS — THEMES
   ============================================= */
:root[data-theme="slate"] {
  --bg: #0e1320;
  --surface: rgba(231, 234, 241, 0.03);
  --surface-hover: rgba(231, 234, 241, 0.06);
  --text: #e7eaf1;
  --text-bright: #fafbfd;
  --text-dim: #a4adc0;
  --text-faint: #7a849a;
  --border: rgba(231, 234, 241, 0.12);
  --border-strong: rgba(231, 234, 241, 0.16);
  --grid: rgba(231, 234, 241, 0.04);
  --invert-bg: #e7eaf1;
  --invert-text: #0e1320;
  --accent: #3aa86b;
}

:root[data-theme="amber"] {
  --bg: #1a120a;
  --surface: rgba(255, 176, 75, 0.04);
  --surface-hover: rgba(255, 176, 75, 0.08);
  --text: #ffcf8a;
  --text-bright: #ffe8c2;
  --text-dim: #c89758;
  --text-faint: #8a6738;
  --border: rgba(255, 176, 75, 0.14);
  --border-strong: rgba(255, 176, 75, 0.22);
  --grid: rgba(255, 176, 75, 0.05);
  --invert-bg: #ffcf8a;
  --invert-text: #1a120a;
  --accent: #3aa86b;
}

:root[data-theme="matrix"] {
  --bg: #04120a;
  --surface: rgba(80, 255, 160, 0.04);
  --surface-hover: rgba(80, 255, 160, 0.08);
  --text: #9aeec0;
  --text-bright: #d4ffe6;
  --text-dim: #5fb585;
  --text-faint: #3a7a55;
  --border: rgba(80, 255, 160, 0.14);
  --border-strong: rgba(80, 255, 160, 0.22);
  --grid: rgba(80, 255, 160, 0.05);
  --invert-bg: #9aeec0;
  --invert-text: #04120a;
  --accent: #3aa86b;
}

/* =============================================
   LAYOUT SHELL
   ============================================= */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
}

/* =============================================
   GRID BACKGROUND
   ============================================= */
.grid-bg {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* =============================================
   NAV
   ============================================= */
.nav {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  height: 56px;
  font-size: 12px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  min-width: 0;
}

.traffic-lights {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-faint  { background: var(--text-faint); }
.dot-accent { background: var(--accent); }

.nav-prompt {
  color: var(--text-faint);
  white-space: nowrap;
}

.nav-cmd {
  color: var(--text);
  white-space: nowrap;
}

.nav-right {
  display: flex;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0 22px;
  font-size: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--text-dim);
  border-left: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--surface-hover);
}

.nav-item.active {
  background: var(--invert-bg);
  color: var(--invert-text);
}

.nav-item.active:hover {
  background: var(--invert-bg);
}

/* =============================================
   SHARED KICKERS
   ============================================= */
.kicker {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 20px;
}

.kicker-sm {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 16px;
}

/* =============================================
   INDEX — HERO
   ============================================= */
.hero-section {
  padding: 64px 56px 48px;
  max-width: 1400px;
  margin: 0 auto;
}

h1 {
  font-size: clamp(28px, 6vw, 64px);
  line-height: 1.0;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-bright);
  max-width: 1100px;
}

.hero-body {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 48px;
  margin-top: 40px;
}

.terminal-block {
  color: var(--text-dim);
  line-height: 1.7;
  font-size: 14px;
  max-width: 680px;
}

.terminal-block p {
  margin-bottom: 1.2em;
}

.terminal-block p:last-child {
  margin-bottom: 0;
}

.prompt-dollar { color: var(--accent); }
.arrow         { color: var(--text-faint); }

.btn-row {
  margin-top: 32px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  font-size: 12.5px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--invert-bg);
  color: var(--invert-text);
  border-color: var(--invert-bg);
}

.btn-primary:hover {
  background: var(--text-bright);
  border-color: var(--text-bright);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  background: var(--surface-hover);
}

/* Stats card */
.stats-card {
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

.stats-header {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-faint);
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.stats-row-last {
  border-bottom: none;
}

.stats-key {
  color: var(--text-dim);
  font-size: 12px;
}

.stats-val {
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
}

.status-pill {
  margin-top: 16px;
  padding: 14px;
  /* accent #3aa86b = rgb(58,168,107) */
  border: 1px solid rgba(58, 168, 107, 0.3);
  background: rgba(58, 168, 107, 0.08);
  font-size: 12px;
  color: var(--text-dim);
}

.status-dot { color: var(--accent); }

/* =============================================
   INDEX — PRACTICE AREAS
   ============================================= */
.pillars-section {
  padding: 32px 56px 64px;
  max-width: 1400px;
  margin: 0 auto;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-strong);
}

.pillar-cell {
  padding: 28px;
  transition: background 0.2s;
}

.pillar-cell:hover {
  background: var(--surface);
}

.pillar-cell-bordered {
  border-left: 1px solid var(--border-strong);
}

.pillar-num {
  font-size: 11px;
  color: var(--text-faint);
}

.pillar-title {
  font-size: 18px;
  font-family: 'Inter', -apple-system, sans-serif;
  font-weight: 500;
  color: var(--text-bright);
  margin-top: 12px;
  letter-spacing: -0.01em;
}

.pillar-blurb {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 10px;
  line-height: 1.6;
}

.pillar-proof {
  margin-top: 16px;
  padding: 8px 10px;
  background: var(--surface-hover);
  border-left: 2px solid var(--accent);
  font-size: 11px;
  color: var(--text);
}

/* =============================================
   WORK
   ============================================= */
.work-section {
  padding: 56px;
  max-width: 1400px;
  margin: 0 auto;
}

.work-section h2 {
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 500;
  color: var(--text-bright);
  letter-spacing: -0.02em;
  margin-top: 0;
  margin-bottom: 36px;
}

.roles-list {
  border: 1px solid var(--border-strong);
}

.role-row {
  display: grid;
  grid-template-columns: 110px 220px 1fr 130px;
  gap: 24px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.role-row:hover {
  background: var(--surface);
}

.role-row-last {
  border-bottom: none;
}

.role-period  { color: var(--text-faint); font-size: 12px; }
.role-company { color: var(--text-bright); font-size: 14px; }
.role-title   { color: var(--text); font-size: 13.5px; }
.role-note    { color: var(--text-dim); font-size: 12.5px; margin-top: 6px; line-height: 1.6; }
.role-where   { color: var(--text-faint); font-size: 11px; text-align: right; }

/* =============================================
   SERVICES
   ============================================= */
.services-section {
  padding: 56px;
  max-width: 1400px;
  margin: 0 auto;
}

.services-h2 {
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 500;
  color: var(--text-bright);
  letter-spacing: -0.025em;
  line-height: 1.05;
  max-width: 1000px;
  margin: 0;
}

.h2-faint { color: var(--text-faint); }

.services-grid {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-strong);
}

.service-cell {
  padding: 28px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.service-cell-bordered {
  border-left: 1px solid var(--border-strong);
}

.service-brace-open,
.service-brace-close {
  font-size: 11px;
  color: var(--text-faint);
}

.service-title {
  font-size: 18px;
  font-family: 'Inter', -apple-system, sans-serif;
  font-weight: 500;
  color: var(--text-bright);
  letter-spacing: -0.01em;
}

.service-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 10px;
  line-height: 1.6;
}

/* =============================================
   CONTACT
   ============================================= */
.contact-section {
  padding: 56px;
  max-width: 1400px;
  margin: 0 auto;
}

.contact-h2 {
  font-size: clamp(32px, 6vw, 72px);
  font-weight: 500;
  color: var(--text-bright);
  letter-spacing: -0.035em;
  line-height: 0.98;
  max-width: 1100px;
  margin: 0;
}

.contact-cards {
  margin-top: 48px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--border-strong);
}

.contact-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px;
  min-height: 200px;
  color: var(--text);
  background: transparent;
  transition: background 0.15s, color 0.15s;
}

.contact-card:hover {
  background: var(--invert-bg);
  color: var(--invert-text);
}

.contact-card-bordered {
  border-left: 1px solid var(--border-strong);
}

.contact-card-kicker {
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 28px;
}

.contact-card-cmd {
  font-size: 28px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.arrow-out {
  margin-left: 10px;
  opacity: 0.5;
}

.logistics-strip {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border-strong);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.logistics-label { color: var(--text-faint); }

/* =============================================
   FOOTER
   ============================================= */
.footer {
  padding: 24px 56px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.theme-switcher {
  display: flex;
  gap: 8px;
}

.theme-btn {
  all: unset;
  cursor: pointer;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-faint);
  padding: 4px 8px;
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.theme-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.theme-btn.active {
  color: var(--invert-text);
  background: var(--invert-bg);
  border-color: var(--invert-bg);
}

/* =============================================
   RESPONSIVE — 768–1099px
   ============================================= */
@media (max-width: 1099px) {
  .hero-section,
  .pillars-section,
  .work-section,
  .services-section,
  .contact-section {
    padding-left: 40px;
    padding-right: 40px;
  }

  .footer {
    padding-left: 40px;
    padding-right: 40px;
  }

  .hero-body {
    grid-template-columns: 1fr;
    /* stats stacks below bio at this breakpoint (natural document order) */
  }

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

  /* third pillar: full-width row, remove left border, add top border */
  .pillar-cell-third {
    grid-column: 1 / -1;
    border-left: none;
    border-top: 1px solid var(--border-strong);
  }

  .role-row {
    grid-template-columns: 110px 160px 1fr 110px;
  }
}

/* =============================================
   RESPONSIVE — 480–767px
   ============================================= */
@media (max-width: 767px) {
  .hero-section {
    padding: 32px 20px 24px;
  }

  .pillars-section,
  .work-section,
  .services-section,
  .contact-section {
    padding: 32px 20px;
  }

  .footer {
    padding: 20px 24px;
    flex-wrap: wrap;
    gap: 12px;
  }

  h1 {
    font-size: clamp(28px, 7vw, 36px);
    line-height: 1.05;
  }

  .work-section h2,
  .services-h2,
  .contact-h2 {
    font-size: 32px;
  }

  /* stats moves above bio */
  .hero-body {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    order: -1;
  }

  /* all pillar columns → 1 col */
  .pillars-grid {
    grid-template-columns: 1fr;
  }

  .pillar-cell-bordered,
  .pillar-cell-third {
    grid-column: auto;
    border-left: none;
    border-top: 1px solid var(--border-strong);
  }

  /* work rows → stacked */
  .role-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .role-where {
    text-align: left;
  }

  .role-period {
    font-size: 11px;
  }

  /* services → 1 col */
  .services-grid {
    grid-template-columns: 1fr;
  }

  .service-cell-bordered {
    border-left: none;
    border-top: 1px solid var(--border-strong);
  }

  /* contact cards → 1 col */
  .contact-cards {
    grid-template-columns: 1fr;
  }

  .contact-card-bordered {
    border-left: none;
    border-top: 1px solid var(--border-strong);
  }

  .contact-card-cmd {
    font-size: 20px;
  }

  /* logistics → 1 col */
  .logistics-strip {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* =============================================
   RESPONSIVE — < 480px
   ============================================= */
@media (max-width: 479px) {
  .hero-section {
    padding: 24px 16px 20px;
  }

  .pillars-section,
  .work-section,
  .services-section,
  .contact-section {
    padding: 24px 16px;
  }

  h1 {
    font-size: 28px;
  }

  /* hide prompt string; keep traffic lights + section tabs */
  .nav-prompt,
  .nav-cmd {
    display: none;
  }

  /* scrollable nav tabs */
  .nav-right {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav-right::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    padding: 0 16px;
  }
}

/* hide decorative grid on small screens */
@media (max-width: 600px) {
  .grid-bg {
    background-image: none;
  }
}
