/**
 * Web Accessibility Scanner — site styles.
 *
 * Plain CSS, no build step. The colour tokens are the extension's own, so the site and
 * the product do not look like two different things.
 *
 * Three-way theming, in this order:
 *   1. Light is the base.
 *   2. `prefers-color-scheme: dark` applies dark — unless the reader has forced light.
 *   3. `[data-theme="dark"]` forces dark regardless of the system.
 *
 * The `:not([data-theme='light'])` guard on the media query is what makes an explicit
 * "Light" choice stick on a machine set to dark; without it the media query would win.
 */

:root {
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-2: #f4f4f5;
  --fg: #18181b;
  --muted: #5b5b66;
  --line: #e4e4e7;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-fg: #ffffff;

  --critical: #dc2626;
  --serious: #c2410c;
  --moderate: #a16207;
  --minor: #0e7490;
  --good: #15803d;

  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* One column width, one gutter, everywhere. */
  --page: 1140px;
  --gutter: 20px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #1c1c1f;
    --surface: #232327;
    --surface-2: #2b2b30;
    --fg: #f4f4f5;
    --muted: #a8a8b3;
    --line: #3f3f46;
    --accent: #a5b4fc;
    --accent-hover: #c7d2fe;
    --accent-fg: #18181b;

    --critical: #f87171;
    --serious: #fb923c;
    --moderate: #fbbf24;
    --minor: #22d3ee;
    --good: #4ade80;

    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #1c1c1f;
  --surface: #232327;
  --surface-2: #2b2b30;
  --fg: #f4f4f5;
  --muted: #a8a8b3;
  --line: #3f3f46;
  --accent: #a5b4fc;
  --accent-hover: #c7d2fe;
  --accent-fg: #18181b;

  --critical: #f87171;
  --serious: #fb923c;
  --moderate: #fbbf24;
  --minor: #22d3ee;
  --good: #4ade80;

  color-scheme: dark;
}

/* ── base ─────────────────────────────────────────────────────────────────── */

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

html {
  /* Anchors land below the sticky header rather than under it. */
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem);
  font-weight: 700;
}
h2 {
  font-size: clamp(1.45rem, 1.2rem + 1.1vw, 1.95rem);
  font-weight: 650;
  margin-top: 2.2em;
}
h3 {
  font-size: 1.15rem;
  font-weight: 650;
  margin-top: 1.8em;
}

p {
  margin: 0 0 1.1em;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-hover);
}

/* Never removed, only replaced — this site is the shop window for a tool that flags
   exactly this. */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--surface-2);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.55;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

/* ── layout ───────────────────────────────────────────────────────────────── */

.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main {
  display: block;
  padding-block: 2.5rem 4rem;
}

.prose {
  max-width: 68ch;
}

/* On a page with nothing beside it, the measure is centred rather than pinned left --
   otherwise half a wide screen is simply empty. */
.prose--center {
  margin-inline: auto;
}

/* ── feature page: content beside the list of the others ──────────────────── */

.feature-layout {
  display: grid;
  gap: 40px;
  align-items: start;
}

.feature-main {
  min-width: 0;
  max-width: 68ch;
}

.rail {
  font-size: 0.94rem;
}

.rail h2 {
  margin: 0 0 0.8em;
  font-size: 0.8rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.rail ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}

.rail li {
  margin: 0;
}

.rail a {
  display: block;
  padding: 6px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.rail a:hover {
  color: var(--fg);
}

.rail a[aria-current='page'] {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

@media (min-width: 1000px) {
  /* Both columns sized to their content and the pair centred, rather than a flexible
     first column: capping the measure at 68ch inside a 1fr column just moved the empty
     space from the edge of the page into the middle of it. */
  .feature-layout {
    grid-template-columns: minmax(0, 68ch) 230px;
    justify-content: center;
    gap: 56px;
  }

  /* Follows you down a long page; capped and scrollable so a list longer than the
     viewport cannot strand its last entries off screen. */
  .rail nav {
    position: sticky;
    top: 5rem;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
  }
}

/* ── skip link ────────────────────────────────────────────────────────────── */

.skip {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  transition: top 120ms ease-out;
}

.skip:focus {
  top: 8px;
  color: var(--accent-fg);
}

/* ── header ───────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header > .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 0.98rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand:hover {
  color: var(--fg);
}

.brand svg {
  display: block;
  flex: 0 0 auto;
}

.site-nav {
  margin-left: auto;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.site-nav a {
  display: block;
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--fg);
  background: var(--surface-2);
}

.site-nav a[aria-current='page'] {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--surface-2);
}

.theme-toggle svg {
  display: block;
}

/* ── hero ─────────────────────────────────────────────────────────────────── */

.hero {
  padding-block: 4rem 3rem;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(
      60rem 22rem at 50% -8rem,
      color-mix(in srgb, var(--accent) 12%, transparent),
      transparent
    ),
    var(--bg);
}

.hero p.lede {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 62ch;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 1.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: 0.97rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--surface-2);
  color: var(--fg);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-fg);
}

/* ── the honest note, used wherever a claim needs its limit stated ────────── */

.note {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 18px;
  margin: 2rem 0;
}

.note > :last-child {
  margin-bottom: 0;
}

.note h2,
.note h3 {
  margin-top: 0;
  font-size: 1rem;
}

/* ── cards ────────────────────────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

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

.card h2,
.card h3 {
  margin: 0 0 0.4em;
  font-size: 1.08rem;
}

.card p {
  color: var(--muted);
  font-size: 0.96rem;
  margin-bottom: 0.9em;
}

.card > :last-child {
  margin-bottom: 0;
  margin-top: auto;
}

.card a.more {
  font-weight: 600;
  font-size: 0.94rem;
  text-decoration: none;
}

.card a.more:hover {
  text-decoration: underline;
}

.card a.more::after {
  content: ' \2192';
}

/* ── screenshots ──────────────────────────────────────────────────────────── */

.shot {
  margin: 0 0 2.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  /* Wider than the prose column: a 1280px panel shrunk into 68ch is unreadable. */
  max-width: var(--page);
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
}

.shot--thumb {
  margin: -20px -20px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* The card's own padding is cancelled by the thumbnail's negative margin, so the image
   meets the card edge instead of floating inside it. */
.card--shot {
  overflow: hidden;
}

/* ── stats ────────────────────────────────────────────────────────────────── */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 2rem 0;
  padding: 0;
  list-style: none;
}

.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 18px;
}

.stat b {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat span {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── tables ───────────────────────────────────────────────────────────────── */

.table-scroll {
  overflow-x: auto;
  margin: 1.5rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

caption {
  text-align: left;
  color: var(--muted);
  font-size: 0.9rem;
  padding-bottom: 0.6rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--line);
}

th {
  font-weight: 650;
  white-space: nowrap;
}

/* ── lists ────────────────────────────────────────────────────────────────── */

.prose ul,
.prose ol {
  padding-left: 1.3em;
  margin: 0 0 1.2em;
}

.prose li {
  margin-bottom: 0.4em;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0;
}

.checklist li {
  position: relative;
  padding-left: 1.9em;
  margin-bottom: 0.7em;
}

.checklist li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 0.5em;
  height: 0.85em;
  border: solid var(--good);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ── breadcrumbs ──────────────────────────────────────────────────────────── */

.crumbs {
  margin-bottom: 1.4rem;
  font-size: 0.92rem;
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--muted);
}

.crumbs li + li::before {
  content: '/';
  margin-right: 0.5em;
  color: var(--line);
}

/* ── pager between feature pages ──────────────────────────────────────────── */

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.pager a {
  text-decoration: none;
  font-weight: 600;
}

.pager a:hover {
  text-decoration: underline;
}

/* ── footer ───────────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-block: 2.5rem;
  font-size: 0.93rem;
}

.site-footer .cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 24px;
}

.site-footer h2 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 0.7em;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li {
  margin-bottom: 0.45em;
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.colophon {
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.colophon p {
  margin: 0 0 0.4em;
}

/* ── utility ──────────────────────────────────────────────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
}

/* ── narrow ───────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .site-header > .wrap {
    padding-block: 10px;
  }

  .site-nav {
    /* Its own line, scrolling sideways rather than wrapping into three rows. */
    order: 2;
    margin-left: 0;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  /* Up beside the brand rather than stranded on a third row of its own, which is where
     source order put it once the nav took a full line. */
  .theme-toggle {
    order: 1;
    margin-left: auto;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav ul {
    flex-wrap: nowrap;
  }

  .site-nav a {
    white-space: nowrap;
  }

  .hero {
    padding-block: 2.5rem 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
