/* Layout: one narrow reading column for the essay, widening to a full grid for work and clients. Blue pencil = the editor's mark, used as the single accent. */
:root {
  --paper: #f5f6f8;
  --paper-2: #e9ebf0;
  --ink: #16181f;
  --ink-soft: #545a6b;
  --rule: #d3d6de;
  --pencil: #2f47d6;
  --pencil-wash: #dfe4fb;

  --f-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Literata", Georgia, "Times New Roman", serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --s-xs: .78rem; --s-sm: .9rem; --s-md: 1.12rem; --s-lg: 1.5rem; --s-xl: 2.4rem;
  --s-hero: clamp(2.7rem, 8.5vw, 6.4rem);
  --gutter: clamp(16px, 4vw, 48px);
  --col: 40rem;
  --wide: 72rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12141a; --paper-2: #1c1f28; --ink: #eceef3; --ink-soft: #a2a8b8;
    --rule: #2d3140; --pencil: #8b9bff; --pencil-wash: #232a52; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12141a; --paper-2: #1c1f28; --ink: #eceef3; --ink-soft: #a2a8b8;
  --rule: #2d3140; --pencil: #8b9bff; --pencil-wash: #232a52; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
img { max-width: 100%; height: auto; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--f-body); font-size: var(--s-md); line-height: 1.65;
  padding-inline: var(--gutter); padding-block: 0;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--pencil); outline-offset: 3px; border-radius: 2px; }
.wrap { max-width: var(--wide); margin-inline: auto; }
.label {
  font-family: var(--f-mono); font-size: var(--s-xs); font-weight: 500;
  text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft);
}

/* Header */
.site-head {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter);
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: .9rem; }
.brand { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; text-decoration: none; }
.brand b { font-family: var(--f-display); font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; }
.brand span { font-family: var(--f-mono); font-size: var(--s-xs); color: var(--ink-soft); letter-spacing: .06em; }
nav { display: flex; gap: 1.4rem; }
nav a { font-family: var(--f-mono); font-size: var(--s-sm); text-decoration: none; color: var(--ink-soft); }
nav a:hover { color: var(--pencil); }

/* Hero */
.hero { padding-block: clamp(3.5rem, 10vw, 7.5rem) clamp(2.5rem, 6vw, 4.5rem); }
.hero h1 {
  font-family: var(--f-display); font-weight: 800; font-size: var(--s-hero);
  line-height: .95; letter-spacing: -.045em; margin: 0; text-wrap: balance; max-width: 13ch;
}
.hero .sub {
  font-family: var(--f-body); font-style: italic; font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.3; color: var(--pencil); margin: 1.6rem 0 0; max-width: 28ch; text-wrap: balance;
}

/* Essay */
.essay { display: grid; grid-template-columns: minmax(0, var(--col)); gap: 1rem 3rem; padding-block: 1rem 3rem; border-top: 1px solid var(--rule); padding-top: 2.5rem; }
.essay aside { padding-top: .35rem; }
.essay .body { min-width: 0; }
.essay p { margin: 0 0 1.15em; }
.essay .lede { font-size: var(--s-lg); line-height: 1.4; font-weight: 500; letter-spacing: -.01em; }
.essay em.mark { font-style: normal; background: linear-gradient(transparent 58%, var(--pencil-wash) 58%); padding-inline: .1em; }
.questions { list-style: none; padding: 0; margin: 1.8em 0; display: grid; gap: .9rem; }
.questions li {
  font-family: var(--f-display); font-weight: 600; font-size: 1.25rem; line-height: 1.3; letter-spacing: -.015em;
  padding-left: 1.6rem; position: relative; text-wrap: balance;
}
.questions li::before { content: "?"; position: absolute; left: 0; top: 0; color: var(--pencil); font-weight: 800; }
.essay .close { font-size: var(--s-lg); line-height: 1.45; margin-top: 1.6em; }

/* Section heads */
.sec { padding-block: 3.5rem; border-top: 1px solid var(--rule); }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.sec-head h2 { font-family: var(--f-display); font-weight: 800; font-size: var(--s-xl); letter-spacing: -.035em; line-height: 1; margin: 0; }
.more { font-family: var(--f-mono); font-size: var(--s-sm); color: var(--pencil); text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px; }
.more:hover { border-bottom-width: 2px; }

/* Portfolio grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  aspect-ratio: 4 / 3; max-width: 100%; padding: 1.1rem 1.2rem; text-decoration: none;
  background: var(--paper-2) center / cover no-repeat; border-radius: 3px; overflow: hidden;
  transition: transform .25s ease;
}
.tile:hover { transform: translateY(-3px); }
@media (prefers-reduced-motion: reduce) { .tile, .tile:hover { transition: none; transform: none; } }
.tile .client { font-family: var(--f-display); font-weight: 800; font-size: 1.55rem; letter-spacing: -.03em; line-height: 1.05; }
.tile .what { font-family: var(--f-mono); font-size: var(--s-xs); color: var(--ink-soft); letter-spacing: .04em; }
.tile.outline { background: transparent; border: 1px dashed var(--rule); }
.tile.tinted { background: var(--tile-bg); color: var(--tile-fg); transition: transform .25s ease, filter .25s ease; }
.tile.tinted .what { color: var(--tile-accent, var(--tile-fg)); opacity: .85; }
.tile.tinted:hover { filter: brightness(1.08); }
.tile.tinted:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Latest */
.latest { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem 2rem; align-items: end; }
.latest h3 { font-family: var(--f-display); font-weight: 800; font-size: clamp(2rem, 6vw, 3.8rem); letter-spacing: -.045em; line-height: .95; margin: .5rem 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: .55rem; font-family: var(--f-mono); font-size: var(--s-sm); font-weight: 500;
  padding: .85rem 1.2rem; border-radius: 2px; background: var(--ink); color: var(--paper); text-decoration: none; border: 0; cursor: pointer;
}
.btn:hover { background: var(--pencil); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.btn.ghost:hover { border-color: var(--pencil); color: var(--pencil); background: transparent; }

/* Clients */
.clients { display: flex; flex-wrap: wrap; gap: .35rem 1.4rem; list-style: none; padding: 0; margin: 0; max-width: 60rem; }
.clients li { font-family: var(--f-display); font-weight: 600; font-size: clamp(1.2rem, 2.6vw, 1.7rem); letter-spacing: -.025em; line-height: 1.35; color: var(--ink-soft); }
.clients-note { margin-top: 1.4rem; }

/* Contact */
.contact { padding-block: 4.5rem 3rem; border-top: 1px solid var(--rule); }
.contact h2 { font-family: var(--f-display); font-weight: 800; font-size: var(--s-hero); letter-spacing: -.05em; line-height: .95; margin: 0 0 2rem; max-width: 12ch; text-wrap: balance; }
.contact-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.email { font-family: var(--f-mono); font-size: clamp(1rem, 2.4vw, 1.25rem); user-select: all; padding: .8rem 1rem; background: var(--paper-2); border-radius: 2px; overflow-wrap: anywhere; }
.copied { font-family: var(--f-mono); font-size: var(--s-xs); color: var(--pencil); }

footer { padding-block: 2rem 2.5rem; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

@media (max-width: 760px) {
  .essay { grid-template-columns: minmax(0, 1fr); }
  .latest { grid-template-columns: minmax(0, 1fr); }
}

/* Project pages */
.back { font-family: var(--f-mono); font-size: var(--s-sm); color: var(--ink-soft); text-decoration: none; }
.back:hover { color: var(--pencil); }
.proj-hero { padding-block: clamp(2.5rem, 7vw, 5rem) 2.5rem; display: grid; gap: 1.2rem; }
.proj-hero h1 { font-family: var(--f-display); font-weight: 800; font-size: var(--s-hero); line-height: .95; letter-spacing: -.045em; margin: 0; text-wrap: balance; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 1.5rem 2.5rem; padding-block: 1.8rem; border-block: 1px solid var(--rule); margin: 0; }
.facts div { min-width: 0; }
.facts dt { margin-bottom: .35rem; }
.facts dd { margin: 0; font-size: var(--s-sm); line-height: 1.5; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 0; }
.tags li { font-family: var(--f-mono); font-size: var(--s-xs); padding: .25rem .55rem; border: 1px solid var(--rule); border-radius: 2px; }
.case { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, var(--col)); gap: .6rem 3rem; padding-block: 2.6rem; border-bottom: 1px solid var(--rule); }
.case h2 { margin: .3rem 0 0; }
.case .body { min-width: 0; }
.case p { margin: 0 0 1em; }
.case ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .7rem; }
.case li::marker { color: var(--brand, var(--pencil)); }
.big-idea { padding-block: clamp(3rem, 8vw, 5.5rem); border-bottom: 1px solid var(--rule); }
.big-idea blockquote { margin: 1rem 0 0; font-family: var(--f-display); font-weight: 800; font-size: clamp(2.2rem, 7vw, 5rem); line-height: .98; letter-spacing: -.045em; color: var(--brand, var(--pencil)); max-width: 14ch; text-wrap: balance; }
@media (max-width: 760px) { .case { grid-template-columns: minmax(0, 1fr); } }

/* Reel: a user-controlled filmstrip of standalone creative */
.reel-sec { padding-block: 3.5rem; border-top: 1px solid var(--rule); }
.reel-controls { display: flex; align-items: center; gap: .6rem; }
.reel-count { font-family: var(--f-mono); font-size: var(--s-xs); color: var(--ink-soft); font-variant-numeric: tabular-nums; min-width: 4.5ch; text-align: right; }
.reel-btn {
  width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; font-size: 1rem;
}
.reel-btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.reel-btn:disabled { opacity: .3; cursor: default; }
.reel {
  display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter);
  padding-bottom: 1rem; scrollbar-width: thin; scrollbar-color: var(--rule) transparent;
  list-style: none; margin-block: 0;
}
@media (prefers-reduced-motion: reduce) { .reel { scroll-behavior: auto; } }
.reel li { flex: 0 0 auto; scroll-snap-align: start; }
.reel img {
  display: block; height: min(clamp(14rem, 34vw, 22rem), calc(82vw / var(--ar, 1.33))); width: auto; max-width: none;
  object-fit: cover; border-radius: 3px; background: var(--paper-2); box-shadow: 0 0 0 1px var(--rule);
}
.reel figure { margin: 0; display: grid; gap: .7rem; justify-items: start; }
.reel figcaption { width: 100%; }
.frame {
  aspect-ratio: 4 / 3; max-width: 100%; border-radius: 3px; overflow: hidden; position: relative;
  background: var(--paper-2) center / cover no-repeat;
  display: flex; align-items: flex-end; padding: 1rem 1.1rem;
}
.frame .ph { font-family: var(--f-mono); font-size: var(--s-xs); color: var(--ink-soft); letter-spacing: .06em; }
.frame.has-img .ph { display: none; }
.reel figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.reel figcaption b { font-family: var(--f-display); font-weight: 600; font-size: 1.05rem; letter-spacing: -.015em; }
.reel figcaption a { font-family: var(--f-mono); font-size: var(--s-xs); color: var(--pencil); text-decoration: none; white-space: nowrap; }
.reel figcaption a:hover { text-decoration: underline; }

/* Featured video */
.featured { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: 2rem 3rem; align-items: start; }
.featured-media { display: grid; gap: 1.2rem; justify-items: start; min-width: 0; }
.featured-media .video { width: 100%; }
.featured-text { display: grid; gap: .9rem; justify-items: start; min-width: 0; }
.featured-text h3 { font-family: var(--f-display); font-weight: 800; font-size: var(--s-lg); letter-spacing: -.02em; line-height: 1.1; margin: 0; }
.featured-text p { margin: 0; color: var(--ink-soft); }
.video {
  position: relative; display: block; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 3px; overflow: hidden;
  background: var(--ink); color: var(--paper); text-decoration: none;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-line {
  position: absolute; left: 1.4rem; top: 1.3rem; right: 1.4rem;
  font-family: var(--f-display); font-weight: 800; font-size: clamp(1.4rem, 3.4vw, 2.6rem); line-height: 1; letter-spacing: -.04em; max-width: 13ch;
}
.play {
  position: absolute; left: 50%; top: 55%; transform: translate(-50%, -50%);
  width: 4.2rem; height: 4.2rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--pencil); color: var(--paper); transition: transform .2s ease;
}
.video:hover .play { transform: translate(-50%, -50%) scale(1.08); }
@media (prefers-reduced-motion: reduce) { .play, .video:hover .play { transition: none; } }
.video-meta { position: absolute; left: 1.4rem; bottom: 1.1rem; font-family: var(--f-mono); font-size: var(--s-xs); letter-spacing: .06em; opacity: .75; }
@media (max-width: 760px) { .featured { grid-template-columns: minmax(0, 1fr); } }

/* Case study media */
.video-lead { margin-bottom: 2.5rem; }
.gallery { display: grid; gap: clamp(1.5rem, 4vw, 3rem); padding-block: 3rem 1rem; }
.gallery figure { margin: 0; min-width: 0; }
.gallery img { display: block; width: 100%; height: auto; border-radius: 3px; box-shadow: 0 0 0 1px var(--rule); }
.gallery .narrow img { max-width: 44rem; margin-inline: auto; }

/* Next project */
.next { display: grid; gap: 1.2rem; padding-block: 3rem; }
.next-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 2.5rem;
  min-height: clamp(10rem, 22vw, 15rem); padding: 1.4rem 1.6rem; border-radius: 3px;
  background: var(--tile-bg); color: var(--tile-fg); text-decoration: none;
  transition: filter .25s ease;
}
.next-card:hover { filter: brightness(1.08); }
.next-card .label { color: var(--tile-fg); opacity: .85; }
.next-name { font-family: var(--f-display); font-weight: 800; font-size: clamp(2rem, 6vw, 3.8rem); letter-spacing: -.045em; line-height: .95; }
.next-name span { display: inline-block; transition: transform .25s ease; }
.next-card:hover .next-name span { transform: translateX(.25em); }
@media (prefers-reduced-motion: reduce) { .next-card, .next-name span { transition: none; } .next-card:hover .next-name span { transform: none; } }
.next-links { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* Case study hero image (when there is no film) and big-idea support line */
.hero-img { margin: 0 0 2.5rem; }
.hero-img img { display: block; width: 100%; height: auto; border-radius: 3px; box-shadow: 0 0 0 1px var(--rule); }
.idea-sub { margin: 1.2rem 0 0; font-size: var(--s-lg); line-height: 1.4; color: var(--ink-soft); max-width: 32ch; }
.hero-img.contained img { max-width: 52rem; margin-inline: auto; }
.gallery .pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: clamp(1rem, 3vw, 2rem); align-items: start; }

/* Multi-project case studies */
.project-title { font-family: var(--f-display); font-weight: 800; font-size: var(--s-lg); letter-spacing: -.02em; line-height: 1.1; margin: 0 0 1rem; }
.case.project { border-bottom: 0; padding-bottom: 1rem; }
.gallery.tight { padding-block: 1rem 3rem; border-bottom: 1px solid var(--rule); }

/* On phones the header wraps to three lines, so let it scroll away instead of sticking */
@media (max-width: 600px) { .site-head { position: static; } }

/* Name doubles as the home link: show it on hover */
.brand b { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: .2em; text-decoration-thickness: 2px; transition: text-decoration-color .2s ease; }
.brand:hover b, .brand:focus-visible b { text-decoration-color: currentColor; }
@media (prefers-reduced-motion: reduce) { .brand b { transition: none; } }

/* Keep jumped-to sections clear of the sticky header */
#work, #contact, #about { scroll-margin-top: 5rem; }
