/*
 * Minimal. Dark by default regardless of the operating system, with a toggle that persists.
 *
 * There is no prefers-color-scheme block on purpose: dark is the default look, and the
 * toggle is the only thing that changes it. Both palettes are complete token sets so nothing
 * renders one theme's ink on the other theme's ground.
 *
 * Afacad is self-hosted. A privacy-first analytics product has no business handing every
 * visitor's IP address to a font CDN on its own homepage.
 */

@font-face {
  font-family: 'Afacad';
  src: url('/fonts/afacad.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0e0e0d;
  --panel: #161615;
  --ink: #f2f1ec;
  --ink-2: #a8a69e;
  --ink-3: #7b7972;
  --rule: #262624;
  --accent: #3987e5;

  /* Series colours, validated for contrast and colour-vision deficiency in both themes. */
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s0: #6d6b65;

  --sans: 'Afacad', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #fcfcfb;
  --panel: #ffffff;
  --ink: #101010;
  --ink-2: #5c5c58;
  --ink-3: #8f8f88;
  --rule: #e7e7e3;
  --accent: #2a78d6;

  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s0: #b6b4ab;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  font-feature-settings: 'tnum' 0;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding-inline: 22px;
}

/* --- header -------------------------------------------------------------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 22px;
}

.wordmark {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-decoration: none;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
}

.toggle:hover {
  color: var(--ink);
  border-color: var(--ink-3);
}

.toggle svg {
  width: 15px;
  height: 15px;
  display: block;
}

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

/* --- hero ---------------------------------------------------------------- */
.hero {
  padding-block: clamp(44px, 9vw, 92px) clamp(34px, 6vw, 60px);
}

h1 {
  font-size: clamp(44px, 8.8vw, 86px);
  font-weight: 400;
  line-height: 1.01;
  letter-spacing: -0.032em;
  text-wrap: balance;
  margin: 0 0 20px;
  max-width: 14ch;
}

h1 span {
  color: var(--ink-3);
}

.hero p {
  font-size: clamp(18px, 2.4vw, 21px);
  color: var(--ink-2);
  max-width: 40ch;
  margin: 0 0 34px;
}

form.waitlist {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  padding: 5px 5px 5px 16px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 999px;
}

form.waitlist:focus-within {
  border-color: var(--accent);
}

input[type='email'] {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 0;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: none;
}

input[type='email']::placeholder {
  color: var(--ink-3);
}

input[type='email']:focus {
  outline: none;
}

button.join {
  flex: 0 0 auto;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--bg);
  background: var(--ink);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

button.join:hover:not(:disabled) {
  background: var(--accent);
}

button.join:disabled {
  opacity: 0.55;
  cursor: progress;
}

.form-msg {
  font-size: 15px;
  margin: 12px 0 0;
  min-height: 1.3em;
  color: var(--ink-2);
}

.form-msg[data-state='error'] {
  color: var(--s2);
}

/* Hidden from people and assistive tech, visible to naive bots. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- charts -------------------------------------------------------------- */
/* The traffic series runs full width above the pair: a 30 day line needs the horizontal
   room, and the two breakdowns below read fine at half. */
.chart-stack {
  display: grid;
  gap: 18px;
  padding-bottom: clamp(50px, 9vw, 96px);
}

.trend {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 4px;
  overflow: visible;
}

.trend-line {
  fill: none;
  stroke: var(--s1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.trend-area {
  fill: var(--s1);
  opacity: 0.1;
  stroke: none;
}

.trend-end {
  fill: var(--s1);
  stroke: var(--panel);
  stroke-width: 2.5;
}

.trend-axis {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 6px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.headline-figure {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.delta {
  font-size: 14px;
  color: var(--s3);
}

.charts {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
}

@media (max-width: 720px) {
  .charts {
    grid-template-columns: minmax(0, 1fr);
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 20px;
}

.panel h2 {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  margin: 0;
}

.panel .meta {
  font-size: 13px;
  color: var(--ink-3);
  margin: 2px 0 18px;
}

/* Horizontal bars */
.bars {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: baseline;
}

.bar-label {
  font-size: 15px;
  color: var(--ink-2);
}

.bar-value {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.bar-track {
  grid-column: 1 / -1;
  height: 7px;
  background: var(--rule);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
}

.bar-row.muted .bar-label,
.bar-row.muted .bar-value {
  color: var(--ink-3);
}

/* Donut */
.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.donut {
  position: relative;
  width: 168px;
  height: 168px;
}

.donut svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-centre {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.donut-centre .big {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.donut-centre .small {
  font-size: 12.5px;
  color: var(--ink-3);
}

.legend {
  display: grid;
  gap: 7px;
  width: 100%;
}

.legend div {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--ink-2);
}

.legend .swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.legend .pct {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* --- below the fold ------------------------------------------------------ */
section.below {
  border-top: 1px solid var(--rule);
  padding-block: clamp(42px, 7vw, 72px);
}

.eyebrow {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 22px;
}

/* Two by two, so each point gets equal weight rather than one orphaned on its own row. */
.points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 640px) {
  .points {
    grid-template-columns: minmax(0, 1fr);
  }
}

.point {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 20px;
}

.point-icon {
  display: block;
  width: 21px;
  height: 21px;
  margin-bottom: 13px;
  color: var(--accent);
}

.point h3 {
  font-size: 17.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  margin: 0 0 4px;
}

.point p {
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0;
}

.faq {
  display: grid;
  gap: 0;
}

.faq details {
  border-bottom: 1px solid var(--rule);
}

.faq details:first-of-type {
  border-top: 1px solid var(--rule);
}

.faq summary {
  padding: 16px 0;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: '+';
  color: var(--ink-3);
  font-weight: 400;
  font-size: 20px;
  line-height: 1;
}

.faq details[open] summary::after {
  content: '\2212';
}

.faq p {
  margin: 0 0 16px;
  font-size: 15.5px;
  color: var(--ink-2);
  max-width: 62ch;
}

footer {
  border-top: 1px solid var(--rule);
  padding-block: 22px 40px;
  font-size: 14px;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
