/* Amplify Interactions: one geometric family (to match the logo), two colours, one moment. */

@font-face {
  font-family: "Jost";
  src: url("/fonts/Jost-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #F6F6F5;
  --ink: #171717;
  --steel: #626262;
  --line: #DCDCDA;
  --signal: #3346FF;
  --signal-ink: #2534C9;
  --wash: #EEEEEC;
  /* Background (ported from ericlouw.com): cursor glow, film grain. */
  --glow: rgba(0, 0, 0, 0.045);
  --grain: 0.035;
  --px: -2000px;
  --py: -2000px;
  --spot: 560px;
  --spotlight: radial-gradient(var(--spot) circle at var(--px) var(--py), var(--glow), transparent 62%);

  --max: 1760px;
  --gutter: clamp(20px, 4vw, 88px);
  --measure: 60ch;

  --fs-0: 1.0625rem;
  --fs-1: 1.25rem;
  --fs-2: 1.75rem;
  --fs-3: clamp(1.75rem, 2.4vw, 2.75rem);
  --fs-hero: clamp(2.5rem, 6.55vw, 8.75rem);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F0F10;
    --ink: #F1F1F1;
    --steel: #959598;
    --line: #2A2A2C;
    --signal: #8A98FF;
    --signal-ink: #AAB4FF;
    --wash: #151516;
    --glow: rgba(255, 255, 255, 0.07);
    --grain: 0.06;
  }
}
:root[data-theme="dark"] {
  --paper: #0F0F10;
  --ink: #F1F1F1;
  --steel: #959598;
  --line: #2A2A2C;
  --signal: #8A98FF;
  --signal-ink: #AAB4FF;
  --wash: #151516;
  --glow: rgba(255, 255, 255, 0.07);
  --grain: 0.06;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--paper); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background-color: transparent; /* html carries --paper; the .bg canvas (fixed, z-index -1) shows through */
  color: var(--ink);
  font-family: "Jost", "Avenir Next", "Futura", "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-0);
  line-height: 1.6;
  font-weight: 400;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Background, ported from ericlouw.com: a fixed canvas behind everything (bg.js: ripples in light,
   a slow starfield in dark, both reacting to the pointer), film grain over everything, and in light
   mode one viewport-anchored glow that follows the pointer. Opaque surfaces cover the canvas. */
.bg { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; }
.grain {
  position: fixed; inset: -100%; width: 300%; height: 300%;
  pointer-events: none; z-index: 120; opacity: var(--grain);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.4s steps(5) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
@media (hover: hover) and (pointer: fine) {
  html body { background-image: var(--spotlight); background-attachment: fixed; }
  /* Dark mode: no spotlight; the starfield brightens its own stars near the pointer instead. */
  :root[data-theme="dark"] { --spotlight: none; }
}
@media (hover: hover) and (pointer: fine) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --spotlight: none; }
}
@media (prefers-reduced-motion: reduce) { .grain { animation: none; } }
@media (forced-colors: active) { .bg, .grain { display: none; } }

a { color: var(--signal-ink); text-decoration: none; text-underline-offset: 0.18em; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { margin: 0; font-weight: 500; line-height: 1.15; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* The logo lockup as a mask, so it takes the ink colour in both themes. */
.logo, .foot-logo {
  display: block;
  aspect-ratio: 947 / 295;
  background: var(--ink);
  -webkit-mask: url("/brand/logo-lockup.png") center / contain no-repeat;
  mask: url("/brand/logo-lockup.png") center / contain no-repeat;
}

/* Page width: content sits in a centred column up to --max; the hero's field bleeds. */
.top, .hero-text, .band, .foot { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }

/* Header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.5rem 0;
  flex-wrap: wrap;
}
.logo { height: 46px; flex: none; }
.logo:focus-visible { outline-offset: 8px; }
.topnav { display: flex; gap: clamp(1rem, 2vw, 2.25rem); flex-wrap: wrap; font-size: var(--fs-1); }
.topnav a { color: var(--steel); }
.topnav a:hover { color: var(--ink); text-decoration: none; }
.theme {
  flex: none; margin-left: auto;
  width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 50%;
  background: none; color: var(--steel); cursor: pointer;
  display: grid; place-items: center;
  transition: color 200ms, border-color 200ms;
}
.theme:hover { color: var(--ink); border-color: var(--steel); }
.theme:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
.theme svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; grid-area: 1 / 1; }
.theme .moon { fill: currentColor; stroke: none; }
/* Shows the mode you would switch to: the moon in light, the sun in dark. */
.theme .sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme .sun { display: block; } :root:not([data-theme="light"]) .theme .moon { display: none; } }
:root[data-theme="dark"] .theme .sun { display: block; }
:root[data-theme="dark"] .theme .moon { display: none; }
:root[data-theme="light"] .theme .sun { display: none; }
:root[data-theme="light"] .theme .moon { display: block; }

/* Hero: the headline and the field both amplify under the pointer, in ink only (no colour). */
.hero {
  position: relative;
  padding-top: clamp(2.5rem, 7vw, 6.5rem);
  min-height: min(88vh, 1100px);
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
}
.hero-text {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "title title" "hint lede";
  column-gap: var(--gutter);
  row-gap: clamp(1.5rem, 3vw, 3rem);
  align-items: end;
  flex: none;
}
.amplify {
  grid-area: title;
  font-size: var(--fs-hero);
  line-height: 0.96;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  font-weight: 500;
  font-variation-settings: "wght" 500;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}
.amplify .w { display: inline-block; white-space: nowrap; }
.amplify .ch {
  --a: 0;
  display: inline-block;
  font-variation-settings: "wght" calc(500 + 320 * var(--a));
  transform: translateY(calc(var(--a) * -0.07em));
  transition: font-variation-settings 140ms ease-out, transform 140ms ease-out;
}
.amplify.resting .ch { transition-duration: 700ms; }

/* The one moment: the sentence powers up from thin to its resting weight while a pulse crosses the field. */
@keyframes power-up {
  from { font-variation-settings: "wght" 200; opacity: 0; transform: translateY(0.12em); }
  to   { font-variation-settings: "wght" 500; opacity: 1; transform: translateY(0); }
}
.amplify.boot .ch {
  animation: power-up 900ms cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--i) * 16ms);
}
@media (prefers-reduced-motion: reduce) {
  .amplify.boot .ch { animation: none; }
  .amplify .ch { transition: none; }
}

.hint {
  grid-area: hint;
  align-self: end;
  color: var(--steel);
  font-size: var(--fs-0);
  transition: opacity 500ms;
}
.hint.gone { opacity: 0; }
@media (hover: none) { .hint { visibility: hidden; } }
.lede {
  grid-area: lede;
  max-width: 44rem;
  justify-self: end;
  font-size: clamp(1.125rem, 1.35vw, 1.5rem);
  line-height: 1.45;
}

.field {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 180px;
  max-height: 420px;
  margin-top: clamp(1.5rem, 3vw, 3.5rem);
  pointer-events: none;
}

/* Bands: a full-width head, then rows laid out as a ledger. */
.band {
  padding: clamp(2.5rem, 4.5vw, 5rem) 0;
  border-top: 1px solid var(--line);
}
.band-head {
  /* The title takes the left third; the intro starts at the centre third and may run to the right edge. */
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  align-items: baseline;
  gap: 1rem var(--gutter);
  margin-bottom: clamp(1.5rem, 3vw, 3rem);
}
.band-head h2 {
  font-size: var(--fs-3);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.band-head p {
  color: var(--steel);
  max-width: 72ch;
  line-height: 1.45;
  font-size: var(--fs-1);
}

.row {
  display: grid;
  grid-template-columns: 88px minmax(12rem, 0.9fr) minmax(0, 2.2fr) minmax(10rem, 0.7fr);
  grid-template-areas: "icon name desc meta" "previews previews previews previews";
  gap: 1rem clamp(1.5rem, 3vw, 4rem);
  padding: clamp(1.5rem, 2.2vw, 2.25rem) 0;
  align-items: start;
  border-top: 1px solid var(--line);
}
.rows .row:first-child { border-top-color: transparent; padding-top: 0.5rem; }

/* The row you are on carries more: its rules take the signal colour and its icon lifts. */
.row { transition: border-color 220ms; }
.row:hover, .row:hover + .row { border-top-color: var(--signal); }
.icon, .glyph { transition: transform 260ms cubic-bezier(.2,.7,.2,1), filter 260ms; }
.row:hover .icon, .row.open .icon { transform: translateY(-3px) scale(1.04); filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.24)); }
.row.open, .row.open + .row { border-top-color: var(--signal); }
.row:hover .glyph { transform: translateY(-3px); }
@media (prefers-reduced-motion: reduce) { .row, .icon, .glyph { transition: none; } }
.rows .row:last-child { padding-bottom: 0; }

.icon {
  grid-area: icon;
  width: 88px; height: 88px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.14));
}
.glyph {
  grid-area: icon;
  width: 88px; height: 88px;
  display: grid; place-items: center;
  color: var(--signal);
  background: var(--wash);
  border-radius: 20px;
}
.glyph svg { width: 46px; height: 46px; }

.row-name { grid-area: name; }
.row-name h3 {
  font-size: var(--fs-2);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.row-name h3 a { color: inherit; }
.row-name h3 a::after {
  content: "";
  display: inline-block;
  width: 0.45em; height: 0.45em;
  margin-left: 0.45em;
  border-top: 2px solid var(--signal);
  border-right: 2px solid var(--signal);
  transform: translateY(-0.08em) rotate(45deg);
  transition: transform 150ms;
}
.row-name h3 a:hover::after { transform: translate(0.15em, -0.08em) rotate(45deg); }
.status { margin-top: 0.5rem; color: var(--steel); font-size: var(--fs-0); }
.status.open { color: var(--signal-ink); }
.row-desc { grid-area: desc; max-width: var(--measure); font-size: var(--fs-0); }
.row-meta { grid-area: meta; color: var(--steel); font-size: var(--fs-0); line-height: 1.5; }
.row-meta li { padding-left: 1rem; position: relative; }
.row-meta li::before {
  content: "";
  position: absolute; left: 0; top: 0.75em;
  width: 0.45rem; height: 2px;
  background: var(--line);
}


/* Previews: the icon is a button; it opens a strip of thumbnails under the row, each opening the lightbox. */
.icon-btn {
  grid-area: icon;
  display: block; padding: 0; border: 0; background: none; cursor: pointer;
  width: 88px; height: 88px; border-radius: 20px;
}
.icon-btn:focus-visible { outline: 3px solid var(--signal); outline-offset: 4px; }
.icon-btn::after { /* the small affordance: a caret under the icon once there is something to open */
  content: ""; display: block; margin: 0.55rem auto 0; width: 0.45em; height: 0.45em;
  border-right: 2px solid var(--steel); border-bottom: 2px solid var(--steel);
  transform: rotate(45deg); transition: transform 220ms, border-color 220ms;
}
.row.open .icon-btn::after { transform: rotate(225deg) translate(-0.1em, -0.1em); border-color: var(--signal); }
.previews {
  grid-area: previews;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 360ms cubic-bezier(.2,.7,.2,1);
}
.previews > div { overflow: hidden; min-height: 0; }
.row.open .previews { grid-template-rows: 1fr; }
.thumbs {
  display: flex; flex-wrap: wrap; gap: 1.25rem clamp(1rem, 2vw, 2rem);
  padding: 0.5rem 0 0.75rem;
}
.thumb {
  display: block; padding: 0; border: 0; background: none; cursor: zoom-in;
  width: clamp(180px, 22vw, 300px);
  color: var(--steel); font: inherit; font-size: var(--fs-0); text-align: left;
}
.thumb img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 16 / 10; object-fit: cover; object-position: top; /* one strip height whatever the window's shape */
  border-radius: 8px;
  outline: 1px solid var(--line);
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.45);
  transition: transform 220ms cubic-bezier(.2,.7,.2,1), box-shadow 220ms;
}
.thumb:hover img, .thumb:focus-visible img { transform: translateY(-3px); box-shadow: 0 18px 32px -16px rgba(0, 0, 0, 0.5); }
.thumb:focus-visible { outline: 3px solid var(--signal); outline-offset: 4px; border-radius: 8px; }
.thumb.center img { object-fit: contain; object-position: center; }
.thumb span { display: block; margin-top: 0.5rem; }
.previews-note { padding: 0.25rem 0 0.75rem; color: var(--steel); font-size: var(--fs-0); }
@media (prefers-reduced-motion: reduce) { .previews, .thumb img, .icon-btn::after { transition: none; } }

/* Lightbox */
.lightbox {
  border: 0; padding: 0; margin: auto;
  width: min(100vw - 2rem, 1760px); max-width: none; max-height: none;
  background: transparent; color: #F1F1F1;
}
.lightbox::backdrop { background: rgba(10, 10, 10, 0.88); }
.lightbox figure { margin: 0; }
.lightbox img {
  display: block; width: 100%; height: auto;
  max-height: calc(100vh - 7rem); object-fit: contain;
  border-radius: 10px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.8);
}
.lightbox figcaption { margin: 1rem auto 0; max-width: 70ch; text-align: center; font-size: var(--fs-0); color: #C3C3C5; }
.lightbox button {
  position: fixed; border: 0; background: rgba(241, 241, 241, 0.12); color: #F1F1F1; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%; font: inherit; font-size: 1.6rem; line-height: 1;
  display: grid; place-items: center;
}
.lightbox button:hover { background: rgba(241, 241, 241, 0.24); }
.lightbox button:focus-visible { outline: 3px solid #8A98FF; outline-offset: 3px; }
.lb-close { top: 1rem; right: 1rem; }
.lb-close::before, .lb-close::after {
  content: ""; grid-area: 1 / 1; width: 1.1rem; height: 2px; background: currentColor; border-radius: 1px;
}
.lb-close::before { transform: rotate(45deg); }
.lb-close::after { transform: rotate(-45deg); }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 1rem; } .lb-next { right: 1rem; }
.lb-prev::before, .lb-next::before {
  content: ""; width: 0.6rem; height: 0.6rem; border-top: 2px solid currentColor; border-right: 2px solid currentColor;
}
.lb-prev::before { transform: translateX(0.1rem) rotate(225deg); }
.lb-next::before { transform: translateX(-0.1rem) rotate(45deg); }
.lightbox[data-single] .lb-prev, .lightbox[data-single] .lb-next { display: none; }

/* Studio */
.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem var(--gutter);
  margin-top: clamp(2.5rem, 4vw, 4.5rem);
}
.principles li { border-top: 2px solid var(--ink); padding-top: 1.25rem; }
.principles h3 { font-size: var(--fs-2); font-weight: 500; letter-spacing: -0.01em; }
.principles p { margin-top: 0.75rem; max-width: 42ch; color: var(--steel); }
.studio-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem var(--gutter);
  margin-top: clamp(2.5rem, 4vw, 4.5rem);
}
.built, .contact {
  display: grid;
  gap: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.built h3, .contact h3 { font-size: var(--fs-1); font-weight: 500; }
.built p, .contact p { max-width: 70ch; }
.built p { color: var(--steel); }

/* Footer: the lockup, large, as the closing mark. */
.foot {
  padding: clamp(3rem, 6vw, 7rem) 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--steel);
}
.foot-logo { width: min(100%, 110px); }
.foot-row {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem;
  margin-top: clamp(2.5rem, 5vw, 5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.foot nav { display: flex; gap: 1.5rem; }
.colophon { margin-top: 1.25rem; max-width: 70ch; font-size: 0.95rem; }
.foot a { color: var(--steel); }
.foot a:hover { color: var(--ink); }

/* Secondary pages */
.page { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; padding: clamp(2rem, 5vw, 5rem) 0; }
.page > * { max-width: var(--measure); }
.page h1 { font-size: var(--fs-3); font-weight: 500; letter-spacing: -0.01em; }
.page h2 { margin-top: 2rem; font-size: var(--fs-1); font-weight: 500; }
.page p { margin-top: 0.75rem; }
.page .updated { color: var(--steel); margin-top: 0.5rem; }

/* Laptop and below */
@media (max-width: 1100px) {
  .row {
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-areas: "icon name" "icon desc" "icon meta" "previews previews";
    gap: 0.6rem 1.5rem;
  }
  .icon, .glyph, .icon-btn { width: 72px; height: 72px; border-radius: 16px; }
  .glyph svg { width: 40px; height: 40px; }
  .row-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 1.25rem; }
  .row-meta li { padding-left: 0; }
  .row-meta li::before { display: none; }
  .principles { grid-template-columns: 1fr; gap: 1.5rem; }
  .studio-cols { grid-template-columns: 1fr; }
  .principles p { max-width: var(--measure); }
}

/* Phones */
@media (max-width: 720px) {
  .top { padding: 1rem 0; }
  .logo { height: 36px; }
  .topnav { font-size: var(--fs-0); gap: 0.9rem 1.1rem; }
  .hero { min-height: 0; }
  .hero-text { grid-template-columns: 1fr; grid-template-areas: "title" "lede"; }
  .hint { display: none; }
  .lede { justify-self: start; font-size: var(--fs-1); }
  .amplify { font-size: clamp(2.25rem, 11vw, 3.5rem); }
  .field { min-height: 140px; max-height: 200px; }
  .row { grid-template-columns: 56px minmax(0, 1fr); gap: 0.5rem 1rem; }
  .icon, .glyph, .icon-btn { width: 56px; height: 56px; border-radius: 12px; }
  .thumbs { gap: 1rem; }
  .thumbs li { width: calc(50% - 0.5rem); }
  .thumb { width: 100%; }
  .glyph svg { width: 32px; height: 32px; }
  .row-name h3 { font-size: var(--fs-1); }
  .band-head { grid-template-columns: 1fr; }
  .band-head p { font-size: var(--fs-0); }
  .foot nav { gap: 1.1rem; }
}
