/* ATA Coin website styles.
   The ATA Coin Design System is the source of truth: tokens, the global
   reset, and the core component styles are imported below, and every value
   here derives from those tokens. Light/dark ships from the same tokens
   (paper/ink swap on prefers-color-scheme) — no per-theme overrides live in
   this file. See DESIGN.md and the design-system README for the rules. */

@import "tokens/colors.css";
@import "tokens/typography.css";
@import "tokens/spacing.css";
@import "tokens/effects.css";
@import "tokens/motion.css";
@import "base.css";
@import "components.css";

/* --- Bridge: names the site JS/charts expect, mapped onto design tokens.
   Allocation colors are locked to their roles (never reassigned per theme);
   the neutrals and status tints recompute automatically because they are
   color-mixes of ink into paper. --- */
:root {
  --series-1: var(--allocation-founder);
  --series-2: var(--allocation-liquidity);
  --series-3: var(--allocation-community);
  --series-4: var(--allocation-treasury);

  --grid: var(--border-default);
  --baseline: var(--border-strong);
  --surface-1: var(--bg-card);
  --border: var(--border-default);
  --text-muted: var(--text-tertiary);

  --badge-pre: var(--bg-sunken);
  --badge-live: color-mix(in oklch, var(--allocation-treasury) 16%, var(--paper));
  --badge-testnet: color-mix(in oklch, var(--allocation-community) 18%, var(--paper));
}

/* --- Layout: a single reading column, document not dashboard. --- */
body {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-7) var(--space-5) var(--space-9);
}

/* --- Type scale (weight + space, one typeface, no webfonts). --- */
h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin: var(--space-3) 0 var(--space-2);
}
h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
  margin-top: var(--space-8);
  padding-bottom: var(--space-2);
  border-bottom: var(--border-width) solid var(--border-default);
}
h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  margin-top: var(--space-6);
}
h4 {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-2);
}

p { margin: var(--space-3) 0; }

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg-sunken);
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.35em;
}

/* --- Skip link, theme control, section nav --- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; white-space: nowrap;
  clip-path: inset(50%);
}
/* Visible only on keyboard focus; first thing in the tab order. */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: calc(-1 * var(--space-8));
  z-index: 10;
  background: var(--bg-page);
  color: var(--text-primary);
  border: var(--border-width) solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: top var(--duration-fast) var(--ease-standard);
}
.skip-link:focus-visible { top: var(--space-3); }

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.theme-toggle {
  flex: none;
  background: transparent;
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-md);
  line-height: 1;
  width: 34px; height: 34px;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard);
}
.theme-toggle:hover { color: var(--text-primary); border-color: var(--border-strong); }

/* Wraps to as many rows as it needs; no horizontal scroll on a phone. */
.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: var(--border-width) solid var(--border-default);
  font-size: var(--text-sm);
}
.section-nav a { color: var(--text-secondary); text-decoration: none; }
.section-nav a:hover { color: var(--link-hover); text-decoration: underline; }

/* --- Brand header --- */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.brand h1 { margin: 0; }
.brand-mark { width: 40px; height: 40px; display: block; }
/* System preference by default, with the manual theme override winning. */
.brand-mark--dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark--light { display: none; }
  :root:not([data-theme="light"]) .brand-mark--dark { display: block; }
}
:root[data-theme="dark"] .brand-mark--light { display: none; }
:root[data-theme="dark"] .brand-mark--dark { display: block; }
:root[data-theme="light"] .brand-mark--light { display: block; }
:root[data-theme="light"] .brand-mark--dark { display: none; }
/* The letters expanded: what the name asserts, next to the wordmark. */
.brand-text { display: flex; flex-direction: column; }
.brand-expansion {
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
/* The lockup already carries the "ATA" wordmark; theme swap via <picture>. */
.brand-lockup { height: 32px; width: auto; display: block; }

.tagline {
  font-size: var(--text-md);
  line-height: var(--leading-snug);
  color: var(--text-secondary);
  max-width: 46rem;
}
.aside {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

/* --- Status badges: quiet pills, never sirens. --- */
.badge {
  display: inline-block;
  margin: 0;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-xs);
  border: var(--border-width) solid var(--border-default);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
}
.badge-pre { background: var(--badge-pre); color: var(--text-secondary); }
.badge-live { background: var(--badge-live); }
.badge-testnet { background: var(--badge-testnet); }
.badge a { color: inherit; }

.banner {
  background: var(--badge-testnet);
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

/* --- Tables: first-class, bordered not elevated. --- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}
/* The table used to carry overflow:hidden for its corners, which clipped the
   focus ring of any link in an edge cell — every "verify" link is in one. */
.table-scroll {
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.table-scroll > table { border-radius: 0; border: 0; }
.table-scroll { border: var(--border-width) solid var(--border-default); }
th, td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--border-width) solid var(--border-default);
}
tbody tr:last-child td { border-bottom: none; }
th { color: var(--text-secondary); font-weight: var(--weight-semibold); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td a { font-family: var(--font-mono); font-size: var(--text-sm); }

/* --- Allocation swatches (locked colors). --- */
.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-xs);
  margin-right: var(--space-2);
}
.swatch-1 { background: var(--series-1); }
.swatch-2 { background: var(--series-2); }
.swatch-3 { background: var(--series-3); }
.swatch-4 { background: var(--series-4); }

/* --- Stat tiles & cards: bordered containers, generous padding. --- */
.stat-row, .card-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin: var(--space-4) 0;
}
.stat-tile, .card {
  background: var(--bg-card);
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  flex: 1 1 240px;
}
.stat-caption {
  display: block;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.stat-value {
  display: block;
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
  margin: var(--space-1) 0;
}

/* --- Definition lists inside vesting cards. --- */
dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px var(--space-3);
  font-size: var(--text-sm);
}
dt { color: var(--text-secondary); }
dd { margin: 0; font-variant-numeric: tabular-nums; }

/* --- Charts / visualizations. --- */
.viz-row { display: flex; flex-wrap: wrap; gap: var(--space-5); align-items: center; }
.viz-row table { flex: 1 1 380px; }

figure.viz-root {
  margin: var(--space-4) 0;
  background: var(--bg-card);
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  flex: 0 1 360px;
}
figure.viz-root.wide { flex: 1 1 100%; }
figure svg { width: 100%; height: auto; display: block; }

.chart-label { font-size: 13px; fill: var(--text-primary); font-family: var(--font-sans); }
.chart-annotation { font-size: 11px; fill: var(--text-secondary); font-family: var(--font-sans); }
.chart-tick { font-size: 11px; fill: var(--text-secondary); font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.chart-grid { stroke: var(--border-strong); stroke-width: 1; }
/* Hatched rather than flat: the cliff band must read as "locked", and a flat
   fill at this luminance was effectively invisible on light paper. */
.chart-cliff { fill: color-mix(in oklch, var(--ink) 22%, var(--paper)); stroke: var(--border-strong); stroke-width: 1; }
.chart-today { stroke: var(--text-primary); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart-center-value { font-size: 30px; font-weight: var(--weight-bold); fill: var(--text-primary); font-family: var(--font-sans); }
.chart-center-caption { font-size: 12px; fill: var(--text-secondary); font-family: var(--font-sans); }

/* --- Buttons: secondary/outline style (see components.css for the primitive). --- */
button {
  font: inherit;
  font-weight: var(--weight-semibold);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  border: var(--border-width) solid var(--border-strong);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard);
}
button:hover { background: var(--bg-sunken); }

footer {
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: var(--border-width) solid var(--border-default);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* --- Sections added with the site build-out --- */

/* Wide tables scroll inside their own box rather than pushing the page sideways. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll > table { min-width: 30rem; }

/* Key facts reads as label/value rows, not a data grid. */
.facts-table th[scope="row"] {
  text-align: left;
  white-space: nowrap;
  width: 34%;
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
}
.facts-table td { color: var(--text-primary); }

/* Numbered phase lists: the marker carries the sequence, so no extra chrome. */
.phase-list { padding-left: 1.15em; }
.phase-list > li { margin-bottom: var(--space-3); }
.phase-list > li::marker { color: var(--text-tertiary); }

.faq { margin: 0; }
.faq dt {
  font-weight: var(--weight-semibold);
  margin-top: var(--space-5);
  color: var(--text-primary);
}
.faq dd {
  margin: var(--space-2) 0 0;
  color: var(--text-secondary);
  max-width: 46rem;
}

/* Printing: a reader should be able to keep the disclosures on paper. */
@media print {
  .skip-link, .section-nav, .theme-toggle, #refresh { display: none !important; }
  body { background: #fff; color: #000; }
  a { text-decoration: underline; }
  /* URLs are the whole point of a verify-it-yourself page. */
  main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; word-break: break-all; }
  section { break-inside: avoid-page; }
  table { break-inside: auto; }
}

/* Legend swatches sit on the card with no boundary; two of the four allocation
   colours fall below 3:1 against it in light mode. The palette is locked by
   design, so the fix is a hairline, not a recolour. */
.swatch { border: 1px solid var(--border-strong); }

/* The one width breakpoint the page needs: below this the page padding eats a
   fifth of the viewport and the definition lists stop fitting side by side. */
@media (max-width: 30rem) {
  body > header, main, body > footer { padding-left: var(--space-4); padding-right: var(--space-4); }
  .card dl { grid-template-columns: 1fr; gap: 2px var(--space-3); }
  .card dl dt { color: var(--text-tertiary); }
  .stat-value { font-size: var(--text-xl); }
}

.allocation-bar { margin: var(--space-5) 0 var(--space-6); }
