/* The Avatar — style range review surface.
   Chrome stays quiet: the page is a wall, the plates are the work. */

:root {
  --fg: #fafafa;
  --fg-secondary: #a3a3a3;
  --fg-muted: #737373;
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-elevated: #1a1a1a;
  --border: #262626;
  --border-subtle: #1f1f1f;
  --gold: #c9b896;
  --lavender: #a78bfa;

  --page-pad: 20px;
  --topbar-h: auto;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }

.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar__in {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--page-pad) 10px;
  max-width: 1400px;
  margin: 0 auto;
}

.topbar__id h1 { font-size: 1.5rem; line-height: 1.15; margin-top: 2px; }
.topbar__id .sub { color: var(--gold); font-weight: 500; font-size: 0.8125rem; }

.who { display: flex; flex-direction: column; gap: 4px; flex: none; }
.who select {
  background: var(--bg-elevated);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.8125rem;
  min-width: 140px;
}
.who select:focus-visible { outline: 2px solid var(--lavender); outline-offset: 1px; }

.tabbar {
  display: flex;
  gap: 2px;
  padding: 0 var(--page-pad) 0;
  max-width: 1400px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  padding: 8px 12px 10px;
  color: var(--fg-muted);
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid transparent;
}
.tab:hover, .tab.is-active { color: var(--fg); border-bottom-color: var(--gold); }

/* ── sections ────────────────────────────────────────────────────── */

main { max-width: 1400px; margin: 0 auto; padding: 0 var(--page-pad) 64px; }

.section { padding-top: 40px; scroll-margin-top: 96px; }
.section__head { margin-bottom: 20px; max-width: 62ch; }
.section__head h2 { font-size: 1.25rem; margin-bottom: 6px; }
.lede { color: var(--fg-secondary); }
.lede em { color: var(--fg); font-style: italic; }

/* ── the three labelled panels ───────────────────────────────────── */

.panels {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 12px;
  margin: 0 calc(var(--page-pad) * -1);
  padding: 0 var(--page-pad);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
  .panels { grid-auto-columns: 86%; }
}

.panel {
  scroll-snap-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel__pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.panel__pick select {
  flex: 1;
  min-width: 0;
  background: var(--bg-elevated);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
  font-size: 0.75rem;
}
.panel__slot {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6875rem;
  color: var(--fg-muted);
  flex: none;
}

/* container-type lets the callouts size themselves against the plate rather
   than the viewport — the same overlay has to work at 340px on a phone and
   at 1400px in the lightbox. */
.plate {
  position: relative;
  width: 100%;
  aspect-ratio: 1536 / 1024;
  background: #101010;
  container-type: inline-size;
}
.plate img { width: 100%; height: 100%; display: block; object-fit: contain; }

.plate__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.dot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: clamp(11px, 3.2cqw, 26px);
  height: clamp(11px, 3.2cqw, 26px);
  border-radius: 50%;
  background: rgba(10, 10, 10, 0.8);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(7px, 1.9cqw, 15px);
  font-weight: 500;
  line-height: 1;
  transition: transform 120ms ease, background 120ms ease;
}
.dot.is-hot {
  background: var(--gold);
  color: #0a0a0a;
  transform: translate(-50%, -50%) scale(1.5);
  z-index: 2;
}

.headingtag {
  position: absolute;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(6px, 1.7cqw, 12px);
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--fg);
  background: rgba(10, 10, 10, 0.7);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 5px;
  width: max-content;
  max-width: 42%;
}

.panel__foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px 9px;
  border-top: 1px solid var(--border-subtle);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.625rem;
  color: var(--fg-muted);
}
.panel__foot button {
  background: none;
  border: none;
  color: var(--fg-muted);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}
.panel__foot button:hover { color: var(--fg); }

/* ── legend ──────────────────────────────────────────────────────── */

.legend {
  margin-top: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.legend__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.legend__head h3 { font-size: 0.9375rem; }
.legend__actions { display: flex; gap: 6px; flex-wrap: wrap; }

.mini {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--fg-secondary);
  border-radius: 5px;
  padding: 4px 9px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.mini:hover { color: var(--fg); border-color: var(--fg-muted); }

.legend__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.row {
  display: grid;
  grid-template-columns: 28px 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
}
.row:hover { background: var(--bg-elevated); }
.row.is-off { opacity: 0.42; }

.row__letter {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--gold);
  text-align: center;
}
.row.is-off .row__letter { color: var(--fg-muted); }

.row__toggle { display: grid; place-items: center; }
.row__toggle input { width: 15px; height: 15px; accent-color: var(--gold); cursor: pointer; }

.row__text {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--fg);
  font: inherit;
  line-height: 1.4;
  padding: 4px 6px;
  width: 100%;
  min-width: 0;
  resize: none;
  overflow: hidden;
}
.row__text:hover { border-color: var(--border); }
.row__text:focus { border-color: var(--lavender); outline: none; background: var(--bg); }
.row.is-edited .row__text { color: var(--lavender); }

.row__meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.5625rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.legend__note {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* On a phone the figure column is the first thing worth losing — the caption
   itself already says which man it belongs to. */
@media (max-width: 560px) {
  .row { grid-template-columns: 22px 20px minmax(0, 1fr); }
  .row__meta { display: none; }
}

/* ── comments ────────────────────────────────────────────────────── */

.commentblock {
  margin-top: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.hint { color: var(--fg-muted); font-size: 0.75rem; margin: 4px 0 8px; }

textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font: inherit;
  padding: 9px 11px;
  resize: vertical;
}
textarea:focus { border-color: var(--lavender); outline: none; }

.commentblock__foot { display: flex; align-items: center; gap: 12px; margin-top: 8px; }

.btn {
  background: var(--gold);
  color: #0a0a0a;
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  font: inherit;
  font-weight: 500;
  font-size: 0.8125rem;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.status {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6875rem;
  color: var(--fg-muted);
}
.status[data-kind="ok"] { color: var(--gold); }
.status[data-kind="err"] { color: #f87171; }

.thread { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.thread li {
  border-left: 2px solid var(--border);
  padding: 2px 0 2px 10px;
}
.thread .who-said {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold);
}
.thread .said { color: var(--fg-secondary); white-space: pre-wrap; }

/* ── galleries ───────────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 14px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card.is-base { border-color: #3a3325; }

.card__img {
  width: 100%;
  aspect-ratio: 3 / 2;
  background: #101010;
  border: none;
  padding: 0;
  cursor: zoom-in;
  display: block;
}
.card__img img { width: 100%; height: 100%; object-fit: contain; display: block; }

.card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.card__title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card__title h4 { margin: 0; font-size: 0.8125rem; font-weight: 600; }
.card__stars { color: var(--gold); font-size: 0.6875rem; letter-spacing: 1px; flex: none; }
.card__meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
}
.card__badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold);
  border: 1px solid #3a3325;
  border-radius: 3px;
  padding: 1px 5px;
}
.card textarea { font-size: 0.8125rem; padding: 7px 9px; }
.card .commentblock__foot { margin-top: 6px; }
.card .btn { padding: 5px 11px; font-size: 0.75rem; }

/* ── lightbox ────────────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(6, 6, 6, 0.96);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 40px 12px 0;
}
.lightbox[hidden] { display: none; }
.lightbox__stage {
  display: grid;
  place-items: center;
  min-height: 0;
}
/* In the lightbox the plate shrink-wraps the image instead of being driven by
   an aspect ratio — the alt frames aren't all 3:2. That rules out container
   queries here (inline-size containment would collapse a shrink-wrapping box),
   so the callouts take a fixed size, which is right at this scale anyway. */
.lightbox__stage .plate {
  display: inline-block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  container-type: normal;
  background: none;
  line-height: 0;
}
/* A percentage max-height on a child of an auto-height parent resolves to
   none, so the image has to be capped against the viewport directly. dvh,
   not vh: vh measures the viewport with mobile browser chrome retracted and
   overshoots on a phone. 116px is the top pad plus the caption bar. */
.lightbox__stage .plate img {
  max-width: 100%;
  max-height: calc(100dvh - 116px);
  width: auto;
  height: auto;
}
.lightbox__stage .dot { width: 26px; height: 26px; font-size: 14px; border-width: 1.5px; }
.lightbox__stage .headingtag { font-size: 12px; max-width: 40%; }
.lightbox__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--fg-secondary);
}
.lightbox__toggle input { accent-color: var(--gold); }
.lightbox__toggle[hidden] { display: none; }
.lightbox__bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 4px 14px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6875rem;
  color: var(--fg-secondary);
}
.lightbox__hint { color: var(--fg-muted); }
.lightbox__close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  color: var(--fg-secondary);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
}
.lightbox__close:hover { color: var(--fg); }

.foot {
  margin-top: 56px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.needs-actor { opacity: 0.5; pointer-events: none; }
