/* ---------- Tokens ---------- */
@font-face {
  font-family: "Josefin Sans";
  src: url("../Fonts/JosefinSans-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 700;
  font-display: swap;
}
@font-face {
  font-family: "Judson";
  src: url("../Fonts/Judson-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Judson";
  src: url("../Fonts/Judson-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #000000;
  --paper: #ffffff;
  --mist: #f1f5f4;
  --line: #d9e1df;
  --slate: #4b5654;
  --teal: #0a7d74;
  --turquoise: #40e0d0;

  --serif: "Judson", Georgia, "Times New Roman", serif;
  --sans: "Josefin Sans", "Segoe UI", system-ui, sans-serif;

  --step--1: 0.9rem;
  --step-0: 1.125rem;
  --step-1: 1.35rem;
  --step-2: 1.8rem;
  --step-3: 2.4rem;
  --step-4: clamp(2.6rem, 6vw, 4.4rem);

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius-pill: 18px;
  --radius-panel: 12px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 110px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--turquoise); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.12; margin: 0; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }
.prose { max-width: 66ch; }
.muted { color: var(--slate); }
.skip {
  position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper);
  padding: 10px 14px; border-radius: 8px; z-index: 100;
}
.skip:focus { left: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--sans); font-size: 1.05rem; font-weight: 600;
  padding: 14px 22px 11px; border-radius: 12px; text-decoration: none;
  border: 2px solid var(--ink); cursor: pointer; line-height: 1.2;
}
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--teal); border-color: var(--teal); color: var(--paper); }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--paper); }
.btn svg { width: 18px; height: 18px; margin-top: -3px; }

/* ---------- Navigation (the black pill from the original site) ---------- */
.topbar { position: sticky; top: 0; z-index: 50; padding: 14px var(--gutter) 0; }
.nav {
  max-width: 900px; margin-inline: auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--ink); color: var(--paper);
  border-radius: var(--radius-pill); padding: 10px 10px 10px 24px;
  box-shadow: 4px 3px 0 rgba(0, 0, 0, 0.18);
}
.nav .brand {
  color: var(--paper); text-decoration: none; font-size: 1.25rem; font-weight: 600;
  padding-top: 4px; margin-right: auto; white-space: nowrap;
}
.nav .brand span { color: var(--turquoise); }
.nav-links { display: flex; gap: 4px; list-style: none; }
.nav-links a {
  color: var(--paper); text-decoration: none; padding: 10px 14px 7px; border-radius: 10px; display: block;
}
.nav-links a:hover, .nav-links a[aria-current] { background: #262626; color: var(--turquoise); }
.nav .cv {
  background: var(--paper); color: var(--ink); text-decoration: none; font-weight: 600;
  padding: 10px 16px 7px; border-radius: 10px; white-space: nowrap;
}
.nav .cv:hover { background: var(--turquoise); }
.nav-extra { display: none; }
.menu-btn {
  display: none; background: transparent; color: var(--paper); border: 1.5px solid #555;
  border-radius: 10px; font: inherit; padding: 8px 12px 5px; cursor: pointer;
}
@media (max-width: 760px) {
  .menu-btn { display: block; }
  .nav { flex-wrap: wrap; padding-left: 18px; }
  .nav-links { display: none; order: 3; width: 100%; flex-direction: column; padding: 6px 0 4px; }
  .nav.open .nav-links { display: flex; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(48px, 9vw, 96px) 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: end; }
.hero .intro { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; color: var(--slate); }
.hero .intro img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; object-position: top; background: var(--mist); }
.hero h1 { font-size: var(--step-4); max-width: 19ch; letter-spacing: -0.01em; }
.hero .lede { font-size: var(--step-1); max-width: 40ch; margin: 22px 0 30px; color: var(--slate); line-height: 1.5; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero .facts { list-style: none; border-left: 3px solid var(--turquoise); padding-left: 18px; min-width: 220px; }
.hero .facts li { padding: 6px 0; font-size: var(--step--1); color: var(--slate); }
.hero .facts strong { display: block; color: var(--ink); font-size: 1.05rem; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }

/* ---------- Delivery pipeline (the signature element) ---------- */
.pipeline { background: var(--ink); color: var(--paper); border-radius: var(--radius-panel); padding: 30px clamp(20px, 4vw, 40px) 34px; margin-top: 28px; }
.pipeline h2 { font-size: var(--step-1); font-weight: 400; color: #cfd8d6; margin-bottom: 26px; }
.pipeline ol { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; position: relative; }
.pipeline ol::before {
  content: ""; position: absolute; left: 0; right: 0; top: 11px; height: 2px; background: #333;
}
.pipeline ol::after {
  content: ""; position: absolute; left: 0; top: 11px; height: 2px; width: 100%; background: var(--turquoise);
  transform-origin: left; animation: run 1.6s 0.3s cubic-bezier(.6,.1,.2,1) both;
}
.pipeline li { position: relative; padding: 36px 18px 0 0; }
.pipeline li::before {
  content: ""; position: absolute; top: 4px; left: 0; width: 16px; height: 16px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--turquoise); z-index: 1;
}
.pipeline .stage { font-family: var(--serif); font-size: var(--step-1); font-weight: 700; display: block; margin-bottom: 6px; }
.pipeline .proof { font-size: var(--step--1); color: #c3cdcb; line-height: 1.45; }
@keyframes run { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (max-width: 860px) {
  .pipeline ol { grid-template-columns: 1fr; }
  .pipeline ol::before, .pipeline ol::after { left: 7px; right: auto; top: 0; bottom: 0; width: 2px; height: auto; }
  .pipeline ol::after { transform-origin: top; animation-name: run-v; }
  .pipeline li { padding: 0 0 22px 36px; }
  .pipeline li::before { top: 2px; }
}
@keyframes run-v { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pipeline ol::after { animation: none; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 9vw, 100px) 0; }
.section.alt { background: var(--mist); }
.section-head { margin-bottom: 40px; max-width: 62ch; }
.section-head h2 { font-size: var(--step-3); margin-bottom: 12px; }
.section-head p { color: var(--slate); margin: 0; }

/* ---------- Case studies ---------- */
.cases { display: grid; gap: 22px; }
.case {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 0;
  border: 2px solid var(--ink); border-radius: var(--radius-panel); overflow: hidden; background: var(--paper);
}
.case .body { padding: clamp(22px, 3.5vw, 36px); }
.case .kind { color: var(--teal); font-weight: 600; margin-bottom: 8px; display: block; }
.case h3 { font-size: var(--step-2); margin-bottom: 14px; }
.case h3 a { color: inherit; text-decoration: none; }
.case h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.case .body p { color: var(--slate); }
.case .read { font-weight: 600; }
.case .spec { background: var(--ink); color: var(--paper); padding: clamp(22px, 3.5vw, 36px); }
.case .spec dl { margin: 0; display: grid; gap: 14px; }
.case .spec dt { color: var(--turquoise); font-size: var(--step--1); }
.case .spec dd { margin: 2px 0 0; line-height: 1.45; }
@media (max-width: 820px) { .case { grid-template-columns: 1fr; } }

/* ---------- Experience timeline ---------- */
.timeline { list-style: none; border-top: 2px solid var(--ink); }
.timeline > li { display: grid; grid-template-columns: 210px 1fr; gap: 24px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.timeline .when { color: var(--slate); font-size: var(--step--1); padding-top: 6px; }
.timeline h3 { font-size: var(--step-1); }
.timeline .org { color: var(--teal); font-weight: 600; margin: 4px 0 12px; }
.timeline ul { padding-left: 1.1em; }
.timeline ul li { margin-bottom: 6px; max-width: 70ch; }
@media (max-width: 700px) { .timeline > li { grid-template-columns: 1fr; gap: 6px; } }

/* ---------- Other builds ---------- */
.builds { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.build { display: grid; grid-template-columns: 64px 1fr; gap: 16px; align-items: start; padding: 20px; background: var(--paper); border-radius: var(--radius-panel); border: 1px solid var(--line); }
.build img { width: 64px; height: 64px; object-fit: contain; }
.build h3 { font-size: 1.2rem; margin-bottom: 4px; }
.build p { font-size: var(--step--1); color: var(--slate); margin-bottom: 8px; line-height: 1.5; }
.build .links { display: flex; gap: 14px; font-size: var(--step--1); font-weight: 600; }

/* ---------- Skills ---------- */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px 40px; }
.skills h3 { font-size: 1.2rem; padding-bottom: 8px; border-bottom: 2px solid var(--ink); margin-bottom: 10px; }
.skills p { color: var(--slate); margin: 0; }

/* ---------- Recognition ---------- */
.recognition { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.recognition li { border-top: 3px solid var(--turquoise); padding-top: 12px; }
.recognition strong { display: block; font-family: var(--serif); font-size: 1.2rem; }
.recognition span { color: var(--slate); font-size: var(--step--1); }

/* ---------- Contact ---------- */
.contact { background: var(--ink); color: var(--paper); border-radius: var(--radius-panel); padding: clamp(32px, 6vw, 64px); }
.contact h2 { font-size: var(--step-3); max-width: 22ch; margin-bottom: 16px; }
.contact p { color: #c3cdcb; max-width: 52ch; }
.contact .btn-solid { background: var(--turquoise); border-color: var(--turquoise); color: var(--ink); }
.contact .btn-solid:hover { background: var(--paper); border-color: var(--paper); }
.contact .btn-line { color: var(--paper); border-color: #666; }
.contact .btn-line:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.contact .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.contact a:focus-visible { outline-color: var(--paper); }

/* ---------- Footer ---------- */
footer { padding: 36px 0 48px; color: var(--slate); font-size: var(--step--1); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }

/* ---------- Case study pages ---------- */
.cs-hero { padding: clamp(40px, 8vw, 80px) 0 32px; }
.cs-hero .back { font-weight: 600; display: inline-block; margin-bottom: 24px; }
.cs-hero .kind { color: var(--teal); font-weight: 600; display: block; margin-bottom: 10px; }
.cs-hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); max-width: 20ch; margin-bottom: 18px; }
.cs-hero .lede { font-size: var(--step-1); color: var(--slate); max-width: 52ch; line-height: 1.5; }
.cs-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0; border: 2px solid var(--ink); border-radius: var(--radius-panel); overflow: hidden; margin: 10px 0 8px; }
.cs-meta div { padding: 18px 20px; border-right: 1px solid var(--line); }
.cs-meta div:last-child { border-right: 0; }
.cs-meta dt { color: var(--slate); font-size: var(--step--1); }
.cs-meta dd { margin: 4px 0 0; font-weight: 600; line-height: 1.4; }
.confidential { font-size: var(--step--1); color: var(--slate); margin-top: 12px; }
.cs-body { padding: 24px 0 72px; }
.cs-section { display: grid; grid-template-columns: 240px 1fr; gap: 32px; padding: 36px 0; border-top: 1px solid var(--line); }
.cs-section > h2 { font-size: var(--step-2); }
.cs-section ul { padding-left: 1.1em; }
.cs-section li { margin-bottom: 10px; max-width: 68ch; }
.cs-section h3 { font-size: var(--step-1); margin: 22px 0 8px; }
.cs-section h3:first-child { margin-top: 0; }
@media (max-width: 760px) { .cs-section { grid-template-columns: 1fr; gap: 12px; } }
.diagram { background: var(--mist); border-radius: var(--radius-panel); padding: 18px; margin: 6px 0 18px; }
.diagram svg { width: 100%; height: auto; display: block; }
.status { list-style: none; padding: 0 !important; }
.status li { padding-left: 28px; position: relative; }
.status li::before { content: ""; position: absolute; left: 0; top: 7px; width: 14px; height: 14px; border-radius: 50%; }
.status .done::before { background: var(--teal); }
.status .open::before { border: 2px solid var(--slate); }
.next-case { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; border-top: 2px solid var(--ink); padding-top: 28px; }
.next-case a { font-family: var(--serif); font-size: var(--step-1); font-weight: 700; }
@media (max-width: 700px) {
  .diagram { overflow-x: auto; }
  .diagram svg { min-width: 640px; }
}
.cs-section > * { min-width: 0; }

/* ---------- Large screens: the panel's space is reserved, and the bar hands over to it as you scroll ---------- */
.rail-panel { display: none; }
@media (min-width: 1024px) {
  :root { --rail: 248px; --p: 0; }
  html { scroll-padding-top: 32px; }
  body { padding-left: var(--rail); }

  /* Top bar: lifts and fades away as --p goes from 0 to 1 */
  .topbar {
    transform: translateY(calc(var(--p) * -110%));
    opacity: calc(1 - var(--p) * 1.25);
    will-change: transform, opacity;
  }

  /* Left panel: slides in from the left as --p goes from 0 to 1 */
  .rail-panel {
    display: block; position: fixed; z-index: 60; top: 0; left: 0; bottom: 0; width: var(--rail);
    padding: 16px 0 16px 16px;
    transform: translateX(calc((var(--p) - 1) * 105%));
    opacity: calc(var(--p) * 1.25);
    will-change: transform, opacity;
  }
  .rail-panel .nav {
    flex-direction: column; align-items: stretch; gap: 0;
    height: 100%; max-width: none; margin: 0;
    padding: 28px 14px 20px; overflow-y: auto;
  }
  .rail-panel .nav .brand { margin: 0 0 28px 12px; font-size: 1.4rem; white-space: normal; }
  .rail-panel .nav-links { display: flex; flex-direction: column; gap: 2px; width: auto; order: 0; padding: 0; }
  .rail-panel .nav-links a { padding: 11px 12px 8px; }
  .rail-panel .nav .cv { margin-top: 20px; text-align: center; padding: 12px 16px 9px; }
  .rail-panel .nav-extra { display: block; margin-top: auto; padding: 22px 12px 0; border-top: 1px solid #2c2c2c; }
  .nav-extra p { color: #aab5b3; font-size: var(--step--1); line-height: 1.5; margin-bottom: 12px; }
  .nav-extra ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; }
  .nav-extra a { color: var(--turquoise); font-size: var(--step--1); font-weight: 600; }
  .nav-extra a:hover { color: var(--paper); }
}

/* ---------- Phones and tablets: the bar tucks away while scrolling down, returns on scroll up ---------- */
@media (max-width: 1023px) {
  .topbar { transition: transform 0.3s cubic-bezier(.2,.8,.2,1); will-change: transform; }
  body.bar-hidden .topbar { transform: translateY(calc(-100% - 10px)); }
}
@media (max-width: 1023px) and (prefers-reduced-motion: reduce) {
  .topbar { transition: none; }
}
