/* ---------- Colors & basics ---------- */
:root {
  --bg: #ffffff;
  --surface: #f6f6f4;
  --text: #161616;
  --muted: #6b6b6b;
  --line: #e4e4e0;
  --accent: #2346d8;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --date-col: 220px;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --surface: #1b1b1b;
    --text: #ededeb;
    --muted: #9a9a96;
    --line: #2c2c2a;
    --accent: #8ea6ff;
  }
}

* { box-sizing: border-box; }

html { scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 3px; }

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

.screen {
  max-width: 1040px;
  margin: 0 auto;
  padding: 120px 32px 96px;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.topbar-name {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.topbar-links { display: flex; gap: 24px; margin-left: auto; }

/* The view switch at the far right: </> opens this page on the terminal site, the monitor is this site */
.view-toggle { display: flex; align-items: center; gap: 2px; margin-left: 20px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.view-toggle a, .view-toggle span { display: grid; place-items: center; padding: 4px 10px; border-radius: 999px; color: var(--muted); }
.view-toggle a:hover { color: var(--text); }
.view-toggle [aria-current] { background: var(--text); color: var(--bg); }
.view-toggle svg { display: block; width: 17px; height: 17px; }

.topbar-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
}

.topbar-links a:hover { color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

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

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

/* ---------- Timeline ---------- */
/* One section per company. Its name, title and dates stick to the left
   while you scroll through its projects on the right. */
.timeline { position: relative; }

/* The vertical line, just right of the company column */
.timeline::before {
  content: "";
  position: absolute;
  left: var(--date-col);
  top: 10px;
  bottom: 0;
  width: 1px;
  background: var(--muted); opacity: 0.35;
}

.company {
  display: grid;
  grid-template-columns: var(--date-col) minmax(0, 1fr);
  padding-bottom: 104px;
}

.company-head {
  position: sticky;
  top: calc(var(--topbar-h, 64px) + 32px);
  align-self: start;
  padding-right: 28px;
  text-align: right;
}

.company-name { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: -0.015em; }
.company-title { margin: 6px 0 0; font-size: 15px; line-height: 1.4; }
.company-dates { margin: 4px 0 0; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.company-body { position: relative; padding-left: 40px; min-width: 0; }
.company-body > .story { margin-top: 0; }

/* Each project is one moment: a dot on the line, a title, and one line about it */
.moments { list-style: none; margin: 0; padding: 0; display: grid; gap: 56px; }
.moment { position: relative; }

.moment::before,
.company-body:not(:has(.moments))::before {
  content: "";
  position: absolute;
  left: -44px;
  top: 13px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--text);
}

.company-body:not(:has(.moments))::before { left: -4px; top: 9px; }
.moment.pending::before { border-color: var(--muted); }

.moment-link { display: block; color: var(--text); text-decoration: none; }

.moment-title {
  margin: 0;
  max-width: 28ch;
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.moment-arrow { display: inline-block; color: var(--accent); font-weight: 500; transition: transform 0.15s; }
a.moment-link:hover .moment-title { color: var(--accent); }
a.moment-link:hover .moment-arrow { transform: translateX(4px); }

.moment-desc { margin: 10px 0 0; font-size: 17px; }

.moment.pending .moment-title,
.moment.pending .moment-desc { color: var(--muted); }

.moment-soon {
  display: inline-block;
  margin: 12px 0 0;
  padding: 2px 10px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
}

.early-jobs { list-style: none; margin: 0; padding: 0; }
.early-jobs li + li { margin-top: 8px; }
.early-jobs .muted { color: var(--muted); }

/* ---------- Story strip (horizontal scroll) ---------- */
.story { margin-top: 36px; }

.story-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.story-title { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }

.story-intro { margin: 4px 0 0; color: var(--muted); font-size: 15px; max-width: 60ch; }

.row-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.row-arrow {
  width: 34px;
  height: 34px;
  padding: 0;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}

.row-arrow:hover:not(:disabled) { border-color: var(--text); }
.row-arrow:disabled { opacity: 0.3; cursor: default; }

.story-track {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 2px 2px 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  /* fade the right edge so the next step visibly peeks in */
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
  mask-image: linear-gradient(90deg, #000 88%, transparent);
}

.story-track::-webkit-scrollbar { display: none; }
.story-track.at-end { -webkit-mask-image: none; mask-image: none; }

.story-item {
  position: relative;
  flex: 0 0 280px;
  padding-right: 16px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}

/* The line that joins one step's marker to the next */
.story-item::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 28px;
  right: 0;
  height: 1px;
  background: var(--line);
}

.story-item:last-child::before { display: none; }

.step-marker {
  position: relative;
  width: 28px;
  height: 28px;
  margin-bottom: 14px;
  border-radius: 50%;
  border: 1px solid var(--text);
  background: var(--bg);
  font-size: 13px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.step:hover { border-color: var(--line); transform: translateY(-2px); }
a.step { text-decoration: none; }
div.step { cursor: default; }
div.step:hover { transform: none; }

/* Preview image across the top of a step card */
.step-thumb {
  display: block;
  margin: -18px -20px 10px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.step-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: left top; display: block; }

.step-text { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.step-label { font-size: 13px; color: var(--muted); }

.step-title { margin: 0; font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }

.step-caption { margin: 0; flex: 1; color: var(--muted); font-size: 14px; line-height: 1.5; }

.step-open { margin-top: 6px; font-size: 14px; font-weight: 500; color: var(--accent); }

.step.pending { background: transparent; border: 1px dashed var(--line); }
.step.pending .step-open { color: var(--muted); font-weight: 400; }
.story-item:has(.pending) .step-marker { border-style: dashed; color: var(--muted); border-color: var(--muted); }

/* ---------- Plain sections ---------- */
.block { margin: 0 0 64px calc(var(--date-col) + 40px); max-width: 64ch; }
.block-title { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 8px; }
.block p { margin: 0 0 16px; }

/* ---------- Project page media (videos, documents, word lists, images) ---------- */
.embed {
  position: relative;
  aspect-ratio: 16 / 10;
  margin: 20px 0;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}

.embed.doc { aspect-ratio: 4 / 5; max-height: 70vh; width: 100%; background: var(--surface); }

.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.word-list {
  columns: 3 150px;
  column-gap: 20px;
  margin: 20px 0;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--muted);
}

.word-list span { display: block; text-decoration: line-through; }

.project-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 20px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.notice { margin: 20px 0; color: var(--muted); font-style: italic; }

.buttons { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Phones ---------- */
@media (max-width: 720px) {
  :root { --date-col: 0px; }
  .screen { padding: 96px 20px 64px; }
  .topbar { padding: 14px 20px; }
  .timeline::before { left: 4px; }

  /* The company label becomes a bar that sticks under the top bar */
  .company { display: block; padding: 0 0 64px 28px; }
  .company-head {
    top: var(--topbar-h, 56px);
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 10px;
    margin: 0 -20px 16px -48px;
    padding: 10px 20px 10px 48px;
    text-align: left;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  .company-name { font-size: 17px; }
  .company-dates { margin: 0; }
  .company-title { order: 3; flex-basis: 100%; margin: 2px 0 0; font-size: 14px; color: var(--muted); }
  .company-body { padding-left: 0; }
  .moments { gap: 40px; }
  .moment::before { left: -28px; top: 10px; }
  .company-body:not(:has(.moments))::before { left: -28px; }

  .block { margin-left: 0; }
  .story-item { flex-basis: 82%; }
  .story-head { align-items: flex-start; }

}

@media (prefers-reduced-motion: reduce) {
  .step, .btn, .moment-arrow { transition: none; }
  .step:hover { transform: none; }
}

/* ---------- Blog ---------- */
.topbar-links a[aria-current="page"] { color: var(--text); }

.page-head { max-width: 64ch; margin-bottom: 56px; }

.page-title {
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 600;
  margin: 0;
}

.post-list { list-style: none; margin: 0; padding: 0; max-width: 64ch; }

.post-item { padding: 28px 0; border-top: 1px solid var(--line); }
.post-item:last-child { border-bottom: 1px solid var(--line); }

.post-date { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }

.post-title { margin: 0; font-size: 22px; line-height: 1.3; font-weight: 600; letter-spacing: -0.015em; }
.post-title a { color: var(--text); text-decoration: none; }
.post-title a:hover { color: var(--accent); }

.post-summary { margin: 8px 0 0; color: var(--muted); }

.post-empty { color: var(--muted); font-style: italic; }

/* A single post */
.post { max-width: 64ch; font-size: 17px; }
.post .page-title { margin-bottom: 32px; }
.post h2 { font-size: 22px; letter-spacing: -0.015em; margin: 40px 0 8px; }
.post p { margin: 0 0 18px; }
.post-back { display: inline-block; margin-bottom: 32px; font-size: 15px; color: var(--muted); text-decoration: none; }
.post-back:hover { color: var(--text); }

/* ---------- Project pages (/portfolio/...) ---------- */
.case { max-width: 68ch; }
.case .stage-label { margin-bottom: 10px; }
.case .page-title { margin-bottom: 20px; }
.dek { font-size: 20px; line-height: 1.5; color: var(--text); margin: 0 0 40px; }

.case .stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin: 0 0 32px; padding: 0; list-style: none;
}
.case .stats li { margin: 0; background: var(--surface); border-radius: var(--radius); padding: 18px 20px; }
.stat-num { display: block; font-size: 34px; line-height: 1.1; font-weight: 600; letter-spacing: -0.03em; }
.stat-label { display: block; margin-top: 6px; font-size: 14px; line-height: 1.4; color: var(--muted); }

.glance {
  display: grid; grid-template-columns: 90px 1fr; gap: 10px 20px;
  margin: 0 0 56px; padding: 20px 0; font-size: 15px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.glance dt { color: var(--muted); }
.glance dd { margin: 0; }

.case h2 { margin-top: 56px; }
.case ul { padding-left: 20px; margin: 0 0 18px; }
.case li + li { margin-top: 8px; }
.case li::marker { color: var(--muted); }

.case figure { margin: 24px 0 32px; }
.case figure img {
  display: block; width: 100%; height: auto; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.case figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); }

.pull {
  margin: 28px 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent);
  font-size: 22px; line-height: 1.4; font-weight: 500; letter-spacing: -0.01em;
}

.table-wrap { overflow-x: auto; margin: 24px 0 28px; }
.case table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.case th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; padding: 0 16px 10px 0; border-bottom: 1px solid var(--text); }
.case td { vertical-align: top; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--line); }
.case td, .case th { font-variant-numeric: tabular-nums; }

/* Markdown pieces on project pages: a > quote becomes a pull quote, images fill the column */
.case blockquote {
  margin: 28px 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent);
  font-size: 22px; line-height: 1.4; font-weight: 500; letter-spacing: -0.01em;
}
.case blockquote p { margin: 0; }
.case img {
  display: block; width: 100%; height: auto; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.case p:has(> img) { margin: 24px 0 8px; }
.case img.bare { background: none; border: 0; border-radius: 0; }
.case .stats + .glance, .case .dek + .glance { margin-top: 0; }

.placeholder {
  margin: 20px 0 28px; padding: 18px 20px; border: 1px dashed var(--muted);
  border-radius: var(--radius); color: var(--muted); font-size: 15px;
}
.placeholder strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }

@media (max-width: 720px) {
  .case .stats { grid-template-columns: 1fr; }
  .glance { grid-template-columns: 1fr; gap: 2px; }
  .glance dd { margin-bottom: 10px; }
  .dek { font-size: 18px; }
  .pull, .case blockquote { font-size: 19px; }
}

/* ---------- Resume ---------- */
.resume { max-width: 68ch; }
.resume .page-title { margin-bottom: 20px; }
.resume-summary { font-size: 19px; line-height: 1.55; margin: 0 0 56px; }

.resume-section { margin-bottom: 56px; }
.resume-heading {
  margin: 0 0 28px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.role { margin-bottom: 36px; }
.role-head {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 24px;
  margin-bottom: 8px;
}
.role-title { grid-column: 1; margin: 0; font-size: 18px; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; }
.role-org { grid-column: 1; margin: 2px 0 0; color: var(--muted); }
.role-dates {
  grid-column: 2; grid-row: 1;
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.role > p { margin: 0 0 10px; }
.role-points { margin: 0; padding-left: 20px; }
.role-points li + li { margin-top: 8px; }
.role-points li::marker { color: var(--muted); }

@media (max-width: 720px) {
  .role-head { grid-template-columns: 1fr; }
  .role-dates { grid-column: 1; grid-row: auto; margin-top: 2px; }
  .resume-summary { font-size: 17px; }
}

/* ---------- Small phones: the name sits above the menu so all four links fit ---------- */
@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; row-gap: 4px; }
  .topbar .view-toggle { order: 1; margin-left: auto; }
  .topbar-links { order: 2; width: 100%; gap: 20px; margin-left: 0; }
  .screen { padding-top: 112px; }
}

/* ---------- Story project pages: one section per timeline card ---------- */
.project-step { margin-top: 56px; scroll-margin-top: 32px; } /* plus the 72px above = clears the menu */
.project-step .stage-label { margin-bottom: 4px; }
.case .project-step h2 { margin-top: 0; }
.project-step .buttons { margin-top: 20px; }

/* ---------- Number tables in Markdown: put {: .metrics} on the line under the table ---------- */
.case table.metrics { table-layout: fixed; }
.case table.metrics th, .case table.metrics td { width: 20%; padding-left: 12px; padding-right: 0; }
.case table.metrics th:first-child, .case table.metrics td:first-child { padding-left: 0; }
.case table.metrics th { vertical-align: bottom; line-height: 1.3; }
