/* The Trinkets page (index.html here is written by tools/pages/build.mjs; this file is not).
   It looks as the Mods page does (public/mods/mods.css): the game's colours and frames
   (src/pixel/pixel.css; docs/pixel-style-guide.md), words in the game's regular font, and only
   the pictures in pixels. What it adds is the few lines on how trinkets are offered and the
   filters over the list. */
:root {
  --surface-page: #171b2e;
  --surface-panel: #2b444b;
  --surface-panel-light: #43616a;
  --surface-panel-dark: #1d3037;
  --surface-well: #141829;
  --action-fill: #e6d5ae;
  --action-selected: #ddb555;
  --action-selected-light: #f1d78d;
  --action-selected-dark: #99732e;
  --text-primary: #ece8dc;
  --text-secondary: #aab8d0;
  --text-on-action: #2e2a30;
  --text-gold: #e8d488;
  --focus-ring: #e8d488;
  --frame-outline: #0f1220;
  --font: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--surface-page); scroll-padding-top: 16px; }
body { margin: 0; color: var(--text-primary); background: var(--surface-page); font: 400 16px/24px var(--font); }
h1, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
h1, h3, .brand, .button, .tag, .facts, .label, .chip, .clear, .odds th { font-weight: 600; }
h1 { font-size: 64px; line-height: 72px; }
h3 { font-size: 18px; line-height: 24px; }
a { color: inherit; text-underline-offset: 4px; touch-action: manipulation; }
a:hover { color: var(--focus-ring); }
img { display: block; }
.pixel { image-rendering: pixelated; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 4px; }
.wrap { width: calc(100% - 64px); max-width: 1280px; margin-inline: auto; }

.skip { position: fixed; z-index: 100; top: -120px; left: 16px; background: var(--action-fill); color: var(--text-on-action); padding: 12px; }
.skip:focus { top: 16px; }

.button { display: inline-flex; align-items: center; justify-content: center; position: relative; min-width: 200px; min-height: 56px; padding: 12px 20px; border: 2px solid var(--frame-outline); background: var(--action-selected); color: var(--text-on-action); box-shadow: inset 2px 2px 0 var(--action-selected-light), inset -2px -4px 0 var(--action-selected-dark); font-size: 16px; line-height: 24px; text-decoration: none; }
.button:hover { background: var(--action-selected-light); color: var(--text-on-action); }
.button:active { top: 2px; box-shadow: inset 2px 2px var(--action-selected-dark); }

/* The top: the game's name, the page's, and Play */
.top { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 48px 32px 40px; }
.brand { font-size: 16px; line-height: 24px; }
.top .button { margin-top: 12px; }

/* How trinkets are offered: a few lines, then the tiers each offer draws from */
.about { padding-bottom: 40px; }
.about .wrap { display: grid; gap: 8px; justify-items: center; max-width: 720px; text-align: center; }
.about b { font-weight: 600; color: var(--text-gold); }
.odds { margin-top: 12px; border-collapse: collapse; font-size: 14px; line-height: 20px; font-variant-numeric: tabular-nums; background: var(--surface-well); border: 2px solid var(--frame-outline); }
.odds th, .odds td { padding: 8px 14px; text-align: center; }
.odds th[scope="row"] { text-align: left; color: var(--text-secondary); }
.odds thead th { color: var(--text-gold); border-bottom: 2px solid var(--frame-outline); }
.odds td { min-width: 64px; }

/* The filters: a search, an order, and a row of switches for each thing a trinket can be told by */
.filters { background: var(--surface-well); padding-block: 20px; border-block: 2px solid var(--frame-outline); }
.filters .wrap { display: grid; grid-template-columns: auto minmax(0, 1fr) 160px; grid-template-areas: "search search sort" "tier who who" "mod mod mod" "result result result"; gap: 16px 32px; align-items: end; }
.field-search { grid-area: search; }
.field-sort { grid-area: sort; }
.group-tier { grid-area: tier; }
.group-who { grid-area: who; }
.group-mod { grid-area: mod; }
.result { grid-area: result; }
.field, .group { display: grid; gap: 6px; }
.label { font-size: 13px; line-height: 20px; color: var(--text-secondary); }
.field input, .field select { width: 100%; min-height: 44px; padding: 8px 12px; border: 2px solid var(--surface-panel-light); border-radius: 0; background: var(--surface-page); color: var(--text-primary); font: 400 16px/24px var(--font); }
.field input:hover, .field select:hover { border-color: var(--text-secondary); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border: 2px solid var(--frame-outline); border-radius: 0; background: var(--surface-panel); color: var(--text-primary); box-shadow: inset 2px 2px 0 var(--surface-panel-light), inset -2px -2px 0 var(--surface-panel-dark); font: 600 14px/20px var(--font); cursor: pointer; touch-action: manipulation; }
.chip:hover { background: var(--surface-panel-light); }
.chip[aria-pressed="true"] { background: var(--action-selected); color: var(--text-on-action); box-shadow: inset 2px 2px 0 var(--action-selected-light), inset -2px -2px 0 var(--action-selected-dark); }
.group-tier .chip { min-width: 52px; justify-content: center; }
.result { display: flex; align-items: center; gap: 16px; min-height: 44px; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.clear { min-height: 44px; padding: 6px 4px; border: 0; background: none; color: var(--text-primary); font: 600 14px/20px var(--font); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.clear:hover { color: var(--focus-ring); }

/* The trinkets, each as its offer shows it */
.band { padding-block: 32px 48px; border-bottom: 2px solid var(--frame-outline); }
.trinkets { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.trinket { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 16px; align-items: start; padding: 16px; background: var(--surface-panel); border: 2px solid var(--frame-outline); box-shadow: inset 2px 2px 0 var(--surface-panel-light), inset -2px -2px 0 var(--surface-panel-dark); scroll-margin-top: 16px; }
.trinket:target { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.trinket-text { display: grid; gap: 8px; }
/* A rule, as the offer shows it: its trigger on a tag, then what it does, its numbers picked out */
.tag { display: inline-block; margin-right: 2px; padding: 2px 6px; font-size: 12px; line-height: 16px; white-space: nowrap; vertical-align: 1px; color: var(--text-gold); background: rgba(8, 9, 12, 0.35); }
.rule b { font-weight: 600; color: var(--text-gold); }
.once { color: var(--text-secondary); }
/* What it costs, its tier, what it needs and who it is for */
.facts { display: flex; flex-wrap: wrap; gap: 0 16px; margin-top: 4px; font-size: 13px; line-height: 20px; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.who { display: flex; align-items: center; gap: 4px 6px; color: var(--text-primary); }
.who img:not(:first-child) { margin-left: 8px; }
.none { padding-block: 32px; text-align: center; color: var(--text-secondary); }

.ending { display: grid; gap: 20px; justify-items: center; padding: 32px 16px 48px; }
.ending .button { font-size: 20px; line-height: 28px; min-height: 72px; padding-inline: 32px; }
.ending > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 24px; }

@media (max-width: 767px) {
  h1 { font-size: 48px; line-height: 56px; }
  .wrap { width: calc(100% - 32px); }
  .top { padding: 32px 16px 28px; }
  .about { padding-bottom: 28px; }
  .about .wrap { justify-items: stretch; text-align: left; }
  .odds { width: 100%; }
  .odds th, .odds td { padding: 8px 6px; }
  .odds td { min-width: 0; }
  .filters { padding-block: 16px; }
  .filters .wrap { grid-template-columns: minmax(0, 1fr) 112px; grid-template-areas: "search sort" "tier tier" "who who" "mod mod" "result result"; gap: 12px 12px; }
  .chip { padding-inline: 10px; }
  .band { padding-block: 20px 32px; }
  .trinkets { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .trinket { padding: 12px; gap: 12px; }
  .ending { padding: 24px 16px 32px; }
  .ending .button { font-size: 16px; line-height: 24px; padding-inline: 24px; }
}
@media (prefers-reduced-motion: no-preference) {
  .button { transition: top 80ms steps(2, start); }
}
@media (forced-colors: active) {
  .button, .trinket, .chip { border: 2px solid CanvasText; }
  .chip[aria-pressed="true"] { background: Highlight; color: HighlightText; }
}
