/* Lahser Dynasty. One stylesheet, light and dark, mobile first.
   Colors are roles, defined once here and redefined for dark mode. */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede7;
  --ink: #17171a;
  --ink-2: #45454d;
  --muted: #74737b;
  --line: #e2dfd7;
  --accent: #1d5bb8;
  --accent-soft: #e6eefb;
  --gold: #8f5b00;
  --gold-soft: #fbf1dc;
  --good: #17703f;
  --good-soft: #e3f3e9;
  --warn: #8f4e00;
  --warn-soft: #fbeedd;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 1px 1px rgba(20, 20, 30, .03);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1012;
    --surface: #18191d;
    --surface-2: #212228;
    --ink: #ecebef;
    --ink-2: #c2c1c9;
    --muted: #8e8d97;
    --line: #2d2e35;
    --accent: #84aefc;
    --accent-soft: #1b2740;
    --gold: #e8b85a;
    --gold-soft: #2e2512;
    --good: #67d297;
    --good-soft: #14291d;
    --warn: #f2a65e;
    --warn-soft: #2e2113;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.55;
  overflow-wrap: break-word;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

strong, .team { font-weight: 650; }
a.team { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
a.team:hover { color: var(--accent); border-bottom-color: var(--accent); }
.was { color: var(--muted); font-size: .85em; font-weight: 400; }
.renamed { margin: -.5rem 0 1.25rem; }
.list.names li { padding: 8px 0; }

.wrap { max-width: 48rem; margin: 0 auto; padding: 0 16px; }

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding-top: 10px; padding-bottom: 10px; }
.brand { font-weight: 750; color: var(--ink); text-decoration: none; letter-spacing: -.01em; margin-right: auto; white-space: nowrap; }
.brand span { margin-right: 6px; }
.ico { margin-right: .4em; }
.nav { display: flex; gap: 2px; margin: 0 -8px; padding: 0; list-style: none; }
.nav a {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: .95rem;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 650; background: var(--surface-2); }

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

main { padding: 24px 0 8px; }

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.015em; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 750; }
h2 { font-size: 1.2rem; font-weight: 700; margin-top: 2rem; margin-bottom: .6rem; }
h3 { font-size: 1.02rem; font-weight: 700; margin-top: 1.4rem; margin-bottom: .4rem; }

.page-head { margin-bottom: 1.25rem; }
.page-head p { margin: .35rem 0 0; color: var(--muted); }
.page-head p strong { color: var(--ink-2); }
.eyebrow { font-size: .8rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 .3rem; }

.prose p, .prose ul, .prose ol { margin: 0 0 .9rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: .25rem 0; }
.prose > p:first-child { font-size: 1.05rem; color: var(--ink-2); }

.section { margin-top: 2rem; }
.section > h2:first-child { margin-top: 0; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card h2, .card h3 { margin-top: 0; }

.lead {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 1.08rem;
  margin: 0 0 1.25rem;
}

.stat-cards { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 0 0 .5rem; }
@media (min-width: 640px) { .stat-cards { grid-template-columns: repeat(3, 1fr); } }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.stat .label { font-size: .78rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 0 0 .35rem; }
.stat .who { margin: 0; }
.stat .figure { margin: .15rem 0 0; font-size: 1.35rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat .sub { margin: .1rem 0 0; color: var(--muted); font-size: .9rem; }
.stat.gold { border-top: 3px solid var(--gold); }
.stat.blue { border-top: 3px solid var(--accent); }
.stat.warn { border-top: 3px solid var(--warn); }

/* ---------------------------------------------------------------- tables */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 0 1rem;
}
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th {
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.r, th.r { text-align: right; }
td.rank { color: var(--muted); width: 2.5rem; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; background: var(--surface-2); }
.wide-cell { min-width: 11rem; }
.chip { display: inline-block; white-space: nowrap; margin-right: 10px; }
.chip:last-child { margin-right: 0; }
@media (max-width: 480px) {
  table { font-size: .9rem; }
  th, td { padding: 8px 7px; }
  th:first-child, td:first-child { padding-left: 10px; }
  th:last-child, td:last-child { padding-right: 10px; }
  thead th { font-size: .68rem; letter-spacing: .03em; }
  td.rank { width: 1.6rem; }
}

/* Narrow screens: rows of a .stack table become labelled blocks. */
@media (max-width: 600px) {
  .stack table, .stack tbody, .stack tr, .stack td { display: block; }
  .stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .stack tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .stack tbody tr:last-child { border-bottom: 0; }
  .stack td, .stack td:first-child, .stack td:last-child { border: 0; padding: 1px 0; text-align: left; min-width: 0; width: auto; }
  .stack td[data-label]::before { content: attr(data-label) "  "; color: var(--muted); font-size: .78rem; font-weight: 650; letter-spacing: .03em; }
  .stack td:empty { display: none; }
}

/* ---------------------------------------------------------------- badges */

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 650;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink-2);
}
.badge.awarded { background: var(--good-soft); color: var(--good); }
.badge.leader { background: var(--accent-soft); color: var(--accent); }
.badge.pending { background: var(--surface-2); color: var(--muted); }
.badge.flag { background: var(--warn-soft); color: var(--warn); }

.note {
  background: var(--warn-soft);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 0 0 1rem;
  font-size: .94rem;
}

/* ---------------------------------------------------------------- lists */

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .meta { font-size: .85rem; color: var(--muted); margin: 0 0 .15rem; }
.list .title { font-weight: 650; }
.list p { margin: .2rem 0 0; color: var(--ink-2); }

.takeaways { margin: 0; padding-left: 1.2rem; }
.takeaways li { margin: .45rem 0; }

.links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.links a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none;
  font-size: .92rem;
}
.links a:hover { border-color: var(--accent); }
.see-also { margin-bottom: 1.25rem; }
.card-lead { margin: .2rem 0 .7rem; }
.amendment-body { margin-top: .75rem; }
.amendment-note { margin: .9rem 0 0; }
.amendment-source { margin: .9rem 0 0; }
.amended { font-size: .85rem; color: var(--muted); margin: -.3rem 0 .8rem; }
.note ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.note p { margin: 0; }

dl.amendment { margin: .75rem 0 0; display: grid; grid-template-columns: 1fr; gap: 2px 16px; }
dl.amendment dt { font-size: .78rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-top: .6rem; }
dl.amendment dd { margin: 0; }
@media (min-width: 640px) {
  dl.amendment { grid-template-columns: 9rem 1fr; }
  dl.amendment dt { margin-top: 0; padding-top: 2px; }
}

/* ---------------------------------------------------------------- charts */

.charts { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .charts { grid-template-columns: 1fr 1fr; } }
figure { margin: 0; }
.charts img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fcfcfb;
}
figcaption { font-size: .85rem; color: var(--muted); margin-top: .35rem; }

/* ---------------------------------------------------------------- details */

details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 16px;
  margin: 1rem 0;
}
summary { cursor: pointer; padding: 12px 0; font-weight: 650; }
details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: .75rem; }
details > :last-child { margin-bottom: 14px; }

/* ---------------------------------------------------------------- parlay */

.parlay {
  margin-top: 2.5rem;
  padding: 16px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
}
.parlay h2 { margin-top: 0; }

/* ---------------------------------------------------------------- pager */

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 2rem; }
.pager a, .pager span {
  flex: 1 1 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
}
.pager span { visibility: hidden; }
.pager .next { text-align: right; }
.pager small { display: block; color: var(--muted); font-size: .78rem; }

/* ---------------------------------------------------------------- figures */

:root { --fig-lead: #1d5bb8; --fig-bar: #8f8c85; }
@media (prefers-color-scheme: dark) { :root { --fig-lead: #3987e5; --fig-bar: #6f6e78; } }

.fig {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 6px;
  margin: 0 0 1rem;
}
.fig figcaption { margin: 0 0 .75rem; color: var(--ink); font-size: 1rem; }
.fig figcaption strong { display: block; }
.fig figcaption span { display: block; color: var(--muted); font-size: .85rem; margin-top: .1rem; }
.barlist { list-style: none; margin: 0; padding: 0; }
.barlist li {
  display: grid;
  grid-template-columns: minmax(0, 11rem) 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
  font-size: .88rem;
}
.bl-name { overflow-wrap: anywhere; line-height: 1.25; }
.bl-rank { display: inline-block; min-width: 1.4em; color: var(--muted); font-variant-numeric: tabular-nums; }
.bl-track { display: block; height: 14px; border-left: 1px solid var(--line); }
.bl-bar { display: block; height: 14px; background: var(--fig-bar); border-radius: 0 4px 4px 0; min-width: 2px; }
.bl-bar.lead { background: var(--fig-lead); }
.bl-val { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 3.5rem; text-align: right; }
.fig-table { border: 0; padding: 0; margin: .5rem 0 0; background: none; }
.fig-table summary { font-size: .85rem; font-weight: 600; color: var(--muted); padding: 6px 0; }
.fig-table[open] summary { border-bottom: 0; margin-bottom: .4rem; }
@media (max-width: 480px) {
  .barlist li {
    grid-template-columns: 1fr auto;
    grid-template-areas: "name val" "track track";
    gap: 3px 10px;
    padding: 5px 0;
  }
  .bl-name { grid-area: name; }
  .bl-val { grid-area: val; min-width: 0; }
  .bl-track { grid-area: track; }
}
@media (forced-colors: active) {
  .bl-bar { background: CanvasText; }
  .bl-bar.lead { background: Highlight; }
}

/* ---------------------------------------------------------------- head to head */

.h2h table { font-size: .82rem; width: auto; min-width: 100%; }
.h2h th, .h2h td { padding: 6px 7px; text-align: center; border-left: 1px solid var(--line); }
.h2h tbody th { text-align: left; white-space: nowrap; font-weight: 400; position: sticky; left: 0; background: var(--surface); z-index: 1; border-left: 0; }
.h2h thead th.corner { text-align: left; vertical-align: bottom; position: sticky; left: 0; z-index: 2; border-left: 0; }
.h2h thead th.vert { vertical-align: bottom; padding: 8px 4px; }
.h2h thead th.vert span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; max-height: 9.5rem; overflow: hidden; text-overflow: ellipsis; display: inline-block; text-transform: none; letter-spacing: 0; font-size: .74rem; }
.h2h td.self { color: var(--muted); background: var(--surface-2); }
.h2h td.total-col { background: var(--surface-2); }
td.win { background: var(--good-soft); color: var(--good); }
td.loss { background: var(--warn-soft); color: var(--warn); }
td.even { background: var(--surface-2); }
.links a[aria-current="page"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 650; }

/* ---------------------------------------------------------------- grid */

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 24px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------------- footer */

.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 18px 0 32px; color: var(--muted); font-size: .85rem; }
.site-footer p { margin: .25rem 0; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
