@font-face {
  font-family: "Inter";
  src: url("assets/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #FFFFFF;
  --tint: #F6F7F9;
  --ink: #14171A;
  --text: #2F343A;
  --muted: #5F6770;
  --rule: #E6E9EE;
  --accent: #0B5CE8;
  --accent-hover: #0949BA;
  --accent-soft: rgba(11, 92, 232, 0.08);

  /* The app's classic palette, darkened where it would miss 4.5:1 on white. */
  --sm-operand: #2F343A;
  --sm-operator: #0B5CE8;
  --sm-keyword: #687079;
  --sm-unit: #257A4D;
  --sm-variable: #6E56CF;
  --sm-result: #B4532F;
  --sm-error: #CC3B33;

  --radius: 14px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --wrap: 1080px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { color: var(--ink); text-wrap: balance; margin: 0; }
p { margin: 0; }

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; background: var(--bg); padding: 8px 12px; z-index: 10; }

/* ---------- header ---------- */

.top { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; font-size: 18px; color: var(--ink); letter-spacing: -0.01em; min-height: 44px; }
.brand .icon { width: 34px; height: 34px; }
.top nav { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.top nav a:not(.btn) { color: var(--muted); padding: 10px 12px; border-radius: 8px; }
.top nav a:not(.btn):hover { color: var(--ink); background: var(--tint); }
.top nav a[aria-current="page"] { color: var(--ink); }

/* ---------- icon ---------- */

.icon { display: inline-block; flex: none; aspect-ratio: 1; }
.icon svg { display: block; width: 100%; height: 100%; overflow: visible; }
.icon noscript img { width: 100%; height: 100%; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px; border-radius: 12px;
  border: 1px solid var(--rule); background: var(--bg); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 16px; cursor: pointer;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease), transform 140ms var(--ease);
}
.btn:hover { border-color: #CBD1D9; }
.btn:active { transform: translateY(1px); }
.btn.buy { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.btn.buy:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 15px; border-radius: 10px; }
.btn .price { font-weight: 500; opacity: 0.92; }
.btn.big { min-height: 56px; padding: 0 30px; font-size: 17px; border-radius: 14px; }

.buyline { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; }
.platforms { font-size: 14px; color: var(--muted); }

/* ---------- live calculator ---------- */

.sm-calc {
  --lh: 30px;
  --pad-y: 24px;
  --pad-x: 28px;
  --res-w: 36%;
  --sm-bg: #FFFFFF;
  --sm-text: #2F343A;
  --sm-heading: var(--ink);
  --sm-rule: var(--rule);
  --sm-caret: var(--accent);
  position: relative;
  background: var(--sm-bg);
  border: 1px solid var(--sm-rule);
  border-radius: var(--radius);
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
  box-shadow: 0 1px 2px rgba(20, 23, 26, 0.04), 0 24px 60px -24px rgba(16, 42, 110, 0.22);
  text-align: left;
}
.sm-body {
  position: relative;
  height: calc(var(--sm-rows, 8) * var(--lh) + 2 * var(--pad-y));
  font-family: "Inter", system-ui, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: var(--lh);
  font-variant-numeric: tabular-nums;
  transition: height 160ms var(--ease);
}
.sm-mirror, .sm-input {
  position: absolute; left: 0; top: 0;
  width: calc(100% - var(--res-w)); height: 100%;
  padding: var(--pad-y) 12px var(--pad-y) var(--pad-x);
  margin: 0;
  font: inherit; line-height: inherit; letter-spacing: 0;
  white-space: pre;
  tab-size: 4;
}
.sm-mirror { overflow: hidden; color: var(--sm-text); pointer-events: none; }
.sm-mirror-inner { will-change: transform; }
.sm-line { display: block; min-height: var(--lh); }
.sm-input {
  background: transparent; border: 0; outline: 0; resize: none;
  color: transparent; caret-color: var(--sm-caret);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  border-radius: var(--radius) 0 0 var(--radius);
}
.sm-input::-webkit-scrollbar { display: none; }
.sm-input::selection { background: rgba(11, 92, 232, 0.18); color: transparent; }
.sm-results {
  position: absolute; right: 0; top: 0; width: var(--res-w);
  padding: var(--pad-y) calc(var(--pad-x) - 8px) var(--pad-y) 8px;
}
.sm-row { height: var(--lh); display: flex; align-items: center; justify-content: flex-end; min-width: 0; }
.sm-res {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--sm-result);
  min-height: 26px; padding: 0 8px; border-radius: 7px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background-color 120ms var(--ease);
}
.sm-res.soft { font-weight: 400; }
.sm-res:hover { background: color-mix(in srgb, var(--sm-result) 12%, transparent); }
.sm-res.copied { color: var(--sm-keyword); }
.sm-res.fresh { animation: sm-in 140ms var(--ease); }
@keyframes sm-in { from { opacity: 0; } to { opacity: 1; } }
.sm-err { width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--sm-error); opacity: 0.7; }

.sm-num, .sm-cur, .sm-fn { color: var(--sm-operand); }
.sm-op { color: var(--sm-operator); }
.sm-kw, .sm-label, .sm-comment { color: var(--sm-keyword); }
.sm-unit { color: var(--sm-unit); }
.sm-var { color: var(--sm-variable); }
.sm-header { color: var(--sm-heading); font-weight: 650; }

@media (max-width: 560px) {
  .sm-calc { --lh: 28px; --pad-y: 18px; --pad-x: 18px; --res-w: 40%; }
  .sm-body { font-size: 15px; }
}

/* ---------- examples (features, how-to) ---------- */

.ex { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; min-width: 0; }
.ex code { font: inherit; display: flex; flex-direction: column; min-width: 0; color: var(--sm-operand); }
.ex code .sm-line { min-height: 0; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.ex output { color: var(--sm-result); font-weight: 600; white-space: nowrap; align-self: flex-end; }

.features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature-link {
  display: flex; flex-direction: column; gap: 14px; height: 100%;
  padding: 22px 22px 20px; border: 1px solid var(--rule); border-radius: var(--radius);
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.feature-link:hover { border-color: #CBD1D9; box-shadow: 0 10px 30px -18px rgba(16, 42, 110, 0.25); }
.feature-title { font-size: 14px; font-weight: 600; color: var(--muted); }
.feature .ex { font-size: 18px; line-height: 1.6; padding-top: 12px; border-top: 1px solid var(--rule); }
.feature-note { font-size: 14px; color: var(--muted); line-height: 1.45; }
@media (max-width: 880px) { .features { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .features { grid-template-columns: minmax(0, 1fr); gap: 12px; } }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.section-head h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.02em; font-weight: 700; }
.more { color: var(--accent); font-weight: 600; font-size: 16px; padding: 10px 0; }
.more:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- video ---------- */

.video {
  position: relative; margin: 0; border-radius: var(--radius); overflow: hidden;
  background: #FFFFFF; border: 1px solid var(--rule);
  aspect-ratio: 16 / 9;
}
.video video { display: block; width: 100%; height: 100%; object-fit: cover; }
.video-toggle {
  position: absolute; right: 14px; bottom: 14px;
  min-height: 40px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--rule); background: rgba(255, 255, 255, 0.92); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}

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

.foot { border-top: 1px solid var(--rule); margin-top: 96px; }
.foot .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-top: 28px; padding-bottom: 40px; font-size: 14px; color: var(--muted); }
.foot a { padding: 8px 0; }
.foot a:hover { color: var(--ink); }
.foot .grow { flex: 1; }
.promise { font-size: 14px; color: var(--muted); }

/* ---------- how-to ---------- */

.howto-hero { padding: 48px 0 32px; }
.howto-hero h1 { font-size: clamp(34px, 5vw, 52px); letter-spacing: -0.03em; font-weight: 750; line-height: 1.08; }
.howto-hero p { margin-top: 14px; max-width: 60ch; color: var(--muted); }
.toc { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.toc a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--rule); border-radius: 999px; font-size: 15px; color: var(--text); }
.toc a:hover { border-color: #CBD1D9; color: var(--ink); }
.howto-section { padding: 40px 0 8px; margin-top: 32px; scroll-margin-top: 16px; }
.howto-section h2 { font-size: 24px; letter-spacing: -0.015em; margin-bottom: 18px; }
.ex-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; }
.ex-row { padding: 14px 0; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 4px; }
/* Lines only between rows: the first row of the grid has none. */
.ex-list > .ex-row:nth-child(-n+2) { border-top: 0; }
.ex-row .ex { font-size: 17px; }
.ex-note { font-size: 14px; color: var(--muted); }
@media (max-width: 720px) {
  .ex-list { grid-template-columns: minmax(0, 1fr); }
  .ex-list > .ex-row:nth-child(2) { border-top: 1px solid var(--rule); }
}
.keys { border-collapse: collapse; width: 100%; font-size: 16px; }
.keys td { padding: 12px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.keys td:first-child { width: 42%; padding-right: 16px; white-space: nowrap; }
kbd { font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); background: var(--tint); border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; }
@media (max-width: 560px) {
  .keys, .keys tbody, .keys tr, .keys td { display: block; width: auto; }
  .keys tr { padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .keys td { padding: 0; border: 0; }
  .keys td:first-child { width: auto; white-space: normal; padding: 0 0 6px; }
  .keys td:last-child { color: var(--muted); font-size: 15px; }
}

@media (max-width: 400px) {
  .top nav { gap: 4px; }
  .top nav a:not(.btn) { padding: 10px 8px; }
  .brand > span:not(.icon), .brand-name { display: none; }
}

/* ---------- calculator theme picker ---------- */

.themes { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.themes-name { margin-right: auto; font-size: 14px; color: var(--muted); min-width: 0; }
.themes-name::before { content: "Theme: "; }
.swatch { position: relative; display: inline-grid; cursor: pointer; }
.swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch-face {
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--sw-dot) 0 4px, transparent 4.5px), var(--sw-bg);
  box-shadow: inset 0 0 0 1px rgba(20, 23, 26, 0.16);
  transition: box-shadow 120ms var(--ease);
}
.swatch:hover .swatch-face { box-shadow: inset 0 0 0 1px rgba(20, 23, 26, 0.35); }
.swatch input:checked + .swatch-face { box-shadow: inset 0 0 0 1px rgba(20, 23, 26, 0.16), 0 0 0 2px #FFFFFF, 0 0 0 4px var(--ink); }
.swatch input:focus-visible + .swatch-face { outline: 2px solid var(--accent); outline-offset: 5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- platform marks ---------- */

.os { display: inline-flex; align-items: center; gap: 18px; font-size: 15px; color: var(--muted); }
.os span { display: inline-flex; align-items: center; gap: 7px; }
.os svg { width: 17px; height: 17px; fill: currentColor; flex: none; }

@media (max-width: 560px) {
  .foot .wrap { gap: 4px 20px; }
  .foot .promise { order: -1; flex-basis: 100%; margin-bottom: 8px; }
  .foot .wrap > span:first-of-type { flex-basis: 100%; order: 2; margin-top: 4px; }
}

.keys tr:last-child td, .keys tr:last-child { border-bottom: 0; }


/* ---------- support and privacy ---------- */

.prose { max-width: 68ch; padding: 48px 0 0; }
.prose h1 { font-size: clamp(34px, 5vw, 52px); letter-spacing: -0.03em; font-weight: 750; line-height: 1.08; }
.prose .updated { margin-top: 12px; font-size: 14px; color: var(--muted); }
.prose .lede { margin-top: 28px; font-size: 19px; color: var(--ink); }
.prose h2 { margin-top: 44px; font-size: 21px; letter-spacing: -0.01em; line-height: 1.3; }
.prose h2 + p, .prose h2 + ul { margin-top: 10px; }
.prose p + p, .prose ul + p, .prose p + ul { margin-top: 12px; }
.prose ul { margin-bottom: 0; padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent-hover); }
.prose code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.9em; background: var(--tint); border-radius: 5px; padding: 1px 5px; white-space: nowrap; }
