/* Hallmark · pre-emit critique: P5 H4 E5 S4 R5 V4 */
/* Hallmark · theme: cobalt · macrostructure: catalogue · enrichment: none · polish: none */
/* Hallmark · fonts: Space Grotesk / Inter / JetBrains Mono · accent: electric cobalt */

:root {
  --color-bg: oklch(98.5% 0.004 250);
  --color-bg-elevated: oklch(100% 0.002 250);
  --color-ink: oklch(24% 0.02 258);
  --color-ink-soft: oklch(34% 0.018 257);
  --color-muted: oklch(52% 0.02 257);
  --color-rule: oklch(88% 0.01 250);
  --color-rule-strong: oklch(78% 0.02 256);
  --color-accent: oklch(58% 0.20 256);
  --color-accent-soft: oklch(94% 0.03 256);
  --color-graphite: oklch(22% 0.016 260);
  --color-graphite-ink: oklch(92% 0.01 250);
  --color-success: oklch(55% 0.14 155);
  --color-warn-bg: oklch(96% 0.03 95);

  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --max: 1200px;
  --shadow-lift: 0 1px 2px oklch(24% 0.02 258 / 0.06);
}

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

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

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

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--space-4);
  top: var(--space-4);
  z-index: 100;
  background: var(--color-bg-elevated);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-rule);
}

/* —— Nav —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  background: color-mix(in oklch, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-rule);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  font-style: normal;
}

.brand-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.cmd-btn,
.ghost-btn,
.solid-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-rule-strong);
  background: var(--color-bg-elevated);
  color: var(--color-ink);
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.cmd-btn:hover,
.ghost-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.solid-btn {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.solid-btn:hover {
  color: white;
  filter: brightness(1.05);
}

.kbd {
  opacity: 0.65;
  margin-left: 0.35rem;
}

/* —— Masthead / catalogue header —— */
.masthead {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--space-7) clamp(1rem, 3vw, 2rem) var(--space-5);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0 0 var(--space-3);
}

.masthead h1 {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 var(--space-3);
  overflow-wrap: anywhere;
  min-width: 0;
}

.lede {
  margin: 0;
  max-width: 42rem;
  color: var(--color-ink-soft);
  font-size: 1.02rem;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-6);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-rule);
}

.stat {
  min-width: 0;
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  font-style: normal;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* —— Toolbar —— */
.toolbar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem) var(--space-4);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

@media (max-width: 900px) {
  .toolbar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .toolbar {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.field label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--color-rule-strong);
  border-radius: var(--radius-sm);
  background: var(--color-bg-elevated);
  color: var(--color-ink);
}

.field input:focus,
.field select:focus {
  border-color: var(--color-accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.result-line {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem) var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* —— Tag panel —— */
.tag-panel {
  max-width: var(--max);
  margin: 0 auto var(--space-4);
  padding: var(--space-5) clamp(1rem, 3vw, 2rem);
  border-top: 1px solid var(--color-rule);
  border-bottom: 1px solid var(--color-rule);
  background: var(--color-bg-elevated);
}

.tag-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.tag-panel-title {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.tag-summary {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.tag-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
}

.field-inline {
  min-width: min(100%, 180px);
}

.tag-active-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.tag-active {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.tag-active-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-height: 220px;
  overflow: auto;
  padding-right: 0.25rem;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--color-rule-strong);
  background: var(--color-bg);
  color: var(--color-ink-soft);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-family: var(--font-body);
  font-size: calc(0.78rem * var(--tag-weight, 1));
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.tag-chip:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.tag-chip.is-include,
.tag-chip.is-active {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.tag-chip.is-exclude {
  background: color-mix(in oklch, oklch(58% 0.18 25) 12%, white);
  border-color: oklch(58% 0.18 25);
  color: oklch(46% 0.16 25);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.tag-chip.is-include .tag-count,
.tag-chip.is-active .tag-count {
  color: color-mix(in oklch, var(--color-accent) 70%, var(--color-muted));
}

.tag-chip.is-exclude .tag-count {
  color: color-mix(in oklch, oklch(46% 0.16 25) 70%, var(--color-muted));
}

.tag-count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--color-muted);
}

.tag-remove {
  font-size: 0.95rem;
  line-height: 1;
}

.game-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-width: 0;
}

.game-tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  color: var(--color-muted);
  background: color-mix(in oklch, var(--color-accent) 8%, white);
  border: 1px solid var(--color-rule);
  border-radius: 4px;
  padding: 0.12rem 0.35rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-tag-more {
  color: var(--color-accent);
  border-color: color-mix(in oklch, var(--color-accent) 35%, var(--color-rule));
}

@media (max-width: 768px) {
  .tag-panel-actions {
    width: 100%;
  }

  .field-inline {
    flex: 1 1 100%;
  }

  .tag-cloud {
    max-height: 180px;
  }
}

/* —— Grid catalogue —— */
.catalogue {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem) var(--space-8);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 0;
  border-top: 1px solid var(--color-rule);
  border-left: 1px solid var(--color-rule);
}

.game {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--color-rule);
  border-bottom: 1px solid var(--color-rule);
  background: var(--color-bg);
  text-decoration: none;
  color: inherit;
  transition: background 160ms ease, border-color 160ms ease;
  opacity: 0;
  transform: translateY(10px);
}

.game.is-in {
  opacity: 1;
  transform: none;
  transition:
    opacity 600ms ease,
    transform 600ms ease,
    background 160ms ease;
}

.game:hover {
  background: var(--color-accent-soft);
}

.game:hover .game-name {
  color: var(--color-accent);
}

.game-media {
  aspect-ratio: 231 / 87;
  background: var(--color-graphite);
  overflow: hidden;
}

.game-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-body {
  padding: var(--space-3) var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.game-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: normal;
  font-size: 0.98rem;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 0;
  overflow-wrap: anywhere;
  min-width: 0;
}

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--color-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--color-success);
  background: color-mix(in oklch, var(--color-success) 12%, white);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.price {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-ink-soft);
}

.price .disc {
  color: var(--color-accent);
  margin-right: 0.35rem;
}

.empty,
.empty-data {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--space-7) clamp(1rem, 3vw, 2rem);
  border-top: 1px solid var(--color-rule);
}

.empty h2,
.empty-data h2 {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  margin: 0 0 var(--space-3);
}

.empty code,
.empty-data code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-accent-soft);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* —— Graphite band —— */
.band {
  background: var(--color-graphite);
  color: var(--color-graphite-ink);
  padding: var(--space-7) clamp(1rem, 3vw, 2rem);
}

.band-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: var(--space-6);
}

@media (max-width: 768px) {
  .band-inner {
    grid-template-columns: 1fr;
  }
}

.band h2 {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-3);
}

.band p {
  margin: 0;
  color: color-mix(in oklch, var(--color-graphite-ink) 80%, transparent);
}

.band-note {
  margin-top: var(--space-3) !important;
  font-size: 0.92rem;
  color: color-mix(in oklch, var(--color-graphite-ink) 65%, transparent) !important;
}

.game-meta-sub {
  margin-top: -0.15rem;
}

.game-date {
  color: var(--color-muted);
}

.band pre {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid color-mix(in oklch, white 12%, transparent);
  border-radius: var(--radius-md);
  background: oklch(18% 0.016 260);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-x: auto;
  box-shadow: var(--shadow-lift);
}

.band .ok {
  color: oklch(78% 0.14 155);
}

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--space-5) clamp(1rem, 3vw, 2rem) var(--space-7);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  border-top: 1px solid var(--color-rule);
}

/* —— Command palette —— */
.palette[hidden] {
  display: none !important;
}

.palette {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: start center;
  padding: 12vh 1rem 1rem;
}

.palette-backdrop {
  position: absolute;
  inset: 0;
  background: oklch(24% 0.02 258 / 0.35);
}

.palette-panel {
  position: relative;
  width: min(560px, 100%);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-rule-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}

.palette-panel input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--color-rule);
  padding: 0.9rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  background: transparent;
  color: var(--color-ink);
}

.palette-panel input:focus {
  outline: none;
}

.palette-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  max-height: 50vh;
  overflow: auto;
}

.palette-list li button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--color-ink);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.palette-list li button[aria-selected="true"],
.palette-list li button:hover {
  background: var(--color-accent-soft);
}

.palette-list .p-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: normal;
  overflow-wrap: anywhere;
}

.palette-list .p-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-muted);
}

.hidden {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .game {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
