/* The status page (status.html), on the bridge-craftwork tokens in
   ../styles.css. Status colours are tokens too, with a dark set; every
   status also has a glyph, so colour is never the only signal. */

:root {
  --st-good: #0F6E56;   --st-good-bg: #E1F5EE;
  --st-fair: #92400E;   --st-fair-bg: #FEF3C7;
  --st-poor: #991B1B;   --st-poor-bg: #FEE2E2;
  --st-gain: #047857;   --st-gain-bg: #D1FAE5;
  --st-neutral: #475569; --st-neutral-bg: #E2E8F0;
  --st-lose: #B91C1C;   --st-lose-bg: #FEE2E2;
  --st-tested: #185FA5; --st-tested-bg: #E6F1FB;
  --st-partial: #6D28D9; --st-partial-bg: #EDE9FE;
  --st-gap: #6b7280;    --st-gap-bg: transparent;
  --accent: #334155;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-text-primary: #e5e7eb; --color-text-secondary: #9ca3af; --color-text-tertiary: #6b7280;
    --color-background-primary: #1f2329; --color-background-secondary: #2a2f37; --color-background-tertiary: #15181d;
    --color-border-tertiary: rgba(255,255,255,.10); --color-border-secondary: rgba(255,255,255,.20); --color-border-primary: rgba(255,255,255,.35);
    --color-text-info: #7cb4ef;
    --st-good: #5fd3a8;   --st-good-bg: #12392e;
    --st-fair: #f3c564;   --st-fair-bg: #3d3011;
    --st-poor: #f69a9a;   --st-poor-bg: #44191b;
    --st-gain: #6ee7b7;   --st-gain-bg: #0f3a2c;
    --st-neutral: #b6c2d2; --st-neutral-bg: #2c3440;
    --st-lose: #fca5a5;   --st-lose-bg: #47191b;
    --st-tested: #8cc0f5; --st-tested-bg: #172c44;
    --st-partial: #c4b5fd; --st-partial-bg: #2c2346;
    --st-gap: #8b93a1;
    --accent: #cbd5e1;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --color-text-primary: #e5e7eb; --color-text-secondary: #9ca3af; --color-text-tertiary: #6b7280;
  --color-background-primary: #1f2329; --color-background-secondary: #2a2f37; --color-background-tertiary: #15181d;
  --color-border-tertiary: rgba(255,255,255,.10); --color-border-secondary: rgba(255,255,255,.20); --color-border-primary: rgba(255,255,255,.35);
  --color-text-info: #7cb4ef;
  --st-good: #5fd3a8;   --st-good-bg: #12392e;
  --st-fair: #f3c564;   --st-fair-bg: #3d3011;
  --st-poor: #f69a9a;   --st-poor-bg: #44191b;
  --st-gain: #6ee7b7;   --st-gain-bg: #0f3a2c;
  --st-neutral: #b6c2d2; --st-neutral-bg: #2c3440;
  --st-lose: #fca5a5;   --st-lose-bg: #47191b;
  --st-tested: #8cc0f5; --st-tested-bg: #172c44;
  --st-partial: #c4b5fd; --st-partial-bg: #2c2346;
  --st-gap: #8b93a1;
  --accent: #cbd5e1;
  color-scheme: dark;
}

body { line-height: 1.45; font-size: 15px; background: var(--color-background-tertiary); color: var(--color-text-primary); }
a { color: var(--color-text-info); }
code { font-family: var(--font-mono); font-size: .85em; }
button, select, input { font: inherit; color: inherit; }

.top { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem .5rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; }
.top h1 { font-size: 1.4rem; font-weight: 600; }
.top h1 .home { color: inherit; text-decoration: none; }
.top h1 .sub { font-weight: 400; color: var(--color-text-secondary); }
.tagline { color: var(--color-text-secondary); flex: 1 1 20rem; }
.top nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.foot { max-width: 1200px; margin: 0 auto; padding: 1rem; color: var(--color-text-secondary); font-size: .85rem; }

.status { max-width: 1200px; margin: 0 auto; padding: 0 1rem; display: grid; gap: .75rem; grid-template-columns: minmax(0, 1fr); }
.panel { background: var(--color-background-primary); border-radius: var(--border-radius-lg); padding: .75rem 1rem; border: 1px solid var(--color-border-tertiary); }
.wrapish { max-width: 1200px; margin: 0 auto 1rem; }
.hint { font-size: .8rem; color: var(--color-text-secondary); margin-top: .35rem; }

/* Summary */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: .5rem 1rem; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: .78rem; color: var(--color-text-secondary); }

/* Legend and tools */
.tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem 1rem; }
.tools label { font-size: .82rem; color: var(--color-text-secondary); }
.tools .search { flex: 1 1 14rem; }
.tools input[type=search], .tools select { display: block; width: 100%; margin-top: .15rem; padding: .3rem .5rem;
  border: 1px solid var(--color-border-secondary); border-radius: var(--border-radius-md); background: var(--color-background-primary); color: var(--color-text-primary); }
.tools .narrow { flex: 0 1 13rem; }
.tools .check { display: flex; gap: .35rem; align-items: center; padding-bottom: .35rem; }
.legend-list { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .6rem; }
.legend-item { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem .15rem .3rem; font-size: .8rem;
  border: 1px solid var(--color-border-tertiary); border-radius: 999px; background: var(--color-background-secondary); cursor: pointer; }
.legend-item:hover { border-color: var(--color-border-primary); }
.legend-item.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.legend-item .n { color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }

.how { margin-top: .45rem; }
.how summary { font-size: .8rem; color: var(--color-text-secondary); cursor: pointer; }

/* Glyphs and colours by status */
.glyph { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%; font-size: .78rem; font-weight: 700; line-height: 1; flex: none; }
.st-conv-good { --c: var(--st-good);    --bg: var(--st-good-bg); }
.st-conv-fair { --c: var(--st-fair);    --bg: var(--st-fair-bg); }
.st-conv-poor { --c: var(--st-poor);    --bg: var(--st-poor-bg); }
.st-bba-good  { --c: var(--st-good);    --bg: var(--st-good-bg); }
.st-bba-fair  { --c: var(--st-fair);    --bg: var(--st-fair-bg); }
.st-bba-poor  { --c: var(--st-poor);    --bg: var(--st-poor-bg); }
.st-ab-gains  { --c: var(--st-gain);    --bg: var(--st-gain-bg); }
.st-ab-neutral{ --c: var(--st-neutral); --bg: var(--st-neutral-bg); }
.st-ab-loses  { --c: var(--st-lose);    --bg: var(--st-lose-bg); }
.st-tested    { --c: var(--st-tested);  --bg: var(--st-tested-bg); }
.st-partial   { --c: var(--st-partial); --bg: var(--st-partial-bg); }
.st-gap       { --c: var(--st-gap);     --bg: var(--st-gap-bg); }
.glyph { color: var(--c); background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--c); }
.glyph.st-gap { box-shadow: inset 0 0 0 1.5px var(--c); background: none; }
.glyph[class*="st-conv-"] { font-size: .66rem; }
/* The background beside a convention score: a smaller square, so shape
   and glyph tell it from the convention's round mark. */
.bgmark { display: inline-grid; place-items: center; width: .95rem; height: .95rem; border-radius: 3px; font-size: .62rem; font-weight: 700;
  line-height: 1; flex: none; color: var(--c); background: var(--bg); box-shadow: inset 0 0 0 1.25px var(--c); }
.how .hint p + p { margin-top: .35rem; }

/* Sections */
.sec { background: var(--color-background-primary); border-radius: var(--border-radius-lg); padding: .6rem .75rem .75rem; border: 1px solid var(--color-border-tertiary); min-width: 0; }
.sechead { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; margin-bottom: .4rem; }
.sechead h2 { font-size: .95rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-secondary); }
.sechead .count { font-size: .8rem; color: var(--color-text-tertiary); }
.bar { display: flex; flex: 1 1 8rem; max-width: 22rem; height: .45rem; border-radius: 999px; overflow: hidden; background: var(--color-background-secondary); }
.bar .seg { background: var(--c); min-width: 2px; }
.bar .seg.st-gap { background: repeating-linear-gradient(135deg, var(--c) 0 2px, transparent 2px 4px); }
.band { font-size: .78rem; font-weight: 600; color: var(--color-text-secondary); margin: .55rem 0 .3rem; }

.tiles { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: .35rem; }
@media (max-width: 480px) { .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.tile { width: 100%; height: 100%; text-align: left; display: flex; flex-direction: column; gap: .3rem; padding: .35rem .5rem .4rem;
  border: 1px solid var(--color-border-tertiary); border-left: 4px solid var(--c); border-radius: var(--border-radius-md);
  background: var(--color-background-primary); cursor: pointer; min-width: 0; }
.tile.st-gap { border-left-style: dashed; background: none; }
.tile:hover { border-color: var(--color-border-primary); border-left-color: var(--c); }
.tile:focus-visible, .legend-item:focus-visible, .close:focus-visible { outline: 2px solid var(--color-text-info); outline-offset: 2px; }
.row1 { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.row1 .name { flex: 1; font-size: .88rem; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.tile.st-gap .name { color: var(--color-text-secondary); }
.lvl { font-size: .7rem; color: var(--color-text-secondary); border: 1px solid var(--color-border-tertiary); border-radius: 4px; padding: 0 .25rem; font-variant-numeric: tabular-nums; }
.dots { display: flex; flex-wrap: wrap; gap: 3px; padding-left: 1.65rem; }
.dot { width: .6rem; height: .6rem; border-radius: 2px; background: var(--c); }
.dot.st-gap { background: none; box-shadow: inset 0 0 0 1.5px var(--c); }
.dot.st-partial { background: linear-gradient(90deg, var(--c) 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px var(--c); }
.dots .more { font-size: .65rem; color: var(--color-text-secondary); line-height: .6rem; }
.empty { color: var(--color-text-secondary); }

/* Details dialog */
dialog { margin: auto; border: 1px solid var(--color-border-secondary); border-radius: var(--border-radius-lg); padding: 0; width: min(46rem, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem); background: var(--color-background-primary); color: var(--color-text-primary); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.dhead { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem 1rem;
  background: var(--color-background-primary); border-bottom: 1px solid var(--color-border-tertiary); }
.dhead h2 { font-size: 1.1rem; font-weight: 600; }
.close { border: 1px solid var(--color-border-secondary); background: var(--color-background-secondary); border-radius: var(--border-radius-md);
  width: 2rem; height: 2rem; font-size: 1.2rem; line-height: 1; cursor: pointer; flex: none; }
#detail-body { padding: .6rem 1rem 1rem; font-size: .9rem; }
#detail-body > * + * { margin-top: .45rem; }
#detail-body h3 { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-secondary); margin-top: .9rem; }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .4rem .55rem; border-radius: var(--border-radius-md); background: var(--bg); }
.status-line.st-gap { background: var(--color-background-secondary); }
.note { padding: .4rem .55rem; border-radius: var(--border-radius-md); background: var(--st-partial-bg); }
.plain { list-style: none; }
.plain li + li { margin-top: .2rem; }
.tscroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.dt { border-collapse: collapse; width: 100%; font-size: .82rem; }
table.dt th, table.dt td { text-align: left; vertical-align: top; padding: .2rem .4rem; border-bottom: 1px solid var(--color-border-tertiary); }
table.dt th { font-weight: 500; color: var(--color-text-secondary); white-space: nowrap; }
table.dt .why { color: var(--color-text-secondary); }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .45rem; }
.pcell { display: flex; flex-direction: column; gap: .1rem; padding: .45rem .6rem; border-radius: var(--border-radius-md);
  background: var(--bg, var(--color-background-secondary)); border-left: 3px solid var(--c, var(--color-border-secondary)); min-width: 0; }
.pcell .plabel { display: flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--color-text-secondary); }
.pcell .big { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.pcell .unit { font-size: .78rem; color: var(--color-text-secondary); margin-top: -.15rem; }
.pcell .pline { font-size: .8rem; overflow-wrap: anywhere; }
.stcell { white-space: nowrap; }
@media (max-width: 560px) {
  dialog { width: 100vw; max-width: 100vw; max-height: 85vh; margin: auto 0 0; border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0; }
}
