/* ============================================
   Tokens
   ============================================ */
:root {
  /* Surfaces */
  --bg: #0e1422;
  --bg-alt: #111a2e;
  --surface: rgba(255, 255, 255, 0.025);
  --surface-strong: rgba(255, 255, 255, 0.045);
  --bg-navbar: rgba(14, 20, 34, 0.78);

  /* Text */
  --fg: #e9ecf2;
  --fg-muted: #aab1c4;
  --fg-dim: #707892;

  /* Accent */
  --accent: #5fb6c0;
  --accent-strong: #2B5797;
  --accent-soft: rgba(95, 182, 192, 0.12);
  --gradient: linear-gradient(135deg, #2B5797 0%, #0EA5A0 100%);

  /* Lines */
  --rule: rgba(255, 255, 255, 0.07);
  --rule-strong: rgba(255, 255, 255, 0.12);

  /* Type */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Shape */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Motion */
  --t-fast: 200ms ease;
  --t-base: 320ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --container: 1080px;
  --reading: 68ch;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: -0.005em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--t-fast);
}

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

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

ul {
  list-style: none;
}

::selection {
  background: var(--accent-soft);
  color: var(--fg);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  background: var(--accent-strong);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* ============================================
   Layout primitives
   ============================================ */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
}

.section {
  padding: 120px 0;
  position: relative;
}

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

.section-divider {
  border-top: 1px solid var(--rule);
}

.section-head {
  max-width: var(--reading);
  margin-bottom: 64px;
}

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 16px;
  text-transform: none;
}

.section-title {
  font-size: clamp(1.75rem, 3.6vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.018em;
  color: var(--fg);
  margin-bottom: 16px;
}

.section-lede {
  color: var(--fg-muted);
  font-size: 1.025rem;
  line-height: 1.7;
  max-width: var(--reading);
}

/* ============================================
   Navbar
   ============================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 18px 0;
  transition: background var(--t-base), border-color var(--t-base), padding var(--t-base);
  border-bottom: 1px solid transparent;
}

.navbar.scrolled {
  background: var(--bg-navbar);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--rule);
  padding: 12px 0;
}

.nav-container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--fg);
}

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

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  transition: color var(--t-fast);
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--fg);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
}

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}

.hamburger {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--fg);
  position: relative;
  transition: background var(--t-fast);
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
  width: 22px;
  height: 1.5px;
  background: var(--fg);
  transition: transform var(--t-fast);
}

.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }

.nav-toggle.open .hamburger { background: transparent; }
.nav-toggle.open .hamburger::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open .hamburger::after { transform: translateY(-7px) rotate(-45deg); }

/* ============================================
   Hero
   ============================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 140px 0 100px;
  background: var(--bg);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 20% 10%, rgba(43, 87, 151, 0.10), transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 90%, rgba(14, 165, 160, 0.06), transparent 60%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 28px;
  letter-spacing: 0.02em;
}

.hero-title {
  font-size: clamp(2rem, 5.4vw, 3.6rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin-bottom: 28px;
  max-width: 22ch;
}

.hero-lede {
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.7;
  color: var(--fg-muted);
  max-width: var(--reading);
  margin-bottom: 40px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 56px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
  border: 1px solid transparent;
  letter-spacing: -0.005em;
}

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

.btn-primary:hover {
  background: #fff;
  border-color: #fff;
  transform: translateY(-1px);
}

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

.btn-ghost:hover {
  border-color: var(--fg-muted);
  background: var(--surface);
}

/* Hero meta */
.hero-meta {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--rule);
  padding-top: 32px;
  max-width: 720px;
}

.hero-meta li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  align-items: baseline;
  font-size: 0.94rem;
}

.meta-key {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
}

.meta-val {
  color: var(--fg-muted);
}

.meta-val a {
  color: var(--fg);
  border-bottom: 1px solid var(--rule-strong);
  transition: border-color var(--t-fast);
}

.meta-val a:hover {
  border-color: var(--accent);
}

/* Hero entrance */
.anim-hero {
  opacity: 0;
  transform: translateY(14px);
}

.anim-hero.visible {
  animation: heroFadeIn 0.7s ease forwards;
}

@keyframes heroFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Engineering Philosophy — principles
   ============================================ */
.principles {
  display: grid;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.principle {
  background: var(--bg);
  padding: 36px 32px;
}

.principle-title {
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--fg);
  margin-bottom: 12px;
}

.principle p {
  color: var(--fg-muted);
  font-size: 0.985rem;
  line-height: 1.75;
  max-width: var(--reading);
}

/* ============================================
   Case studies
   ============================================ */
.case {
  padding: 56px 0;
  border-top: 1px solid var(--rule);
}

.case:first-of-type {
  border-top: none;
  padding-top: 0;
}

.case-head {
  margin-bottom: 36px;
}

.case-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.case-title {
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 8px;
}

.case-role {
  font-size: 0.92rem;
  color: var(--fg-dim);
}

.case-role a {
  color: var(--fg-muted);
  border-bottom: 1px solid var(--rule-strong);
}

.case-role a:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.case-body {
  display: grid;
  gap: 0;
}

.case-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  align-items: baseline;
}

.case-row dt {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--fg-dim);
  text-transform: lowercase;
  padding-top: 2px;
}

.case-row dd {
  color: var(--fg-muted);
  font-size: 0.985rem;
  line-height: 1.75;
  max-width: var(--reading);
}

.case-row dd strong {
  color: var(--fg);
  font-weight: 600;
}

.case-row ul {
  display: grid;
  gap: 12px;
  padding-left: 0;
}

.case-row ul li {
  position: relative;
  padding-left: 22px;
}

.case-row ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 10px;
  height: 1px;
  background: var(--accent);
}

/* Tech tags */
.tech-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--fg-muted);
  padding: 3px 9px;
  margin: 0 6px 6px 0;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  letter-spacing: 0.01em;
}

/* ============================================
   Experience timeline
   ============================================ */
.timeline {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--rule);
}

.t-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  padding: 32px 0;
  border-bottom: 1px solid var(--rule);
}

.t-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.t-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--fg);
  letter-spacing: 0.01em;
}

.t-loc {
  font-size: 0.8rem;
  color: var(--fg-dim);
}

.t-role {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--fg);
  margin-bottom: 4px;
}

.t-company {
  font-size: 0.92rem;
  color: var(--accent);
  margin-bottom: 14px;
}

.t-company a {
  color: inherit;
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast);
}

.t-company a:hover {
  border-bottom-color: var(--accent);
}

.t-summary {
  color: var(--fg-muted);
  font-size: 0.98rem;
  line-height: 1.7;
  max-width: var(--reading);
}

/* ============================================
   Expertise grid
   ============================================ */
.expertise-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.expertise {
  background: var(--bg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.expertise-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--fg);
}

.expertise-body {
  color: var(--fg-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  flex-grow: 1;
}

.expertise-tech {
  display: flex;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Credentials */
.credentials {
  margin-top: 48px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.credentials > summary {
  padding: 18px 24px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--fg-muted);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: color var(--t-fast);
}

.credentials > summary::-webkit-details-marker { display: none; }

.credentials > summary::after {
  content: '+';
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--fg-dim);
  transition: transform var(--t-base);
}

.credentials[open] > summary::after {
  transform: rotate(45deg);
}

.credentials > summary:hover {
  color: var(--fg);
}

.credentials-grid {
  padding: 8px 24px 24px;
  display: grid;
  gap: 18px;
  border-top: 1px solid var(--rule);
}

.cred {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  align-items: baseline;
  padding-top: 12px;
}

.cred-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
}

.cred-value {
  color: var(--fg-muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.cred-value a {
  color: var(--fg);
  border-bottom: 1px solid var(--rule-strong);
}

.cred-value a:hover {
  border-color: var(--accent);
}

/* ============================================
   Writing
   ============================================ */
.writing-list {
  display: grid;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.writing-item {
  background: var(--bg-alt);
  padding: 28px 32px;
  transition: background var(--t-fast);
}

.writing-item.upcoming {
  opacity: 0.85;
}

.writing-tag {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--fg-dim);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.writing-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--fg);
  margin-bottom: 6px;
}

.writing-summary {
  color: var(--fg-muted);
  font-size: 0.94rem;
  line-height: 1.65;
  max-width: var(--reading);
}

/* ============================================
   Contact
   ============================================ */
.contact-wrap .section-head {
  margin-bottom: 48px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 760px;
}

.contact-item {
  background: var(--bg);
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background var(--t-fast);
}

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

.contact-key {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
}

.contact-val {
  font-size: 0.98rem;
  color: var(--fg);
}

/* ============================================
   Footer
   ============================================ */
.footer {
  padding: 36px 0;
  border-top: 1px solid var(--rule);
  background: var(--bg);
}

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

.footer p {
  font-size: 0.84rem;
  color: var(--fg-dim);
}

.footer-note {
  font-family: var(--font-mono);
  font-size: 0.78rem !important;
}

/* ============================================
   Reveal on scroll
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
  .expertise-grid {
    grid-template-columns: 1fr;
  }

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

  .case-row,
  .t-item,
  .cred,
  .hero-meta li {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .case-row dt,
  .meta-key,
  .cred-label {
    margin-bottom: 4px;
  }
}

@media (max-width: 768px) {
  body { font-size: 16px; }

  .nav-toggle { display: block; }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-alt);
    flex-direction: column;
    padding: 88px 32px 32px;
    gap: 24px;
    transition: right var(--t-base);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
    border-left: 1px solid var(--rule);
  }

  .nav-links.open { right: 0; }

  .section { padding: 80px 0; }

  .hero {
    padding: 120px 0 80px;
  }

  .case { padding: 40px 0; }

  .principle {
    padding: 28px 24px;
  }

  .expertise {
    padding: 24px;
  }
}

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

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    justify-content: center;
  }

  .credentials > summary {
    padding: 16px 18px;
  }

  .credentials-grid {
    padding: 8px 18px 20px;
  }
}
