/* Tally — the website.
 *
 * The palette and the three typefaces are LIFTED FROM src/ui/tokens.css, not chosen here. The site
 * and the extension should read as one thing, and the token file is the authority: its values carry
 * measured WCAG ratios in their comments and are pinned by src/ui/tokens.test.ts. Copied rather than
 * imported because what deploys is the `site/` tree alone, with no build step to resolve a path into
 * src/ — so if a colour changes there, change it here too. Only the tokens the site actually draws
 * are copied; the app has many more.
 *
 * AMBER IS THE ONLY WARM COLOUR, and on this site it is spent in exactly one place: the hero's
 * unlogged figure. That is the same discipline the app keeps, and the same argument — the eye should
 * go to the gap.
 */

:root {
  color-scheme: light dark;

  --bg: #f4f6fa;
  --panel: #ffffff;
  --well: #edf1f7;
  --ink: #16253d;
  --muted: #566780;
  --line: #dde3ec;
  --line-strong: #7b8aa3;

  --accent: #0052cc;
  --accent-deep: #003d99;
  --accent-tint: #e6effc;
  --accent-on-tint: #0747a6;

  --warn: #d97706;
  --warn-text: #8a4b08;
  --go-text: #05614a;
  --go-bg: #e1f5ee;
  --go-line: #b4e3d1;

  /* The rail. Identical in both themes — the one surface that never flips, which is what makes it
     read as the brand rather than as chrome. */
  --rail-bg: #16213a;
  --rail-fg: #9fb0c9;
  --rail-muted: #8a99b0;
  --rail-brand: #ffffff;
  --rail-line: #2a3852;
  --rail-attention: #d97706;

  --focus: #0052cc;

  --font-display: "Bricolage Grotesque", "Hanken Grotesk", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Space Mono ships 400 and 700 ONLY — never weight it 500 or 600, or the browser synthesises a
     smeared bold on numerals that are already the hardest thing on screen to read. */
  --font-num: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r-md: 9px;
  --r-lg: 11px;
  --r-xl: 14px;
  --r-pill: 999px;

  --measure: 68ch;
  --pad: clamp(20px, 5vw, 40px);
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* Dark. Redefines TOKENS ONLY — nothing below this file's token blocks names a colour directly, so
   both themes resolve as a set. Guarded so an explicit light choice beats a dark OS. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1524;
    --panel: #16213a;
    --well: #1b2842;
    --ink: #e8eef8;
    --muted: #a8b8d0;
    --line: #2a3852;
    --line-strong: #61748f;

    --accent: #4c9aff;
    --accent-deep: #85b8ff;
    --accent-tint: #1c2c4d;
    --accent-on-tint: #a8cbff;

    --warn: #e8a33d;
    --warn-text: #f0b968;
    --go-text: #7fd8bb;
    --go-bg: #14352c;
    --go-line: #245c4b;

    --focus: #4c9aff;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0e1524;
  --panel: #16213a;
  --well: #1b2842;
  --ink: #e8eef8;
  --muted: #a8b8d0;
  --line: #2a3852;
  --line-strong: #61748f;

  --accent: #4c9aff;
  --accent-deep: #85b8ff;
  --accent-tint: #1c2c4d;
  --accent-on-tint: #a8cbff;

  --warn: #e8a33d;
  --warn-text: #f0b968;
  --go-text: #7fd8bb;
  --go-bg: #14352c;
  --go-line: #245c4b;

  --focus: #4c9aff;
}

/* ---- base ------------------------------------------------------------------------------------ */

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

body {
  margin: 0;
  /* Explicit, from a token: a transparent body borrows whatever ground the host paints. */
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  /* REQUIRED, not tidiness. The <img> tags carry width/height attributes so the browser can
     reserve the right space before the file arrives. Without `height: auto` those attributes stay
     in force as a fixed height while max-width shrinks the width — so a 1622x1252 screenshot in a
     1000px column rendered 1000x1252, stretched vertically by a third. */
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-deep);
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}

code {
  font-family: var(--font-num);
  font-size: 0.86em;
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.08em 0.34em;
  /* break-word, not anywhere: `anywhere` split /rest/api/3/myself after "mysel". */
  overflow-wrap: break-word;
  /* A chip that does wrap gets its border on both fragments rather than one open-ended box. */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.wrap {
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: var(--pad);
}

.prose {
  max-width: var(--measure);
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: var(--pad);
  top: 10px;
  z-index: 10;
  background: var(--panel);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
}

/* ---- masthead -------------------------------------------------------------------------------- */

.masthead {
  background: var(--rail-bg);
  color: var(--rail-fg);
  border-bottom: 1px solid var(--rail-line);
}

.masthead .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 62px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--rail-brand);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.brand:hover {
  color: var(--rail-brand);
}

.brand img {
  width: 26px;
  height: 26px;
}

.masthead nav {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.masthead nav a {
  color: var(--rail-fg);
  text-decoration: none;
  font-size: 15px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
}

.masthead nav a:hover {
  color: var(--rail-brand);
  background: var(--rail-line);
}

.masthead nav a[aria-current="page"] {
  color: var(--rail-brand);
  background: var(--rail-line);
}

/* ---- hero ------------------------------------------------------------------------------------ */

.hero {
  background: var(--rail-bg);
  color: var(--rail-fg);
  padding-block: clamp(48px, 9vw, 92px) clamp(40px, 8vw, 76px);
}

.hero h1 {
  color: var(--rail-brand);
  font-size: clamp(38px, 6.2vw, 62px);
  letter-spacing: -0.025em;
  max-width: 16ch;
}

.hero p {
  max-width: 54ch;
  font-size: clamp(17px, 1.9vw, 20px);
  margin: 22px 0 0;
}

/* The product's whole argument, set as the product sets it: a Space Mono figure, and the only
   amber on the page. Everything else here is quiet so this is what the eye lands on. */
.gap-line {
  margin-top: 34px;
  padding: 18px 22px;
  border: 1px solid var(--rail-line);
  border-left: 3px solid var(--rail-attention);
  border-radius: var(--r-lg);
  background: #111a2e;
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.gap-line b {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: clamp(22px, 3.4vw, 30px);
  color: var(--rail-attention);
  font-variant-numeric: tabular-nums;
}

.gap-line span {
  color: var(--rail-muted);
  font-size: 16px;
}

.cta-row {
  margin-top: 34px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: var(--r-md);
  text-decoration: none;
  border: 1px solid transparent;
  display: inline-block;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #ffffff;
}

.btn-ghost {
  color: var(--rail-brand);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  color: var(--rail-brand);
  background: var(--rail-line);
}

/* A store link that has no URL yet is a disabled control, not a live link that 404s. */
.btn[aria-disabled="true"] {
  background: transparent;
  color: var(--rail-muted);
  border-color: var(--rail-line);
  cursor: default;
  pointer-events: none;
}

.cta-note {
  color: var(--rail-muted);
  font-size: 14px;
  margin: 14px 0 0;
}

/* ---- sections -------------------------------------------------------------------------------- */

section {
  padding-block: clamp(44px, 7vw, 76px);
}

section + section {
  border-top: 1px solid var(--line);
}

section h2 {
  font-size: clamp(26px, 3.6vw, 34px);
  letter-spacing: -0.015em;
}

section h2 + p,
section h2 + .prose {
  margin-top: 16px;
}

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

.shot {
  margin-top: 30px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--panel);
}

figure {
  margin: 0;
}

/* Two screenshots in a row need air between them, or the caption of the first reads as a heading
   for the second. */
figure + figure {
  margin-top: 40px;
}

figcaption {
  color: var(--muted);
  font-size: 14.5px;
  margin-top: 12px;
  max-width: var(--measure);
}

/* ---- the two honest columns ------------------------------------------------------------------ */

.cols {
  margin-top: 30px;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 24px 26px;
}

.card h3 {
  font-size: 19px;
  margin-bottom: 14px;
}

.card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 11px;
}

.card li {
  padding-left: 26px;
  position: relative;
  font-size: 16px;
}

.card li::before {
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-num);
  font-weight: 700;
}

.does li::before {
  content: "+";
  color: var(--go-text);
}

.doesnt li::before {
  content: "\2013"; /* en dash — an absence, not a failure */
  color: var(--muted);
}

.limits {
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 26px 28px;
  margin-top: 24px;
  max-width: var(--measure);
}

.limits h3 {
  font-size: 18px;
}

.limits ul {
  margin: 14px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.limits li {
  font-size: 16px;
}

/* ---- prose pages (the privacy policy) -------------------------------------------------------- */

.doc {
  padding-block: clamp(36px, 6vw, 60px);
}

/* The measure is applied to the text elements, NOT to this container: a table constrained to 68ch
   wrapped every endpoint mid-path. Tables and their scroller get the full column instead. */
.doc-body > p,
.doc-body > ul,
.doc-body > h1,
.doc-body > h2,
.doc-body > h3,
.doc-body > h4,
.doc-body > hr {
  max-width: var(--measure);
}

.doc-body h1 {
  font-size: clamp(30px, 4.4vw, 40px);
  letter-spacing: -0.022em;
}

.doc-body h1 + .lead {
  margin-top: 10px;
}

.doc-body h2 {
  font-size: clamp(23px, 3vw, 29px);
  margin-top: 46px;
  letter-spacing: -0.012em;
}

.doc-body h3 {
  font-size: 19px;
  margin-top: 34px;
}

.doc-body h2:first-child,
.doc-body h3:first-child {
  margin-top: 0;
}

.doc-body p {
  margin: 16px 0;
}

.doc-body .lead {
  color: var(--muted);
  font-size: 15.5px;
}

.doc-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 34px 0;
}

.doc-body ul {
  padding-left: 20px;
  display: grid;
  gap: 9px;
}

/* Tables can be wider than the measure, so they scroll in their own box rather than the page. */
.scroller {
  overflow-x: auto;
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
}

.doc-body table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: 15px;
}

.doc-body th,
.doc-body td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.doc-body thead th {
  background: var(--well);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.doc-body tbody tr:last-child td {
  border-bottom: 0;
}

/* ---- footer ---------------------------------------------------------------------------------- */

footer {
  background: var(--rail-bg);
  color: var(--rail-muted);
  padding-block: 34px;
  font-size: 15px;
}

footer .wrap {
  display: flex;
  gap: 10px 26px;
  flex-wrap: wrap;
  align-items: center;
}

footer a {
  color: var(--rail-fg);
}

footer a:hover {
  color: var(--rail-brand);
}

footer .spacer {
  margin-left: auto;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
