/*
  TEST — grid layout, from Davis's sketch. Not used by the live site.
  Same treatment as test-dmcg: Neue Haas Grotesk Text (Helvetica fallback),
  black and white only. Small type: 12px (9pt) body, 13px (10pt) for the
  header, titles and footer. The intro is the one large thing on the page.

  Grid: 12 columns, 60px margins and 24px gutters on desktop
  (32 / 24 on tablets, 16 / 16 on phones), matching the web template IDML.
  Each project row puts its words in columns 1–3 (1–4 on tablets) and its
  pictures in the rest; the vertical rule sits at the end of the gutter
  after the words, with extra space (--inset) between the words and the rule.
*/

/* Neue Haas Grotesk Text, from the copy installed on this Mac (local() only —
   the desktop licence doesn't cover serving the font files on the web). */
@font-face {
  font-family: 'NHG Text';
  font-weight: 400;
  src: local('Haas Grot Text 55 Roman'), local('HaasGrotText-55Roman'),
       local('Neue Haas Grotesk Text Pro 55 Roman'), local('NHaasGroteskTXPro-55Rg');
}
@font-face {
  font-family: 'NHG Text';
  font-weight: 700;
  src: local('Haas Grot Text 75 Bold'), local('HaasGrotText-75Bold'),
       local('Neue Haas Grotesk Text Pro 75 Bold'), local('NHaasGroteskTXPro-75Bd');
}

:root {
  /* Inverted: white type on black. One deliberate dark look, so no light theme. */
  color-scheme: dark;          /* dark scrollbars and video controls */
  --paper: #000000;
  --ink: #ffffff;
  --ink-60: #9a9a9a;           /* secondary text: 7.4:1 on black */
  --ink-15: #3a3a3a;           /* hairlines */
  --wait: #1a1a1a;             /* behind a picture while it loads */
  --sans: 'NHG Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --t-body: 12px;  --l-body: 15px;   /* 9pt */
  --t-label: 13px; --l-label: 16px;  /* 10pt */

  --m: 60px;                   /* page margin */
  --g: 24px;                   /* gutter */
  --rule: 1px solid var(--ink);
  --inset: 48px;               /* words to the dividing rule */
  --strip-h: min(34vw, 62vh);  /* height of the picture strip */
}

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

body {
  margin: 0;
  container-type: inline-size; /* 100cqw = page width without the scrollbar */
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-body)/var(--l-body) var(--sans);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--ink-60); }
p, h1, h2, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.skip { position: absolute; left: var(--m); top: -100px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 12px; }
.skip:focus { top: 12px; }

/* One column width, from the 12-column grid */
body {
  --col: calc((100cqw - 2 * var(--m) - 11 * var(--g)) / 12);
  /* The words column used on every page: margin + columns 1–3 + a gutter */
  --side: calc(var(--m) + 3 * var(--col) + 3 * var(--g));
}

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

.masthead {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; /* clears a phone's status bar when shared */
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--g);
  align-items: center;
  height: 56px;
  padding: 0 var(--m);
  background: var(--paper);
  border-bottom: var(--rule);
  font: 700 var(--t-label)/var(--l-label) var(--sans);
}
.brand { grid-column: 1 / 5; display: inline-flex; align-items: center; gap: 10px; justify-self: start; }
.brand svg { height: 22px; width: auto; display: block; }

/* Nav: flush right, each link after a slash */
.nav { grid-column: 5 / 13; justify-self: end; display: flex; gap: calc(var(--g) * 2); }
.nav a::before { content: '/'; font-weight: 400; margin-right: 4px; }
.nav a[aria-current] { color: var(--ink-60); }

/* ---------- Intro ---------- */

.intro {
  padding: 56px var(--m) 64px;
  font: 700 clamp(28px, 3.6vw, 56px)/1.08 var(--sans);
  letter-spacing: -0.01em;
}

/* ---------- Project rows ---------- */

#projects:focus { outline: none; }

.project {
  display: grid;
  /* words: margin + columns 1–3 + a gutter | pictures: the rest */
  grid-template-columns: var(--side) 1fr;
  border-top: var(--rule);
}
.projects > li:last-child .project { border-bottom: var(--rule); }

.project__text {
  display: flex; flex-direction: column;
  padding: 40px var(--inset) 40px var(--m);
  border-right: var(--rule);
}
.project__head {
  display: flex; justify-content: space-between; gap: var(--g);
  font: 700 var(--t-label)/var(--l-label) var(--sans);
}
.project__year { color: var(--ink-60); font-weight: 400; }
.project__summary { margin-top: 32px; max-width: 36em; }
.project__more { margin-top: 16px; }
.project__more a { text-decoration: underline; text-underline-offset: 2px; }

/* Tags: three to a row, on the column grid inside the words */
.project__tags {
  margin-top: auto; padding-top: 40px;
  display: grid; grid-template-columns: repeat(3, 1fr); column-gap: var(--g);
  color: var(--ink-60);
}

/* Pictures: one sideways strip, running off the right edge */
.strip {
  display: flex; gap: var(--g);
  padding: 40px 0 40px var(--g);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
}
.strip::after { content: ''; flex: 0 0 calc(var(--m) - var(--g)); } /* right margin at the end */
.strip > * { flex: 0 0 auto; scroll-snap-align: start; scroll-margin-left: var(--g); }
.strip img, .strip video {
  display: block;
  height: var(--strip-h);
  width: auto;
  background: var(--wait); /* only while loading */
}
.strip video { aspect-ratio: 16 / 9; object-fit: cover; }

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

.footer {
  padding: 40px var(--m) 56px;
  font: 700 var(--t-label)/var(--l-label) var(--sans);
}
.footer p { margin-top: 24px; }

/* ---------- Tablet ---------- */

@media (max-width: 1024px) {
  :root { --m: 32px; --strip-h: min(42vw, 56vh); }
  :root { --inset: 32px; }
  body { --side: calc(var(--m) + 4 * var(--col) + 4 * var(--g)); }
}

/* ---------- Phone: the words sit above the pictures ---------- */

@media (max-width: 760px) {
  :root { --m: 16px; --g: 16px; --strip-h: 64vw; }
  .masthead { display: flex; justify-content: space-between; gap: 16px; height: 48px; }
  .brand span { display: none; } /* logo alone; the intro carries the name */
  .nav { display: flex; gap: 16px; }
  .intro { padding: 32px var(--m) 40px; font-size: 28px; }
  .project { grid-template-columns: 1fr; }
  .project__text { border-right: 0; padding: 24px var(--m) 0; }
  .project__summary { margin-top: 16px; }
  .project__tags { padding-top: 16px; }
  .strip { padding: 24px 0 32px var(--m); }
  .strip > * { scroll-margin-left: var(--m); }
  .strip::after { flex-basis: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .strip { scroll-snap-type: none; }
}

/* =====================================================================
   Project page (test-grid-project.html) and About (test-grid-about.html).
   Same rules as the home rows: words in the --side column, a vertical
   rule, then the pictures or the content to the right.
   ===================================================================== */

/* Title row: the project name, large, across the page */
.title {
  padding: 56px var(--m) 56px;
  font: 700 clamp(36px, 5vw, 72px)/1.04 var(--sans);
  letter-spacing: -0.01em;
}

.detail {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  border-top: var(--rule);
  border-bottom: var(--rule);
}
.detail__side { border-right: var(--rule); }
.detail__text { padding: 40px var(--inset) 56px var(--m); }
/* Stays in view while the pictures scroll, when it fits on screen (set in JS) */
.detail__text.is-sticky { position: sticky; top: 56px; }

.detail__lede { font: 700 var(--t-label)/var(--l-label) var(--sans); }

/* Meta: label left, value right, each on a hairline */
.meta { margin: 32px 0 0; }
.meta > div {
  display: grid; grid-template-columns: 1fr 2fr; gap: var(--g);
  padding: 6px 0;
  border-top: 1px solid var(--ink-15, #d4d4d4);
}
.meta > div:last-child { border-bottom: 1px solid var(--ink-15, #d4d4d4); }
.meta dt { color: var(--ink-60); }
.meta dd { margin: 0; }

/* Body copy pulled from the project page.
   Case studies have three levels, and the rule weight says which:
     section   — full rule (white), bold 13px label: "05 — Process"
     sub-head  — hairline, bold 12px run-in: "Listening", "1  Container…"
     body      — 12px / 15px, lists hang on a dash
   Pull quotes step up to 15px bold. */
.copy { margin-top: 32px; }
.copy > * + * { margin-top: 10px; }
.copy p + p, .copy p + ol, .copy ol + p,
.copy p + ul, .copy ul + p { margin-top: 10px; }
.copy a { text-decoration: underline; text-underline-offset: 2px; }

/* Section */
.copy .case { border-top: var(--rule); padding-top: 12px; }
.copy .case + .case, .copy > p + .case { margin-top: 40px; }
.copy .case h2 {
  font: 700 var(--t-label)/var(--l-label) var(--sans);
  margin-bottom: 16px;
}

/* Sub-head */
.copy .case__sub {
  font: 700 var(--t-body)/var(--l-body) var(--sans);
  border-top: 1px solid var(--ink-15);
  padding-top: 10px;
  margin: 24px 0 6px;
}
.copy .case h2 + .case__sub { border-top: 0; padding-top: 0; margin-top: 0; }
.copy .case__n { display: inline-block; width: 2ch; color: var(--ink-60); font-weight: 400; }

/* Lists: a hanging dash (bulleted) or a grey number (ordered) */
.copy ul, .copy ol { padding-left: 0; }
.copy ul > li { position: relative; padding-left: 1.2em; }
.copy ul > li::before { content: '–'; position: absolute; left: 0; color: var(--ink-60); }
.copy ol { counter-reset: n; }
.copy ol > li { counter-increment: n; position: relative; padding-left: 2ch; }
.copy ol > li::before { content: counter(n); position: absolute; left: 0; color: var(--ink-60); }
.copy li + li { margin-top: 4px; }
.copy li > span > b { font-weight: 700; }

/* Pull quote */
.copy .case__quote {
  font: 700 15px/19px var(--sans);
  letter-spacing: 0;
  margin: 16px 0;
}

/* Pictures: stacked, each as wide as the column allows */
.figs { padding: 40px var(--m) 56px var(--g); display: grid; row-gap: 48px; }
.figs__row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--g); align-items: start; }
.figs figure { margin: 0; }
.figs img, .figs video {
  display: block; width: auto; height: auto;
  max-width: 100%; max-height: 86vh; /* tall pictures fit the screen, no box around them */
}
.figs figcaption { margin-top: 8px; color: var(--ink-60); }

/* One row per section (case studies whose sections list their pictures).
   The row's rule replaces the section rule, so each section has one line. */
.is-rows .detail + .detail { border-top: 0; }
.is-rows .detail__text { padding-top: 32px; padding-bottom: 40px; }
.is-rows .copy:first-child { margin-top: 0; }
.is-rows .copy .case { border-top: 0; padding-top: 0; }
.is-rows .figs { padding-top: 32px; padding-bottom: 40px; row-gap: 32px; }

/* Previous / next */
.pager {
  display: grid; grid-template-columns: var(--side) 1fr;
  font: 700 var(--t-label)/var(--l-label) var(--sans);
  border-bottom: var(--rule);
}
.pager > * { padding: 24px var(--inset) 24px var(--m); }
.pager > :first-child { border-right: var(--rule); }
.pager > :last-child { padding-left: var(--g); padding-right: var(--m); text-align: right; }
.pager span { color: var(--ink-60); font-weight: 400; display: block; margin-bottom: 4px; }

/* About: one ruled row per section, label left, text right */
.rows > section {
  display: grid; grid-template-columns: var(--side) 1fr;
  border-top: var(--rule);
}
.rows > section:last-child { border-bottom: var(--rule); }
.rows h2 {
  padding: 32px var(--inset) 32px var(--m);
  border-right: var(--rule);
  font: 700 var(--t-label)/var(--l-label) var(--sans);
}
.rows__body { padding: 32px var(--m) 40px var(--g); max-width: calc(6 * var(--col) + 6 * var(--g) + var(--m)); }
.rows__body p + p { margin-top: 10px; }
.rows__body ol { list-style: decimal; padding-left: 1.4em; }
.rows__body ol li + li { margin-top: 4px; }
.rows__body a { text-decoration: underline; text-underline-offset: 2px; }
.rows .meta { margin: 0; }

@media (max-width: 760px) {
  .title { padding: 32px var(--m) 32px; font-size: 36px; }
  .detail, .pager, .rows > section { grid-template-columns: 1fr; }
  .detail__side, .pager > :first-child, .rows h2 { border-right: 0; }
  .detail__text { padding: 24px var(--m) 8px; }
  .figs { padding: 24px var(--m) 40px; row-gap: 32px; }
  .is-rows .detail__text { padding: 24px var(--m) 0; }
  .is-rows .figs { padding: 20px var(--m) 32px; row-gap: 24px; }
  .figs__row { grid-auto-flow: row; }
  .pager > :first-child { border-bottom: var(--rule); }
  .pager > * { padding: 16px var(--m); }
  .rows h2 { padding: 24px var(--m) 0; }
  .rows__body { padding: 12px var(--m) 28px; }
}
