/* investinfo stylesheet. System fonts only, no external resources. */

:root {
  color-scheme: light;
  --bg: #f5f9f9;
  --surface: #ffffff;
  --surface-2: #e9f1f2;
  --text: #13262b;
  --text-muted: #435a60;
  --border: #c8d6d8;
  --border-strong: #637a80;
  --accent: #0b6b7a;
  --accent-hover: #084e5a;
  --accent-soft: #d9eef1;
  --on-accent: #ffffff;
  --danger: #a3261b;
  --warn-bg: #fff3dc;
  --warn-border: #9a5a00;
  --warn-text: #432800;
  --focus: #0b4fd0;
  --header-bg: rgba(255, 255, 255, .82);
  --glow-a: rgba(11, 107, 122, .16);
  --glow-b: rgba(34, 121, 160, .12);
  --glass: rgba(255, 255, 255, .78);
  --shadow: 0 1px 2px rgba(19, 38, 43, .05), 0 8px 24px rgba(19, 38, 43, .06);
  --shadow-hover: 0 2px 4px rgba(19, 38, 43, .08), 0 18px 40px rgba(19, 38, 43, .12);

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 14px;
  --maxw: 72rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1a1d;
    --surface: #132327;
    --surface-2: #1a2f34;
    --text: #e7f0f1;
    --text-muted: #a8bcc1;
    --border: #29424a;
    --border-strong: #7f999f;
    --accent: #5ccbdb;
    --accent-hover: #8fe0ec;
    --accent-soft: #173b42;
    --on-accent: #04262d;
    --danger: #ff9d92;
    --warn-bg: #3b2b0d;
    --warn-border: #e3a83f;
    --warn-text: #ffe8bf;
    --focus: #9bbcff;
    --header-bg: rgba(13, 26, 29, .8);
    --glow-a: rgba(92, 203, 219, .14);
    --glow-b: rgba(96, 128, 255, .10);
    --glass: rgba(19, 35, 39, .78);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 18px 40px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1a1d;
  --surface: #132327;
  --surface-2: #1a2f34;
  --text: #e7f0f1;
  --text-muted: #a8bcc1;
  --border: #29424a;
  --border-strong: #7f999f;
  --accent: #5ccbdb;
  --accent-hover: #8fe0ec;
  --accent-soft: #173b42;
  --on-accent: #04262d;
  --danger: #ff9d92;
  --warn-bg: #3b2b0d;
  --warn-border: #e3a83f;
  --warn-text: #ffe8bf;
  --focus: #9bbcff;
  --header-bg: rgba(13, 26, 29, .8);
  --glow-a: rgba(92, 203, 219, .14);
  --glow-b: rgba(96, 128, 255, .10);
  --glass: rgba(19, 35, 39, .78);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 18px 40px rgba(0, 0, 0, .4);
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1.125rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.75rem); }
h2 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.9rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
img, svg { max-width: 100%; height: auto; }

a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
main:focus { outline: none; }

.container { width: min(100% - 2rem, var(--maxw)); margin-inline: auto; }
.section { padding-block: 2.5rem; }
.muted { color: var(--text-muted); }
.lead { font-size: 1.25rem; color: var(--text-muted); max-width: 40rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: .5rem; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: .75rem 1rem; border-radius: 10px; font-weight: 700;
}
.skip-link:focus { left: .5rem; }

/* Header */
html { scroll-padding-top: 5rem; }
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header {
    background: var(--header-bg);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
  }
}
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .5rem 1.25rem; min-height: 4rem; padding-block: .5rem;
}
.brand {
  order: 1; display: inline-flex; align-items: center; gap: .55rem;
  font-size: 1.4rem; font-weight: 800; text-decoration: none; letter-spacing: -.02em;
}
.brand-mark { flex: 0 0 auto; width: 2rem; height: 2rem; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { fill: none; stroke: var(--on-accent); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.brand-a { color: var(--text); }
.brand-b { color: var(--accent); }
.header-tools { order: 2; margin-inline-start: auto; display: flex; align-items: center; gap: .5rem; }
.main-nav {
  order: 3; flex-basis: 100%; min-width: 0;
  overflow-x: auto; scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav ul { display: flex; flex-wrap: nowrap; gap: .15rem; list-style: none; margin: 0; padding: 0; white-space: nowrap; }
.main-nav a {
  display: inline-flex; align-items: center; min-height: 2.5rem;
  padding: .35rem .85rem; border-radius: 999px; color: var(--text-muted);
  text-decoration: none; font-weight: 600; font-size: 1rem;
  transition: background-color .15s ease, color .15s ease;
}
.main-nav a:hover { background: var(--surface-2); color: var(--text); }
.main-nav a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.nav-search-icon {
  position: relative; display: inline-block; flex: 0 0 .9rem;
  width: .9rem; height: .9rem;
}
.nav-search-icon::before {
  position: absolute; top: 0; left: 0; width: .55rem; height: .55rem;
  border: 2px solid currentColor; border-radius: 50%; content: "";
}
.nav-search-icon::after {
  position: absolute; top: .56rem; left: .53rem; width: .34rem; height: 2px;
  background: currentColor; content: ""; transform: rotate(45deg);
  transform-origin: left center;
}
.search-pill {
  display: inline-flex; align-items: center; gap: .55rem;
  min-height: 2.5rem; padding: 0 .85rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-muted); text-decoration: none; font-size: .95rem; font-weight: 600;
  transition: border-color .15s ease, color .15s ease;
}
.search-pill:hover, .search-pill[aria-current] { border-color: var(--accent); color: var(--text); }

@media (min-width: 40rem) {
  .search-pill { min-width: 10.5rem; padding-inline-end: 1.25rem; }
}
@media (max-width: 61.99rem) {
  .main-nav {
    -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent);
    mask-image: linear-gradient(90deg, #000 82%, transparent);
  }
  .main-nav ul { padding-inline-end: 2.5rem; }
}
@media (max-width: 39.99rem) {
  .header-inner { gap: .35rem .75rem; }
  .brand { font-size: 1.2rem; gap: .45rem; }
  .brand-mark { width: 1.75rem; height: 1.75rem; }
  .header-tools { gap: .35rem; }
  .lang-link { min-width: 2.3rem; padding: 0 .45rem; }
  .search-pill-text {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}
@media (min-width: 62rem) {
  .header-inner { flex-wrap: nowrap; }
  .main-nav { order: 2; flex: 1 1 auto; flex-basis: auto; }
  .main-nav ul { justify-content: center; }
  .header-tools { order: 3; margin-inline-start: 0; }
}

/* Language switch */
.lang-switch ul {
  display: inline-flex; list-style: none; margin: 0; padding: 2px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2);
}
.lang-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.15rem; min-width: 2.6rem; padding: 0 .6rem; border-radius: 999px;
  font-size: .9rem; font-weight: 700; text-decoration: none; color: var(--text-muted);
}
.lang-link:hover { color: var(--text); }
.lang-link.is-current { background: var(--accent); color: var(--on-accent); }

/* Theme toggle: moon in light mode, sun in dark mode */
.theme-toggle {
  display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-icon {
  display: block; width: 1.05rem; height: 1.05rem; border-radius: 50%;
  box-shadow: inset .38rem -.22rem 0 0 currentColor;
  transform: rotate(-20deg);
}
.theme-toggle[aria-pressed="true"] .theme-icon {
  width: .7rem; height: .7rem; background: currentColor; transform: none;
  box-shadow: 0 0 0 .16rem var(--surface), 0 0 0 .28rem currentColor;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 2.75rem; padding: .5rem 1.1rem;
  border: 2px solid var(--accent); border-radius: 10px;
  background: transparent; color: var(--accent);
  font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-lg { min-height: 3.25rem; padding: .75rem 1.6rem; border-radius: 999px; font-size: 1.05rem; }
.btn-lg.btn-primary { box-shadow: 0 8px 24px var(--glow-a); }
.btn-lg.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px var(--glow-a); }
.btn-lg.btn-ghost { background: var(--surface); }
.btn-arrow { transition: transform .15s ease; }
.btn:hover .btn-arrow { transform: translateX(3px); }

/* Hero */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(2rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(60rem 30rem at 88% -12%, var(--glow-a), transparent 62%),
    radial-gradient(42rem 26rem at -8% 108%, var(--glow-b), transparent 60%),
    var(--bg);
}
.hero-chart {
  position: absolute; inset: auto 0 0 0; z-index: -1;
  width: 100%; height: 58%; pointer-events: none;
}
.hero-chart-area { fill: url(#hero-chart-fill); }
.hero-chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; opacity: .35; vector-effect: non-scaling-stroke; }
.hero-stop-top { stop-color: var(--accent); stop-opacity: .14; }
.hero-stop-bottom { stop-color: var(--accent); stop-opacity: 0; }
.hero-grid { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 62rem) {
  .hero-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr); gap: 3.5rem; }
}
.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem; margin-bottom: 1.4rem;
  padding: .3rem .9rem .3rem .7rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-muted); font-size: .9rem; font-weight: 600;
}
.eyebrow-dot {
  width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 7px var(--accent-soft); } }
.hero h1 {
  max-width: 16ch; margin-bottom: 1.1rem;
  font-size: clamp(2.3rem, 1.4rem + 3.6vw, 4.1rem); line-height: 1.06; letter-spacing: -.03em; font-weight: 800;
  color: var(--text);
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1 {
    background: linear-gradient(100deg, var(--text) 35%, var(--accent) 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
@media (forced-colors: active) {
  .hero h1 { background: none; -webkit-text-fill-color: CanvasText; }
}
.hero .lead { font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem); max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 2rem 0 0; }

/* Learning program card */
.program {
  padding: 1.4rem; border: 1px solid var(--border); border-radius: 22px;
  background: var(--glass); box-shadow: var(--shadow-hover);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.program-title { margin: 0 0 .75rem; padding-inline: .5rem; font-size: 1.15rem; }
.program-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.program-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .85rem;
  padding: .55rem .5rem; border-radius: 12px; color: var(--text); text-decoration: none;
  font-size: 1rem; font-weight: 600; line-height: 1.3;
  transition: background-color .15s ease;
}
.program-item:hover { background: var(--surface-2); color: var(--text); }
.program-num {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; font-variant-numeric: tabular-nums;
}
.program-count {
  min-width: 1.9rem; padding: .1rem .5rem; border-radius: 999px; text-align: center;
  background: var(--surface-2); color: var(--text-muted);
  font-family: var(--font-mono); font-size: .85rem;
}
.program-all {
  display: inline-flex; gap: .35rem; margin: .9rem .5rem 0;
  font-weight: 700; text-decoration: none;
}
.program-all:hover { text-decoration: underline; }

/* Stats strip */
.stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem;
  list-style: none; margin: clamp(2.5rem, 5vw, 4rem) 0 0; padding: 0;
}
@media (min-width: 48rem) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
  display: flex; flex-direction: column; gap: .1rem;
  padding: 1rem 1.2rem; border: 1px solid var(--border); border-radius: 16px; background: var(--glass);
}
.stat-value {
  font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.6rem); font-weight: 800; line-height: 1.1;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text);
}
.stat-label { color: var(--text-muted); font-size: .95rem; }

.section-heading { display: flex; align-items: center; gap: .65rem; margin-bottom: 1.25rem; letter-spacing: -.01em; }
.section-heading::before {
  content: ""; width: .3rem; height: 1.3em; border-radius: 999px;
  background: linear-gradient(var(--accent), var(--accent-hover));
}

/* Home tiles */
.tile-grid {
  display: grid; gap: 1.25rem; list-style: none; margin: 0; padding: 0;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
}
.tile {
  position: relative; display: flex; flex-direction: column; height: 100%; overflow: hidden;
  border: 1px solid var(--border); border-radius: 18px; background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--accent); }
.tile:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.tile .card-link::after { border-radius: 18px; }
.tile-cover {
  position: relative; height: 7rem; overflow: hidden;
  background: linear-gradient(135deg, #0b5f6c, #12907f);
}
.tile-cover::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .1) 1px, transparent 1px);
  background-size: 24px 24px;
}
.tile-spark { position: absolute; inset: auto 0 0 0; width: 100%; height: 72%; }
.tile-spark path {
  fill: none; stroke: rgba(255, 255, 255, .92); stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke;
}
.tile-analysis .tile-cover { background: linear-gradient(135deg, #283a8c, #4b67d6); }
.tile-post .tile-cover { background: linear-gradient(135deg, #8a3f06, #d17a24); }
.tile-practice .tile-cover { background: linear-gradient(135deg, #1b6236, #34a065); }
.tile-glossary .tile-cover, .tile-term-of-day .tile-cover { background: linear-gradient(135deg, #532781, #8a5ae6); }
.tile.is-archive .tile-cover { filter: grayscale(.85); }
.tile-body { display: flex; flex-direction: column; flex: 1; padding: 1.1rem 1.25rem 1.2rem; }
.tile .card-badges { margin-bottom: .6rem; }
.tile .badge { font-size: .8rem; padding: .05rem .55rem; }
.tile-title { margin: 0 0 .5rem; font-size: 1.15rem; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.tile-text {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
  margin: 0 0 .9rem; color: var(--text-muted); font-size: .98rem; line-height: 1.5;
}
.tile-meta { margin: auto 0 0; color: var(--text-muted); font-family: var(--font-mono); font-size: .85rem; }

/* Calculators band */
.tools-band {
  display: grid; gap: 1.75rem; align-items: center;
  padding: clamp(1.5rem, 4vw, 3rem); border-radius: 24px; color: #ffffff;
  background:
    radial-gradient(30rem 18rem at 100% 0%, rgba(255, 255, 255, .14), transparent 60%),
    linear-gradient(135deg, #0a4d59, #0b6b7a 55%, #0e7569);
  box-shadow: var(--shadow-hover);
}
@media (min-width: 62rem) { .tools-band { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 3rem; } }
.tools-band h2 { margin-bottom: .5rem; color: #ffffff; font-size: clamp(1.7rem, 1.3rem + 1.5vw, 2.4rem); letter-spacing: -.02em; }
.tools-band p { margin: 0; color: #e3f5f7; font-size: 1.1rem; }
.tools-links { display: grid; gap: .65rem; list-style: none; margin: 0; padding: 0; }
@media (min-width: 40rem) { .tools-links { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tool-link {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; height: 100%;
  padding: .95rem 1.1rem; border: 1px solid rgba(255, 255, 255, .24); border-radius: 14px;
  background: rgba(255, 255, 255, .1); color: #ffffff; font-weight: 600; line-height: 1.3; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease;
}
.tool-link:hover { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .5); color: #ffffff; }
.tool-link:focus-visible { outline-color: #ffffff; }
.tool-arrow { transition: transform .15s ease; }
.tool-link:hover .tool-arrow { transform: translateX(3px); }

/* Page header band (lists, articles, tools, search) */
.narrow { width: min(100% - 2rem, 48rem); }
.page-hero {
  position: relative; overflow: hidden; isolation: isolate;
  padding-block: clamp(2.25rem, 5vw, 3.75rem) clamp(1.75rem, 4vw, 2.75rem);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(48rem 22rem at 92% -30%, var(--glow-a), transparent 62%),
    radial-gradient(30rem 18rem at -6% 120%, var(--glow-b), transparent 60%),
    var(--bg);
}
.page-hero-chart {
  position: absolute; inset: auto 0 0 0; z-index: -1;
  width: 100%; height: 70%; pointer-events: none;
}
.page-hero-chart path { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .22; vector-effect: non-scaling-stroke; }
.page-hero h1 {
  max-width: 22ch; margin-bottom: .6rem;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3.1rem); font-weight: 800; line-height: 1.1; letter-spacing: -.025em;
}
.page-hero-article h1 { max-width: none; font-size: clamp(1.85rem, 1.35rem + 2vw, 2.7rem); }
.page-hero .lead { margin-bottom: 0; }
.page-hero .card-badges { margin-bottom: 1rem; }
.page-count, .page-meta {
  display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: 1rem 0 0;
  color: var(--text-muted); font-family: var(--font-mono); font-size: .875rem;
}
.page-count {
  display: inline-flex; padding: .25rem .8rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface);
}
.page-head { padding-bottom: 1rem; }
.breadcrumb { margin: 0 0 1rem; }
.breadcrumb a {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 2.25rem; padding: .2rem .85rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text-muted); font-size: .95rem; font-weight: 600; text-decoration: none;
}
.breadcrumb a:hover { border-color: var(--accent); color: var(--accent); }

/* Cards (calculators use .card) */
.card-grid, .card-list {
  display: grid; gap: 1.25rem; list-style: none; margin: 0; padding: 0;
}
.card-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.list-gap { margin-top: 1.5rem; }

.card {
  position: relative; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px;
  padding: 1.25rem 1.4rem; height: 100%; box-shadow: var(--shadow);
}
.card:hover { border-color: var(--accent); }
.card:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.card.is-archive { background: var(--surface-2); }
.card-title { font-size: 1.3rem; font-weight: 700; line-height: 1.3; margin: 0 0 .5rem; }
.card-link { color: var(--text); text-decoration: none; }
.card-link:hover { color: var(--accent); text-decoration: underline; }
.card-link:focus-visible { outline: none; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: 18px; }
.card-text { color: var(--text-muted); margin-bottom: .75rem; }
.card-meta {
  display: flex; flex-wrap: wrap; gap: .25rem 1rem;
  font-size: .9375rem; color: var(--text-muted); margin: 0;
}
.card-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }

/* Compact tiles: no cover, a coloured strip on top instead */
.tile-grid-compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 1rem; }
.tile-compact { border-top: 4px solid #0b6b7a; }
.tile-compact.tile-analysis { border-top-color: #4b67d6; }
.tile-compact.tile-post { border-top-color: #d17a24; }
.tile-compact.tile-practice { border-top-color: #34a065; }
.tile-compact.tile-glossary, .tile-compact.tile-term-of-day { border-top-color: #8a5ae6; }
.tile-compact.tile-page { border-top-color: var(--border-strong); }
.tile-compact:hover { border-top-color: var(--accent); }
.tile-compact .tile-body { padding: 1rem 1.15rem 1.1rem; }
.tile-compact .tile-title { font-size: 1.08rem; }
.tile-compact .tile-text { -webkit-line-clamp: 3; margin-bottom: .4rem; }

/* Lessons page: modules */
.module { padding-block: 1.25rem 1.75rem; scroll-margin-top: 5rem; }
.module + .module { border-top: 1px dashed var(--border); }
.module-heading { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.1rem; font-size: clamp(1.3rem, 1.1rem + .8vw, 1.7rem); }
.module-num {
  display: inline-grid; place-items: center; flex: 0 0 auto; width: 2.5rem; height: 2.5rem; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: var(--on-accent);
  font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.jump-num {
  display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; margin-inline-end: .5rem;
  border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: .85rem; font-weight: 800;
}

/* Search */
.search-panel {
  max-width: 46rem; margin-block: 0 1.5rem; padding: 1.25rem 1.4rem;
  border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow);
}
.search-label { display: block; margin-bottom: .6rem; font-weight: 700; }
.search-controls { display: flex; align-items: stretch; gap: .75rem; }
.search-field {
  position: relative; flex: 1; min-width: 0; display: flex; align-items: center;
}
.search-field .nav-search-icon { position: absolute; left: 1.1rem; color: var(--text-muted); pointer-events: none; }
.search-controls input {
  flex: 1; min-width: 0; min-height: 3.25rem; padding: .5rem 1rem .5rem 2.75rem;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.search-controls input:focus-visible { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-controls .btn { border-radius: 999px; }
.search-panel #search-hint { margin: .6rem 0 0; font-size: .95rem; }
.search-count { margin-block: 1.5rem 1rem; font-weight: 700; }
.search-result[hidden] { display: none; }

.badge {
  display: inline-block; padding: .1rem .6rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: .85rem; font-weight: 600; line-height: 1.5;
}
.badge-pin { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.badge-archive { background: var(--surface-2); color: var(--text); }
.badge-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }

/* Articles */
.article-body { padding-top: 2.25rem; }
.prose { font-size: 1.125rem; line-height: 1.75; max-width: 44rem; }
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3, .prose h4 { margin-top: 2.2em; letter-spacing: -.015em; }
.prose h2 { padding-top: .2em; }
.prose a { font-weight: 600; text-decoration-thickness: 1px; }
.prose ul, .prose ol { padding-inline-start: 1.4rem; }
.prose li { margin-bottom: .45em; }
.prose li::marker { color: var(--accent); font-weight: 700; }
.prose strong { color: var(--text); }
.prose blockquote {
  margin: 1.75rem 0; padding: 1rem 1.25rem;
  border-inline-start: 4px solid var(--accent); border-radius: 0 14px 14px 0;
  background: var(--surface-2); color: var(--text);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 6px; }
.prose pre { overflow-x: auto; padding: 1rem; background: var(--surface-2); border-radius: 12px; }
.prose pre code { padding: 0; background: none; }
.prose table {
  display: block; max-width: 100%; overflow-x: auto; border-collapse: separate; border-spacing: 0;
  margin: 1.5rem 0; border: 1px solid var(--border); border-radius: 14px;
  font-size: 1rem; font-variant-numeric: tabular-nums;
}
.prose th, .prose td { padding: .65rem .9rem; border-bottom: 1px solid var(--border); text-align: start; }
.prose thead th { background: var(--surface-2); font-weight: 700; }
.prose tr:last-child td { border-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

.glossary-detail {
  max-width: 44rem; margin: 0 0 2rem; padding: 1.25rem 1.4rem;
  border: 1px solid var(--border); border-inline-start: 4px solid #8a5ae6; border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow);
}
.glossary-detail h2 { margin-bottom: .4rem; font-size: 1.05rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.glossary-detail p { margin: 0; font-size: 1.1rem; }

.source {
  max-width: 44rem; margin-top: 2.5rem; padding: 1rem 1.2rem;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); font-size: 1rem;
  overflow-wrap: anywhere;
}
.tags { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 1.25rem 0 0; padding: 0; }
.tags li {
  padding: .2rem .75rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted); font-size: .9rem; font-weight: 600;
}

.notice {
  max-width: 44rem; margin: 0 0 1.5rem; padding: .9rem 1.15rem;
  border: 1px solid var(--border-strong); border-inline-start-width: 4px; border-radius: 14px; background: var(--surface);
}
.notice-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }

/* Jump navigation (lessons, calculators) */
.jump-nav ul { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 0 0 2rem; padding: 0; }
.jump-nav a {
  display: inline-flex; align-items: center; min-height: 2.6rem; padding: .35rem 1rem .35rem .45rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text); font-size: .95rem; font-weight: 600; text-decoration: none;
  transition: border-color .15s ease, color .15s ease;
}
.jump-nav a:not(:has(.jump-num)) { padding-inline-start: 1rem; }
.jump-nav a:hover { border-color: var(--accent); color: var(--accent); }

/* Calculators */
.calc-grid { display: grid; gap: 1.5rem; }
.calc { height: auto; min-width: 0; padding: clamp(1.25rem, 3vw, 2rem); scroll-margin-top: 5.5rem; border-radius: 22px; }
.calc:hover { border-color: var(--border); }
.calc:focus-within { outline: none; border-color: var(--accent); }
.calc > h2 { display: flex; align-items: center; gap: .75rem; letter-spacing: -.015em; }
.calc > h2::before {
  content: ""; flex: 0 0 auto; width: .6rem; height: .6rem; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft);
}
.calc-desc { color: var(--text-muted); max-width: 42rem; }
.calc-note { font-size: .95rem; color: var(--text-muted); max-width: 42rem; }
.calc-fields {
  display: grid; gap: 1rem 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
}
.calc-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0; }
.calc-actions .btn { border-radius: 999px; }

.field label { display: block; margin-bottom: .35rem; font-weight: 600; }
.field input, .field select {
  width: 100%; min-height: 3rem; padding: .5rem .95rem;
  border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface-2); color: var(--text);
  font: inherit; font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.field input:focus-visible, .field select:focus-visible {
  outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft);
}
.field input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--warn-bg); }
.field-hint { margin: .35rem 0 0; font-size: .95rem; color: var(--text-muted); }
.field-error { margin: .35rem 0 0; font-size: .95rem; font-weight: 600; color: var(--danger); }

.avg-rows { display: grid; gap: 1rem; margin-bottom: 1rem; }
.avg-row { margin: 0; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); }
.avg-row legend { padding: 0 .5rem; font-weight: 700; }
.avg-remove { margin-top: 1rem; }

.calc-output { margin-top: 1rem; min-width: 0; }
.calc-placeholder {
  padding: .9rem 1.1rem; border: 1px dashed var(--border-strong); border-radius: 14px; color: var(--text-muted);
}
.results {
  display: grid; gap: .75rem; margin: 0 0 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}
.result { padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2); }
.result-main { border-color: var(--accent); background: var(--accent-soft); }
.result dt { font-size: .9rem; color: var(--text-muted); }
.result dd {
  margin: .2rem 0 0; font-size: 1.55rem; font-weight: 800; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}

.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; margin-top: 1rem; }
.data-table { width: 100%; min-width: 28rem; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.data-table caption { text-align: start; padding: .75rem 1rem; font-weight: 700; }
.data-table th, .data-table td { padding: .6rem 1rem; border-top: 1px solid var(--border); text-align: end; }
.data-table th:first-child, .data-table td:first-child { text-align: start; }
.data-table thead th { background: var(--surface-2); }
.data-table tbody th { font-weight: 600; }
.data-table tbody tr:hover { background: var(--surface-2); }

/* 404 */
.not-found {
  position: relative; overflow: hidden; padding-block: clamp(3rem, 10vw, 7rem);
  background:
    radial-gradient(40rem 24rem at 80% 0%, var(--glow-a), transparent 62%),
    var(--bg);
}
.not-found-code {
  margin: 0 0 .5rem; font-size: clamp(5rem, 3rem + 10vw, 10rem); font-weight: 800; line-height: 1;
  letter-spacing: -.05em; color: var(--accent);
}
.not-found h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); }

/* Footer */
.site-footer { margin-top: 3rem; padding-block: 2rem; border-top: 1px solid var(--border); background: var(--surface); }
.risk {
  padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
  background: var(--warn-bg); color: var(--warn-text);
  border: 2px solid var(--warn-border); border-inline-start-width: 8px; border-radius: 12px;
}
.risk-title { font-size: 1.2rem; margin: 0 0 .4rem; }
.risk p { margin: 0; font-size: 1.0625rem; }
.footer-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem 1.5rem; margin-bottom: 1rem;
}
.brand-small { order: 0; font-size: 1.2rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; list-style: none; margin: 0; padding: 0; }
.footer-links a { color: var(--text-muted); font-weight: 600; text-decoration: none; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.footer-note, .footer-copy { color: var(--text-muted); font-size: .95rem; margin-bottom: .4rem; }

@media (max-width: 40rem) {
  body { font-size: 1.0625rem; }
  .prose { font-size: 1.125rem; }
  .calc { padding: 1.1rem; }
  .search-controls { flex-direction: column; }
}

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