/*
 * circle-ml — the site's identity, and it is its own.
 *
 * THEME COLOUR  #22c55e   a grass green, taken by nothing else in the family
 * BACKGROUND    #04150c   a near-black of the same hue
 * DRAWING       two glows and two slow gradients in the base, and on its own
 *               fixed layer a LATTICE OF CIRCLES — a thin ring at the centre of
 *               every sixty-pixel cell, faded by a mask so it dissolves rather
 *               than stopping. Measured signature: 2 radial + 2 linear + 1
 *               repeating ring lattice + masked. No site in the register shares
 *               it, and the shape is chosen because it is the page's own
 *               subject: circles, in a grid.
 *
 * The lattice is its OWN layer rather than another entry in the base gradient
 * stack, because a mask on the base would fade the page's own colour with it.
 */

:root {
  --bg: #04150c;
  --panel: rgba(10, 54, 32, 0.42);
  --panel-solid: #072113;
  --accent: #22c55e;
  --accent-lit: #6ee7a0;
  --accent-deep: #15803d;
  --pale: #bbf7d0;
  --text: #eaf7ef;
  --muted: #9db8a8;
  --hairline: rgba(34, 197, 94, 0.22);
  --yellow: #fbbf24;
  --radius: 14px;
  --container: 1000px;
  --consent-height: 0px;
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: calc(var(--consent-height) + 8px);
  background-color: var(--bg);
  background-image:
    radial-gradient(58% 42% at 14% 2%, rgba(34, 197, 94, 0.20) 0%, rgba(34, 197, 94, 0) 68%),
    radial-gradient(52% 40% at 88% 8%, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0) 70%),
    linear-gradient(168deg, rgba(14, 60, 35, 0.75) 0%, rgba(4, 21, 12, 0) 62%),
    linear-gradient(0deg, rgba(34, 197, 94, 0.05) 0%, rgba(34, 197, 94, 0) 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/*
 * The drawing. A ring at the centre of every cell of a sixty-pixel lattice —
 * circles in a grid, which is the page's own subject drawn at background size.
 */
.dvs-pattern {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: repeating-radial-gradient(
    circle at 50% 50%,
    rgba(34, 197, 94, 0) 0 20px,
    rgba(34, 197, 94, 0.19) 20px 21.5px,
    rgba(34, 197, 94, 0) 21.5px 30px
  );
  background-size: 60px 60px;
  mask-image: radial-gradient(
    125% 92% at 50% 0%,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.28) 52%,
    transparent 92%
  );
  -webkit-mask-image: radial-gradient(
    125% 92% at 50% 0%,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.28) 52%,
    transparent 92%
  );
}

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

/* ------------------------------------------------------------------ the bar */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px 20px;
  background: rgba(4, 21, 12, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand .mark {
  width: 26px;
  height: 26px;
  display: block;
  flex: none;
}

.brand b {
  display: block;
  font-size: 15px;
  line-height: 1.1;
  letter-spacing: 0.2px;
}

.brand small {
  display: block;
  font-size: 11.5px;
  line-height: 1.2;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}

/* --------------------------------------------------------------- the column */

main {
  position: relative;
  z-index: 1;
  max-width: var(--container);
  margin: 0 auto;
  padding: 30px 20px 56px;
}

section + section {
  margin-top: 34px;
}

h1 {
  font-size: clamp(1.9rem, 5.2vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}

h2 {
  font-size: clamp(1.25rem, 2.8vw, 1.6rem);
  line-height: 1.2;
  margin: 0 0 12px;
}

h3 {
  font-size: 1rem;
  margin: 18px 0 6px;
}

p {
  margin: 0 0 14px;
}

.lede {
  font-size: 1.09rem;
  color: var(--text);
  max-width: 64ch;
}

.sub {
  color: var(--muted);
  max-width: 74ch;
}

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

.belief {
  color: var(--pale);
}

.card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 22px;
}

.card + .card {
  margin-top: 16px;
}

/* ----------------------------------------------------------------- the stage */

.stage-frame {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  /* Darker than the page on purpose: the belief wash is the site's own green, so
     the stage has to be a distinctly darker panel or the wash and the page merge
     and the square stops reading as a square. */
  background: #020c06;
  border: 1px solid var(--hairline);
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
}

.no-webgl {
  margin: 14px auto 0;
  max-width: 62ch;
  color: var(--pale);
  font-size: 0.9rem;
}

.hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px 18px;
  margin: 18px 0 4px;
}

.stat-k {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-v {
  display: block;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.verdict {
  display: inline-block;
  margin: 14px 0 12px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.verdict[data-state='edge'] {
  border-color: rgba(34, 197, 94, 0.6);
  color: var(--accent-lit);
}

.verdict[data-state='shape'] {
  border-color: rgba(187, 247, 208, 0.6);
  color: var(--pale);
}

.status-line {
  color: var(--muted);
  margin: 0 0 16px;
  max-width: 74ch;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  padding-top: 4px;
  border-top: 1px solid var(--hairline);
  margin-top: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

select {
  font: inherit;
  color: var(--text);
  background: var(--panel-solid);
  border: 1px solid var(--hairline);
  border-radius: 9px;
  padding: 7px 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--accent-deep);
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 15px;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent);
}

.btn-ghost {
  background: transparent;
  border-color: var(--hairline);
  color: var(--muted);
}

.btn-ghost:hover {
  background: rgba(34, 197, 94, 0.14);
  color: var(--text);
}

.hint {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 14px 0 0;
  max-width: 84ch;
}

.hint:empty {
  display: none;
}

/* ------------------------------------------------------------------ the rest */

.ledger {
  margin: 0;
  padding-left: 1.1rem;
}

.ledger li {
  margin-bottom: 10px;
  max-width: 84ch;
}

.ledger b {
  color: var(--pale);
  font-weight: 600;
}

.chart {
  display: block;
  width: 100%;
  height: 280px;
  background: rgba(3, 16, 9, 0.5);
  border: 1px solid var(--hairline);
  border-radius: 10px;
}

.door {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-lit);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* ----------------------------------------------------------------- the gate */

.consent-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgba(5, 26, 15, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--hairline);
  padding: 14px 20px;
}

.consent-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.consent-ask,
.consent-prefs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  width: 100%;
}

.consent-copy {
  flex: 1 1 320px;
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* 🔴 TWO ROWS, AND ONLY ONE OF THEM HAS A CONTROL. The fault report is declared
   rather than offered, so its row ends in a tag the reader can see and cannot
   press — a switch there would be a control that does nothing when pressed. */
.consent-list {
  flex: 1 1 100%;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 18px;
  flex-wrap: wrap;
  border-top: 1px solid var(--hairline);
  padding-top: 12px;
}

.consent-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.consent-row-name {
  margin: 0 0 2px;
  font-size: 0.9rem;
  color: var(--text);
}

.consent-row-why {
  margin: 0;
  max-width: 62ch;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
}

.consent-always {
  flex: none;
  align-self: flex-start;
  margin-top: 2px;
  padding: 3px 9px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.consent-actions {
  display: flex;
  gap: 12px;
}

.consent-close {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.switch-track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: rgba(3, 22, 13, 0.9);
  position: relative;
  flex: none;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 120ms ease;
}

.switch[aria-checked='true'] .switch-track::after {
  transform: translateX(18px);
  background: var(--accent-lit);
}

.consent-word {
  min-width: 2ch;
  color: var(--muted);
}

/* ----------------------------------------------------------------- the foot */

.site-footer {
  position: relative;
  z-index: 1;
  max-width: var(--container);
  margin: 0 auto;
  padding: 26px 20px 40px;
  border-top: 1px solid var(--hairline);
  font-size: 0.88rem;
  color: var(--muted);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--text);
}

.footer-brand .mark {
  width: 22px;
  height: 22px;
  display: block;
  flex: none;
}

.footer-links {
  margin: 0 0 10px;
}

.footer-copy {
  margin: 0;
}

.footer-links a,
.footer-links .door {
  color: var(--accent-lit);
}

/* ------------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 640px) {
  main {
    padding: 22px 16px 48px;
  }
  .card {
    padding: 18px;
  }
  .hud {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
}
