/* ==========================================================================
   ognjenzekovic.com: the whole site's styles, in one file.

   1. Fonts           6. Hero              11. Project pages
   2. Colours, sizes  7. Selected work     12. Contact and footer
   3. Base            8. Diagrams          13. Small screens
   4. Layout          9. Experience        14. Print
   5. Header         10. About
   ========================================================================== */


/* 1. Fonts ---------------------------------------------------------------
   Self-hosted, so the page makes no requests to other servers.
   Each font is split in two files: "latin" (English) and "latin-ext"
   (letters like ć). The browser only downloads a file when the page
   uses a character from its unicode-range. */

@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist";
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist";
  src: url("/fonts/geist-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}


/* 2. Colours and sizes ---------------------------------------------------
   Custom properties: change a value here and it changes everywhere.
   The accent is the same blue as the CV (#2B4590), so the two feel
   like one set. Dark mode swaps the values when the visitor's system
   is set to dark; there is no toggle. */

:root {
  color-scheme: light dark;

  --bg: #f5f3ee;          /* page */
  --panel: #ebe8df;       /* behind diagrams and photos */
  --card: #fbfaf7;        /* boxes inside diagrams */
  --ink: #14161b;         /* headings, main text */
  --ink-2: #454a54;       /* body text */
  --ink-3: #62666f;       /* labels, dates */
  --line: #d9d4c8;
  --line-2: #bdb7a8;
  --accent: #2b4590;
  --on-accent: #ffffff;
  --green: #2e7d4f;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  --wrap: 1240px;                   /* widest the content gets */
  --pad: clamp(20px, 5vw, 56px);    /* space at the sides */
  --gap: clamp(48px, 9vw, 128px);   /* space between sections */
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014;
    --panel: #161920;
    --card: #1c2028;
    --ink: #eceae4;
    --ink-2: #b3b7be;
    --ink-3: #8d929b;
    --line: #262a32;
    --line-2: #3a3f49;
    --accent: #a9bcf7;
    --on-accent: #0e1014;
    --green: #6cc48f;
  }
}


/* 3. Base ----------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 88px;   /* so #work etc. don't hide under the sticky header */
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font: 400 1.0625rem/1.65 var(--sans);
  font-synthesis: none;         /* never fake bold or italic */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; height: auto; }

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
p { margin: 0 0 1em; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
figure { margin: 0; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }

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

/* "Skip to content": invisible until a keyboard user tabs onto it. */
.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
}
.skip:focus { top: 16px; }

/* Small uppercase text for dates, places and section labels. */
.label {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* A list of technologies, written as plain text. */
.stack {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}


/* 4. Layout --------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section { padding-top: var(--gap); }

/* Section heading: big serif title, short note on the right. */
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 26rem);
  align-items: end;
  gap: 16px 48px;
  padding-bottom: 28px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 { font-size: clamp(2.5rem, 5.5vw, 4.25rem); }
.section-head p { margin: 0; color: var(--ink-3); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn .icon { width: 18px; height: 18px; }

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}
.arrow-link .icon { width: 16px; height: 16px; transition: transform 0.15s; }
.arrow-link:hover .icon { transform: translate(2px, -2px); }


/* 5. Header --------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 68px;
}
.brand {
  font-family: var(--serif);
  font-size: 1.375rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.9375rem;
  color: var(--ink-2);
  text-decoration: none;
}
.site-nav a:hover { color: var(--ink); background: var(--panel); }
.site-nav .nav-cv {
  margin-left: 8px;
  padding: 8px 16px;
  border: 1px solid var(--line-2);
  color: var(--ink);
}


/* 6. Hero ----------------------------------------------------------------- */

.hero { padding-top: clamp(40px, 8vw, 104px); }

.hero-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--ink);
}
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 22%, transparent);
}

.hero h1 {
  margin: clamp(20px, 3vw, 32px) 0 0;
  font-size: clamp(3.4rem, 12.5vw, 10.5rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  font-weight: 380;
}

.hero-body {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 40px clamp(40px, 6vw, 96px);
  margin-top: clamp(28px, 4vw, 48px);
  padding-top: clamp(28px, 4vw, 40px);
  border-top: 1px solid var(--line-2);
}

.lead {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.6vw, 2.125rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.hero-intro p:not(.lead) { max-width: 38rem; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 12px; margin-top: 32px; }
.actions .arrow-link { margin-left: 12px; }

/* Snapshot: what a recruiter wants to know in five seconds. */
.snapshot { margin: 0; }
.snapshot div {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.snapshot div:first-child { padding-top: 4px; }
.snapshot dt { padding-top: 3px; }
.snapshot dd { margin: 0; color: var(--ink); line-height: 1.4; }
.snapshot dd span { display: block; margin-top: 4px; font-size: 0.875rem; color: var(--ink-3); }


/* 7. Selected work -------------------------------------------------------
   Each project is a card. The title's link is stretched over the whole
   card with ::after, so the card is clickable but a screen reader only
   reads the title as the link. */

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(40px, 5vw, 64px) clamp(24px, 3vw, 40px);
}

.case { position: relative; display: flex; flex-direction: column; gap: 24px; }
.case-wide {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
}
.case-wide .case-text { order: -1; }

.case-visual {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: var(--panel);
  transition: transform 0.25s ease;
}
.case-wide .case-visual { aspect-ratio: 16 / 9; }
.case:hover .case-visual { transform: translateY(-3px); }

.case-text { display: flex; flex-direction: column; gap: 12px; }
.case h3 { font-size: clamp(1.75rem, 2.6vw, 2.25rem); }
.case-wide h3 { font-size: clamp(2rem, 3.4vw, 3rem); }
.case h3 a { text-decoration: none; }
.case h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.case h3 a:focus-visible { outline: none; }
.case h3 a:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 6px; }
.case:hover h3 a { color: var(--accent); }
.case-text > p:not(.label):not(.stack) { margin: 0; max-width: 34rem; }
.case-more { margin-top: 4px; }

/* More projects: a compact list under the cards. */
.more { margin-top: clamp(64px, 8vw, 104px); }
.more > h3 { font-size: clamp(1.75rem, 3vw, 2.5rem); margin-bottom: 8px; }
.more > p { color: var(--ink-3); margin-bottom: 24px; }
.more-list { list-style: none; border-top: 1px solid var(--line); }
.more-list li {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr) minmax(0, 2fr);
  gap: 8px 40px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.more-list h4 { font-size: 1.375rem; margin-bottom: 4px; }
.more-list p { margin: 0; }
.more-list .links { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 0.9375rem; }
.more-list .links a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--ink); }
.more-list .links a:hover { color: var(--accent); }
.more-list .links .icon { width: 14px; height: 14px; }


/* 8. Diagrams --------------------------------------------------------------
   Drawn with HTML, CSS and inline SVG instead of images, so they stay
   sharp, follow the colour scheme and weigh almost nothing. */

.viz {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(20px, 4vw, 44px);
  color: var(--ink);
}
.viz .label { margin-bottom: 16px; }
/* An SVG fills the box and scales to fit it, keeping its shape. */
.viz > svg { flex: 1; min-height: 0; width: 100%; }
.viz-svg { padding: clamp(12px, 2.4vw, 28px); }

/* "fit": the box keeps its shape but grows if the diagram needs more room. */
.case-visual.fit { display: flex; }
.case-visual.fit .viz { position: static; flex: 1; }

/* Flow: steps on a line, left to right (top to bottom on phones). */
/* Each step spans three rows (name, note, label) of a shared grid, so the
   rows line up across steps however long the notes are ("subgrid"). */
.flow { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-rows: repeat(3, auto); gap: 0 12px; }
.flow li { position: relative; padding-top: 30px; display: grid; grid-row: span 3; grid-template-rows: subgrid; }
.flow li::before {           /* the dot */
  content: "";
  position: absolute;
  top: 4px;
  left: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  z-index: 1;
}
.flow li::after {            /* the line to the next dot */
  content: "";
  position: absolute;
  top: 9px;
  left: 12px;
  right: -12px;
  height: 2px;
  background: var(--line-2);
}
.flow li:last-child::after { display: none; }
.flow b { display: block; font-family: var(--serif); font-size: 1.375rem; font-weight: 400; color: var(--ink); line-height: 1.1; }
.flow span { display: block; margin-top: 8px; font-size: 0.875rem; line-height: 1.4; color: var(--ink-2); }
/* flow-v: the same steps, top to bottom. Used inside the text column. */
.flow-v { grid-auto-flow: row; gap: 0; }
.flow-v li { display: block; grid-row: auto; padding: 0 0 22px 30px; }
.flow-v li:last-child { padding-bottom: 0; }
.flow-v li::before { top: 5px; }
.flow-v li::after { top: 17px; bottom: -5px; left: 5px; right: auto; width: 2px; height: auto; }
.flow-v b { font-size: 1.25rem; }
.flow-v span { margin-top: 4px; font-size: 0.9375rem; }
.flow .mine { display: block; font-style: normal; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }

/* Bars: speedups in the Rust project. */
.bars { display: grid; gap: 18px; position: relative; }
.bar { display: grid; gap: 6px; }
.bar-head { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9375rem; color: var(--ink-2); }
.bar-head b { font-family: var(--serif); font-size: 1.5rem; font-weight: 400; color: var(--ink); line-height: 1; }
.bar-track { position: relative; height: 14px; border-radius: 999px; background: color-mix(in srgb, var(--line-2) 55%, transparent); }
.bar-fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--v) / 9 * 100%); border-radius: inherit; background: var(--accent); }
.bar-track::after {          /* where "8 threads = 8x" would be */
  content: "";
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: calc(8 / 9 * 100%);
  border-left: 2px dashed var(--ink-3);
}
.bars-lg { gap: 28px; }
.bars-lg .bar-head { font-size: 1.0625rem; }
.bars-lg .bar-head b { font-size: 2.5rem; }
.bars-lg .bar-track { height: 20px; }
.bars-note { margin: 18px 0 0; font-size: 0.8125rem; color: var(--ink-3); }

/* Boxes: the Claude plugin diagram. */
.skills { display: grid; grid-template-columns: minmax(0, 3fr) auto minmax(0, 2fr); align-items: center; gap: 20px; }
.skills-box { padding: 20px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); }
.skills-box .label { margin-bottom: 12px; }
.skills-box ul { list-style: none; display: grid; gap: 8px; }
.skills-box li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: var(--panel); font-size: 0.9375rem; color: var(--ink); }
.skills-box li::before { content: ""; width: 10px; height: 12px; flex: none; border: 1.5px solid var(--accent); border-radius: 2px; }
.skills-users { list-style: none; display: grid; gap: 10px; }
.skills-users li { padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 0.9375rem; color: var(--ink); text-align: center; }
.skills-arrow { width: 40px; color: var(--ink-3); }

/* Photo with a phone screenshot on top: the variometer. */
.viz-photo { padding: 0; }
.viz-photo .device { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.viz-photo .phone {
  position: absolute;
  right: 6%;
  bottom: -14%;
  width: 30%;
  border-radius: 18px;
  border: 5px solid #111;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

/* SVG diagrams share these classes. */
.svg-box { fill: var(--card); stroke: var(--line-2); stroke-width: 1.25; }
.svg-box-accent { fill: var(--card); stroke: var(--accent); stroke-width: 1.5; }
.svg-zone { fill: none; stroke: var(--line-2); stroke-width: 1.25; stroke-dasharray: 5 5; }
.svg-line { fill: none; stroke: var(--ink-3); stroke-width: 1.5; }
.svg-line-accent { fill: none; stroke: var(--accent); stroke-width: 1.75; }
.svg-title { fill: var(--ink); font: 500 17px var(--sans); }
.svg-sub { fill: var(--ink-3); font: 400 13px var(--mono); letter-spacing: 0.02em; }
.svg-tag { fill: var(--ink-3); font: 400 12.5px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.svg-arrowhead { fill: var(--ink-3); }
.svg-arrowhead-accent { fill: var(--accent); }
.svg-shelf { fill: var(--card); stroke: var(--ink-3); stroke-width: 1.25; stroke-linejoin: round; }
.svg-post { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.svg-post-back { stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.svg-dim { stroke: var(--accent); stroke-width: 1.25; fill: none; }
.svg-dim-text { fill: var(--accent); font: 500 13px var(--mono); }


/* 9. Experience ----------------------------------------------------------- */

.jobs { list-style: none; }
.job {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 12px 48px;
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
}
.job:first-child { padding-top: 0; }
.job h3 { font-size: clamp(1.625rem, 2.6vw, 2.125rem); }
.job .where { margin: 6px 0 16px; color: var(--ink); font-weight: 500; }
.job ul { margin: 16px 0 18px; padding-left: 1.1em; list-style: disc; display: grid; gap: 8px; }
.job li::marker { color: var(--ink-3); }
.job-when { padding-top: 10px; }

.quote {
  margin: clamp(48px, 7vw, 88px) 0 0;
  padding: clamp(28px, 5vw, 56px);
  border-radius: var(--radius);
  background: var(--panel);
}
.quote blockquote { margin: 0; }
.quote blockquote p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.625rem, 3.4vw, 2.75rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  max-width: 30ch;
}
.quote figcaption { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; color: var(--ink-3); font-size: 0.9375rem; }
.quote figcaption b { color: var(--ink); font-weight: 500; }

.subhead { margin-top: clamp(64px, 8vw, 104px); }
.subhead > h3 { font-size: clamp(1.75rem, 3vw, 2.5rem); padding-bottom: 20px; margin-bottom: 36px; border-bottom: 1px solid var(--line); }
.certs { margin-top: 24px; font-size: 0.9375rem; color: var(--ink-3); }


/* 10. About --------------------------------------------------------------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: 40px clamp(40px, 6vw, 96px);
}
.about-text p { max-width: 40rem; }
.about-text .lead { margin-bottom: 0.9em; }

.facts { margin: 0; border-top: 1px solid var(--line); align-self: start; }
.facts div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts dd { margin: 4px 0 0; color: var(--ink); }

.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 3vw, 40px);
  margin-top: clamp(56px, 7vw, 88px);
}
.principle { padding-top: 20px; border-top: 2px solid var(--ink); }
.principle .label { margin-bottom: 14px; }
.principle h3 { font-size: 1.625rem; margin-bottom: 14px; }
.principle p { margin: 0; }


/* 11. Project pages ------------------------------------------------------- */

.back { display: inline-flex; align-items: center; gap: 8px; margin-top: 36px; color: var(--ink-2); text-decoration: none; font-size: 0.9375rem; }
.back .icon { width: 16px; height: 16px; }

.case-head { padding-top: clamp(28px, 5vw, 56px); }
.case-head h1 { margin: 14px 0 22px; font-size: clamp(2.75rem, 8vw, 6.5rem); line-height: 0.96; letter-spacing: -0.03em; max-width: 14ch; }
.case-head .lead { max-width: 36rem; }

/* The big figure under the title. */
.case-hero { margin-top: clamp(32px, 5vw, 56px); }
.case-hero.fig-panel { padding: clamp(24px, 4vw, 52px); }
.case-hero > figcaption.label { margin-bottom: 24px; }
.case-hero > figcaption:not(.label) { margin-top: 20px; font-size: 0.875rem; color: var(--ink-3); text-align: center; }
.case-hero .skills { max-width: 900px; margin-inline: auto; }
.case-hero .bars { max-width: 860px; }

/* Photo and phone side by side. The column widths follow the two
   images' proportions, so both come out the same height. */
.pair { display: grid; grid-template-columns: 887fr 450fr; align-items: center; gap: clamp(14px, 3vw, 40px); max-width: 760px; margin-inline: auto; }
.pair img { width: 100%; border-radius: 12px; }
.pair .phone-shot { border: 5px solid #111; border-radius: 22px; }

/* Wide diagrams scroll sideways on phones instead of shrinking to unreadable. */
.scroll-x { overflow-x: auto; }
.swipe-hint { display: none; }
@media (max-width: 600px) { .swipe-hint { display: block; margin: 12px 0 0; font-size: 0.8125rem; color: var(--ink-3); text-align: center; } }
.scroll-x svg { width: 100%; min-width: 520px; max-height: 36rem; margin-inline: auto; }
.shelf-fig svg { width: 100%; max-height: 26rem; }

.case-body {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 40px clamp(40px, 6vw, 96px);
  margin-top: clamp(40px, 6vw, 72px);
}
.case-facts { align-self: start; position: sticky; top: 96px; }
.case-facts dl { margin: 0; border-top: 1px solid var(--line); }
.case-facts div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.case-facts dd { margin: 4px 0 0; color: var(--ink); font-size: 0.9688rem; line-height: 1.5; }
.case-facts dd a { display: inline-flex; align-items: center; gap: 4px; }
.case-facts dd .icon { width: 14px; height: 14px; }

.prose { max-width: 42rem; }
.prose h2 { font-size: clamp(1.75rem, 3vw, 2.375rem); margin: 56px 0 18px; }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.1em; display: grid; gap: 10px; margin-bottom: 1em; }
.prose li::marker { color: var(--ink-3); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose .note { padding: 16px 20px; border-left: 2px solid var(--line-2); color: var(--ink-3); font-size: 0.9375rem; }
.prose .pull {
  margin: 36px 0;
  font-family: var(--serif);
  font-size: clamp(1.375rem, 2.4vw, 1.75rem);
  line-height: 1.3;
  color: var(--ink);
  padding-left: 22px;
  border-left: 2px solid var(--accent);
}
.prose .pull blockquote, .prose .pull p { margin: 0; }
.prose .pull figcaption { margin-top: 12px; font: 400 0.875rem/1.5 var(--sans); color: var(--ink-3); }

/* Two boxes side by side, for a comparison. */
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 8px 0 24px; }
.compare > div { padding: 18px 20px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); }
.compare .label { margin-bottom: 8px; }
.compare p:last-child { margin: 0; color: var(--ink); }

/* Figures inside the text column, and wide ones that break out of it. */
.fig { margin: 36px 0; }
.fig figcaption { margin-top: 12px; font-size: 0.875rem; color: var(--ink-3); }
.fig-panel { padding: clamp(20px, 3vw, 32px); border-radius: var(--radius); background: var(--panel); color: var(--ink); }
.fig-panel figcaption { margin-top: 20px; }
.fig img.shot { width: 100%; border-radius: 10px; border: 1px solid var(--line); }

.phones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 2vw, 24px); }
.phones figure { margin: 0; }
.phones img { width: 100%; border-radius: 16px; border: 4px solid #111; }
.phones figcaption { margin-top: 10px; font-size: 0.8125rem; color: var(--ink-3); line-height: 1.4; }
.phones.two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 520px; margin: 28px 0; }

.case-next { margin-top: clamp(64px, 9vw, 120px); }
.case-next a {
  display: grid;
  gap: 8px;
  padding: clamp(28px, 4vw, 44px) 0;
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
  text-decoration: none;
}
.case-next .title { display: flex; align-items: center; justify-content: space-between; gap: 24px; font-family: var(--serif); font-size: clamp(2rem, 5vw, 3.75rem); line-height: 1.05; letter-spacing: -0.02em; color: var(--ink); }
.case-next .icon { width: clamp(28px, 4vw, 44px); height: clamp(28px, 4vw, 44px); stroke-width: 1.25; transition: transform 0.2s; }
.case-next a:hover .title { color: var(--accent); }
.case-next a:hover .icon { transform: translateX(6px); }


/* 12. Contact and footer -------------------------------------------------- */

.contact { margin-top: var(--gap); padding: clamp(56px, 9vw, 120px) 0 clamp(40px, 6vw, 64px); background: var(--ink); color: color-mix(in srgb, var(--bg) 78%, var(--ink)); }
.contact .label { color: color-mix(in srgb, var(--bg) 62%, var(--ink)); }
.contact h2 { margin: 18px 0 28px; color: var(--bg); font-size: clamp(2rem, 4.4vw, 3.5rem); max-width: 18ch; }
/* The address is plain text, so it works without an email app: one click selects all of it, ready to copy. */
.contact-email {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  -webkit-user-select: all;
  user-select: all;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 5.6vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--bg);
  overflow-wrap: anywhere;
}
.contact-links { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid color-mix(in srgb, var(--bg) 30%, var(--ink));
  border-radius: 999px;
  color: var(--bg);
  text-decoration: none;
}
.contact-links a:hover { border-color: var(--bg); color: var(--bg); }
.contact-links .icon { width: 16px; height: 16px; }
.contact .tz { margin: 32px 0 0; }

.site-footer { background: var(--ink); color: color-mix(in srgb, var(--bg) 62%, var(--ink)); font-size: 0.875rem; }
.site-footer .inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block: 24px 32px; border-top: 1px solid color-mix(in srgb, var(--bg) 16%, var(--ink)); }
.site-footer a { color: inherit; }
.site-footer a:hover { color: var(--bg); }

/* 404: the page is short, so "main" stretches to push the contact block and footer to the bottom of the screen. */
.page-404 { min-height: 100vh; display: flex; flex-direction: column; }
.page-404 main { flex: 1; }
.page-404 .contact { margin-top: 0; }
.notfound { padding-top: clamp(56px, 10vw, 140px); padding-bottom: var(--gap); }
.notfound h1 { font-size: clamp(3rem, 9vw, 7rem); line-height: 0.95; letter-spacing: -0.03em; margin: 16px 0 24px; }


/* 13. Small screens ------------------------------------------------------- */

@media (max-width: 960px) {
  .hero-body, .about-grid, .case-body { grid-template-columns: minmax(0, 1fr); }
  .case-facts { position: static; }
  .principles { grid-template-columns: minmax(0, 1fr); }
  .case-wide { grid-template-columns: minmax(0, 1fr); }
  .case-wide .case-text { order: 0; }
  .case-wide .case-visual { aspect-ratio: 4 / 3; }
  .more-list li { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .more-list .links { grid-column: 2; flex-direction: row; justify-content: flex-start; gap: 16px; }
}

@media (max-width: 760px) {
  .site-nav .nav-wide { display: none; }
  .section-head { grid-template-columns: minmax(0, 1fr); }
  .work-grid { grid-template-columns: minmax(0, 1fr); }
  .job { grid-template-columns: minmax(0, 1fr); }
  .job-when { padding-top: 0; }
  .more-list li { grid-template-columns: minmax(0, 1fr); }
  .more-list .links { grid-column: auto; }
  .compare { grid-template-columns: minmax(0, 1fr); }
  .case-visual.fit { aspect-ratio: auto; }
  .case-visual.fit .flow span { display: none; }

  /* The flow diagram turns vertical. */
  .flow { grid-auto-flow: row; gap: 0; }
  .flow li { display: block; grid-row: auto; padding: 0 0 18px 28px; }
  .flow li::before { top: 5px; }
  .flow li::after { top: 17px; bottom: -5px; left: 5px; right: auto; width: 2px; height: auto; }
  .flow b { font-size: 1.25rem; }
  .flow span { margin-top: 4px; }
  .flow .mine { margin-top: 6px; padding-top: 6px; }

  .skills { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .skills-arrow { transform: rotate(90deg); margin: 0 auto; width: 28px; }
  .skills-users { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skills-users li { display: flex; align-items: center; justify-content: center; border-radius: 12px; font-size: 0.875rem; line-height: 1.3; }
  .phones { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .phones figcaption { font-size: 0.75rem; }
}

@media (max-width: 420px) {
  .brand { font-size: 1.2rem; }
  .site-nav a { padding: 8px 8px; }
  .site-nav .nav-cv { margin-left: 4px; padding: 8px 12px; }
  .actions .arrow-link { margin-left: 4px; }
  .snapshot div { grid-template-columns: 5.25rem minmax(0, 1fr); }
}

/* Very narrow phones: a tighter menu, and the email address on one line. */
@media (max-width: 359px) {
  .site-header .wrap { gap: 8px; }
  .brand { font-size: 1.05rem; }
  .site-nav { gap: 2px; }
  .site-nav a { padding: 8px 5px; }
  .site-nav .nav-cv { padding: 8px 10px; }
  .contact-email { font-size: 1.375rem; }
}

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


/* 14. Print: a clean text page. ----------------------------------------- */

@media print {
  :root { --bg: #fff; --ink: #000; --ink-2: #222; --ink-3: #555; --line: #ccc; --panel: #fff; }
  body { font-size: 11pt; }
  .site-header, .skip, .actions, .case-visual, .case-hero, .fig, .phones, .case-next, .contact-links, .site-footer, .case-more, .back { display: none !important; }
  .contact { background: none; color: #000; padding: 24pt 0 0; }
  .contact h2, .contact-email { color: #000; }
  .section { padding-top: 24pt; }
  .work-grid, .case-wide, .hero-body, .about-grid, .case-body, .principles { display: block; }
  .case, .job, .principle, .more-list li { break-inside: avoid; margin-bottom: 14pt; }
  .case h3 a::after { display: none; }
  a { text-decoration: none; }
}
