/* Northdesk's static public pages (src/site/render.ts): the calculators and the
   pages written for searches. Same look as the landing page (LandingKit.tsx):
   calm page colors, white sheets, pill buttons, the Northdesk blue, Plus
   Jakarta Sans with Fraunces for the big headlines. Light and dark follow the
   device, or the theme picked on the landing page (data-theme). */

:root {
  --page: #f3f5f8; --zone: #e9f1fb; --sheet: #ffffff; --sheet-2: #f6f8fb;
  --ink: #16202e; --text: #374151; --muted: #6b7280; --line: rgba(15, 23, 42, 0.08);
  --blue: #0a7cf6; --blue-ink: #0a5fd0; --blue-soft: #e8f1ff;
  --primary: #111827; --primary-ink: #ffffff; --primary-hover: #374151;
  --ok: #047857; --ok-soft: #ecfdf5; --warn: #b45309; --warn-soft: #fff7ed;
  --shadow: 0 30px 60px -30px rgba(16, 42, 84, 0.25);
  --orb: radial-gradient(circle at 30% 25%, #8fdcff 0%, #2f9bff 38%, #0a6cf0 62%, #4338ca 100%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #101116; --zone: #15161c; --sheet: #1a1b21; --sheet-2: #202128;
    --ink: #ffffff; --text: #d1d5db; --muted: #9ca3af; --line: rgba(255, 255, 255, 0.08);
    --blue: #3b9bff; --blue-ink: #8cc4ff; --blue-soft: rgba(10, 124, 246, 0.18);
    --primary: #ffffff; --primary-ink: #111827; --primary-hover: #e5e7eb;
    --ok: #6ee7b7; --ok-soft: rgba(16, 185, 129, 0.12); --warn: #fdba74; --warn-soft: rgba(249, 115, 22, 0.12);
    --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #101116; --zone: #15161c; --sheet: #1a1b21; --sheet-2: #202128;
  --ink: #ffffff; --text: #d1d5db; --muted: #9ca3af; --line: rgba(255, 255, 255, 0.08);
  --blue: #3b9bff; --blue-ink: #8cc4ff; --blue-soft: rgba(10, 124, 246, 0.18);
  --primary: #ffffff; --primary-ink: #111827; --primary-hover: #e5e7eb;
  --ok: #6ee7b7; --ok-soft: rgba(16, 185, 129, 0.12); --warn: #fdba74; --warn-soft: rgba(249, 115, 22, 0.12);
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 400 16px/1.65 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: clip; -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--blue-ink); }
h1, h2, h3 { color: var(--ink); margin: 0; }
code { font: 500 0.92em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--sheet-2); border-radius: 6px; padding: 1px 6px; white-space: normal; word-break: break-word; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--sheet); color: var(--ink); padding: 8px 16px; border-radius: 999px; font-weight: 600; }
.skip:focus { left: 12px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 24px; border-radius: 999px; font-weight: 600; font-size: 15px; text-decoration: none; border: 0; cursor: pointer; font-family: inherit; white-space: nowrap; transition: background-color .15s, opacity .15s; }
.btn.sm { height: 40px; padding: 0 18px; font-size: 14px; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); color: var(--primary-ink); }
.btn.quiet { background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.quiet:hover { background: var(--sheet-2); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--page) 82%, transparent); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo { display: flex; align-items: center; flex-shrink: 0; }
.logo img { height: 34px; width: auto; margin-left: -6px; }
.nav { display: none; gap: 4px; margin-left: 16px; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; font-size: 14.5px; padding: 8px 12px; border-radius: 999px; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.top-act { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.hide-sm { display: none; }
@media (min-width: 860px) { .nav { display: flex; } .hide-sm { display: inline-flex; } .menu { display: none; } }
.menu { position: relative; }
.menu summary { list-style: none; width: 40px; height: 40px; border-radius: 999px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink); }
.menu-panel { position: absolute; right: 0; top: 48px; width: min(280px, calc(100vw - 32px)); background: var(--sheet); border-radius: 20px; padding: 8px; box-shadow: 0 24px 50px -20px rgba(16, 42, 84, .45), 0 0 0 1px var(--line); display: flex; flex-direction: column; }
.menu-panel a:not(.btn) { color: var(--ink); text-decoration: none; padding: 12px; border-radius: 12px; font-weight: 500; }
.menu-panel a:not(.btn):hover { background: var(--sheet-2); }
.menu-panel .btn { margin-top: 6px; }

/* Breadcrumb */
.crumbs ol { list-style: none; margin: 0; padding: 18px 0 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 13.5px; color: var(--muted); }
.crumbs li + li::before { content: '›'; margin-right: 6px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }

/* Headline */
.hero { padding: 28px 0 8px; max-width: 820px; }
.eyebrow { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; color: var(--blue); letter-spacing: .01em; }
.hero h1 { font-family: Fraunces, Georgia, serif; font-weight: 400; font-size: clamp(34px, 6vw, 58px); line-height: 1.05; letter-spacing: -0.02em; text-wrap: balance; }
.lede { margin: 16px 0 0; font-size: clamp(16.5px, 2vw, 19px); line-height: 1.6; color: var(--text); max-width: 720px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
@media (max-width: 420px) { .cta-row .btn { flex: 1 1 auto; } }

/* Screenshots */
.shot { margin: 32px 0 8px; }
.shot.win { border-radius: 16px; overflow: hidden; background: var(--sheet); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.win-bar { height: 28px; display: flex; gap: 6px; align-items: center; padding: 0 12px; background: var(--sheet-2); border-bottom: 1px solid var(--line); }
.win-bar i { width: 9px; height: 9px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 18%, transparent); }
.shot.phone { display: flex; justify-content: center; }
.phone-frame { width: min(280px, 72vw); border-radius: 36px; padding: 6px; background: #111113; box-shadow: var(--shadow); }
.phone-frame img { border-radius: 30px; }
.shot.paper img { border-radius: 10px; box-shadow: var(--shadow), 0 0 0 1px var(--line); max-width: 720px; margin: 0 auto; width: 100%; }

/* Prose */
.prose { max-width: 760px; }
.block { padding: 28px 0 0; }
.block h2 { font-size: clamp(23px, 3vw, 30px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 12px; }
.block p { margin: 0 0 14px; }
.block ul { margin: 0 0 16px; padding-left: 22px; }
.block li { margin: 6px 0; }
.block li::marker { color: var(--blue); }
.block strong { color: var(--ink); font-weight: 600; }
.sub { color: var(--muted); margin-top: -4px !important; }
.example { }
.example p { background: var(--sheet); border-radius: 16px; padding: 14px 18px; box-shadow: 0 0 0 1px var(--line); }

/* FAQ */
.faq details { background: var(--sheet); border-radius: 16px; margin: 0 0 8px; box-shadow: 0 0 0 1px var(--line); }
.faq summary { cursor: pointer; padding: 16px 48px 16px 18px; font-weight: 600; color: var(--ink); list-style: none; position: relative; line-height: 1.4; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 400; color: var(--muted); }
.faq details[open] summary::after { content: '–'; }
.faq details > div { padding: 0 18px 4px; }

/* Link cards */
.cards { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .cards { grid-template-columns: repeat(3, 1fr); } .cards.tight { grid-template-columns: repeat(4, 1fr); } }
.card { position: relative; display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 16px 40px 16px 18px; background: var(--sheet); border-radius: 18px; text-decoration: none; box-shadow: 0 0 0 1px var(--line); transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 45%, transparent), 0 16px 30px -22px rgba(16, 42, 84, .45); }
.card-t { color: var(--ink); font-weight: 600; font-size: 15.5px; line-height: 1.35; }
.card-d { color: var(--muted); font-size: 14px; line-height: 1.5; }
.card-go { position: absolute; right: 16px; top: 16px; color: var(--blue); font-weight: 600; }
.calc-cards .card { padding-top: 18px; padding-bottom: 18px; }
.calc-cards .card-t { font-size: 17px; }

/* Calculator */
.hero-calc { padding-bottom: 0; }
.calc-grid { display: grid; gap: 14px; margin-top: 24px; align-items: start; }
@media (min-width: 900px) { .calc-grid { grid-template-columns: 1fr 1fr; gap: 18px; } .result { position: sticky; top: 76px; } }
.panel { background: var(--sheet); border-radius: 22px; padding: 18px; box-shadow: var(--shadow), 0 0 0 1px var(--line); min-width: 0; }
@media (min-width: 640px) { .panel { padding: 22px 24px; } }
.panel-h { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.field { margin: 0 0 14px; display: flex; flex-direction: column; gap: 5px; }
.field[hidden] { display: none; }
.field label { font-weight: 600; color: var(--ink); font-size: 14.5px; }
.inp { position: relative; display: flex; align-items: center; }
.field input, .field select {
  width: 100%; height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--sheet-2); color: var(--ink);
  font: 500 17px/1 inherit; font-family: inherit; padding: 0 14px; appearance: none; -webkit-appearance: none;
}
.field select { padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; font-size: 16px; }
.inp input { padding-right: 64px; }
.field input:focus, .field select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent); background: var(--sheet); }
.suffix { position: absolute; right: 14px; color: var(--muted); font-size: 14px; pointer-events: none; }
.help { font-size: 13px; color: var(--muted); line-height: 1.45; }
.parsed { font-size: 13px; color: var(--blue-ink); min-height: 0; font-variant-numeric: tabular-nums; }
.parsed:empty { display: none; }
.parsed.bad { color: var(--warn); }
.calc-tip { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.r-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.r-table th, .r-table td { text-align: left; vertical-align: top; padding: 11px 0; border-bottom: 1px solid var(--line); }
.r-table tr:last-child th, .r-table tr:last-child td { border-bottom: 0; }
.r-table th { font-weight: 500; color: var(--text); font-size: 14.5px; padding-right: 12px; width: 44%; }
.r-table td { text-align: right; }
.r-table .v { display: block; color: var(--ink); font-weight: 600; font-size: 16px; }
.r-table .s { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; margin-top: 2px; }
.r-table tr.strong .v { font-size: 22px; letter-spacing: -0.01em; color: var(--blue-ink); }
.r-error { margin: 0; padding: 14px 16px; border-radius: 14px; background: var(--warn-soft); color: var(--warn); font-weight: 500; }
.notes { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.note { font-size: 14px; line-height: 1.5; padding: 10px 12px 10px 34px; border-radius: 12px; position: relative; background: var(--sheet-2); }
.note::before { position: absolute; left: 12px; top: 10px; font-weight: 700; }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.ok::before { content: '✓'; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.warn::before { content: '!'; left: 15px; }
.note.info::before { content: 'i'; left: 15px; color: var(--blue); font-family: Georgia, serif; font-style: italic; }

/* Ask Dex */
.dex { margin-top: 24px; border-radius: 26px; padding: 20px 16px 16px; background: linear-gradient(180deg, var(--zone), var(--sheet)); box-shadow: 0 0 0 1px var(--line); }
@media (min-width: 640px) { .dex { padding: 26px 26px 22px; } }
.dex-head { display: flex; gap: 14px; align-items: center; }
.dex-head h2 { font-size: clamp(19px, 2.6vw, 24px); font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
.dex-head p { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.orb { position: relative; flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; background: var(--orb); box-shadow: 0 12px 30px -8px rgba(10, 124, 246, .55); }
.orb::after { content: ''; position: absolute; top: 14%; left: 20%; width: 38%; height: 24%; border-radius: 50%; background: rgba(255, 255, 255, .5); filter: blur(3px); }
.orb.sm { width: 28px; height: 28px; box-shadow: 0 6px 16px -6px rgba(10, 124, 246, .55); }
.dex-thread { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dex-thread:empty { display: none; }
.msg { display: flex; gap: 8px; align-items: flex-end; }
.msg.me { justify-content: flex-end; }
.bubble { max-width: min(88%, 620px); padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin-bottom: 0; }
.msg.me .bubble { background: #0a7cf6; color: #fff; border-bottom-right-radius: 6px; }
.msg.bot .bubble { background: var(--sheet); color: var(--ink); border-bottom-left-radius: 6px; box-shadow: 0 0 0 1px var(--line); }
.msg.warn .bubble { color: var(--text); }
.dex-card { margin-top: 10px; border-radius: 14px; background: var(--sheet-2); padding: 10px 12px; }
.dex-card-t { font-size: 12.5px !important; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 4px !important; }
.dex-card table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.dex-card th, .dex-card td { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.dex-card tr:last-child th, .dex-card tr:last-child td { border-bottom: 0; }
.dex-card th { text-align: left; font-weight: 500; color: var(--text); padding-right: 10px; }
.dex-card td { text-align: right; font-weight: 600; color: var(--ink); }
.dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: dot 1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.dex-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dex-chips[hidden] { display: none; }
.chip { font: 500 14px/1.35 inherit; font-family: inherit; text-align: left; color: var(--ink); background: var(--sheet); border: 0; box-shadow: 0 0 0 1px var(--line); border-radius: 14px; padding: 9px 12px; cursor: pointer; max-width: 100%; }
.chip:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 50%, transparent); }
.dex-form { display: flex; gap: 8px; margin-top: 14px; align-items: flex-end; }
.dex-form textarea { flex: 1; min-width: 0; min-height: 52px; max-height: 160px; resize: vertical; border-radius: 16px; border: 1px solid var(--line); background: var(--sheet); color: var(--ink); font: 400 16px/1.45 inherit; font-family: inherit; padding: 13px 14px; }
.dex-form textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent); }
.dex-form .btn { height: 52px; flex-shrink: 0; padding: 0 20px; }
.dex-cta { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.dex-cta a { font-weight: 600; }
.dex-note { font-size: 14px; color: var(--muted); }
.dex.busy .dex-form { opacity: .7; }

/* Closing band */
.cta-band { padding: 48px 16px 56px; }
.cta-in { max-width: 1072px; margin: 0 auto; border-radius: 28px; padding: 32px 20px; text-align: center; background: linear-gradient(180deg, var(--zone), var(--sheet)); box-shadow: 0 0 0 1px var(--line); }
.cta-in h2 { font-family: Fraunces, Georgia, serif; font-weight: 400; font-size: clamp(30px, 4.4vw, 46px); letter-spacing: -0.02em; line-height: 1.08; }
.cta-in h2 span { color: var(--blue); }
.cta-in p { max-width: 560px; margin: 12px auto 0; color: var(--text); }
.cta-in .cta-row { justify-content: center; }

/* Footer */
.foot { border-top: 1px solid var(--line); padding: 36px 0 28px; font-size: 14px; }
.foot .wrap { display: grid; gap: 28px; }
@media (min-width: 960px) { .foot .wrap { grid-template-columns: 260px 1fr; } }
.f-brand img { height: 32px; width: auto; margin-left: -5px; }
.f-brand p { margin: 10px 0 0; color: var(--ink); font-weight: 600; }
.f-brand p.muted { color: var(--muted); font-weight: 400; margin-top: 2px; margin-bottom: 16px; }
.f-cols { display: grid; gap: 24px; grid-template-columns: 1fr 1fr; }
@media (min-width: 760px) { .f-cols { grid-template-columns: repeat(4, 1fr); } }
.f-h { margin: 0 0 8px; font-weight: 600; color: var(--ink); font-size: 13.5px; }
.f-cols ul { list-style: none; margin: 0; padding: 0; }
.f-cols li { margin: 0; }
.f-cols a { display: inline-block; padding: 4px 0; color: var(--muted); text-decoration: none; line-height: 1.4; }
.f-cols a:hover { color: var(--ink); }
.f-base { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; color: var(--muted); padding-top: 18px; border-top: 1px solid var(--line); }
.f-links { display: flex; gap: 18px; }
.f-links a { color: var(--muted); text-decoration: none; }
.f-links a:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Text with a side column (desktop) */
.with-side { display: block; }
.side { display: none; }
@media (min-width: 1100px) {
  .with-side { display: grid; grid-template-columns: minmax(0, 760px) 268px; gap: 56px; justify-content: space-between; }
  .side { display: block; padding-top: 32px; }
  .side-in { position: sticky; top: 84px; }
}
.side-h { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.toc { list-style: none; margin: 0 0 20px; padding: 0 0 0 12px; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 5px 0; color: var(--text); text-decoration: none; font-size: 14px; line-height: 1.4; }
.toc a:hover { color: var(--blue); }
.side-card { background: var(--sheet); border-radius: 20px; padding: 18px; box-shadow: 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.side-card p { margin: 0; font-size: 14.5px; line-height: 1.5; }
.side-card strong { color: var(--ink); }
.side-card .orb { width: 34px; height: 34px; }
.side-link { font-size: 14px; font-weight: 600; text-decoration: none; }
.hero-shot { max-width: 1000px; }
.block .cards { padding-left: 0; }
@media (max-width: 560px) {
  .dex-head { align-items: flex-start; }
  .dex-head .orb { width: 36px; height: 36px; margin-top: 2px; }
  .dex-form { flex-direction: column; align-items: stretch; }
  .dex-form textarea { min-height: 76px; }
  .dex-form .btn { height: 48px; }
}
.hero-shot.win img { max-height: 560px; width: 100%; object-fit: cover; object-position: top; }
.block .cards li { margin: 0; }
@media (max-width: 639px) { .card { padding: 14px 40px 14px 16px; border-radius: 16px; } .cards { gap: 8px; } }
