/* Inter and JetBrains Mono (SIL Open Font License 1.1; see fonts/), variable weight 400-700. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Colours follow two of Reckon's own themes: Dune (light) and Graphite (dark). */
:root {
  color-scheme: light dark;

  --bg: #f6eedf;
  --surface: #fbf6ec;
  --sunk: #efe4cf;
  --text: #3b2f26;
  --muted: #726251;
  --border: #dfcfb3;
  --accent: #a3401f;
  --result: #2c6a47;
  --label: #a3401f;
  --header: #a3401f;
  --comment: #9a8670;
  --cursor: #a8452a;
  --button: #3b2f26;
  --button-text: #fbf6ec;

  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
  --page: 68rem;

  @media (prefers-color-scheme: dark) {
    --bg: #131416;
    --surface: #18191b;
    --sunk: #1d1f22;
    --text: #f2f2f2;
    --muted: #9a9ea5;
    --border: #2e3035;
    --accent: #7fe0a6;
    --result: #7fe0a6;
    --label: #f2c46d;
    --header: #ff9b73;
    --comment: #7f858d;
    --cursor: #8fb5ff;
    --button: #7fe0a6;
    --button-text: #10261a;
  }
}

:root {
  /* The theme switch sets <meta name="color-scheme">; mirror it here so CSS follows. */
  &:has(> head > meta[name="color-scheme"][content="light"]) { color-scheme: light; }
  &:has(> head > meta[name="color-scheme"][content="dark"]) { color-scheme: dark; }
}

/* Where light-dark() exists, colours follow color-scheme, so the switch works.
   Older browsers keep the media-query colours above and follow the system. */
@supports (color: light-dark(white, black)) {
  :root {
    --bg: light-dark(#f6eedf, #131416);
    --surface: light-dark(#fbf6ec, #18191b);
    --sunk: light-dark(#efe4cf, #1d1f22);
    --text: light-dark(#3b2f26, #f2f2f2);
    --muted: light-dark(#726251, #9a9ea5);
    --border: light-dark(#dfcfb3, #2e3035);
    --accent: light-dark(#a3401f, #7fe0a6);
    --result: light-dark(#2c6a47, #7fe0a6);
    --label: light-dark(#a3401f, #f2c46d);
    --header: light-dark(#a3401f, #ff9b73);
    --comment: light-dark(#9a8670, #7f858d);
    --cursor: light-dark(#a8452a, #8fb5ff);
    --button: light-dark(#3b2f26, #7fe0a6);
    --button-text: light-dark(#fbf6ec, #10261a);
  }
}

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  @media (prefers-reduced-motion: reduce) { scroll-behavior: auto; }
}

body { margin: 0; }

a { color: inherit; text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }

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

code, kbd, pre { font-family: var(--mono); font-size: 0.92em; }

.wrap { max-width: var(--page); margin-inline: auto; padding-inline: 1rem; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 650;
  font-size: 1.1rem;
  text-decoration: none;
}
.brand img { border-radius: 8px; }
.site-header nav { display: flex; gap: 1.25rem; font-size: 0.95rem; }
.site-header nav a { text-decoration: none; color: var(--muted); }
.site-header nav a:hover { color: var(--text); }
.site-header nav { align-items: center; }

/* Theme switch: shows the theme in use; clicking flips it. */
.theme-toggle {
  display: grid;
  place-items: center;
  min-inline-size: 2rem;
  min-block-size: 2rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .is-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-toggle .is-light { display: none; }
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-toggle .is-dark { display: contents; }
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle .is-light { display: none; }
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle .is-dark { display: contents; }
@supports not (color: light-dark(white, black)) { .theme-toggle { display: none; } }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (width < 34rem) { .site-header nav .optional { display: none; } }

/* Hero */
.hero {
  display: grid;
  gap: 2.5rem;
  align-items: center;
  padding-block: 3rem 4rem;
  @media (width >= 60rem) { grid-template-columns: 0.95fr 1.05fr; padding-block: 4.5rem 5rem; }
}
.hero h1 {
  font-size: clamp(2.2rem, 1.4rem + 2.8vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  text-wrap: balance;
}
.lede { font-size: 1.2rem; color: var(--muted); margin: 0 0 1.75rem; max-width: 32rem; text-wrap: pretty; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.platforms { margin: 1.25rem 0 0; color: var(--muted); font-size: 0.9rem; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-block-size: 2.75rem;
  padding: 0.6rem 1.15rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}
.button.primary { background: var(--button); color: var(--button-text); }
.button.primary:hover { color: var(--button-text); filter: brightness(1.08); }
.button.secondary { border-color: var(--border); background: var(--surface); }

/* A sheet: Reckon's two columns, lines on the left and answers on the right */
.window {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 18px 50px -20px rgb(0 0 0 / 0.35);
  overflow: hidden;
}
.titlebar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  min-block-size: 2.6rem;
  padding: 0.3rem 0.6rem 0.3rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}
.titlebar .dots { display: flex; gap: 6px; }
.titlebar .dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--border); }

.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.85;
  margin: 0;
}
.sheet > div { display: contents; }
.sheet dt, .sheet dd {
  margin: 0;
  min-block-size: 1.85em;
  overflow-wrap: break-word;
}
.sheet dt { padding-inline: 1rem 0.75rem; white-space: pre-wrap; }
.sheet dd {
  padding-inline: 0.75rem 1rem;
  text-align: end;
  white-space: nowrap;
  min-inline-size: 6rem;
  color: var(--result);
  font-weight: 600;
  border-inline-start: 1px solid var(--border);
}
.sheet .h { color: var(--header); font-weight: 650; }
.sheet .l { color: var(--label); }
.sheet .c { color: var(--comment); }
.sheet .caret {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  margin-inline-start: 1px;
  vertical-align: -0.2em;
  background: var(--cursor);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet .caret { animation: none; } }
.sheet > div:first-child > * { padding-block-start: 0.6rem; }
.sheet > div:last-child > * { padding-block-end: 0.6rem; }

/* Small charts drawn in the answer column, as in the app */
.spark { width: 7.5rem; height: 2.4em; vertical-align: middle; overflow: visible; }
.spark .fill { fill: var(--result); }
.spark .stroke { fill: none; stroke: var(--result); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark .dash { fill: none; stroke: var(--muted); stroke-width: 0.8; stroke-dasharray: 2 2; }
.sheet.charts > div > * { padding-block: 0.3rem; }

.demo { position: relative; }
.hero > * { min-width: 0; }
.demo .sheet {
  font-size: 0.85rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 38%);
  align-content: start;
  /* The divider runs to the bottom, below the last line */
  background: linear-gradient(to right, transparent calc(62% - 1px), var(--border) calc(62% - 1px) 62%, transparent 62%);
}
/* Each line reserves the height of its finished text while it is typed */
.demo .sheet dt { display: grid; }
.demo .sheet dt::before { content: attr(data-full); visibility: hidden; grid-area: 1 / 1; }
.demo .sheet dt > span { grid-area: 1 / 1; }

.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs[hidden] { display: none; }
.tabs button {
  flex: none;
  font: inherit;
  font-size: 0.82rem;
  min-block-size: 1.9rem;
  padding: 0 0.8rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--sunk); border-color: var(--border); color: var(--text); font-weight: 600; }
.demo-more {
  display: inline-block;
  margin-block-start: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
}
.demo-more:hover { color: var(--accent); }
/* Fixed answer column, so answers appearing mid-typing never shift the layout */
.demo .sheet dd { overflow: hidden; text-overflow: ellipsis; min-inline-size: 0; }
.replay {
  justify-self: end;
  white-space: nowrap;
  font: inherit;
  font-size: 0.75rem;
  min-block-size: 1.5rem;
  padding: 0 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.replay:hover { color: var(--text); }
.replay[hidden] { display: none; }
@media (width < 34rem) {
  .sheet { font-size: 0.78rem; }
  .tabs { padding-inline: 0.4rem; gap: 0; }
  .tabs button { padding: 0 0.6rem; font-size: 0.78rem; }
  .spark { width: 5.5rem; }
  .sheet dt { padding-inline: 0.7rem 0.5rem; }
  .sheet dd { padding-inline: 0.5rem 0.7rem; }
}

/* Sections */
section { padding-block: 3.5rem; border-top: 1px solid var(--border); }
section h2 {
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem);
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 0.5rem;
}
.section-lede { color: var(--muted); margin: 0 0 2rem; max-width: 40rem; font-size: 1.05rem; }

/* Features */
.features { display: grid; gap: 3rem; }
.feature {
  display: grid;
  gap: 1rem 3rem;
  align-items: center;
  @media (width >= 56rem) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); }
}
.feature h4 { margin: 0 0 0.35rem; font-size: 1.15rem; }
.group {
  margin: 2.5rem 0 1.25rem;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.group:first-of-type { margin-block-start: 0; }
.group-lede { margin: -0.75rem 0 1.5rem; color: var(--muted); max-width: 40rem; }
.group.small { margin-block-start: 2rem; }
.group a { color: inherit; }
.feature p { margin: 0; color: var(--muted); max-width: 30rem; }
.feature .window { box-shadow: none; }
.feature figure { margin: 0; }
.feature img { display: block; width: 100%; height: auto; }

.more {
  display: grid;
  gap: 0.75rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}
.more li { padding-inline-start: 1.1rem; position: relative; color: var(--muted); }
.more li::before { content: "="; position: absolute; inset-inline-start: 0; color: var(--result); font-family: var(--mono); font-weight: 700; }
.muted { color: var(--muted); font-weight: 400; }
.more strong { color: var(--text); font-weight: 600; }

/* Download */
.install {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  margin-block-end: 2rem;
}
.install h4, .downloads h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.cmd {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem 0.35rem 0.35rem 0.9rem;
}
.cmd pre { margin: 0; flex: 1; overflow-x: auto; font-size: 0.85rem; padding-block: 0.4rem; }
.cmd pre::before { content: "$ "; color: var(--muted); user-select: none; }

.copy { position: relative; flex: none; }
.copy-button {
  display: grid;
  place-items: center;
  min-inline-size: 2.25rem;
  min-block-size: 2.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--sunk);
  color: var(--muted);
  cursor: pointer;
}
.copy-button:hover { color: var(--text); }
.copy-button svg { width: 16px; height: 16px; }
.copy-button .done { display: none; }
.copy-button[data-copied] .idle { display: none; }
.copy-button[data-copied] .done { display: block; color: var(--result); }
.tip {
  position: absolute;
  inset-block-end: calc(100% + 6px);
  inset-inline-end: 0;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.tip:not(:empty) { opacity: 1; }

.downloads {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.5rem), 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
.downloads li {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.downloads p { margin: 0 0 0.9rem; color: var(--muted); font-size: 0.92rem; flex: 1; }
.downloads a { font-weight: 600; text-decoration: none; color: var(--accent); }
.downloads a:hover { text-decoration: underline; }

.note {
  margin: 2rem 0 0;
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  background: var(--sunk);
  border: 1px solid var(--border);
  font-size: 0.95rem;
}
.note p { margin: 0 0 0.5rem; }
.note p:last-child { margin: 0; }

/* Open source */
.oss { display: grid; gap: 1.5rem; align-items: center; @media (width >= 50rem) { grid-template-columns: 1fr auto; } }
.oss p { margin: 0 0 0.75rem; max-width: 42rem; color: var(--muted); }

footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}
footer .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }
footer nav { display: flex; gap: 1.25rem; }
