/* ------------------------------------------------------------------
   Konstantinos Konstantinidis · portfolio

   Two type roles, and no others:
   - DISPLAY (Jost): always uppercase and widely tracked. Wordmark, nav,
     section titles, labels, tabs, and the project title in the hero.
   - TEXT (Host Grotesk): sentence case at a regular weight, tightly tracked
     when large. Statements, project titles, body copy.

   Black ground, hairline rules, purple as a flat accent.
   ------------------------------------------------------------------ */

:root {
  color-scheme: dark;

  --paper: #08080a;
  --plate: #101014;
  --ink: #f4f3f6;
  --ink-2: #b6b3bf;
  --ink-3: #86828f;
  --rule: #24222b;
  --rule-strong: #3e3a49;
  --accent: #9d5cff;
  --accent-text: #c3a3ff;
  --accent-deep: #6d28d9;
  --glow: radial-gradient(62% 78% at 50% 50%, rgba(150, 92, 255, 0.4), rgba(96, 48, 190, 0.16) 52%, rgba(96, 48, 190, 0) 80%);

  --display: "Jost", "Futura PT", Futura, "Century Gothic", "Trebuchet MS", sans-serif;
  --text: "Host Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --track: 0.16em;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1320px;
  --header-h: 64px;
  --section-gap: clamp(80px, 11vw, 160px);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent-deep); color: #fff; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

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

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--accent-deep);
  color: #fff;
  text-decoration: none;
}
.skip:focus { top: 10px; }

/* Display role: small tracked capitals ------------------------------- */

.label,
.section-note,
.nav a,
.wordmark,
.filters button,
.card-top,
.card-when,
.spec dt,
.fig-no,
.crumbs,
.contact-key,
.site-footer,
.toolbox dt,
.slide-kicker,
.featured-tabs button,
.btn-pill,
.text-link,
.callout b,
.lightbox-bar,
.next-label,
.milestone-date,
.todo {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.75rem;
  line-height: 1.4;
  letter-spacing: var(--track);
  text-transform: uppercase;
  font-kerning: none;
}

.label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--ink-2);
}
.label::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--accent);
}

.text-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.7em;
  text-decoration: none;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--accent);
  transition: color 0.15s, border-color 0.15s;
}
.text-link:hover { color: var(--accent-text); border-color: var(--accent-text); }

/* Anything still waiting on real content. Search the project for "todo". */
.todo {
  display: inline-block;
  padding: 6px 10px;
  border: 1px dashed var(--rule-strong);
  color: var(--ink-3);
  font-size: 0.6875rem;
}

/* Text role: large statements ---------------------------------------- */

.statement-text {
  max-width: 21em;
  font-family: var(--text);
  font-weight: 400;
  font-size: clamp(1.625rem, 4.1vw, 3.625rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
  text-wrap: pretty;
}
.statement-text .dim { color: var(--ink-3); }

.lede {
  max-width: 34em;
  font-size: clamp(1.0625rem, 1.5vw, 1.3125rem);
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* Header ------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 8, 10, 0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
.home .site-header { background: rgba(8, 8, 10, 0.5); border-bottom-color: rgba(255, 255, 255, 0.1); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
}

/* The name, stacked on two lines. */
.wordmark {
  display: grid;
  gap: 2px;
  padding-left: 11px;
  border-left: 2px solid var(--accent);
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1.15;
  letter-spacing: 0.24em;
  text-decoration: none;
  transition: color 0.15s;
}
.wordmark:hover { color: var(--accent-text); }

.nav { display: flex; gap: clamp(16px, 3vw, 40px); }

.nav a {
  position: relative;
  padding-block: 8px;
  text-decoration: none;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: var(--track); /* stop under the last letter, not its tracking */
  bottom: 2px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.nav a:hover::after,
.nav a:focus-visible::after { transform: scaleX(1); }

/* Hero -------------------------------------------------------------- */

/* A full-screen stage. Featured projects fill it and rotate; the current
   project is named bottom-left and the tabs below double as a progress bar. */
.hero {
  --foot-h: 52px;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: clamp(600px, 100svh, 940px);
  margin-top: calc(-1 * var(--header-h)); /* the picture runs up behind the header */
  padding-top: var(--header-h);
  overflow: hidden;
  background: var(--plate);
}
.hero.is-empty { min-height: 0; }
.hero.is-empty .hero-foot { display: none; }

.hero-stage { position: absolute; inset: 0; z-index: 0; }
.hero-foot { position: relative; z-index: 2; grid-row: 2; }

.slide {
  position: absolute;
  inset: 0;
  display: block;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
}
/* The fade itself is stepped by site.js (inline opacity on the active slide). */
.slide.is-active { z-index: 2; opacity: 1; visibility: visible; }
.slide.is-leaving { z-index: 1; opacity: 1; visibility: visible; }

/* Backdrop for a photo: a blurred, enlarged copy of itself. */
.slide-ambient {
  position: absolute;
  inset: -70px;
  z-index: 0;
  background: center / cover no-repeat;
  filter: blur(44px) saturate(1.1) brightness(0.5);
}

/* Backdrop for a cut-out render: a soft violet light behind it. */
.slide.is-cutout {
  background:
    radial-gradient(48% 64% at 60% 52%, rgba(150, 92, 255, 0.46), rgba(96, 48, 190, 0.16) 56%, rgba(96, 48, 190, 0) 84%),
    var(--plate);
}

/* Darker on the left for the text, fading into the page below. */
.slide::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(0deg, var(--paper) 0%, rgba(8, 8, 10, 0) 40%),
    linear-gradient(90deg, rgba(8, 8, 10, 0.88) 0%, rgba(8, 8, 10, 0.5) 38%, rgba(8, 8, 10, 0) 72%),
    rgba(60, 30, 130, 0.14);
}

.slide-photo,
.slide-cutout { position: absolute; z-index: 2; }

/* The picture is as large as the hero allows: full height between the header
   and the tabs, or 46% of the screen width, whichever it reaches first (the
   width limit keeps a landscape picture clear of the title on the left).
   `--ar` is its width / height, set by site.js. */
.slide-photo {
  --room: calc(100% - var(--header-h) - var(--foot-h) - 36px);
  right: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
  top: calc(50% + (var(--header-h) - var(--foot-h)) / 2);
  transform: translateY(-50%);
  height: min(var(--room), calc(46vw / var(--ar, 0.75)));
  width: auto;
  max-width: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 44px 90px -30px rgba(0, 0, 0, 0.9);
}

.slide-cutout {
  right: -3vw;
  top: calc(50% + 6px);
  transform: translateY(-50%);
  width: min(88vw, 1320px, 150svh);
  max-width: none;
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.6));
}

.slide-caption {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: calc(var(--foot-h) + clamp(22px, 3vw, 40px));
  display: grid;
  justify-items: start;
  gap: 16px;
}

.slide-kicker { color: var(--ink-2); }
.slide-kicker b { color: var(--accent-text); font-weight: 500; }
.slide-kicker i { margin-left: 16px; font-style: normal; }

.slide-title {
  max-width: min(17em, 40vw);
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.5rem, 2.8vw, 2.5rem);
  line-height: 1.18;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-kerning: none;
  text-wrap: balance;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
  padding: 11px 16px 11px 22px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  color: var(--ink);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-pill span { font-size: 1rem; line-height: 0.75; letter-spacing: 0; }
.slide:hover .btn-pill { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* Tabs double as the progress indicator. */
.featured-tabs {
  display: flex;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.featured-tabs button {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex: 1 1 0;
  min-width: 0;
  padding: 18px 14px 16px 0;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  text-align: left;
  cursor: pointer;
  transition: color 0.15s;
}
.featured-tabs button + button { padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, 0.1); }
.featured-tabs button:hover { color: var(--ink); }
.featured-tab.is-active { color: var(--ink); }
.featured-tab .tab-no { color: var(--accent-text); }
.featured-tab .tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The fill is driven from site.js, so it tracks the real clock. */
.featured-tab .bar {
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 2px;
  overflow: hidden;
}
.featured-tab .bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

.featured-tabs .featured-pause {
  flex: 0 0 6rem;
  justify-content: center;
}
.featured-tabs .featured-pause[hidden] { display: none; }

/* Letter animation --------------------------------------------------- */

/* While a title decodes, each unsettled letter keeps its own width (the real
   letter is still there, just transparent) and shows a stand-in glyph on top,
   so nothing shifts. site.js steps it from the clock. */
.tw { display: inline-block; white-space: nowrap; }
.tc { position: relative; display: inline-block; }
.tc.is-on { color: transparent; }
.tc.is-on::after {
  content: attr(data-g);
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  letter-spacing: 0;
  color: var(--accent-text);
}

/* Text still to be typed holds its place; the caret marks where typing is. */
.t-hidden { color: transparent; }
.t-hidden.is-caret { box-shadow: -2px 0 0 var(--accent); }

/* Opening statement -------------------------------------------------- */

.statement { padding-top: clamp(56px, 8vw, 112px); }

/* Sections ---------------------------------------------------------- */

.work,
.about,
.contact { padding-top: var(--section-gap); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule-strong);
}

.section-head h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.375rem, 2.6vw, 2rem);
  line-height: 1.15;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-kerning: none;
}

.section-note { color: var(--ink-3); }

/* Plates (figure grounds) ------------------------------------------- */

.plate {
  background: var(--plate);
  border: 1px solid var(--rule);
}

/* Cut-out renders have no ground of their own, so they get the light. */
.card-plate img,
.fig-plate img,
.lightbox-stage img { background: var(--glow), var(--plate); }

/* Work grid --------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px clamp(18px, 2.4vw, 32px);
  padding-block: 18px clamp(28px, 4vw, 44px);
}

.filters button {
  padding: 8px 0 6px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.work-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(40px, 4.4vw, 64px) clamp(16px, 2vw, 28px);
}

.card[hidden] { display: none; }

.card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-block: 11px;
  border-top: 1px solid var(--rule-strong);
  color: var(--ink-2);
  font-size: 0.6875rem;
  transition: border-color 0.15s;
}
.card-no { color: var(--accent-text); }
.card-disc { text-align: right; }

.card-plate {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  padding: 12px;
  overflow: hidden;
}
.card-plate img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  min-height: 0;
  object-fit: contain;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card-title {
  margin-top: 16px;
  font-weight: 500;
  font-size: 1.1875rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
  transition: color 0.15s;
}

.card-sum {
  margin-top: 8px;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--ink-2);
  text-wrap: pretty;
}

.card-when {
  margin-top: auto;
  padding-top: 16px;
  color: var(--accent-text);
  font-size: 0.6875rem;
}
.card-when.is-empty { color: var(--ink-3); }

.card a:hover .card-top,
.card a:focus-visible .card-top { border-top-color: var(--accent); }
.card a:hover .card-title,
.card a:focus-visible .card-title { color: var(--accent-text); }
.card a:hover .card-plate img { transform: scale(1.03); }

/* About ------------------------------------------------------------- */

.about-text {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.7fr);
  gap: clamp(20px, 6vw, 96px);
  align-items: end;
  padding-block: clamp(32px, 5vw, 64px) clamp(48px, 7vw, 96px);
}
.about-text p:not(.statement-text) {
  max-width: 30em;
  font-size: 1.0625rem;
  color: var(--ink-2);
}

.toolbox {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 36px 28px;
  align-items: start;
}
.toolbox dt {
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--accent);
  color: var(--ink);
  font-size: 0.6875rem;
}
.toolbox dd {
  padding-block: 8px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--ink-2);
}

/* Contact ----------------------------------------------------------- */

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: end;
  padding-top: clamp(32px, 5vw, 64px);
}

.contact-list li {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  align-items: baseline;
  gap: 16px;
  padding-block: 16px;
  border-bottom: 1px solid var(--rule);
}
.contact-list li:first-child { border-top: 1px solid var(--rule); }
.contact-key { color: var(--ink-3); font-size: 0.6875rem; }
.contact-list a {
  justify-self: start;
  font-size: 1.0625rem;
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  overflow-wrap: anywhere;
  transition: color 0.15s, border-color 0.15s;
}
.contact-list a:hover { color: var(--accent-text); border-color: var(--accent-text); }

/* Footer ------------------------------------------------------------ */

.site-footer {
  margin-top: var(--section-gap);
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 0.6875rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-block: 26px;
}
.to-top { text-decoration: none; }
.to-top:hover { color: var(--accent-text); }

/* Project page ------------------------------------------------------ */

.project-head { padding-top: clamp(28px, 4vw, 56px); }

.crumbs {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink-3);
}
.crumbs a { text-decoration: none; color: var(--ink-2); }
.crumbs a:hover { color: var(--accent-text); }
.crumbs .count b { color: var(--accent-text); font-weight: 500; }

/* Title, with an optional badge (e.g. a mission patch) on its right. */
.project-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(20px, 4vw, 56px);
  margin-top: clamp(28px, 5vw, 64px);
}
.project-badge {
  flex: none;
  width: clamp(92px, 13vw, 190px);
  height: auto;
}

.project-title {
  margin-top: 0;
  max-width: 15em;
  font-family: var(--text);
  font-weight: 400;
  font-size: clamp(2.25rem, 6.2vw, 5rem);
  line-height: 1;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.project-summary { margin-top: clamp(18px, 2.4vw, 28px); }

.spec {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(32px, 4.4vw, 56px);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
}
.spec > div { padding: 16px 16px 18px 0; }
.spec > div + div {
  padding-left: 18px;
  border-left: 1px solid var(--rule);
}
.spec dt { color: var(--ink-3); margin-bottom: 8px; font-size: 0.6875rem; }
.spec dd { font-size: 0.9375rem; line-height: 1.45; }
.spec .todo { margin-top: 2px; }

.project-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.62fr);
  gap: clamp(32px, 6vw, 96px);
  padding-top: clamp(44px, 6vw, 88px);
}

.overview p {
  max-width: 38em;
  color: var(--ink-2);
  text-wrap: pretty;
}
.overview p:first-of-type {
  font-size: clamp(1.125rem, 1.7vw, 1.4375rem);
  line-height: 1.38;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.overview p + p { margin-top: 1.1em; }

.highlights li {
  position: relative;
  padding: 12px 0 12px 24px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9375rem;
  line-height: 1.45;
}
.highlights li:first-child { border-top: 1px solid var(--rule); }
.highlights li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 1.35em;
  width: 10px;
  height: 1px;
  background: var(--accent);
}

/* Figures */
.figures {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(20px, 2.6vw, 36px) clamp(12px, 1.8vw, 24px);
  padding-top: clamp(44px, 6vw, 88px);
}

.fig {
  grid-column: span var(--span, 12);
  display: flex;
  flex-direction: column;
}

.fig-plate {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  padding: clamp(10px, 1.5vw, 20px);
  cursor: zoom-in;
  transition: border-color 0.15s;
}
.fig-plate:hover { border-color: var(--accent); }
.fig-plate img {
  width: 100%;
  max-width: var(--maxw, 100%);
}

/* Video figures play in place rather than opening the viewer. */
.fig-video { cursor: default; }
.fig-video:hover { border-color: var(--rule); }
.fig-video video {
  display: block;
  width: 100%;
  max-width: var(--maxw, 100%);
  height: auto;
  background: #000;
}

.fig figcaption {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: 8px;
  padding-top: 12px;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--ink-2);
}
.fig-no { color: var(--accent-text); padding-top: 3px; font-size: 0.6875rem; }

/* Part labels over a figure */
.fig-plate .cutout {
  position: relative;
  display: block;
  width: 100%;
  max-width: var(--maxw, 100%);
  margin-block: 46px; /* room for the labels above and below */
}
.fig-plate .cutout img { max-width: none; }

.callouts { position: absolute; inset: 0; }

.callout {
  position: absolute;
  left: var(--x);
  top: 0;
  bottom: 0;
  width: 0;
}

/* leader */
.callout::before {
  content: "";
  position: absolute;
  left: -0.5px;
  width: 1px;
  background: rgba(244, 243, 246, 0.6);
}
.callout.up::before { top: -18px; height: calc(var(--y) + 18px); }
.callout.down::before { top: var(--y); bottom: -18px; }

/* point on the part */
.callout::after {
  content: "";
  position: absolute;
  left: -3.5px;
  top: calc(var(--y) - 3.5px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px var(--accent);
}

/* label */
.callout b {
  position: absolute;
  left: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  color: var(--ink);
}
.callout.align-start b { transform: translateX(-4px); }
.callout.align-end b { transform: translateX(calc(-100% + 4px)); }
.callout.up b { top: -40px; }
.callout.down b { bottom: -40px; }

/* Timeline */
.timeline { padding-top: clamp(52px, 7vw, 104px); }

.timeline-track {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 16px;
  padding-top: 28px;
}
.timeline-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 5px;
  height: 1px;
  background: var(--rule-strong);
}
.milestone { position: relative; }
.milestone::before {
  content: "";
  position: absolute;
  left: 0;
  top: -28px;
  width: 11px;
  height: 11px;
  border: 1px solid var(--accent-text);
  border-radius: 50%;
  background: var(--accent);
}
.milestone-date { display: block; color: var(--accent-text); }
.milestone-label { display: block; margin-top: 4px; font-size: 0.9375rem; line-height: 1.4; }

/* Only a date range is known: one run from start to finish. */
.timeline-track.is-span {
  grid-auto-flow: row;
  grid-template-columns: minmax(0, 1fr) auto;
  width: min(560px, 100%);
}
.timeline-track.is-span::before { background: var(--accent); }
.timeline-track.is-span .milestone:last-child { text-align: right; }
.timeline-track.is-span .milestone:last-child::before { left: auto; right: 0; }
.milestone.is-open::before { background: var(--paper); } /* still running */

.timeline-track.is-empty::before {
  background: repeating-linear-gradient(90deg, var(--rule-strong) 0 6px, transparent 6px 12px);
}
.timeline-track.is-empty .milestone::before { background: var(--paper); border-color: var(--rule-strong); }
.timeline-track.is-empty .milestone span {
  display: block;
  height: 8px;
  width: min(70%, 120px);
  margin-top: 6px;
  background: var(--rule);
}
.timeline-track.is-empty .milestone span + span { width: min(45%, 80px); }
.timeline .todo { margin-top: 20px; }

/* Next project */
.next {
  display: block;
  margin-top: var(--section-gap);
  padding-block: clamp(28px, 4vw, 48px);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  text-decoration: none;
}
.next-label { display: block; color: var(--ink-3); }
.next-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-top: 12px;
  font-weight: 400;
  font-size: clamp(1.75rem, 4.8vw, 3.75rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  transition: color 0.15s;
}
.next-title .arrow { color: var(--accent); letter-spacing: 0; transition: transform 0.2s ease; }
.next:hover .next-title { color: var(--accent-text); }
.next:hover .next-title .arrow { transform: translateX(8px); }

.not-found { padding-block: clamp(64px, 12vw, 160px); }
.not-found .text-link { margin-top: 28px; }

/* Lightbox ---------------------------------------------------------- */

.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
}
.lightbox[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.lightbox::backdrop { background: var(--paper); }

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
}
.lightbox-btn,
.lightbox-nav {
  border: 1px solid var(--rule-strong);
  background: var(--plate);
  cursor: pointer;
  transition: border-color 0.15s;
}
.lightbox-btn { padding: 9px 14px; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.lightbox-btn:hover,
.lightbox-nav:hover { border-color: var(--accent); }

.lightbox-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 0;
  padding: 16px var(--gutter);
}
.lightbox-stage img {
  justify-self: center;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  min-height: 0;
  object-fit: contain;
  border: 1px solid var(--rule);
}
.lightbox-nav {
  width: 44px;
  height: 44px;
  font-size: 1rem;
  line-height: 1;
}
.lightbox-nav[disabled] { opacity: 0.35; cursor: default; }

.lightbox-caption {
  padding: 14px var(--gutter) 20px;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--ink-2);
  text-align: center;
}

/* Responsive -------------------------------------------------------- */

@media (max-width: 1180px) {
  .work-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .featured-tab .tab-label { display: none; }
}

@media (max-width: 880px) {
  /* Hero on a narrow screen: the picture takes everything between the header
     and a compact caption. */
  .hero {
    --top: calc(var(--header-h) + 16px);
    --bottom: 196px; /* caption + tabs */
    min-height: clamp(620px, 100svh, 940px);
  }
  .slide::before {
    background:
      linear-gradient(0deg, var(--paper) 0%, rgba(8, 8, 10, 0.7) 24%, rgba(8, 8, 10, 0) 46%),
      rgba(60, 30, 130, 0.14);
  }
  .slide.is-cutout {
    background:
      radial-gradient(90% 36% at 50% 44%, rgba(150, 92, 255, 0.5), rgba(96, 48, 190, 0.16) 56%, rgba(96, 48, 190, 0) 84%),
      var(--plate);
  }
  .slide-photo {
    --room: calc(100% - var(--top) - var(--bottom));
    right: auto;
    left: 50%;
    top: calc(var(--top) + var(--room) / 2);
    transform: translate(-50%, -50%);
    height: min(var(--room), calc((100vw - 2 * var(--gutter)) / var(--ar, 0.75)));
  }
  .slide-cutout {
    right: -10vw;
    top: calc(var(--top) + (100% - var(--top) - var(--bottom)) / 2);
    width: min(168vw, 1100px);
  }

  /* kicker and link share a line; the title sits under them */
  .slide-caption {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 10px 16px;
    bottom: calc(var(--foot-h) + 18px);
  }
  .slide-title { grid-column: 1 / -1; grid-row: 2; max-width: none; font-size: clamp(1.25rem, 4.2vw, 1.875rem); }
  .btn-pill {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    padding: 0 0 3px;
    gap: 8px;
    border: 0;
    border-bottom: 1px solid var(--accent);
    border-radius: 0;
  }
  .slide:hover .btn-pill { background: transparent; color: var(--accent-text); }

  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .about-text,
  .contact-layout,
  .project-body { grid-template-columns: minmax(0, 1fr); align-items: start; }

  .spec { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .spec > div:nth-child(n + 3) { border-top: 1px solid var(--rule); }

  .fig { grid-column: span 6; }
  .fig[data-span="12"] { grid-column: span 12; }

  .timeline-track { grid-auto-flow: row; grid-auto-columns: auto; padding-top: 0; padding-left: 28px; gap: 20px; }
  .timeline-track::before { left: 5px; right: auto; top: 0; bottom: 0; width: 1px; height: auto; }
  .timeline-track.is-empty::before {
    background: repeating-linear-gradient(180deg, var(--rule-strong) 0 6px, transparent 6px 12px);
  }
  .milestone::before { left: -28px; top: 3px; }
  .timeline-track.is-span { grid-template-columns: none; width: auto; }
  .timeline-track.is-span .milestone:last-child { text-align: left; }
  .timeline-track.is-span .milestone:last-child::before { left: -28px; right: auto; }
}

@media (max-width: 560px) {
  :root { --track: 0.13em; }

  .hero { --bottom: 214px; } /* titles wrap to three lines here */
  .slide-kicker i { display: none; }

  .wordmark { font-size: 0.6875rem; letter-spacing: 0.2em; }
  .nav { gap: 14px; }
  .nav a { font-size: 0.6875rem; }

  .work-grid { grid-template-columns: minmax(0, 1fr); }

  /* Part labels need room; on a phone the render stands alone. */
  .callouts { display: none; }
  .fig-plate .cutout { margin-block: 0; }

  .featured-tabs button { padding-right: 6px; }
  .featured-tabs button + button { padding-left: 8px; }
  .featured-tabs .featured-pause { flex-basis: 4.75rem; }

  .fig,
  .fig[data-span="12"] { grid-column: span 12; }
  .fig[data-span="3"],
  .fig[data-span="4"] { grid-column: span 6; }

  .contact-list li { grid-template-columns: 5.5rem minmax(0, 1fr); }

  .lightbox-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .lightbox-stage img { grid-column: 1; grid-row: 1; }
  .lightbox-nav { grid-row: 2; }
  #lightbox-prev { justify-self: start; grid-column: 1; }
  #lightbox-next { justify-self: end; grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media print {
  .site-header, .filters, .lightbox, .featured-tabs { display: none; }
}

.not-found .project-title { margin-top: 24px; }
