/* ------------------------------------------------------------------
   Grid system
   Everything on the page hangs off these tokens. The ten layouts at the
   bottom only move things between columns; case images always span the
   full grid width.
   ------------------------------------------------------------------ */
:root {
  --margin: 24px;          /* page edge to the grid: text and image panels share it */
  --gutter: 20px;          /* gap between columns */
  --stack: 12px;           /* vertical gap between stacked panels */
  --cols: 12;              /* column count */
  --text-start: 7;         /* column where running text starts */

  --site-max: 1920px;      /* same cap as works.pm; wider screens get white sides */

  --panel-h: auto;         /* desktop panels are 16:9 (debug menu: Panel) */
  --panel-ratio: 16 / 9;
  --panel-bg: #f1f2f6;
  --mockup-desktop: 1;     /* case image scale inside its panel (debug menu: Mockup) */
  --mockup-mobile: 2;
  --mockup: var(--mockup-desktop);
  --inset: 0.88;           /* desktop: mockups sit a little smaller, clear of the panel edges */
  --growth-zoom: var(--mockup);   /* zoom of the Growth spec canvas (scenes/growth.html) */

  --ink: #111114;
  --ink-soft: #8e8e93;
  --rule: #e7e7e9;
  --paper: #fff;

  --text-l: 28px;
  --lead-l: 40px;
  --text-s: 20px;           /* as works.pm: nav, captions and footer at 20/26 on desktop */
  --lead-s: 26px;
}

* { box-sizing: border-box; margin: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--text-s)/var(--lead-s) Inter, system-ui, sans-serif;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  max-width: var(--site-max);
  margin-inline: auto;
}

/* Past the cap, works.pm marks the page edges with grey hairlines. Off by
   default here; the debug menu's Edge lines switch turns them on. */
@media (min-width: 1921px) {
  .edge-lines body { box-shadow: -1px 0 var(--rule), 1px 0 var(--rule); min-height: 100vh; }
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--ink-soft); }
/* A link inside running text (Klaus Nygård on the LucaLuca page) is underlined so it reads as one. */
.intro-text p a, .case-story-text a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

h1, h2, p, dl, dd { font: inherit; margin: 0; }

.nowrap { white-space: nowrap; }   /* keeps the name on one line */

/* The grid. Text and image panels both start on its first column edge. */
.grid,
.case-meta,
.list-row {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gutter);
}
.grid { padding-inline: var(--margin); }

/* ------------------------------------------------------------------
   Base: shared by every layout
   ------------------------------------------------------------------ */
.nav {
  height: 80px;
  align-items: center;
}
.nav-name { grid-column: 1 / var(--text-start); }
.nav-links {
  grid-column: var(--text-start) / -1;
  display: flex;
  gap: 20px;
}

.intro {
  padding-top: 40px;
  padding-bottom: 200px;
}
.intro-text {
  grid-column: var(--text-start) / -1;
  max-width: 640px;
  font-size: var(--text-l);
  line-height: var(--lead-l);
  letter-spacing: -0.021em;
}
.intro-text p + p { margin-top: var(--lead-l); }

/* Case list: hidden unless a layout turns it on. */
.list { display: none; }
.list-row {
  grid-column: 1 / -1;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}
.list-row:last-child { border-bottom: 1px solid var(--rule); }

.work {
  display: grid;
  gap: var(--stack);
  padding-inline: var(--margin);
}

.case { position: relative; display: flex; flex-direction: column; }

.case-media {
  position: relative;
  height: var(--panel-h);
  aspect-ratio: var(--panel-ratio);
  background: var(--panel-bg);
  overflow: hidden;
  container-type: size;    /* lets a live prototype size itself to the panel */
}

/* A live, animated prototype in the panel (Wolt Support): the inbox chat with
   the courier's phone in front, laid out as on the samulinivala.com cover
   (covers/support-inbox.html, a 2400×1350 artboard). Only the part of that
   artboard the two devices cover is kept: 1842×1018, from x 243 / y 172.
   The scene script in index.html sets --k: the artboard scaled to a 16:9 area
   that fits the panel, times the Mockup size, capped so nothing is cropped. */
.case-scene {
  position: absolute;
  inset: 0;
  /* Behaves like an image: no text selection, no hover states, normal cursor. */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: default;
}
.case-scene .art { pointer-events: none; }

/* A screenshot or screen recording shown as a bare phone screen (LucaLuca),
   sized like the SweatCount screen in its image: 874/1080 of a 16:9 area that
   fits the panel, times the Mockup size, with the same rounded corners. */
.case-video,
.case-screen {
  position: absolute;
  left: 50%;
  top: 50%;
  height: calc(min(100cqh, 100cqw * 9 / 16) * 874 / 1080 * var(--mockup) * var(--inset));
  aspect-ratio: 402 / 874;
  translate: -50% -50%;
  border-radius: 13.7% / 6.3%;
  overflow: hidden;
  background: #fff;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}
.case-video video { display: block; width: 100%; height: 100%; object-fit: cover; }
.case-media img.case-screen {   /* outranks the full-panel image rule */
  width: auto;
  height: calc(min(100cqh, 100cqw * 9 / 16) * 874 / 1080 * var(--mockup) * var(--inset));
  object-fit: cover;
  transform: none;
  mix-blend-mode: normal;
}

/* A case with its own page: the whole panel opens it. */
.case-open { position: absolute; inset: 0; z-index: 3; }

/* A row of phone screens in one panel (the LucaLuca loading screens), after a
   slide of devices side by side: the screens share the width with gutters
   between them and never grow past the single-screen size. On phones the row
   scrolls sideways. */
.case-strip {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--gutter) * 2);    /* double gutter between the screens */
  padding: 0 calc(var(--gutter) * 2);
}
.case-strip .case-video {
  position: relative;
  left: auto;
  top: auto;
  translate: none;
  flex: 0 1 auto;
  width: auto;
  /* about 242px wide each at most, so the row reads as a set of small screens */
  height: min(calc(min(100cqh, 100cqw * 9 / 16) * 874 / 1080 * var(--inset)), (100cqw - 10 * var(--gutter)) / 4 * 874 / 402, 242px * 874 / 402);
}

/* Two screens side by side (the LucaLuca paywall and coins), as in the Figma
   frame: each the size of a single screen, a 7.5% gap between them. */
.case-strip--pair { gap: calc(min(100cqw, 100cqh * 16 / 9) * 0.075); }
.case-strip--pair .case-video {
  height: calc(min(100cqh, 100cqw * 9 / 16) * 874 / 1080 * var(--inset));
}
.case-media img.case-shot { width: auto; object-fit: cover; aspect-ratio: 402 / 874; transform: none; mix-blend-mode: normal; }

/* The Back link at the end of a case page, under the last panel. */
.case-end { padding-top: 24px; }
.case-end a { grid-column: 1 / var(--text-start); white-space: nowrap; }

/* A full-bleed image (Sports Tracker's brand images): fills the panel edge to
   edge, cropped to it, with no mockup scaling or blending. */
.case-media img.case-full {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: none;
  mix-blend-mode: normal;
}

/* A scene in its own page (Wolt Growth): fills the panel and, like an image,
   takes no clicks or selection. */
.case-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}
.case-scene .art {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1842px;
  height: 1018px;
  transform: translate(-50%, -50%) scale(var(--k, 0.5));
}
.case-scene .desk { position: absolute; left: 294px; top: 0; width: 1548px; }
.case-scene .desk .sm-frame { box-shadow: 0 0 0 1px #2d2d2f, 0 40px 100px rgba(0, 0, 0, 0.25); }
.case-scene .phone { position: absolute; left: 0; top: 263px; z-index: 2; --ps: 0.894; }
.case-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;     /* at scale 1 the whole image is visible */
  transform: scale(calc(var(--mockup) * var(--inset)));
  transform-origin: center;
  /* The case images come on white. Multiply lets the panel tint show through. */
  mix-blend-mode: multiply;
}

/* Caption default: a row on the grid under the panel.
   num | title | desc | tag  ->  col 1 | 2–6 | 7–11 | 12 */
.case-meta {
  padding: 12px 0 48px;
  align-items: baseline;
}
.case-num   { grid-column: 1 / 2;  color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.case-title { grid-column: 2 / 7;  font-weight: 500; }
.case-desc  { grid-column: 7 / 12; color: var(--ink-soft);
  max-width: 34em; }   /* about 65–70 characters a line, the comfortable reading measure */
.case-tag   { grid-column: 12 / -1; color: var(--ink-soft); text-align: right; }
.case-link  { display: none; }   /* only Thirds shows it for now */


/* ------------------------------------------------------------------
   Footer, after samulinivala.com: name and role, year, back to top,
   LinkedIn and X under a hairline on the grid. The year starts where the
   running text does (column 4 in Thirds).
   ------------------------------------------------------------------ */
.foot {
  margin-top: 160px;
  padding-bottom: 48px;
  row-gap: 24px;
}
.foot::before {                    /* the hairline, inside the page margin */
  content: "";
  grid-column: 1 / -1;
  height: 1px;
  margin-bottom: -4px;
  background: var(--rule);
}
.foot p      { grid-row: 2; }
.foot b      { font-weight: 500; }
.foot .mut   { color: var(--ink-soft); }
.foot-name   { grid-column: 1 / var(--text-start); }
.foot-year   { grid-column: var(--text-start) / span 2; }
.foot-social { grid-column: 9 / 11; }
.foot-top    { grid-column: 11 / -1; text-align: right; }   /* back to top on the right edge */

/* ------------------------------------------------------------------
   Case page (lucaluca.html): title and text in the text column, the
   facts in the first columns, then the panels as on the home page.
   ------------------------------------------------------------------ */
.page-case .intro { padding-bottom: 120px; }
/* no captions between the panels here, so they keep the stacking gap
   (Thirds and the phone layout set it to 0 on the home page) */
html[data-layout] .page-case .work { row-gap: var(--stack); }
.page-case .intro-text { grid-row: 1; }
.page-case .intro-text p { color: var(--ink-soft); margin-top: 0; }
.case-facts {
  grid-column: 1 / var(--text-start);
  grid-row: 1;
  align-self: start;
  padding-top: 10px;              /* first line on the title's baseline row */
  display: grid;
  row-gap: var(--lead-s);         /* a blank line between Back, the facts and the link */
}
.case-facts dl div { display: flex; gap: 0.35em; }

/* Story text between the panels of a case page: the text column, the reading measure. */
.case-story { padding: 72px var(--margin) 72px; }
.case-story-text { grid-column: var(--text-start) / -1; max-width: 34em; }
.case-story-text p + p { margin-top: var(--lead-s); }
.case-facts dt { color: var(--ink-soft); }
.case-facts dt::after { content: ":"; }

/* ------------------------------------------------------------------
   Grid overlay (press C)
   ------------------------------------------------------------------ */
.grid-overlay {
  position: fixed;
  inset: 0;
  max-width: var(--site-max);
  margin-inline: auto;
  pointer-events: none;
  display: none;
  z-index: 10;
}
.show-grid .grid-overlay { display: grid; }
.grid-overlay i {
  background: rgba(255, 0, 80, 0.06);
  box-shadow: inset 1px 0 rgba(255, 0, 80, 0.25), inset -1px 0 rgba(255, 0, 80, 0.25);
}

/* ==================================================================
   Layouts. Switch with the debug menu (D), arrow keys up/down,
   or keys 1–0 for the first ten.
   ================================================================== */

/* Shared pieces --------------------------------------------------- */

/* Nav links pushed to the right edge. */
[data-layout="split"] .nav-links,
[data-layout="display"] .nav-links,
[data-layout="centered"] .nav-links {
  grid-column: 7 / -1;
  justify-content: flex-end;
}

/* Caption laid over the panel, works.pm style. */
[data-layout="works"] .case-meta,
[data-layout="index"] .case-meta,
[data-layout="display"] .case-meta {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  gap: 0.35em;
  padding: 0 24px 20px;
}
[data-layout="works"] .case-meta .case-num,
[data-layout="index"] .case-meta .case-num,
[data-layout="display"] .case-meta .case-num { order: 9; margin-left: auto; }
[data-layout="works"] .case-meta .case-tag,
[data-layout="index"] .case-meta .case-tag,
[data-layout="display"] .case-meta .case-tag { display: none; }

/* 1 Works: the works.pm baseline. Text from column 7, caption on the image. */

/* 2 Split: intro on the left half, caption row under a 16:9 panel. */
[data-layout="split"] { --panel-h: auto; --panel-ratio: 16 / 9; }
[data-layout="split"] .intro-text { grid-column: 1 / 7; }
[data-layout="split"] .work { row-gap: 0; }
[data-layout="split"] .case-num   { grid-column: 12 / -1; grid-row: 1; text-align: right; }
[data-layout="split"] .case-title { grid-column: 1 / 7; grid-row: 1; }
[data-layout="split"] .case-desc  { grid-column: 7 / 12; grid-row: 1; }
[data-layout="split"] .case-tag   { display: none; }

/* 3 Display: one big statement across ten columns, caption on the image. */
[data-layout="display"] .nav-name { grid-column: 1 / 7; }
[data-layout="display"] .intro-text {
  grid-column: 1 / 11;
  max-width: none;
  font-size: 64px;
  line-height: 68px;
  letter-spacing: -0.035em;
}
[data-layout="display"] .intro-text p + p { margin-top: 0; color: var(--ink-soft); }

/* 4 Centered: intro over the middle six columns, centred captions. */
[data-layout="centered"] { --panel-h: auto; --panel-ratio: 16 / 9; }
[data-layout="centered"] .intro-text { grid-column: 4 / 10; max-width: none; text-align: center; }
[data-layout="centered"] .work { row-gap: 0; }
[data-layout="centered"] .case-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 64px;
}
[data-layout="centered"] .case-tag { display: none; }

/* 5 Ledger: column 1 is an index column. Ruled caption rows sit above
   each panel; small type throughout. */
[data-layout="ledger"] { --panel-h: auto; --panel-ratio: 16 / 9; }
[data-layout="ledger"] .nav-name { grid-column: 2 / 7; }
[data-layout="ledger"] .nav-links { grid-column: 7 / -1; }
[data-layout="ledger"] .intro { padding-bottom: 120px; }
[data-layout="ledger"] .intro-text {
  display: contents;
  font-size: var(--text-s);
  line-height: var(--lead-s);
  letter-spacing: inherit;
}
[data-layout="ledger"] .intro-text p { grid-column: 2 / 6; grid-row: 1; margin: 0; }
[data-layout="ledger"] .intro-text p + p { grid-column: 7 / 11; color: var(--ink-soft); }
[data-layout="ledger"] .work { row-gap: 64px; }
[data-layout="ledger"] .case-meta {
  order: -1;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}

/* 6 Index: works layout plus a ruled list of every case before the images. */
[data-layout="index"] .intro { padding-bottom: 120px; }
[data-layout="index"] .list { display: grid; padding-bottom: 120px; }

/* 7 Sticky: caption bar above each panel stays pinned while its image scrolls. */
[data-layout="sticky"] { --panel-h: calc(100vh - 48px); }
[data-layout="sticky"] .work { row-gap: 0; }
[data-layout="sticky"] .case-meta {
  order: -1;
  position: sticky;
  top: 0;
  z-index: 2;
  height: 48px;
  align-items: center;
  padding: 0;
  background: var(--paper);
}

/* 8 Compact: small type, the two intro sentences side by side,
   caption columns line up with the nav. */
[data-layout="compact"] .intro { padding-top: 0; padding-bottom: 120px; }
[data-layout="compact"] .intro-text {
  display: contents;
  font-size: var(--text-s);
  line-height: var(--lead-s);
  letter-spacing: inherit;
}
[data-layout="compact"] .intro-text p { grid-column: 7 / 10; grid-row: 1; margin: 0; }
[data-layout="compact"] .intro-text p + p { grid-column: 10 / -1; color: var(--ink-soft); }
[data-layout="compact"] .work { row-gap: 0; }
[data-layout="compact"] .case-title { grid-column: 1 / 7; grid-row: 1; }
[data-layout="compact"] .case-desc  { grid-column: 7 / 10; grid-row: 1; }
[data-layout="compact"] .case-tag   { grid-column: 10 / 12; grid-row: 1; text-align: left; }
[data-layout="compact"] .case-num   { grid-column: 12 / -1; grid-row: 1; text-align: right; }

/* 9 Thirds: text starts at column 4 (a quarter in; works.pm uses a third on
   smaller screens). Caption under the panel on the same split. */
:is([data-layout="thirds"], [data-layout="topline"]) { --text-start: 4; }
:is([data-layout="thirds"], [data-layout="topline"]) .work { row-gap: 0; }
:is([data-layout="thirds"], [data-layout="topline"]) .case-title { grid-column: 1 / var(--text-start); grid-row: 1; }
:is([data-layout="thirds"], [data-layout="topline"]) .case-desc  { grid-column: var(--text-start) / 11; grid-row: 1; }
:is([data-layout="thirds"], [data-layout="topline"]) .case-num,
:is([data-layout="thirds"], [data-layout="topline"]) .case-tag   { display: none; }
/* The right column holds the case link (App Store) instead of the number. */
:is([data-layout="thirds"], [data-layout="topline"]) .case-link  { display: block; grid-column: 11 / -1; grid-row: 1; text-align: right; }

/* 21 Top line: Thirds, with the intro sentence moved up into the nav row in the
   nav's small type, in place of the Work and About links. The default. */
.nav-line { display: none; }
[data-layout="topline"] .nav-links { display: none; }
/* The big intro keeps its room, so the first case starts as low as before; only its words go. */
[data-layout="topline"] .intro--home { visibility: hidden; }
[data-layout="topline"] .nav-line { display: block; grid-column: 1 / -1; margin: 0; }   /* top left: the name is gone on the home page */
/* Top line: no name top left. Case pages put Back there instead, so the Back above the facts goes. */
.nav-back { display: none; }
[data-layout="topline"] .nav-name { display: none; }
[data-layout="topline"] .nav-back { display: block; grid-column: 1 / var(--text-start); }
[data-layout="topline"] .case-back { display: none; }

/* 10 Chapters: each case opens with a large heading, like a book chapter. */
[data-layout="chapters"] .intro { padding-bottom: 80px; }
[data-layout="chapters"] .intro-text {
  grid-column: 1 / 9;
  max-width: none;
  font-size: 44px;
  line-height: 52px;
  letter-spacing: -0.03em;
}
[data-layout="chapters"] .intro-text p + p { margin-top: 0; color: var(--ink-soft); }
[data-layout="chapters"] .work { row-gap: 0; }
[data-layout="chapters"] .case-meta {
  order: -1;
  padding: 120px 0 24px;
  font-size: var(--text-l);
  line-height: var(--lead-l);
  letter-spacing: -0.021em;
}
[data-layout="chapters"] .case-num   { grid-column: 1 / 7; grid-row: 1 / 3; }
[data-layout="chapters"] .case-title { grid-column: 7 / -1; grid-row: 1; font-weight: 400; }
[data-layout="chapters"] .case-desc  { grid-column: 7 / -1; grid-row: 2; }
[data-layout="chapters"] .case-tag   { display: none; }

/* 11 Hero: the intro sits at the bottom of the first screen, so the page
   opens on white space and the first image starts just below the fold. */
[data-layout="hero"] .intro {
  min-height: calc(100vh - 80px);
  align-content: end;
  padding-bottom: 48px;
}
[data-layout="hero"] .case-meta,
[data-layout="masthead"] .case-meta {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  gap: 0.35em;
  padding: 0 24px 20px;
}
[data-layout="hero"] .case-meta .case-num,
[data-layout="masthead"] .case-meta .case-num { order: 9; margin-left: auto; }
[data-layout="hero"] .case-meta .case-tag,
[data-layout="masthead"] .case-meta .case-tag { display: none; }

/* 12 Quiet: small intro straight under the nav, caption rows under panels. */
[data-layout="quiet"] .intro { padding-top: 0; padding-bottom: 120px; }
[data-layout="quiet"] .intro-text {
  grid-column: 7 / 10;
  font-size: var(--text-s);
  line-height: var(--lead-s);
  letter-spacing: inherit;
}
[data-layout="quiet"] .work { row-gap: 0; }

/* 13 Right: everything hangs from the right edge. */
[data-layout="right"] .nav-links { grid-column: 7 / -1; justify-content: flex-end; }
[data-layout="right"] .intro-text { grid-column: 7 / -1; justify-self: end; text-align: right; }
[data-layout="right"] .work { row-gap: 0; }
[data-layout="right"] .case-meta {
  display: flex;
  justify-content: flex-end;
  gap: 0.35em;
}
[data-layout="right"] .case-meta .case-num { order: -1; margin-right: auto; }
[data-layout="right"] .case-meta .case-tag { display: none; }

/* 14 Masthead: the name set huge across the full width. */
[data-layout="masthead"] .nav { height: auto; padding-top: 28px; row-gap: 40px; }
[data-layout="masthead"] .nav-links { grid-row: 1; }
[data-layout="masthead"] .nav-name {
  grid-column: 1 / -1;
  grid-row: 2;
  /* Sized to fill the grid: the name is about 5.7 times its font size wide. */
  font-size: calc((min(100vw, var(--site-max)) - 2 * var(--margin)) * 0.172);
  line-height: 1;
  white-space: nowrap;
  letter-spacing: -0.05em;
  margin-left: -0.05em;      /* optical: pull the N onto the column edge */
}
[data-layout="masthead"] .intro { padding-top: 48px; }

/* 15 Corners: title, number, description and tag in the four corners
   of the panel. */
[data-layout="corners"] .case-meta {
  position: absolute;
  inset: 0;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr auto;
  padding: 20px 24px;
  pointer-events: none;
}
[data-layout="corners"] .case-title { grid-column: 1; grid-row: 1; }
[data-layout="corners"] .case-num   { grid-column: 2; grid-row: 1; text-align: right; }
[data-layout="corners"] .case-desc  { grid-column: 1; grid-row: 3; }
[data-layout="corners"] .case-tag   { grid-column: 2; grid-row: 3; }

/* 16 Cinema: letterbox panels at 21:9, caption row underneath. */
[data-layout="cinema"] { --panel-h: auto; --panel-ratio: 21 / 9; }
[data-layout="cinema"] .work { row-gap: 0; }

/* 17 Numeral: a huge case number on the image, title beside it. */
[data-layout="numeral"] .case-meta {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  padding: 0 24px 24px;
}
[data-layout="numeral"] .case-num {
  font-size: 160px;
  line-height: 0.8;
  letter-spacing: -0.06em;
  margin-right: 0.15em;
}
[data-layout="numeral"] .case-tag { display: none; }

/* 18 Large captions: captions at intro size, title and description
   split across the two halves. */
[data-layout="large"] .work { row-gap: 0; }
[data-layout="large"] .case-meta {
  padding: 16px 0 96px;
  font-size: var(--text-l);
  line-height: var(--lead-l);
  letter-spacing: -0.021em;
}
[data-layout="large"] .case-title { grid-column: 1 / 7; font-weight: 400; }
[data-layout="large"] .case-desc  { grid-column: 7 / -1; }
[data-layout="large"] .case-num,
[data-layout="large"] .case-tag   { display: none; }

/* 19 Aligned: the caption sits under the intro column, number on the left. */
[data-layout="aligned"] .work { row-gap: 0; }
[data-layout="aligned"] .case-meta { padding: 16px 0 96px; }
[data-layout="aligned"] .case-num   { grid-column: 1 / 7; grid-row: 1; }
[data-layout="aligned"] .case-title { grid-column: 7 / -1; grid-row: 1; }
[data-layout="aligned"] .case-desc  { grid-column: 7 / -1; grid-row: 2; }
[data-layout="aligned"] .case-tag   { display: none; }

/* 20 Mono: monospaced type everywhere, uppercase labels. */
[data-layout="mono"] body {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0;
}
[data-layout="mono"] .nav,
[data-layout="mono"] .case-meta { text-transform: uppercase; }
[data-layout="mono"] .intro-text { font-size: 24px; line-height: 32px; letter-spacing: -0.02em; }
[data-layout="mono"] .case-title { font-weight: 400; }
[data-layout="mono"] .work { row-gap: 0; }

/* Panel shape on desktop (debug menu: Panel). 16:9 is the default above;
   "full" makes panels as tall as the window, less room for the caption.
   The phone rules below still win. */
html[data-panel="full"]  { --panel-h: calc(100vh - var(--stack) - 100px); --panel-ratio: auto; }
html[data-panel="16:10"] { --panel-h: auto; --panel-ratio: 16 / 10; }

/* ------------------------------------------------------------------
   Small screens: every layout folds to one column.
   html[data-layout] outranks the layout rules above.
   ------------------------------------------------------------------ */
@media (max-width: 760px) {
  :root {
    --margin: 12px;
    --mockup: var(--mockup-mobile);
    --inset: 1;
    --growth-zoom: 1.6;           /* the spec row fills the low 4:3 phone panel as it does on desktop */
  }
  /* One type size on phones: the large size falls back to the small one. */
  html[data-layout] {
    --text-s: 16px;
    --lead-s: 24px;
    --text-l: var(--text-s);
    --lead-l: var(--lead-s);
  }
  html[data-layout] body { font-size: var(--text-s); line-height: var(--lead-s); }
  html[data-layout] { --text-start: 1; --panel-h: auto; --panel-ratio: 4 / 5; }
  /* A wide UI (the inbox) gets a landscape panel, so it is not lost in grey. */
  html[data-layout] .case--wide { --panel-ratio: 4 / 3; }
  /* full-bleed images keep their own 16:10 shape instead of a tall crop */
  html[data-layout] .case--image { --panel-ratio: 16 / 10; }
  html[data-layout] .case--169 { --panel-ratio: 16 / 9; }   /* a 16:9 image keeps its shape */
  html[data-layout] .nav { height: 64px; }
  html[data-layout] .nav-name {
    grid-column: 1 / 7;
    grid-row: auto;
    margin: 0;
    font-size: inherit;
    line-height: inherit;
    letter-spacing: inherit;
  }
  html[data-layout] .nav-links { grid-column: 7 / -1; grid-row: auto; justify-content: flex-end; }
  /* Top line: the name and the sentence stack, and the row grows to hold them. */
  html[data-layout="topline"] .nav { height: auto; padding-top: 20px; padding-bottom: 24px; align-items: start; }
  html[data-layout="topline"] .nav-back,
  html[data-layout="topline"] .nav-line { grid-column: 1 / -1; }
  html[data-layout] .intro { min-height: 0; padding-top: 24px; padding-bottom: 96px; }
  html[data-layout] .intro-text {
    display: block;
    grid-column: 1 / -1;
    justify-self: stretch;
    text-align: left;
    font-size: var(--text-l);
    line-height: var(--lead-l);
    letter-spacing: inherit;
  }
  html[data-layout] .intro-text p + p { margin-top: var(--lead-l); }
  html[data-layout] .list { padding-bottom: 96px; }
  html[data-layout] .list-row .case-desc { display: none; }
  html[data-layout] .list-row .case-title { grid-column: 2 / 11; }
  html[data-layout] .work { row-gap: 0; }
  html[data-layout] .case-meta {
    position: static;
    order: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;           /* title and link on one line, description under them */
    align-items: baseline;
    gap: 0 0.35em;
    height: auto;
    padding: 12px 0 40px;
    border: 0;
    font-size: var(--text-s);
    line-height: var(--lead-s);
    letter-spacing: inherit;
  }
  html[data-layout] .case-meta .case-num {
    order: 9;
    margin: 0 0 0 auto;
    font-size: inherit;
    line-height: inherit;
    letter-spacing: inherit;
  }
  html[data-layout] .case-meta .case-desc {
    display: block;
    order: 20;
    flex-basis: 100%;
    font-size: inherit;
    text-align: left;
  }
  html[data-layout] .case-meta .case-tag { display: none; }
  /* title, description, then the link on its own line, all on the left */
  html:is([data-layout="thirds"], [data-layout="topline"]) .case-meta .case-link { order: 30; flex-basis: 100%; text-align: left; }
  /* the row of screens scrolls sideways, two and a bit at a time */
  html[data-layout] .case-strip { gap: var(--gutter); justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 var(--gutter); scrollbar-width: none; }
  html[data-layout] .case-strip::-webkit-scrollbar { display: none; }
  html[data-layout] .case-strip .case-video { flex: none; height: 80%; scroll-snap-align: center; }
  html[data-layout] .case-media--strip .case-video { pointer-events: auto; }
  /* the pair fits side by side: centred, no scrolling */
  html[data-layout] .case-strip--pair { justify-content: center; overflow: visible; padding: 0; scroll-snap-type: none; }
  html[data-layout] .case-strip--pair .case-video { height: 72%; }
  html[data-layout] .case-story { padding-block: 40px; }
  html[data-layout] .case-story-text { grid-column: 1 / -1; }
  /* case page: facts under the text */
  html[data-layout] .case-end a { grid-column: 1 / -1; }   /* text-start is column 1 here, so span the row */
  /* Back above the case text, the facts and link under it */
  html[data-layout] .case-facts { display: contents; }
  html[data-layout] .case-facts > * { grid-column: 1 / -1; }
  html[data-layout] .case-back { grid-row: 1; margin-bottom: 24px; }
  html[data-layout] .page-case .intro-text { grid-row: 2; }
  html[data-layout] .case-facts dl { grid-row: 3; margin-top: 24px; }
  html[data-layout] .case-facts dl ~ a { grid-row: 4; margin-top: 24px; }
  /* footer: two by two */
  html[data-layout] .foot { margin-top: 96px; padding-bottom: 32px; }
  html[data-layout] .foot-name   { grid-column: 1 / 7;  grid-row: 2; }
  html[data-layout] .foot-year   { grid-column: 7 / -1; grid-row: 2; }
  /* as on samulinivala.com: name and year on top, then Back to top under the name and the links under the year */
  html[data-layout] .foot-top    { grid-column: 1 / 7;  grid-row: 3; text-align: left; }
  html[data-layout] .foot-social { grid-column: 7 / -1; grid-row: 3; }
}

/* The Wolt Growth case is hidden for now (class on <html>); Debug menu → Growth → Show brings it back. */
.hide-growth #case-03,
.hide-growth .list-row[href="#case-03"] { display: none; }
