/* IBM Plex Sans Arabic 1.005, the unmodified WOFF2 files of IBM's @ibm/plex-sans-arabic 1.1.0
   (SIL OFL 1.1, Reserved Font Name "Plex"; fonts/OFL.txt). */
@font-face { font-family: "Plex Arabic"; src: url("fonts/IBMPlexSansArabic-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url("fonts/IBMPlexSansArabic-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --bg: #ffffff; --surface: #f5f5f7; --card: #ffffff; --ink: #0b0b0d; --muted: #5f5f6b; --line: #e4e3ec;
  --accent: #4f46e5; --accent-ink: #ffffff; --accent-wash: #efeeff;
  --sub: #fdf0d5; --sub-line: #b26a00; --del: #ffe1e6; --del-line: #c9324c; --ins: #dcecff; --ins-line: #1d5fbf;
  --ok: #087a63; --focus: #6366f1; --bar: #4f46e5; --bar-hover: #3f37c9; --whisker: #2d2d36; --grid: #e4e3ec; --ref: #8a8a96;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Plex Arabic", system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", "Geeza Pro", Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e12; --surface: #15151b; --card: #1a1a21; --ink: #ececf1; --muted: #a3a3b2; --line: #2c2c37;
    --accent: #8b85ff; --accent-ink: #0e0e12; --accent-wash: #24224a;
    --sub: #4a3a12; --sub-line: #f0b24a; --del: #4d1d27; --del-line: #ff7b93; --ins: #15304f; --ins-line: #7ab4ff;
    --ok: #4fd1ae; --focus: #8b85ff; --bar: #7c74f5; --bar-hover: #9a94ff; --whisker: #d6d6df; --grid: #2c2c37; --ref: #8a8a96;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e12; --surface: #15151b; --card: #1a1a21; --ink: #ececf1; --muted: #a3a3b2; --line: #2c2c37;
  --accent: #8b85ff; --accent-ink: #0e0e12; --accent-wash: #24224a;
  --sub: #4a3a12; --sub-line: #f0b24a; --del: #4d1d27; --del-line: #ff7b93; --ins: #15304f; --ins-line: #7ab4ff;
  --ok: #4fd1ae; --focus: #8b85ff; --bar: #7c74f5; --bar-hover: #9a94ff; --whisker: #d6d6df; --grid: #2c2c37; --ref: #8a8a96;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 400 16px/1.6 var(--sans); overflow-x: hidden; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: .95rem; color: var(--muted); }
p { margin: .4rem 0; }
a { color: var(--accent); }
code, pre { font-family: var(--mono); }
code { unicode-bidi: isolate; font-size: .85em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; inset-inline-start: 1rem; top: -3rem; background: var(--card); padding: .5rem 1rem; border-radius: 8px; z-index: 10; }
.skip:focus { top: .5rem; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-weight: 600; }
.mark { width: 28px; height: 28px; }
.mark-ink { fill: var(--ink); }
.mark-accent { fill: var(--accent); }
.lang { font: inherit; font-size: .9rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: .3rem .9rem; cursor: pointer; }

.intro { padding: 1.6rem 0 1rem; max-width: 860px; }
.lede { font-size: 1.05rem; }
.note { color: var(--muted); font-size: .88rem; }
.lbl { color: var(--muted); font-size: .9rem; }
h3 { font-size: .95rem; color: var(--muted); margin-top: 1rem; }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.tile .k { color: var(--muted); font-size: .85rem; margin: 0; }
.tile .v { font-size: 2rem; font-weight: 600; line-height: 1.2; margin: .2rem 0; }
.tile .s { color: var(--muted); font-size: .85rem; margin: 0; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin: 0 0 16px; }
select { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .35rem .5rem; max-width: 100%; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; min-width: 0; position: relative; }
.chart { width: 100%; margin-top: .6rem; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--sans); font-size: 12px; fill: var(--muted); }
.chart .name { fill: var(--ink); font-size: 13px; }
.chart .val { fill: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .ref { stroke: var(--ref); stroke-width: 1; }
.chart .bar { fill: var(--bar); }
.chart .whisker { stroke: var(--whisker); stroke-width: 1.5; }
.chart .hit { fill: transparent; cursor: default; }
.chart g.row:hover .bar, .chart g.row:focus .bar { fill: var(--bar-hover); }
.chart g.row:focus { outline: none; }
.chart g.row:focus .hit { stroke: var(--focus); stroke-width: 2; }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: .45rem .6rem; font-size: .85rem; box-shadow: 0 4px 16px rgba(0,0,0,.12); max-width: 280px; }
.tip strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.tip .k { display: inline-block; width: 12px; height: 2px; background: var(--bar); vertical-align: middle; margin-inline-end: .35rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
thead th { background: var(--surface); font-weight: 600; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
thead th { vertical-align: bottom; }
th.num { white-space: normal; min-width: 5.5rem; }
#board-table td:first-child { min-width: 11rem; }
#cost-table td:first-child { min-width: 9.5rem; }
th button { font: inherit; font-weight: 600; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
th button::after { content: ""; display: inline-block; width: 1em; color: var(--muted); }
th[aria-sort="ascending"] button::after { content: " \2191"; }
th[aria-sort="descending"] button::after { content: " \2193"; }
td .t { display: block; font-size: .8rem; color: var(--muted); }
td .tname { font-weight: 600; white-space: nowrap; }
.pass { color: var(--ok); }
.plain { padding-inline-start: 1.1rem; margin: .3rem 0; }
.plain li { margin: .3rem 0; }
.plain .t { color: var(--muted); }
.how ul { padding-inline-start: 1.2rem; margin: .3rem 0; }
.how li { margin: .3rem 0; }
.cta { background: var(--accent-wash); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 24px; }
.cite code { display: block; white-space: normal; overflow-wrap: anywhere; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; font-size: .85rem; }
.foot { border-top: 1px solid var(--line); background: var(--card); padding: 1rem 0 1.4rem; font-size: .9rem; }
.foot-row p { margin: .3rem 0; }
.links { display: flex; flex-wrap: wrap; gap: 1rem; }
.fine { color: var(--muted); font-size: .8rem; }
[hidden] { display: none !important; }

@media (max-width: 720px) {
  #board-table th:nth-child(3), #board-table td:nth-child(3),
  #board-table th:nth-child(5), #board-table td:nth-child(5),
  #board-table th:nth-child(6), #board-table td:nth-child(6),
  #board-table th:nth-child(7), #board-table td:nth-child(7) { display: none; }
  #board-table td:first-child { min-width: 8rem; }
  .tiles { grid-template-columns: 1fr; gap: 10px; }
  .tile .v { font-size: 1.6rem; }
  .card { padding: 14px; }
  th, td { padding: .4rem .45rem; }
  table { font-size: .84rem; }
}
@media (forced-colors: active) {
  .chart .bar { fill: CanvasText; }
  .chart .whisker, .chart .ref, .chart .gridline { stroke: CanvasText; }
}
