/*
 * css/base.css: the PONMATH design system, part 1 (fonts, tokens, reset, type, layout, focus).
 *
 * colosseum.com's brand sheet 1:1 (the owner's own project): light first, its dark theme under
 * <html data-theme="dark">, square corners, no shadows, engraved grey art, crimson accent, GT Pantheon Text for
 * everything you read, ABC Favorit Mono for small-caps labels and counters, an Old London red initial on headlines.
 * Re-themed as a Greek school of mathematics by the art and the copy, not by new colours.
 *
 * Components live in css/components.css. Page files only use the tokens and classes from these two files.
 * The full system with snippets: reference/DESIGN.md. Every class works without inline styles (the CSP has no
 * 'unsafe-inline').
 */

/* ---------------------------------------------------------------- fonts (see fonts/LICENSES.md) */

@font-face {
  font-family: 'Pantheon Text';
  src: url(../fonts/gt-pantheon-text-regular.woff2?v=2) format('woff2');
  font-style: normal; font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Pantheon Text';
  src: url(../fonts/gt-pantheon-text-medium.woff2?v=2) format('woff2');
  font-style: normal; font-weight: 500; font-display: swap;
}
@font-face {
  font-family: 'Favorit Mono';
  src: url(../fonts/abc-favorit-mono-regular.woff2?v=2) format('woff2');
  font-style: normal; font-weight: 400 500; font-display: swap;
}
@font-face {
  font-family: 'Old London';
  src: url(../fonts/old-london-initials.woff2?v=2) format('woff2');
  font-style: normal; font-weight: 400; font-display: swap;
  unicode-range: U+0030-0039, U+0041-005A, U+0061-007A;
}
/* math fallback: only downloaded when a page shows one of these characters (Pantheon has no Greek, no ≡ ∈ ∞ √) */
@font-face {
  font-family: 'Ponmath Math';
  src: url(../fonts/stix-two-text.woff2?v=2) format('woff2');
  font-style: normal; font-weight: 400 700; font-display: swap;
  unicode-range: U+0370-03FF, U+2100-214F;
}
@font-face {
  font-family: 'Ponmath Math';
  src: url(../fonts/jetbrains-mono.woff2?v=2) format('woff2');
  font-style: normal; font-weight: 400 700; font-display: swap;
  unicode-range: U+2200-22FF, U+27E8-27E9;
}
@font-face {
  font-family: 'Ponmath Math Italic';
  src: url(../fonts/stix-two-text-italic.woff2?v=2) format('woff2');
  font-style: italic; font-weight: 400 700; font-display: swap;
}

/* ---------------------------------------------------------------- tokens: shared */

:root {
  --brand-font-display: 'Pantheon Text', 'Ponmath Math', Georgia, 'Times New Roman', serif;
  --brand-font-body: 'Pantheon Text', 'Ponmath Math', Georgia, 'Times New Roman', serif;
  --brand-font-label: 'Favorit Mono', 'Ponmath Math', ui-monospace, SFMono-Regular, Menlo, monospace;
  --brand-font-initial: 'Old London', 'Pantheon Text', Georgia, serif;
  --brand-font-math: 'Ponmath Math Italic', 'Pantheon Text', Georgia, serif;

  --brand-radius: 0;            /* colosseum is square: frames, buttons, inputs, media */
  --brand-radius-pill: 999px;   /* only dots and the live pulse */

  --brand-space-2xs: .25rem;
  --brand-space-xs: .5rem;
  --brand-space-sm: .75rem;
  --brand-space-md: 1rem;
  --brand-space-lg: 1.5rem;
  --brand-space-xl: 2rem;
  --brand-space-2xl: 3rem;
  --brand-space-3xl: 4.5rem;
  --brand-space-4xl: 7rem;

  --brand-transition-fast: .16s ease;
  --brand-transition-base: .22s ease;

  --brand-shell-max: 1280px;    /* content 1216 + 2 x 32 gutter, as colosseum at 1440 */
  --brand-shell-narrow: 760px;  /* reading pages: docs, learn lessons, proposal text */
  --brand-gutter: 16px;         /* 320 to 599 */
  --brand-nav-height: 64px;
  --brand-tap: 44px;            /* minimum tap target */

  --brand-footer-bg: #750000;
  --brand-footer-border: #9d0000;
  --brand-footer-text: #ffffff;
  --brand-footer-text-muted: #d4d4d4;
}

/* ---------------------------------------------------------------- tokens: light (default, colosseum's light) */

:root,
:root[data-theme='light'] {
  --brand-bg: #f5f5f5;
  --brand-bg-elevated: #f0f0f0;
  --brand-bg-muted: #f7f7f7;
  --brand-bg-strong: #f5f5f5;
  --brand-bg-hover: #efefef;
  --brand-bg-inverse: #0a0a0a;

  --brand-border: #d4d4d4;
  --brand-border-primary: #c7c7c7;
  --brand-border-subtle: #e5e5e5;
  --brand-border-strong: #a1a1a1;
  --brand-border-active: #860000;

  --brand-text-primary: #262626;
  --brand-text-secondary: #525252;
  --brand-text-ink: #191817;
  --brand-text-body: #45423b;
  --brand-text-muted: #666666;    /* colosseum's #707070 is 4.35:1 on #f0f0f0; #666 passes AA on every light surface */
  --brand-text-inverse: #f5f5f5;
  --brand-text-on-accent: #ffffff;

  --brand-accent: #c00000;
  --brand-accent-strong: #9d0000;
  --brand-accent-readable: #9d0000;
  --brand-accent-readable-soft: #c00000;
  --brand-accent-link: #a02218;
  --brand-accent-hover: #860000;
  --brand-action-bg: #c00000;
  --brand-action-bg-hover: #9d0000;
  --brand-accent-soft: rgba(192, 0, 0, .08);
  --brand-focus: rgba(192, 0, 0, .3);

  --brand-danger: #c00000;
  --brand-feedback-positive: #1a7f55;
  --brand-feedback-positive-soft: rgba(26, 127, 85, .1);
  --brand-feedback-negative: #b42318;
  --brand-feedback-warning: #8a5a00;

  --brand-logo-surface: #262626;
  --brand-decorative-art-opacity: 1;
  --brand-art-filter: none;       /* engraved grey art on paper */
  --brand-scrim: rgba(25, 24, 23, .48);
  --brand-floating-shadow: 0 10px 30px -18px rgba(25, 24, 23, .45);

  color-scheme: light;
}

/* ---------------------------------------------------------------- tokens: dark (colosseum's dark) */

:root[data-theme='dark'] {
  --brand-bg: #1c1c1c;
  --brand-bg-elevated: #2b2b2b;
  --brand-bg-muted: #242424;
  --brand-bg-strong: #1c1c1c;
  --brand-bg-hover: #333333;
  --brand-bg-inverse: #e5e5e5;

  --brand-border: #616161;
  --brand-border-primary: #616161;
  --brand-border-subtle: #404040;
  --brand-border-strong: #808080;
  --brand-border-active: #e60f0f;

  --brand-text-primary: #fafafa;
  --brand-text-secondary: #c7c7c7;
  --brand-text-ink: #fafafa;
  --brand-text-body: #c7c7c7;
  --brand-text-muted: #a1a1a1;
  --brand-text-inverse: #1c1c1c;
  --brand-text-on-accent: #ffffff;

  --brand-accent: #ed3131;
  --brand-accent-strong: #e60f0f;
  --brand-accent-readable: #f75e5e;
  --brand-accent-readable-soft: #f75e5e;
  --brand-accent-link: #ff6868;
  --brand-accent-hover: #ff8585;
  --brand-action-bg: #df1717;
  --brand-action-bg-hover: #c00000;
  --brand-accent-soft: rgba(237, 49, 49, .1);
  --brand-focus: rgba(237, 49, 49, .34);

  --brand-danger: #ed3131;
  --brand-feedback-positive: #4ade80;
  --brand-feedback-positive-soft: rgba(74, 222, 128, .1);
  --brand-feedback-negative: #fb7185;
  --brand-feedback-warning: #f2b544;

  --brand-logo-surface: #242424;
  --brand-decorative-art-opacity: 1;
  --brand-art-filter: invert(.87); /* grey line on paper becomes a soft grey line on dark; white fills turn dark */
  --brand-scrim: rgba(0, 0, 0, .62);
  --brand-floating-shadow: 0 10px 30px -18px rgba(0, 0, 0, .9);

  color-scheme: dark;
}

@media (min-width: 600px) { :root { --brand-gutter: 24px; --brand-nav-height: 72px; } }
@media (min-width: 1024px) { :root { --brand-gutter: 32px; } }

/* ---------------------------------------------------------------- reset */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--brand-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--brand-bg);
  color: var(--brand-text-primary);
  font-family: var(--brand-font-body);
  font-size: 16px;
  line-height: 1.5;
  font-optical-sizing: auto;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, ul, ol, dl, dd, pre { margin: 0; }
h1, h2, h3, h4, h5, h6 { font-weight: 400; font-size: inherit; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg, video, canvas, picture { display: block; max-width: 100%; }
img, video { height: auto; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 0; }
button:disabled { cursor: default; }
input, textarea, select { border-radius: 0; }
table { border-collapse: collapse; border-spacing: 0; }
hr { border: 0; border-top: 1px solid var(--brand-border-subtle); margin: 0; }
[hidden] { display: none !important; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 3px;
}
:where(input, select, textarea):focus-visible { outline-offset: 0; }

::selection { background: var(--brand-accent); color: var(--brand-text-on-accent); }

/* text links inside running copy */
.prose a, a.link {
  color: var(--brand-accent-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--brand-transition-fast);
}
.prose a:hover, a.link:hover { color: var(--brand-accent-hover); }
/* the reset makes svg a block: an icon inside a running link must stay on the link's last line */
.prose a svg, a.link svg { display: inline-block; vertical-align: -1px; }

/* ---------------------------------------------------------------- type scale (colosseum's) */

/* headline: hero 52/60 on phones, 64/72 from 768 */
.display {
  font-family: var(--brand-font-display);
  font-weight: 400;
  color: var(--brand-text-primary);
  letter-spacing: -.03em;
  line-height: 1.3;
  text-wrap: balance;
}
.display--hero { font-size: clamp(2.5rem, 1.8rem + 3.2vw, 4rem); line-height: 1.125; letter-spacing: -.04em; }
.display--section { font-size: clamp(2rem, 1.6rem + 1.6vw, 2.5rem); line-height: 1.3; }
.display--sub { font-size: clamp(1.375rem, 1.2rem + .7vw, 1.75rem); line-height: 1.3; letter-spacing: -.02em; }
.display--card { font-size: 1.5rem; line-height: 1.333; letter-spacing: -.01em; }

/* the illuminated first letter: Old London, accent strong, 1.1em, wrap the first letter of a headline */
.initial {
  font-family: var(--brand-font-initial);
  font-size: 1.1em;
  font-weight: 400;
  letter-spacing: .015em;
  color: var(--brand-accent-strong);
}
:root[data-theme='dark'] .initial { color: var(--brand-accent-readable); }

.lede {
  color: var(--brand-text-secondary);
  font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
  line-height: 1.5;
  text-wrap: pretty;
}
.body { color: var(--brand-text-secondary); font-size: 1rem; line-height: 1.5; }
.small { font-size: .875rem; line-height: 1.5; color: var(--brand-text-secondary); }

/* serif small caps label: "BUILDERS IN THE ARENA", "FEATURED COMPANIES" */
.caps {
  font-family: var(--brand-font-body);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand-text-secondary);
}

/* mono label: "LIVE NOW", "COHORT 1", counters */
.label {
  font-family: var(--brand-font-label);
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--brand-text-muted);
}
.label--md { font-size: 12px; line-height: 14px; letter-spacing: .08em; }
.label--sm { font-size: 9px; line-height: 14px; letter-spacing: .06em; }
.label--xs { font-size: 7px; line-height: 10px; letter-spacing: .08em; }
.label--accent { color: var(--brand-accent-readable); }
.label--ink { color: var(--brand-text-primary); }

/* numbers that change: tabular so digits do not jump */
.num { font-variant-numeric: tabular-nums lining-nums; }
.mono { font-family: var(--brand-font-label); font-variant-numeric: tabular-nums; }

/* hashes, addresses, tx ids: mono, wraps anywhere, never widens the page */
.hash {
  text-transform: none;
  font-family: var(--brand-font-label);
  font-size: .8125rem;
  letter-spacing: .02em;
  overflow-wrap: anywhere;
  word-break: break-all;
}

/* typeset math: <span class="math"><var>x</var><sup>3</sup> + ...</span>; long equations get their own scroll line */
.math { font-family: var(--brand-font-body); font-variant-numeric: lining-nums; white-space: nowrap; }
.math var { font-family: var(--brand-font-math); font-style: italic; padding-right: .04em; }
.math sup { font-size: .62em; vertical-align: .62em; line-height: 0; }
.math-line {
  display: block;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  white-space: nowrap;
  max-width: 100%;
}
.math-line::-webkit-scrollbar { display: none; }

/* running text blocks (docs, lessons) */
.prose { color: var(--brand-text-body); font-size: 1.0625rem; line-height: 1.65; max-width: 68ch; }
.prose > * + * { margin-top: 1em; }
.prose h2 { font-family: var(--brand-font-display); font-size: 1.75rem; line-height: 1.3; letter-spacing: -.02em; color: var(--brand-text-primary); margin-top: 2em; }
.prose h3 { font-family: var(--brand-font-display); font-size: 1.25rem; line-height: 1.4; color: var(--brand-text-primary); margin-top: 1.6em; }
.prose ul { padding-left: 1.2em; list-style: none; }
.prose li { position: relative; }
.prose li + li { margin-top: .4em; }
.prose ul > li::before {
  content: '';
  position: absolute; left: -1.05em; top: .62em;
  width: 5px; height: 5px;
  border: 1px solid var(--brand-border-strong);
  transform: rotate(45deg);
}
.prose ol { padding-left: 1.4em; list-style: decimal; }
.prose code { font-family: var(--brand-font-label); font-size: .875em; background: var(--brand-bg-elevated); padding: .05em .3em; }
.prose blockquote { border-left: 1px solid var(--brand-border-strong); padding-left: 1em; color: var(--brand-text-secondary); }

/* ---------------------------------------------------------------- layout */

.shell { width: 100%; max-width: var(--brand-shell-max); margin-inline: auto; padding-inline: var(--brand-gutter); }
.shell--narrow { max-width: calc(var(--brand-shell-narrow) + 2 * var(--brand-gutter)); }
.section { position: relative; padding-block: clamp(4rem, 2.5rem + 5vw, 7rem); }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 3vw, 4rem); }
.stack { display: flex; flex-direction: column; gap: var(--brand-space-md); }
.stack--sm { gap: var(--brand-space-xs); }
.stack--lg { gap: var(--brand-space-lg); }
.stack--xl { gap: var(--brand-space-2xl); }
.stack > .btn:not(.btn--block), .stack > .wallet:not(.wallet--block) { align-self: flex-start; }
.row { display: flex; align-items: center; gap: var(--brand-space-sm); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--center { justify-content: center; }
.center { text-align: center; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--brand-space-md); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
}

/* decorative engraved art: never interactive, softened in dark */
.art {
  opacity: var(--brand-decorative-art-opacity);
  filter: var(--brand-art-filter);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

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

/* skip link: clipped (not pushed off canvas, which would widen the scroll area) until focused */
.skip {
  position: absolute; left: 12px; top: 12px; z-index: 200;
  padding: 10px 16px;
  background: var(--brand-action-bg); color: var(--brand-text-on-accent);
  clip-path: inset(50%);
  opacity: 0;
}
.skip:focus { clip-path: none; opacity: 1; }

body.is-locked { overflow: hidden; }

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