/* ------------------------------------------------------------------
   Portfolio — case study
   Restrained editorial layout. No frameworks, no webfonts, no CDN.
   ------------------------------------------------------------------ */

:root {
  --paper:      #FBFAF7;
  --paper-2:    #F4F2ED;
  --card:       #FFFFFF;
  --ink:        #16191C;
  --ink-2:      #3C4249;
  --muted:      #6C7278;
  --muted-2:    #8A9097;
  --rule:       #E4E0D8;
  --rule-soft:  #EDEAE3;
  --accent:     #1B3A57;
  --accent-2:   #2C5F8A;
  --accent-soft:#EDF2F6;
  --pos:        #1E7A47;
  --neg:        #A93226;

  --serif: Charter, "Iowan Old Style", "Source Serif 4", Georgia, Cambria, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;

  --shot-w: 443px;
  --gutter: clamp(20px, 5vw, 56px);
  --wrap: 1120px;
  --prose: 68ch;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--accent-2); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

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

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; z-index: 100;
}
.skip:focus { left: 8px; top: 8px; }

/* ---------------------------------------------------------------- layout */

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

.section { padding-block: clamp(56px, 9vw, 104px); }
.section + .section { border-top: 1px solid var(--rule-soft); }
.section--tint { background: var(--paper-2); }

.prose { max-width: var(--prose); }
.prose p { margin: 0 0 1.1em; color: var(--ink-2); }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); font-weight: 600; }

/* --------------------------------------------------------------- headings */

h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--ink); }

h1 {
  font-size: clamp(2.05rem, 1.32rem + 3.1vw, 3.7rem);
  line-height: 1.05;
  letter-spacing: -0.021em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.5rem, 1.14rem + 1.5vw, 2.2rem);
  line-height: 1.16;
  letter-spacing: -0.016em;
  margin: 0 0 0.7em;
  text-wrap: balance;
}

h3 {
  font-size: clamp(1.08rem, 1rem + 0.35vw, 1.24rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 0.45em;
}

.eyebrow {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 22px;
}
.eyebrow::before {
  content: attr(data-n);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--accent-2);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--rule);
}

.lede {
  font-size: clamp(1.06rem, 1rem + 0.4vw, 1.3rem);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 60ch;
}

/* ------------------------------------------------------------------- hero */

.hero { padding-block: clamp(44px, 7vw, 88px) clamp(44px, 7vw, 84px); }

.hero__grid { display: grid; gap: clamp(34px, 5vw, 64px); align-items: center; }
.hero__proof { justify-self: start; }

/* Desktop: copy left, real system right, ~60/40.
   The device is sized off the viewport height as well as its width, so the
   screenshot lands inside the first screen instead of pushing past the fold.
   443 / 960 = 0.4615, so width = height x 0.462. */
@media (min-width: 900px) {
  .hero__grid {
    --hero-shot: clamp(320px, 34vw, 400px);
    grid-template-columns: minmax(0, 1fr) var(--hero-shot);
  }
  /* stretch, not end — an end-aligned grid item shrinks to fit its content,
     which collapses the device below its own column width */
  .hero__proof { justify-self: stretch; }
  .hero__proof .shot-btn,
  .hero__proof .shot,
  .hero__proof figcaption { max-width: var(--hero-shot); }

  /* The device keeps its full column width and trims to the viewport instead
     of shrinking, so the screenshot reads at a usable size and still lands
     inside the first screen. The full capture opens in the lightbox and
     appears uncropped in the Staff entry section. */
  .hero__proof .shot img {
    height: min(calc(var(--hero-shot) * 2.167), calc(100vh - 240px));
    object-fit: cover;
    object-position: top center;
  }
}

.hero__kicker {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 28px;
}

.hero h1 { max-width: 17ch; }

.hero__lede { max-width: 62ch; margin: 0 0 32px; }

.positioning {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin: 0 0 36px; padding: 0; list-style: none;
}
.positioning li {
  font-size: 0.76rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #DDE6ED;
  border-radius: 999px;
  padding: 7px 15px;
}

.meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 40px;
}
.meta div { background: var(--paper); padding: 16px 18px; }
.meta dt {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted-2); margin: 0 0 6px;
}
.meta dd { margin: 0; font-size: 0.92rem; line-height: 1.45; color: var(--ink-2); }

@media (min-width: 560px) { .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Scoped so a two-item strip can never inherit four tracks and render
   empty cells where the background shows through. */
@media (min-width: 1000px) { .meta:not(.meta--light) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* hero variant: two entries, two tracks at every width above 560px */
.meta--light { max-width: 520px; margin-top: 34px; }

/* ------------------------------------------------------------------ flow */

.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
}
.flow li { display: flex; align-items: center; gap: 12px; min-width: 0; }
.flow li::after {
  content: "→";
  color: var(--accent-2);
  font-size: 0.95rem;
  line-height: 1;
}
.flow li:last-child::after { content: none; }
.flow span {
  display: block;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 10px 15px;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: -0.003em;
  color: var(--ink);
}
.flow--arch span { background: var(--accent-soft); border-color: #DCE5EC; color: var(--accent); }

.jump {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 0.92rem; font-weight: 600;
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 3px;
}
.jump:hover { border-bottom-color: var(--accent); }
.jump span[aria-hidden] { font-size: 0.86em; }

/* ------------------------------------------------------------- screenshots */

figure { margin: 0; }

.shot {
  display: block;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 20px;
  padding: 7px;
  box-shadow: 0 1px 1px rgba(22, 25, 28, 0.03), 0 16px 34px -26px rgba(22, 25, 28, 0.45);
  width: 100%;
  max-width: var(--shot-w);
}
.shot img { border-radius: 14px; width: 100%; background: var(--paper-2); }

.shot-btn {
  display: block; width: 100%; max-width: var(--shot-w);
  padding: 0; border: 0; background: none; cursor: zoom-in;
  font: inherit; color: inherit;
}
.shot-btn .shot { transition: box-shadow 220ms ease, transform 220ms ease; }
.shot-btn:hover .shot { box-shadow: 0 1px 1px rgba(22,25,28,.04), 0 22px 40px -26px rgba(22,25,28,.55); }

figcaption {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 12px;
  max-width: var(--shot-w);
  text-align: left;
}
figcaption b { color: var(--ink-2); font-weight: 600; }

/* two-column: screenshot + explanation */
.split { display: grid; gap: clamp(28px, 4vw, 56px); align-items: start; }
@media (min-width: 900px) {
  .split { grid-template-columns: var(--shot-w) minmax(0, 1fr); }
  .split--reverse { grid-template-columns: minmax(0, 1fr) var(--shot-w); }
  .split--reverse .split__figure { order: 2; }
}

.split__body > h2 { margin-top: -0.15em; }

/* annotated point list */
.points { list-style: none; margin: 22px 0 0; padding: 0; }
.points li {
  position: relative;
  padding: 14px 0 14px 22px;
  border-top: 1px solid var(--rule-soft);
  color: var(--ink-2);
  font-size: 0.96rem;
  line-height: 1.55;
}
.points li:last-child { border-bottom: 1px solid var(--rule-soft); }
.points li::before {
  content: "";
  position: absolute; left: 0; top: 23px;
  width: 6px; height: 1px; background: var(--accent-2);
}
.points b { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------- triptych */

.triptych { display: grid; gap: 28px; }
@media (min-width: 760px) { .triptych { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .triptych { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.triptych .shot, .triptych .shot-btn, .triptych figcaption { max-width: 100%; }

.pair { display: grid; gap: 28px; }
@media (min-width: 760px) { .pair { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pair .shot, .pair .shot-btn, .pair figcaption { max-width: 100%; }

.note {
  font-size: 0.86rem;
  color: var(--muted);
  border-left: 2px solid var(--rule);
  padding-left: 14px;
  margin: 0 0 34px;
  max-width: 62ch;
}

/* ------------------------------------------------------------------ trace */

.trace { list-style: none; counter-reset: step; margin: 34px 0 0; padding: 0; max-width: 78ch; }
.trace > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 30px 52px;
  border-left: 1px solid var(--rule);
  margin-left: 13px;
}
.trace > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.trace > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: -13px; top: -2px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--rule);
  color: var(--accent-2);
  font-family: var(--mono); font-size: 0.66rem; font-weight: 600;
  display: grid; place-items: center;
}
.trace h3 { margin-bottom: 0.3em; }
.trace p { margin: 0; color: var(--ink-2); font-size: 0.96rem; }

.fieldline {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.9;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 12px 14px;
  margin: 14px 0 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.fieldline span { color: var(--muted); }

.callout {
  background: var(--accent-soft);
  border: 1px solid #DCE5EC;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: clamp(22px, 3vw, 32px);
  margin-top: 44px;
  max-width: 78ch;
}
.callout h3 { margin-top: 0; font-family: var(--serif); font-size: 1.25rem; }
.callout p { color: var(--ink-2); margin: 0 0 1em; }
.callout p:last-child { margin-bottom: 0; }

.dates {
  display: grid; gap: 1px; background: #DCE5EC;
  border: 1px solid #DCE5EC; border-radius: 4px;
  margin: 0 0 20px;
}
@media (min-width: 620px) { .dates { grid-template-columns: 1fr 1fr; } }
.dates div { background: #F7FAFC; padding: 14px 16px; }
.dates dt {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 5px;
}
.dates dd {
  margin: 0; font-family: var(--mono); font-size: 0.98rem; color: var(--ink); font-weight: 600;
}
.dates dd small { display: block; font-family: var(--sans); font-size: 0.78rem; font-weight: 400; color: var(--muted); margin-top: 4px; letter-spacing: 0; }

/* ------------------------------------------------------------------ video */

.video-block { display: grid; gap: clamp(28px, 4vw, 56px); align-items: center; }
@media (min-width: 900px) { .video-block { grid-template-columns: var(--shot-w) minmax(0, 1fr); } }

.player {
  position: relative;
  width: 100%; max-width: var(--shot-w);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 20px;
  padding: 7px;
  box-shadow: 0 1px 1px rgba(22,25,28,.03), 0 16px 34px -26px rgba(22,25,28,.45);
}
.player__inner {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 1440 / 3118;
  background: #0E1113;
}
.player__inner img, .player__inner video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 14px;
}
.player__play {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: grid; place-items: center;
  border: 0; padding: 0; cursor: pointer;
  background: linear-gradient(180deg, rgba(14,17,19,.12), rgba(14,17,19,.34));
  color: #fff;
}
.player__play i {
  display: grid; place-items: center;
  width: 68px; height: 68px; border-radius: 50%;
  background: rgba(255,255,255,.94);
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  transition: transform 200ms ease;
}
.player__play i::after {
  content: ""; margin-left: 5px;
  border-style: solid; border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent var(--accent);
}
.player__play:hover i { transform: scale(1.06); }
.player__badge {
  position: absolute; left: 14px; bottom: 14px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em;
  color: #fff; background: rgba(14,17,19,.66);
  border-radius: 999px; padding: 5px 11px;
  backdrop-filter: none;
}

.specs { list-style: none; margin: 24px 0 0; padding: 0; }
.specs li {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 11px 0; border-top: 1px solid var(--rule-soft);
  font-size: 0.9rem; color: var(--ink-2);
}
.specs li:last-child { border-bottom: 1px solid var(--rule-soft); }
.specs b {
  flex: 0 0 128px; color: var(--muted-2);
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  padding-top: 4px;
}

/* --------------------------------------------------------------- outcomes */

.outcomes { display: grid; gap: 0 clamp(28px, 4vw, 56px); margin: 34px 0 0; padding: 0; list-style: none; }
@media (min-width: 800px) { .outcomes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.outcomes li { padding: 22px 0; border-top: 1px solid var(--rule); }
.outcomes h3 { margin-bottom: 0.35em; font-family: var(--sans); font-size: 1rem; font-weight: 650; letter-spacing: -0.005em; }
.outcomes p { margin: 0; font-size: 0.93rem; color: var(--ink-2); }

/* ----------------------------------------------------------- architecture */

.arch { display: grid; gap: clamp(30px, 4vw, 56px); margin-top: 34px; }
@media (min-width: 860px) { .arch { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.arch h3 {
  font-family: var(--sans); font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  padding-bottom: 12px; border-bottom: 1px solid var(--rule); margin-bottom: 0;
}
.arch ul { list-style: none; margin: 0; padding: 0; }
.arch li { padding: 15px 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.93rem; color: var(--ink-2); }
.arch li b { display: block; color: var(--ink); font-weight: 600; font-size: 0.95rem; margin-bottom: 2px; }

/* ------------------------------------------------------------ disclosure */

.disclosure {
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--card);
  padding: clamp(24px, 3.4vw, 38px);
  max-width: 78ch;
}
.disclosure p { font-size: 0.94rem; color: var(--ink-2); margin: 0 0 1em; }
.disclosure p:last-child { margin-bottom: 0; }
.disclosure strong { color: var(--ink); }

/* -------------------------------------------------------------------- cta */

.cta { text-align: left; }
.cta h2 { max-width: 20ch; }
.cta__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 0.94rem; font-weight: 600;
  padding: 13px 24px; border-radius: 3px;
  text-decoration: none; border: 1px solid var(--accent);
  transition: background-color 180ms ease, color 180ms ease;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #12293D; color: #fff; }
.btn--ghost { background: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); color: var(--accent); }

/* ----------------------------------------------------------------- footer */

.foot {
  border-top: 1px solid var(--rule);
  padding-block: 34px 44px;
  font-size: 0.8rem;
  color: var(--muted);
}
.foot p { margin: 0 0 6px; max-width: 74ch; }

/* --------------------------------------------------------------- lightbox */

.lightbox {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(12, 14, 16, 0.92);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  display: none;
}
.lightbox[open], .lightbox.is-open { display: block; }
.lightbox__img {
  display: block;
  width: 443px; max-width: none;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
  background: #fff;
}
.lightbox__cap {
  display: block; margin: 14px auto 0; max-width: 443px;
  color: #C9CDD1; font-size: 0.8rem; line-height: 1.5; text-align: left;
}
.lightbox__close {
  position: sticky; top: 0; float: right;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.28); background: rgba(0,0,0,.4);
  color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer;
  z-index: 2;
}
body.is-locked { overflow: hidden; }

/* ----------------------------------------------------------------- motion */

/* Content is never hidden behind script. The only motion on this page is
   hover feedback and the browser's own smooth scrolling, both of which
   degrade to nothing. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .shot-btn .shot, .player__play i, .btn { transition: none; }
}

/* ------------------------------------------------------------- semantic */

.state-pos { color: var(--pos); font-weight: 600; }
.state-neg { color: var(--neg); font-weight: 600; }
.amount { font-family: var(--mono); font-weight: 600; letter-spacing: -0.01em; }

/* --------------------------------------------------------------- site bar */

/* Added for the v1 deployment: a restrained return path to the portfolio
   homepage. Not sticky, so nothing about the existing scroll behaviour or
   section layout changes. */
.site-bar {
  background: var(--paper);
  border-bottom: 1px solid var(--rule-soft);
}
.site-bar__inner { display: flex; align-items: center; min-height: 56px; }
.site-bar__back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-decoration: none;
}
.site-bar__back span {
  font-family: var(--sans);
  font-size: 0.9em;
  color: var(--muted);
}
.site-bar__back:hover, .site-bar__back:hover span { color: var(--accent); }
