:root {
  --bg: #0c0c0e; --surface: #16161a; --raised: #1f1f24; --line: #2a2a30;
  --text: #ededea; --muted: #8e8d88; --accent: #f0f0ec; --warn: #d9a441; --miss: #d36450;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif; }
a { color: inherit; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 20px; }

.hero { padding: 48px 0 36px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 40px; align-items: center; }
.stats { margin: 18px 0 0; color: var(--muted); font-size: 13px; }
.featured { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 130px; grid-auto-flow: dense; gap: 8px; }
.featured button { padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--surface); }
.featured button:nth-child(1) { grid-row: span 2; }
.featured button:nth-child(5) { grid-column: span 2; }
.featured img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.featured button:hover img { transform: scale(1.04); }
@media (max-width: 899px) {
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .featured { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 90px; }
}
@media (max-width: 600px) { .hero { padding: 28px 0 18px; } .lede { font-size: 15px; margin: 8px 0 14px; } }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(32px, 6vw, 56px); line-height: 1.05; letter-spacing: -0.02em; font-weight: 650; }
h1 img { width: 1em; height: 1em; margin-right: 0.28em; vertical-align: -0.14em; }
.lede { margin: 14px 0 22px; max-width: 560px; color: var(--muted); font-size: 17px; }
.cta { display: inline-block; padding: 10px 18px; border-radius: 999px; background: var(--accent); color: #111;
  text-decoration: none; font-weight: 600; font-size: 14px; }
.cta:hover { background: #fff; }

.toolbar { position: sticky; top: 0; z-index: 5; padding: 12px 0 10px;
  background: rgb(12 12 14 / 0.86); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.toolbar .wrap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.chips-row { margin-top: 10px; justify-content: space-between; }

button { font: inherit; color: var(--text); cursor: pointer; }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.segmented button { border: 0; background: none; padding: 6px 14px; border-radius: 7px; font-size: 14px; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--raised); color: var(--text); }
#search { flex: 1 1 200px; max-width: 360px; margin-left: auto; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
#search:focus { outline: 2px solid #555; outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
/* A phone has no room for two rows of chips, so they scroll, and the faded edge shows there is more. */
@media (max-width: 759px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-right: 32px;
    mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); }
  .chips::-webkit-scrollbar { display: none; }
}
.chips button { flex: none; border: 1px solid var(--line); background: none; padding: 4px 12px;
  border-radius: 999px; font-size: 13px; color: var(--muted); }
.chips button[aria-pressed="true"] { border-color: var(--text); color: var(--text); }

#count { color: var(--muted); font-size: 13px; margin: 18px 0 12px; }
#grid { columns: 2 150px; column-gap: 10px; }
@media (min-width: 760px) { #grid { columns: 4 240px; column-gap: 14px; } }
.card { break-inside: avoid; display: block; width: 100%; margin: 0 0 10px; padding: 0; border: 0;
  border-radius: var(--radius); overflow: hidden; background: var(--surface); position: relative; }
@media (min-width: 760px) { .card { margin-bottom: 14px; } }
.card img { display: block; width: 100%; height: auto; transition: transform 0.3s ease, opacity 0.3s; }
.card:hover img { transform: scale(1.025); }
.card .caption { position: absolute; inset: auto 0 0 0; padding: 28px 12px 10px; text-align: left; font-size: 13px;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.75)); opacity: 0; transition: opacity 0.2s; }
.card:hover .caption, .card:focus-visible .caption { opacity: 1; }
@media (hover: none) { .card .caption { opacity: 1; } }
.flag { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 999px; font-size: 11px;
  font-weight: 600; color: #111; vertical-align: 1px; }
.flag.partial { background: var(--warn); } .flag.fails { background: var(--miss); }

footer { padding: 40px 20px 56px; color: var(--muted); font-size: 13px; }

dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--bg); color: var(--text); }
dialog::backdrop { background: rgb(0 0 0 / 0.85); }
.detail { display: flex; flex-direction: column; height: 100%; overflow: auto; }
figure { margin: 0; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: #000; padding: 12px; }
figure img { display: block; max-width: 100%; max-height: 62dvh; height: auto; border-radius: 6px; }
aside { padding: 0 20px 28px; }
.detail-bar { position: sticky; top: 0; display: flex; gap: 8px; justify-content: flex-end; padding: 12px 0;
  background: var(--bg); }
.detail-bar button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 17px; }
.detail-bar button:hover { background: var(--raised); }
#detail-text h2 { margin: 0 0 6px; font-size: 20px; font-weight: 620; letter-spacing: -0.01em; }
#detail-text .note { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.prompt-box { position: relative; margin: 16px 0 20px; padding: 14px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.copy { float: right; margin: -4px -4px 6px 10px; border: 1px solid var(--line); background: var(--raised);
  border-radius: 7px; padding: 3px 10px; font-size: 12px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.refs { display: flex; gap: 8px; flex-wrap: wrap; }
.refs img { height: 88px; width: auto; border-radius: 6px; display: block; }
@media (min-width: 1000px) {
  .detail { flex-direction: row; overflow: hidden; }
  figure { flex: 1 1 auto; padding: 24px; }
  figure img { max-height: calc(100dvh - 48px); }
  aside { flex: 0 0 420px; overflow: auto; border-left: 1px solid var(--line); }
}
