/* Qadas site styles — dark-dominant, in the register of Linear and Stripe.
 *
 * Four things carry that register, and the earlier passes had none of them:
 *   1. atmosphere — radial auras and a faint grid, so the ground is never flat
 *   2. glass surfaces — translucent cards with a hairline border that brightens on hover
 *   3. centred section heads with a small pill label above
 *   4. one large visual object per section, rather than text at 62ch with dead space beside it
 *
 * Why dark rather than the white page this replaces: the hero asset is satellite imagery, and
 * imagery reads as luminous on black and washed out on white. The subject decides the ground.
 */

/* ============================ reset ============================ */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-5));
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3 {
  margin: 0;
  font-weight: var(--weight-display);
  letter-spacing: var(--tracking-display);
  line-height: 1.08;
  text-wrap: balance;
  color: var(--fg);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); letter-spacing: var(--tracking-tight); line-height: 1.3; }

p, ul, ol, dl, figure { margin: 0; }
img, svg { max-width: 100%; height: auto; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100%;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus { top: var(--space-3); }

/* ============================ atmosphere ============================ */

/* The ground is never flat. One aura behind the hero, a softer one behind the closing CTA, plus a
 * faint grid that fades out down the page. This is the single biggest lever on whether a dark page
 * reads as designed or as unstyled, and it is what the earlier passes were missing. */

.aura { position: relative; isolation: isolate; }

.aura::before {
  content: "";
  position: absolute;
  inset: -30% -20% auto -20%;
  height: 120%;
  background: radial-gradient(ellipse 55% 55% at 50% 0%, var(--accent-glow), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.aura--soft::before {
  background: radial-gradient(ellipse 60% 50% at 50% 50%, rgb(63 207 142 / 9%), transparent 70%);
}

.grid-bg { position: relative; isolation: isolate; }

.grid-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(255 255 255 / 2.5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 2.5%) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 65%);
  pointer-events: none;
  z-index: -1;
}

/* ============================ layout ============================ */

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

.shell--wide { max-width: var(--container-wide); }
.shell--narrow { max-width: var(--container-narrow); }

.section { padding-block: var(--section-y); }
.section--ruled { border-top: 1px solid var(--border); }

.bleed { width: 100vw; margin-inline: calc(50% - 50vw); }

/* ============================ type ============================ */

/* A plain label with no chrome, for captions under figures. */
.caption {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--fg-faint);
}

.lead {
  font-size: var(--text-lg);
  line-height: 1.55;
  color: var(--fg-muted);
  max-width: 52ch;
}

.muted { color: var(--fg-muted); }
.small { font-size: var(--text-base); }

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Left aligned, because a map-sheet marker is a full-width rule and centring under it reads as a
 * mistake. The marker carries the section index; the head carries the sentence. */
.head {
  display: grid;
  justify-items: start;
  gap: var(--space-4);
  max-width: 46rem;
}

.head + * { margin-top: var(--space-7); }

/* ============================ buttons ============================ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.65rem var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--fg);
  color: var(--bg);
  font: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  text-decoration: none;
  cursor: pointer;
  transition: opacity var(--transition), background var(--transition), transform var(--transition);
}

.button:hover { opacity: 0.9; transform: translateY(-1px); }

.button--ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--fg);
}

.button--ghost:hover { background: var(--surface-hover); opacity: 1; }
.button--wide { width: 100%; }

.link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--accent);
  text-decoration: none;
}

.link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ============================ header ============================ */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}

.site-header.is-scrolled {
  background: rgb(8 9 10 / 72%);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom-color: var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: var(--header-h);
}

.nav__brand { display: inline-flex; align-items: center; margin-right: auto; }
.nav__brand img { display: block; width: 100px; height: auto; filter: brightness(0) invert(1); }

.nav__toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px; height: 38px;
  padding: 0 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav__toggle span { display: block; height: 1.5px; background: var(--fg); }

.nav__links { display: none; }
.nav__cta { display: none; }

@media (min-width: 1020px) {
  .nav__toggle { display: none; }
  .nav__links { display: flex; align-items: center; gap: var(--space-6); }
  .nav__cta { display: inline-flex; }

  .nav__item > a,
  .nav__group > summary {
    font-size: var(--text-base);
    color: var(--fg-muted);
    text-decoration: none;
    cursor: pointer;
    list-style: none;
    transition: color var(--transition);
  }

  .nav__item > a:hover,
  .nav__group > summary:hover,
  .nav__item > a[aria-current="page"] { color: var(--fg); }

  .nav__group { position: relative; }
  .nav__group > summary::-webkit-details-marker { display: none; }
  /* The chevron is drawn rather than typed, so it can rotate when the panel opens. */
  .nav__chev {
    display: inline-block;
    width: 0.42em;
    height: 0.42em;
    margin-left: 0.45em;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-0.15em) rotate(45deg);
    opacity: 0.55;
    transition: transform 140ms ease, opacity 140ms ease;
  }

  .nav__group[open] > summary .nav__chev { transform: translateY(0.05em) rotate(225deg); opacity: 1; }

  /* A panel rather than a column of links: each entry says what it is, so the reader can choose
   * from the bar instead of opening five pages to find out. */
  .nav__panel {
    position: absolute;
    top: calc(100% + var(--space-3));
    left: calc(var(--space-4) * -1);
    width: max-content;
    max-width: min(46rem, calc(100vw - 4rem));
    padding: var(--space-4);
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
    z-index: 50;
  }

  .nav__intro {
    margin: 0 0 var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border);
    font-size: var(--text-sm);
    color: var(--fg-faint);
    max-width: 44ch;
  }

  .nav__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px var(--space-3);
  }

  .nav__panel a {
    display: grid;
    gap: 0.15rem;
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    text-decoration: none;
    border: 1px solid transparent;
  }

  .nav__panel a:hover,
  .nav__panel a[aria-current="page"] {
    background: var(--surface);
    border-color: var(--border);
  }

  /* The rightmost panel would otherwise run off the edge of the window, so it hangs from its
   * right rather than its left. */
  .nav__group:last-of-type .nav__panel {
    left: auto;
    right: calc(var(--space-4) * -1);
  }

  .nav__label { font-size: var(--text-base); color: var(--fg); }
  .nav__note { font-size: var(--text-sm); color: var(--fg-faint); line-height: 1.45; }
  .nav__panel a[aria-current="page"] .nav__label { color: var(--accent); }
}

@media (max-width: 1019px) {
  .nav { position: relative; }

  .nav__panel { display: grid; gap: var(--space-2); padding-block: var(--space-2); }
  .nav__grid { display: grid; gap: var(--space-1); }
  .nav__intro { display: none; }
  .nav__note { display: none; }

  .nav__links.is-open {
    display: grid;
    gap: var(--space-1);
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    padding: var(--space-4);
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lift);
  }

  .nav__links.is-open a,
  .nav__links.is-open summary {
    display: block;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-base);
    color: var(--fg);
    text-decoration: none;
    list-style: none;
    cursor: pointer;
  }

  .nav__submenu { display: grid; padding-left: var(--space-4); }
  .nav__submenu a { color: var(--fg-muted); }
}

/* ============================ comparison slider ============================ */

.compare {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  isolation: isolate;
}

@media (max-width: 760px) { .compare { aspect-ratio: 4 / 3; } }

.compare__pane { position: absolute; inset: 0; }
.compare__pane picture { position: absolute; inset: 0; display: block; }
.compare__pane img { width: 100%; height: 100%; object-fit: cover; display: block; }
.compare__pane--winter { clip-path: inset(0 0 0 var(--split, 50%)); }

.compare__stamp {
  position: absolute;
  top: var(--space-5);
  padding: 0.3rem var(--space-3);
  border-radius: var(--radius-pill);
  background: rgb(8 9 10 / 72%);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong);
  font-family: var(--font-data);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-label);
}

.compare__stamp--left { left: var(--space-5); }
.compare__stamp--right { right: var(--space-5); }

.compare__range {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 3;
}

.compare__handle {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--split, 50%);
  width: 1px;
  background: rgb(255 255 255 / 70%);
  z-index: 2;
  pointer-events: none;
}

.compare__handle::after {
  content: "↔";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(8 9 10 / 82%);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-bright);
  color: var(--fg);
}

.compare__range:focus-visible + .compare__handle::after {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.compare__note {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* ============================ finding ============================ */

.finding {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}

.finding__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem var(--space-3);
  border-radius: var(--radius-sm);
  font-family: var(--font-data);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge--high { background: var(--high-bg); color: var(--high); }
.badge--moderate { background: var(--moderate-bg); color: var(--moderate); }
.badge--low { background: var(--low-bg); color: var(--low); }
.badge--sample { background: var(--surface); color: var(--fg-faint); border: 1px solid var(--border); }

.finding__confidence {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

.meter { display: inline-flex; gap: 2px; }
.meter i { width: 12px; height: 4px; border-radius: 1px; background: var(--border-strong); }
.meter i.is-on { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }

.finding__body { padding: var(--space-5); display: grid; gap: var(--space-5); }
.finding__evidence { display: grid; font-size: var(--text-base); }

.finding__evidence > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
  border-top: 1px solid var(--border);
}

.finding__evidence dt { color: var(--fg-muted); }

.finding__evidence dd {
  margin: 0;
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.finding__check {
  padding: var(--space-4);
  background: var(--gradient-soft);
  border: 1px solid rgb(63 207 142 / 20%);
  border-radius: var(--radius);
  font-size: var(--text-base);
  color: var(--fg-muted);
}

.finding__check strong { color: var(--fg); font-weight: var(--weight-medium); }

.footnote {
  margin-top: var(--space-5);
  max-width: 52ch;
  font-size: var(--text-base);
  color: var(--fg-faint);
}

/* ============================ limits ============================ */

.limits { list-style: none; padding: 0; display: grid; gap: var(--space-3); }

@media (min-width: 860px) {
  .limits { grid-template-columns: repeat(2, 1fr); }
}

.limits li {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.limits strong {
  display: flex;
  gap: var(--space-3);
  align-items: baseline;
  font-weight: var(--weight-medium);
}

.limits strong::before {
  content: "✕";
  font-family: var(--font-data);
  font-size: 0.72em;
  color: var(--high);
}

.limits span {
  padding-left: calc(var(--space-3) + 1ch);
  font-size: var(--text-base);
  color: var(--fg-muted);
}

/* ============================ forms ============================ */

.form { display: grid; gap: var(--space-4); max-width: 420px; margin-inline: auto; text-align: left; }

.field { display: grid; gap: var(--space-2); }
.field label { font-size: var(--text-base); font-weight: var(--weight-medium); }

.field input,
.field select {
  width: 100%;
  padding: 0.7rem var(--space-4);
  font: inherit;
  font-size: var(--text-base);
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.field input::placeholder { color: var(--fg-faint); }

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"] { border-color: var(--high); }

.field-hint { font-size: var(--text-xs); color: var(--fg-faint); }
.form-error { font-size: var(--text-base); color: var(--high); }

.consent {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  font-size: var(--text-base);
  color: var(--fg-muted);
}

.consent input { margin-top: 0.25em; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }

.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-success {
  display: flex;
  gap: var(--space-4);
  max-width: 420px;
  margin-inline: auto;
  padding: var(--space-5);
  background: var(--gradient-soft);
  border: 1px solid rgb(63 207 142 / 24%);
  border-radius: var(--radius-lg);
  text-align: left;
}

.success-mark { color: var(--accent); font-size: 1.25rem; line-height: 1; }

/* ============================ pending stub ============================ */

/* ============================ footer ============================ */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-8) var(--space-6);
  font-size: var(--text-base);
  color: var(--fg-muted);
}

.footer__grid { display: grid; gap: var(--space-6); }

@media (min-width: 760px) {
  .footer__grid { grid-template-columns: 1.6fr repeat(3, 1fr); gap: var(--space-7); }
}

.footer__brand img { width: 100px; filter: brightness(0) invert(1); opacity: 0.85; }
.footer__brand p { margin-top: var(--space-4); max-width: 32ch; color: var(--fg-faint); }

.footer__column h2 {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: var(--space-4);
  font-weight: var(--weight-normal);
}

.footer__column a {
  display: block;
  padding-block: 0.3rem;
  text-decoration: none;
  transition: color var(--transition);
}

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

.footer__bottom {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  display: grid;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--fg-faint);
}

/* ============ document primitives, shared by interior pages ============ */

/* Label/value pairs. A table would be semantically wrong — these are definitions, not a grid of
 * comparable rows — and a real <table> wraps badly at phone width. */
.rt {
  margin: var(--space-5) 0 0;
  border-top: 1px solid var(--border);
}

.rt > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.rt dt { color: var(--fg-muted); font-size: var(--text-sm); }

.rt dd {
  margin: 0;
  font-family: var(--font-data);
  font-size: var(--text-sm);
  color: var(--fg);
  text-align: right;
}

/* ---- notices and callouts ---- */

.notice {
  margin-top: var(--space-7);
  padding: var(--space-5);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.notice__heading {
  font-size: var(--text-base);
  margin-bottom: var(--space-3);
}

.notice p { color: var(--fg-muted); font-size: var(--text-sm); max-width: 66ch; }

.callout {
  margin-top: var(--space-5);
  padding-left: var(--space-5);
  border-left: 2px solid var(--border-strong);
  color: var(--fg-muted);
  font-size: var(--text-sm);
  max-width: 68ch;
}

.callout--warn { border-left-color: var(--accent); color: var(--fg); }

/* What the category cannot see, at the same visual weight as what it can. Demoting this block to
 * small print would undo the reason it is on the page. */
.notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-5);
  margin-top: var(--space-6);
}

.note {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-strong);
}

.note h2,
.note h3 { font-size: var(--text-lg); margin-bottom: var(--space-3); }
.note p { color: var(--fg-muted); font-size: var(--text-sm); }

/* ---- closing call to action ---- */

.cta-band { text-align: center; }
.cta-band .lead { margin-inline: auto; }
.cta-band .button { margin-top: var(--space-6); }

/* ---- the gap's closing line ---- */

/* The line that turns the contrast into an offer. It belongs under both columns, not inside one. */
.gap__closing {
  margin: clamp(var(--space-6), 3vw, var(--space-7)) auto 0;
  max-width: 62ch;
  text-align: center;
  color: var(--fg-muted);
}

/* ============================ category diagrams ============================ */

/* Grey is the reference or the neighbouring parcel; the accent is always the parcel analysed. */

.diagram {
  display: block;
  width: 100%;
  height: auto;
  background: rgb(0 0 0 / 22%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dg-axis, .dg-guide { stroke: var(--border-strong); stroke-width: 1; }
.dg-line { fill: none; stroke: var(--fg-faint); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dg-accent-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dg-fill { fill: rgb(255 255 255 / 4%); stroke: none; }
.dg-event line { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 3; }
.dg-dot { fill: var(--fg-faint); }
.dg-dot--accent { fill: var(--accent); }
.dg-bracket path { fill: none; stroke: var(--border-strong); stroke-width: 1; }
.dg-ring circle { fill: none; stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.dg-poi circle { fill: var(--fg-faint); }
.dg-bar rect { fill: rgb(255 255 255 / 10%); }
.dg-text { font-family: var(--font-data); font-size: 8px; letter-spacing: 0.1em; fill: var(--fg-faint); }
.dg-text--accent { fill: var(--accent); }
