/* ==========================================================================
   Creek Studio V3 — site stylesheet
   System source: 03_CREEK STUDIO/05 - Website/V3/SPEC - V3 Build State & Rules.md
   Layout values are written against the 1440 desktop frame and scale with it.
   ========================================================================== */

/* ---------- 0. Fonts (self-hosted, SIL OFL — see assets/fonts/OFL.txt) ---------- */
@font-face { font-family: "Creek Sans"; src: url("../fonts/InstrumentSans-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Creek Sans"; src: url("../fonts/InstrumentSans-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Creek Sans"; src: url("../fonts/InstrumentSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Creek Serif"; src: url("../fonts/InstrumentSerif-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Creek Serif"; src: url("../fonts/InstrumentSerif-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
/* ---------- end fonts ---------- */

/* ---------- 1. Tokens ---------- */
:root {
  /* Colour: black and white; project imagery carries the colour */
  --ink: #201F1D;            /* Creek Ink (logo package) */
  --ink-2: #6B6863;          /* secondary metadata, 5.4:1 on white */
  --ground: #FFFFFF;
  --mist: #F2F1EF;           /* image placeholder while loading */
  --rule: rgba(32, 31, 29, 0.24);
  --rule-soft: rgba(32, 31, 29, 0.16);

  /* Type */
  --font-sans: "Creek Sans", "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "Creek Serif", "Instrument Serif", "Times New Roman", Times, serif;

  /* Grid: 12 columns, 80px margins, 24px gutters at 1440 */
  --m: 80px;
  --g: 24px;
  /* one design pixel at 1440, scaling with the viewport (capped at 1920) */
  --u: calc(min(100vw, 1920px) / 1440);

  /* Type ladder (values at 1440): large / medium / tiny */
  --fs-display: clamp(56px, 7.8vw, 150px);   /* 112 */
  --fs-h2: clamp(40px, 5vw, 96px);           /* 72 */
  --fs-h3: clamp(34px, 3.9vw, 76px);         /* 56 */
  --fs-serif: clamp(30px, 3.35vw, 64px);     /* 48 */
  --fs-intro: clamp(20px, 1.8vw, 32px);      /* 26 */
  --fs-body: 17px;
  --fs-meta: 11px;

  /* Spacing: dramatic between sections, uneven inside blocks */
  --s-section: calc(240 * var(--u));
  --s-block: calc(220 * var(--u));
  --s-120: calc(120 * var(--u));
  --s-48: 48px;
  --s-32: 32px;
  --s-24: 24px;
  --s-12: 12px;

  /* Motion */
  --t-img: 640ms;
  --t-text: 520ms;
  --t-hover: 300ms;
  --t-page: 420ms;
  --t-fade: 420ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* the wipe gets a gentler start than --ease: a large edge travelling across the
     screen looks snatched if it leaves at full speed */
  --ease-img: cubic-bezier(0.25, 0.46, 0.18, 1);
}

@media (max-width: 1279px) {
  :root { --m: 56px; --g: 20px; }
}

@media (max-width: 899px) {
  :root {
    --m: 22px;
    --g: 14px;
    --fs-body: 16px;
    /* 390 ladder: display 52 / project titles 47 / h2 44 / h3 40 / serif 34 */
    --fs-display: clamp(44px, 13.4vw, 72px);
    --fs-h2: clamp(36px, 11.3vw, 48px);
    --fs-h3: clamp(32px, 10.3vw, 40px);
    --fs-serif: clamp(30px, 8.7vw, 36px);
    --s-section: 144px;
    --s-block: 120px;
    --s-120: 56px;
    --s-48: 36px;
  }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  --u: calc(min(100%, 1920px) / 1440);
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.45;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
main:focus { outline: none; }
[id] { scroll-margin-top: 96px; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--m);
  top: 12px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--ground);
  font-size: var(--fs-meta);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  translate: 0 -200%;
}
.skip-link:focus { translate: 0 0; }

/* ---------- 3. Grid ----------
   Lines: 1 full-start | 2 col 1 | 3 col 2 | ... | 13 col 12 | 14 content-end | 15 full-end
   Columns a..b  ->  grid-column: (a+1) / (b+2)
   Items set --c (desktop), --c-m (mobile), --r / --r-m (row),
   --y (desktop offset in 1440 px) and --y-m (mobile offset in px). */
.grid {
  display: grid;
  max-width: 1760px;
  margin-inline: auto;
  grid-template-columns:
    [full-start] calc(var(--m) - var(--g))
    [content-start] repeat(12, minmax(0, 1fr))
    [content-end] calc(var(--m) - var(--g))
    [full-end];
  column-gap: var(--g);
}

.gi {
  grid-column: var(--c-m, 2 / 14);
  grid-row: var(--r-m, auto);
  margin-top: calc(var(--y-m, 0) * 1px);
  min-width: 0;
}

@media (min-width: 900px) {
  .gi {
    grid-column: var(--c, 2 / 14);
    grid-row: var(--r, auto);
    margin-top: calc(var(--y, 0) * var(--u));
  }
}

.self-end { align-self: end; }
.self-start { align-self: start; }
.right { text-align: right; }
.z2 { position: relative; z-index: 2; }

/* ---------- 4. Type roles ---------- */
.meta {
  font-size: var(--fs-meta);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.meta--muted { color: var(--ink-2); }

.display,
.h2,
.h3 {
  font-weight: 600;
  text-transform: uppercase;
  text-wrap: balance;
}
.display { font-size: var(--fs-display); line-height: 0.92; letter-spacing: -0.02em; }
.h2 { font-size: var(--fs-h2); line-height: 0.94; letter-spacing: -0.018em; }
.h3 { font-size: var(--fs-h3); line-height: 0.98; letter-spacing: -0.015em; }

.intro {
  font-size: var(--fs-intro);
  line-height: 1.28;
  letter-spacing: -0.004em;
  text-wrap: balance;
}

.body { max-width: 34em; }
.body p, .body li { text-wrap: pretty; }
.body > * + * { margin-top: 0.9em; }

.serif {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--fs-serif);
  line-height: 1.04;
  letter-spacing: 0;
  text-transform: none;
}
.serif--italic { font-style: italic; }

.lines > li { line-height: 1.5; }

/* Arrow links: VIEW PROJECT ↗ and friends */
.link {
  display: inline-flex;
  gap: 0.5em;
  align-items: baseline;
  font-size: var(--fs-meta);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-block: 6px;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0% 1px no-repeat;
  transition: background-size var(--t-hover) var(--ease);
}
.link:hover,
.link:focus-visible { background-size: 100% 1px; }
.link .arrow { display: inline-block; transition: translate var(--t-hover) var(--ease); }
.link:hover .arrow { translate: 2px -2px; }

/* ---------- 5. Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 26px var(--m) 18px;
  pointer-events: none;             /* the empty half of the bar stays clickable-through */
  transition: translate 450ms var(--ease), background-color 300ms linear, box-shadow 300ms linear;
}
.site-header .brand,
.site-header .site-nav { pointer-events: auto; }
.site-header.is-scrolled {
  background: var(--ground);
  box-shadow: 0 1px 0 var(--rule-soft);
}
.site-header.is-hidden { translate: 0 -100%; }

.brand,
.site-nav a {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand { display: inline-block; padding: 5px; margin: -5px; transition: opacity 300ms linear; }
.brand-mark { display: none; }
html.js body:not(.no-hero) .site-header:not(.show-brand) .brand { opacity: 0; pointer-events: none; }
html.js body:not(.no-hero) .site-header:not(.show-brand) .brand:focus-visible { opacity: 1; pointer-events: auto; }

.site-nav ul { display: flex; gap: 36px; }
.site-nav a {
  display: inline-block;
  padding-block: 6px;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0% 1px no-repeat;
  transition: background-size var(--t-hover) var(--ease);
}
.site-nav a:hover,
.site-nav a:focus-visible { background-size: 100% 1px; }

@media (max-width: 899px) {
  .site-header { padding: 16px var(--m) 12px; align-items: center; }
  .brand-word {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .brand-mark { display: block; height: 22px; width: auto; }
  .site-nav { margin-left: auto; }
  .site-nav ul { gap: 16px; }
  .site-nav a { font-size: 11px; }
}

/* ---------- 6. Media ---------- */
.media { position: relative; }
.media-frame {
  overflow: hidden;
  background: var(--mist);
}
.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  --s-base: 1;
  scale: var(--s-base);
  translate: 0 calc(var(--drift, 0) * 1%);
  transition: scale var(--t-hover) var(--ease), opacity var(--t-fade) linear;
}
@media (min-width: 900px) {
  [data-drift] .media-frame img { --s-base: 1.08; }
}
a.media-link:hover .media-frame img { scale: calc(var(--s-base) + 0.02); }

.r-4x5 .media-frame { aspect-ratio: 4 / 5; }
.r-3x4 .media-frame { aspect-ratio: 3 / 4; }
.r-4x3 .media-frame { aspect-ratio: 4 / 3; }
.r-16x9 .media-frame { aspect-ratio: 16 / 9; }
.r-1x1 .media-frame { aspect-ratio: 1 / 1; }
.r-21x9 .media-frame { aspect-ratio: 21 / 9; }
.r-board .media-frame { aspect-ratio: 1600 / 980; }
@media (max-width: 899px) {
  .mr-4x3 .media-frame { aspect-ratio: 4 / 3 !important; }   /* beats the inline ratio */
  .mr-4x5 .media-frame { aspect-ratio: 4 / 5 !important; }
  .mpos-left .media-frame img { object-position: 0% 50% !important; }
}

.cutout .media-frame { background: none; overflow: visible; }
.cutout img { height: auto; object-fit: contain; }

/* ---------- 7. Hero ----------
   The stacked logo sits at display size: CREEK is 360 units in the SVG,
   so the image width is set from --fs-hero (rule 2: display 104–120px). */
.hero {
  --fs-hero: clamp(64px, 8.34vw, 120px);
  min-height: 94vh;
  min-height: 94svh;
  grid-template-rows: 1fr auto auto;
  padding-top: 128px;
  padding-bottom: 40px;
  row-gap: 28px;
}
.hero-logo { align-self: end; }
.hero-logo img { width: calc(var(--fs-hero) * 1283.5 / 360); max-width: 100%; }
.hero-meta,
.hero-line { align-self: end; }
.hero-meta { padding-bottom: calc((var(--fs-intro) - var(--fs-meta)) * 0.21); }
.hero-line { font-size: var(--fs-intro); line-height: 1.25; max-width: 16em; }

@media (max-width: 899px) {
  .hero { --fs-hero: clamp(64px, 25vw, 120px); min-height: 100svh; padding-top: 96px; padding-bottom: 28px; row-gap: 18px; }
  .hero-line { font-size: 20px; margin-top: 10px; }
}

/* ---------- 8. Sections ---------- */
.section { padding-top: var(--s-section); }
.section-head { row-gap: var(--s-24); }
.section-head .meta { padding-top: calc((var(--fs-h2) - var(--fs-meta)) * 0.18); }

/* Selected work */
.project { padding-top: var(--s-block); row-gap: 0; }
.work-head + .project { padding-top: var(--s-120); }

.p-title { position: relative; display: block; }
.p-title a { transition: opacity var(--t-hover) linear; }
.p-title a:hover { opacity: 0.55; }
.p-num {
  position: absolute;
  right: 100%;
  margin-right: 0.9em;
  font-size: var(--fs-meta);
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1;
  translate: 0 0.35em;
}
/* right-aligned cards hang the number on the other side */
.p-head.right .p-title .p-num { right: auto; left: 100%; margin-right: 0; margin-left: 0.9em; }
.p-disc { margin-top: var(--s-24); }
.p-kind { margin-top: 4px; color: var(--ink-2); }
.p-intro .body { font-size: var(--fs-body); }
.p-intro .link { margin-top: var(--s-24); }

/* Interlude between projects */
.interlude { padding-block: var(--s-section) 0; }
.interlude .serif { margin-top: calc(40 * var(--u)); }

/* Services */
.service,
.index-row,
.site-footer {
  background: linear-gradient(var(--rule), var(--rule)) var(--m) 0 / calc(100% - 2 * var(--m)) 1px no-repeat;
}

.service {
  margin-top: calc(96 * var(--u));
  padding-top: var(--s-32);
  row-gap: var(--s-24);
}
.service:first-of-type { margin-top: var(--s-120); }
.service .lines { columns: 1; }
.service .lines li { padding-block: 2px; }

/* How I work */
.step { margin-top: var(--s-120); row-gap: var(--s-24); }
.step .lines { margin-block: 0.9em; }

/* More than a studio */
.keep-list li { line-height: 1.55; }

/* Meander */
.meander { padding-block: var(--s-section); }
.meander .ipa {
  margin-top: calc(24 * var(--u));
  /* Instrument Serif has no IPA glyphs; this is a chosen fallback, not an accident */
  font-family: Georgia, "Iowan Old Style", "Times New Roman", Times, serif;
  font-size: calc(var(--fs-serif) * 0.86);
}

/* Work index */
.index-list {
  margin-top: var(--s-48);
  padding-bottom: 1px;
  background: linear-gradient(var(--rule), var(--rule)) var(--m) 100% / calc(100% - 2 * var(--m)) 1px no-repeat;
}
.index-row {
  align-items: baseline;
  padding-block: 22px 20px;
  row-gap: 6px;
}
.index-name {
  font-size: var(--fs-intro);
  font-weight: 600;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  line-height: 1.1;
  transition: translate var(--t-hover) var(--ease);
}
.index-kind { color: var(--ink-2); }
.index-kind::before { content: "\00b7\00a0"; margin-right: 0.2em; }
.index-row:hover .index-name,
.index-row:focus-visible .index-name { translate: 10px 0; }
.index-row { transition: background-color var(--t-hover) var(--ease); }
a.index-row:hover, a.index-row:focus-visible { background-color: rgba(32, 31, 29, 0.035); }
.index-year { display: inline-flex; gap: 0.6em; align-items: baseline; justify-content: flex-end; }
.index-year .arrow { width: 1em; text-align: left; }
.index-row .arrow { opacity: 0; transition: opacity var(--t-hover) linear; }
.index-row:hover .arrow,
.index-row:focus-visible .arrow { opacity: 1; }

/* Contact */
.contact { padding-block: calc(300 * var(--u)) calc(260 * var(--u)); row-gap: var(--s-24); }
.contact .display { margin-top: var(--s-24); }
.email {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0% 2px no-repeat;
  transition: background-size var(--t-hover) var(--ease);
  padding-bottom: 6px;
}
.email:hover,
.email:focus-visible { background-size: 100% 2px; }

@media (min-width: 900px) {
  .contact .email { font-size: var(--fs-h2); line-height: 0.94; letter-spacing: -0.018em; }
}
.contact-details { display: grid; gap: var(--s-24); }
.contact-details a,
.site-footer a:not(.gi) { display: inline-block; padding-block: 5px; font-weight: 500; }
.site-footer .meta a[href^="mailto"] { overflow-wrap: anywhere; }

@media (max-width: 899px) {
  .contact { padding-block: 160px 120px; }
  .email { font-size: clamp(18px, 5.7vw, 34px); overflow-wrap: normal; white-space: nowrap; }
  /* the contact address is the page's last and largest instruction, so it wraps
     at the @ rather than shrinking to body size */
  .contact .email {
    font-size: clamp(28px, 8.6vw, 44px);
    line-height: 1.02;
    letter-spacing: -0.015em;
    white-space: normal;
  }
}

/* Short pages (404) still push the footer to the bottom */
.page-shell { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.page-shell > main { flex: 1 0 auto; align-content: center; }

/* Footer */
.site-footer {
  padding-block: 40px 44px;
  row-gap: 20px;
  align-items: start;
}
/* the contact column's links are inline-blocks with padding; pull the column
   back so its first line shares a baseline with services, place and copyright */
.footer-contact { margin-top: -5px; }
@media (max-width: 899px) { .footer-contact { margin-top: 0; } }
.footer-home { display: inline-block; padding-block: 6px; }
.footer-logo { width: 176px; }
.footer-colophon { max-width: 62ch; text-transform: none; letter-spacing: 0.02em; font-size: 12px; line-height: 1.5; }
.footer-copy { display: inline-flex; gap: 8px; align-items: center; justify-content: flex-end; }

/* Mid-desktop: the contact cell needs more room than one row allows */
@media (min-width: 900px) and (max-width: 1279px) {
  .site-footer .footer-home { grid-column: 2 / 8; grid-row: 1; }
  .site-footer .footer-services { grid-column: 2 / 4; grid-row: 2; margin-top: 44px; }
  .site-footer .footer-place { grid-column: 4 / 6; grid-row: 2; margin-top: 44px; }
  .site-footer .footer-contact { grid-column: 6 / 11; grid-row: 2; margin-top: 44px; }
  .site-footer .footer-copy { grid-column: 11 / 14; grid-row: 2; margin-top: 44px; }
  .site-footer .footer-colophon { grid-column: 2 / 12; grid-row: 3; margin-top: 36px; }
}

@media (max-width: 899px) {
  .footer-copy { justify-content: flex-start; }
}

/* In development (Face Space on HOME) */
.soon { color: var(--ink-2); }
.no-link { cursor: default; }
.index-row.no-link:hover .index-name { translate: none; }

@media (min-width: 900px) {
  .right-d { text-align: right; }
}

/* ---------- 10. Project pages ---------- */
.pp-hero { padding-top: 176px; row-gap: var(--s-24); }
.pp-title { margin-top: var(--s-12); }
.pp-facts { display: grid; }
.pp-facts .fact {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  column-gap: var(--s-12);
  padding-block: 10px;
  border-top: 1px solid var(--rule-soft);
}
.pp-facts .fact:last-child { border-bottom: 1px solid var(--rule-soft); }
.pp-facts dd { margin: 0; }

.back-link {
  display: inline-block;
  padding-block: 7px;
  margin-block: -7px;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0% 1px no-repeat;
  transition: background-size var(--t-hover) var(--ease);
}
.back-link:hover,
.back-link:focus-visible { background-size: 100% 1px; }
.back-link .arrow { display: inline-block; transition: translate var(--t-hover) var(--ease); }
.back-link:hover .arrow { translate: -6px 0; }

.statement { padding-top: var(--s-section); }

.chapter { padding-top: var(--s-block); row-gap: var(--s-24); }
.chapter .intro + .body,
.chapter .body + .body { margin-top: var(--s-32); }
.ch-label { padding-top: calc((var(--fs-intro) - var(--fs-meta)) * 0.36); }

.range { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--g); }
.range-item .h3 { margin-top: var(--s-12); }
.menu-sets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--g); }
.menu-sets .intro { margin-top: var(--s-12); }

.next-project { padding-block: var(--s-section) 0; row-gap: var(--s-24); }
.next-link {
  display: inline-block;
  font-size: var(--fs-display);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-wrap: balance;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0% 3px no-repeat;
  padding-bottom: 10px;
  transition: background-size var(--t-page) var(--ease);
}
.next-link:hover,
.next-link:focus-visible { background-size: 100% 3px; }
.next-link .arrow { display: inline-block; transition: translate var(--t-hover) var(--ease); }
.next-link:hover .arrow { translate: 8px 0; }

.next-thumb { display: block; align-self: start; }
.next-project { align-items: start; }
.next-thumb .media-frame img { transition: scale var(--t-page) var(--ease); }
.next-project:hover .next-thumb .media-frame img { scale: 1.03; }

.pp-cta { padding-bottom: calc(160 * var(--u)); }

@media (max-width: 899px) {
  .pp-hero { padding-top: 120px; }
  .range { grid-template-columns: 1fr; row-gap: var(--s-32); }
  .next-project { padding-block: 144px 0; }
  .pp-cta { padding-bottom: 96px; }
}

/* Page to page: a slow cross-fade where the browser supports view transitions */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--t-page);
  animation-timing-function: var(--ease);
}

/* Cursor label on project images (fine pointers only) */
.cursor-label {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  margin: 16px 0 0 16px;
  padding: 6px 8px 5px;
  background: var(--ink);
  color: var(--ground);
  font-size: var(--fs-meta);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms linear;
}
.cursor-label.is-on { opacity: 1; }

/* ---------- 11. Mobile composition (below 900px, drawn at 390 x 844) ----------
   Rule 17: recomposed, not stacked. Two text edges (the margin and column 4),
   images alternating full bleed, edge-bleeding and narrow, titles 44-54px.
   Placements live inline as --c-m / --r-m / --y-m; this block holds the
   pieces that change shape rather than position. */
@media (max-width: 899px) {
  /* one left edge per card on a phone: right alignment needs width to read as a decision */
  .p-head.right, .p-head.right .p-title { text-align: left; }

  /* Project titles on HOME sit a step above the h3 ladder (rule 17: 44-54px) */
  .p-title { font-size: clamp(40px, 12vw, 52px); line-height: 0.94; }
  /* no room to hang a number at 390: it sits on its own line above the title */
  .p-num { position: static; display: block; margin: 0 0 0.6em; translate: none; }
  .p-head.right .p-title .p-num { margin-left: 0; }

  /* Service lists: two short columns instead of one long one */
  .service .lines { columns: 2; column-gap: var(--g); }
  .service .lines li { break-inside: avoid; }

  /* Paired statements (Good Dawg Fund) stagger instead of squeezing side by side */
  .pair-stagger { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-24); }
  .pair-stagger > :first-child { margin-right: calc((100% + var(--g)) / 12 * 3); }
  .pair-stagger > :nth-child(2) { margin-left: calc((100% + var(--g)) / 12 * 3); }

  /* Retail range steps down and across */
  .range-item:nth-child(2) { margin-left: calc((100% + var(--g)) / 12 * 3); }
  .range-item:nth-child(3) { margin-left: calc((100% + var(--g)) / 12 * 6); }

  /* Meander: the one word that fills the width */
  .meander .display { font-size: clamp(56px, 17.4vw, 120px); line-height: 0.9; }

  .next-link { text-wrap: pretty; }
}

/* ---------- 9. Motion ----------
   Only active when JS has confirmed motion is allowed (html.motion).
   Anything in the first viewport is marked in before paint, so the page
   is readable at rest. */
html.motion [data-reveal="text"] {
  transition:
    opacity var(--t-text) var(--ease) var(--d, 0ms),
    translate var(--t-text) var(--ease) var(--d, 0ms);
}
html.motion [data-reveal="text"]:not(.is-in) { opacity: 0; translate: 0 14px; }

html.motion [data-reveal="media"] .media-frame {
  clip-path: inset(0 0 0 0);
  transition: clip-path var(--t-img) var(--ease-img) var(--d, 0ms);
}
html.motion [data-reveal="media"]:not(.is-in) .media-frame { clip-path: inset(0 0 100% 0); }

/* The frame opens on schedule whether or not the file has arrived. A picture that is
   already decoded - which is the normal case, two screens of warning - is opaque as
   the frame opens and animates nothing. Only a late one fades up, against the frame's
   own mist rather than against a hole in the page. */
html.motion [data-reveal="media"] .media-frame img:not(.is-loaded) { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- 12. Print ---------- */
@media print {
  :root, body { --m: 12mm; --g: 6mm; --u: 0.62px; --fs-body: 10pt; --fs-meta: 7pt; }
  @page { margin: 14mm; }

  .site-header, .cursor-label, .skip-link, .arrow,
  .next-project, .pp-cta, .meander, .site-footer .footer-services { display: none !important; }

  body { background: #fff; color: #000; font-size: 10pt; line-height: 1.4; }
  .grid { max-width: none; }

  /* nothing stays hidden waiting for a scroll event that will never fire */
  [data-reveal], [data-reveal] * { opacity: 1 !important; clip-path: none !important; translate: none !important; }
  .media-frame img { scale: 1 !important; translate: none !important; }

  .section, .chapter, .statement { padding-top: 12mm !important; }
  .project { break-inside: avoid; }
  figure, .index-row { break-inside: avoid; }
  .media-frame { max-height: 110mm; }
  .media-frame img { object-fit: contain; }

  h1, h2, h3, .display, .h2, .h3, .p-title { break-after: avoid; }
  .display { font-size: 26pt; }
  .h2 { font-size: 20pt; }
  .h3, .p-title { font-size: 15pt; }
  .intro { font-size: 11pt; }

  a { text-decoration: none; color: #000; }
  /* the paper has no hover, so name the site once, at the end */
  .site-footer .footer-copy::after { content: " \00b7 creekstudio.co.uk"; }
}
