/* ==========================================================================
   Portfolio — two modes, one skeleton.
   Colour, type and spacing all come from the tokens in this first block.
   Change a token here and it changes everywhere.
   ========================================================================== */

:root {
  /* the five source colours, unchanged */
  --bone: #faf9f6;
  --mauve: #a69cac;
  --slate: #474973;
  --ink-2: #161b33;
  --ink: #0d0c1d;

  --gutter: clamp(30px, 4.5vw, 68px);
  --bar: 44px;
  --pad-section: clamp(1rem, 2vh, 9rem);

  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --display: "Archivo", system-ui, sans-serif;

  --t-xs: 10px;
  --t-s: 11.5px;
  --t-m: 13.5px;
  --t-title: clamp(1.9rem, 5.2vw, 4.1rem);
  --t-name: clamp(2rem, 7vw, 9em);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ── one dark theme for every page ───────────────────────────────────────────
   --ground is set by theme.js, which picks one of five near-identical blues
   per visit and keeps games and image a fixed distance apart in that ramp.
   The value below is the fallback if scripting is off.
   ------------------------------------------------------------------------- */

:root {
  --ground: #0d0c1d;
  --ground-2: color-mix(in oklab, var(--ground) 84%, var(--bone));
  --type: var(--bone);
  --type-dim: var(--mauve);
  --rule: var(--slate);
  --duo-shadow: var(--ink);
  --duo-light: var(--bone);
  --halftone: 0.5;
  --grain: 0.18;
}

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

html {
  background: var(--ground);
  scroll-padding-top: calc(var(--bar) + 1rem);
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--type);
  font-family: var(--mono);
  font-size: var(--t-m);
  font-weight: 300;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.5s var(--ease),
    color 0.5s var(--ease);
}

img {
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--type);
  outline-offset: 3px;
}

.mono {
  font-family: var(--mono);
  font-size: var(--t-s);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--type-dim);
}

/* ── ruler ───────────────────────────────────────────────────────────────── */

.ruler {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--gutter);
  z-index: 5;
  pointer-events: none;
  border-right: 1px solid color-mix(in oklab, var(--rule) 50%, transparent);
  background-image: repeating-linear-gradient(
    to bottom,
    var(--rule) 0 1px,
    transparent 1px 13px
  );
  background-size: 7px 100%;
  background-position: right 1px top;
  background-repeat: repeat-y;
  opacity: 0.55;
}

/* ── top bar ─────────────────────────────────────────────────────────────── */

.bar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--bar);
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 1.5rem;
  padding: 0 clamp(0.8rem, 2vw, 1.6rem) 0 calc(var(--gutter) + 0.9rem);
  background: color-mix(in oklab, var(--ground) 88%, transparent);
  backdrop-filter: blur(7px);
  border-bottom: 1px solid color-mix(in oklab, var(--rule) 42%, transparent);
}

.switch {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.switch__btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0.15rem 0;
  font-family: var(--mono);
  font-size: var(--t-s);
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--type-dim);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

/* the section you are currently looking at */
.switch__btn[aria-pressed="true"],
.switch__btn--here {
  color: var(--type);
  box-shadow: inset 0 -1px 0 0 var(--type);
}

.switch__btn--here {
  cursor: default;
}

.switch__btn:hover {
  color: var(--type);
}

.switch__rule {
  width: 1px;
  height: 11px;
  background: var(--rule);
}

/* ── language ────────────────────────────────────────────────────────────── */

.lang {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lang__btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0.15rem 0;
  font-family: var(--mono);
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  color: var(--type-dim);
  cursor: pointer;
  transition: color 0.25s var(--ease);
}

.lang__btn[aria-pressed="true"] {
  color: var(--type);
  box-shadow: inset 0 -1px 0 0 var(--type);
}

.lang__btn:hover {
  color: var(--type);
}


.bar__id,
.bar__clock {
  margin: 0;
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  color: var(--type-dim);
}

.bar__id {
  text-align: center;
}

.bar__clock {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── processed image plate ───────────────────────────────────────────────────
   Every image on the page sits in one of these. The image itself is never
   shown raw: it is flattened to luminosity over a duotone ground, screened
   with a halftone dot grid and dusted with grain.
   ------------------------------------------------------------------------- */

.plate {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(176deg, var(--duo-light), var(--duo-shadow) 82%);
}

.plate img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /*filter: grayscale(1) contrast(1.14) brightness(0.94);
  mix-blend-mode: luminosity;*/
  transition: filter 0.5s var(--ease);
}

.plate::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-image: radial-gradient(
    circle at center,
    var(--duo-shadow) 0.7px,
    transparent 0.85px
  );
  background-size: 3px 3px;
  opacity: var(--halftone);
  mix-blend-mode: overlay;
  transition: opacity 0.5s var(--ease);
}

.plate::after {
  content: "";
  position: absolute;
  inset: -60%;
  z-index: 3;
  pointer-events: none;
  opacity: var(--grain);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* inspection: processing lifts when you point at a plate you can open */
.plate--live {
  cursor: zoom-in;
}

.plate--live:hover::before,
.plate--live:focus-visible::before {
  opacity: 0;
}

.plate--live:hover img,
.plate--live:focus-visible img {
  filter: grayscale(0.15) contrast(1.02) brightness(1);
}

/* In the document for screen readers and crawlers, off the screen for
   everyone else. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── index of work ───────────────────────────────────────────────────────── */

/* this is the first thing on the page now, so it has to clear the fixed bar */
.index {
  padding: calc(var(--bar) + clamp(1.4rem, 4vh, 3rem)) var(--gutter) 0
    calc(var(--gutter) + clamp(0.9rem, 2vw, 1.8rem));
}

.index__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.7rem;
}

.index__head p {
  margin: 0;
  font-size: var(--t-xs);
  letter-spacing: 0.11em;
}

.index__hint {
  color: color-mix(in oklab, var(--type-dim) 78%, transparent);
}

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

.row {
  border-bottom: 1px solid color-mix(in oklab, var(--rule) 55%, transparent);
}

.row__head {
  appearance: none;
  width: 100%;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr) auto;
  gap: 0.6rem 1.4rem;
  align-items: baseline;
  padding: 1.5rem 0 1.25rem;
  cursor: pointer;
  font: inherit;
}

.row__id {
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  color: var(--type-dim);
  font-variant-numeric: tabular-nums;
  padding-top: 0.55em;
}

.row__title {
  margin: 0;
  font-family: var(--display);
  font-variation-settings:
    "wdth" 112,
    "wght" 600;
  font-size: var(--t-title);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--type);
  transition: opacity 0.25s var(--ease);
}

.row__head:hover .row__title {
  opacity: 0.62;
}

.row__meta {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
  padding-top: 0.6em;
}

.row__meta li {
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  color: var(--type-dim);
  white-space: nowrap;
}

.row__meta li + li {
  padding-left: 0.9rem;
  border-left: 1px solid color-mix(in oklab, var(--rule) 70%, transparent);
}

/* contact strip: the collapsed state of a record */
.row__strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 0 1.5rem;
  overscroll-behavior-x: contain;
  flex-wrap: wrap;
}

/* The strip scrolls, but the bar itself is hidden: a thumbnail clipped at the
   right edge is the cue that there is more, and every thumbnail is focusable,
   so tabbing scrolls the strip along. */
.row__strip::-webkit-scrollbar {
  display: none;
}

.row__strip .plate {
  flex: 0 0 auto;
  width: clamp(112px, 15vw, 188px);
  aspect-ratio: 16 / 10;
}

/* expanding detail */
.row__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease);
}

.row[data-open="true"] .row__body {
  grid-template-rows: 1fr;
}

.row__bodyInner {
  overflow: hidden;
}

.row__detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.6rem;
  padding: 0.4rem 0 2.6rem;
}

.row__blurb {
  max-width: 62ch;
  margin: 0;
  font-size: var(--t-m);
  line-height: 1.78;
  color: var(--type);
}

.row__blurb p {
  margin: 0 0 1.05em;
}

.row__blurb p:last-child {
  margin-bottom: 0;
}

.row__specs {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
  gap: 0.35rem 2.4rem;
}

.row__specs div {
  display: flex;
  gap: 0.7rem;
  font-size: var(--t-xs);
  letter-spacing: 0.09em;
}

.row__specs dt {
  color: color-mix(in oklab, var(--type-dim) 80%, transparent);
  min-width: 5.4rem;
}

.row__specs dd {
  margin: 0;
  color: var(--type);
}

.row__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 8px;
}

.row__gallery .plate {
  aspect-ratio: 16 / 10;
}

.row__video {
  width: 100%;
  display: block;
  background: var(--ground-2);
  border: 1px solid color-mix(in oklab, var(--rule) 55%, transparent);
}

/* ── embedded video ──────────────────────────────────────────────────────── */

.row__yt {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--ground-2);
  border: 1px solid color-mix(in oklab, var(--rule) 55%, transparent);
}

.row__ytStart {
  appearance: none;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.row__ytStart img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.62) saturate(0.85);
  transition: filter 0.3s var(--ease);
}

.row__ytStart:hover img,
.row__ytStart:focus-visible img {
  filter: brightness(0.78) saturate(1);
}

.row__ytMark {
  position: absolute;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  font-family: var(--mono);
  font-size: var(--t-s);
  letter-spacing: 0.18em;
  color: #fff;
  border: 1px solid rgb(255 255 255 / 0.75);
  padding: 0.6rem 1.5rem;
  background: rgb(0 0 0 / 0.35);
  backdrop-filter: blur(3px);
  transition:
    background-color 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

.row__ytStart:hover .row__ytMark,
.row__ytStart:focus-visible .row__ytMark {
  background: rgb(0 0 0 / 0.6);
  border-color: #fff;
}

.row__ytFrame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ── per-project documents ───────────────────────────────────────────────── */

.row__docs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.row__doc {
  appearance: none;
  font: inherit;
  font-size: var(--t-s);
  letter-spacing: 0.05em;
  color: var(--type);
  text-decoration: none;
  background: none;
  border: 1px solid color-mix(in oklab, var(--rule) 80%, transparent);
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  transition:
    border-color 0.25s var(--ease),
    background-color 0.25s var(--ease);
}

.row__doc:hover {
  border-color: var(--type);
  background: color-mix(in oklab, var(--rule) 18%, transparent);
}

.docview {
  width: min(96vw, 1100px);
  max-width: none;
  height: 92svh;
  padding: 0;
  border: 1px solid color-mix(in oklab, var(--rule) 70%, transparent);
  background: var(--ground);
  color: var(--type);
}

.docview::backdrop {
  background: color-mix(in srgb, #0d0c1d 88%, transparent);
}

.docview__bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid color-mix(in oklab, var(--rule) 55%, transparent);
}

.docview__title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  color: var(--type);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docview__tab,
.docview__close {
  appearance: none;
  font-family: var(--mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  color: var(--type-dim);
  text-decoration: none;
  background: none;
  border: 1px solid color-mix(in oklab, var(--rule) 70%, transparent);
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  white-space: nowrap;
}

.docview__tab:hover,
.docview__close:hover {
  color: var(--type);
  border-color: var(--type);
}

.docview__frame {
  display: block;
  width: 100%;
  height: calc(92svh - 3rem);
  border: 0;
  background: var(--ground-2);
}

.row__link {
  justify-self: start;
  font-size: var(--t-s);
  letter-spacing: 0.06em;
  color: var(--type);
  text-decoration: none;
  box-shadow: inset 0 -1px 0 0 var(--type);
  padding-bottom: 2px;
}

.row__link:hover {
  box-shadow: inset 0 -2px 0 0 var(--type);
}

/* ── contact ─────────────────────────────────────────────────────────────── */

.contact {
  padding: var(--pad-section) var(--gutter) 0
    calc(var(--gutter) + clamp(0.9rem, 2vw, 1.8rem));
}

.contact__lead {
  margin: 0 0 0.8rem;
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
}

.contact__mail {
  display: inline-block;
  font-family: var(--display);
  font-variation-settings:
    "wdth" 108,
    "wght" 600;
  font-size: clamp(1.5rem, 4.4vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--type);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: opacity 0.25s var(--ease);
}

.contact__mail:hover {
  opacity: 0.62;
}

.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 1.6rem 0 0;
  padding: 0;
  list-style: none;
}

.contact__links a {
  font-size: var(--t-s);
  letter-spacing: 0.05em;
  color: var(--type-dim);
  text-decoration: none;
  box-shadow: inset 0 -1px 0 0 color-mix(in oklab, var(--rule) 80%, transparent);
  padding-bottom: 2px;
  transition: color 0.25s var(--ease);
}

.contact__links a:hover {
  color: var(--type);
  box-shadow: inset 0 -1px 0 0 var(--type);
}

/* ── about page ──────────────────────────────────────────────────────────────
   The head of this page is the one centred block on the site: the name, with
   the readouts under it if there are any.
   ------------------------------------------------------------------------- */

.about__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: calc(var(--bar) + clamp(1.4rem, 4vh, 3.2rem)) var(--gutter)
    clamp(0.5rem, 2vh, 1.5rem);
}

.about__readouts {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.about__readouts li {
  font-size: var(--t-xs);
  letter-spacing: 0.11em;
  line-height: 1.85;
  color: var(--type-dim);
  font-variant-numeric: tabular-nums;
}

.about__lead {
  margin: 0.9rem 0 0;
  max-width: 26ch;
  font-family: var(--display);
  font-variation-settings:
    "wdth" 112,
    "wght" 600;
  font-size: clamp(1.75rem, 5vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  color: var(--type);
}

.about__bio,
.about__practice,
.about__cols {
  padding: var(--pad-section) var(--gutter) 0
    calc(var(--gutter) + clamp(0.9rem, 2vw, 1.8rem));
}

.about__h {
  margin: 0 0 0.75rem;
  font-family: var(--mono);
  font-size: var(--t-xs);
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--type-dim);
}

.about__bio p {
  max-width: 62ch;
  margin: 0 0 1.15rem;
  font-size: var(--t-m);
  line-height: 1.78;
  color: var(--type);
}

.about__bio p:last-child {
  margin-bottom: 0;
}

.about__practice > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 2.4rem 3.5rem;
  border-top: 1px solid var(--rule);
  padding-top: 1.6rem;
}

.about__practice p {
  max-width: 52ch;
  margin: 0;
  font-size: var(--t-m);
  line-height: 1.78;
  color: var(--type);
}

.about__cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 2.4rem 3.5rem;
}

.about__block {
  border-top: 1px solid var(--rule);
  padding-top: 1.6rem;
}

.about__tools {
  margin: 0;
}

.about__tools div {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.9rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid color-mix(in oklab, var(--rule) 45%, transparent);
  font-size: var(--t-s);
}

.about__tools dt {
  color: var(--type-dim);
  letter-spacing: 0.06em;
}

.about__tools dd {
  margin: 0;
  color: var(--type);
}

.about__timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.about__timeline li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.9rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid color-mix(in oklab, var(--rule) 45%, transparent);
  font-size: var(--t-s);
  color: var(--type);
}

.about__year {
  color: var(--type-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.about__cv {
  margin: 1.6rem 0 0;
}

/* ── footer ──────────────────────────────────────────────────────────────── */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: var(--pad-section);
  padding: 1rem clamp(0.8rem, 2vw, 1.6rem) 1.1rem
    calc(var(--gutter) + clamp(0.9rem, 2vw, 1.8rem));
  border-top: 1px solid color-mix(in oklab, var(--rule) 45%, transparent);
}

.foot p {
  margin: 0;
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
}

/* ── lightbox: the one place imagery is shown true ───────────────────────── */

.lightbox {
  width: min(96vw, 1500px);
  max-width: none;
  max-height: 94svh;
  padding: 0;
  border: 1px solid color-mix(in oklab, var(--rule) 70%, transparent);
  background: var(--ground);
  color: var(--type);
}

.lightbox::backdrop {
  background: color-mix(in srgb, #0d0c1d 88%, transparent);
}

.lightbox__img {
  display: block;
  width: 100%;
  max-height: 84svh;
  object-fit: contain;
  background: var(--ground-2);
}

.lightbox__close {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  z-index: 2;
  appearance: none;
  border: 1px solid color-mix(in oklab, var(--rule) 70%, transparent);
  background: color-mix(in oklab, var(--ground) 82%, transparent);
  backdrop-filter: blur(6px);
  color: var(--type);
  font-family: var(--mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}

.lightbox__cap {
  margin: 0;
  padding: 0.7rem 0.9rem 0.9rem;
  font-size: var(--t-xs);
  letter-spacing: 0.09em;
}

/* ── narrow screens ──────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  :root {
    --bar: 40px;
  }

  /* the id is hidden here, leaving nav / language / clock */
  .bar {
    grid-template-columns: auto auto 1fr;
    gap: 0.8rem;
  }

  .bar__id {
    display: none;
  }

  /* the clock is decoration; it goes before the bar gets crowded */
  @media (max-width: 460px) {
    .bar {
      grid-template-columns: auto 1fr;
    }

    .bar__clock {
      display: none;
    }
  }

  .about__lead {
    max-width: none;
  }

  .bar__clock {
    text-align: right;
  }

  .row__head {
    grid-template-columns: 3.4rem minmax(0, 1fr);
  }

  .row__meta {
    grid-column: 1 / -1;
    flex-wrap: wrap;
    gap: 0.5rem 0.8rem;
    padding-top: 0.2rem;
  }

  .row__meta li + li {
    padding-left: 0.8rem;
  }

  .foot {
    flex-direction: column;
    gap: 0.3rem;
  }
}

/* ── reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
