/* ==========================================================================
   Slice of the Slayer — theme
   Dark-first, responsive, token-driven. Light theme via [data-theme="light"].
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */

:root {
  color-scheme: dark;

  --bg:          #0a0a0e;
  --bg-1:        #10101a;
  --bg-2:        #16161f;
  --bg-3:        #1d1d28;
  --line:        #272733;
  --line-soft:   #1e1e28;

  --text:        #eceaf1;
  --text-dim:    #a5a3b3;
  --text-faint:  #6f6d7d;

  --accent:      #e5384f;   /* Buffy crimson */
  --accent-ink:  #ffffff;
  --accent-soft: rgba(229, 56, 79, .14);
  --accent-line: rgba(229, 56, 79, .38);

  --cool:        #8a7cf8;   /* Angel indigo */
  --cool-soft:   rgba(138, 124, 248, .14);
  --cool-line:   rgba(138, 124, 248, .38);

  --shadow-1: 0 1px 2px rgba(0,0,0,.5);
  --shadow-2: 0 10px 30px -12px rgba(0,0,0,.7);
  --shadow-3: 0 24px 60px -20px rgba(0,0,0,.8);

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 22px;

  --wrap: 1180px;
  --header-h: 64px;

  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Cinzel", "Iowan Old Style", "Palatino Linotype", Palatino,
                  Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(.4, .14, .3, 1);
}

[data-theme="light"] {
  color-scheme: light;

  --bg:          #f7f6f8;
  --bg-1:        #ffffff;
  --bg-2:        #ffffff;
  --bg-3:        #f1eff3;
  --line:        #e0dde5;
  --line-soft:   #ebe8ee;

  --text:        #17151c;
  --text-dim:    #5c5868;
  --text-faint:  #8e8a99;

  --accent:      #c31d36;
  --accent-soft: rgba(195, 29, 54, .09);
  --accent-line: rgba(195, 29, 54, .3);

  --cool:        #5a49d6;
  --cool-soft:   rgba(90, 73, 214, .09);
  --cool-line:   rgba(90, 73, 214, .3);

  --shadow-1: 0 1px 2px rgba(23,21,28,.06);
  --shadow-2: 0 10px 30px -14px rgba(23,21,28,.18);
  --shadow-3: 0 24px 60px -24px rgba(23,21,28,.26);
}

/* --- Reset -------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A quiet vignette so the flat black reads as depth, not void. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60rem 40rem at 15% -10%, var(--accent-soft), transparent 70%),
    radial-gradient(55rem 38rem at 92% 4%,  var(--cool-soft),  transparent 70%);
}

img, svg, video { max-width: 100%; height: auto; display: block; }
button, input, select { font: inherit; color: inherit; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.15; font-weight: 600; }
h1 { font-family: var(--font-display); font-size: clamp(2rem, 1.2rem + 3vw, 3.1rem); letter-spacing: -.01em; }
h2 { font-family: var(--font-display); font-size: clamp(1.35rem, 1.05rem + 1.1vw, 1.85rem); }
h3 { font-size: 1.06rem; letter-spacing: -.005em; }
p  { margin: 0 0 1rem; }

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: var(--accent-ink); }

/* --- Layout ------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 2rem);
}

main { position: relative; z-index: 1; padding-block: clamp(1.75rem, 4vw, 3rem) 4rem; }

.skip-link {
  position: absolute;
  left: 1rem; top: -100%;
  z-index: 100;
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.skip-link:focus { top: .75rem; color: var(--accent-ink); }

/* --- Header ------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header { background: var(--bg); }
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  margin-right: auto;
}
.brand:hover { color: var(--text); }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-mark .slice { fill: var(--accent); }
.brand-mark .ring  { fill: none; stroke: var(--cool); stroke-width: 6; opacity: .75; }
.brand em {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 500;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-left: 1px solid var(--line);
  padding-left: .6rem;
  margin-left: .1rem;
}

/* Navigation */

.nav-list {
  display: flex;
  align-items: center;
  gap: .15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link,
.nav-button {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem .7rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-dim);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.nav-link:hover, .nav-button:hover { background: var(--bg-3); color: var(--text); }
.nav-link[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.nav-button::after {
  content: "";
  width: .38em; height: .38em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .18s var(--ease);
  opacity: .8;
}
.nav-button[aria-expanded="true"]::after { transform: translateY(1px) rotate(225deg); }
.nav-button[aria-expanded="true"] { background: var(--bg-3); color: var(--text); }

.nav-group { position: relative; }

.submenu {
  position: absolute;
  top: calc(100% + .5rem);
  left: 0;
  min-width: 15rem;
  margin: 0;
  padding: .4rem;
  list-style: none;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .16s var(--ease), transform .16s var(--ease), visibility .16s;
}
.nav-group[data-open="true"] .submenu { opacity: 1; visibility: visible; transform: none; }

.submenu a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem .65rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: .875rem;
}
.submenu a:hover { background: var(--bg-3); color: var(--text); }
.submenu a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.submenu .count {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* Header buttons */

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-1);
  color: var(--text-dim);
  cursor: pointer;
  transition: color .16s var(--ease), border-color .16s var(--ease), background .16s var(--ease);
}
.icon-button:hover { color: var(--text); border-color: var(--accent-line); background: var(--bg-3); }
.icon-button svg { width: 17px; height: 17px; }

.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun  { display: none; }

@media (max-width: 560px) {
  .brand em { display: none; }
  .brand { font-size: .95rem; gap: .45rem; }
}

.burger { display: none; border-radius: var(--radius-sm); }
.burger svg { width: 19px; height: 19px; }
.burger .icon-close { display: none; }
.burger[aria-expanded="true"] .icon-close { display: block; }
.burger[aria-expanded="true"] .icon-menu  { display: none; }

/* Mobile navigation */

@media (max-width: 900px) {
  .burger { display: inline-grid; }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto;
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    padding: .75rem clamp(1rem, 3vw, 2rem) 1.75rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-3);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
  }
  .nav[data-open="true"] { opacity: 1; visibility: visible; transform: none; }

  .nav-list { flex-direction: column; align-items: stretch; gap: .1rem; }
  .nav-link, .nav-button { width: 100%; justify-content: space-between; padding: .7rem .8rem; font-size: .95rem; }

  .submenu {
    position: static;
    display: none;
    min-width: 0;
    margin: .1rem 0 .4rem;
    background: var(--bg-1);
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .nav-group[data-open="true"] .submenu { display: block; }
}

/* --- Page heading ------------------------------------------------------- */

.page-head { margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .8rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 1.6rem; height: 1px;
  background: currentColor;
  opacity: .6;
}
.eyebrow.cool { color: var(--cool); }

.lede-strong {
  max-width: 46ch;
  margin-bottom: .9rem;
  color: var(--text);
  font-size: clamp(1.08rem, 1rem + .35vw, 1.25rem);
}

.lede {
  max-width: 60ch;
  color: var(--text-dim);
  font-size: clamp(1rem, .96rem + .2vw, 1.1rem);
}

.updated {
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--text-faint);
}

/* --- Cards / panels ---------------------------------------------------- */

.panel {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}
.panel + .panel { margin-top: 1.5rem; }
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 { margin: 0; font-size: 1.1rem; }
.panel-body { padding: 1.15rem; }

/* --- Stats ------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: .85rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 1.05rem 1.1rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.stat::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(var(--accent), var(--cool));
}
.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 1.3rem + 1.2vw, 2.3rem);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  display: block;
  margin-top: .4rem;
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* --- Masthead (the original site banner, used at full size) ------------- */

.masthead { margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }

.masthead-title { margin: 0; }

.masthead-frame {
  display: block;
  padding: .5rem;
  background: linear-gradient(125deg, var(--accent-line), var(--cool-line));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
}
.masthead-frame img {
  width: 100%;
  border-radius: calc(var(--radius-lg) - 5px);
  background: #08080c;
}

/* --- Page banner -------------------------------------------------------- */

/* The same banner art, dimmed behind each interior page heading. Declared
   twice on purpose: the plain url() is the guaranteed fallback, image-set()
   upgrades browsers that can take the smaller WebP. */
.page-banner {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}

.page-banner::before {
  content: "";
  position: absolute;
  inset: -2%;
  z-index: -2;
  background-image: url("../../images/sotsheader.png");
  background-image: image-set(url("../img/masthead.webp") type("image/webp"),
                              url("../../images/sotsheader.png") type("image/png"));
  background-size: cover;
  background-position: 50% 45%;
  opacity: .32;
  filter: saturate(.7) blur(1px);
}

.page-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(96deg,
    var(--bg) 6%,
    color-mix(in srgb, var(--bg) 82%, transparent) 46%,
    color-mix(in srgb, var(--bg) 46%, transparent) 100%);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .page-banner::after { background: linear-gradient(96deg, var(--bg) 20%, transparent); }
}

[data-theme="light"] .page-banner::before { opacity: .2; }

.page-banner .page-head {
  margin: 0;
  padding: clamp(1.4rem, 3.4vw, 2.5rem);
}

/* --- Home hero --------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } }

.hero h1 { margin-bottom: .75rem; }
.hero h1 .thin { display: block; color: var(--text-dim); font-size: .5em; letter-spacing: .04em; }

.hero-figure {
  position: relative;
  padding: .55rem;
  background: linear-gradient(140deg, var(--accent-line), var(--cool-line));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
}
.hero-figure > img {
  width: 100%;
  border-radius: calc(var(--radius-lg) - 6px);
  background: var(--bg-2);
}

/* Cross-fading feature image. Slides are stacked; only .is-active is visible,
   so with JavaScript off the first one simply stays put. */
.slideshow {
  position: relative;
  aspect-ratio: 455 / 250;
  overflow: hidden;
  border-radius: calc(var(--radius-lg) - 6px);
  background: #08080c;
}

.slide {
  position: absolute;
  inset: 0;
  display: block;
  opacity: 0;
  transition: opacity .9s var(--ease);
}
.slide.is-active { opacity: 1; }
.slide img {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
}

.slide-dots {
  position: absolute;
  left: 50%;
  bottom: .55rem;
  z-index: 2;
  display: flex;
  gap: .4rem;
  padding: .4rem .55rem;
  transform: translateX(-50%);
  background: rgba(8, 8, 12, .5);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.slide-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .45);
  cursor: pointer;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.slide-dots button:hover { background: #fff; }
.slide-dots button[aria-current="true"] {
  background: var(--accent);
  transform: scale(1.4);
}

.button-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .68rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .16s var(--ease), background .16s var(--ease),
              border-color .16s var(--ease), color .16s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); color: var(--accent-ink); }
.btn-ghost { border-color: var(--line); color: var(--text-dim); background: var(--bg-1); }
.btn-ghost:hover { border-color: var(--cool-line); color: var(--text); }

/* --- Section card grid ------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  height: 100%;
  padding: 1.15rem 1.2rem 1.25rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.card::before {
  content: "";
  position: absolute;
  inset: -40% 55% 40% -10%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent);
  opacity: 0;
  transition: opacity .25s var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: var(--shadow-2); }
.card:hover::before { opacity: 1; }
.card.cool:hover { border-color: var(--cool-line); }
.card.cool::before { background: radial-gradient(closest-side, var(--cool-soft), transparent); }

.card h3 { position: relative; margin: 0; font-size: 1.02rem; }
.card h3 a { display: block; }
.card h3 a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.card p { position: relative; margin: 0; color: var(--text-dim); font-size: .875rem; }
.card .card-count {
  position: relative;
  margin-top: auto;
  padding-top: .8rem;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* --- Table tools ------------------------------------------------------- */

.table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-left: auto;
}

.search-field { position: relative; flex: 1 1 15rem; min-width: 12rem; }
.search-field svg {
  position: absolute;
  left: .75rem; top: 50%;
  width: 15px; height: 15px;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.search-field input {
  width: 100%;
  padding: .55rem .75rem .55rem 2.2rem;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .875rem;
}
.search-field input::placeholder { color: var(--text-faint); }
.search-field input:focus { outline: none; border-color: var(--accent-line); background: var(--bg-2); }

.row-count {
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- Data tables ------------------------------------------------------- */

.table-wrap {
  max-height: min(70vh, 44rem);
  overflow: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overscroll-behavior: contain;
}

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .9rem;
}

table.data th, table.data td {
  padding: .68rem .95rem;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0;
  background: var(--bg-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data thead th button {
  display: flex;
  align-items: center;
  gap: .4rem;
  width: 100%;
  padding: .7rem .95rem;
  border: 0;
  background: none;
  color: var(--text-dim);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}
table.data thead th button:hover { color: var(--text); }
table.data thead th button .arrow { opacity: 0; font-size: .7em; transition: opacity .15s var(--ease); }
table.data thead th[aria-sort] button { color: var(--accent); }
table.data thead th[aria-sort] button .arrow { opacity: 1; }
table.data thead th[aria-sort="descending"] button .arrow { transform: rotate(180deg); }

table.data tbody tr { transition: background .12s var(--ease); }
table.data tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg-3) 45%, transparent); }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data tbody td:first-child { font-weight: 500; color: var(--text); }
table.data td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-dim); }

.tag {
  display: inline-block;
  padding: .12rem .5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-dim);
}
.tag.yes  { color: var(--cool);   border-color: var(--cool-line);   background: var(--cool-soft); }
.tag.no   { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

.empty-row td {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-faint);
}

/* --- Galleries --------------------------------------------------------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr));
  gap: .85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gallery.wide   { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.gallery.square .tile { aspect-ratio: 1 / 1; }

/* Artwork and flat collectibles must not be cropped to fit a tile. */
.gallery.contain .tile img { object-fit: contain; padding: .45rem; }
.gallery.contain .tile:hover img { transform: scale(1.03); }

.tile {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: zoom-in;
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.gallery.portrait .tile { aspect-ratio: 3 / 4; }
/* A portrait photo in a landscape tile: show all of it rather than cover-cropping
   to a slice of the middle, which cuts heads off. */
.tile.tall img { object-fit: contain; padding: .3rem; }
.tile.tall:hover img { transform: scale(1.03); }
.tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .35s var(--ease), opacity .2s var(--ease);
}
.tile:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: var(--shadow-2); }
.tile:hover img { transform: scale(1.05); }

/* --- Lightbox ---------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: clamp(.5rem, 1.5vw, 1rem);
  background: rgba(4, 4, 8, .9);
  backdrop-filter: blur(6px);
}
.lightbox[data-open="true"] { display: grid; }
/* The figure fills the frame and splits into an image row and a caption row, so
   the image is limited by the space actually left over rather than by a guessed
   slice of the viewport. A 3:2 photo on a 16:9 screen still leaves a gap down
   each side - that is the aspect ratio, not spare room. */
.lightbox figure {
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-rows: 1fr auto;
  align-items: center;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  min-height: 0;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
}
.lightbox-caption {
  margin-top: .9rem;
  color: #cfcdd8;
  font-size: .82rem;
  text-align: center;
}
.lightbox-close { position: absolute; top: 1rem; right: 1rem; }
.lightbox-prev, .lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox .icon-button { background: rgba(20,20,28,.7); border-color: rgba(255,255,255,.18); color: #f2f1f6; }
.lightbox .icon-button:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* --- Timeline ---------------------------------------------------------- */

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

.timeline > li {
  position: relative;
  padding: 0 0 1.6rem 2rem;
  border-left: 1px solid var(--line);
}
.timeline > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline > li::before {
  content: "";
  position: absolute;
  left: -5px; top: .45rem;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline h3 { margin: 0 0 .35rem; font-size: 1rem; }
.timeline .meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.timeline .note { margin: .55rem 0 0; color: var(--text-dim); font-size: .875rem; }
.timeline .strip {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .9rem 0 0;
  padding: 0;
  list-style: none;
}
.timeline .strip .tile { width: 7.5rem; aspect-ratio: 5 / 6; }

/* --- Prose ------------------------------------------------------------- */

.prose { max-width: 68ch; }
.prose p { color: var(--text-dim); }
.prose h2 { margin-top: 2rem; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* --- Footer ------------------------------------------------------------ */

.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--bg-1) 60%, transparent);
  padding-block: 2.25rem;
  font-size: .82rem;
  color: var(--text-faint);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.5rem;
}
.footer-inner nav { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; margin-left: auto; }
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--accent); }
.site-footer p { margin: 0; }

/* --- Utilities / motion ------------------------------------------------ */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.reveal { opacity: 0; transform: translateY(12px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .5s var(--ease), transform .5s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .site-footer, .table-tools, .lightbox { display: none !important; }
  body::before { display: none; }
  .table-wrap { max-height: none; overflow: visible; }
  body { background: #fff; color: #000; }
}
