/* ============================================================
   case.css — Shared layout + typography for case-study pages
   ------------------------------------------------------------
   Pulls the same design language as home-v8.css:
     - VT323 for the H1 marquee (--font-display)
     - system-ui sans for h2/h3/subtitle/meta values (--font-heading)
     - Inter for body copy (--font-body)
     - JetBrains Mono for eyebrows + back link (--font-mono)
   on the cream canvas defined by tokens.css. Self-contained:
   does not depend on home-v8.css. Pair this with:
       <link rel="stylesheet" href="../nav.css">
       <link rel="stylesheet" href="../case.css">
       <link rel="stylesheet" href="../tokens.css">
   tokens.css must come last so --site-bg wins.
   No serif fonts. The design system uses VT323 for display,
   system-ui sans for headings, Inter for body, JetBrains Mono
   for mono — and nothing else.
   ============================================================ */

:root {
  /* Brand */
  --primary:        #1F4D3A;
  --primary-active: #143426;
  --primary-soft:   #B4CDC0;

  /* Ink scale */
  --ink:            #141413;
  --body-strong:    #252523;
  --body:           #3d3d3a;
  --muted:          #6c6a64;
  --muted-soft:     #8e8b82;

  /* Surface */
  --canvas:         #fcfcfb;
  --surface-soft:   #f4f3ee;
  --surface-card:   #ece9e0;
  --hairline:       #e7e3da;
  --hairline-soft:  #eeebe3;

  /* Layout */
  --pad-page:       24px;
  --max-w:          1200px;
  --read-w:         720px;

  /* Per-case theming — overridden inline in each page <body style="..."> */
  --case-grad:      linear-gradient(135deg, #181715, #2a2725, #423d36);
  --case-accent:    var(--primary);
}

@media (min-width: 768px)  { :root { --pad-page: 48px; } }
@media (min-width: 1200px) { :root { --pad-page: 72px; } }

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--body);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--primary-soft); color: var(--ink); }

a { color: inherit; text-decoration: none; transition: color .15s ease, opacity .15s ease; }
p { margin: 0; text-wrap: pretty; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; color: var(--ink); }
em { font-style: italic; }

/* Heading family — used for everything except the H1 marquee. */
.case h2, .case h3,
.case__subtitle,
.case__sub-title {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.012em;
}

/* ============================================================
   Header / back link
   ============================================================ */

.case__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 56px;
  transition: color .15s ease, transform .15s ease;
}
.case__back:hover {
  color: var(--case-accent);
  transform: translateX(-2px);
}

/* ============================================================
   Header block
   ============================================================ */

.case {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 64px var(--pad-page) 0;
}

.case__title {
  font-family: var(--font-heading);
  font-size: clamp(44px, 5.6vw, 72px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
  max-width: 18ch;
  margin: 0 0 20px;
}

.case__subtitle {
  font-size: clamp(20px, 2vw, 24px);
  line-height: 1.45;
  color: var(--muted);
  max-width: 56ch;
  font-style: normal;
  font-weight: 400;
  margin: 0 0 56px;
}

/* ============================================================
   Meta strip — Role / Timeline / Platform / Scope / Team
   ============================================================ */

.case__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 28px;
  padding: 28px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.case__meta-item label {
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.case__meta-item span {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: -0.005em;
  color: var(--ink);
}

/* ============================================================
   Hero visual & inline visuals — gradient blocks with caption
   ============================================================ */

.case__hero {
  width: 100%;
  aspect-ratio: 16 / 7;
  margin: 64px 0 0;
  background: var(--case-grad);
  border-radius: 0;
  position: relative;
  overflow: hidden;
}
/* When a real <img> or <video> is supplied, it covers the full block.
   The brand gradient stays underneath as a fallback / letterbox tint. */
.case__hero img,
.case__hero video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
/* When the hero is a video, match the video's native aspect ratio so
   nothing gets cropped top/bottom by the default 16/7 frame. The dark
   gradient backdrop is suppressed and the video overscans by 1px to
   prevent sub-pixel rounding from exposing the backdrop as a hairline. */
.case__hero--video {
  aspect-ratio: 1792 / 960;
  background: transparent;
}
.case__hero--video video {
  inset: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
}

.case__visual {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 32px 0;
  border-radius: 0;
  background: var(--case-grad);
  filter: saturate(0.9);
  position: relative;
  overflow: hidden;
}
/* When a real image/video is supplied via .case__visual--photo,
   the asset already carries its own art direction, so we drop the
   saturate filter. The asset crops to fill the frame (object-fit:
   cover, inherited from the generic .case__visual img/video rule
   below) — no dark letterbox bars. Assets are expected to have
   safe-area padding around their central content.
   Need letterbox instead? Add .case__visual--contain explicitly. */
.case__visual--photo {
  filter: none;
  background: #0a0a0a;
}
/* Wider variant for compositions that read better in a panoramic
   slot (e.g. scattered toasts, wide diagrams). */
.case__visual--wide {
  aspect-ratio: 16 / 7;
}
/* Use when the asset is portrait/near-square and you want the whole
   thing visible (no top/bottom crop). The block's background colour
   should be set inline to match the asset's own background so the
   side letterboxing reads as intentional canvas. */
.case__visual.case__visual--contain img,
.case__visual.case__visual--contain video {
  object-fit: contain;
}
/* Slide variant — used when dropping a full 16:9 deck slide into the
   reading column. Keeps the slide's original art direction intact:
   no saturate filter, soft cream backdrop (visible only at responsive
   crops), and object-fit: cover so the slide reaches every edge. */
.case__visual--slide {
  filter: none;
  background: var(--surface-soft);
}
.case__visual--slide img,
.case__visual--slide video {
  object-fit: cover;
}
.case__visual img,
.case__visual video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Figure block — wraps .case__visual when an accompanying caption is
   useful (e.g. labeling a deck slide, navigation concept, or chart). */
.case__figure {
  margin: 32px 0;
}
.case__figure .case__visual { margin: 0; }

/* Editorial breakout: inline figures and standalone visuals inside the
   reading column escape the 720px text width and span the full content
   width (--max-w, ~1200px) — same width as the hero at the top of the
   page. Body text stays narrow for readability, but assets get
   editorial weight. The margin-left: 50% + translateX(-50%) pair
   centers the figure on the PAGE rather than the column; on viewports
   narrower than --max-w the figure naturally collapses to whatever
   width the viewport allows, so it never overflows. */
.case__body .case__figure,
.case__body > .case__visual {
  width: min(var(--max-w), calc(100vw - 2 * var(--pad-page)));
  margin-left: 50%;
  transform: translateX(-50%);
}
/* Figure caption — editorial voice. Italic, lowercase, muted —
   visually distinct from the bold-sans section titles above
   and from the regular-sans body copy that surrounds it. */
.case__figure figcaption {
  display: block;
  margin: 12px 2px 0;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  line-height: 1.55;
}

/* ============================================================
   Long-form reading column
   ============================================================ */

.case__body {
  max-width: var(--read-w);
  margin: 0 auto;
  padding: 0 var(--pad-page) 0;
}

.case__section-title {
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 72px 0 18px;
}

.case__sub-title {
  font-size: 26px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--ink);
  margin: 36px 0 12px;
  letter-spacing: -0.005em;
}

.case__body p {
  font-size: 17px;
  line-height: 1.75;
  color: var(--body);
  margin-bottom: 16px;
}

.case__body ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}
.case__body ul li {
  font-size: 17px;
  line-height: 1.7;
  color: var(--body);
  padding-left: 18px;
  position: relative;
  margin-bottom: 10px;
}
.case__body ul li::before {
  content: '•';
  position: absolute;
  left: 4px;
  top: 0;
  font-size: 1em;
  line-height: 1.7;
  color: var(--muted-soft);
}

/* ============================================================
   Impact grid (4 stat cards w/ emoji)
   ============================================================ */

.case__impact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0 8px;
}
.case__impact-item {
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 22px 24px;
}
/* Impact tile icons — pixel-art SVGs (12x12 viewBox, crispEdges),
   matching the home page's cs-stats__ico language. Rendered at 28px
   so the pixel grid has enough breathing room for the shapes to be
   recognisable (smaller sizes turn dot-and-frame motifs into mush).
   image-rendering: pixelated keeps the squares hard-edged on retina
   displays where the browser would otherwise interpolate. The emoji
   fallback size is kept for any tile still using an emoji glyph. */
.case__impact-icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 12px;
  color: var(--ink);
}
.case__impact-icon svg {
  display: block;
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
}
.case__impact-item p {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
  font-weight: 450;
}

/* ============================================================
   Press strip — "as featured in", a stack of clickable cards
   under a hairline. Sits near the bottom of a case page, before
   skills/pagination. Each item is an external link.
   ============================================================ */

.case__press {
  margin: 56px 0 0;
}
/* Eyebrow uses the same type as .case__section-title ("My role", etc.)
   so the press strip sits inside the same heading hierarchy as the
   rest of the page rather than looking like a styled callout. */
.case__press-eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 18px;
}
.case__press-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Suppress the inherited em-dash bullet from .case__body ul li::before */
.case__press-list li::before {
  content: none !important;
  display: none !important;
}
.case__press-list li {
  margin: 0;
  padding: 0;
}

/* Each press card spans the full width of the content block. Flat
   background + sharp corners + plain hairline border = quiet row that
   sits inside the body grid rather than reading as a separate
   component. No gradient, no shadow, no rounded corners. */
.case__press-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  box-sizing: border-box;
  padding: 18px 22px;
  border: 1px solid var(--hairline);
  border-radius: 0;
  background: var(--surface-soft);
  color: var(--body);
  text-decoration: none;
  transition:
    border-color .25s ease,
    color .25s ease;
}

.case__press-item:hover,
.case__press-item:focus-visible {
  border-color: var(--ink);
  color: var(--ink);
  outline: none;
}

.case__press-outlet {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--hairline);
  transition: border-color .25s ease;
}
.case__press-item:hover .case__press-outlet,
.case__press-item:focus-visible .case__press-outlet {
  border-bottom-color: var(--ink);
}

.case__press-item em {
  font-style: normal;
  color: var(--body);
  letter-spacing: 0.005em;
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  line-height: 1.5;
}
.case__press-item:hover em,
.case__press-item:focus-visible em {
  color: var(--body-strong);
}

/* Plain diagonal arrow glyph — no badge, no circle, no fill. Matches
   the bare ↗ language used on the home carousel cards. Nudges up and
   to the right on hover so the affordance is still legible. */
.case__press-go {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  transition:
    color .25s ease,
    transform .25s cubic-bezier(.2, .7, .2, 1);
}
.case__press-item:hover .case__press-go,
.case__press-item:focus-visible .case__press-go {
  color: var(--ink);
  transform: translate(2px, -2px);
}

@media (max-width: 540px) {
  .case__press-item {
    flex-wrap: wrap;
    padding: 14px 16px;
    gap: 10px 14px;
  }
  .case__press-item em {
    flex: 1 0 100%;
    order: 3;
    font-size: 13.5px;
  }
  .case__press-go {
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .case__press-go { transition: color .15s ease; }
  .case__press-item:hover .case__press-go,
  .case__press-item:focus-visible .case__press-go { transform: none; }
}

/* ============================================================
   Skills pill bar
   ============================================================ */

.case__skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 32px 0 0;
}
.case__skills span {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 7px 12px;
  background: var(--surface-soft);
  border-radius: 999px;
  color: var(--muted);
}

/* ============================================================
   Pagination — prev / next case
   ============================================================ */

.case__pagination {
  max-width: var(--max-w);
  margin: 96px auto 0;
  padding: 32px var(--pad-page) 0;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  gap: 24px;
}
.case__pagination a {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.012em;
  color: var(--ink);
  line-height: 1.25;
  transition: color .2s ease, transform .2s ease;
}
.case__pagination a small {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color .2s ease;
}
.case__pagination a:hover { color: var(--case-accent); }
.case__pagination a:hover small { color: var(--case-accent); }
.case__pagination .pg-prev:hover { transform: translateX(-2px); }
.case__pagination .pg-next:hover { transform: translateX(2px); }
.case__pagination .pg-next { text-align: right; align-items: flex-end; }
.case__pagination .pg-spacer { flex: 1; }

/* ============================================================
   Footer
   ============================================================ */

.case__foot {
  max-width: var(--max-w);
  margin: 64px auto 0;
  padding: 40px var(--pad-page) 56px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.case__foot a {
  color: var(--ink);
  font-weight: 600;
  transition: color .15s ease, transform .15s ease;
}
.case__foot a:hover {
  color: var(--case-accent);
  transform: translateX(2px);
}

/* ============================================================
   Vision badge — "VISION · LOCKED" eyebrow above case title
   ============================================================ */

.case__badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 6px 14px 6px 12px;
  border-radius: 999px;
  background: rgba(31, 77, 58, 0.08);
  color: var(--case-accent);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
/* Pixel-art padlock — same silhouette used in the case-lock form below,
   sized to match the badge's mono cap height so the icon sits on the
   same optical baseline as the text. */
.case__badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  color: var(--case-accent);
  flex: none;
}
.case__badge-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ============================================================
   Poster hero — used when a case has no hero image yet (vision work)
   ============================================================ */

.case__hero--poster {
  aspect-ratio: 16 / 7;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(180, 205, 192, 0.18), transparent 60%),
    radial-gradient(120% 90% at 0% 100%, rgba(255, 255, 255, 0.05), transparent 55%),
    var(--case-grad);
}
.case__hero-poster {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 32px;
  text-align: center;
  color: #fff;
}
.case__hero-poster__eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.case__hero-poster__title {
  font-family: 'VT323', ui-monospace, monospace;
  font-size: clamp(48px, 6vw, 96px);
  line-height: 1;
  color: #f4eeff;
}
.case__hero-poster__title em {
  font-style: normal;
  color: #B4CDC0;
}
.case__hero-poster__cap {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

/* ============================================================
   Case lock — quiet password gate for vision work.
   Small, centred, mostly whitespace — the page badge + locked rail
   card already announce the state, so this just needs to take input.
   ============================================================ */

.case-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 320px;
  margin: 80px auto 24px;
  padding: 0;
  text-align: center;
}
.case-lock__icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--muted-soft);
}
.case-lock__icon svg {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.case-lock__form {
  display: flex;
  align-items: stretch;
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--canvas);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.case-lock__form:focus-within {
  border-color: var(--case-accent);
  box-shadow: 0 0 0 3px rgba(31, 77, 58, 0.12);
}
.case-lock__input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 14px;
  outline: none;
}
.case-lock__input::placeholder { color: var(--muted-soft); }
.case-lock__submit {
  flex: 0 0 auto;
  padding: 0 14px;
  border: 0;
  border-left: 1px solid var(--hairline);
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}
.case-lock__submit:hover {
  color: var(--case-accent);
  background: rgba(31, 77, 58, 0.06);
}
.case-lock__contact {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-soft);
  transition: color .15s ease;
}
.case-lock__contact:hover { color: var(--case-accent); }
.case-lock__error {
  margin: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #b3261e;
}

.case-lock.is-shaking {
  animation: case-lock-shake 0.42s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes case-lock-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}
@media (prefers-reduced-motion: reduce) {
  .case-lock.is-shaking { animation: none; }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
  .case { padding: 48px var(--pad-page) 0; }
  .case__back { margin-bottom: 36px; }
  .case__subtitle { margin-bottom: 36px; }
  .case__hero { aspect-ratio: 4 / 3; margin-top: 40px; }
  .case__hero--video { aspect-ratio: 1792 / 960; }
  .case__hero--poster { aspect-ratio: 4 / 3; }
  .case__visual { aspect-ratio: 4 / 3; }
  .case__impact { grid-template-columns: 1fr; }
  .case__pagination { flex-direction: column; gap: 24px; }
  .case__pagination .pg-next { text-align: left; align-items: flex-start; }
  .case-lock { margin-top: 56px; }
}
