:root {
  --bg: #EDEFF2;
  --text: #14213D;
  --panel: #FFFFFF;
  --muted: #4A5568;
  --accent: #2B4EFF;
  --yellow: #FFD23F;
  --stripe1: #DDE2EA;
  --stripe2: #E8ECF2;
  --footer-bg: #14213D;
  --footer-fg: #FFFFFF;
  --btn-bg: #14213D;
  --btn-fg: #FFFFFF;
  --btn-hover: #2B4EFF;
  --btn-hover-fg: #FFFFFF;
  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --line: 2px solid var(--text);
  --radius: 10px;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1527;
    --text: #E9EDF7;
    --panel: #192140;
    --muted: #A8B3CC;
    --accent: #7C93FF;
    --stripe1: #18203A;
    --stripe2: #1E2746;
    --footer-bg: #080C18;
    --footer-fg: #E9EDF7;
    --btn-bg: #E9EDF7;
    --btn-fg: #0F1527;
    --btn-hover: #7C93FF;
    --btn-hover-fg: #0F1527;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1527;
  --text: #E9EDF7;
  --panel: #192140;
  --muted: #A8B3CC;
  --accent: #7C93FF;
  --stripe1: #18203A;
  --stripe2: #1E2746;
  --footer-bg: #080C18;
  --footer-fg: #E9EDF7;
  --btn-bg: #E9EDF7;
  --btn-fg: #0F1527;
  --btn-hover: #7C93FF;
  --btn-hover-fg: #0F1527;
  color-scheme: dark;
}
/* The Play page and the yellow band stay yellow in both themes */
body.play, .on-yellow {
  --bg: #FFD23F;
  --text: #14213D;
  --panel: #FFFFFF;
  --muted: #3B4560;
  --accent: #2B4EFF;
  --stripe1: #FFF3B8;
  --stripe2: #FFF9DB;
  --btn-bg: #14213D;
  --btn-fg: #FFFFFF;
  --btn-hover: #2B4EFF;
  --btn-hover-fg: #FFFFFF;
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.wrap { width: min(1180px, 100% - 3rem); margin-inline: auto; }
main:focus { outline: none; }

.skip { position: absolute; left: -999px; top: .5rem; background: var(--btn-bg); color: var(--btn-fg); padding: .5rem 1rem; border: 0; border-radius: var(--radius); font: inherit; z-index: 100; }
.skip:focus { left: .5rem; }

/* Type */
h1, h2, h3, .wordmark { font-family: var(--display); font-variation-settings: "wdth" 85, "opsz" 72; letter-spacing: -0.015em; margin: 0; }
h1 { font-weight: 800; line-height: 1; font-size: clamp(2.6rem, 6.5vw, 5.25rem); }
h2 { font-weight: 800; line-height: 1.05; font-size: clamp(1.9rem, 4vw, 3rem); }
h3 { font-weight: 700; line-height: 1.15; font-size: clamp(1.5rem, 2.6vw, 2rem); }
p { margin: 0 0 1em; max-width: 65ch; }
.lead { font-size: 1.25rem; line-height: 1.5; max-width: 40ch; }
mark.todo { background: var(--yellow); color: #14213D; padding: .05em .3em; border-radius: 4px; }
.play mark.todo, .on-yellow mark.todo { background: #fff; }

/* Header */
.site-header .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: 1.25rem; }
.wordmark { font-weight: 800; font-size: 1.35rem; text-decoration: none; }
.site-nav { display: flex; gap: .25rem; }
.site-nav a { text-decoration: none; padding: .35rem .9rem; border-radius: 999px; font-weight: 500; }
.site-nav a:hover { background: var(--panel); }
.site-nav a[aria-current="page"] { background: var(--btn-bg); color: var(--btn-fg); }

/* Buttons */
.btn { display: inline-block; padding: .7rem 1.3rem; border: var(--line); border-color: var(--btn-bg); border-radius: var(--radius); background: var(--btn-bg); color: var(--btn-fg); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--btn-hover); border-color: var(--btn-hover); color: var(--btn-hover-fg); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--text); }
.btn.ghost:hover { background: var(--panel); color: var(--text); border-color: var(--text); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.text-link { font-weight: 600; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.text-link:hover { color: var(--accent); }

/* Hero */
.hero { padding-block: clamp(1.5rem, 5vw, 4rem) clamp(3rem, 7vw, 6rem); }
.hero h1 { margin-bottom: 1.5rem; max-width: 13ch; }
.hero .lead { max-width: 44ch; }

/* Gear train down the right edge of the home page */
.gears { position: fixed; top: 0; right: 0; width: min(300px, 30vw); height: 100vh; pointer-events: none; z-index: 0; opacity: .32; overflow: hidden; }
.gears svg { width: 100%; height: 100%; }
.gears path { stroke: var(--text); stroke-width: 1.5; fill-rule: evenodd; stroke-linejoin: round; }
.gears .ga { fill: var(--accent); }
.gears .gb { fill: #FFD23F; }
.site-header, main, .site-footer { position: relative; z-index: 1; }

/* Sections */
.section { padding-block: clamp(3rem, 7vw, 6rem); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.5rem; }

/* Photo slots */
.slot { position: relative; margin: 0; }
.slot img { width: 100%; height: auto; border: var(--line); border-radius: var(--radius); background: var(--panel); }
.slot.cover img { aspect-ratio: var(--ar, 4 / 3); object-fit: cover; }
.ph-box { aspect-ratio: var(--ar, 4 / 3); display: grid; place-items: center; text-align: center; padding: 1rem; border: var(--line); border-radius: var(--radius); background: repeating-linear-gradient(135deg, var(--stripe1) 0 12px, var(--stripe2) 12px 24px); color: var(--muted); font-size: .95rem; }
figure { margin: 0; }
figcaption { margin-top: .6rem; font-size: .9rem; color: var(--muted); max-width: 65ch; }
.slot-hint { position: absolute; right: .6rem; bottom: .6rem; background: var(--accent); color: #fff; padding: .25rem .65rem; border-radius: 6px; font-size: .8rem; font-weight: 600; pointer-events: none; }
.slot-x { position: absolute; right: .6rem; top: .6rem; width: 1.8rem; height: 1.8rem; border-radius: 50%; border: 2px solid #14213D; background: #fff; color: #14213D; font-size: 1.1rem; line-height: 1; cursor: pointer; align-items: center; justify-content: center; padding: 0; }
.slot-x:hover { background: #c62828; color: #fff; border-color: #c62828; }

/* Title block */
.titleblock { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 2px; background: var(--text); border: var(--line); border-radius: 6px; overflow: hidden; margin: 1.25rem 0 0; }
.titleblock > div { background: var(--panel); padding: .55rem .8rem; position: relative; }
.titleblock dt { font-size: .78rem; color: var(--muted); font-weight: 500; line-height: 1.3; }
.titleblock dd { margin: 0; font-weight: 600; font-size: .95rem; line-height: 1.35; }
.titleblock .fx { position: absolute; right: .25rem; top: .25rem; }

/* Featured rows */
.feature { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2rem; align-items: center; margin-bottom: clamp(3rem, 6vw, 5rem); }
.feature:last-child { margin-bottom: 0; }
.feature .media { grid-column: 1 / 8; grid-row: 1; display: block; text-decoration: none; }
.feature .body { grid-column: 8 / 13; grid-row: 1; }
.feature.flip .media { grid-column: 6 / 13; }
.feature.flip .body { grid-column: 1 / 6; }
.feature .media img, .feature .media .ph-box { transition: box-shadow .15s ease, transform .15s ease; }
a.media:hover img, a.media:hover .ph-box { box-shadow: 8px 8px 0 var(--accent); transform: translate(-4px, -4px); }
.feature h3 { margin-bottom: .75rem; }
.feature h3 a { text-decoration: none; }
.feature h3 a:hover { color: var(--accent); }

/* Play teaser */
.play-teaser { background: var(--bg); color: var(--text); border-block: var(--line); }
.play-teaser .section-head { margin-bottom: 1.5rem; }
.tilt-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-block: 2rem 2.25rem; }
.tilt-row > :nth-child(1) { transform: rotate(-2deg); }
.tilt-row > :nth-child(2) { transform: rotate(1.5deg); }
.tilt-row > :nth-child(3) { transform: rotate(-1deg); }

/* Work index */
.page-head { padding-block: clamp(1.5rem, 4vw, 3rem) clamp(2rem, 4vw, 3rem); }
.page-head p { margin-top: 1.25rem; font-size: 1.15rem; max-width: 50ch; }
.work-list { list-style: none; margin: 0; padding: 0; border-bottom: var(--line); }
.work-list > li { border-top: var(--line); }
.work-list .row { display: grid; grid-template-columns: 220px 1fr auto; gap: 1.5rem; align-items: center; padding: 1.25rem .75rem; text-decoration: none; position: relative; }
a.row:hover { background: var(--panel); }
.work-list h2 { font-size: clamp(1.4rem, 2.5vw, 1.9rem); margin-bottom: .3rem; }
.work-list p { margin: 0; color: var(--muted); font-size: 1rem; }
.work-list .when { font-weight: 600; text-align: right; font-size: .95rem; }

/* Case study */
.crumb { display: inline-block; margin-bottom: 1.5rem; font-weight: 500; }
.cs-head { padding-block: clamp(1.5rem, 4vw, 3rem) 2.5rem; }
.cs-head h1 { margin-bottom: 1.25rem; max-width: 16ch; }
.cs-head .lead { max-width: 52ch; }
.cs-hero { margin-bottom: 1.5rem; }
.cs-section { display: grid; grid-template-columns: minmax(9rem, 1fr) 3fr; gap: 2rem; padding-block: 2.5rem; border-top: var(--line); }
.cs-section > h2 { font-size: 1.4rem; align-self: start; position: sticky; top: 1.25rem; }
.cs-body > * + * { margin-top: 1.25rem; }
.cs-body p { margin: 0; }
.fig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.para-wrap { position: relative; }
.para-wrap .px { position: absolute; right: -2.2rem; top: 0; }
.next { display: block; margin-top: 3rem; padding: 2rem; background: var(--btn-bg); color: var(--btn-fg); border-radius: var(--radius); text-decoration: none; }
.next:hover { background: var(--btn-hover); color: var(--btn-hover-fg); }
.next small { display: block; font-size: .9rem; opacity: .85; margin-bottom: .25rem; }
.next span { font-family: var(--display); font-variation-settings: "wdth" 85, "opsz" 72; font-weight: 800; font-size: clamp(1.5rem, 3vw, 2.25rem); }

/* Play */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2.5rem; }
.chip { font: inherit; font-weight: 500; padding: .35rem 1rem; border: var(--line); border-radius: 999px; background: transparent; color: var(--text); cursor: pointer; }
.chip:hover { background: rgba(255,255,255,.7); }
.chip[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-fg); }
.play-grid { columns: 3 260px; column-gap: 1.75rem; padding-bottom: clamp(3rem, 7vw, 6rem); }
.tile { break-inside: avoid; margin: 0 0 2rem; transition: transform .15s ease; }
.tile:nth-child(odd) { transform: rotate(-1deg); }
.tile:nth-child(even) { transform: rotate(1deg); }
.tile:hover { transform: rotate(0); }
.tile h3 { font-size: 1.25rem; margin-top: .7rem; }
.tile p { margin: 0; font-size: .95rem; color: var(--muted); }

/* About */
.about-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: clamp(2rem, 5vw, 4rem); padding-bottom: clamp(3rem, 7vw, 5rem); align-items: start; }
.about-grid .slot { position: sticky; top: 1.25rem; }
.about-grid h2 { font-size: 1.6rem; margin: 2.5rem 0 1rem; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.5rem; border-left: var(--line); }
.timeline li { position: relative; padding-bottom: 1.5rem; }
.timeline li::before { content: ""; position: absolute; left: calc(-1.5rem - 8px); top: .45rem; width: 14px; height: 14px; background: var(--accent); border: var(--line); border-radius: 50%; }
.timeline strong { display: block; }
.timeline .tl-role { color: var(--muted); font-size: .95rem; display: block; }
.timeline .fx { margin-left: .5rem; }
.contact-band { background: #2B4EFF; color: #fff; padding-block: clamp(2.5rem, 6vw, 4rem); }
.contact-band h2 { margin-bottom: 1rem; }
.contact-band .btn { background: #fff; color: #14213D; border-color: #fff; }
.contact-band .btn:hover { background: #FFD23F; border-color: #FFD23F; color: #14213D; }
.contact-band .btn.ghost { background: transparent; color: #fff; border-color: #fff; }
.contact-band .btn.ghost:hover { background: rgba(255,255,255,.15); color: #fff; }
.contact-band :focus-visible { outline-color: #fff; }

/* Footer */
.site-footer { background: var(--footer-bg); color: var(--footer-fg); padding-block: 2.5rem 6rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.site-footer p { margin: 0; max-width: 40ch; }
.site-footer .links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.site-footer a { color: #FFD23F; font-weight: 500; }
.site-footer :focus-visible { outline-color: #FFD23F; }
.settings { width: 100%; border-top: 1px solid rgba(255,255,255,.25); padding-top: 1.25rem; font-size: .95rem; display: none; gap: .6rem 1.5rem; flex-wrap: wrap; align-items: center; }
body.editing .settings { display: flex; }
.settings span.lab { opacity: .75; }

@media (max-width: 860px) {
  .feature, .feature.flip { grid-template-columns: 1fr; gap: 1.25rem; }
  .feature .media, .feature .body, .feature.flip .media, .feature.flip .body { grid-column: 1; grid-row: auto; }
  .tilt-row { grid-template-columns: 1fr 1fr; }
  .tilt-row > :nth-child(3) { display: none; }
  .work-list .row { grid-template-columns: 110px 1fr; }
  .work-list .when { grid-column: 2; text-align: left; }
  .cs-section { grid-template-columns: 1fr; gap: 1rem; }
  .cs-section > h2 { position: static; }
  .about-grid { grid-template-columns: 1fr; }
  .about-grid .slot { position: static; max-width: 340px; }
  
}
@media (max-width: 520px) {
  .fig-row { grid-template-columns: 1fr; }
  .site-header .wrap { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  a.media:hover img, a.media:hover .ph-box { transform: none; }
}

.skip { text-decoration: none; }
.slot img { height: auto; }
.tile .slot img { aspect-ratio: auto; }
