/* =======================================================================
   Infinity Insights - UI system (mobile-first)
   Design goals
   - Clean, modern, trustworthy (fintech-like) but not distracting
   - Fast to scan (cards + clear hierarchy)
   - Accessible defaults (contrast, focus rings, target sizes)
   - Works without frameworks (self-hostable)
   ======================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800;900&family=Space+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@500;600&display=swap");

/* Theme tokens --------------------------------------------------------- */
:root{
  --sans: "Manrope", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --display: "Space Grotesk", "Manrope", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --maxw: 1180px;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius: 18px;
  --radius-lg: 22px;

  --panel-bg: linear-gradient(180deg,
    color-mix(in srgb, var(--surface) 96%, transparent),
    color-mix(in srgb, var(--surface) 88%, transparent)
  );
  --panel-bg-soft: linear-gradient(180deg,
    color-mix(in srgb, var(--surface-2) 80%, transparent),
    color-mix(in srgb, var(--surface) 92%, transparent)
  );
  --panel-shadow-hover: 0 18px 42px color-mix(in srgb, var(--text) 12%, transparent);

  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #edf2f7;

  --text: #0b1220;
  --muted: #52607a;

  --border: rgba(15, 23, 42, 0.12);
  --border-strong: rgba(15, 23, 42, 0.18);

  --primary: #14b8a6;
  --primary-2: #22c55e;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --link: #087569;
  --link-hover: #065f56;
  --link-strong: #0f766e;

  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;

  --shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 28px 72px rgba(15, 23, 42, 0.18);

  --focus: rgba(15, 118, 110, 0.26);
  --focus-ring: #0f766e;

  --header-h: calc(55px + env(safe-area-inset-top));
}

/* System dark mode */
@media (prefers-color-scheme: dark){
  :root{
    --bg: #080d19;
    --surface: #0f172a;
    --surface-2: #101b33;

    --text: #e2e8f0;
    --muted: #94a3b8;

    --border: rgba(226, 232, 240, 0.12);
    --border-strong: rgba(226, 232, 240, 0.24);

    --shadow: 0 20px 60px rgba(0,0,0,0.45);
    --shadow-lg: 0 34px 90px rgba(0,0,0,0.55);

    --link: #5eead4;
    --link-hover: #99f6e4;
    --link-strong: #99f6e4;

    --focus: rgba(94, 234, 212, 0.30);
    --focus-ring: #5eead4;
  }
}

/* Explicit theme overrides (via site.js) */
html[data-theme="light"]{
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #edf2f7;

  --text: #0b1220;
  --muted: #52607a;

  --border: rgba(15, 23, 42, 0.12);
  --border-strong: rgba(15, 23, 42, 0.18);

  --shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 28px 72px rgba(15, 23, 42, 0.18);

  --link: #087569;
  --link-hover: #065f56;
  --link-strong: #0f766e;

  --focus: rgba(15, 118, 110, 0.26);
  --focus-ring: #0f766e;
}

html[data-theme="dark"]{
  --bg: #080d19;
  --surface: #0f172a;
  --surface-2: #101b33;

  --text: #e2e8f0;
  --muted: #94a3b8;

  --border: rgba(226, 232, 240, 0.12);
  --border-strong: rgba(226, 232, 240, 0.24);

  --shadow: 0 20px 60px rgba(0,0,0,0.45);
  --shadow-lg: 0 34px 90px rgba(0,0,0,0.55);

  --link: #5eead4;
  --link-hover: #99f6e4;
  --link-strong: #99f6e4;

  --focus: rgba(94, 234, 212, 0.30);
  --focus-ring: #5eead4;
}

/* Base --------------------------------------------------------------- */
*{ box-sizing: border-box; }
html{
  min-height: 100%;
  /* Ensure the background also fills the browser canvas (helps on mobile overscroll). */
  background:
    radial-gradient(1200px 700px at 10% -10%, color-mix(in srgb, var(--accent) 25%, transparent), transparent 60%),
    radial-gradient(1100px 680px at 92% 0%, color-mix(in srgb, var(--primary) 24%, transparent), transparent 58%),
    radial-gradient(900px 620px at 50% 100%, color-mix(in srgb, var(--primary-2) 20%, transparent), transparent 58%),
    var(--bg);
}
body{
  min-height: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  position: relative;
  isolation: isolate;
  text-rendering: optimizeLegibility;
}

body::before{
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(520px 320px at 16% 12%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    radial-gradient(680px 380px at 85% 0%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 62%),
    radial-gradient(800px 500px at 50% 100%, color-mix(in srgb, var(--primary-2) 14%, transparent), transparent 60%);
  opacity: 0.9;
  pointer-events: none;
}

body::after{
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(90deg, color-mix(in srgb, var(--text) 8%, transparent) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--text) 8%, transparent) 1px, transparent 1px);
  background-size: 140px 140px;
  opacity: 0.18;
  pointer-events: none;
}

a{ color: var(--link); text-underline-offset: 3px; }
a:hover{ color: var(--link-hover); text-decoration-thickness: 2px; }

h1, h2, h3, .brand-name, .section-title, .menu-heading{
  font-family: var(--display);
}
h1, h2, h3{
  letter-spacing: 0;
}

/*
  Content link styling
  - Keep navigation/menu links unchanged
  - Make in-content hyperlinks clearly recognizable, using the same tone as the Articles page
*/
main a:not(.btn):not(.chip):not(.tool-link):not(.tool-card):not(.track-card),
.footer a:not(.btn):not(.chip):not(.tool-link):not(.tool-card):not(.track-card){
  color: var(--link);
}
main a:not(.btn):not(.chip):not(.tool-link):not(.tool-card):not(.track-card):visited,
.footer a:not(.btn):not(.chip):not(.tool-link):not(.tool-card):not(.track-card):visited{
  color: var(--link);
}
main a:not(.btn):not(.chip):not(.tool-link):not(.tool-card):not(.track-card):hover,
.footer a:not(.btn):not(.chip):not(.tool-link):not(.tool-card):not(.track-card):hover{
  color: var(--link-hover);
}

.container{
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}


.hide-sm{ display: inline; }
.show-sm{ display: none; }
@media (max-width: 520px){
  .hide-sm{ display: none; }
  .show-sm{ display: inline; }
}

.skip-link{
  position: absolute;
  left: -9999px;
  top: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 9999;
}
.skip-link:focus{
  left: 12px;
}

#main{
  scroll-margin-top: calc(var(--header-h) + 14px);
}
#calculators{
  scroll-margin-top: calc(var(--header-h) + 14px);
}
#main:focus{
  outline: none;
}

/* Header + nav ------------------------------------------------------- */
.site-header{
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--text) 8%, transparent);
}

.site-header .container{
  /* Header should span the full viewport width (not the main content max width). */
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0 24px;
}
.nav{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  width: 100%;
}
.header-actions{
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0;
  min-width: 0;
}

.brand-name{
  font-weight: 800;
  font-size: 32px;
  letter-spacing: 0;
  line-height: 1.12;
  padding-bottom: 2px;
  color: var(--text);
  white-space: nowrap;
}
@supports (-webkit-background-clip: text) or (background-clip: text){
  .brand-name{
    background: linear-gradient(100deg, var(--text) 0%, color-mix(in srgb, var(--primary) 70%, var(--accent)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}
@media (max-width: 520px){
  .site-header .container{ padding: 0 16px; }
  .brand-name{ font-size: 23px; }
  .brand-badge{ font-size: 38px; }
}
.brand-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text);
  font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols", "Noto Sans Symbols2", "Symbola", var(--display);
  font-weight: 900;
  font-size: 44px;
  line-height: 1;
  letter-spacing: 0;
  padding: 0;
  transform: translateY(-4px) scaleX(0.92);
  transform-origin: center;
}
@supports (-webkit-background-clip: text) or (background-clip: text){
  .brand-badge{
    background: linear-gradient(100deg, var(--text) 0%, color-mix(in srgb, var(--primary) 70%, var(--accent)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.nav-right{
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-actions{
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Header layout variant: centered brand + left menu + right profile */
.nav-grid{
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.nav-left{
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
}
.nav-center{ justify-self: center; }
.nav-right{
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.brand-center{ justify-content: center; }

@media (max-width: 520px){
  .nav-grid{ grid-template-columns: auto 1fr auto; }
  .brand-name{ font-size: 23px; }
}

/* Home: secondary banner under the header (Menu left / Profile right) */
.home-header-inner{
  display: flex;
  align-items: center;
  justify-content: center;
}

.sub-header{
  position: sticky;
  top: var(--header-h);
  z-index: 999;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  backdrop-filter: blur(12px);
}

.sub-header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

.sub-header-left,
.sub-header-right{
  display: flex;
  align-items: center;
}

.tool-switch{
  display: flex;
  align-items: center;
  gap: 8px;
}
.tool-switch__label{
  font-weight: 700;
  color: var(--muted);
  font-size: 0.95rem;
}
.tool-select{
  min-width: 190px;
  max-width: 240px;
  padding-right: 34px;
}
@media (max-width: 520px){
  .tool-switch__label{ display: none; }
  .tool-select{ min-width: 0; max-width: 180px; }
}

/* Parent tools dropdown ------------------------------------------------ */
.tool-menu{ position: relative; }
.tool-menu-btn{ white-space: nowrap; }
.tool-menu-chev{ font-size: 0.9em; opacity: 0.75; }

.tool-menu-panel{
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--surface) 98%, transparent),
    color-mix(in srgb, var(--surface) 92%, transparent)
  );
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 80;
}
@supports (backdrop-filter: blur(16px)){
  .tool-menu-panel{ backdrop-filter: blur(16px); }
}

/* Left-aligned menu panel (for the main Menu button) */
.menu-panel-left{
  left: 0;
  right: auto;
}

/* Nested menu (Parent tools) */
.menu-accordion{
  margin: 4px 0;
}
.menu-accordion summary{
  list-style: none;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.menu-accordion summary::-webkit-details-marker{ display: none; }
.menu-accordion summary::marker{ content: ""; }
.menu-accordion summary::after{
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid color-mix(in srgb, var(--text) 45%, var(--muted));
  border-bottom: 2px solid color-mix(in srgb, var(--text) 45%, var(--muted));
  transform: rotate(45deg);
  transition: transform 160ms ease, border-color 160ms ease;
  flex: 0 0 auto;
}
.menu-accordion[open] summary::after{
  transform: rotate(-135deg);
}
.menu-accordion summary:hover::after{
  border-color: color-mix(in srgb, var(--primary) 60%, var(--text));
}

.menu-sub{
  padding: 0 6px 6px 6px;
  display: grid;
  gap: 6px;
}

.tool-menu-subitem{
  display: flex;
  align-items: center;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--link);
  font-weight: 650;
  border: 1px solid transparent;
  margin-left: 8px;
}

.tool-menu-subitem:hover{
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--link-hover);
}

.tool-menu-subitem[aria-current="page"]{
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

/* Small section label inside dropdown panels */
.menu-subheading{
  padding: 0 10px 8px 10px;
  color: var(--muted);
  font-weight: 850;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@media (max-width: 720px){
  .tool-menu-panel{
    position: fixed;
    top: calc(var(--header-h) + 10px);
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    min-width: 0;
    max-height: calc(100vh - var(--header-h) - 24px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 2000;
  }
}


/* Dropdown menu helpers (Settings / Profile) */
.tool-menu-panel .menu-heading{
  padding: 10px 10px 6px 10px;
  font-weight: 900;
  letter-spacing: 0;
  font-size: 0.95rem;
}
.tool-menu-panel .menu-note{
  padding: 0 10px 10px 10px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}
.tool-menu-panel .menu-divider{
  height: 1px;
  background: var(--border);
  margin: 8px 6px;
}
.tool-menu-panel button.tool-menu-item{
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.tool-menu-panel button.tool-menu-item:focus-visible{
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}
.tool-menu-item[aria-checked="true"]{
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
}

.tool-menu.open .tool-menu-panel,
.tool-menu:focus-within .tool-menu-panel{
  display: block;
}

.tool-menu-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-weight: 650;
}

a.tool-menu-item{
  color: var(--link);
}

.tool-menu-item:hover{
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.tool-menu-item[aria-current="page"]{
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
}

a.tool-menu-item:hover{
  color: var(--link-hover);
}

.icon-pill{
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--surface) 92%, transparent),
    color-mix(in srgb, var(--surface) 78%, transparent)
  );
  color: var(--text);
  font-family: inherit;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
  cursor: pointer;
  font-weight: 650;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.icon-pill:hover{
  border-color: var(--border-strong);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--text) 10%, transparent);
  transform: translateY(-1px);
}
.icon-pill:focus-visible{
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}
@media (max-width: 720px){
  :root{ --header-h: calc(58px + env(safe-area-inset-top)); }
  .site-header .container{ padding: 0 14px; }
  .header-row{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }
  .header-actions{
    display: flex;
    position: fixed;
    top: calc(env(safe-area-inset-top) + 8px);
    right: 14px;
    width: auto;
    height: auto;
    min-width: 0;
    transform: none;
    justify-content: flex-end;
    justify-self: end;
    gap: 6px;
    flex-direction: row-reverse;
    overflow: visible;
    z-index: 1101;
  }
  .header-actions > .tool-menu{ flex: 0 0 auto; }
  [data-profile-menu-button]{
    width: 40px;
    min-width: 40px;
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }
  .brand{
    grid-column: 1;
    width: 100%;
    min-width: 0;
    padding-right: 146px;
    gap: 8px;
    overflow: hidden;
  }
  .brand-name{
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.08;
  }
  .brand-badge{ flex: 0 0 auto; font-size: 36px; }
  .icon-pill{
    gap: 6px;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.95rem;
  }
}
@media (max-width: 720px){
  [data-profile-menu] .hide-sm,
  [data-profile-menu] .show-sm{
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
@media (max-width: 420px){
  [data-main-menu] .hide-sm,
  [data-main-menu] .show-sm{
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  [data-main-menu-button]{
    width: 44px;
    min-width: 44px;
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }
}
@media (max-width: 340px){
  :root{ --header-h: calc(56px + env(safe-area-inset-top)); }
  .site-header .container{ padding: 0 12px; }
  .header-actions{
    right: 12px;
  }
  .header-row{
    gap: 6px;
  }
  .header-actions{
    gap: 6px;
  }
  .brand{
    padding-right: 96px;
  }
  .brand-name{
    font-size: 21px;
  }
  .brand-badge{ font-size: 34px; }
  .icon-pill{
    padding: 8px 10px;
  }
}
.nav-toggle{ display: none; }

.nav-links{
  display: flex;
  align-items: center;
  gap: 10px;
}
.link{
  text-decoration: none;
  color: var(--text);
  font-weight: 650;
}

button.link{
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}
button.link:focus-visible{
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}

.pill{
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.link.pill:hover{
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
}
.link.pill.active{
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

@media (max-width: 860px){
  .nav-toggle{ display: inline-flex; }
  .nav-links{
    display: none;
    position: absolute;
    z-index: 1200;
    top: calc(var(--header-h) + 10px);
    right: 12px;
    left: 12px;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  body.nav-open .nav-links{ display: flex; }
}

/* Layout sections ----------------------------------------------------- */
main{ flex: 1 0 auto; padding: 28px 0 60px; }

.hero{
  padding: 18px 0 24px;
}
.card.hero-card{
  padding: 26px 24px;
  display: grid;
  gap: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--primary) 12%, transparent) 0%, transparent 60%),
    var(--surface);
}
.hero h1{
  margin: 0;
  font-size: clamp(26px, 3.6vw, 40px);
  letter-spacing: 0;
  line-height: 1.08;
}
.hero p{
  margin: 0;
  color: var(--muted);
  max-width: 68ch;
  font-size: 1.05rem;
}
.hero-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}
@media (max-width: 520px){
  .hero-actions .btn{ width: 100%; }
}

.hero-kicker{
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--muted);
}

.hero-note,
.trust-line{
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.hero-badges{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.hero-card--split{
  display: grid;
  gap: 18px;
  align-items: start;
}
@media (min-width: 900px){
  .hero-card--split{ grid-template-columns: 1.1fr 0.9fr; }
}

.hero-copy{ display: flex; flex-direction: column; gap: 8px; }

.hero-rail{
  display: grid;
  gap: 12px;
  align-content: start;
}
.hero-panel{
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-bg-soft);
  display: grid;
  gap: 8px;
}
.hero-panel-title{
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
}
.hero-panel-value{
  font-weight: 900;
  font-size: 1.1rem;
}
.hero-panel-desc{
  color: var(--muted);
  font-size: 0.9rem;
}
@media (max-width: 520px){
  .hero-panel .btn{ width: 100%; }
}

.track-grid{
  display: grid;
  gap: 14px;
  margin-top: 14px;
  margin-bottom: 14px;
  align-items: stretch;
  grid-template-columns: 1fr;
}
@media (min-width: 900px){
  .track-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.track-card{
  text-decoration: none;
  color: var(--text);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent) 0%, transparent 60%),
    var(--panel-bg);
  align-self: stretch;
}
.track-grid > .track-card,
.track-grid > .card.track-card + .card.track-card{
  margin-top: 0;
  height: 100%;
}
.track-card h2,
.track-card p{ margin: 0; }
.track-card h2{
  min-height: 2.6em;
}
.track-card p{
  min-height: 2.6em;
}
@media (max-width: 720px){
  .track-card h2,
  .track-card p{
    min-height: 0;
  }
}

.track-card:hover{
  text-decoration: none;
}

.track-meta{
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.track-cta{
  margin-top: auto;
  font-weight: 800;
  color: var(--link-strong);
}

.track-points{
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}
.track-points li{
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 8px;
  align-items: start;
}
.track-points li::before{
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  background: color-mix(in srgb, var(--primary) 70%, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

.tool-grid{
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}
@media (min-width: 860px){
  .tool-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.tool-grid--two{
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 860px){
  .tool-grid--two{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.section-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head .btn{ white-space: nowrap; }
@media (max-width: 520px){
  .section-head{ align-items: flex-start; }
}

.insight-grid{
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: stretch;
}

.insight-card{
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-bg-soft);
  text-decoration: none;
  color: var(--text);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  height: 100%;
}
@media (hover: hover){
  .insight-card:hover{
    border-color: color-mix(in srgb, var(--primary) 22%, var(--border));
    box-shadow: 0 16px 32px color-mix(in srgb, var(--text) 10%, transparent);
    transform: translateY(-2px);
    text-decoration: none;
  }
}

.insight-meta{
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--muted);
}
.insight-title{
  font-weight: 900;
  font-size: 1rem;
  line-height: 1.3;
}
.insight-desc{
  color: var(--muted);
  font-size: 0.9rem;
}

.tool-card{
  display: block;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-bg-soft);
  text-decoration: none;
  color: var(--text);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  height: 100%;
}
@media (hover: hover){
  .tool-card:hover{
    border-color: color-mix(in srgb, var(--primary) 22%, var(--border));
    box-shadow: 0 16px 32px color-mix(in srgb, var(--text) 10%, transparent);
    transform: translateY(-2px);
    text-decoration: none;
  }
}

.tool-title{
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 4px;
}
.tool-desc{
  color: var(--muted);
  font-size: 0.92rem;
}

.tool-meta{
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.disclaimer-block p{ margin: 0 0 6px 0; }
.disclaimer-block p:last-child{ margin-bottom: 0; }
.disclaimer-block{
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--warning) 10%, transparent) 0%, transparent 60%),
    var(--panel-bg);
}

.trust-grid{
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 900px){
  .trust-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px){
  .trust-grid{ grid-template-columns: 1fr; }
}

.trust-item{
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-bg-soft);
}
.trust-title{
  font-weight: 800;
  margin-bottom: 4px;
}
.trust-desc{
  color: var(--muted);
  font-size: 0.92rem;
}

/* Cards + surfaces ---------------------------------------------------- */
.card{
  border-radius: var(--radius);
  border: 1px solid var(--border);
  /* Fallback background for browsers without color-mix() support */
  background: var(--surface);
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
@supports (backdrop-filter: blur(12px)){
  .card{ backdrop-filter: blur(12px); }
}
.card.pad{ padding: 18px; }
.card.soft{
  background: var(--panel-bg-soft);
}
.card h2, .card h3{ margin: 0; }
.card + .card{ margin-top: 14px; }
@media (hover: hover){
  .card:hover{
    border-color: color-mix(in srgb, var(--primary) 18%, var(--border));
    box-shadow: var(--panel-shadow-hover);
    transform: translateY(-2px);
  }
}

.badge{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  /* Badges are informational (not links). Keep them neutral so they don't look clickable. */
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 78%, transparent);
  color: color-mix(in srgb, var(--text) 92%, var(--muted));
  font-weight: 650;
  width: fit-content;
}

/* Forms --------------------------------------------------------------- */
.section-title{
  margin-top: 16px;
  margin-bottom: 10px;
  font-weight: 800;
  letter-spacing: 0;
  font-size: 1.05rem;
}
.form-grid{
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 720px){
  .form-grid{ grid-template-columns: 1fr; }
}
.span-2{ grid-column: 1 / -1; }

.field label{
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 0.95rem;
}
.field input,
.field select,
.field textarea{
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.field textarea{ min-height: 110px; resize: vertical; }

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible{
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  box-shadow: 0 0 0 4px var(--focus);
}

.help{
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}
.small{ font-size: 0.9rem; color: var(--muted); }
.sep{
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

/* Buttons ------------------------------------------------------------- */
.btn-row{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text);
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}
.btn:hover{
  border-color: var(--border-strong);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--text) 10%, transparent);
  transform: translateY(-1px);
}
.btn:active{ transform: translateY(0); }
.btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}
.btn-primary{
  border-style: solid;
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--primary) 20%, var(--surface)),
    color-mix(in srgb, var(--primary) 8%, var(--surface))
  );
  color: color-mix(in srgb, var(--text) 84%, var(--primary));
  box-shadow: 0 12px 26px color-mix(in srgb, var(--primary) 25%, transparent);
}
.btn-primary:hover{
  border-color: color-mix(in srgb, var(--primary) 60%, var(--border));
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--primary) 26%, var(--surface)),
    color-mix(in srgb, var(--primary) 12%, var(--surface))
  );
}
.btn-ghost{
  background: transparent;
  border-style: dashed;
}
.btn-danger{
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

/* Notices ------------------------------------------------------------- */
.notice{
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-bg-soft);
  color: color-mix(in srgb, var(--text) 92%, var(--muted));
}
.notice--error{
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}
.notice--info{
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}
.notice--warn{
  border-color: color-mix(in srgb, var(--warning) 55%, var(--border));
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
}

/* Calculator layout --------------------------------------------------- */
.calc-layout{
  display: grid;
  gap: 14px;
  align-items: start;
}
.calc-layout.equal-cards{
  align-items: stretch;
}
.calc-layout.equal-cards > .card{
  height: 100%;
  display: flex;
  flex-direction: column;
}
@media (min-width: 980px){
  .calc-layout{ grid-template-columns: 1.05fr 0.95fr; }
  .sticky{ position: sticky; top: calc(var(--header-h) + 14px); }
}

/* Stats --------------------------------------------------------------- */
.stats{
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}
@media (max-width: 560px){
  .stats{ grid-template-columns: 1fr; }
}
.stats--results{
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 900px){
  .stats--results{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.stat{
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-bg-soft);
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  height: 100%;
}
.stat .label{ color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; }
.stat .value{ font-weight: 900; font-size: 1.25rem; letter-spacing: 0; }
.stats--links .stat{
  display: flex;
  flex-direction: column;
}
.stats--links .stat .small:last-child{
  margin-top: auto;
}
@media (hover: hover){
  .stat:hover{
    border-color: color-mix(in srgb, var(--primary) 22%, var(--border));
    box-shadow: 0 16px 32px color-mix(in srgb, var(--text) 10%, transparent);
    transform: translateY(-2px);
  }
}

.table{
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}
.table th, .table td{
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
}
.table th{ color: var(--muted); font-weight: 800; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* Footer -------------------------------------------------------------- */
.footer{
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  padding: 26px 0 calc(34px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.95rem;
}
.footer a{ color: var(--link); }

/* Motion -------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference){
  .hero-card{
    animation: rise-in 520ms ease both;
  }
  .track-card{
    animation: rise-in 520ms ease both;
  }
  .track-card:nth-child(2){ animation-delay: 80ms; }
  .tool-card{
    animation: rise-in 520ms ease both;
  }
  .tool-card:nth-child(1){ animation-delay: 40ms; }
  .tool-card:nth-child(2){ animation-delay: 80ms; }
  .tool-card:nth-child(3){ animation-delay: 120ms; }
  .tool-card:nth-child(4){ animation-delay: 160ms; }
  .tool-card:nth-child(5){ animation-delay: 200ms; }
  .tool-card:nth-child(6){ animation-delay: 240ms; }
  .stats .stat{
    animation: rise-in 520ms ease both;
  }
  .stats .stat:nth-child(1){ animation-delay: 40ms; }
  .stats .stat:nth-child(2){ animation-delay: 80ms; }
  .stats .stat:nth-child(3){ animation-delay: 120ms; }
  .stats .stat:nth-child(4){ animation-delay: 160ms; }
  .calc-layout > .card{
    animation: rise-in 520ms ease both;
  }
  .calc-layout > .card:nth-child(2){ animation-delay: 120ms; }
}
@keyframes rise-in{
  from{ opacity: 0; transform: translateY(16px); }
  to{ opacity: 1; transform: translateY(0); }
}

/* Motion safety ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce){
  *{ scroll-behavior: auto !important; }
  .btn:hover{ transform: none; }
}

/* Button sizing helpers ------------------------------------------------ */
.btn-sm{
  min-height: 36px;
  padding: 8px 10px;
  font-size: 0.92rem;
  border-radius: var(--radius-sm);
}
