/* EK Pixora Co. — site styles
   Follows DESIGN.md: palette: Teal & Saffron (DESIGN.md section 2), typography B (Inter + Instrument Serif italic),
   square corners, no shadows, motion section 6. Everything under "Motion" is an enhancement;
   every page is complete and readable without it. */

/* ---------- Fonts (self-hosted) ---------- */
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter-400.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter-500.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter-600.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/assets/fonts/instrument-serif-italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
/* Metric-matched fallback so text does not jump when Inter arrives. */
@font-face { font-family: "Inter Fallback"; src: local("Arial"), local("Helvetica"); size-adjust: 107.12%; ascent-override: 90.2%; descent-override: 22.48%; line-gap-override: 0%; }

/* ---------- Tokens ---------- */
:root {
  --color-ink: #0C2226;
  --color-lagoon: #17363B;
  --color-mist: #EEF3F0;
  --color-foam: #DCE6E2;
  --color-tide: #C3D2CD;
  --color-stone: #46595F;
  --color-fog: #9FB3B5;
  --color-ember: #A04C00;
  --color-saffron: #F4B13F;
  --color-moss: #3F6B4F;
  --color-field: #668084;
  --color-error: #A63426;

  --font-sans: "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-accent: "Instrument Serif", "Iowan Old Style", Georgia, serif;

  --text-display: clamp(2.5rem, 1.4rem + 4.6vw, 5.5rem);
  --text-h1: clamp(2.125rem, 1.5rem + 2.6vw, 3.5rem);
  --text-h2: clamp(1.75rem, 1.4rem + 1.6vw, 2.625rem);
  --text-h3: clamp(1.375rem, 1.25rem + 0.6vw, 1.75rem);
  --text-lead: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
  --text-body: 1.0625rem;
  --text-small: 0.9375rem;
  --text-label: 0.8125rem;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  --gutter: clamp(16px, 4vw, 56px);
  --section-pad: clamp(64px, 8vw, 144px);
  --header-h: 60px;

  --dur-fast: 150ms;
  --dur-base: 300ms;
  --dur-reveal: 600ms;
  --dur-image: 700ms;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* Hero depth (M1), medium intensity. Phones get none of it. */
  --hero-drift: 18%;
  --hero-scale-gain: 0.10;
  --hero-rise: 40px;

  /* Light context (default) */
  --bg: var(--color-mist);
  --bg-alt: var(--color-foam);
  --text: var(--color-ink);
  --text-muted: var(--color-stone);
  --accent: var(--color-ember);
  --focus: var(--color-ember);
  --rule: #BFD0CA;
  --input-border: var(--color-field);
}

[data-surface="dark"] {
  --bg: var(--color-ink);
  --bg-alt: var(--color-lagoon);
  --text: var(--color-mist);
  --text-muted: var(--color-fog);
  --accent: var(--color-saffron);
  --focus: var(--color-saffron);
  --rule: #2B484D;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--color-mist);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.65;
  text-wrap: pretty;
  overflow-x: clip;
}

img, video { display: block; max-width: 100%; height: auto; }
picture { display: block; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
figure { margin: 0; }

:focus-visible { outline: 2px solid var(--focus, var(--color-ember)); outline-offset: 3px; }

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0;
  z-index: 100;
  padding: 12px 16px;
  background: var(--color-mist);
  color: var(--color-ink);
  transform: translateY(-120%);
}
.skip-link:focus { transform: none; }

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

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

.label {
  font-size: var(--text-label);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--text-muted);
}

.accent-word {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1em;
  letter-spacing: 0;
}

.nowrap { white-space: nowrap; }

.h1 { font-size: var(--text-h1); line-height: 1.06; letter-spacing: -0.025em; }
.h2 { font-size: var(--text-h2); line-height: 1.12; letter-spacing: -0.02em; }
.h3 { font-size: var(--text-h3); line-height: 1.2; letter-spacing: -0.01em; }
.lead { font-size: var(--text-lead); line-height: 1.55; }
.muted { color: var(--text-muted); }
.prose { max-width: 62ch; }
.prose > * + * { margin-top: var(--space-5); }

/* ---------- Buttons and links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 0;
  font: 500 var(--text-body)/1 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) linear, color var(--dur-fast) linear, border-color var(--dur-fast) linear;
}
.btn--primary { background: var(--color-saffron); color: var(--color-ink); }
.btn--outline { border-color: currentColor; background: transparent; color: inherit; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }


.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-thickness var(--dur-fast) linear, color var(--dur-fast) linear;
}
.text-link { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { background: var(--color-ink); color: var(--color-mist); }
  [data-surface="dark"] .btn--primary:hover { background: var(--color-mist); color: var(--color-ink); }
  .btn--outline:hover { background: var(--text); color: var(--bg); }
  .link-arrow:hover, .text-link:hover { text-decoration-thickness: 2px; color: var(--accent); }
}
.btn:active, .link-arrow:active { opacity: 0.85; }

/* ---------- Header (M5: solid bar that takes the colour of the section beneath) ---------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  height: var(--header-h);
  background: var(--bg);
  color: var(--text);
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.site-header[data-surface="light"] { border-bottom-color: var(--rule); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; height: 100%; }

.wordmark { font-weight: 500; font-size: 1.125rem; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }

.site-nav ul { display: flex; align-items: center; gap: clamp(8px, 1.6vw, 24px); }
.site-nav a:not(.btn) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 6px;
  font-size: var(--text-small);
  font-weight: 500;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-position: 0 calc(50% + 12px);
  background-repeat: no-repeat;
  transition: background-size var(--dur-fast) linear;
}
.site-nav a[aria-current="page"]:not(.btn) { background-size: 100% 1px; }
@media (hover: hover) and (pointer: fine) {
  .site-nav a:not(.btn):hover { background-size: 100% 1px; }
}
.site-nav .btn { min-height: 44px; padding: 0 20px; font-size: var(--text-small); }

.menu-toggle {
  display: none;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: 500 var(--text-small)/1 var(--font-sans);
  cursor: pointer;
}
@media (max-width: 959px) {
  .site-nav { display: none; }
  .menu-toggle { display: inline-flex; align-items: center; }
}

.menu-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  padding: 0 var(--gutter) var(--space-7);
  background: var(--color-mist);
  color: var(--color-ink);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--ease-out), visibility 0s linear var(--dur-base);
}
.menu-panel.is-open { opacity: 1; visibility: visible; transition: opacity var(--dur-base) var(--ease-out), visibility 0s; }
.menu-panel__bar { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); flex: none; }
.menu-panel ul { display: grid; gap: var(--space-2); margin: var(--space-6) 0; }
.menu-panel li a { display: block; padding: 4px 0; font-size: var(--text-h1); font-weight: 500; letter-spacing: -0.025em; line-height: 1.1; text-decoration: none; }
.menu-panel .btn { align-self: flex-start; }
.menu-panel__extra { margin-top: var(--space-6); font-size: var(--text-small); }
.menu-panel__extra a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Sections ---------- */
.section { padding-block: var(--section-pad); background: var(--bg); color: var(--text); }
.section--light { --bg: var(--color-mist); }
.section--alt { --bg: var(--color-foam); }
.section--tight-top { padding-top: var(--space-7); }
.section--tight-bottom { padding-bottom: var(--space-7); }

.section-head { display: grid; gap: var(--space-4); margin-bottom: var(--space-8); max-width: 62ch; }
.section-head--row { max-width: none; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 820px) {
  .section-head--row { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
}

.rule-top { border-top: 1px solid var(--rule); }

/* Inner page opening block */
.page-head { padding-block: clamp(48px, 6vw, 96px) var(--space-8); background: var(--bg); color: var(--text); }
.page-head .wrap { display: grid; gap: var(--space-5); }
.page-head .lead { max-width: 56ch; color: var(--text-muted); }
.page-head h1 { max-width: 20ch; }

/* ---------- Hero (M1 depth, M4 headline) ---------- */
.hero {
  position: relative;
  height: min(calc(100svh - var(--header-h)), max(560px, 118vw), 1100px);
  min-height: 520px;
  overflow: clip;
  background: var(--color-lagoon);
  view-timeline: --hero block;
}
.hero__media { position: absolute; left: 0; right: 0; top: -20%; height: 120%; transform-origin: 50% 50%; will-change: transform; }
.hero__media picture, .hero__media img { width: 100%; height: 100%; }
.hero__media img { object-fit: cover; object-position: 52% 50%; }
.hero__content {
  position: absolute;
  left: var(--gutter);
  bottom: 0;
  z-index: 2;
  width: min(calc(100% - 2 * var(--gutter)), 700px);
  padding: var(--space-7) var(--space-7) var(--space-6);
  background: var(--color-mist);
  color: var(--color-ink);
}
.hero__headline { margin: var(--space-4) 0 var(--space-6); font-size: var(--text-display); line-height: 1.02; letter-spacing: -0.03em; }
.hero__headline .line { display: block; overflow: hidden; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.hero__headline .line__inner { display: block; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-6); }
.hero__content .label { color: var(--color-stone); }

@media (max-width: 639px) {
  .hero { height: auto; min-height: 0; display: flex; flex-direction: column; view-timeline: none; }
  .hero__media { position: relative; top: 0; height: min(62svh, 120vw); will-change: auto; }
  .hero__content { position: relative; left: 0; width: 100%; padding: var(--space-6) var(--gutter) var(--space-7); }
}

/* ---------- Home: introduction ---------- */
.intro__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
.intro__text { max-width: 34ch; font-size: var(--text-h2); line-height: 1.12; letter-spacing: -0.02em; font-weight: 500; text-wrap: balance; }
.intro__tagline { font-size: var(--text-lead); line-height: 1.4; color: var(--text-muted); }
@media (min-width: 1024px) {
  .intro__grid { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 32px; }
  .intro__grid > * { grid-column: 3 / span 8; }
}

/* ---------- Photographs ---------- */
.ph { position: relative; background: var(--color-tide); overflow: clip; }
.ph picture, .ph img { width: 100%; height: 100%; }
.ph img { object-fit: cover; }
.caption { margin-top: var(--space-3); font-size: var(--text-small); line-height: 1.5; color: var(--text-muted); }

/* Placeholder frames and notes: always labelled, never mistaken for content */
.placeholder {
  display: block;
  padding: var(--space-5);
  background: var(--color-tide);
  color: var(--color-ink);
  font-size: var(--text-small);
  line-height: 1.55;
}
.placeholder__tag {
  display: inline-block;
  margin-right: var(--space-2);
  font-size: var(--text-label);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.placeholder--frame { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 240px; }

/* Home: selected work */
.selected { display: grid; gap: var(--space-8); }
.selected__row { display: grid; gap: var(--space-6); grid-template-columns: minmax(0, 1fr); }
.selected figure .ph { aspect-ratio: var(--ar); }
.selected__close .ph { aspect-ratio: 16 / 9; }
.selected__close .ph img { object-position: 50% 58%; }
@media (min-width: 820px) {
  .selected__row--pair { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 32px; align-items: start; }
  .selected__row--pair > :first-child { grid-column: 2 / span 4; }
  .selected__row--pair > :last-child { grid-column: 7 / span 5; margin-top: var(--space-9); }
}

/* M2 layered photography: a back and a front photograph overlap a little. Static by default. */
.layers { --max-h: 1100px; position: relative; width: min(100%, calc(var(--max-h) * var(--set-ar))); aspect-ratio: var(--set-ar); }
.layers--center { margin-inline: auto; }
.layers__item { position: absolute; }
.layers__item .ph { aspect-ratio: var(--ar); }
.layers__back { left: 0; top: 0; width: var(--back-w); }
.layers__front { right: 0; bottom: 0; width: var(--front-w); }
@media (max-width: 639px) {
  .layers { width: 100%; aspect-ratio: auto; display: grid; gap: var(--space-5); }
  .layers__item { position: static; width: 100%; }
  .layers__front { width: 78%; justify-self: end; }
}

/* Stories (home strip and index) */
.story-card { display: grid; gap: var(--space-4); text-decoration: none; color: inherit; }
.story-card .ph { aspect-ratio: var(--ar); }
.story-card__title { font-size: var(--text-h3); line-height: 1.2; letter-spacing: -0.01em; font-weight: 500; }
.story-card__meta { font-size: var(--text-small); color: var(--text-muted); }
.story-card__title span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.story-card .ph img { transition: transform 600ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .story-card:hover .ph img { transform: scale(1.02); }
  .story-card:hover .story-card__title span { text-decoration-thickness: 2px; color: var(--accent); }
}
.story-list { display: grid; gap: var(--space-8) var(--space-6); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 720px) { .story-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.story-list--index { gap: var(--space-8) var(--space-6); }
@media (min-width: 720px) {
  .story-list--index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .story-list--index > :nth-child(even) { margin-top: var(--space-9); }
}
@media (min-width: 1100px) { .story-list--index { grid-template-columns: repeat(3, minmax(0, 1fr)); } .story-list--index > :nth-child(even) { margin-top: 0; } .story-list--index > :nth-child(3n+2) { margin-top: var(--space-9); } }

/* Typographic lists: services overview, capabilities */
.rule-list { border-top: 1px solid var(--rule); }
.rule-list > li { border-bottom: 1px solid var(--rule); }
.rule-item { display: grid; gap: var(--space-2) var(--space-6); padding-block: var(--space-5); grid-template-columns: minmax(0, 1fr); }
.rule-item__title { font-size: var(--text-h3); line-height: 1.2; letter-spacing: -0.01em; font-weight: 500; }
.rule-item__text { color: var(--text-muted); max-width: 56ch; }
.rule-item .num { font-size: var(--text-label); font-weight: 500; letter-spacing: 0.12em; color: var(--text-muted); }
@media (min-width: 820px) {
  .rule-item { grid-template-columns: 4rem minmax(0, 5fr) minmax(0, 6fr); align-items: baseline; }
  .rule-item--two { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
}
.cols-2 { display: grid; gap: 0 var(--space-7); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 820px) { .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cols-2 > .rule-list:first-child { border-top: 1px solid var(--rule); }
@media (max-width: 819px) { .cols-2 > .rule-list + .rule-list { border-top: 0; } }

/* Steps */
.steps { display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); counter-reset: step; }
.steps > li { padding-block: var(--space-5); border-top: 1px solid var(--rule); counter-increment: step; display: grid; gap: var(--space-2); align-content: start; }
.steps > li::before { content: "0" counter(step); font-size: var(--text-label); font-weight: 500; letter-spacing: 0.12em; color: var(--text-muted); }
.steps h3 { font-size: var(--text-h3); line-height: 1.2; letter-spacing: -0.01em; }
.steps p { color: var(--text-muted); max-width: 34ch; }
@media (min-width: 820px) {
  .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-6); }
  .steps > li { padding-top: var(--space-5); }
}

/* Services chapters: alternating image and text rows */
.chapter { display: grid; gap: var(--space-6); grid-template-columns: minmax(0, 1fr); padding-block: var(--space-8); border-top: 1px solid var(--rule); }
.chapter:first-of-type { border-top: 0; padding-top: 0; }
.chapter__body { display: grid; gap: var(--space-4); align-content: center; max-width: 52ch; }
.chapter__body p { color: var(--text-muted); }
.chapter__media .ph { aspect-ratio: var(--ar); }
@media (min-width: 820px) {
  .chapter { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 32px; align-items: center; }
  .chapter__media { grid-column: 1 / span 5; }
  .chapter__media--wide { grid-column: 1 / span 7; }
  .chapter__body { grid-column: 7 / span 5; }
  .chapter__media--wide + .chapter__body { grid-column: 9 / span 4; }
  .chapter--flip .chapter__media { grid-column: 8 / span 5; grid-row: 1; }
  .chapter--flip .chapter__media--wide { grid-column: 6 / span 7; }
  .chapter--flip .chapter__body { grid-column: 1 / span 5; grid-row: 1; }
  .chapter--flip .chapter__media--wide + .chapter__body { grid-column: 1 / span 4; }
  .chapter--text .chapter__body { grid-column: 1 / span 7; max-width: 60ch; }
}

/* ---------- Portfolio ---------- */
.filters { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.filter {
  min-height: 44px;
  min-width: 44px;
  padding: 0 6px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--text-muted);
  font: 500 var(--text-small)/1 var(--font-sans);
  cursor: pointer;
}
.filter[aria-pressed="true"] { color: var(--text); border-bottom-color: currentColor; }
@media (hover: hover) and (pointer: fine) { .filter:hover { color: var(--text); } }
.filters-wrap { display: none; margin-bottom: var(--space-7); }
.js .filters-wrap { display: block; }

.portfolio-group + .portfolio-group { margin-top: var(--space-9); }
.portfolio-group__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); padding-bottom: var(--space-4); margin-bottom: var(--space-5); border-bottom: 1px solid var(--rule); }
.portfolio-group[hidden] { display: none; }

/* Justified rows: every photograph keeps its own shape, rows come out at an equal height. */
.rows { --row-h: 340px; --row-gap: var(--space-4); display: flex; flex-wrap: wrap; gap: var(--row-gap); }
.rows::after { content: ""; flex-grow: 1000000; }
.rows > * { flex: calc(var(--ar) * 100) 1 calc(var(--ar) * var(--row-h)); aspect-ratio: var(--ar); min-width: 0; }
@media (min-width: 1024px) { .rows { --row-h: 380px; --row-gap: var(--space-6); } }
@media (max-width: 639px) { .rows > * { flex: 1 1 100%; } .rows::after { display: none; } }

.tile {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: var(--color-tide);
  cursor: zoom-in;
  overflow: clip;
  position: relative;
}
.tile picture, .tile img { width: 100%; height: 100%; }
.tile img { object-fit: cover; transition: transform 600ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .tile:hover img { transform: scale(1.02); } }

/* Film (only present once there are films) */
.film { display: grid; gap: var(--space-3); }
.film video { width: 100%; background: var(--color-lagoon); aspect-ratio: 16 / 9; }
.film--vertical video { aspect-ratio: 9 / 16; }
.film-list { display: grid; gap: var(--space-6); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 720px) { .film-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); } }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--color-ink);
  color: var(--color-mist);
  --focus: var(--color-saffron);
}
.lightbox::backdrop { background: var(--color-ink); }
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.lightbox__bar { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--gutter); min-height: var(--header-h); }
.lightbox__stage { display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 var(--gutter); }
.lightbox__stage picture { max-width: 100%; max-height: 100%; }
.lightbox__stage img { max-width: 100%; max-height: calc(100dvh - 190px); width: auto; height: auto; object-fit: contain; }
.lightbox__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--gutter) var(--space-4); }
.lightbox__caption { font-size: var(--text-small); color: var(--color-fog); }
.lightbox__btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border: 1px solid var(--color-fog);
  border-radius: 0;
  background: transparent;
  color: var(--color-mist);
  font: 500 var(--text-small)/1 var(--font-sans);
  cursor: pointer;
}
.lightbox__nav { display: flex; gap: var(--space-3); }
@media (hover: hover) and (pointer: fine) { .lightbox__btn:hover { background: var(--color-mist); color: var(--color-ink); } }
body.has-lightbox { overflow: hidden; }

/* ---------- Story pages ---------- */
.story-lead { position: relative; background: var(--color-lagoon); }
.story-lead .ph { aspect-ratio: var(--ar); max-height: calc(100svh - var(--header-h)); width: 100%; }
.story-head { display: grid; gap: var(--space-5); padding-block: var(--space-8); }
.story-head h1 { max-width: 18ch; }
@media (min-width: 1024px) {
  .story-head { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 32px; align-items: start; }
  .story-head > :first-child { grid-column: 1 / span 6; }
  .story-head > :last-child { grid-column: 8 / span 5; }
}
.story-blocks { display: grid; gap: var(--space-8); padding-bottom: var(--section-pad); }
.block-full .ph { aspect-ratio: var(--ar); }
.block-single { display: grid; }
@media (min-width: 820px) { .block-single > figure { width: 50%; justify-self: center; } }
.block-pair .rows { --row-gap: var(--space-4); max-width: 1040px; margin-inline: auto; }
.block-pair .rows::after, .rows--fill::after { display: none; }
.rows--fill { max-width: 880px; margin-inline: auto; }
@media (min-width: 1024px) { .block-pair .rows { --row-gap: var(--space-6); --row-h: 560px; } }
.story-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-5); padding-block: var(--space-7); border-top: 1px solid var(--rule); }

/* ---------- Contact and forms ---------- */
.contact-grid { display: grid; gap: var(--space-8); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) {
  .contact-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 32px; }
  .contact-grid > :first-child { grid-column: 1 / span 5; }
  .contact-grid > :last-child { grid-column: 7 / span 6; }
}
.contact-lines { display: grid; gap: var(--space-5); }
.contact-lines dt { margin-bottom: var(--space-1); }
.contact-lines dd { margin: 0; }

.form { display: grid; gap: var(--space-5); }
.field { display: grid; gap: var(--space-2); }
.field label, .field .field__label { font-weight: 500; font-size: var(--text-small); }
.field .hint { font-weight: 400; color: var(--text-muted); }
.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--input-border);
  border-radius: 0;
  background: var(--color-mist);
  color: var(--color-ink);
  font: 400 1rem/1.4 var(--font-sans);
}
.textarea { min-height: 160px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--color-ember); outline-offset: 2px; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--color-error); }
.error-text { color: var(--color-error); font-size: var(--text-small); }
.error-summary { padding: var(--space-5); border: 1px solid var(--color-error); color: var(--color-error); }
.error-summary h2 { font-size: var(--text-body); margin-bottom: var(--space-2); }
.error-summary ul { list-style: disc; padding-left: 1.2em; }
.error-summary a { color: inherit; }
.form__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.status { min-height: 1.6em; font-size: var(--text-small); color: var(--color-moss); }
.status--error { color: var(--color-error); }
.form-note { font-size: var(--text-small); color: var(--text-muted); max-width: 56ch; }

/* ---------- Footer ---------- */
.site-footer { --bg: var(--color-lagoon); background: var(--bg); color: var(--color-mist); padding-block: var(--space-8); --text-muted: var(--color-fog); --focus: var(--color-saffron); }
.site-footer__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
@media (min-width: 720px) { .site-footer__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.site-footer li + li { margin-top: 4px; }
.site-footer .label { color: var(--color-fog); margin-bottom: var(--space-3); }
.site-footer a { text-underline-offset: 4px; }
.site-footer a.foot-link { display: inline-flex; align-items: center; min-height: 44px; }
.footer-meta { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid #2B484D; display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-6); align-items: center; justify-content: space-between; font-size: var(--text-small); color: var(--color-fog); }
.motion-switch { min-height: 44px; padding: 0 16px; border: 1px solid var(--color-fog); border-radius: 0; background: transparent; color: var(--color-mist); font: 500 var(--text-small)/1 var(--font-sans); cursor: pointer; }
.motion-switch[aria-pressed="true"] { background: var(--color-mist); color: var(--color-ink); }
.motion-switch[disabled] { opacity: 0.8; cursor: default; }

/* ---------- Contact invitation band ---------- */
.invite { display: grid; gap: var(--space-6); }
.invite__line { max-width: 18ch; font-size: var(--text-h1); line-height: 1.06; letter-spacing: -0.025em; font-weight: 500; text-wrap: balance; }
.invite__row { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-7); align-items: center; }

/* ---------- Motion (everything below is an enhancement) ---------- */
.js-motion .reveal { opacity: 0; transform: translate3d(0, 14px, 0); }
.js-motion .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}
/* M3 for photographs: fade in while easing from a slight zoom. */
.js-motion .reveal-img .ph img, .js-motion .reveal-img.ph img, .js-motion .reveal-img .tile img { opacity: 0; transform: scale(1.03); }
.js-motion .reveal-img.is-visible .ph img, .js-motion .reveal-img.is-visible.ph img, .js-motion .reveal-img.is-visible .tile img {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-image) var(--ease-out), transform var(--dur-image) var(--ease-out);
}

.js-motion .hero__headline .line__inner { transform: translate3d(0, 105%, 0); }
.js-motion .hero.is-ready .hero__headline .line__inner { transform: none; transition: transform 750ms var(--ease-out); transition-delay: calc(var(--i, 0) * 90ms + 120ms); }

.js-motion:not(.js-ready) .reveal,
.js-motion:not(.js-ready) .hero__headline .line__inner { animation: failsafe 0.01s 2.5s forwards; }
.js-motion:not(.js-ready) .reveal-img .ph img,
.js-motion:not(.js-ready) .reveal-img .tile img { animation: failsafe 0.01s 2.5s forwards; }
@keyframes failsafe { to { opacity: 1; transform: none; } }

@keyframes hero-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(0, var(--hero-drift), 0) scale(calc(1 + var(--hero-scale-gain))); }
}
@keyframes hero-content-out {
  0%   { opacity: 1; transform: translate3d(0, 0, 0); }
  55%  { opacity: 1; }
  100% { opacity: 0; transform: translate3d(0, calc(var(--hero-rise) * -1), 0); }
}
@keyframes hero-settle { from { transform: scale(1.07); } to { transform: scale(1); } }
.js-motion .hero__media img { animation: hero-settle 1600ms var(--ease-out) both; }

/* M2: the two layers of a spread drift a little apart as it passes through the screen. */
@keyframes layer-back  { from { transform: translate3d(0, -14px, 0); } to { transform: translate3d(0, 14px, 0); } }
@keyframes layer-front { from { transform: translate3d(0, 22px, 0); } to { transform: translate3d(0, -22px, 0); } }

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    :root:not([data-motion="off"]):not(.depth-js) .hero__media {
      animation: hero-drift linear both;
      animation-timeline: --hero;
      animation-range: exit 0% exit 100%;
    }
    :root:not([data-motion="off"]):not(.depth-js) .hero__content {
      animation: hero-content-out linear both;
      animation-timeline: --hero;
      animation-range: exit 0% exit 100%;
    }
    :root:not([data-motion="off"]) .layers__back  { animation: layer-back linear both; animation-timeline: view(); }
    :root:not([data-motion="off"]) .layers__front { animation: layer-front linear both; animation-timeline: view(); }
  }
}

.depth-js:not([data-motion="off"]) .hero__media {
  transform: translate3d(0, calc(var(--p, 0) * var(--hero-drift)), 0) scale(calc(1 + var(--p, 0) * var(--hero-scale-gain)));
}
.depth-js:not([data-motion="off"]) .hero__content {
  opacity: calc(1 - max(0, (var(--p, 0) - 0.55) / 0.45));
  transform: translate3d(0, calc(var(--p, 0) * var(--hero-rise) * -1), 0);
}

/* Phones: the simplified tier, with no hero drift and no layer drift. */
@media (max-width: 639px) {
  :root .hero__media, :root .hero__content { animation: none !important; transform: none !important; opacity: 1 !important; }
  :root .layers__back, :root .layers__front { animation: none !important; transform: none !important; }
}

/* Still tier: system setting or the footer switch. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .reveal, .hero__headline .line__inner { opacity: 1 !important; transform: none !important; }
  .reveal-img .ph img, .reveal-img.ph img, .reveal-img .tile img { opacity: 1 !important; transform: none !important; }
  .hero__media, .hero__content, .layers__back, .layers__front { animation: none !important; transform: none !important; opacity: 1 !important; }
}
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after { animation: none !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
:root[data-motion="off"] .reveal, :root[data-motion="off"] .hero__headline .line__inner { opacity: 1 !important; transform: none !important; }
:root[data-motion="off"] .reveal-img .ph img, :root[data-motion="off"] .reveal-img.ph img, :root[data-motion="off"] .reveal-img .tile img { opacity: 1 !important; transform: none !important; }
:root[data-motion="off"] .hero__media, :root[data-motion="off"] .hero__content, :root[data-motion="off"] .layers__back, :root[data-motion="off"] .layers__front { transform: none !important; opacity: 1 !important; }

/* ---------- Small additions ---------- */
.placeholder-inline { display: inline-block; padding: 1px 8px; background: var(--color-tide); color: var(--color-ink); font-size: var(--text-small); }
.about-grid { display: grid; gap: var(--space-8); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) {
  .about-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 32px; align-items: start; }
  .about-grid > :first-child { grid-column: 1 / span 6; }
  .about-grid > :last-child { grid-column: 8 / span 5; }
}
.rows .ph { height: 100%; }
