/* Separable Portfolio Revamp v1.3
   Art direction refinement.
   Primary reference: mockup #1.
   Light-only prototype. Dark/auto theme intentionally postponed.
*/

:root {
  --bg: #efeae0;
  --paper: #f4efe5;
  --text: #11110f;
  --muted: #5e594f;
  --faint: #8d877b;
  --line: rgba(17, 17, 15, .34);
  --line-soft: rgba(17, 17, 15, .14);
  --image-bg: #d6d0c5;
  --mono: "Courier New", Courier, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --max: 1460px;
  --edge: clamp(24px, 3.5vw, 56px);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  scroll-padding-top: 0;
}

body {
  min-height: 100%;
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: .006em;
  color: var(--text);
  background:
    url("../img/paper-grain.png"),
    radial-gradient(circle at 26% 19%, rgba(255,255,255,.46), transparent 28rem),
    linear-gradient(90deg, rgba(255,255,255,.20), transparent 35%, rgba(0,0,0,.022)),
    var(--bg);
  background-size: 420px 420px, auto, auto, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .055;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.20), rgba(0,0,0,.20) 1px, transparent 1px, transparent 7px);
  mix-blend-mode: multiply;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .055;
  background:
    linear-gradient(90deg, transparent 0, rgba(255,255,255,.42) 32%, transparent 60%),
    radial-gradient(circle at 74% 28%, rgba(255,255,255,.20), transparent 19rem);
}

a {
  color: inherit;
  text-underline-offset: .28em;
  text-decoration-thickness: 1px;
}

img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--image-bg);
}

button {
  font: inherit;
}

.skip-link {
  position: fixed;
  top: -10rem;
  left: 1rem;
  z-index: 50;
  padding: .7rem 1rem;
  background: var(--text);
  color: var(--bg);
}

.skip-link:focus {
  top: 1rem;
}

/* Shared top navigation / mockup #1 */

.site-header {
  position: relative;
  z-index: 5;
  width: min(var(--max), calc(100vw - var(--edge) * 2));
  margin: 0 auto;
  padding: 26px 0 12px;
  display: grid;
  grid-template-columns: 1fr auto 30px;
  align-items: center;
  column-gap: 36px;
}

.brand,
.rail-brand {
  font-family: var(--sans);
  font-weight: 800;
  letter-spacing: .085em;
  font-size: 15px;
  line-height: 1;
  text-decoration: none;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: clamp(25px, 3vw, 46px);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: .055em;
}

.primary-nav a,
.rail-nav a {
  text-decoration: none;
  position: relative;
}

.primary-nav a {
  opacity: .93;
}

.primary-nav a:hover {
  opacity: 1;
}

.primary-nav a.is-active::after,
.rail-nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  border-bottom: 1px solid currentColor;
}

.theme-pill {
  justify-self: end;
  width: 27px;
  height: 15px;
  border: 1px solid rgba(17, 17, 15, .74);
  border-radius: 999px;
  background: transparent;
  padding: 2px;
  opacity: .9;
}

.theme-pill span {
  display: block;
  width: 9px;
  height: 9px;
  background: var(--text);
  border-radius: 50%;
}

/* HOME — gallery lobby */

.home-layout {
  position: relative;
  z-index: 1;
  width: min(var(--max), calc(100vw - var(--edge) * 2));
  min-height: calc(100svh - 128px);
  margin: 0 auto;
  padding: clamp(24px, 4.5vh, 56px) 0 62px;
  display: grid;
  grid-template-columns: minmax(220px, 282px) minmax(0, 1fr) 74px;
  column-gap: clamp(26px, 4.5vw, 58px);
  align-items: start;
}

.intro-column {
  padding-top: clamp(12px, 3.4vh, 34px);
}

.intro-column h1 {
  margin: 0 0 clamp(54px, 8vh, 76px);
  max-width: 13ch;
  font-family: var(--mono);
  font-size: clamp(25px, 2.18vw, 34px);
  line-height: 1.215;
  letter-spacing: -.045em;
  font-weight: 400;
  text-transform: uppercase;
}

.series-index {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: series;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: .035em;
}

.series-index li {
  counter-increment: series;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  margin: 0 0 13px;
}

.series-index li::before {
  content: counter(series, decimal-leading-zero);
  color: var(--faint);
}

.series-index a {
  text-decoration: none;
}

.series-index a:hover {
  color: var(--text);
  text-decoration: underline;
}

.image-stage {
  display: grid;
  grid-template-columns: minmax(500px, 805px) 31px;
  gap: 18px;
  justify-self: center;
  align-self: start;
  padding-top: clamp(2px, 1vh, 10px);
}

.featured-frame {
  position: relative;
  margin: 0;
  width: min(805px, 100%);
  aspect-ratio: 1.58 / 1;
  overflow: hidden;
  background: var(--image-bg);
}

.featured-frame img {
  height: 100%;
  object-fit: cover;
  filter: contrast(1.03) saturate(.92);
  transition: opacity 620ms ease, filter 620ms ease;
}

.featured-frame img.is-changing {
  opacity: .24;
  filter: grayscale(100%) blur(8px);
}

.featured-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.035),
    inset 0 -95px 120px rgba(0,0,0,.035);
}

.side-metadata {
  min-width: 32px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: flex;
  flex-direction: row;
  gap: 15px;
  align-items: center;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 9.4px;
  letter-spacing: .052em;
  white-space: nowrap;
}

.scroll-note {
  position: absolute;
  right: 0;
  bottom: 84px;
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 9.5px;
  letter-spacing: .05em;
}

.scroll-note i {
  display: block;
  width: 25px;
  border-top: 1px solid var(--text);
}

.site-footer {
  position: relative;
  z-index: 1;
  width: min(var(--max), calc(100vw - var(--edge) * 2));
  margin: 0 auto;
  padding: 14px 0 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 9.5px;
  letter-spacing: .06em;
}

/* WORK — screenplay / archive page */

.work-page {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.work-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 30px 38px 42px;
  border-right: 1px dashed var(--line-soft);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 54px;
}

.rail-brand {
  display: grid;
  gap: 6px;
}

.rail-brand span {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.rail-nav {
  display: grid;
  gap: 7px;
  align-content: start;
  text-transform: uppercase;
  font-size: 12px;
}

.rail-statement,
.rail-place {
  margin: 0;
  align-self: end;
  text-transform: uppercase;
  color: var(--text);
  font-size: 11px;
}

.rail-place {
  color: var(--muted);
}

.work-layout {
  position: relative;
  max-width: 1040px;
  padding: 30px clamp(34px, 5.5vw, 82px) 70px;
}

.script-block {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 24px;
  margin-bottom: 18px;
}

.scene,
.script-page {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: .01em;
}

.script-page {
  justify-self: end;
}

.script-copy {
  grid-column: 1 / 2;
  margin: 0;
  font-size: 14px;
  line-height: 1.46;
  letter-spacing: -.01em;
}

.single-work-viewer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 28px;
  align-items: center;
}

.work-frame {
  margin: 0;
  width: min(800px, 100%);
}

.work-frame img {
  aspect-ratio: 1.53 / 1;
  object-fit: cover;
}

.work-meta {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: 2px 28px;
  margin-top: 14px;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 10.8px;
  line-height: 1.35;
}

.work-meta b {
  color: var(--text);
  font-weight: 400;
}

.work-dots {
  display: grid;
  gap: 9px;
  justify-items: center;
}

.work-dots button {
  width: 5.5px;
  height: 5.5px;
  border: 1px solid var(--text);
  border-radius: 50%;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.work-dots button.is-active {
  background: var(--text);
}

.viewer-controls {
  grid-column: 1 / -1;
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

.viewer-controls button {
  border: 0;
  border-bottom: 1px solid var(--text);
  background: transparent;
  color: var(--text);
  padding: 0;
  text-transform: uppercase;
  cursor: pointer;
  font-size: 11px;
}

.series-section {
  margin-top: 72px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.series-section h2 {
  margin: 0 0 18px;
  font-family: var(--sans);
  letter-spacing: .085em;
  text-transform: uppercase;
  font-size: 14px;
}

.gallery-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.gallery-card {
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  display: grid;
  align-content: end;
  text-decoration: none;
  text-transform: uppercase;
}

.gallery-card small {
  margin-top: 8px;
  color: var(--muted);
  text-transform: none;
}

.hidden-console-button {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 10;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(17, 17, 15, .34);
  border-radius: 50%;
  background: transparent;
  color: rgba(17, 17, 15, .72);
  cursor: pointer;
  opacity: .24;
  transition: opacity 160ms ease, transform 160ms ease;
}

.hidden-console-button:hover {
  opacity: 1;
  transform: rotate(90deg);
}

.terminal-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  background:
    url("../img/paper-grain.png"),
    var(--paper);
  color: var(--text);
  padding: 0;
}

.terminal-form {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.terminal-form input {
  border: 1px solid var(--line);
  background: transparent;
  padding: 10px;
  color: inherit;
  font: inherit;
}

.terminal-form input:focus {
  outline: 2px solid rgba(17,17,15,.28);
  outline-offset: 2px;
}

.terminal-form button {
  justify-self: end;
  border: 0;
  border-bottom: 1px solid var(--text);
  background: transparent;
  text-transform: uppercase;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 980px) {
  .site-header {
    width: min(100% - 32px, var(--max));
    grid-template-columns: 1fr auto;
    padding-top: 22px;
  }

  .primary-nav {
    grid-column: 1 / -1;
    justify-self: start;
    overflow-x: auto;
    max-width: 100%;
    padding-top: 16px;
    gap: 20px;
    font-size: 10px;
  }

  .theme-pill {
    display: none;
  }

  .home-layout {
    width: min(100% - 32px, var(--max));
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 34px 0 56px;
    row-gap: 34px;
  }

  .intro-column {
    padding-top: 0;
  }

  .intro-column h1 {
    margin-bottom: 34px;
    font-size: clamp(26px, 8vw, 42px);
  }

  .image-stage {
    grid-template-columns: 1fr;
    justify-self: stretch;
    padding-top: 0;
  }

  .featured-frame {
    width: 100%;
  }

  .side-metadata {
    writing-mode: horizontal-tb;
    transform: none;
    flex-wrap: wrap;
    gap: 10px 18px;
  }

  .scroll-note {
    display: none;
  }

  .site-footer {
    width: min(100% - 32px, var(--max));
  }

  .work-page {
    display: block;
  }

  .work-rail {
    position: static;
    width: min(100% - 32px, var(--max));
    height: auto;
    margin: 0 auto;
    padding: 24px 0;
    border-right: 0;
    border-bottom: 1px dashed var(--line-soft);
    display: grid;
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .rail-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
  }

  .rail-statement,
  .rail-place {
    display: none;
  }

  .work-layout {
    padding: 28px 16px 52px;
  }

  .script-block {
    grid-template-columns: 1fr;
  }

  .script-page {
    justify-self: start;
  }

  .single-work-viewer {
    grid-template-columns: 1fr;
  }

  .work-dots {
    display: flex;
    justify-content: flex-end;
  }

  .work-meta {
    grid-template-columns: 1fr;
  }
}


/* v1.4 — real image / editorial canvas refinement */

.home-page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.home-page .home-layout {
  flex: 1 0 auto;
}

.home-page .site-footer {
  flex: 0 0 auto;
}

.featured-frame img[data-orientation="portrait"] {
  object-fit: cover;
}

.featured-frame img {
  object-position: center center;
}

.series-index a {
  opacity: .82;
}

.series-index a:hover {
  opacity: 1;
}

.side-metadata {
  opacity: .88;
}

.hidden-console-button {
  background: rgba(239, 234, 224, .18);
}

.hidden-console-button:not(:hover) {
  color: transparent;
}

.hidden-console-button:not(:hover)::before {
  content: "";
  display: block;
  width: 3px;
  height: 3px;
  margin: auto;
  border-radius: 50%;
  background: rgba(17,17,15,.62);
}

@media (min-width: 1200px) and (max-height: 820px) {
  .home-layout {
    padding-top: 22px;
    padding-bottom: 48px;
  }

  .intro-column h1 {
    margin-bottom: 52px;
  }

  .featured-frame {
    width: min(760px, 100%);
  }
}

@media (min-width: 1400px) and (min-height: 850px) {
  .home-layout {
    padding-top: 46px;
  }
}



/* v1.5 — curation, metadata, work page polish */

[hidden] {
  display: none !important;
}

.featured-frame img[data-tone="monochrome"] {
  filter: grayscale(100%) contrast(1.06) saturate(.92);
}

.featured-frame img[data-tone="dark"] {
  filter: contrast(1.06) saturate(.96);
}

.featured-frame img[data-tone="documentary"] {
  filter: contrast(1.02) saturate(.92);
}

.work-layout {
  padding-top: clamp(28px, 4.6vh, 48px);
}

.script-block {
  max-width: 910px;
}

.script-copy {
  max-width: 720px;
}

.work-frame {
  width: min(820px, 100%);
}

.work-frame img {
  object-position: center center;
}

.work-frame img[data-tone="monochrome"] {
  filter: grayscale(100%) contrast(1.04);
}

.work-caption {
  margin: 10px 0 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 10.8px;
  text-transform: uppercase;
  letter-spacing: .035em;
}

.work-meta {
  margin-top: 12px;
}

.work-dots {
  opacity: .78;
}

.viewer-controls {
  margin-top: 28px;
}

.hidden-console-button {
  opacity: .18;
}

.hidden-console-button:hover {
  opacity: .75;
}

.terminal-dialog::backdrop {
  background: rgba(17, 17, 15, .05);
}

@media (min-width: 1300px) {
  .single-work-viewer {
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 24px;
  }
}

@media (max-width: 980px) {
  .work-caption {
    font-size: 10px;
  }
}


/* v1.6 — console polish and work viewport control */

.terminal-dialog {
  max-width: calc(100vw - 32px);
}

.terminal-form {
  min-height: 185px;
}

.terminal-form label {
  text-transform: none;
}

.terminal-form input::placeholder {
  color: rgba(17, 17, 15, .36);
}

.terminal-form [data-terminal-output] {
  white-space: pre-wrap;
  min-height: 3.5em;
  margin: 0;
  line-height: 1.45;
}

.home-console-button {
  opacity: .08;
}

.home-console-button:hover {
  opacity: .55;
}

/* Keep work images more controlled on shorter screens */
@media (min-width: 981px) {
  .work-frame img {
    max-height: min(66vh, 680px);
    width: auto;
    max-width: 100%;
    margin: 0;
  }

  .work-frame {
    display: inline-block;
  }

  .single-work-viewer {
    align-items: start;
  }
}

@media (min-width: 981px) and (max-height: 820px) {
  .work-layout {
    padding-top: 24px;
  }

  .script-block {
    margin-bottom: 14px;
  }

  .script-copy {
    line-height: 1.38;
  }

  .work-frame img {
    max-height: 60vh;
  }

  .viewer-controls {
    margin-top: 20px;
  }

  .series-section {
    margin-top: 56px;
  }
}

@media (min-width: 981px) and (max-height: 720px) {
  .script-copy {
    display: none;
  }

  .work-frame img {
    max-height: 64vh;
  }
}


/* v1.6.1 — universal console bootstrap */

.hidden-console-button {
  z-index: 40;
}

.terminal-dialog {
  z-index: 60;
}

.terminal-dialog::backdrop {
  background: rgba(17, 17, 15, .055);
}


/* v1.7 — responsive refinement
   Goal: keep the editorial / print-object identity intact across desktop, tablet and mobile.
*/

/* Better default touch behavior */
a,
button {
  -webkit-tap-highlight-color: rgba(17, 17, 15, .12);
}

/* Large desktop: keep the canvas calm and close to mockup #1 */
@media (min-width: 1500px) {
  :root {
    --max: 1500px;
  }

  .home-layout {
    grid-template-columns: minmax(230px, 292px) minmax(0, 1fr) 76px;
  }

  .featured-frame {
    width: min(835px, 100%);
  }
}

/* Medium laptops / smaller browser heights */
@media (min-width: 981px) and (max-height: 760px) {
  .site-header {
    padding-top: 18px;
    padding-bottom: 8px;
  }

  .home-layout {
    padding-top: 18px;
    padding-bottom: 44px;
  }

  .intro-column {
    padding-top: 10px;
  }

  .intro-column h1 {
    margin-bottom: 38px;
    font-size: clamp(22px, 2vw, 30px);
  }

  .series-index li {
    margin-bottom: 9px;
  }

  .featured-frame {
    width: min(720px, 100%);
  }

  .site-footer {
    padding-top: 10px;
    padding-bottom: 12px;
  }
}

/* Tablet landscape / narrow desktop */
@media (max-width: 1180px) and (min-width: 981px) {
  :root {
    --edge: 28px;
  }

  .site-header {
    grid-template-columns: 220px minmax(0, 1fr) 30px;
    column-gap: 24px;
  }

  .primary-nav {
    justify-self: end;
    gap: clamp(18px, 2.4vw, 30px);
  }

  .home-layout {
    grid-template-columns: 245px minmax(0, 1fr) 58px;
    column-gap: 30px;
  }

  .intro-column h1 {
    font-size: clamp(23px, 2.5vw, 31px);
  }

  .image-stage {
    grid-template-columns: minmax(440px, 1fr) 30px;
    gap: 16px;
  }

  .featured-frame {
    width: 100%;
  }

  .side-metadata {
    font-size: 8.8px;
  }

  .scroll-note {
    right: 0;
  }
}

/* Tablet portrait and mobile: transform from "spread" to "single editorial page" */
@media (max-width: 980px) {
  :root {
    --edge: 18px;
  }

  body {
    overflow-x: hidden;
  }

  .site-header {
    width: min(100% - 32px, var(--max));
    padding: 20px 0 12px;
    grid-template-columns: 1fr auto;
    row-gap: 14px;
    column-gap: 16px;
  }

  .brand,
  .rail-brand {
    font-size: 14px;
  }

  .theme-pill {
    display: block;
    width: 25px;
    height: 14px;
  }

  .primary-nav {
    grid-column: 1 / -1;
    justify-self: stretch;
    display: flex;
    gap: 18px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 0 8px;
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    font-size: 10px;
    letter-spacing: .045em;
  }

  .primary-nav::-webkit-scrollbar {
    display: none;
  }

  .home-layout {
    width: min(100% - 32px, var(--max));
    min-height: auto;
    display: grid;
    grid-template-columns: 1fr;
    row-gap: 26px;
    padding: 30px 0 46px;
  }

  .intro-column {
    padding-top: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 34vw);
    gap: 22px;
    align-items: end;
  }

  .intro-column h1 {
    margin: 0;
    max-width: 13ch;
    font-size: clamp(28px, 7vw, 48px);
    line-height: 1.14;
  }

  .series-index {
    justify-self: end;
    width: 100%;
    font-size: 10px;
  }

  .series-index li {
    grid-template-columns: 23px 1fr;
    margin-bottom: 10px;
  }

  .image-stage {
    display: grid;
    grid-template-columns: 1fr;
    gap: 13px;
    justify-self: stretch;
    padding-top: 0;
  }

  .featured-frame {
    width: 100%;
    aspect-ratio: 1.52 / 1;
  }

  .featured-frame img {
    height: 100%;
    object-fit: cover;
  }

  .side-metadata {
    min-width: 0;
    writing-mode: horizontal-tb;
    transform: none;
    display: flex;
    flex-wrap: wrap;
    gap: 7px 15px;
    align-items: flex-start;
    font-size: 9px;
    line-height: 1.4;
  }

  .scroll-note {
    display: none;
  }

  .site-footer {
    width: min(100% - 32px, var(--max));
    padding: 12px 0 18px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    font-size: 9px;
  }

  /* Work page tablet/mobile */
  .work-page {
    display: block;
  }

  .work-rail {
    position: relative;
    width: min(100% - 32px, var(--max));
    height: auto;
    margin: 0 auto;
    padding: 20px 0 16px;
    border-right: 0;
    border-bottom: 1px dashed var(--line-soft);
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .rail-brand {
    gap: 5px;
  }

  .rail-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 16px;
    padding: 8px 0;
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    font-size: 10.5px;
  }

  .rail-nav::-webkit-scrollbar {
    display: none;
  }

  .rail-nav a.is-active::after {
    bottom: -5px;
  }

  .rail-statement,
  .rail-place {
    display: none;
  }

  .work-layout {
    width: min(100% - 32px, var(--max));
    max-width: none;
    margin: 0 auto;
    padding: 22px 0 52px;
  }

  .script-block {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px 16px;
    margin-bottom: 18px;
  }

  .scene,
  .script-page {
    font-size: clamp(13px, 2.5vw, 15px);
    margin-bottom: 0;
  }

  .script-copy {
    grid-column: 1 / -1;
    max-width: 100%;
    font-size: clamp(12px, 2.3vw, 14px);
    line-height: 1.45;
  }

  .single-work-viewer {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .work-frame {
    width: 100%;
    display: block;
  }

  .work-frame img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
  }

  .work-meta {
    grid-template-columns: repeat(2, minmax(0, max-content));
    gap: 2px 20px;
    font-size: 10px;
  }

  .work-caption {
    max-width: 100%;
    font-size: 10px;
  }

  .work-dots {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    padding: 2px 0;
  }

  .viewer-controls {
    margin-top: 18px;
  }

  .series-section {
    margin-top: 44px;
  }

  .gallery-card {
    min-height: 104px;
  }

  .hidden-console-button {
    right: 18px;
    bottom: 18px;
  }
}

/* Phones: make it feel intentional, not just squeezed */
@media (max-width: 640px) {
  :root {
    --edge: 14px;
  }

  body::before {
    opacity: .045;
  }

  .site-header {
    width: min(100% - 24px, var(--max));
    padding-top: 18px;
  }

  .brand {
    font-size: 13px;
  }

  .primary-nav {
    gap: 16px;
    font-size: 9.5px;
  }

  .home-layout {
    width: min(100% - 24px, var(--max));
    padding-top: 24px;
    row-gap: 24px;
  }

  .intro-column {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .intro-column h1 {
    font-size: clamp(30px, 11vw, 44px);
    line-height: 1.12;
  }

  .series-index {
    justify-self: start;
    max-width: 260px;
  }

  .featured-frame {
    aspect-ratio: 1.28 / 1;
  }

  .side-metadata {
    font-size: 8.8px;
    opacity: .82;
  }

  .site-footer {
    width: min(100% - 24px, var(--max));
    font-size: 8.6px;
  }

  .work-rail,
  .work-layout {
    width: min(100% - 24px, var(--max));
  }

  .work-rail {
    padding-top: 18px;
  }

  .rail-brand {
    font-size: 13px;
  }

  .rail-nav {
    font-size: 10px;
    gap: 15px;
  }

  .work-layout {
    padding-top: 20px;
  }

  .script-block {
    grid-template-columns: 1fr;
  }

  .script-page {
    justify-self: start;
    color: var(--muted);
  }

  .script-copy {
    font-size: 12px;
  }

  .work-meta {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .work-caption {
    line-height: 1.45;
  }

  .work-dots button {
    width: 6px;
    height: 6px;
  }

  .terminal-dialog {
    width: min(100% - 24px, 520px);
  }

  .terminal-form {
    padding: 18px;
    min-height: 170px;
  }

  .terminal-form input {
    width: 100%;
  }
}

/* Very small phones */
@media (max-width: 390px) {
  .intro-column h1 {
    font-size: clamp(28px, 10.5vw, 38px);
  }

  .featured-frame {
    aspect-ratio: 1.12 / 1;
  }

  .primary-nav,
  .rail-nav {
    gap: 13px;
  }

  .terminal-form {
    padding: 16px;
  }
}

/* Landscape phones: preserve usability */
@media (max-height: 520px) and (orientation: landscape) {
  .home-layout {
    padding-top: 18px;
    padding-bottom: 34px;
  }

  .intro-column {
    grid-template-columns: 260px 1fr;
    align-items: start;
  }

  .intro-column h1 {
    font-size: 28px;
  }

  .featured-frame {
    aspect-ratio: 2 / 1;
  }

  .work-rail {
    position: relative;
  }

  .script-copy {
    display: none;
  }

  .work-frame img {
    max-height: none;
  }
}


/* v1.7.1 — responsive polish after real device screenshots
   Fixes:
   - theme toggle placement on tablet/mobile
   - calmer tablet title scale
   - tighter mobile console sizing
   - slightly better mobile vertical rhythm
*/

/* Make the toggle stay on the brand row instead of dropping below nav */
@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
  }

  .theme-pill {
    display: block;
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: end;
  }

  .primary-nav {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* Tablet portrait / narrow desktop: keep the title dramatic, but not oversized */
@media (min-width: 641px) and (max-width: 980px) {
  .home-layout {
    padding-top: 26px;
  }

  .intro-column {
    grid-template-columns: minmax(0, 1fr) minmax(210px, 34vw);
    gap: 28px;
    align-items: end;
  }

  .intro-column h1 {
    font-size: clamp(34px, 5.3vw, 45px);
    line-height: 1.15;
  }

  .series-index {
    align-self: end;
  }

  .featured-frame {
    aspect-ratio: 1.58 / 1;
  }
}

/* Phones: reduce the excessive gap caused by the toggle/nav flow */
@media (max-width: 640px) {
  .site-header {
    row-gap: 12px;
  }

  .home-layout {
    padding-top: 22px;
  }

  .intro-column {
    gap: 26px;
  }

  .intro-column h1 {
    font-size: clamp(29px, 10.2vw, 42px);
  }

  .series-index {
    font-size: 9.4px;
  }

  .featured-frame {
    margin-top: 2px;
  }

  .side-metadata {
    padding-bottom: 28px;
  }
}

/* Very narrow phones */
@media (max-width: 390px) {
  .intro-column h1 {
    font-size: clamp(27px, 9.8vw, 37px);
  }
}

/* Mobile console: prevent the dialog from becoming wider than the viewport */
@media (max-width: 640px) {
  .terminal-dialog {
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
    max-height: min(72dvh, 560px);
    margin: auto;
  }

  .terminal-form {
    max-height: min(72dvh, 560px);
    overflow: auto;
    padding: 18px;
    min-height: 0;
  }

  .terminal-form input {
    font-size: 16px; /* prevents iOS Safari from zooming input */
  }

  .terminal-form [data-terminal-output] {
    font-size: 13px;
    line-height: 1.42;
  }
}

/* Work page on phones: keep metadata readable above browser chrome */
@media (max-width: 640px) {
  .work-layout {
    padding-bottom: 88px;
  }

  .viewer-controls {
    padding-bottom: 18px;
  }

  .series-section {
    margin-top: 34px;
  }
}

/* iOS/safe area polish */
@supports (padding: max(0px)) {
  @media (max-width: 640px) {
    .site-header,
    .home-layout,
    .site-footer,
    .work-rail,
    .work-layout {
      padding-left: max(0px, env(safe-area-inset-left));
      padding-right: max(0px, env(safe-area-inset-right));
    }

    .hidden-console-button {
      right: max(18px, env(safe-area-inset-right));
      bottom: max(18px, env(safe-area-inset-bottom));
    }
  }
}


/* v1.7.2 — mobile polish after v1.7.1 screenshots
   Main fixes:
   - remove excessive Work page blank space before content on mobile
   - make iPhone console more controlled with keyboard open
   - keep desktop untouched
*/

/* Work mobile: reset desktop rail grid rows so hidden rail content does not create excess vertical space */
@media (max-width: 980px) {
  .work-rail {
    grid-template-rows: auto auto;
    gap: 14px;
    padding-bottom: 10px;
  }

  .work-layout {
    padding-top: 18px;
  }
}

@media (max-width: 640px) {
  .work-rail {
    gap: 12px;
    padding-bottom: 8px;
  }

  .work-layout {
    padding-top: 16px;
    padding-bottom: 140px;
  }

  .script-block {
    margin-bottom: 16px;
  }

  .scene {
    line-height: 1.35;
  }
}

/* iPhone console: smaller, calmer, less likely to overflow with virtual keyboard */
@media (max-width: 640px) {
  .terminal-dialog {
    width: calc(100vw - 48px);
    max-width: calc(100vw - 48px);
    max-height: min(58dvh, 460px);
  }

  .terminal-form {
    padding: 14px;
    max-height: min(58dvh, 460px);
    gap: 12px;
  }

  .terminal-form label {
    font-size: 13px;
  }

  .terminal-form input {
    min-height: 46px;
    padding: 8px;
    font-size: 16px;
  }

  .terminal-form [data-terminal-output] {
    font-size: 12px;
    line-height: 1.38;
  }

  .terminal-form button {
    color: var(--text);
  }
}

/* Home mobile: keep the visual drama, but prevent the first image metadata from being buried too aggressively */
@media (max-width: 640px) {
  .home-layout {
    padding-bottom: 72px;
  }

  .side-metadata {
    padding-bottom: 42px;
  }
}

/* Very small mobile screens */
@media (max-width: 390px) {
  .terminal-dialog {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }

  .terminal-form {
    padding: 12px;
  }
}


/* v2.0 — content pages, final work polish, gallery workflow support */

img.is-loading {
  opacity: .55;
}

/* Content pages */
.content-page {
  min-height: 100svh;
}

.content-layout {
  width: min(var(--max), calc(100vw - var(--edge) * 2));
  margin: 0 auto;
  padding: clamp(46px, 7vh, 84px) 0 86px;
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(180px, 300px);
  column-gap: clamp(46px, 9vw, 140px);
  align-items: start;
}

.content-main {
  max-width: 780px;
}

.content-kicker {
  margin: 0 0 20px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .065em;
  font-size: 10px;
}

.content-main h1 {
  margin: 0 0 34px;
  max-width: 13ch;
  font-family: var(--mono);
  font-size: clamp(34px, 5vw, 68px);
  line-height: 1.08;
  font-weight: 400;
  letter-spacing: -.05em;
  text-transform: uppercase;
}

.content-main p {
  margin: 0 0 18px;
  max-width: 66ch;
  font-size: 14px;
  line-height: 1.65;
}

.content-note {
  margin-top: 34px !important;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: .035em;
  line-height: 1.55 !important;
}

.content-aside {
  padding-top: 6px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px;
  line-height: 1.55;
  border-left: 1px dashed var(--line-soft);
  padding-left: 24px;
}

.content-aside p {
  margin: 0 0 28px;
}

.content-footer {
  margin-top: 0;
}

.content-list {
  margin: 0 0 24px;
  padding-left: 1.2rem;
  font-size: 13px;
  line-height: 1.65;
}

.cv-section {
  margin-bottom: 32px;
}

.cv-portrait {
  width: min(100%, 300px);
  margin: 0 0 38px;
}

.cv-portrait img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line-soft);
}

.cv-portrait-image--dark {
  display: none !important;
}

html[data-theme="dark"] .cv-portrait-image--light {
  display: none !important;
}

html[data-theme="dark"] .cv-portrait-image--dark {
  display: block !important;
}

.cv-portrait figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.cv-section h2,
.journal-entry h2 {
  margin: 0 0 10px;
  font-family: var(--sans);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .085em;
}

.entry-date {
  margin-bottom: 8px !important;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px !important;
  letter-spacing: .06em;
}

.contact-card {
  margin: 28px 0;
  padding: 20px;
  border: 1px solid var(--line-soft);
  display: grid;
  gap: 18px;
}

.contact-card p {
  margin: 0;
}

.series-grid {
  margin-top: 34px;
  display: grid;
  gap: 12px;
}

.series-card {
  min-height: 128px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  display: grid;
  align-content: end;
  text-decoration: none;
  text-transform: uppercase;
}

.series-card span {
  color: var(--muted);
}

.series-card strong {
  margin-top: 8px;
  font-family: var(--sans);
  letter-spacing: .085em;
}

.series-card small {
  margin-top: 8px;
  color: var(--muted);
  text-transform: none;
  line-height: 1.45;
}

/* Work page v2.0 polish */
.work-frame img {
  transition: opacity 180ms ease;
}

.work-caption {
  letter-spacing: .055em;
}

.viewer-controls button:hover,
.gallery-card:hover,
.series-card:hover {
  opacity: .68;
}

@media (min-width: 981px) {
  .work-meta {
    max-width: 760px;
  }

  .work-dots {
    padding-top: 8px;
  }
}

/* Content pages responsive */
@media (max-width: 980px) {
  .content-layout {
    width: min(100% - 32px, var(--max));
    padding: 38px 0 68px;
    grid-template-columns: 1fr;
    row-gap: 36px;
  }

  .content-main h1 {
    max-width: 14ch;
    font-size: clamp(36px, 8vw, 62px);
  }

  .content-aside {
    border-left: 0;
    border-top: 1px dashed var(--line-soft);
    padding-left: 0;
    padding-top: 20px;
  }
}

@media (max-width: 640px) {
  .content-layout {
    width: min(100% - 24px, var(--max));
    padding: 32px 0 76px;
  }

  .content-main h1 {
    font-size: clamp(32px, 10vw, 44px);
  }

  .content-main p {
    font-size: 13px;
    line-height: 1.62;
  }

  .contact-card {
    padding: 16px;
  }

  .series-card {
    min-height: 112px;
    padding: 16px;
  }
}

/* Small mobile console override retained */
@media (max-width: 640px) {
  .terminal-dialog {
    width: calc(100vw - 48px);
    max-width: calc(100vw - 48px);
    max-height: min(58dvh, 460px);
  }
}


/* v2.1 — near-release: theme system, accessibility and production polish */

/* Default light values are inherited from previous versions.
   Dark mode intentionally preserves the same editorial / paper-object idea,
   but as a dark archive rather than a generic black website.
*/

:root {
  color-scheme: light dark;
}

html[data-theme="dark"] {
  --paper: #11110f;
  --paper-rgb: 17, 17, 15;
  --ink: #e9e3d6;
  --text: #e9e3d6;
  --muted: #9f998e;
  --line: rgba(233, 227, 214, .58);
  --line-soft: rgba(233, 227, 214, .22);
  --shadow: rgba(0, 0, 0, .42);
}

html[data-theme="dark"] body {
  background:
    linear-gradient(rgba(233, 227, 214, .018) 50%, transparent 50%),
    radial-gradient(circle at 22% 18%, rgba(233, 227, 214, .075), transparent 34%),
    var(--paper);
  background-size: 100% 3px, auto, auto;
  color: var(--text);
}

html[data-theme="dark"] body::before {
  opacity: .11;
  mix-blend-mode: soft-light;
}

html[data-theme="dark"] .featured-frame,
html[data-theme="dark"] .work-frame img,
html[data-theme="dark"] .contact-card,
html[data-theme="dark"] .series-card,
html[data-theme="dark"] .gallery-card,
html[data-theme="dark"] .terminal-dialog {
  box-shadow: none;
}

html[data-theme="dark"] .terminal-dialog,
html[data-theme="dark"] .terminal-form {
  background: #151410;
  color: var(--text);
}

html[data-theme="dark"] .terminal-form input {
  background: #11110f;
  color: var(--text);
  border-color: var(--line);
}

html[data-theme="dark"] .theme-pill {
  border-color: var(--line);
}

html[data-theme="dark"] .theme-pill span {
  transform: translateX(11px);
  background: var(--text);
}

html[data-theme-mode="auto"] .theme-pill::after,
html[data-theme-mode="light"] .theme-pill::after,
html[data-theme-mode="dark"] .theme-pill::after {
  position: absolute;
  left: 50%;
  top: calc(100% + 5px);
  transform: translateX(-50%);
  font-family: var(--sans);
  font-size: 7px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}

html[data-theme-mode="auto"] .theme-pill::after {
  content: "auto";
}

html[data-theme-mode="light"] .theme-pill::after {
  content: "light";
}

html[data-theme-mode="dark"] .theme-pill::after {
  content: "dark";
}

.theme-pill {
  position: relative;
}

/* Work rail theme button */
.rail-topline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}

.rail-theme {
  margin-top: 2px;
}

/* Accessibility */
.skip-link {
  position: fixed;
  z-index: 1000;
  left: 16px;
  top: 16px;
  transform: translateY(-180%);
  padding: 10px 12px;
  background: var(--text);
  color: var(--paper);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 11px;
  border: 1px solid var(--line);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.primary-nav a,
.rail-nav a,
.viewer-controls button,
.gallery-card,
.series-card,
.contact-card a,
.content-main a {
  text-underline-offset: 4px;
}

button {
  cursor: pointer;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}

/* Print */
@media print {
  .primary-nav,
  .rail-nav,
  .theme-pill,
  .hidden-console-button,
  .terminal-dialog,
  .scroll-note,
  .viewer-controls,
  .work-dots {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .site-header,
  .home-layout,
  .work-layout,
  .content-layout {
    width: 100% !important;
    margin: 0 !important;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}

/* Mobile adjustments for theme label */
@media (max-width: 640px) {
  html[data-theme-mode="auto"] .theme-pill::after,
  html[data-theme-mode="light"] .theme-pill::after,
  html[data-theme-mode="dark"] .theme-pill::after {
    display: none;
  }

  .rail-topline {
    grid-template-columns: 1fr auto;
  }
}


/* v2.1.1 final polish — visible three-state theme label */

.theme-pill {
  display: inline-grid;
  grid-template-columns: 25px auto;
  align-items: center;
  gap: 7px;
  width: auto;
  min-width: 25px;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.theme-pill > span {
  position: relative;
  display: block;
  width: 25px;
  height: 14px;
  border: 1px solid var(--text);
  border-radius: 999px;
  background: transparent;
}

.theme-pill > span::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--text);
  transition: transform 160ms ease;
}

.theme-pill[data-theme-resolved="dark"] > span::before {
  transform: translateX(11px);
}

.theme-pill em {
  font-family: var(--sans);
  font-style: normal;
  font-size: 8px;
  line-height: 1;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  transform: translateY(1px);
}

/* Disable older pseudo-labels from v2.1 so labels do not duplicate */
html[data-theme-mode="auto"] .theme-pill::after,
html[data-theme-mode="light"] .theme-pill::after,
html[data-theme-mode="dark"] .theme-pill::after {
  content: none !important;
  display: none !important;
}

/* Work rail theme toggle stays compact */
.rail-theme {
  justify-self: end;
}

/* On very narrow phones, keep the label but make it tiny enough not to damage the header */
@media (max-width: 430px) {
  .theme-pill {
    gap: 5px;
  }

  .theme-pill em {
    font-size: 7px;
    letter-spacing: .06em;
  }
}

/* If space becomes extremely narrow, hide only the label, not the function */
@media (max-width: 340px) {
  .theme-pill em {
    display: none;
  }
}

/* v2.1.1 small contact/readability polish */
.content-note strong {
  color: var(--text);
}

.contact-card a {
  word-break: break-word;
}

/* Keep hidden console visible enough in dark mode */
html[data-theme="dark"] .hidden-console-button {
  color: var(--text);
  border-color: var(--line-soft);
  background: rgba(233, 227, 214, .03);
}


/* v2.1.2 — editorial text-based theme selector
   Replaces the earlier pill-toggle visually without changing the theme system.
*/

.theme-pill {
  display: none !important;
}

.theme-selector {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  font-family: var(--sans);
  font-size: 9px;
  line-height: 1;
  letter-spacing: .075em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  transform: translateY(1px);
}

.theme-selector button {
  appearance: none;
  border: 0;
  padding: 0 0 3px;
  margin: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  opacity: .48;
  border-bottom: 1px solid transparent;
  transition:
    opacity 140ms ease,
    color 140ms ease,
    border-color 140ms ease;
}

.theme-selector span {
  opacity: .28;
}

.theme-selector button:hover,
.theme-selector button:focus-visible {
  opacity: .86;
  color: var(--text);
}

.theme-selector button[data-active="true"],
.theme-selector button[aria-pressed="true"] {
  opacity: 1;
  color: var(--text);
  border-bottom-color: currentColor;
}

/* Header alignment: selector behaves like a typographic nav item */
.site-header > .theme-selector {
  justify-self: end;
}

/* Work rail placement */
.rail-topline {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.rail-topline > .theme-selector {
  justify-self: end;
  margin-top: 1px;
}

/* Dark theme keeps it quiet and editorial */
html[data-theme="dark"] .theme-selector {
  color: var(--muted);
}

html[data-theme="dark"] .theme-selector button[data-active="true"],
html[data-theme="dark"] .theme-selector button[aria-pressed="true"] {
  color: var(--text);
}

/* Mobile: keep direct selection but reduce density */
@media (max-width: 640px) {
  .theme-selector {
    gap: 5px;
    font-size: 8px;
    letter-spacing: .055em;
  }

  .theme-selector button {
    padding-bottom: 3px;
  }
}

/* Very narrow phones: use compact labels, but preserve accessibility text in aria */
@media (max-width: 370px) {
  .theme-selector button[data-theme-choice="auto"] {
    font-size: 0;
  }

  .theme-selector button[data-theme-choice="auto"]::before {
    content: "A";
    font-size: 8px;
  }

  .theme-selector button[data-theme-choice="light"] {
    font-size: 0;
  }

  .theme-selector button[data-theme-choice="light"]::before {
    content: "L";
    font-size: 8px;
  }

  .theme-selector button[data-theme-choice="dark"] {
    font-size: 0;
  }

  .theme-selector button[data-theme-choice="dark"]::before {
    content: "D";
    font-size: 8px;
  }
}


/* v2.1.3 — header spacing fix
   Prevents the editorial theme selector from overlapping CONTACT.
   This intentionally only touches header/rail positioning of the selector.
*/

/* Desktop/header: reserve a real column for the theme selector */
.site-header {
  column-gap: clamp(16px, 2vw, 34px);
}

.site-header .primary-nav {
  min-width: 0;
  padding-right: clamp(8px, 1.2vw, 18px);
}

.site-header > .theme-selector {
  position: relative;
  z-index: 2;
  min-width: max-content;
  justify-self: end;
  margin-left: clamp(12px, 1.6vw, 26px);
}

/* Slightly tighten nav before it has to wrap */
@media (max-width: 1120px) {
  .site-header {
    column-gap: 18px;
  }

  .site-header .primary-nav {
    gap: clamp(16px, 2.2vw, 28px);
  }

  .site-header > .theme-selector {
    font-size: 8px;
    gap: 5px;
    margin-left: 12px;
  }
}

/* Tablet / narrow desktop: put theme selector on its own row, aligned right.
   This avoids any collision with CONTACT while keeping the editorial look. */
@media (max-width: 860px) {
  .site-header {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand theme"
      "nav nav";
    row-gap: 13px;
  }

  .site-header .brand {
    grid-area: brand;
  }

  .site-header .primary-nav {
    grid-area: nav;
    width: 100%;
    padding-right: 0;
  }

  .site-header > .theme-selector {
    grid-area: theme;
    align-self: center;
    margin-left: 0;
  }
}

/* Phone: keep the selector above the nav, not inside the nav line */
@media (max-width: 640px) {
  .site-header {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand theme"
      "nav nav";
    row-gap: 12px;
  }

  .site-header > .theme-selector {
    justify-self: end;
    font-size: 8px;
  }

  .site-header .primary-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .site-header .primary-nav::-webkit-scrollbar {
    display: none;
  }
}

/* Very narrow phones: compact labels only when absolutely needed */
@media (max-width: 390px) {
  .site-header > .theme-selector {
    gap: 4px;
  }

  .site-header > .theme-selector button[data-theme-choice="auto"],
  .site-header > .theme-selector button[data-theme-choice="light"],
  .site-header > .theme-selector button[data-theme-choice="dark"] {
    font-size: 0;
  }

  .site-header > .theme-selector button[data-theme-choice="auto"]::before {
    content: "A";
    font-size: 8px;
  }

  .site-header > .theme-selector button[data-theme-choice="light"]::before {
    content: "L";
    font-size: 8px;
  }

  .site-header > .theme-selector button[data-theme-choice="dark"]::before {
    content: "D";
    font-size: 8px;
  }
}

/* Work rail already has different layout; keep selector compact there */
.work-rail .theme-selector,
.rail-topline .theme-selector {
  margin-left: 0;
  max-width: max-content;
}


/* v2.1.4 — desktop header collision fix
   Fixes CONTACT overlapping with AUTO / LIGHT / DARK on laptop/desktop widths.
   Root cause: the original header's third grid column was only 30px wide,
   while the new text-based theme selector is wider than that.
*/

/* Desktop and normal laptop widths:
   give the theme selector a real max-content column.
*/
@media (min-width: 981px) {
  .site-header {
    grid-template-columns: minmax(150px, 1fr) max-content max-content;
    column-gap: clamp(28px, 3vw, 54px);
  }

  .site-header .brand {
    justify-self: start;
  }

  .site-header .primary-nav {
    justify-self: end;
    padding-right: 0;
    gap: clamp(24px, 2.8vw, 44px);
  }

  .site-header > .theme-selector {
    justify-self: end;
    align-self: center;
    min-width: max-content;
    margin-left: 0;
  }
}

/* Smaller laptop widths before the tablet/mobile layout:
   keep everything on one row, but reduce nav density safely.
*/
@media (min-width: 981px) and (max-width: 1240px) {
  .site-header {
    grid-template-columns: minmax(120px, 1fr) max-content max-content;
    column-gap: 24px;
  }

  .site-header .primary-nav {
    gap: clamp(17px, 2vw, 28px);
    font-size: 9.6px;
  }

  .site-header > .theme-selector {
    font-size: 8px;
    gap: 5px;
  }
}

/* Last safe desktop step:
   if the laptop window is quite narrow but still desktop layout,
   move the selector above the nav rather than letting it collide.
*/
@media (min-width: 861px) and (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand theme"
      "nav nav";
    row-gap: 13px;
    column-gap: 18px;
  }

  .site-header .brand {
    grid-area: brand;
  }

  .site-header .primary-nav {
    grid-area: nav;
    justify-self: start;
    width: 100%;
    padding-right: 0;
  }

  .site-header > .theme-selector {
    grid-area: theme;
    justify-self: end;
    align-self: center;
    margin-left: 0;
  }
}

/* v2.2.0-rc1 — curation release candidate */
.work-frame img {
  aspect-ratio: auto;
  object-fit: contain;
}

@media (min-width: 981px) {
  .work-frame { max-width: 100%; }
  .work-frame img { max-height: min(68vh, 760px); }
}

/* v2.2.1-rc2 — release candidate polish
   Landing page now uses a dedicated curated B&W hero set instead of pulling
   mixed-orientation images directly from the work galleries.
*/

.home-page .featured-frame {
  aspect-ratio: 3 / 2;
  background: var(--image-bg);
}

.home-page .featured-frame img {
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: grayscale(100%) contrast(1.08) saturate(.88);
}

.home-page .featured-frame img.is-changing {
  opacity: .18;
  filter: grayscale(100%) contrast(1.05) blur(7px);
}

@media (max-width: 980px) {
  .home-page .featured-frame {
    aspect-ratio: 3 / 2;
  }
}

@media (max-width: 640px) {
  .home-page .featured-frame {
    aspect-ratio: 4 / 3;
  }

  .home-page .featured-frame img {
    object-position: center center;
  }
}

@media (max-width: 420px) {
  .home-page .featured-frame {
    aspect-ratio: 1.2 / 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-page .featured-frame img {
    transition: none;
  }
}
