:root {
  --paper: #f2f1ed;
  --ink: #141413;
  --muted: #5f5d57;
  --rule: #d6d3cc;
  --row-hover: #e8e6e0;
  --night: #0b0a09;
  --light: #f3f0ea;
  --light-muted: #b7b1a6;
  --idle: #9b958b;
  --foot-rule: #24221f;
  --gutter: clamp(20px, 4vw, 56px);
  --plate-w: clamp(260px, 24vw, 440px);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

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

html {
  /* Dark behind the page so overscroll never shows a white edge next to the hero. */
  background: var(--night);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: relative;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img { display: block; }
h1, h2, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }

[id] { scroll-margin-top: 24px; }

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

/* Header, pinned to the top of the hero */

.site-header {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 28px var(--gutter);
  color: var(--light);
  font-size: 15px;
}

.site-nav { display: flex; gap: 24px; }
.site-nav a { text-decoration: none; transition: opacity .3s ease; }
.site-nav a:hover { opacity: .7; }

/* Over photos: a dark halo keeps the ring visible on bright and dark areas alike. */
.site-nav a:focus-visible,
.hero-pick:focus-visible,
.hero-strip:focus-visible {
  outline: 2px solid var(--light);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(11, 10, 9, .75);
}
.contact-details a:focus-visible {
  outline: 1px solid var(--light);
  outline-offset: 4px;
}

.wordmark {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  white-space: nowrap;
}
.wordmark-name { font-size: 21px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.3; }
.wordmark-note { font-size: 11px; color: var(--light-muted); line-height: 1.3; }

/* Hero */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: var(--night);
  color: var(--light);
}

.hero { --fade: .7s; }

.hero-photos { position: absolute; inset: 0; isolation: isolate; }

/*
 * The incoming photo fades in on top while the outgoing one holds underneath until it is
 * covered, so a change never dips towards black. Hidden photos leave the accessibility tree.
 */
.hero-photo {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos, center 60%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0s linear var(--fade), visibility 0s linear var(--fade);
}
.hero-photo.is-on {
  z-index: 1;
  opacity: 1;
  visibility: visible;
  transition: opacity var(--fade) var(--ease), visibility 0s;
}

/* The lights come on: a dark layer lifts off the photo, which is cheap for phone GPUs. */
.hero-dark {
  position: absolute;
  inset: 0;
  background: var(--night);
  opacity: .92;
  transition: opacity 3s var(--ease);
  will-change: opacity;
}
.lit .hero-dark { opacity: 0; }
.settled .hero-dark { display: none; }

.hero-scrim, .hero-assist {
  position: absolute;
  inset: 0;
}

.hero-scrim {
  background: linear-gradient(180deg, rgba(11, 10, 9, .6) 0%, rgba(11, 10, 9, 0) 24%, rgba(11, 10, 9, 0) 50%, rgba(11, 10, 9, .85) 100%);
}

/*
 * The brief's scrim is enough for the dark Paddington photo. The brighter photos get
 * this extra layer, which crossfades with them, so text holds its contrast on bright
 * facades without dimming the Paddington scheme.
 */
.hero-assist {
  --clear-from: 24%;
  --clear-to: 38%;
  --full-at: 60%;
  background: linear-gradient(180deg, rgba(11, 10, 9, .5) 0%, rgba(11, 10, 9, .5) 10%, rgba(11, 10, 9, 0) var(--clear-from), rgba(11, 10, 9, 0) var(--clear-to), rgba(11, 10, 9, .72) var(--full-at), rgba(11, 10, 9, .72) 100%);
  opacity: 0;
  transition: opacity var(--fade) var(--ease);
}
.hero[data-active="1"] .hero-assist { opacity: .9; }
.hero[data-active="2"] .hero-assist,
.hero[data-active="3"] .hero-assist { opacity: 1; }

/* The h1 sits higher on the photo on short landscape screens. */
@media (min-width: 821px) and (min-aspect-ratio: 3/2) and (max-height: 800px) {
  .hero-assist { --full-at: 54%; }
}

/* The photo is height-locked and the text block climbs past the middle. */
@media (max-aspect-ratio: 3/2) {
  .hero-assist { --clear-from: 20%; --clear-to: 28%; --full-at: 48%; }
}

.hero-foot {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: clamp(32px, 5vw, 64px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.hero-main { flex: 0 1 820px; min-width: 0; }
.hero-notes { flex: none; }

h1 {
  margin-bottom: 32px;
  font-weight: 500;
  font-size: clamp(38px, 5vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.hero-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
}

.hero-pick {
  min-height: 30px;
  padding: 5px 0;
  background: none;
  border: 0;
  color: var(--idle);
  text-align: left;
  cursor: pointer;
  transition: color .6s ease;
}
.hero-pick:hover, .hero-pick:focus-visible, .hero-pick.is-on { color: var(--light); }

/* Mobile name strip: shown from the mobile breakpoint down. */
.hero-strip { display: none; }

.hero-notes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--light-muted);
  font-size: 13px;
  padding-bottom: 5px;
  text-align: right;
}
.hero-caption { transition: opacity .15s ease; }
.hero-caption.is-fading { opacity: 0; }
.hero-sunset { color: var(--light); }
.hero-sunset[hidden] { display: none; }

/* Studio */

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--plate-w);
  align-items: baseline;
  gap: 32px 40px;
  padding: clamp(88px, 11vw, 150px) var(--gutter) clamp(72px, 9vw, 120px);
}

.studio h2 {
  max-width: 900px;
  font-weight: 500;
  font-size: clamp(26px, 2.8vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.studio-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--muted);
  font-size: 15px;
}

/* Selected work */

.work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--plate-w);
  align-items: start;
  gap: 40px;
  padding: 0 var(--gutter) clamp(72px, 9vw, 120px);
}

.work-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }

/* The fill is wider than the text, so names still line up with the headings above. */
.row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 2.2fr) minmax(0, 1.3fr);
  align-items: baseline;
  gap: 8px 32px;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  cursor: default;
  transition: background-color .4s ease-out, box-shadow .4s ease-out, color .2s ease-out;
}
.row.is-on {
  background: var(--row-hover);
  box-shadow: -12px 0 0 var(--row-hover), 12px 0 0 var(--row-hover);
}

.row-name { display: flex; flex-direction: column; gap: 2px; }

.row-name button {
  padding: 0;
  background: none;
  border: 0;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  cursor: default;
}
.row-name button:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

.row-under { color: var(--muted); font-size: 13px; }
.row-line { font-size: 15px; }
.row-award { color: var(--muted); font-size: 13px; }

.plate { position: sticky; top: 24px; width: 100%; max-width: 440px; }

.plate-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  isolation: isolate;
  background: var(--ink);
}
/* Same pattern as the hero: incoming on top, outgoing holds until it is covered. */
.plate-frame img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0s linear .4s, visibility 0s linear .4s;
}
.plate-frame img.is-on {
  z-index: 1;
  opacity: 1;
  visibility: visible;
  transition: opacity .4s ease-out, visibility 0s;
}

.plate-caption { min-height: 20px; margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 20px; }

/* Contact */

.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px 64px;
  padding: clamp(72px, 9vw, 120px) var(--gutter);
  background: var(--night);
  color: var(--light);
}

.contact-lead { flex: 1 1 420px; display: flex; flex-direction: column; gap: 14px; }
.contact-lead p { color: var(--light-muted); }

.contact h2 {
  font-weight: 500;
  font-size: clamp(30px, 3.4vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.contact-details {
  flex: 0 0 var(--plate-w);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 15px;
  font-style: normal;
  line-height: 1.9;
}
.contact-details a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: opacity .3s ease;
}
.contact-details a:hover { opacity: .7; }
.contact-details span { color: var(--light-muted); text-wrap: balance; }

/* Footer */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 22px var(--gutter) 32px;
  background: var(--night);
  border-top: 1px solid var(--foot-rule);
  color: var(--idle);
  font-size: 12px;
}

/* Mobile */

@media (max-width: 820px) {
  .site-header { padding: 16px var(--gutter); }

  .site-nav { gap: 16px; }
  .site-nav a { display: inline-flex; align-items: center; min-height: 44px; }

  #work { scroll-margin-top: 0; }

  /* Vertical scrolling stays with the browser; only sideways swipes reach main.js. */
  .hero { --fade: .9s; touch-action: pan-y pinch-zoom; }
  .hero.is-quick { --fade: .45s; }
  .hero[data-active="0"] .hero-assist { opacity: .6; }
  .hero-assist { --clear-from: 20%; --clear-to: 40%; --full-at: 60%; }

  .hero-foot {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-end;
    gap: 16px;
    bottom: 24px;
  }
  .hero-main { flex: none; }
  h1 { margin-bottom: 8px; }
  .hero-list { display: none; }

  .hero-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 44px;
    padding: 0;
    background: none;
    border: 0;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: opacity .2s ease-out;
  }
  .hero-strip:active { opacity: .6; transition-duration: 0s; }
  .strip-names { flex: 1 1 auto; min-width: 0; overflow: hidden; }
  .strip-track { display: inline-flex; gap: 16px; white-space: nowrap; will-change: transform; }
  .strip-track.is-shifting { transition: transform .3s var(--ease); }
  .strip-name { opacity: .3; transition: opacity .3s var(--ease); }
  .strip-name.is-current { opacity: 1; }
  .strip-name.is-gone { opacity: 0; }
  .strip-count { flex: none; color: var(--light-muted); font-size: 12px; font-weight: 400; }

  .hero-caption { display: none; }
  .hero-notes { padding-bottom: 0; text-align: left; }

  .studio { display: block; }
  .studio-side { margin-top: 32px; }

  /* The photo pins to the top and releases at the end of the section. */
  .work { display: flex; flex-direction: column; gap: 0; padding: 0; }
  .plate {
    order: -1;
    z-index: 1;
    top: 0;
    max-width: none;
    height: 45vh;
    height: 45svh;
    min-height: 220px;
  }
  .plate-frame { height: 100%; aspect-ratio: auto; }
  .plate-caption { display: none; }

  .work-index { padding: 0 var(--gutter) 48px; }
  .work-list { border-top: 0; }

  .row { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 8px 0 18px; color: var(--muted); }
  .row.is-on { background: none; box-shadow: none; }
  .row.is-on, .row.is-on .row-under, .row.is-on .row-award { color: var(--ink); }
  .row-award:empty { display: none; }
  .row-under, .row-award { transition: color .2s ease-out; }
  .row:active, .row:active .row-under, .row:active .row-award { color: var(--ink); transition-duration: 0s; }

  .row-name button { display: flex; align-items: center; width: 100%; min-height: 44px; }

  .contact { display: block; }
  .contact-details { margin-top: 32px; }
  .contact-details a { line-height: 44px; }
  .contact-details span { margin-top: 6px; line-height: 1.5; }

  .site-footer { flex-direction: column; }
}

@media (max-width: 340px) {
  .site-nav { gap: 12px; }
}

/* Keeps the foot clear of the header on the shortest portrait phones. */
@media (max-width: 820px) and (max-height: 700px) {
  h1 { margin-bottom: 8px; }
  .hero-foot { gap: 8px; bottom: 16px; }
}

/* The text reaches well above the middle here, so every photo needs the assist. */
@media (max-width: 820px) and (max-height: 640px) {
  .hero-assist { --clear-from: 12%; --clear-to: 20%; --full-at: 40%; }
  .hero[data-active="0"] .hero-assist,
  .hero[data-active="1"] .hero-assist { opacity: 1; }
}

/* Landscape phones: the panel fits the screen and the hero drops its minimum height. */
@media (min-width: 821px) and (max-height: 500px) {
  .hero { min-height: 0; }
  .plate-frame { aspect-ratio: auto; height: calc(100svh - 72px); }
  .hero-pick { min-height: 44px; }
  .site-header { padding: 14px var(--gutter); }
  .hero-foot { bottom: 12px; }
  h1 { margin-bottom: 6px; }
}

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

@media (prefers-reduced-motion: reduce) {
  .hero-dark { display: none; }
  *, *::before, *::after { transition: none !important; }
}
