/* SameFace design system.

   The whole argument is one contrast: a picture nobody has used before, and a
   picture an earlier coin was already wearing. Teal for first, rose for repeat,
   and everything else stays quiet so those two read instantly across a grid of
   two hundred thumbnails.

   THEMING. Dark is home, light is an override, and every colour is a token
   because the surfaces are white overlays that disappear on a light ground.
   Fills stay saturated across themes; text roles (--first-fg, --repeat-fg)
   darken in light, where #2dd4bf on white is ~1.7:1 and unreadable. */

:root {
  color-scheme: dark;

  --first: #2dd4bf;
  --first-fg: #2dd4bf;
  --first-glow: rgba(45, 212, 191, 0.14);
  --repeat: #fb7185;
  --repeat-fg: #fb7185;
  --repeat-glow: rgba(251, 113, 133, 0.14);
  --machine: #c084fc;
  --machine-fg: #c084fc;
  --neutral: #60a5fa;

  --bg: #08080c;
  --bg-2: #0c0c12;
  --masthead-bg: rgba(8, 8, 12, 0.74);

  --surface: rgba(255, 255, 255, 0.028);
  --surface-2: rgba(255, 255, 255, 0.048);
  --surface-3: rgba(255, 255, 255, 0.07);
  --hover: rgba(255, 255, 255, 0.035);
  --track: rgba(255, 255, 255, 0.08);

  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.15);
  --gridline: rgba(255, 255, 255, 0.055);

  --ink: #f5f6f8;
  --ink-2: #b7bcc6;
  --ink-3: #7e848f;
  --ink-4: #545a65;
  --on-accent: #04211d;

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1140px;

  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --mono: 'SF Mono', ui-monospace, 'JetBrains Mono', Menlo, monospace;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.32);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    color-scheme: light;
    --first-fg: #0d7c6c;
    --repeat-fg: #c02c48;
    --machine-fg: #7c3aed;
    --neutral: #2563eb;

    --bg: #fbfbfd;
    --bg-2: #f3f4f7;
    --masthead-bg: rgba(251, 251, 253, 0.78);

    --surface: rgba(9, 12, 20, 0.028);
    --surface-2: rgba(9, 12, 20, 0.05);
    --surface-3: rgba(9, 12, 20, 0.075);
    --hover: rgba(9, 12, 20, 0.035);
    --track: rgba(9, 12, 20, 0.1);

    --line: rgba(9, 12, 20, 0.11);
    --line-2: rgba(9, 12, 20, 0.2);
    --gridline: rgba(9, 12, 20, 0.08);

    --ink: #0b0d13;
    --ink-2: #444b58;
    --ink-3: #6c7280;
    --ink-4: #949aa6;
    --on-accent: #ffffff;

    --shadow: 0 1px 2px rgba(9, 12, 20, 0.06), 0 12px 28px rgba(9, 12, 20, 0.08);
  }
}

:root[data-theme='light'] {
  color-scheme: light;
  --first-fg: #0d7c6c;
  --repeat-fg: #c02c48;
  --machine-fg: #7c3aed;
  --neutral: #2563eb;

  --bg: #fbfbfd;
  --bg-2: #f3f4f7;
  --masthead-bg: rgba(251, 251, 253, 0.78);

  --surface: rgba(9, 12, 20, 0.028);
  --surface-2: rgba(9, 12, 20, 0.05);
  --surface-3: rgba(9, 12, 20, 0.075);
  --hover: rgba(9, 12, 20, 0.035);
  --track: rgba(9, 12, 20, 0.1);

  --line: rgba(9, 12, 20, 0.11);
  --line-2: rgba(9, 12, 20, 0.2);
  --gridline: rgba(9, 12, 20, 0.08);

  --ink: #0b0d13;
  --ink-2: #444b58;
  --ink-3: #6c7280;
  --ink-4: #949aa6;
  --on-accent: #ffffff;

  --shadow: 0 1px 2px rgba(9, 12, 20, 0.06), 0 12px 28px rgba(9, 12, 20, 0.08);
}

* { box-sizing: border-box; }

/* `overflow-x: clip` and NOT `hidden`. On `body`, `hidden` forces the other
   axis to compute to `auto`, which turns the body into a scroll container and
   stops the fixed z-index:-1 backdrop below from painting once the page is
   scrolled — layout and hit-testing stay correct, so it fails silently and
   only a screenshot catches it. `clip` leaves `overflow-y: visible` alone. */
html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

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

/* A very quiet field of dots, so the dark ground is not a flat void. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 78% -8%, var(--repeat-glow), transparent 62%),
    radial-gradient(900px 540px at 8% 4%, var(--first-glow), transparent 60%);
  opacity: 0.85;
}

a { color: inherit; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: var(--masthead-bg);
  border-bottom: 1px solid var(--line);
}

.masthead .wrap {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 56px;
}

.brandmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 640;
  letter-spacing: -0.015em;
  text-decoration: none;
  font-size: 15px;
  flex: none;
}

/* Two squares, offset — one picture and its echo. */
.glyph {
  position: relative;
  width: 17px;
  height: 17px;
  flex: none;
}
.glyph i {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: block;
}
/* Teal leads, rose trails — the same order as the logo and the og card. Teal
   means "not seen before" everywhere else here, so a mark with the rose in
   front would state the argument backwards. */
.glyph i:first-child {
  right: 0;
  bottom: 0;
  background: var(--repeat);
  opacity: 0.55;
}
.glyph i:last-child {
  left: 0;
  top: 0;
  background: var(--first);
}

.masthead nav {
  display: flex;
  gap: 18px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.masthead nav::-webkit-scrollbar { display: none; }

.masthead nav a {
  color: var(--ink-3);
  text-decoration: none;
  font-size: 13.5px;
  white-space: nowrap;
  padding: 4px 0;
  transition: color 0.15s;
}
.masthead nav a:hover { color: var(--ink); }
.masthead nav a[aria-current='page'] { color: var(--ink); font-weight: 560; }

.masthead-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.icon-link {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}
.icon-link:hover { color: var(--ink); background: var(--surface-2); }

/* ------------------------------------------------------------------- type */

h1, h2, h3 {
  letter-spacing: -0.028em;
  line-height: 1.12;
  margin: 0;
  font-weight: 660;
}

.hero {
  padding: 76px 0 40px;
}
.hero h1 {
  font-size: clamp(38px, 7vw, 68px);
  max-width: 17ch;
}
.hero .kicker {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 18px;
}
.hero .lede {
  font-size: clamp(16.5px, 2.1vw, 19px);
  color: var(--ink-2);
  max-width: 62ch;
  margin: 22px 0 0;
}

.section {
  padding: 56px 0;
  border-top: 1px solid var(--line);
}
.section > .wrap > h2 {
  font-size: clamp(24px, 3.4vw, 33px);
  max-width: 22ch;
}
.section .sub {
  color: var(--ink-2);
  max-width: 68ch;
  margin: 14px 0 0;
  font-size: 15.5px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin: 0 0 12px;
}

.mono { font-family: var(--mono); }
.first-fg { color: var(--first-fg); }
.repeat-fg { color: var(--repeat-fg); }
.machine-fg { color: var(--machine-fg); }
.dim { color: var(--ink-3); }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 34px 0 0;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat .v {
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 660;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.stat .k {
  color: var(--ink-3);
  font-size: 12.5px;
  margin-top: 8px;
  line-height: 1.45;
}

/* -------------------------------------------------------------- the curve */

.chart-card {
  margin-top: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 14px;
}
.chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
  margin-bottom: 6px;
}
.chart-head h3 { font-size: 16px; font-weight: 600; }
.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-left: auto;
  font-size: 12.5px;
  color: var(--ink-3);
}
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i {
  width: 11px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

.chart-scroll { overflow-x: auto; }
svg.chart { display: block; width: 100%; height: auto; min-width: 460px; }
svg.chart text { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-4); }
svg.chart .gridline { stroke: var(--gridline); stroke-width: 1; }
svg.chart .axis { stroke: var(--line-2); stroke-width: 1; }

/* ------------------------------------------------------------- the slider */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 26px;
  align-items: center;
  margin-top: 24px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.control { display: flex; align-items: center; gap: 12px; min-width: 260px; flex: 1; }
.control label { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.control output {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  min-width: 8ch;
  text-align: right;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 22px;
  background: none;
  cursor: pointer;
  min-width: 110px;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--track);
}
input[type='range']::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--track);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--ink);
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
input[type='range']::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  border: none;
}
input[type='range']:focus-visible { outline: 2px solid var(--neutral); outline-offset: 4px; }

/* --------------------------------------------------------------- the wall */

.wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
  margin-top: 26px;
}

.tile {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
  aspect-ratio: 1;
  cursor: pointer;
  display: block;
  padding: 0;
  width: 100%;
  text-align: left;
  transition: transform 0.16s cubic-bezier(0.2, 0.7, 0.3, 1), border-color 0.16s;
}
.tile:hover { transform: translateY(-3px); border-color: var(--line-2); }
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #fff;
}
.tile .count {
  position: absolute;
  left: 8px;
  top: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(6, 6, 10, 0.78);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.tile .badge {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(6, 6, 10, 0.6);
}
.tile .foot {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px 9px 7px;
  font-size: 11.5px;
  color: #fff;
  background: linear-gradient(transparent, rgba(6, 6, 10, 0.86));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* -------------------------------------------------------------- the strip */

.strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 10px;
}
.strip img {
  width: 68px;
  height: 68px;
  flex: none;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff;
}

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

.table-scroll { overflow-x: auto; margin-top: 22px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 560px;
}
th {
  text-align: left;
  font-weight: 560;
  color: var(--ink-3);
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--gridline);
  vertical-align: middle;
}
tbody tr:hover { background: var(--hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }

/* ---------------------------------------------------------------- dialog */

dialog {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--ink);
  padding: 0;
  max-width: min(760px, calc(100vw - 32px));
  width: 100%;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(4, 4, 8, 0.62); backdrop-filter: blur(3px); }
.dlg-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.dlg-head img {
  width: 76px;
  height: 76px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: none;
  background: #fff;
}
.dlg-body { padding: 4px 22px 20px; max-height: 56vh; overflow: auto; }
.dlg-close {
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  flex: none;
  font-size: 16px;
  line-height: 1;
}
.dlg-close:hover { color: var(--ink); }

/* ------------------------------------------------------------- dropzone */

.drop {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 42px 24px;
  text-align: center;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.drop.over { border-color: var(--first); background: var(--first-glow); }
.drop h3 { font-size: 17px; margin-bottom: 6px; }
.drop p { color: var(--ink-3); font-size: 14px; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 560;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn[disabled] { opacity: 0.45; cursor: default; }

/* ------------------------------------------------------------ callouts */

.note {
  border-left: 2px solid var(--line-2);
  padding: 2px 0 2px 18px;
  margin: 26px 0;
  color: var(--ink-2);
  font-size: 15px;
  max-width: 70ch;
}
.note.warn { border-left-color: var(--repeat); }
.note.good { border-left-color: var(--first); }
.note strong { color: var(--ink); font-weight: 600; }

.prose { max-width: 70ch; color: var(--ink-2); font-size: 15.5px; }
.prose h3 { color: var(--ink); font-size: 18px; margin: 34px 0 10px; }
.prose p { margin: 0 0 14px; }
.prose code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 5px;
}
.prose ul { padding-left: 20px; margin: 0 0 14px; }
.prose li { margin-bottom: 7px; }

/* ------------------------------------------------------------- bench bars */

.bench { margin-top: 22px; display: grid; gap: 10px; }
.bench-row {
  display: grid;
  grid-template-columns: 116px 1fr auto;
  gap: 14px;
  align-items: center;
  font-size: 13px;
}
.bench-row .lbl { font-family: var(--mono); color: var(--ink-2); font-size: 12px; }
.bench-bar {
  height: 22px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
}
.bench-bar i {
  display: block;
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.bench-row .ms {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-size: 12.5px;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 34px 0 54px;
  margin-top: 34px;
}
.foot-nav { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; font-size: 13.5px; }
.foot-nav a { color: var(--ink-2); text-decoration: none; }
.foot-nav a:hover { color: var(--ink); }
.foot-nav .dot { color: var(--ink-4); }
.foot-note { color: var(--ink-3); font-size: 12.5px; max-width: 76ch; margin: 0 0 8px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: sheen 1.3s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes sheen {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

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

@media (max-width: 620px) {
  .wrap { padding: 0 18px; }
  .hero { padding: 48px 0 28px; }
  .section { padding: 42px 0; }
  .bench-row { grid-template-columns: 92px 1fr auto; }
  .wall { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 9px; }
}
