/* ==========================================================================
   Vendwright — style.css
   Hand-written, no framework, no build step.

   Contents
   01  Design tokens (palette, type, space, radii)
   02  Dark theme
   03  Reset & base elements
   04  Typography & prose
   05  Layout (wrap, section, stack, grids)
   06  Skip link & header
   07  Navigation
   08  Footer
   09  Buttons
   10  Cards & card grid
   11  Tables
   12  Forms & form controls
   13  Result panels (shared with tool.css)
   14  Components (hero, eyebrow, callout, badge, faq, breadcrumb, price)
   15  Utilities
   16  Motion & print
   ========================================================================== */


/* 01  Design tokens ======================================================= */

:root {
  color-scheme: light;

  /* --- Raw palette. Anchored to the product artwork:
         slate #1F2937, accent #2563EB, near-white #F9FAFB, border #E5E7EB. */
  --c-slate-950: #0B111C;
  --c-slate-900: #111827;
  --c-slate-800: #1F2937;
  --c-slate-700: #374151;
  --c-slate-600: #4B5563;
  --c-slate-500: #6B7280;
  --c-slate-400: #9CA3AF;
  --c-slate-300: #D1D5DB;
  --c-slate-200: #E5E7EB;
  --c-slate-100: #F3F4F6;
  --c-slate-50:  #F9FAFB;
  --c-white:     #FFFFFF;

  --c-blue-800: #1E40AF;
  --c-blue-700: #1D4ED8;
  --c-blue-600: #2563EB;
  --c-blue-500: #3B82F6;
  --c-blue-400: #60A5FA;
  --c-blue-100: #DBEAFE;
  --c-blue-50:  #EFF6FF;

  --c-green-700: #15803D;
  --c-green-600: #16A34A;
  --c-green-50:  #F0FDF4;
  --c-amber-700: #B45309;
  --c-amber-600: #D97706;
  --c-amber-50:  #FFFBEB;
  --c-red-700:   #B91C1C;
  --c-red-600:   #DC2626;
  --c-red-50:    #FEF2F2;

  /* --- Semantic tokens (light) */
  --bg:            var(--c-white);
  --bg-subtle:     var(--c-slate-50);
  --bg-sunken:     var(--c-slate-100);
  --bg-inverse:    var(--c-slate-800);
  --surface:       var(--c-white);
  --surface-hover: var(--c-slate-50);

  --border:        var(--c-slate-200);
  --border-strong: var(--c-slate-300);
  --border-inverse: rgba(255, 255, 255, 0.14);

  --text:          var(--c-slate-900);
  --text-muted:    var(--c-slate-600);
  /* Deliberately a shade darker than --c-slate-500 (#6B7280). The raw 500 only
     reaches 4.39:1 on --bg-sunken, 4.44:1 on --accent-soft and 4.42:1 on
     --bad-bg, so small labels set in it failed AA on tinted surfaces. This
     value clears 4.5:1 on every light background token. */
  --text-faint:    #656D7C;
  --text-inverse:  var(--c-slate-50);
  --text-inverse-muted: var(--c-slate-400);

  --accent:         var(--c-blue-600);
  --accent-hover:   var(--c-blue-700);
  --accent-active:  var(--c-blue-800);
  --accent-soft:    var(--c-blue-50);
  --accent-border:  var(--c-blue-100);
  --on-accent:      var(--c-white);

  --ok:      var(--c-green-700);
  --ok-bg:   var(--c-green-50);
  --warn:    var(--c-amber-700);
  --warn-bg: var(--c-amber-50);
  --bad:     var(--c-red-700);
  --bad-bg:  var(--c-red-50);

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 1px 3px rgba(16, 24, 40, 0.08), 0 4px 12px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 2px 6px rgba(16, 24, 40, 0.06), 0 16px 32px -8px rgba(16, 24, 40, 0.12);
  --header-bg: rgba(255, 255, 255, 0.86);

  /* --- Type */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --text-xs:   clamp(0.75rem,   0.735rem + 0.07vw, 0.8125rem);
  --text-sm:   clamp(0.875rem,  0.860rem + 0.07vw, 0.9375rem);
  --text-base: clamp(1rem,      0.970rem + 0.15vw, 1.0625rem);
  --text-lg:   clamp(1.125rem,  1.070rem + 0.24vw, 1.25rem);
  --text-xl:   clamp(1.3125rem, 1.220rem + 0.42vw, 1.5rem);
  --text-2xl:  clamp(1.5rem,    1.320rem + 0.80vw, 1.875rem);
  --text-3xl:  clamp(1.75rem,   1.430rem + 1.43vw, 2.5rem);
  --text-4xl:  clamp(2.125rem,  1.620rem + 2.24vw, 3.25rem);

  --leading-tight: 1.15;
  --leading-snug:  1.3;
  --leading:       1.65;

  /* --- Space */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;

  /* --- Radii & measure */
  --r-sm:   4px;
  --r:      8px;
  --r-lg:   12px;
  --r-full: 999px;

  --w-prose:   42rem;
  --w-content: 68rem;
  --w-wide:    82rem;
  --gutter: clamp(1rem, 0.6rem + 1.8vw, 2rem);
  --header-h: 3.75rem;
}


/* 02  Dark theme =========================================================
   Two selectors, same values: the media query is the default signal, the
   [data-theme] attribute lets a page (or a future toggle) force a mode. */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg:            var(--c-slate-900);
    --bg-subtle:     var(--c-slate-800);
    --bg-sunken:     var(--c-slate-950);
    --bg-inverse:    var(--c-slate-950);
    --surface:       #182234;
    --surface-hover: #1E293B;

    --border:        #2B3648;
    --border-strong: #3B4859;
    --border-inverse: rgba(255, 255, 255, 0.12);

    --text:          var(--c-slate-50);
    --text-muted:    var(--c-slate-300);
    --text-faint:    var(--c-slate-400);
    --text-inverse:  var(--c-slate-50);
    --text-inverse-muted: var(--c-slate-400);

    --accent:        var(--c-blue-400);
    --accent-hover:  #82BAFF;
    --accent-active: var(--c-blue-100);
    --accent-soft:   rgba(59, 130, 246, 0.12);
    --accent-border: rgba(96, 165, 250, 0.32);
    --on-accent:     var(--c-slate-950);

    --ok:      #4ADE80;
    --ok-bg:   rgba(74, 222, 128, 0.10);
    --warn:    #FBBF24;
    --warn-bg: rgba(251, 191, 36, 0.10);
    --bad:     #F87171;
    --bad-bg:  rgba(248, 113, 113, 0.10);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 16px 32px -8px rgba(0, 0, 0, 0.55);
    --header-bg: rgba(17, 24, 39, 0.86);
  }
}

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

  --bg:            var(--c-slate-900);
  --bg-subtle:     var(--c-slate-800);
  --bg-sunken:     var(--c-slate-950);
  --bg-inverse:    var(--c-slate-950);
  --surface:       #182234;
  --surface-hover: #1E293B;

  --border:        #2B3648;
  --border-strong: #3B4859;
  --border-inverse: rgba(255, 255, 255, 0.12);

  --text:          var(--c-slate-50);
  --text-muted:    var(--c-slate-300);
  --text-faint:    var(--c-slate-400);
  --text-inverse:  var(--c-slate-50);
  --text-inverse-muted: var(--c-slate-400);

  --accent:        var(--c-blue-400);
  --accent-hover:  #82BAFF;
  --accent-active: var(--c-blue-100);
  --accent-soft:   rgba(59, 130, 246, 0.12);
  --accent-border: rgba(96, 165, 250, 0.32);
  --on-accent:     var(--c-slate-950);

  --ok:      #4ADE80;
  --ok-bg:   rgba(74, 222, 128, 0.10);
  --warn:    #FBBF24;
  --warn-bg: rgba(251, 191, 36, 0.10);
  --bad:     #F87171;
  --bad-bg:  rgba(248, 113, 113, 0.10);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 16px 32px -8px rgba(0, 0, 0, 0.55);
  --header-bg: rgba(17, 24, 39, 0.86);
}


/* 03  Reset & base ======================================================== */

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

* { margin: 0; }

html {
  /* overflow-x: clip (not hidden) keeps position: sticky working. Safety net
     only — no component should ever need it. */
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Keeps anchor targets and keyboard-focused controls clear of the sticky
     header at the top; the bottom value is a small buffer so a focused control
     never lands flush against the edge. Pages with a .tool-dock raise it. */
  scroll-padding-top: calc(var(--header-h) + 1rem);
  scroll-padding-bottom: var(--s-5);
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
picture,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

svg { fill: currentColor; }

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

p,
li,
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--s-6) 0;
}

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

::selection {
  background: var(--accent);
  color: var(--on-accent);
}


/* 04  Typography & prose ================================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.018em;
  color: var(--text);
  text-wrap: balance;
}

h1 { font-size: var(--text-3xl); letter-spacing: -0.025em; }
h2 { font-size: var(--text-2xl); letter-spacing: -0.021em; }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); line-height: var(--leading-snug); }
h5, h6 { font-size: var(--text-base); line-height: var(--leading-snug); }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

strong, b { font-weight: 650; }

small { font-size: var(--text-sm); }

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

code {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.1em 0.35em;
}

pre {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--s-4);
  overflow-x: auto;
  line-height: 1.5;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--s-4);
  color: var(--text-muted);
}

/* .prose — apply to any block of running body copy. Handles its own rhythm. */
.prose { max-width: var(--w-prose); }

.prose > * + * { margin-top: var(--s-4); }

.prose > h2 { margin-top: var(--s-7); }
.prose > h3 { margin-top: var(--s-6); }
.prose > h4 { margin-top: var(--s-5); }

.prose ul,
.prose ol {
  padding-left: 1.35em;
}

.prose li + li { margin-top: var(--s-2); }

.prose li::marker { color: var(--text-faint); }

.prose img,
.prose figure { border-radius: var(--r); }

.lede {
  font-size: var(--text-lg);
  line-height: 1.55;
  color: var(--text-muted);
  max-width: var(--w-prose);
  text-wrap: pretty;
}

.eyebrow {
  display: block;
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}


/* 05  Layout ============================================================== */

.wrap {
  width: 100%;
  max-width: var(--w-content);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow { max-width: var(--w-prose); }
.wrap--wide   { max-width: var(--w-wide); }

.section { padding-block: clamp(2.5rem, 1.6rem + 4vw, 5rem); }
.section--tight { padding-block: clamp(1.75rem, 1.2rem + 2.4vw, 3rem); }
.section--flush-top { padding-top: 0; }

.section--subtle {
  background: var(--bg-subtle);
  border-block: 1px solid var(--border);
}

.section--dark {
  background: var(--bg-inverse);
  color: var(--text-inverse);
  border-block: 1px solid var(--border-inverse);
}

.section--dark h1,
.section--dark h2,
.section--dark h3 { color: var(--text-inverse); }

.section--dark .lede,
.section--dark .eyebrow { color: var(--text-inverse-muted); }

/* The default accent outline only reaches 2.84:1 against the light-theme slate
   band (#2563EB on #1F2937) — and on a primary button it is the same colour as
   the button. Use the inverse text colour there instead: 14:1. */
.section--dark :focus-visible { outline-color: var(--text-inverse); }

/* Vertical rhythm helper: children get consistent spacing, no bottom margins. */
.stack > * + * { margin-top: var(--s-4); }
.stack-sm > * + * { margin-top: var(--s-2); }
.stack-lg > * + * { margin-top: var(--s-6); }

.section-head {
  max-width: var(--w-prose);
  margin-bottom: var(--s-6);
}

.section-head > * + * { margin-top: var(--s-3); }

/* Generic auto-fitting grid. Children must not set their own widths. */
.grid {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
}

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); }
.grid--tight { gap: var(--s-4); }

.split {
  display: grid;
  gap: var(--s-6);
  align-items: start;
}

@media (min-width: 56em) {
  .split { grid-template-columns: 1fr 1fr; gap: var(--s-7); }
  .split--sidebar { grid-template-columns: minmax(0, 1fr) 20rem; }
}

/* Grid items default to min-width: auto, i.e. their min-content size. One
   unbreakable child — a <pre>, a long URL, a wide table — then stretches the
   whole column past the viewport and the text gets clipped (html has
   overflow-x: clip, so the reader cannot even scroll to it). Zero it on every
   grid we own; the children that need to scroll already do so themselves. */
.grid > *,
.split > *,
.card-grid > *,
.site-footer__cols > * { min-width: 0; }


/* 06  Skip link & header ================================================== */

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: var(--s-2);
  z-index: 100;
  transform: translateY(-200%);
  background: var(--accent);
  color: var(--on-accent);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--on-accent);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: var(--header-h);
}

/* Wordmark: bold, letterspaced, matches the product covers. */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  flex: 0 0 auto;
}

.wordmark:hover { color: var(--text); }

.wordmark__mark {
  width: 1.375rem;
  height: 1.375rem;
  flex: 0 0 auto;
  color: var(--accent);
}

.wordmark__text { display: inline-block; }


/* 07  Navigation ========================================================== */

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-right: -0.5rem;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r);
  color: var(--text-muted);
  cursor: pointer;
}

.nav-toggle:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  display: block;
  width: 1.125rem;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before { position: absolute; top: -5px; }
.nav-toggle__bars::after  { position: absolute; top: 5px; }

.site-header.is-nav-open .nav-toggle__bars { background: transparent; }
.site-header.is-nav-open .nav-toggle__bars::before { top: 0; transform: rotate(45deg); }
.site-header.is-nav-open .nav-toggle__bars::after  { top: 0; transform: rotate(-45deg); }

.site-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: var(--s-1);
}

.site-nav__link {
  display: block;
  padding: 0.4rem 0.65rem;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav__link:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.site-nav__link[aria-current="page"] {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}

.site-nav__cta { margin-left: var(--s-2); }

/* Mobile: collapse into a panel under the header bar. */
@media (max-width: 47.99em) {
  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: var(--s-3) var(--gutter) var(--s-4);
  }

  .site-header.is-nav-open .site-nav { display: block; }

  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .site-nav__link {
    padding: 0.7rem 0.25rem;
    font-size: var(--text-base);
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }

  .site-nav__list > li:last-child .site-nav__link { border-bottom: 0; }

  .site-nav__link[aria-current="page"] {
    box-shadow: inset 3px 0 0 var(--accent);
    padding-left: 0.75rem;
  }

  .site-nav__cta { margin: var(--s-3) 0 0; }
  .site-nav__cta .btn { width: 100%; }
}

@media (min-width: 48em) {
  .nav-toggle { display: none; }
}


/* 08  Footer ============================================================== */

.site-footer {
  margin-top: var(--s-8);
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.site-footer__inner { padding-block: var(--s-7) var(--s-6); }

.site-footer__cols {
  display: grid;
  gap: var(--s-6);
  grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr));
}

.site-footer__brand { max-width: 22rem; }

.site-footer__tagline {
  margin-top: var(--s-3);
  color: var(--text-faint);
  text-wrap: pretty;
}

.footer-heading {
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--s-3);
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li + li { margin-top: var(--s-2); }

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.site-footer__legal {
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  justify-content: space-between;
  align-items: baseline;
  color: var(--text-faint);
  font-size: var(--text-xs);
}


/* 09  Buttons ============================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--r);
  max-width: 100%;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  /* Not nowrap: a long label ("See the Estate Executor Organizer") pushed past
     the right edge at 320px. The label only wraps when it genuinely cannot
     fit, because a flex item still sizes to max-content first. */
  text-wrap: balance;
  overflow-wrap: break-word;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease,
    color 0.12s ease, box-shadow 0.12s ease;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-sm);
}

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

.btn--primary:active { background: var(--accent-active); }

.btn--secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.btn--secondary:hover {
  background: var(--surface-hover);
  border-color: var(--text-faint);
  color: var(--text);
}

.btn--ghost {
  background: none;
  border-color: transparent;
  color: var(--accent);
}

.btn--ghost:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.btn--lg {
  padding: 0.8rem 1.4rem;
  font-size: var(--text-base);
  border-radius: var(--r);
}

.btn--sm {
  padding: 0.35rem 0.7rem;
  font-size: var(--text-xs);
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: center;
}

/* On a dark section, secondary buttons need the inverse treatment. */
.section--dark .btn--secondary {
  background: transparent;
  border-color: var(--border-inverse);
  color: var(--text-inverse);
}

.section--dark .btn--secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-inverse);
}


/* 10  Cards =============================================================== */

.card-grid {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
}

.card-grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); }
.card-grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); }

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color 0.14s ease, box-shadow 0.14s ease,
    transform 0.14s ease;
}

.card--link:hover,
.card:has(> a:hover) {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.card__media {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--bg-inverse);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__media--square { aspect-ratio: 1 / 1; }

.card__body {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-5);
  flex: 1 1 auto;
}

.card__title {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  letter-spacing: -0.014em;
}

.card__title a {
  color: inherit;
  text-decoration: none;
}

/* Stretched link: on .card--link the title anchor covers the whole card, so
   the entire card is clickable without nesting anchors. Only applied inside
   .card--link, which supplies the positioning context. */
.card--link { position: relative; }

.card--link .card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card__text {
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-wrap: pretty;
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-2) var(--s-3);
  margin-top: auto;
  padding-top: var(--s-3);
  font-size: var(--text-sm);
  color: var(--text-faint);
}

.card__footer {
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}

.card--flat {
  background: var(--bg-subtle);
  box-shadow: none;
}

.card--accent { border-color: var(--accent-border); }


/* 11  Tables ============================================================== */

/* Always wrap a table in .table-wrap — it keeps wide tables from pushing the
   page sideways on narrow screens. */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}

.table-wrap > table {
  border: 0;
  border-radius: 0;
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  background: var(--surface);
}

caption {
  caption-side: bottom;
  padding-top: var(--s-3);
  color: var(--text-faint);
  font-size: var(--text-sm);
  text-align: left;
}

th,
td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

thead th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-strong);
}

tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }

tbody tr:hover { background: var(--bg-subtle); }

.table--zebra tbody tr:nth-child(even) { background: var(--bg-subtle); }

.table--compact th,
.table--compact td { padding: 0.4rem 0.6rem; }

/* .table--numeric: first column stays left (it labels the row), every other
   column is right-aligned so the digits line up. */
.num,
.table--numeric th:not(:first-child),
.table--numeric td:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}


/* 12  Forms =============================================================== */

fieldset {
  border: 0;
  padding: 0;
  min-width: 0;
}

legend {
  padding: 0;
  font-size: var(--text-base);
  font-weight: 650;
  letter-spacing: -0.01em;
}

label { display: block; }

.field { min-width: 0; }

.field + .field { margin-top: var(--s-4); }

.field__label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.field__hint {
  display: block;
  margin-top: 0.3rem;
  font-size: var(--text-xs);
  color: var(--text-faint);
  text-wrap: pretty;
}

.field__error {
  display: block;
  margin-top: 0.3rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--bad);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
select,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input[type="number"] { font-variant-numeric: tabular-nums; }

textarea {
  min-height: 6rem;
  resize: vertical;
  line-height: 1.5;
}

select {
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236B7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 1rem 1rem;
  cursor: pointer;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239CA3AF' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
  }
}

:root[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239CA3AF' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible { outline: none; }

/* Forced-colours modes drop box-shadow and repaint border-color, which would
   leave a focused field with no indicator at all. Put a real outline back. */
@media (forced-colors: active) {
  input:focus,
  select:focus,
  textarea:focus,
  .input-affix:focus-within {
    outline: 2px solid Highlight;
    outline-offset: 1px;
  }
}

input::placeholder,
textarea::placeholder { color: var(--text-faint); }

input[aria-invalid="true"],
select[aria-invalid="true"] { border-color: var(--bad); }

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--bg-sunken);
  color: var(--text-faint);
  cursor: not-allowed;
}

/* Input with a leading unit (currency symbol, %) or trailing suffix. */
.input-affix {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.input-affix:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.input-affix > input,
.input-affix > select {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.input-affix > input:focus,
.input-affix > select:focus { box-shadow: none; }

.input-affix__unit {
  display: flex;
  align-items: center;
  padding-inline: 0.7rem;
  background: var(--bg-subtle);
  color: var(--text-faint);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
}

.input-affix__unit:first-child { border-right: 1px solid var(--border); }
.input-affix__unit:last-child  { border-left: 1px solid var(--border); }

/* Checkbox / radio rows. The label is the tap target, so it carries the 24px
   minimum from WCAG 2.5.8 — a single line of --text-sm is only 23px tall. */
.check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-height: 1.5rem;
  font-size: var(--text-sm);
  cursor: pointer;
}

.check input[type="checkbox"],
.check input[type="radio"] {
  width: 1rem;
  height: 1rem;
  margin: 0.22rem 0 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
  cursor: pointer;
}

.check + .check { margin-top: var(--s-2); }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: center;
  margin-top: var(--s-5);
}


/* 13  Result panels ======================================================
   Base styles shared by every calculator. Layout for them lives in tool.css. */

.result-panel {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}

.result-panel__title {
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--s-4);
}

.result-headline {
  display: block;
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  /* A big enough figure must wrap, not spill out of the panel and off the
     side of a 360px screen, where overflow-x: clip makes it unreadable. */
  overflow-wrap: break-word;
}

.result-headline--accent { color: var(--accent); }
.result-headline--ok  { color: var(--ok); }
.result-headline--bad { color: var(--bad); }

.result-caption {
  display: block;
  margin-top: var(--s-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-wrap: pretty;
}

.result-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}

.result-row:last-child { border-bottom: 0; }

.result-row__label {
  flex: 1 1 auto;
  color: var(--text-muted);
  min-width: 0;
}

/* The value keeps its natural width (flex-shrink: 0) so the label is what
   wraps, not the number. max-width + overflow-wrap are the backstop for a
   figure so long it cannot fit the row at all: it breaks rather than running
   off the side of a 360px screen, where overflow-x: clip hides it for good. */
.result-row__value {
  flex: 0 0 auto;
  max-width: 100%;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
  text-align: right;
  color: var(--text);
}

.result-row--total {
  margin-top: var(--s-2);
  padding-top: var(--s-3);
  border-top: 2px solid var(--border-strong);
  border-bottom: 0;
  font-size: var(--text-base);
}

.result-row--total .result-row__label {
  color: var(--text);
  font-weight: 600;
}

.result-row--total .result-row__value { font-size: var(--text-lg); }


/* 14  Components ========================================================== */

.hero { padding-block: clamp(2.5rem, 1.5rem + 4.5vw, 5.5rem) clamp(2rem, 1.4rem + 3vw, 4rem); }

.hero__title {
  font-size: var(--text-4xl);
  letter-spacing: -0.032em;
  max-width: 18ch;
}

.hero > * + * { margin-top: var(--s-4); }
.hero .btn-row { margin-top: var(--s-6); }

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-faint);
  border-radius: var(--r);
  background: var(--bg-subtle);
  padding: var(--s-4) var(--s-5);
  font-size: var(--text-sm);
}

.callout > * + * { margin-top: var(--s-2); }

.callout__title {
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: 0;
}

.callout--info { border-left-color: var(--accent); background: var(--accent-soft); }
.callout--ok   { border-left-color: var(--ok);   background: var(--ok-bg); }
.callout--warn { border-left-color: var(--warn); background: var(--warn-bg); }
.callout--bad  { border-left-color: var(--bad);  background: var(--bad-bg); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge--accent {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.badge--ok   { background: var(--ok-bg);   border-color: transparent; color: var(--ok); }
.badge--warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.price {
  font-size: var(--text-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
}

.price__note {
  margin-left: 0.4rem;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-faint);
}

/* Feature / spec list with no bullets */
.feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.feature-list li {
  position: relative;
  padding-left: 1.6rem;
}

.feature-list li + li { margin-top: var(--s-3); }

.feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.75rem;
  height: 0.4rem;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

/* FAQ / disclosure */
.faq { border-top: 1px solid var(--border); }

.faq details {
  border-bottom: 1px solid var(--border);
}

.faq summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-4) 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--text-faint);
  font-weight: 400;
  font-size: var(--text-lg);
  line-height: 1;
}

.faq details[open] summary::after { content: "\2212"; }

.faq details > *:not(summary) {
  padding-bottom: var(--s-4);
  color: var(--text-muted);
  max-width: var(--w-prose);
}

/* Breadcrumb */
.breadcrumb {
  font-size: var(--text-sm);
  color: var(--text-faint);
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.4rem;
  color: var(--border-strong);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }

/* Small labelled statistic, usable outside calculators too */
.stat__label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.stat__value {
  display: block;
  margin-top: 0.15rem;
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}


/* 15  Utilities =========================================================== */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-sm    { font-size: var(--text-sm); }
.text-xs    { font-size: var(--text-xs); }
.text-center { text-align: center; }
.nums       { font-variant-numeric: tabular-nums; }
.nowrap     { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mt-7 { margin-top: var(--s-7); }
.measure { max-width: var(--w-prose); }
.center-col { margin-inline: auto; }
.hide { display: none; }

@media (max-width: 47.99em) {
  .hide-sm { display: none; }
}


/* 16  Motion & print ====================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  /* Three selectors so these beat the dark-theme blocks above, whichever of
     them is active when the reader hits Print. */
  :root,
  :root:not([data-theme="light"]),
  :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #fff;
    --bg-subtle: #fff;
    --bg-sunken: #fff;
    --surface: #fff;
    --text: #000;
    --text-muted: #333;
    --text-faint: #555;
    --border: #ccc;
    --border-strong: #999;
    --bg-inverse: #fff;
    --text-inverse: #000;
    --text-inverse-muted: #555;
    --border-inverse: #ccc;
    --accent: #1D4ED8;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.4;
  }

  .site-header,
  .site-nav,
  .nav-toggle,
  .skip-link,
  .site-footer__cols,
  .btn,
  .no-print { display: none !important; }

  .site-footer {
    margin-top: var(--s-5);
    background: none;
    border-top: 1px solid #ccc;
  }

  .section { padding-block: 0.5rem; }

  a { color: #000; text-decoration: underline; }

  .prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
    word-break: break-all;
  }

  .card,
  .result-panel,
  .table-wrap,
  .callout {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
  }

  h1, h2, h3 { break-after: avoid; }

  table { break-inside: auto; }
  tr, img { break-inside: avoid; }

  thead { display: table-header-group; }
}


/* 17  Pre-launch states =================================================== */
/* Appended by build-site.py when a buy_url or a legal field is still empty.
   Refilling the config and rebuilding removes this block entirely. */

.buy-pending {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-2);
  max-width: 100%;
  text-align: left;
}

.buy-pending--block {
  display: flex;
  width: 100%;
}

.btn.buy-pending__btn {
  background: var(--bg-sunken);
  border-color: var(--border-strong);
  border-style: dashed;
  color: var(--text-muted);
  box-shadow: none;
  cursor: default;
  opacity: 1;
}

.buy-pending--block .buy-pending__btn { width: 100%; }

.buy-pending__note {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-faint);
  max-width: 34rem;
}

.text-center .buy-pending,
.center-col .buy-pending {
  align-items: center;
  text-align: center;
}

/* .btn-row centres its items. Next to a two-line notice that leaves the
   sibling button floating at half height, so top-align that row instead. */
.btn-row:has(.buy-pending) { align-items: flex-start; }

.section--dark .btn.buy-pending__btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-inverse);
  color: var(--text-inverse);
}

.section--dark .buy-pending__note { color: var(--text-inverse-muted); }

/* The accent blue only reaches 2.84:1 on the slate band — the same reason the
   focus ring is overridden above. Use the inverse text colour for the support
   link inside a dark section. */
.section--dark .buy-pending__note a {
  color: var(--text-inverse);
  text-decoration-color: rgba(255, 255, 255, 0.45);
}

/* An identity field the owner has not supplied yet. Deliberately loud: it is
   meant to be impossible to ship by accident without noticing. */
.pending-value {
  display: inline-block;
  padding: 0.05em 0.4em;
  border: 1px dashed var(--warn);
  border-radius: var(--r-sm, 4px);
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 600;
  font-size: 0.95em;
}

@media print {
  .btn.buy-pending__btn { border-style: dashed; }
}
