/* Layout: MMBB-style index — ruled filter bar, count line, 5-column image grid, slim ruled footer. Dark, single theme. */
:root {
  --bg: #121417;
  --surface: #1c1f23;
  --line: #2c3036;
  --rule: #d9d4ca;        /* the heavier rule above each filter */
  --text: #e9e5dd;
  --muted: #8b9098;
  --accent: #c2ae90;      /* travertine */
  --gap: 10px;
  --pad: max(16px, clamp(16px, 7vw, 140px));
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.45 "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 12px; background: var(--accent); color: var(--bg); padding: 8px 12px; z-index: 10; }

/* header */
.top {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px;
  padding: 26px var(--pad) 20px;
}
.brand { font-weight: 500; letter-spacing: .02em; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.top nav a[aria-current="page"] { color: var(--accent); }

/* filter bar: 5 equal columns, each topped by a rule */
.bar {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: var(--gap);
  margin: 0 var(--pad); border-bottom: 1px solid var(--line);
}
.fsel, .fsearch { position: relative; display: block; border-top: 2px solid var(--rule); min-width: 0; }
.fsel select {
  appearance: none; -webkit-appearance: none; width: 100%; margin: 0; border: 0; border-radius: 0;
  background: transparent; color: var(--text); font: inherit; padding: 13px 28px 13px 0; cursor: pointer;
  text-overflow: ellipsis;
}
.fsel select option { background: var(--surface); color: var(--text); }
.fsel::after {
  content: ""; position: absolute; right: 6px; top: 50%; width: 8px; height: 8px; pointer-events: none;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-70%) rotate(45deg);
}
.fsel.on select { color: var(--accent); }
.fsearch { display: flex; align-items: center; }
.fsearch input {
  flex: 1; min-width: 0; margin: 6px 0; border: 0; border-radius: 0; background: var(--surface); color: var(--text);
  font: inherit; padding: 7px 34px 7px 10px;
}
.fsearch input::placeholder { color: var(--muted); }
.fsearch input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }
.fsearch svg { position: absolute; right: 9px; width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 1.6; pointer-events: none; }

/* count line */
.count {
  margin: 0 var(--pad); padding: 12px 0; text-align: center; border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.count button { font: inherit; color: var(--accent); background: none; border: 0; padding: 0 0 0 14px; cursor: pointer; }

/* project grid: 5 across x 3 down */
.tiles {
  list-style: none; margin: 18px var(--pad) 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap);
}
.tile[hidden] { display: none; }
.tile a { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface); }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); }
.cap {
  position: absolute; inset: auto 0 0 0; padding: 26px 12px 10px; display: grid;
  background: linear-gradient(transparent, rgba(10, 11, 13, .82)); color: var(--text);
  opacity: 0; transition: opacity .25s;
}
.cap .sub { color: var(--muted); font-size: 13px; }
.tile a:hover .cap, .tile a:focus-visible .cap { opacity: 1; }
.tile a:hover img { transform: scale(1.03); }
.tile a:hover { color: var(--text); }
.empty { margin: 0 var(--pad); padding: 32px 0; color: var(--muted); text-align: center; }

/* footer: ruled, columns aligned to the grid */
.foot {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: var(--gap);
  margin: 96px var(--pad) 0; padding: 12px 0 28px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 14px; line-height: 1.6;
}
.foot > div { display: grid; align-content: start; min-width: 0; }
.foot a:hover { color: var(--text); }

/* project page: ruled info row, ruled tab row, then the images */
.project { padding: 0 var(--pad); }
.phead, .ptabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: var(--gap); }
.phead > * { margin: 0; padding: 12px 0; border-top: 2px solid var(--rule); border-bottom: 1px solid var(--line); min-width: 0; font: inherit; }
.phead h1 { font-weight: 500; }
.phead span { color: var(--text); }
.ptabs { align-items: end; }
.ptabs [role="tab"] {
  font: inherit; color: var(--muted); background: none; border: 0; border-bottom: 2px solid var(--rule);
  padding: 12px 0; text-align: left; cursor: pointer; transition: color .2s;
}
.ptabs [role="tab"]:hover { color: var(--text); }
.ptabs [role="tab"][aria-selected="true"] { color: var(--accent); }
.vtoggle { grid-column: 5; grid-row: 2; justify-self: end; display: flex; gap: 12px; padding: 16px 0 0; }
.vtoggle[hidden] { display: none; }
.vtoggle button { background: none; border: 0; padding: 0; cursor: pointer; }
.vtoggle svg { display: block; width: 40px; height: 16px; fill: var(--line); transition: fill .2s; }
.vtoggle button:hover svg { fill: var(--muted); }
.vtoggle button[aria-pressed="true"] svg { fill: var(--text); }

.panel { padding-top: 16px; }
.stage { position: relative; background: var(--surface); }
.stage img { width: 100%; height: auto; }
.nav { position: absolute; top: 0; bottom: 0; width: 50%; background: none; border: 0; padding: 0; }
.nav.prev { left: 0; cursor: w-resize; }
.nav.next { right: 0; cursor: e-resize; }
.counter { margin: 10px 0 0; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.thumbs { list-style: none; margin: 0; padding: 0; display: none; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap); }
.thumbs button { display: block; width: 100%; padding: 0; border: 0; background: var(--surface); cursor: zoom-in; aspect-ratio: 16 / 10; overflow: hidden; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.thumbs button:hover img { opacity: .8; }
.viewer[data-mode="thumbs"] .stage, .viewer[data-mode="thumbs"] .counter { display: none; }
.viewer[data-mode="thumbs"] .thumbs { display: grid; }
.text { max-width: 64ch; font-size: 17px; font-weight: 300; line-height: 1.65; }
.text p { margin: 0 0 1em; }
.credits { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px var(--gap); margin: 0; }
.credits dt { color: var(--muted); font-size: 13px; }
.credits dd { margin: 0; }
.note { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.pn { display: flex; justify-content: space-between; gap: 20px; margin-top: 56px; padding-top: 12px; border-top: 1px solid var(--line); }

/* prose pages */
.prose { padding: clamp(24px, 5vw, 64px) var(--pad) 0; }
.prose h1 { margin: 0 0 36px; max-width: 24ch; font-weight: 300; line-height: 1.12; letter-spacing: -.015em; font-size: clamp(28px, 4vw, 54px); text-wrap: balance; }
.prose p { max-width: 64ch; font-size: 17px; font-weight: 300; line-height: 1.6; }
.prose h2 { font-size: 14px; font-weight: 400; color: var(--muted); margin: 0 0 12px; }
.prose .role { color: var(--accent); margin: 0 0 8px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 40px 64px; margin-top: 48px; padding-top: 14px; border-top: 2px solid var(--rule); }
.cols ul, .contact { list-style: none; margin: 0; padding: 0; }
.cols li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.contact li { font-size: clamp(20px, 2.6vw, 30px); font-weight: 300; padding: 8px 0; }
.legal { margin-top: 56px; color: var(--muted); font-size: 14px !important; }

/* responsive */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fsearch { grid-column: 1 / -1; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .foot { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .phead, .ptabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .phead h1 { grid-column: 1 / -1; }
  .phead span:empty { display: none; }
  .vtoggle { grid-column: 1 / -1; grid-row: auto; }
  .thumbs, .credits { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot { grid-template-columns: 1fr; row-gap: 10px; }
}
/* touch screens have no hover: show titles under the images */
@media (hover: none) {
  .tile a { aspect-ratio: auto; background: none; }
  .tile img { aspect-ratio: 16 / 10; background: var(--surface); }
  .cap { position: static; opacity: 1; background: none; padding: 6px 0 4px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
