/* Possibility Engine shell styles. Never loaded inside demos. */

:root {
  color-scheme: dark;
  --bg: #0b0b0d;
  --surface: #141418;
  --surface-2: #1c1c22;
  --line: #2a2a33;
  --text: #f2f1ee;
  --muted: #9a99a3;
  --accent: #ff4d2e;
  --accent-ink: #0b0b0d;
  --good: #3ddc97;
  --warn: #ffc94d;
  --bad: #ff6b6b;
  --radius: 14px;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }

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

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

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

.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center;
  padding: 14px var(--gutter);
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); }
/* Ammunition mark (inline SVG, coloured via currentColor). */
.brand-mark { width: 46px; height: auto; aspect-ratio: 185 / 57; flex: none; color: var(--accent); }
.brand-text strong { font-weight: 700; }

.site-footer {
  padding: 48px var(--gutter);
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
  margin-top: 80px;
}

/* ---------- Gallery ---------- */

.gallery, .viewer { padding: 0 var(--gutter); max-width: 1440px; margin: 0 auto; }

.intro { padding: clamp(48px, 9vw, 120px) 0 32px; max-width: 760px; }
.intro h1 {
  font: 700 clamp(44px, 8vw, 96px)/0.95 var(--font-display);
  letter-spacing: -0.03em;
  margin: 0 0 20px;
}
.intro h1 em { font-style: normal; color: var(--accent); }
.intro p { color: var(--muted); font-size: 18px; margin: 0; }

.dev-warnings {
  margin: 0 0 24px; padding: 12px 16px;
  border: 1px solid color-mix(in oklab, var(--warn) 50%, transparent);
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--warn) 8%, transparent);
  color: var(--warn); font-size: 13px;
}
.dev-warnings summary { cursor: pointer; font-weight: 600; }

.filters {
  display: grid; gap: 16px;
  padding: 20px; margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  scroll-margin-top: 80px;
}

.filters-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.search { flex: 1 1 280px; }
.search input, .sort select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit;
}
.sort { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.sort select { width: auto; }

.clear, .btn, .stage-toolbar button {
  padding: 9px 14px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  font: 500 13px var(--font-body); text-decoration: none;
  cursor: pointer;
}
.clear:hover, .btn:hover, .stage-toolbar button:hover { border-color: var(--muted); }

.facet { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.facet legend {
  float: left; width: 130px; margin-right: 8px;
  font: 600 11px var(--font-body); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}

.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip small { color: var(--muted); font-size: 11px; }
.chip span:hover { border-color: var(--muted); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip input:checked + span small { color: inherit; opacity: 0.7; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.result-count { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

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

.card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s;
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in oklab, var(--accent) 60%, var(--line)); }

.card-link { text-decoration: none; flex: 1; }

.card-media {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background:
    radial-gradient(120% 80% at 20% 0%, hsl(var(--hue) 80% 55% / 0.55), transparent 60%),
    radial-gradient(100% 90% at 100% 100%, hsl(calc(var(--hue) + 60) 80% 50% / 0.45), transparent 60%),
    var(--surface-2);
}
.card-media img, .card-media video { width: 100%; height: 100%; object-fit: cover; }
.card-media video { position: absolute; inset: 0; opacity: 0; transition: opacity 0.3s; }
.card:hover .card-media video { opacity: 1; }
.card-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 700 96px var(--font-display); color: rgb(255 255 255 / 0.85);
  mix-blend-mode: overlay;
}

.card-body { padding: 16px 18px 8px; }
.card-title { font: 600 19px/1.25 var(--font-display); margin: 0 0 6px; }
.card-summary { color: var(--muted); margin: 0; font-size: 14px; }

.card-meta { padding: 10px 18px 16px; display: grid; gap: 10px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tag {
  display: inline-block;
  padding: 3px 9px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  font: 500 12px var(--font-body); text-decoration: none;
  cursor: pointer;
}
.tag:hover { border-color: var(--accent); color: var(--accent); }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  padding: 2px 8px; border-radius: 6px;
  font: 600 11px var(--font-body); letter-spacing: 0.02em;
  background: var(--surface-2); color: var(--muted);
}
.badge--low, .badge--light { color: var(--good); }
.badge--medium, .badge--moderate { color: var(--warn); }
.badge--high, .badge--heavy { color: var(--bad); }

.empty { color: var(--muted); padding: 48px 0; text-align: center; }

/* ---------- Viewer ---------- */

.viewer-nav {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  padding: 24px 0; font-size: 14px;
}
.viewer-nav a { color: var(--muted); text-decoration: none; }
.viewer-nav a:hover { color: var(--text); }
.viewer-pager { display: flex; gap: 20px; }

.viewer-head h1 {
  font: 700 clamp(32px, 5vw, 56px)/1.05 var(--font-display);
  letter-spacing: -0.02em; margin: 0 0 10px;
}
.lede { color: var(--muted); font-size: 18px; margin: 0 0 24px; max-width: 760px; }

.stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.stage-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.stage-toolbar .btn { margin-left: auto; }

.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 10px 0 0 10px; margin-left: 0; }
.seg button:last-child { border-radius: 0 10px 10px 0; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--accent); }

.stage-frame {
  --frame-width: 100%;
  display: flex; justify-content: center;
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--bg) 0 50%) 0 0 / 20px 20px;
}
.stage-frame iframe {
  display: block;
  width: min(var(--frame-width), 100%);
  height: min(78vh, 900px);
  border: 0;
  background: #fff;
  transition: width 0.35s ease;
}

.details {
  display: grid; gap: 32px;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  padding: 32px 0;
}
@media (max-width: 760px) { .details { grid-template-columns: 1fr; } }

.detail-main h2 { font: 600 20px var(--font-display); margin: 0 0 10px; }
.detail-main p { color: var(--muted); margin: 0; font-size: 16px; }

.detail-meta { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 12px 16px; font-size: 14px; }
.detail-meta dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; padding-top: 3px; }
.detail-meta dd { margin: 0; }

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