/* BitsExplorer stylesheet.
 *
 * Served as a file rather than inlined, because the content security policy
 * allows styles only from our own origin. Adding 'unsafe-inline' would have
 * been the quick fix and the wrong one on a site that publishes header quality
 * checks on other people's work. */

:root {
  color-scheme: light dark;
  --bg: #fbfbfa;
  --surface: #ffffff;
  --fg: #17171a;
  --muted: #6a6a70;
  --faint: #93939a;
  --line: #e4e4e0;
  --accent: #2f5bd7;
  --ok: #1f7a4d;
  --warn: #9a6b00;
  --bad: #a32b2b;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131316;
    --surface: #1b1b20;
    --fg: #ededea;
    --muted: #9c9ca4;
    --faint: #75757d;
    --line: #2b2b32;
    --accent: #8ba7f5;
    --ok: #5fd19a;
    --warn: #e0b45c;
    --bad: #f08a8a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 66rem; margin: 0 auto; padding: 0 1.5rem; }

/* ---------- site chrome ---------- */

header.site {
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
  margin-bottom: 2.5rem;
  background: var(--surface);
}
header.site .wrap { display: flex; align-items: baseline; gap: 1.5rem; flex-wrap: wrap; }
header.site .brand { font-weight: 650; letter-spacing: -.02em; color: var(--fg); font-size: 1.05rem; }
header.site nav { display: flex; gap: 1.1rem; font-size: .9rem; }
header.site nav a { color: var(--muted); }
header.site nav a:hover { color: var(--fg); }

footer.site {
  margin: 4rem 0 0;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: .82rem;
}

h1 { font-size: 1.8rem; line-height: 1.2; letter-spacing: -.025em; margin: 0 0 .4rem; }
.lede { color: var(--muted); margin: 0 0 2rem; }

/* ---------- feed ---------- */

.filters { display: flex; gap: .45rem; flex-wrap: wrap; margin: 0 0 1.75rem; }
.filters a {
  font-size: .85rem; padding: .28rem .7rem; border: 1px solid var(--line);
  border-radius: 99px; color: var(--muted); background: var(--surface);
}
.filters a:hover { text-decoration: none; color: var(--fg); }
.filters a[aria-current="true"] { color: var(--bg); background: var(--fg); border-color: var(--fg); }

.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Each medium keeps its own shape. One generic row for everything is what the
   plan warns would make a cross-medium feed feel like a spreadsheet.

   Keyed on what the image is, not what medium it came from. An item can carry
   an icon or a screenshot whatever its platform, and giving a tall screenshot
   the icon treatment produces a small letterboxed smudge with rounded corners,
   which is exactly what happened once app screenshots started arriving. */
.card .shot { display: block; aspect-ratio: 16 / 10; background: var(--bg);
              border-bottom: 1px solid var(--line); overflow: hidden; }
.card .shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }

.card.shot-icon .shot { display: grid; place-items: center; padding: 1.1rem; }
.card.shot-icon .shot img {
  width: auto; height: auto; max-height: 6.5rem; border-radius: 22%;
  object-fit: contain; box-shadow: 0 2px 12px rgb(0 0 0 / .16);
}

/* A portrait screenshot in a landscape card shows its top rather than being
   squeezed. The interesting part of a phone screenshot is the top of it. */
.card.shot-screenshot .shot img { object-fit: cover; object-position: top center; }

.card .noshot {
  aspect-ratio: 16 / 10; display: grid; place-items: center;
  color: var(--faint); font-size: .8rem; background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.card .body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card h2 { font-size: 1rem; margin: 0; line-height: 1.35; letter-spacing: -.01em; }
.card h2 a { color: var(--fg); }
.card p {
  margin: 0; color: var(--muted); font-size: .88rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card .meta {
  margin-top: auto; padding-top: .6rem; color: var(--faint); font-size: .78rem;
  display: flex; gap: .45rem; align-items: center; flex-wrap: wrap;
}

.tag {
  display: inline-block; padding: .06rem .42rem; border: 1px solid var(--line);
  border-radius: 99px; font-size: .72rem; color: var(--muted);
}

.empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 3rem 1.5rem; text-align: center; color: var(--muted);
}

.pager { display: flex; gap: 1.25rem; margin-top: 2.5rem; font-size: .9rem; }

/* ---------- item page ---------- */

.item { display: grid; gap: 2.5rem; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 54rem) { .item { grid-template-columns: 1fr; gap: 1.75rem; } }

.hero { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.hero img { display: block; width: 100%; height: auto; }
.hero.icon { display: grid; place-items: center; padding: 2.25rem; }
.hero.icon img { width: 8rem; height: 8rem; border-radius: 22%; box-shadow: 0 3px 18px rgb(0 0 0 / .18); }

.thumbs { display: flex; gap: .6rem; margin-top: .8rem; overflow-x: auto; padding-bottom: .4rem; }
.thumbs img { height: 8rem; width: auto; border: 1px solid var(--line); border-radius: 6px; }

.item h1 { margin-top: 1.75rem; }

.facts { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1.1rem 1.2rem; }
.facts + .facts { margin-top: 1.1rem; }
.facts h2 {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--faint); margin: 0 0 .8rem; font-weight: 600;
}
.facts dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .5rem .9rem; font-size: .88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.cta {
  display: inline-block; margin-top: 1.4rem; padding: .58rem 1.15rem; border-radius: 8px;
  background: var(--fg); color: var(--bg); font-weight: 550; font-size: .92rem;
}
.cta:hover { text-decoration: none; opacity: .88; }
.cta.secondary { background: transparent; color: var(--fg); border: 1px solid var(--line); margin-left: .45rem; }

.prose { font-size: 1rem; margin: 1.25rem 0 0; }
.source-note { margin-top: .7rem; color: var(--faint); font-size: .8rem; }
.evidence { color: var(--faint); font-size: .76rem; margin-top: .15rem; }

.changes { margin: 0; padding: 0; list-style: none; font-size: .85rem; }
.changes li {
  display: flex; justify-content: space-between; gap: 1rem; padding: .32rem 0;
  border-bottom: 1px solid var(--line); color: var(--muted);
}
.changes li:last-child { border-bottom: 0; }

/* ---------- status page ---------- */

.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem 1.5rem; }
.totals div { border-top: 1px solid var(--line); padding-top: .5rem; }
.totals dt { color: var(--muted); font-size: .8rem; }
.totals dd { margin: .15rem 0 0; font-size: 1.35rem; font-variant-numeric: tabular-nums; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .8rem .55rem 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 500; color: var(--muted); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.ok { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }

h2.section { font-size: 1rem; font-weight: 600; margin: 2.4rem 0 .7rem; }

.lede.tight { margin-bottom: 0; }
.faint { color: var(--faint); }

/* ---------- the wheel ---------- */

.spinhead { text-align: center; max-width: 34rem; margin: 0 auto 2.5rem; }
.spinhead .filters { justify-content: center; }
.spinhead .lede { margin-bottom: 1.5rem; }

.cta.big { font-size: 1.05rem; padding: .8rem 2.4rem; border-radius: 99px; margin-top: .25rem; }

.result {
  max-width: 44rem; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.result .hero { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.result .hero.icon { padding: 2.5rem; }
.result-body { padding: 1.4rem 1.5rem 1.7rem; }
.result-body h2 { margin: 0 0 .35rem; font-size: 1.3rem; letter-spacing: -.02em; }
.result-body h2 a { color: var(--fg); }
.result-body .meta {
  color: var(--faint); font-size: .82rem; margin: .7rem 0 0;
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
}

.reset-line { text-align: center; margin-top: 1.25rem; }

/* ---------- forms and admin ---------- */

.wrap.narrow { max-width: 30rem; }

.stack { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.5rem; }
.stack label { font-size: .85rem; color: var(--muted); margin-top: .6rem; }
.stack input {
  font: inherit; padding: .55rem .7rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--fg);
}
.stack input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.stack .cta { text-align: center; border: 0; cursor: pointer; font: inherit; font-weight: 550; }
.stack .cta.secondary { margin-left: 0; }
.stack .cta[disabled] { opacity: .5; cursor: default; }

.formnote { color: var(--faint); font-size: .82rem; margin: .5rem 0 0; }
.formerror { color: var(--bad); font-size: .88rem; margin: .75rem 0 0; }

.fallback { margin-top: 1.75rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.fallback summary { cursor: pointer; font-size: .88rem; color: var(--muted); }
.fallback[open] summary { margin-bottom: .5rem; }

/* ---------- the edition ---------- */

.kicker { color: var(--faint); font-size: .82rem; letter-spacing: .04em;
          text-transform: uppercase; margin: 0 0 .3rem; }

.editionstrip { padding-bottom: 2.5rem; margin-bottom: 2.5rem; border-bottom: 1px solid var(--line); }
.editionhead { margin-bottom: 1.75rem; }
.riverhead { margin-top: 0; }

.picks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.pick { display: grid; grid-template-columns: 2rem 11rem 1fr; gap: 1.1rem; align-items: start; }
@media (max-width: 46rem) {
  .pick { grid-template-columns: 1.6rem 1fr; }
  .pick .shot { grid-column: 2; }
  .pick .pickbody { grid-column: 2; }
}

.pick .rank { font-variant-numeric: tabular-nums; color: var(--faint);
              font-size: .95rem; padding-top: .15rem; }
.pick .shot { display: block; border: 1px solid var(--line); border-radius: 8px;
              overflow: hidden; background: var(--surface); aspect-ratio: 16 / 10; }
.pick .shot img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.pick.shot-icon .shot { display: grid; place-items: center; padding: .7rem; }
.pick.shot-icon .shot img { width: auto; height: auto; max-height: 4.4rem; border-radius: 22%;
                            object-fit: contain; box-shadow: 0 2px 8px rgb(0 0 0 / .14); }

.pick h2 { font-size: 1.05rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
.pick h2 a { color: var(--fg); }
.pick .note { margin: 0; color: var(--fg); }
.pick .summary { margin: 0; color: var(--muted); font-size: .9rem; }
.pick .meta { margin-top: .5rem; color: var(--faint); font-size: .78rem;
              display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }

.editionfoot { margin-top: 3rem; }

/* ---------- curation ---------- */

.adminbar { display: flex; justify-content: space-between; align-items: flex-end;
            gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.adminbar form { display: flex; gap: .75rem; align-items: center; }
.adminbar .cta { margin-top: 0; }

.statepill { font-size: .78rem; padding: .15rem .6rem; border-radius: 99px;
             border: 1px solid var(--line); color: var(--muted); }
.statepill.live { color: var(--ok); border-color: var(--ok); }

.curatelist { list-style: none; margin: 0 0 1rem; padding: 0;
              display: flex; flex-direction: column; gap: .75rem; }
.curateitem { display: grid; grid-template-columns: 5rem 1fr auto; gap: 1rem;
              align-items: start; padding: .85rem; background: var(--surface);
              border: 1px solid var(--line); border-radius: var(--radius); }
.curateitem .thumb { width: 5rem; height: 3.2rem; object-fit: cover; border-radius: 6px;
                     border: 1px solid var(--line); }
.curateitem h3 { margin: 0 0 .2rem; font-size: .98rem; }
.curateitem h3 a { color: var(--fg); }
.curateitem .summary { margin: 0; color: var(--muted); font-size: .85rem; }

.noteform { display: flex; gap: .5rem; margin-top: .6rem; }
.noteform input { flex: 1; font: inherit; font-size: .88rem; padding: .4rem .6rem;
                  border: 1px solid var(--line); border-radius: 7px;
                  background: var(--bg); color: var(--fg); }
.cta.small { font-size: .82rem; padding: .35rem .85rem; margin-top: 0; }
.linkbutton { background: none; border: 0; color: var(--muted); cursor: pointer;
              font: inherit; font-size: .82rem; padding: .2rem; }
.linkbutton:hover { color: var(--bad); }

.card .score { font-variant-numeric: tabular-nums; color: var(--fg); font-weight: 600; }
.card .why { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .35rem;
             color: var(--faint); font-size: .7rem; }
.card .why span { border: 1px solid var(--line); border-radius: 99px; padding: 0 .4rem; }
.card form { margin-top: .6rem; }

.introform { display: flex; gap: .5rem; margin: 1.25rem 0 0; }
.introform input { flex: 1; font: inherit; font-size: .9rem; padding: .45rem .7rem;
                   border: 1px solid var(--line); border-radius: 7px;
                   background: var(--surface); color: var(--fg); }

.rowactions { display: flex; flex-direction: column; gap: .2rem; align-items: flex-end; }
.linkbutton.danger:hover { color: var(--bad); }

/* ---------- the hygiene panel ---------- */

.hygiene .nodata { margin: 0 0 .8rem; color: var(--muted); font-size: .85rem; }

.hygienescore { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .9rem; }
.hygienescore .scorenum { font-size: 1.9rem; font-variant-numeric: tabular-nums;
                          letter-spacing: -.03em; }
.hygienescore .scorelabel { color: var(--muted); font-size: .8rem; }

.checklist { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.check { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
         padding: .35rem 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check .checkname { color: var(--fg); }
.check .checkdetail { color: var(--faint); text-align: right; font-size: .8rem; }

/* Deliberately muted. A low score is never styled as a warning: the genuinely
   dangerous case is handled upstream by the blocklist gate, which removes
   rather than grades. */
.check.fail .checkname { color: var(--muted); }
.check.skipped { opacity: .55; }

.checknote { margin: .9rem 0 0; color: var(--faint); font-size: .76rem; line-height: 1.5; }
