/* =================================================================
   Quiet, editorial palette: warm off-white, soft ink, thin rules,
   and three muted domain colours used as accents only.
   ================================================================= */
:root {
  --paper: #F7F6F3;
  --card: #FFFFFF;
  --ink: #1F1F1E;
  --ink-2: #6B6A66;
  --line: #E3E1DC;
  --ai: #4A5A8C;
  --conflict: #A9533F;
  --development: #4F7A5E;
  --c: var(--ink);
  --sans: "Inter", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --header-h: 96px;
  --hero-h: clamp(180px, 30vh, 380px);
  --gut: clamp(16px, 2.4vw, 32px);
}
.d-ai { --c: var(--ai); }
.d-conflict { --c: var(--conflict); }
.d-development { --c: var(--development); }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 500; }
.icon { width: 14px; height: 14px; flex: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; margin: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--ai); outline-offset: 2px; }

/* ---- Header ----------------------------------------------------- */
.site-header {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 var(--gut);
  border-bottom: 1px solid var(--line);
}
.brand { font: 500 clamp(30px, 3.4vw, 46px)/1 var(--serif); text-decoration: none; letter-spacing: -0.02em; }
.site-nav { display: flex; gap: 28px; }
.site-nav a { font-size: 16px; color: var(--ink-2); text-decoration: none; padding: 4px 0; border-bottom: 1px solid transparent; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }

/* Content-type filter: a pill bar floating on the bottom of the headline picture */
.hero-filters { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1; }
.filters {
  display: flex; align-items: center; gap: 4px; white-space: nowrap;
  padding: 6px 6px 6px 18px;
  background: rgba(255, 255, 255, .95); border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
}
.filter-hint { font: 500 13px/1 var(--sans); color: var(--ink-2); margin-right: 8px; }
.filter-btn, .filter-clear {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 13px/1 var(--sans); color: var(--ink-2);
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.filter-btn:hover { color: var(--ink); border-color: #C9C6BF; }
.filter-btn[aria-pressed="true"]:hover { color: #fff; }
.filter-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-clear { border-color: transparent; background: none; text-decoration: underline; text-underline-offset: 3px; }

/* ---- Headline picture ------------------------------------------- */
.hero { position: relative; height: var(--hero-h); background: #111; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(0, 0, 0, .3)); pointer-events: none; }
.hero img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 52%; }

/* ---- Work board: three columns, fits one screen on desktop ------ */
.board {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  height: calc(100dvh - var(--header-h) - var(--hero-h));
  min-height: 480px;
}
.load-error { grid-column: 1 / -1; padding: 32px var(--gut); color: var(--conflict); }
.domain {
  container: domain / inline-size;
  display: flex; flex-direction: column; min-height: 0;
  padding: 18px var(--gut) var(--gut);
}
.domain + .domain { border-left: 1px solid var(--line); }
.domain-head {
  display: flex; align-items: baseline; gap: 10px;
  padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.domain-head::before {
  content: ""; position: absolute; left: 0; bottom: -1px; width: 40px; height: 2px; background: var(--c);
}
.domain-name { font: 500 22px/1 var(--serif); }
.domain-count { font-size: 12px; color: var(--ink-2); }

.tiles {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(130px, 1fr);
  gap: 14px;
  overflow-y: auto;
}

/* ---- Tile ------------------------------------------------------- */
.tile {
  position: relative; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line); border-radius: 6px;
  overflow: hidden; text-decoration: none;
  transition: box-shadow .25s, opacity .3s, filter .3s, border-color .25s;
}
.tile:hover, .tile:focus-visible { box-shadow: 0 6px 20px rgba(30, 30, 30, .08); border-color: #D6D3CC; }
.tile.feature { grid-column: span 2; }

.tile-fig { position: relative; margin: 0; flex: 1; min-height: 60px; overflow: hidden; background: var(--c); }
.tile-fig img, .tile-fig .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.tile:hover .tile-fig img, .tile:hover .tile-fig .art { transform: scale(1.03); }

.tile-desc {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  padding: 14px 16px;
  background: rgba(28, 28, 27, .9); color: #fff;
  z-index: 1;
  opacity: 0; transition: opacity .25s ease;
}
.tile-desc p { margin: 0; font-size: 14px; line-height: 1.45; overflow: hidden; }   /* size set per tile by fitDescription() in work.js */
.tile-desc p.clipped { -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.tile-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.tile-go { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; opacity: .8; flex: none; }

/* Photo credits: small grey text along the bottom, shown on hover */
.credit { font-size: 10.5px; line-height: 1.3; letter-spacing: .01em; color: #A8A6A0; text-align: right; }
.hero > .credit, .photo > .credit {
  position: absolute; right: 10px; bottom: 7px; max-width: 70%; z-index: 1;
  color: #D4D2CC; text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.hero:hover > .credit, .photo:hover > .credit { opacity: 1; }
.tile:hover .tile-desc, .tile:focus-visible .tile-desc { opacity: 1; }

.tile-body { padding: 10px 12px 12px; }
.tile h3 {
  font: 500 15px/1.3 var(--sans); letter-spacing: -0.005em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile.feature h3 { font: 500 19px/1.25 var(--serif); }
.tile-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin: 6px 0 0; font-size: 12px; color: var(--ink-2); }
.type { display: inline-flex; align-items: center; gap: 4px; }
.type .icon { width: 12px; height: 12px; color: var(--c); }
.tile-year { margin-left: auto; }

/* Highlight mode: matches stay crisp, everything else recedes */
.is-filtering .tile:not(.match) { opacity: .35; filter: grayscale(1); }
.is-filtering .tile:not(.match):hover { opacity: .8; filter: none; }
.is-filtering .tile.match { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 6px 20px rgba(30, 30, 30, .08); }

/* ---- About ------------------------------------------------------ */
.about {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 6vw, 88px);
  max-width: 1200px; margin: 0 auto;
  padding: clamp(40px, 6vw, 80px) var(--gut);
  align-items: start;
}
.collage { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo { position: relative; margin: 0; border-radius: 6px; overflow: hidden; background: var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo.empty img { visibility: hidden; }
.p1 { grid-column: 1 / -1; aspect-ratio: 4 / 5; }
.p1 img { object-position: 50% 30%; }
.p2, .p3 { aspect-ratio: 1; }
.p3 img { object-position: 50% 20%; }

.bio { position: sticky; top: 32px; }
.bio-title, .contact h2 { font: 400 clamp(2.2rem, 4vw, 3.2rem)/1.1 var(--serif); letter-spacing: -0.015em; margin-bottom: 24px; }
.bio p { font-size: 17px; line-height: 1.7; max-width: 62ch; margin: 0 0 1.1em; color: #34332F; }
.bio-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 14px/1 var(--sans); text-decoration: none; cursor: pointer;
  padding: 12px 18px; border: 1px solid var(--ink); border-radius: 999px;
  background: transparent; color: var(--ink);
  transition: background .15s, color .15s;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn-solid { background: var(--ink); color: #fff; }
.btn-solid:hover { background: #3A3936; }
.btn:disabled { opacity: .6; cursor: progress; }

.contact {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 6vw, 88px);
  max-width: 1200px; margin: 0 auto;
  padding: clamp(40px, 6vw, 80px) var(--gut);
  border-top: 1px solid var(--line);
}
.contact-intro > p { max-width: 44ch; color: var(--ink-2); }
.p4 { margin-top: 28px; aspect-ratio: 3 / 2; max-width: 420px; }

.contact-form {
  display: grid; gap: 18px; align-content: start;
  padding: clamp(20px, 3vw, 32px);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
}
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field legend { font-size: 13px; font-weight: 500; color: var(--ink-2); padding: 0; }
.field input, .field textarea {
  font: 400 16px/1.4 var(--sans); color: var(--ink);
  padding: 10px 12px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 6px; width: 100%;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--ai); background: #fff; }
.topics { display: flex; flex-wrap: wrap; gap: 6px; }
.topics legend { margin-bottom: 6px; }
.topics label { cursor: pointer; position: relative; }
.topics input { position: absolute; inset: 0; margin: 0; opacity: 0; }
.topics span { display: inline-block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--ink-2); background: var(--card); }
.topics input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.topics input:focus-visible + span { outline: 2px solid var(--ai); outline-offset: 2px; }
.honey { position: absolute; left: -9999px; }
.contact-form .btn { justify-self: start; }
.form-status { margin: 0; font-size: 14px; min-height: 1.4em; color: var(--ink-2); }
.form-status[data-kind="ok"] { color: var(--development); }
.form-status[data-kind="error"] { color: var(--conflict); }

/* ---- Footer ----------------------------------------------------- */
.site-footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 24px var(--gut); border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
}
.footer-links { display: flex; gap: 18px; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--ink); }

/* ---- Responsive ------------------------------------------------- */
/* Narrow columns: tiles become compact rows, thumbnail on the left */
@media (min-width: 761px) {
  @container domain (max-width: 400px) {
    .tiles { grid-template-columns: 1fr; grid-auto-rows: minmax(84px, 1fr); gap: 10px; }
    .tile, .tile.feature { grid-column: auto; flex-direction: row; }
    .tile-fig { flex: 0 0 38%; }
    .tile-body { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
    .tile.feature h3 { font: 500 15px/1.3 var(--sans); }
  }
}
@media (max-width: 900px) {
  .about, .contact { grid-template-columns: 1fr; }
  .bio { position: static; }
  .collage { max-width: 520px; }
}
@media (max-width: 760px) {
  .site-header { height: auto; padding-top: 18px; padding-bottom: 18px; }
  .hero { height: auto; }
  .hero img { height: var(--hero-h); }
  .hero::after { display: none; }
  .hero > .credit { bottom: auto; top: calc(var(--hero-h) - 24px); }
  .hero-filters { position: static; transform: none; padding: 12px var(--gut); background: var(--paper); }
  .filters { flex-wrap: wrap; white-space: normal; padding: 0; background: none; box-shadow: none; border-radius: 0; }
  .filter-hint { width: 100%; margin: 0 0 6px; }
  .board { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .domain + .domain { border-left: 0; border-top: 1px solid var(--line); }
  .tiles { overflow: visible; grid-auto-rows: auto; }
  .tile-fig { flex: none; aspect-ratio: 4 / 3; }
  .tile.feature .tile-fig { aspect-ratio: 16 / 9; }
}
/* Touch screens have no hover: show the description under the title */
@media (hover: none) {
  .tile-desc { position: static; opacity: 1; background: none; color: var(--ink-2); padding: 0 12px 12px; order: 3; }
  .tile-go { display: none; }
  .tile-foot { justify-content: flex-start; margin-top: 4px; }
  .credit { color: #9A988F; text-align: left; }
  .hero > .credit, .photo > .credit { opacity: .85; }
  .tile-fig { flex: none; aspect-ratio: 4 / 3; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
