/* =========================================================
   PennyPath design system — single file, no build step
   System fonts, mobile-first, WCAG AA, CLS-safe by design
   ========================================================= */

/* ---------- TOKENS ---------- */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
             Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Code",
               Menlo, Consolas, "Liberation Mono", monospace;

  --fs-xs:   0.79rem;
  --fs-sm:   0.889rem;
  --fs-base: 1rem;
  --fs-md:   1.125rem;
  --fs-lg:   clamp(1.25rem, 1.1rem + 0.6vw, 1.4rem);
  --fs-xl:   clamp(1.5rem, 1.3rem + 0.9vw, 1.8rem);
  --fs-2xl:  clamp(1.9rem, 1.6rem + 1.4vw, 2.4rem);
  --fs-3xl:  clamp(2.3rem, 1.8rem + 2.4vw, 3.2rem);

  --lh-body: 1.6;
  --lh-tight: 1.15;
  --measure: 68ch;

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem;
  --space-4: 1rem;    --space-5: 1.5rem; --space-6: 2rem;
  --space-7: 3rem;    --space-8: 4rem;   --space-9: 6rem;

  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-pill: 999px;

  --container: 1120px;
  --container-narrow: 760px;
  --header-h: 60px;

  --ease: cubic-bezier(.2,.6,.2,1);
  --dur: 160ms;

  /* Light theme */
  --bg:           #ffffff;
  --surface:      #f7f8fa;
  --surface-2:    #eef0f4;
  --text:         #0f172a;
  --muted:        #51607a;
  --border:       #e2e6ee;
  --border-strong:#cdd4e0;

  --brand:        #3a5bd9;
  --brand-strong: #2942b8;
  --brand-soft:   #eaeefc;
  --on-brand:     #ffffff;

  --accent:        #0e8f87;
  --accent-strong: #0a716b;
  --on-accent:     #ffffff;

  --success: #1a7f4b;
  --warn:    #9a6700;
  --danger:  #c0392b;
  --focus:   #3a5bd9;

  --chart-1: #3a5bd9;
  --chart-2: #0e8f87;
  --chart-3: #c98a1a;

  --sh-1: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.08);
  --sh-2: 0 4px 12px rgba(15,23,42,.10), 0 2px 4px rgba(15,23,42,.06);
  --sh-3: 0 12px 32px rgba(15,23,42,.16);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0c1018; --surface:#141a26; --surface-2:#1d2533;
    --text:#e8edf6; --muted:#9aa7bd; --border:#283142; --border-strong:#39455a;
    --brand:#7d97f4; --brand-strong:#9db2f8; --brand-soft:#18203a; --on-brand:#0c1018;
    --accent:#3fd0c5; --accent-strong:#65ddd3; --on-accent:#06231f;
    --success:#46c98a; --warn:#e6b450; --danger:#f08a7e; --focus:#7d97f4;
    --chart-1:#7d97f4; --chart-2:#3fd0c5; --chart-3:#e6b450;
    --sh-1:0 1px 2px rgba(0,0,0,.4);
    --sh-2:0 4px 14px rgba(0,0,0,.5);
    --sh-3:0 14px 40px rgba(0,0,0,.6);
  }
}

:root[data-theme="dark"] {
  --bg:#0c1018; --surface:#141a26; --surface-2:#1d2533;
  --text:#e8edf6; --muted:#9aa7bd; --border:#283142; --border-strong:#39455a;
  --brand:#7d97f4; --brand-strong:#9db2f8; --brand-soft:#18203a; --on-brand:#0c1018;
  --accent:#3fd0c5; --accent-strong:#65ddd3; --on-accent:#06231f;
  --success:#46c98a; --warn:#e6b450; --danger:#f08a7e; --focus:#7d97f4;
  --chart-1:#7d97f4; --chart-2:#3fd0c5; --chart-3:#e6b450;
  --sh-1:0 1px 2px rgba(0,0,0,.4);
  --sh-2:0 4px 14px rgba(0,0,0,.5);
  --sh-3:0 14px 40px rgba(0,0,0,.6);
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
  color-scheme: light dark;
}
body {
  font-family: var(--font-ui); font-size: var(--fs-base); line-height: var(--lh-body);
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100dvh; display: flex; flex-direction: column;
}
img, picture, svg, video, canvas { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:where(a) { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: .15em; }
:where(a):hover { color: var(--brand-strong); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }

/* ---------- TYPOGRAPHY ---------- */
h1,h2,h3,h4 { line-height: var(--lh-tight); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-3xl); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
small, .text-sm { font-size: var(--fs-sm); }
.text-muted { color: var(--muted); }
.lead { font-size: var(--fs-md); color: var(--muted); }
.center { text-align: center; }

/* ---------- LAYOUT ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--space-4); }
.container-narrow { max-width: var(--container-narrow); }
main { flex: 1 0 auto; }
.section { padding-block: var(--space-8); }
.section-sm { padding-block: var(--space-6); }
.stack > * + * { margin-top: var(--space-4); }
.grid { display: grid; gap: var(--space-4); }
@media (min-width: 640px){ .grid-2 { grid-template-columns: repeat(2,1fr); } }
@media (min-width: 900px){ .grid-3 { grid-template-columns: repeat(3,1fr); } }
@media (min-width: 640px){ .grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); } }

/* ---------- HEADER / NAV ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; gap: var(--space-4); }
.brand-logo { font-weight: 800; font-size: var(--fs-md); letter-spacing: -.02em;
  color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: var(--space-2); }
.brand-logo .mark { color: var(--brand); }
.nav { margin-left: auto; display: flex; align-items: center; gap: var(--space-1); }
.nav a { color: var(--text); text-decoration: none; padding: var(--space-2) var(--space-3);
  border-radius: var(--r-sm); font-size: var(--fs-sm); }
.nav a:hover, .nav a[aria-current="page"] { background: var(--surface-2); }

.nav-mobile { margin-left: auto; position: relative; }
.nav-mobile > summary { list-style: none; cursor: pointer; padding: var(--space-2) var(--space-3);
  border:1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.nav-mobile > summary::-webkit-details-marker { display:none; }
.nav-mobile[open] .nav-panel {
  position: absolute; right: 0; top: calc(var(--header-h) - 8px);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--space-2); display: grid; gap: var(--space-1); box-shadow: var(--sh-2);
  min-width: 200px; z-index: 60;
}
.nav-panel a { padding: var(--space-3); border-radius: var(--r-sm); color: var(--text); text-decoration:none; }
.nav-panel a:hover { background: var(--surface-2); }
@media (min-width: 760px){ .nav-mobile { display:none; } }
@media (max-width: 759px){ .nav { display:none; } }

.theme-toggle { background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-pill); width: 38px; height: 38px; display: grid; place-items: center;
  font-size: 1.1rem; line-height: 1; }
.theme-toggle:hover { background: var(--border); }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-5); font-size: var(--fs-base); font-weight: 600; line-height: 1;
  border-radius: var(--r-md); border: 1px solid transparent; background: var(--surface-2); color: var(--text);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--sh-1); }
.btn-primary:hover { background: var(--brand-strong); color: var(--on-brand); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent-strong); color: var(--on-accent); }
.btn-ghost { background: transparent; border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-lg { padding: var(--space-4) var(--space-6); font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--fs-sm); }

/* ---------- CARDS ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--space-5); box-shadow: var(--sh-1);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
a.card { text-decoration: none; color: inherit; display: block; }
.card-link:hover, a.card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.card .eyebrow { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent-strong); }
.card h3 { font-size: var(--fs-lg); margin-top: var(--space-1); }
.card-icon { font-size: 1.6rem; line-height: 1; margin-bottom: var(--space-2); }

/* ---------- HERO ---------- */
.hero { text-align: center; padding-block: var(--space-9) var(--space-7); }
.hero h1 { max-width: 20ch; margin-inline: auto; }
.hero .lead { max-width: 56ch; margin: var(--space-4) auto var(--space-6); }
.hero-cta { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }
.trust-strip { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5);
  justify-content: center; color: var(--muted); font-size: var(--fs-sm); list-style: none; padding: 0; }
.trust-strip li { display: inline-flex; align-items: center; gap: var(--space-2); }
.trust-strip li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

.badge { display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-3); border-radius: var(--r-pill); font-size: var(--fs-xs);
  font-weight: 600; background: var(--brand-soft); color: var(--brand-strong);
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }

/* ---------- TOOL / CALCULATOR ---------- */
.tool-layout { display: grid; gap: var(--space-6); align-items: start; }
@media (min-width: 1000px){ .tool-layout { grid-template-columns: minmax(0,1fr) 300px; } }
.tool {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--space-6); box-shadow: var(--sh-1);
}
.field-grid { display: grid; gap: var(--space-4); }
@media (min-width: 560px){ .field-grid.cols-2 { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: var(--space-2); }
.field label { font-weight: 600; font-size: var(--fs-sm); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.input-prefix { position: relative; display: flex; align-items: center; }
.input-prefix > span { position: absolute; left: var(--space-3); color: var(--muted); pointer-events: none; }
.input-prefix > input { padding-left: 1.6rem; }
.input-suffix { position: relative; display: flex; align-items: center; }
.input-suffix > span { position: absolute; right: var(--space-3); color: var(--muted); pointer-events: none; }

.input, select, textarea {
  width: 100%; padding: var(--space-3) var(--space-4); background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
}
.input-mono { font-family: var(--font-mono); }
input[type="range"] { padding: 0; accent-color: var(--brand); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: var(--space-2) var(--space-3);
  border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: var(--sh-1); }

.tool-result {
  margin-top: var(--space-5); padding: var(--space-5);
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
  border-radius: var(--r-md); min-height: 96px; display: flex; flex-direction: column; justify-content: center;
}
.tool-result .result-label { font-size: var(--fs-sm); color: var(--muted); }
.tool-result .result-value { font-family: var(--font-mono); font-size: var(--fs-2xl); font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--text); }
.result-grid { display: grid; gap: var(--space-4); margin-top: var(--space-4); }
@media (min-width: 480px){ .result-grid.cols-2 { grid-template-columns: 1fr 1fr; } .result-grid.cols-3 { grid-template-columns: repeat(3,1fr); } }
.stat { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--space-4); }
.stat .k { font-size: var(--fs-sm); color: var(--muted); }
.stat .v { font-family: var(--font-mono); font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; }

.chart-wrap { margin-top: var(--space-5); }
.chart-wrap svg { width: 100%; height: auto; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin-top: var(--space-3);
  font-size: var(--fs-sm); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: var(--space-2); }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- ARTICLE ---------- */
.article { max-width: var(--measure); margin-inline: auto; }
.article > * + * { margin-top: var(--space-5); }
.article h2 { margin-top: var(--space-7); }
.article h3 { margin-top: var(--space-6); }
.article p, .article li { font-size: var(--fs-md); line-height: 1.7; }
.article ul, .article ol { padding-left: 1.4em; }
.article li + li { margin-top: var(--space-2); }
blockquote { border-left: 4px solid var(--brand); padding-left: var(--space-4); color: var(--muted); }
.callout { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--r-md); padding: var(--space-4); }

.breadcrumb { font-size: var(--fs-sm); color: var(--muted); display: flex; gap: var(--space-2);
  flex-wrap: wrap; padding-block: var(--space-4) 0; list-style: none; }
.breadcrumb a { color: var(--muted); }
.breadcrumb li + li::before { content: "/"; margin-right: var(--space-2); color: var(--border-strong); }

.faq dt { font-weight: 700; margin-top: var(--space-5); }
.faq dd { margin: var(--space-2) 0 0; color: var(--text); }

/* ---------- TABLES ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg);
  -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
thead th { position: sticky; top: 0; background: var(--surface-2); text-align: left;
  padding: var(--space-3) var(--space-4); font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--border); }
tbody td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:nth-child(even) { background: var(--surface); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.col-recommended { background: var(--brand-soft); }

/* ---------- AD ZONES (reserve space → zero CLS) ---------- */
.ad-slot { display: flex; align-items: center; justify-content: center; background: var(--surface);
  border: 1px dashed var(--border-strong); border-radius: var(--r-md); color: var(--muted);
  overflow: hidden; position: relative; margin-inline: auto; }
.ad-slot::before { content: "Advertisement"; position: absolute; top: 6px; left: 8px; font-size: var(--fs-xs);
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ad-leaderboard { width: 100%; min-height: 100px; }
.ad-rail { width: 300px; min-height: 250px; }
.ad-inline { width: 100%; min-height: 280px; max-width: 336px; }
@media (min-width: 1024px){ .ad-leaderboard { min-height: 90px; } }
/* When a real ad unit is present, drop the dashed placeholder styling. */
.ad-slot:has(.adsbygoogle) { border: none; background: transparent; }
.ad-slot:has(.adsbygoogle)::before { content: none; }

/* ---------- DISCLOSURE / FORMS ---------- */
.disclosure { font-size: var(--fs-sm); color: var(--muted); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--space-3) var(--space-4); }
.capture { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--space-5); display: grid; gap: var(--space-3); }
.capture .row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.capture input[type=email] { flex: 1 1 220px; }

.offer { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--space-4);
  background: var(--bg); display: flex; gap: var(--space-3); align-items: flex-start; }
.offer .offer-body { flex: 1; }
.offer h4 { font-size: var(--fs-base); }
.offer p { font-size: var(--fs-sm); color: var(--muted); margin-top: var(--space-1); }

/* ---------- RAIL ---------- */
.rail { display: grid; gap: var(--space-5); }
@media (min-width: 1000px){ .rail { position: sticky; top: calc(var(--header-h) + var(--space-4)); } }
.rail-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--space-4); }
.rail-box h4 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: var(--space-3); }
.rail-box ul { list-style: none; padding: 0; display: grid; gap: var(--space-1); }
.rail-box a { text-decoration: none; display: block; padding: var(--space-2); border-radius: var(--r-sm); color: var(--text); font-size: var(--fs-sm); }
.rail-box a:hover { background: var(--surface-2); }

/* ---------- FOOTER ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: var(--space-9);
  padding-block: var(--space-7); color: var(--muted); font-size: var(--fs-sm); flex-shrink: 0; }
.footer-grid { display: grid; gap: var(--space-6); }
@media (min-width: 640px){ .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.site-footer h4 { font-size: var(--fs-sm); color: var(--text); margin-bottom: var(--space-3);
  text-transform: uppercase; letter-spacing: .06em; }
.site-footer a { color: var(--muted); text-decoration: none; display: block; padding-block: var(--space-1); }
.site-footer a:hover { color: var(--text); }
.footer-note { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: space-between; align-items: center; }

/* ---------- UTILITIES ---------- */
.visually-hidden { position:absolute!important; width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }
.skip-link { position:absolute; left:-999px; top:0; background: var(--brand); color: var(--on-brand);
  padding: var(--space-3); border-radius: 0 0 var(--r-sm) 0; z-index:100; }
.skip-link:focus { left:0; }
.mt-0{margin-top:0}.mt-4{margin-top:var(--space-4)}.mt-6{margin-top:var(--space-6)}.mt-8{margin-top:var(--space-8)}
.tag { display:inline-block; font-size: var(--fs-xs); font-weight:600; padding: 2px var(--space-2);
  border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); }
