/* ============================================================
   CalcTeacher — app.css
   Design: Editorial-precision, warm ivory + deep slate palette
   Fonts: Plus Jakarta Sans (all)
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Light theme */
  --bg:          #faf9f6;
  --bg2:         #f0ede6;
  --surface:     #ffffff;
  --surface2:    #f5f3ef;
  --border:      #e5e0d8;
  --text:        #1a1714;
  --text-2:      #4a4540;
  --muted:       #8a8480;
  --accent:      #c2410c;       /* burnt orange — primary CTA */
  --accent-2:    #7c3aed;       /* violet — secondary */
  --accent-3:    #0891b2;       /* cyan — links */
  --success:     #16a34a;
  --warning:     #d97706;
  --danger:      #dc2626;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow:      0 4px 16px rgba(0,0,0,.1);
  --shadow-lg:   0 16px 48px rgba(0,0,0,.14);
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   20px;
  --transition:  .2s ease;
}

[data-theme="dark"] {
  --bg:       #12110e;
  --bg2:      #1c1a16;
  --surface:  #211f1b;
  --surface2: #2a2723;
  --border:   #3a3730;
  --text:     #f0ece4;
  --text-2:   #a8a399;
  --muted:    #6a6560;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow:    0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

h1,h2,h3,h4,h5,h6 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  line-height: 1.2;
  color: var(--text);
  font-weight: 700;
}

a { color: var(--accent-3); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ── Container ────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: #9a330a;
  border-color: #9a330a;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(194,65,12,.3);
}
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}
.btn-ghost {
  background: var(--surface2);
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--border); }

.btn-calculate {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  letter-spacing: .02em;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  border-radius: var(--radius);
  margin-top: .5rem;
}
.btn-calculate:hover {
  background: #9a330a;
  box-shadow: 0 8px 24px rgba(194,65,12,.35);
  transform: translateY(-2px);
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250,249,246,.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
[data-theme="dark"] .site-header {
  background: rgba(18,17,14,.9);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 64px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-img {
  height: 36px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
}
[data-theme="dark"] .logo-img { filter: brightness(1.1); }

/* Nav */
.main-nav { margin-left: auto; }
.nav-list {
  display: flex;
  align-items: center;
  gap: .25rem;
}
.nav-link {
  padding: .5rem .875rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: .25rem;
}
.nav-link:hover, .nav-link.active {
  background: var(--surface2);
  color: var(--text);
}
.nav-link.active { color: var(--accent); }
.caret { font-size: .7rem; opacity: .6; }

/* Dropdown */
.nav-has-dropdown { position: relative; }
.nav-dropdown {
  position: absolute;
  top: calc(100% + .5rem);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem;
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 200;
}
.nav-has-dropdown:hover .nav-dropdown { display: block; }
.nav-dropdown li a {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem .875rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--text-2);
  transition: all var(--transition);
}
.nav-dropdown li a:hover { background: var(--surface2); color: var(--text); }

/* Header actions */
.header-actions { display: flex; align-items: center; gap: .5rem; margin-left: .5rem; }
.search-btn, .theme-toggle, .hamburger {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.search-btn:hover, .theme-toggle:hover { background: var(--surface2); color: var(--text); }

/* Theme toggle */
.theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: none; }
[data-theme="dark"] .theme-moon { display: block; }

/* Hamburger */
.hamburger { flex-direction: column; gap: 4px; display: none; }
.hamburger span { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; transition: all var(--transition); }

/* Search overlay */
.search-overlay {
  display: none;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  box-shadow: var(--shadow);
  z-index: 90;
}
.search-overlay.open { display: block; }
.search-form {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .625rem 1rem;
}
.search-form input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  font-family: 'Inter', sans-serif;
}
.search-form input::placeholder { color: var(--muted); }
.search-form button { background: none; border: none; cursor: pointer; color: var(--muted); padding: 0; }
.search-close { font-size: 1rem; color: var(--muted); }
.search-suggestions {
  margin-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.suggestion-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  color: var(--text);
  text-decoration: none;
  font-size: .9rem;
}
.suggestion-item:hover { background: var(--surface2); }

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  padding: 5rem 0 4rem;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg2) 100%);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 4rem;
  align-items: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: .375rem .875rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 1.5rem;
}
.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  color: var(--text);
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-2);
  max-width: 480px;
  margin-bottom: 2rem;
}

/* Hero search */
.hero-search { margin-bottom: 2rem; }
.search-box {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  max-width: 520px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}
.search-box:focus-within { border-color: var(--accent); }
.search-box svg { color: var(--muted); flex-shrink: 0; }
.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  font-family: 'Inter', sans-serif;
}
.search-box input::placeholder { color: var(--muted); }
.search-box button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .5rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition);
}
.search-box button:hover { background: #9a330a; }

/* Hero stats */
.hero-stats {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.stat strong { display: block; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.5rem; font-weight: 800; color: var(--text); }
.stat span { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-sep { width: 1px; height: 40px; background: var(--border); }

/* Hero visual */
.hero-visual { display: flex; justify-content: center; }
.calc-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  width: 280px;
  animation: float 4s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.calc-screen {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  margin-bottom: 1rem;
  text-align: right;
}
.calc-display {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
}
.calc-label { font-size: .8rem; color: var(--success); margin-top: .25rem; }
.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
}
.calc-keys span {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .625rem;
  text-align: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: .875rem;
  cursor: default;
  transition: background var(--transition);
}
.calc-keys span.op { background: var(--bg2); color: var(--accent); }
.calc-keys span.eq { background: var(--accent); color: #fff; border-color: var(--accent); }
.calc-keys span.zero { grid-column: span 2; }
.calc-keys span:hover:not(.eq) { background: var(--border); }

/* ── Categories Strip ─────────────────────────────────────── */
.categories-strip { padding: 2rem 0; border-bottom: 1px solid var(--border); }
.cats-grid {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.cat-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: .5rem 1rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: all var(--transition);
}
.cat-chip:hover {
  background: color-mix(in srgb, var(--cat-color) 10%, transparent);
  border-color: var(--cat-color);
  color: var(--cat-color);
}
.cat-icon { font-size: 1rem; }
.cat-count {
  background: var(--surface2);
  border-radius: 99px;
  padding: .1rem .5rem;
  font-size: .75rem;
  color: var(--muted);
}

/* ── Sections ─────────────────────────────────────────────── */
.section { padding: 4rem 0; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.section-title {
  font-size: 1.75rem;
  font-weight: 800;
}
.see-all {
  font-size: .875rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.see-all:hover { text-decoration: underline; }
.text-center { text-align: center; }

/* ── Calculator Grid ──────────────────────────────────────── */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.calc-grid--large { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.calc-card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}
.calc-card-item:hover {
  border-color: var(--cat-color, var(--accent));
  box-shadow: 0 8px 32px rgba(0,0,0,.1);
  transform: translateY(-3px);
}
.calc-card-link {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  height: 100%;
  text-decoration: none;
  color: var(--text);
}
.calc-card-icon { font-size: 2rem; margin-bottom: .75rem; }
.calc-card-cat {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--cat-color, var(--muted));
  font-weight: 600;
  margin-bottom: .375rem;
}
.calc-card-name { font-size: 1.05rem; font-weight: 700; margin-bottom: .5rem; }
.calc-card-desc { font-size: .85rem; color: var(--text-2); line-height: 1.5; flex: 1; }
.calc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: .875rem;
  border-top: 1px solid var(--border);
}
.calc-card-action {
  font-size: .8rem;
  font-weight: 600;
  color: var(--cat-color, var(--accent));
}
.calc-card-badge {
  font-size: .7rem;
  background: #f59e0b20;
  color: #d97706;
  padding: .15rem .5rem;
  border-radius: 99px;
  font-weight: 600;
}

/* ── Popular List ─────────────────────────────────────────── */
.popular-list { display: flex; flex-direction: column; gap: .5rem; }
.popular-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition);
}
.popular-item:hover { border-color: var(--accent); background: var(--surface2); }
.popular-rank {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.popular-icon { font-size: 1.25rem; }
.popular-info { flex: 1; }
.popular-info strong { display: block; font-size: .95rem; font-weight: 600; }
.popular-info small { font-size: .8rem; color: var(--muted); }
.popular-arrow { color: var(--muted); font-size: .9rem; }

/* ── Features Grid ────────────────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 2.5rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.feature-icon { font-size: 2rem; margin-bottom: 1rem; }
.feature-card h3 { font-size: 1rem; margin-bottom: .5rem; }
.feature-card p { font-size: .875rem; color: var(--text-2); line-height: 1.6; }

/* ── Calculator Page ──────────────────────────────────────── */
.calculator-page { padding: 2rem 0 4rem; }

.breadcrumbs { margin-bottom: 1.5rem; }
.breadcrumbs ol { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.breadcrumbs li { font-size: .8rem; }
.breadcrumbs a { color: var(--text-2); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs [aria-current="page"] { color: var(--text); font-weight: 500; }
.breadcrumbs .sep { color: var(--muted); }

.calc-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}
.calc-main { min-width: 0; }

/* Calculator header card */
.calc-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}
.calc-icon-wrap {
  width: 64px; height: 64px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--cat-color) 12%, transparent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.calc-icon-large { font-size: 2rem; }
.calc-category-badge {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .25rem .625rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: .5rem;
}
.calc-title { font-size: 1.75rem; font-weight: 800; margin-bottom: .375rem; }
.calc-description { font-size: .9rem; color: var(--text-2); }

/* Form */
.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}
.calc-form { }
.form-fields { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: .375rem; }
.form-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.unit-label { font-size: .75rem; color: var(--muted); font-weight: 400; }
.form-control {
  padding: .75rem 1rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  appearance: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(194,65,12,.12);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a8480' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-error {
  background: #dc262615;
  border: 1px solid #dc262640;
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .875rem;
  color: var(--danger);
  margin-bottom: 1rem;
}

.form-actions { display: flex; gap: .75rem; }
.form-actions .btn { flex: 1; }
.form-actions .btn-ghost { flex: 0 0 auto; }

/* Result box */
.result-box {
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-top: 1.5rem;
  animation: slideUp .35s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.result-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.result-title { font-size: 1.1rem; font-weight: 700; }
.share-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: all var(--transition);
}
.share-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.result-highlight {
  text-align: center;
  padding: 1.5rem;
  background: var(--surface2);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}
.result-number {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.result-label { font-size: 1rem; font-weight: 600; margin-top: .5rem; }

/* BMI gauge */
.bmi-gauge-wrap { margin: 1.25rem 0; }
.bmi-gauge {
  height: 10px;
  background: linear-gradient(90deg, #3b82f6 0%,#22c55e 35%,#f59e0b 65%,#ef4444 100%);
  border-radius: 99px;
  position: relative;
  margin-bottom: .5rem;
}
.bmi-gauge-fill {
  position: absolute;
  top: -3px;
  left: 0;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: var(--shadow);
  transition: left .6s cubic-bezier(.4,0,.2,1);
  margin-left: -8px;
}
.bmi-gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: .7rem;
  color: var(--muted);
  margin-top: .5rem;
  text-align: center;
}

/* Result rows */
.result-rows { display: flex; flex-direction: column; gap: .5rem; }
.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .625rem .875rem;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: .9rem;
}
.result-row span { color: var(--text-2); }
.result-row strong { font-weight: 600; }

.result-advice {
  margin-top: 1rem;
  padding: .875rem 1rem;
  background: var(--surface2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .875rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* EMI result */
.result-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.result-stat {
  text-align: center;
  padding: 1rem;
  background: var(--surface2);
  border-radius: var(--radius);
}
.result-stat.rs-highlight { background: var(--accent); }
.result-stat.rs-highlight .rs-value,
.result-stat.rs-highlight .rs-label { color: #fff; }
.rs-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.1rem; font-weight: 800; }
.rs-label { font-size: .75rem; color: var(--muted); margin-top: .25rem; }

/* EMI chart */
.emi-chart-wrap { display: flex; align-items: center; gap: 1.5rem; margin: 1.25rem 0; justify-content: center; }
.emi-legend { display: flex; flex-direction: column; gap: .5rem; }
.legend-item { display: flex; align-items: center; gap: .5rem; font-size: .8rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* Amortization */
.amortization-toggle { margin-top: 1rem; }
.amortization-toggle summary {
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  color: var(--accent);
  padding: .5rem;
  list-style: none;
  user-select: none;
}
.amortization-table-wrap { overflow-x: auto; margin-top: .75rem; }
.amortization-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.amortization-table th, .amortization-table td {
  padding: .5rem .75rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.amortization-table th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .7rem; }
.amortization-table th:first-child, .amortization-table td:first-child { text-align: left; }

/* Age result */
.age-primary {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .75rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  color: var(--text);
}
.age-primary small { font-size: 1rem; font-weight: 400; color: var(--muted); }
.age-sep { color: var(--border); font-size: 2rem; }

.result-disclaimer {
  margin-top: 1.25rem;
  font-size: .75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: .875rem;
}

/* Info card */
.calc-info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-top: 1.25rem;
}
.calc-info-card h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.calc-info-card h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
.steps-list { display: flex; flex-direction: column; gap: .5rem; counter-reset: step; }
.steps-list li {
  counter-increment: step;
  display: flex;
  gap: .75rem;
  font-size: .9rem;
  color: var(--text-2);
  padding: .5rem .75rem;
  background: var(--surface2);
  border-radius: var(--radius-sm);
}
.steps-list li::before {
  content: counter(step);
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.formula-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-family: 'Courier New', monospace;
  font-size: .9rem;
  color: var(--accent-2);
}

/* Sidebar */
.calc-sidebar { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 1.25rem; }
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.sidebar-card h3 { font-size: .95rem; margin-bottom: .875rem; }
.related-list { display: flex; flex-direction: column; gap: .375rem; }
.related-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background var(--transition);
  font-size: .875rem;
}
.related-link:hover { background: var(--surface2); }
.rel-icon { font-size: 1.1rem; }
.rel-info strong { display: block; font-size: .85rem; }
.rel-info small { font-size: .75rem; color: var(--muted); }

.cat-list { display: flex; flex-direction: column; gap: .25rem; }
.cat-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text-2);
  text-decoration: none;
  transition: all var(--transition);
}
.cat-link:hover, .cat-link--active {
  background: color-mix(in srgb, var(--cat-color) 10%, transparent);
  color: var(--cat-color);
}

/* ── List / Category Pages ────────────────────────────────── */
.list-page { padding: 2.5rem 0 4rem; }
.page-hero {
  text-align: center;
  margin-bottom: 2.5rem;
}
.page-hero h1 { font-size: 2.25rem; margin-bottom: .5rem; }
.page-hero p { color: var(--text-2); }
.page-hero-icon { font-size: 3rem; margin-bottom: .75rem; }

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 2rem;
}
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: all var(--transition);
}
.filter-btn:hover {
  border-color: var(--cat-color, var(--accent));
  color: var(--cat-color, var(--accent));
}
.filter-btn--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: 3rem;
}
.page-btn {
  padding: .5rem .875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--text-2);
  text-decoration: none;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn--active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Search Bar Full ──────────────────────────────────────── */
.search-bar-full { margin-bottom: 2rem; }
.search-form-full .search-box { max-width: 100%; }
.search-meta { margin-bottom: 1.5rem; font-size: .9rem; color: var(--text-2); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h2 { margin-bottom: .5rem; }
.empty-state p { color: var(--text-2); margin-bottom: 1.5rem; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}
.footer-inner {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 4rem;
  padding: 3rem 0;
}
.footer-logo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .875rem;
}
.footer-logo strong { color: var(--accent); }
.footer-tagline { font-weight: 600; font-size: .9rem; color: var(--text); margin-bottom: .5rem; }
.footer-desc { font-size: .8rem; color: var(--muted); line-height: 1.6; }

.footer-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.footer-col h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .875rem; font-weight: 700; }
.footer-col ul { display: flex; flex-direction: column; gap: .5rem; }
.footer-col a { font-size: .875rem; color: var(--text-2); text-decoration: none; transition: color var(--transition); }
.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
}
.footer-bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-bottom p { font-size: .8rem; color: var(--muted); }
.footer-disclaimer { font-size: .75rem !important; max-width: 480px; text-align: right; }

/* ── Static Pages ─────────────────────────────────────────── */
.static-page { padding: 3rem 0 5rem; }
.static-inner { max-width: 800px; }
.static-inner h1 { font-size: 2.25rem; margin-bottom: 1rem; }
.static-inner .lead { font-size: 1.1rem; color: var(--text-2); margin-bottom: 2rem; border-left: 3px solid var(--accent); padding-left: 1rem; }
.static-inner .muted { color: var(--muted); font-size: .85rem; margin-bottom: 2rem; }
.static-inner h2 { font-size: 1.3rem; margin: 2rem 0 .75rem; }
.static-inner h3 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
.static-inner p { font-size: .95rem; color: var(--text-2); line-height: 1.75; margin-bottom: .875rem; }
.static-inner ul { list-style: disc; padding-left: 1.5rem; }
.static-inner ul li { font-size: .95rem; color: var(--text-2); margin-bottom: .375rem; }
.static-inner a { color: var(--accent-3); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 3rem; margin-top: 2rem; }
.contact-info { display: flex; flex-direction: column; gap: 1.5rem; }
.contact-item { display: flex; gap: 1rem; align-items: flex-start; }
.contact-item span { font-size: 1.5rem; }
.contact-item strong { display: block; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem; }
.contact-form { display: flex; flex-direction: column; gap: 1rem; }
.contact-form textarea.form-control { min-height: 140px; }

/* ── Error Pages ──────────────────────────────────────────── */
.error-page { padding: 6rem 0; text-align: center; }
.error-inner { max-width: 600px; margin: 0 auto; }
.error-code {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--border);
  margin-bottom: -1rem;
}
.error-icon { font-size: 3rem; margin-bottom: 1rem; }
.error-page h1 { font-size: 2rem; margin-bottom: .75rem; }
.error-page p { color: var(--text-2); margin-bottom: 2rem; }
.error-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-bottom: 3rem; }
.error-suggestions h2 { font-size: 1.25rem; margin-bottom: 1.5rem; }

/* ── Ad placeholders ──────────────────────────────────────── */
.ad-placeholder {
  background: var(--surface2) !important;
  border-color: var(--border) !important;
  color: var(--muted) !important;
  margin: 1.5rem auto !important;
}

/* ── Utility ──────────────────────────────────────────────── */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-sidebar { position: static; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .footer-inner { grid-template-columns: 1fr; gap: 2rem; }
  .footer-links { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .main-nav {
    display: none;
    position: fixed;
    top: 64px; left: 0; right: 0; bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    z-index: 99;
  }
  .main-nav.open { display: block; }
  .nav-list { flex-direction: column; gap: .25rem; align-items: stretch; }
  .nav-link { padding: .875rem 1rem; border-radius: var(--radius-sm); }
  .nav-dropdown { position: static; box-shadow: none; border: none; background: var(--surface2); margin-top: .25rem; display: block; }
  .result-grid-3 { grid-template-columns: 1fr; }
  .hero { padding: 3rem 0 2.5rem; }
  .section { padding: 2.5rem 0; }
  .footer-links { grid-template-columns: 1fr 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .age-primary { font-size: 1.75rem; }
  .result-number { font-size: 2.25rem; }
}
@media (max-width: 480px) {
  .cats-grid { gap: .5rem; }
  .cat-chip { padding: .375rem .75rem; font-size: .8rem; }
  .footer-links { grid-template-columns: 1fr; }
  .calc-header { flex-direction: column; }
  .form-actions { flex-direction: column; }
  .form-actions .btn-ghost { width: 100%; }
  .filter-bar { gap: .375rem; }
  .filter-btn { font-size: .8rem; padding: .4rem .75rem; }
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .calc-sidebar, .ad-placeholder { display: none; }
  .calc-layout { grid-template-columns: 1fr; }
}

/* ============================================================
   CALCULATOR PAGE — NEW TWO-COLUMN LAYOUT (appended to v6)
   PC  : info panel LEFT (always open) | form RIGHT
   Mobile : collapsible info panel above form
   ============================================================ */

/* ── Wrapper ──────────────────────────────────────────────── */
.cpg-wrap {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 2rem;
}

/* ── Info panel ───────────────────────────────────────────── */
.cpg-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: 76px;
}

/* Toggle button — DESKTOP: hidden. MOBILE: visible */
.cpg-toggle {
  display: none;
  width: 100%;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  text-align: left;
}
.cpg-toggle-icon { font-size: 1.2rem; flex-shrink: 0; }
.cpg-toggle-title {
  flex: 1;
  font-size: .95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cpg-toggle-chevron {
  font-size: .7rem;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform .25s;
}
.cpg-info.cpg-open .cpg-toggle-chevron { transform: rotate(180deg); }

/* Info body */
.cpg-info-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.cpg-info-body[hidden] { display: none; }

/* Hero: icon + badge + title */
.cpg-hero {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.cpg-icon-wrap {
  width: 56px; height: 56px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--cat-color) 13%, transparent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}
.cpg-title-group { min-width: 0; }
.cpg-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .7rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  border: 1px solid;
  margin-bottom: .45rem;
  letter-spacing: .03em;
}
.cpg-title {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}

/* Description */
.cpg-desc {
  font-size: .875rem;
  color: var(--text-2);
  line-height: 1.75;
  border-left: 3px solid var(--cat-color, var(--accent));
  padding-left: .875rem;
  margin: 0;
}

/* Quick facts chips */
.cpg-facts {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.cpg-fact {
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: .28rem .75rem;
}

/* How to use */
.cpg-howto-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .6rem;
}
.cpg-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.cpg-steps li {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  font-size: .82rem;
  color: var(--text-2);
  line-height: 1.5;
}
.cpg-step-n {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--cat-color) 15%, transparent);
  color: var(--cat-color, var(--accent));
  font-size: .65rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--cat-color) 28%, transparent);
  margin-top: 1px;
}

/* Formula */
.cpg-formula {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
}
.cpg-formula-lbl {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: .35rem;
}
.cpg-formula code {
  font-family: 'Courier New', monospace;
  font-size: .82rem;
  color: var(--accent-2);
  word-break: break-all;
}

/* Tags */
.cpg-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.cpg-tag {
  font-size: .7rem;
  padding: .18rem .6rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  text-decoration: none;
  transition: all var(--transition);
}
.cpg-tag:hover { border-color: var(--accent); color: var(--accent); }

/* ── Form panel ───────────────────────────────────────────── */
.cpg-form { min-width: 0; }
/* Re-use v6 .calc-card exactly — no new styles needed */

/* ── MOBILE ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .cpg-wrap {
    grid-template-columns: 1fr;
    gap: .875rem;
  }
  .cpg-info {
    position: static;
  }
  /* Show toggle button on mobile */
  .cpg-toggle {
    display: flex;
    border-bottom: 1px solid var(--border);
  }
  /* Collapsed: hide border-bottom on toggle when body is hidden */
  .cpg-info:not(.cpg-open) .cpg-toggle {
    border-bottom: none;
  }
  .cpg-info-body {
    padding: 1.1rem 1.1rem 1.25rem;
  }
  .cpg-title { font-size: 1.3rem; }
  .cpg-icon-wrap { width: 46px; height: 46px; font-size: 1.4rem; }
}

/* ── Header burger fix ────────────────────────────────────── */
/* Ensure header stays above everything and burger menu renders on top */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
}
@media (max-width: 768px) {
  .header-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-left: .5rem;
    position: relative;
    z-index: 1001;
  }
  .search-btn,
  .theme-toggle,
  .hamburger {
    width: 38px;
    height: 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    z-index: 1001;
  }
  .main-nav {
    display: none;
    position: fixed;
    top: 64px;
    left: 0; right: 0; bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    z-index: 999;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
  }
  .main-nav.open { display: block; }
  .header-inner {
    position: relative;
    z-index: 1001;
  }
}

/* ── Footer responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 2rem 0;
  }
  .footer-links {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
  .footer-bottom-inner {
    flex-direction: column;
    text-align: center;
    gap: .5rem;
  }
  .footer-disclaimer { text-align: center; }
}
@media (max-width: 480px) {
  .footer-links { grid-template-columns: 1fr; }
  .footer-brand { text-align: center; }
  .footer-logo { justify-content: center; }
}

/* Breadcrumb — always horizontal */
.breadcrumbs ol {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem .4rem;
  list-style: none;
  padding: 0; margin: 0;
}
.breadcrumbs li {
  display: flex !important;
  align-items: center;
  font-size: .8rem;
  white-space: nowrap;
}
