/* Cellwise public site. Tokens first; every colour pair below meets WCAG AA in both themes. */
:root {
  --bg: #F3F7F5; --ink: #12201A; --ink2: #4A5C54; --ink3: #5E6F68;
  --card: #FFFFFF; --hair: rgba(18, 32, 26, .12); --green: #12A150; --green2: #0B7A3B; --btn: #0D8040; --on-green: #fff;
  --tint: color-mix(in srgb, var(--green) 9%, var(--card));
  --blue: #1F64D8; --bad: #C9302C; --gold: #8A6100;
  --cell: #FFFFFF; --cellh: #F2F5F4; --cell-line: #DCE3E0;
  --hue-l: 32%; --hue-bg: .14;
  --radius: 16px; --radius-s: 10px;
  --shadow: 0 1px 2px rgba(16, 40, 30, .06), 0 8px 24px -12px rgba(16, 40, 30, .16);
  --shadow-hover: 0 2px 4px rgba(16, 40, 30, .08), 0 14px 30px -12px rgba(16, 40, 30, .24);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", sans-serif;
  --round: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1512; --ink: #E9F3EE; --ink2: #B0C2BA; --ink3: #8A9C94;
    --card: #142019; --hair: rgba(255, 255, 255, .11); --green: #2FC874; --green2: #4ED68A; --btn: #2FC874; --on-green: #0B1A12;
    --blue: #7AAEFF; --bad: #FF6B70; --gold: #F2C14E; --cell: #16211D; --cellh: #1D2A25; --cell-line: #2A3833;
    --hue-l: 72%; --hue-bg: .2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -12px rgba(0, 0, 0, .5);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 16px 32px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1512; --ink: #E9F3EE; --ink2: #B0C2BA; --ink3: #8A9C94;
  --card: #142019; --hair: rgba(255, 255, 255, .11); --green: #2FC874; --green2: #4ED68A; --btn: #2FC874; --on-green: #0B1A12;
  --blue: #7AAEFF; --bad: #FF6B70; --gold: #F2C14E; --cell: #16211D; --cellh: #1D2A25; --cell-line: #2A3833;
  --hue-l: 72%; --hue-bg: .2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -12px rgba(0, 0, 0, .5);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 16px 32px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 120px; }
html, body { margin: 0; }
body { font: 17px/1.6 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overflow-wrap: break-word; }
h1, h2, h3 { font-family: var(--round); line-height: 1.2; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(1.875rem, 5vw, 2.75rem); margin: .3em 0 .25em; }
h2 { font-size: 1.5rem; margin: 1.8em 0 .55em; }
h3 { font-size: 1.125rem; margin: 0 0 .35em; }
p { text-wrap: pretty; }
a { color: var(--blue); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: var(--mono); font-size: .9em; }
p code, .steps li code, .links li code, dd code, .answer code, summary code, h3 code { padding: .05em .3em; border-radius: 6px; background: color-mix(in srgb, var(--ink) 6%, transparent); overflow-wrap: anywhere; }
.wrap { width: min(1000px, 100% - 32px); margin: 0 auto; }
.muted { color: var(--ink2); } .small { font-size: .875rem; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 20; background: var(--card); color: var(--ink); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 650; }
.skip:focus { left: 16px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--hair); padding-top: env(safe-area-inset-top, 0px); }
.top-in { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px 20px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font: 750 1.25rem var(--round); color: var(--ink); text-decoration: none; }
.logo { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 26px; height: 26px; padding: 3px; border-radius: 8px; background: var(--green); }
.logo i { background: rgba(255, 255, 255, .92); border-radius: 2px; }
.logo i:nth-child(4) { background: transparent; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .92); }
.topnav { display: flex; justify-content: flex-end; align-items: center; gap: 2px; }
.topnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--ink2); text-decoration: none; font-weight: 600; font-size: .9375rem; white-space: nowrap; }
.topnav a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.topnav a[aria-current] { color: var(--green2); }
.crumbs { font-size: .875rem; color: var(--ink3); padding-top: 14px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0 6px; margin: 0; padding: 0; }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--ink3); }
.crumbs a { color: var(--ink2); }
.crumbs [aria-current] { color: var(--ink3); }

/* ---------- buttons, cards ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 44px; padding: .55em 1.3em; border-radius: 999px; font-weight: 650; text-decoration: none; text-align: center; background: var(--btn); color: var(--on-green); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 16px -8px var(--btn); }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.small { min-height: 40px; padding: .3em 1.05em; font-size: .9375rem; }
.btn.big { min-height: 52px; padding: .7em 1.7em; font-size: 1.0625rem; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hair); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
a.card { color: var(--ink); text-decoration: none; }
a.card:hover { box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--green) 45%, var(--hair)); }
.pill { display: inline-block; font-size: .75rem; font-weight: 650; line-height: 1.5; color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent); padding: .1em .6em; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.pill.free { color: var(--green2); background: color-mix(in srgb, var(--green) 14%, transparent); }
.pill.plus { color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, transparent); }

/* ---------- article ---------- */
.lede { font-size: 1.1875rem; color: var(--ink2); margin: .2em 0 1.2em; max-width: 40em; }
.kicker { margin: 1.4em 0 0; font-weight: 650; font-size: .9375rem; color: hsl(var(--h, 152) 65% var(--hue-l)); }
.doc { max-width: 800px; }
.doc > p, .doc section > p, .links li, .steps li { max-width: 44em; }
.updated { margin-top: 2.5em; }
.answer { font-size: 1.125rem; background: var(--tint); border-color: color-mix(in srgb, var(--green) 25%, var(--hair)); }
.answer .label { display: block; font: 700 .75rem var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--green2); margin-bottom: 4px; }
.sig { display: flex; gap: 12px; align-items: flex-start; font-size: 1.0625rem; }
.sig code { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.fxl { flex: none; font: italic 600 .9375rem/1.7 Georgia, serif; color: var(--ink3); }
.args { display: grid; gap: 0; margin: 0; border: 1px solid var(--hair); border-radius: 14px; overflow: hidden; background: var(--card); }
.args div { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 12px; padding: 10px 16px; }
.args div + div { border-top: 1px solid var(--hair); }
.args dt code { font-weight: 650; overflow-wrap: anywhere; } .args dd { margin: 0; color: var(--ink2); }

/* ---------- mini spreadsheet ---------- */
.sheet { overflow-x: auto; border: 1px solid var(--cell-line); border-radius: 12px; background: var(--cell); margin: 12px 0; -webkit-overflow-scrolling: touch; }
.xl { border-collapse: collapse; font-size: .9375rem; min-width: 100%; }
.xl th { background: var(--cellh); color: var(--ink3); font: 600 .75rem var(--sans); padding: 4px 8px; border: 1px solid var(--cell-line); }
.xl thead th:first-child, .xl tbody th { width: 36px; }
.xl td { padding: 6px 10px; border: 1px solid var(--cell-line); white-space: nowrap; min-width: 64px; height: 34px; }
.xl td.n { text-align: right; font-variant-numeric: tabular-nums; }
.xl td.hd { font-weight: 650; background: var(--cellh); }
.xl td.tgt { box-shadow: inset 0 0 0 2px var(--green); font-weight: 650; color: var(--green2); }
.xl td.err, .err { color: var(--bad); }
.sheet + .scroll-hint { display: none; }
.fbar { display: flex; align-items: flex-start; gap: 10px; padding: 7px 12px; border-radius: var(--radius-s); background: var(--cell); border: 1px solid var(--cell-line); }
.fbar code { font-size: 1rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.fbar a { color: var(--green2); text-decoration: none; font-weight: 650; }
.fbar a:hover { text-decoration: underline; }
.nb { flex: none; font: 650 .875rem/1.85 var(--mono); color: var(--ink2); padding-right: 10px; border-right: 1px solid var(--cell-line); }
.result { margin: 12px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.result .lbl { color: var(--ink2); }
.result b { font-variant-numeric: tabular-nums; }
.result .shown { color: var(--ink2); font-size: .9375rem; }
.result .shown b { color: var(--ink); }
.result .blank { color: var(--ink2); font-style: italic; }
.ex, .examples > li { display: grid; gap: 0; }
.ex > p:last-child, .examples > li > p:last-child { margin-bottom: 0; }
.ex .sheet, .examples .sheet { margin-bottom: 0; }

/* ---------- lists of things ---------- */
.examples, .exlist, .steps { padding-left: 0; list-style: none; display: grid; gap: 12px; counter-reset: s var(--start, 0); }
.ex { margin: 14px 0; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: baseline; }
.steps li::before { content: counter(s); flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green2); font: 700 .875rem var(--round); transform: translateY(-1px); }
.steps li > span { min-width: 0; }
.mistakes, .guide { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.mistakes p, .guide p { margin: 0; color: var(--ink2); }
.guide .f { display: block; margin: 6px 0 10px; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--green) 10%, transparent); color: var(--green2); font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.guide .f a { color: inherit; }
.faq { display: grid; gap: 10px; }
.faq details { padding: 0; }
.faq summary, .exlist summary { cursor: pointer; font-weight: 650; }
.faq summary { padding: 14px 20px; min-height: 44px; list-style: none; display: flex; gap: 12px; justify-content: space-between; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; font: 600 1.25rem/1 var(--sans); color: var(--ink3); }
.faq details[open] summary::after { content: "–"; }
.faq p { margin: 0; padding: 0 20px 16px; color: var(--ink2); }
.exlist summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--green2); }
.exlist .q { font-weight: 650; margin: 0 0 8px; }
.exlist details { margin-top: 4px; color: var(--ink2); }
.opts { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.opts li { padding: 4px 12px; border-radius: 10px; border: 1px solid var(--hair); font-size: .9375rem; }
.pairs { display: grid; gap: 6px; margin: 0; }
.pairs div { display: grid; grid-template-columns: 160px 1fr; gap: 12px; }
.pairs dt { font-weight: 650; } .pairs dd { margin: 0; color: var(--ink2); }
.links { padding-left: 1.2em; }
.links li { margin: 2px 0; }
.chips { list-style: none; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.chips a { display: flex; flex-direction: column; gap: 2px; min-height: 44px; height: 100%; padding: 10px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--hair); text-decoration: none; color: var(--ink); }
.chips a:hover { border-color: color-mix(in srgb, var(--green) 45%, var(--hair)); }
.chips code { font-weight: 700; color: var(--green2); }
.chips span { font-size: .875rem; color: var(--ink2); }
.chips b { font-weight: 650; }

/* ---------- calls to action ---------- */
.cta { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin: 2.2em 0; background: linear-gradient(135deg, color-mix(in srgb, var(--green) 13%, var(--card)), var(--card)); border-color: color-mix(in srgb, var(--green) 25%, var(--hair)); }
.cta > div { min-width: 0; max-width: 44em; }
.cta h2 { margin: 0; font-size: 1.25rem; } .cta p { margin: 6px 0 0; color: var(--ink2); }
.cta .row { flex: none; }
.plus-note { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; margin: .5em 0 1.5em; border-style: dashed; box-shadow: none; }
.plus-note p { margin: 0; color: var(--ink2); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 2em 0; }
.pager a { display: grid; gap: 2px; padding: 12px 16px; text-decoration: none; }
.pager a span { font-size: .8125rem; color: var(--ink3); font-weight: 600; }
.pager a b { color: var(--ink); }
.pager .next { text-align: right; grid-column: 2; }

/* ---------- indexes ---------- */
.search { width: 100%; min-height: 48px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--hair); background: var(--card); color: var(--ink); font: inherit; box-shadow: var(--shadow); }
.search::placeholder { color: var(--ink3); }
.noresults { margin: 16px 0; } .noresults p { margin: 0; }
.fngrid { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.fngrid a { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px 14px; }
.fngrid code { font-weight: 700; color: var(--green2); }
.fngrid span { font-size: .875rem; color: var(--ink2); }
.units { list-style: none; padding: 0; display: grid; gap: 10px; }
.units.two { grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); }
.units a { display: flex; gap: 14px; align-items: center; height: 100%; }
.units a > span:last-child { display: grid; gap: 2px; min-width: 0; }
.units .muted { font-size: .9375rem; }
.units .t { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.badge { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font: 800 1rem var(--round); color: hsl(var(--h) 70% var(--hue-l)); background: hsl(var(--h) 80% 55% / var(--hue-bg)); }
.glist { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.glist > li { min-width: 0; }
.glist a { display: grid; align-content: start; gap: 4px; height: 100%; }
.glist .muted { font-size: .9375rem; }
.more { font-weight: 650; }
.more a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: center; padding: 40px 0 8px; }
.hero h1 { font-size: clamp(2.25rem, 6vw, 3.5rem); letter-spacing: -.03em; margin-top: 0; }
.hero .fine { margin: 12px 0 0; font-size: .9375rem; color: var(--ink2); }
.demo { transform: rotate(-1.5deg); }
.demo .xl td { min-width: 0; }
.feat3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 32px; }
.feat3 h2 { font-size: 1.125rem; margin: 0 0 .3em; } .feat3 p { margin: 0; color: var(--ink2); }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plans h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 1.25rem; }
.plans .price { font: 650 1rem var(--sans); color: var(--ink2); }
.plans ul { margin: .4em 0 1em; padding-left: 1.2em; color: var(--ink2); }
.plans li { margin: 4px 0; }
.plans .card { display: flex; flex-direction: column; }
.plans .card .btn { margin-top: auto; align-self: flex-start; }
.plans .best { border-color: color-mix(in srgb, var(--green) 45%, var(--hair)); }

/* ---------- 404 ---------- */
.nf { padding: 32px 0 8px; }

/* ---------- footer ---------- */
.foot { margin-top: 72px; border-top: 1px solid var(--hair); padding: 36px 0 24px; }
.foot-in { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 20px; }
.foot-in > div:first-child p { margin: 10px 0 14px; max-width: 26em; }
.foot h2 { font: 700 .8125rem var(--sans); margin: 0 0 6px; color: var(--ink3); text-transform: uppercase; letter-spacing: .06em; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot ul a { display: inline-flex; align-items: center; min-height: 32px; color: var(--ink2); text-decoration: none; font-size: .9375rem; }
.foot ul a:hover { color: var(--ink); text-decoration: underline; }
.foot .legal { margin-top: 24px; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  a.card, .chips a, .btn, .topnav a { transition: box-shadow .18s ease, border-color .18s ease, filter .18s ease, background-color .18s ease, color .18s ease; }
}
@media (prefers-reduced-motion: reduce) {
  .demo { transform: none; }
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- phones ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .hero, .feat3, .plans { grid-template-columns: 1fr; }
  .hero { gap: 28px; padding-top: 24px; }
  .foot-in { grid-template-columns: 1fr 1fr; }
  .foot-in > div:first-child { grid-column: 1 / -1; }
  .foot ul a { min-height: 44px; }
  .args div, .pairs div { grid-template-columns: 1fr; gap: 2px; }
  .demo { transform: none; }
  .links a { display: inline-block; padding: 9px 0; }
  .cta .row, .cta .row .btn { width: 100%; }
  h2 { font-size: 1.375rem; }
  .lede { font-size: 1.125rem; }
  .card { padding: 16px; }
  .faq summary { padding: 12px 16px; } .faq p { padding: 0 16px 14px; }
  .xl { font-size: .875rem; }
  .xl td { padding: 6px 8px; min-width: 48px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}
@media (max-width: 640px) {
  .top-in { grid-template-columns: 1fr auto; grid-template-areas: "brand cta" "nav nav"; min-height: 0; padding-top: 6px; gap: 0 12px; }
  .top-in .brand { grid-area: brand; }
  .top-in > .btn { grid-area: cta; }
  .topnav { grid-area: nav; justify-content: space-between; margin: 0 -12px; overflow-x: auto; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { font-size: .9375rem; }
}
@media (max-width: 360px) {
  .wrap { width: calc(100% - 24px); }
  .topnav a { padding: 0 8px; font-size: .875rem; }
  .brand { font-size: 1.125rem; }
  .btn.big { width: 100%; }
}

/* Long content never pushes the page sideways. */
.doc, main > *, .examples > li, .exlist > li, .mistakes > *, .guide > *, .units > li, .fngrid > li, .hero > *, .feat3 > *, .plans > * { min-width: 0; }
.opts li, .pairs dd, .exlist p, .examples p, .doc p, .doc li, .doc h2, .doc h3, .doc summary, .glist b, .glist span { overflow-wrap: anywhere; }

/* ---------- print (people print the cheat sheets) ---------- */
@media print {
  :root { --bg: #fff; --card: #fff; --shadow: none; --ink2: #333; --ink3: #555; --blue: #000; }
  body { font-size: 11.5pt; background: #fff; }
  .top, .foot, .crumbs, .cta, .search, .noresults, .skip, .plus-note .btn, .pager { display: none !important; }
  .wrap { width: 100%; }
  .card { box-shadow: none; break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  .sheet, .fbar { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  .demo { transform: none; }
  .xl td { white-space: normal; }
  .faq summary::after { display: none; }
}

/* Hide the badge Netlify injects at serve time; it overlapped the lesson Check button. */
#nl-badge, .nl-badge, #nl-card { display: none !important; }
