/* Plain CSS, mobile first. No fonts, images or other files are loaded from outside. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #545454;
  --link: #0b57d0;
  --border: #c4c7cc;
  --card: #f5f6f8;
  --focus: #1a73e8;
  --banner-bg: #ffd84d;
  --banner-text: #1a1a1a;
  --stale-bg: #fde7e7;
  --stale-text: #8a1c1c;
  --sample-bg: #e6e6e6;
  --sample-text: #1a1a1a;
  --mark-bg: #fff200;
  --mark-text: #000000;
  --mark-outline: #d00000;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --text: #ececec;
    --muted: #b4b7bd;
    --link: #8ab4f8;
    --border: #444851;
    --card: #1b1d22;
    --focus: #ffd84d;
    --stale-bg: #3b1616;
    --stale-text: #ffb8b8;
    --sample-bg: #34373d;
    --sample-text: #ececec;
    --mark-outline: #ff6b6b;
  }
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--link);
}

h1, h2 {
  line-height: 1.25;
}

h1 {
  font-size: 1.6rem;
  margin: 1rem 0 0.5rem;
}

h2 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.5rem;
}

/* Keyboard focus is always visible. */
a:focus-visible,
button:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 2px solid var(--focus);
  z-index: 10;
}

.skip-link:focus {
  top: 0.5rem;
}

.sample-banner {
  background: var(--banner-bg);
  color: var(--banner-text);
  font-weight: 700;
  text-align: center;
  padding: 0.5rem 1rem;
  border-bottom: 2px solid var(--banner-text);
}

.site-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.site-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.site-header nav ul {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

main {
  padding: 0 1rem 1.5rem;
  max-width: 100%;
}

.intro,
.count {
  max-width: 45rem;
}

.count,
.muted,
.note,
.verified {
  color: var(--muted);
}

.note {
  display: block;
  font-size: 0.875rem;
}

.back {
  margin: 1rem 0 0;
}

.site-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  max-width: 45rem;
  margin: 0.25rem 0;
}

/* Badges are text, so they do not depend on colour alone. */
.badge {
  display: inline-block;
  padding: 0 0.4rem;
  border: 1px solid currentColor;
  border-radius: 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-stale {
  background: var(--stale-bg);
  color: var(--stale-text);
}

.badge-sample {
  background: var(--sample-bg);
  color: var(--sample-text);
}

.unknown {
  font-style: italic;
  color: var(--muted);
}

/* Draft sentences are meant to be hard to miss. */
.placeholder {
  background: var(--mark-bg);
  color: var(--mark-text);
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  outline: 2px dashed var(--mark-outline);
  outline-offset: 1px;
  margin-right: 0.25rem;
}

.sources {
  list-style: none;
  margin: 0;
  padding: 0;
}

.detail-link {
  display: block;
  font-size: 0.875rem;
}

.verified {
  display: block;
  font-size: 0.875rem;
}

/* Sort menu: shown on narrow screens only, where the table is a list of cards. */
.sort-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.sort-controls select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.35rem 0.5rem;
}

/* Comparison table and fact tables: stacked cards by default. */
.table-wrap {
  margin: 1rem 0;
}

table.plans,
table.facts {
  width: 100%;
  border-collapse: collapse;
}

table.plans thead,
table.facts thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

table.plans tbody,
table.facts tbody,
table.plans tr,
table.facts tr,
table.plans td,
table.facts td,
table.facts tbody th {
  display: block;
}

table.plans tr,
table.facts tr {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

table.plans td,
table.facts td,
table.facts tbody th {
  padding: 0.3rem 0;
  text-align: left;
  font-weight: 400;
}

table.plans td + td,
table.facts td,
table.facts tbody th + td {
  border-top: 1px solid var(--border);
}

table.plans td::before,
table.facts td::before,
table.facts tbody th::before {
  content: attr(data-label);
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

table.facts tbody th {
  font-weight: 700;
}

.plan {
  margin-top: 1.5rem;
  scroll-margin-top: 1rem;
}

.plan-link {
  max-width: 45rem;
}

.affiliate-notice {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Sort buttons are added by script, so the table also works without it. */
.sort-btn {
  font: inherit;
  font-weight: 700;
  color: inherit;
  background: none;
  border: 0;
  padding: 0.25rem 0;
  cursor: pointer;
  text-align: left;
}

th[aria-sort="ascending"] .sort-btn::after {
  content: " \25B2";
}

th[aria-sort="descending"] .sort-btn::after {
  content: " \25BC";
}

/* Wide screens: real tables, no sort menu. */
@media (min-width: 62rem) {
  main {
    padding: 0 1.5rem 2rem;
  }

  .site-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
  }

  .site-header nav ul {
    margin: 0;
  }

  .sort-controls {
    display: none;
  }

  .table-wrap {
    overflow-x: auto;
  }

  table.plans,
  table.facts {
    display: table;
    min-width: 60rem;
  }

  table.plans thead,
  table.facts thead {
    display: table-header-group;
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  table.plans tbody,
  table.facts tbody {
    display: table-row-group;
  }

  table.plans tr,
  table.facts tr {
    display: table-row;
    background: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
  }

  table.plans th,
  table.facts th,
  table.plans td,
  table.facts td,
  table.facts tbody th {
    display: table-cell;
    padding: 0.5rem 0.6rem;
    border: 0;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    text-align: left;
  }

  table.plans td + td,
  table.facts td,
  table.facts tbody th + td {
    border-top: 0;
  }

  table.plans td::before,
  table.facts td::before,
  table.facts tbody th::before {
    content: none;
  }

  table.plans thead th,
  table.facts thead th {
    background: var(--card);
    border-bottom: 2px solid var(--border);
    font-weight: 700;
  }

  th[aria-sort] {
    background: var(--sample-bg);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
