/* ===== Design tokens ===== */
:root {
  --paper: #F4F5F1;
  --paper-alt: #ECEEE9;
  --ink: #171D24;
  --ink-soft: #4B535B;
  --blue: #1F4E79;
  --blue-light: #6C93B5;
  --amber: #C97A2B;
  --grid: #D8DCD9;
  --line: #C7CCC6;
  --radius: 2px;
  --max-width: 1180px;
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --shadow-soft: 0 12px 28px rgba(23, 29, 36, 0.06);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(circle at 78% 10%, rgba(108, 147, 181, 0.12), transparent 28rem);
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

/* Faint engineering grid backdrop */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.22;
  pointer-events: none;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 245, 241, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 24px;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
}

.main-nav {
  display: flex;
  gap: 28px;
  font-size: 14.5px;
}

.main-nav a {
  color: var(--ink-soft);
  transition: color 0.15s ease;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: var(--blue);
}

.lang-toggle {
  font-family: var(--font-mono);
  font-size: 13px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px 10px;
  cursor: pointer;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 4px;
}

.lang-toggle:hover { border-color: var(--blue); }

.lang-opt { opacity: 0.5; }
.lang-opt.is-active { opacity: 1; color: var(--blue); font-weight: 500; }
.lang-sep { opacity: 0.35; }

/* Keyboard focus visibility */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ===== Hero ===== */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 80px;
  align-items: center;
  padding-top: 88px;
  padding-bottom: 88px;
}

.eyebrow-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 20px;
}

.eyebrow-tag .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}

.hero h1 {
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.05em;
  max-width: 15ch;
}

.hero h1 .highlight {
  color: var(--blue);
}

.hero-sub {
  margin: 20px 0 0;
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: 17px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14.5px;
  padding: 12px 20px;
  border-radius: var(--radius);
  display: inline-block;
  border: 1px solid transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.btn-primary {
  background: var(--blue);
  color: var(--paper);
  box-shadow: 4px 4px 0 var(--amber);
}

.btn-primary:hover {
  background: #17405f;
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--amber);
}

.btn-ghost {
  border-color: var(--line);
  color: var(--ink);
}

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

.btn-text {
  padding: 12px 4px;
  color: var(--ink-soft);
}

.btn-text:hover { color: var(--blue); }

.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 42px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Portrait */
.hero-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.portrait-frame {
  position: relative;
  width: 260px;
  height: 300px;
  border: 1px solid var(--line);
  background: var(--paper-alt);
  box-shadow: var(--shadow-soft);
}

.portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(18%) contrast(1.04);
}

.portrait-placeholder {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--paper-alt);
  color: var(--ink-soft);
  padding: 20px;
  text-align: center;
}

.portrait-placeholder svg {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: var(--blue-light);
  stroke-width: 2.5;
}

.portrait-placeholder span {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
}

.portrait-missing .portrait-img { display: none; }
.portrait-missing .portrait-placeholder { display: flex; }

.corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1.4px solid var(--blue);
}

.corner-tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.corner-tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.corner-bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.corner-br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.portrait-caption {
  color: var(--ink-soft);
}

/* About layout */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 40px;
}

.about-grid .about-lead {
  margin: 0;
}

/* Hero diagram (now used inside About) */
.hero-diagram {
  display: flex;
  justify-content: center;
}

.pipeline-svg {
  width: 100%;
  max-width: 380px;
  height: auto;
}

.pipeline-svg .diagram-label {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--ink-soft);
  letter-spacing: 0.04em;
}

.pipeline-svg rect {
  fill: var(--paper);
  stroke: var(--blue);
  stroke-width: 1.4;
}

.pipeline-svg .node-final rect {
  fill: var(--blue);
}

.pipeline-svg .node-final text {
  fill: var(--paper);
}

.pipeline-svg .node-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  fill: var(--ink);
}

.pipeline-svg .node-final .node-title {
  fill: var(--paper);
}

.pipeline-svg .node-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--ink-soft);
}

.pipeline-svg .node-final .node-sub {
  fill: var(--blue-light);
}

.pipeline-svg .flow-line {
  stroke: var(--blue-light);
  stroke-width: 1.4;
  fill: none;
}

.pipeline-svg .arrowhead {
  fill: var(--blue-light);
}

.pipeline-svg .node {
  opacity: 0;
  animation: fadeInNode 0.5s ease forwards;
}

.pipeline-svg .n1 { animation-delay: 0.05s; }
.pipeline-svg .n2 { animation-delay: 0.25s; }
.pipeline-svg .n3 { animation-delay: 0.45s; }
.pipeline-svg .n4 { animation-delay: 0.65s; }
.pipeline-svg .flow-line, .pipeline-svg .arrowhead {
  opacity: 0;
  animation: fadeInNode 0.4s ease forwards;
  animation-delay: 0.2s;
}

@keyframes fadeInNode {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .pipeline-svg .node,
  .pipeline-svg .flow-line,
  .pipeline-svg .arrowhead {
    opacity: 1;
    animation: none;
  }
}

/* ===== Section shared ===== */
section {
  padding: 72px 0;
  border-top: 1px solid var(--line);
}

.about,
.services {
  background: rgba(236, 238, 233, 0.45);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 32px;
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--blue-light);
}

.section-head h2 {
  font-size: 26px;
}

/* ===== About ===== */
.about-lead {
  max-width: 62ch;
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0 0 40px;
}

.capability-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.capability h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.capability p {
  color: var(--ink-soft);
  font-size: 14.5px;
  margin: 0;
}

/* ===== Projects ===== */
.project-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 20px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.project-row:first-of-type { padding-top: 0; }
.project-row:last-of-type { border-bottom: none; }

.project-row:hover {
  background: rgba(255, 255, 255, 0.45);
  border-color: var(--blue-light);
  transform: translateX(6px);
}

.project-id {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--blue);
  padding-top: 4px;
}

.project-body h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.project-body p {
  color: var(--ink-soft);
  font-size: 15px;
  max-width: 60ch;
  margin: 0 0 16px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px 9px;
}

/* ===== Services ===== */
.service-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 36px;
}

.service {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--paper-alt);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.service:hover {
  border-color: var(--blue-light);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(23, 29, 36, 0.06);
}

.service h3 {
  font-size: 15.5px;
  margin-bottom: 10px;
}

.service p {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
}

.services-note {
  color: var(--ink-soft);
  font-size: 14.5px;
  max-width: 56ch;
}

/* ===== Contact ===== */
.contact-lead {
  font-size: 18px;
  max-width: 40ch;
  margin: 0 0 32px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 4px;
  border-bottom: 1px solid var(--line);
  transition: color 0.15s ease, transform 0.15s ease;
}

.contact-link:first-child { border-top: 1px solid var(--line); }

.contact-link:hover {
  color: var(--blue);
  transform: translateX(4px);
}

.contact-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
}

.contact-value {
  font-size: 16px;
  font-weight: 500;
}

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

.footer-inner {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
}

.footer-mono {
  font-family: var(--font-mono);
}

/* ===== Responsive ===== */
@media (max-width: 780px) {
  .capability-list,
  .service-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .header-inner {
    flex-wrap: wrap;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .main-nav {
    display: flex;
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    font-size: 13px;
  }

  .lang-toggle {
    margin-left: auto;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-top: 56px;
    padding-bottom: 56px;
  }

  .hero-portrait { order: -1; }

  .portrait-frame {
    width: 180px;
    height: 210px;
  }

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

  .pipeline-svg { max-width: 300px; }

  section { padding: 52px 0; }

  .project-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .project-row:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-row,
  .service,
  .contact-link,
  .btn {
    transition: none;
  }

  .project-row:hover,
  .service:hover,
  .contact-link:hover,
  .btn-primary:hover {
    transform: none;
    box-shadow: none;
  }
}

