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

:root {
  --blue: #2563EB;
  --blue-hover: #1d4ed8;
  --blue-light: #EFF6FF;
  --blue-mid: #BFDBFE;
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --border: #e2e8f0;
  --surface: #ffffff;
  --bg: #f8fafc;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --nav-h: 72px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ─── NAV ─── */
nav {
  position: sticky; top: 0; z-index: 200;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 clamp(16px, 4vw, 40px);
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h);
}
.nav-logo {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; text-decoration: none; flex-shrink: 0;
}
.nav-logo-icon {
  width: 42px; height: 42px;
  background: var(--blue); border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}
.nav-logo-icon svg { width: 22px; height: 22px; }
.nav-logo-text { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.4px; }
.nav-logo-sub { font-size: 12px; color: var(--muted); font-weight: 400; display: block; margin-top: -2px; }
.nav-links { display: flex; gap: 2px; flex-wrap: wrap; }
.nav-link {
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--muted); font-weight: 500;
  cursor: pointer; border: none; background: none;
  font-family: 'DM Sans', sans-serif; transition: all 0.15s; white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--bg); }
.nav-link.active { color: var(--blue); background: var(--blue-light); }
.nav-home-btn {
  padding: 9px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--blue); color: white; border: none;
  font-family: 'DM Sans', sans-serif; transition: background 0.15s; flex-shrink: 0;
}
.nav-home-btn:hover { background: var(--blue-hover); }

/* ─── PAGE SYSTEM ─── */
.page { display: none; }
.page.active { display: block; }

/* ─── HOMEPAGE SPLIT LAYOUT ─── */
.home-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - var(--nav-h));
  align-items: stretch;
}

/* LEFT PANEL */
.home-left {
  padding: clamp(40px, 6vw, 80px) clamp(28px, 5vw, 72px);
  display: flex; flex-direction: column; justify-content: center;
  border-right: 1px solid var(--border);
  background: linear-gradient(160deg, #f8fafc 0%, #eff6ff 100%);
  position: sticky; top: var(--nav-h);
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.home-left-inner { max-width: 440px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--blue);
  background: var(--blue-light); border: 1px solid var(--blue-mid);
  border-radius: 99px; padding: 4px 12px; margin-bottom: 28px;
  letter-spacing: 0.02em;
}
.hero-badge svg { width: 12px; height: 12px; }
.hero-title {
  font-size: clamp(2.2rem, 4vw, 3.4rem); font-weight: 700;
  letter-spacing: -1.5px; line-height: 1.1; margin-bottom: 20px;
  color: var(--text);
}
.hero-title span { color: var(--blue); }
.hero-desc {
  font-size: 16px; color: var(--muted); font-weight: 400;
  line-height: 1.75; margin-bottom: 40px;
}
.hero-stats { display: flex; gap: 32px; flex-wrap: wrap; }
.stat { }
.stat-num { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -1px; font-family: 'DM Mono', monospace; }
.stat-lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Decorative background circles */
.home-left::before {
  content: ''; position: absolute; width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(37,99,235,0.07) 0%, transparent 70%);
  border-radius: 50%; bottom: -80px; right: -60px; pointer-events: none;
}
.home-left::after {
  content: ''; position: absolute; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(37,99,235,0.05) 0%, transparent 70%);
  border-radius: 50%; top: 40px; left: -40px; pointer-events: none;
}

/* RIGHT PANEL */
.home-right {
  padding: clamp(32px, 4vw, 60px) clamp(24px, 4vw, 56px);
  overflow-y: auto;
}

/* BASIC CALC in home */
.home-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 14px;
}
.basic-calc-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  overflow: hidden; margin-bottom: 40px; max-width: 380px;
}
.bc-display {
  background: #0f172a; padding: 18px 20px 14px;
  text-align: right;
}
.bc-expr { font-family: 'DM Mono', monospace; font-size: 12px; color: #475569; min-height: 18px; margin-bottom: 4px; }
.bc-val { font-family: 'DM Mono', monospace; font-size: 30px; font-weight: 500; color: #f8fafc; letter-spacing: -1px; word-break: break-all; }
.bc-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--border);
}
.bc-btn {
  padding: 16px 0; font-size: 15px; font-weight: 500;
  border: none; cursor: pointer; font-family: 'DM Sans', sans-serif;
  background: var(--surface); color: var(--text);
  transition: background 0.1s; user-select: none;
}
.bc-btn:hover { background: var(--bg); }
.bc-btn:active { background: #e2e8f0; }
.bc-btn.op { color: var(--blue); font-weight: 600; }
.bc-btn.eq { background: var(--blue); color: white; font-size: 18px; }
.bc-btn.eq:hover { background: var(--blue-hover); }
.bc-btn.clear { color: #ef4444; }
.bc-btn.wide { grid-column: span 2; }

/* CATEGORY CARDS */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.cat-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 16px; cursor: pointer; background: var(--surface);
  transition: all 0.18s; text-align: left; position: relative; overflow: hidden;
}
.cat-card::after {
  content: ''; position: absolute; inset: 0; opacity: 0;
  background: var(--blue-light); transition: opacity 0.18s; z-index: 0;
}
.cat-card:hover { border-color: var(--blue-mid); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.cat-card:hover::after { opacity: 1; }
.cat-card > * { position: relative; z-index: 1; }
.cat-icon {
  width: 36px; height: 36px; margin-bottom: 10px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: var(--blue-light);
}
.cat-icon svg { width: 18px; height: 18px; stroke: var(--blue); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.cat-card h3 { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.cat-card p { font-size: 11px; color: var(--muted); line-height: 1.5; }
.cat-count {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; font-weight: 600; color: var(--faint);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 99px; padding: 2px 7px;
}

/* ─── CALCULATOR PAGES ─── */
.calc-page-wrap {
  max-width: 1100px; margin: 0 auto; padding: 0 0 80px;
}

/* Page split: info left, tools right */
.calc-split {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  min-height: calc(100vh - var(--nav-h));
}

.calc-left-panel {
  padding: clamp(32px, 4vw, 56px) 32px clamp(32px, 4vw, 56px) clamp(24px, 4vw, 48px);
  border-right: 1px solid var(--border);
  background: linear-gradient(160deg, #f8fafc 0%, #eff6ff 100%);
  position: sticky; top: var(--nav-h);
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  display: flex; flex-direction: column;
}

.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); cursor: pointer;
  border: none; background: none; font-family: 'DM Sans', sans-serif;
  margin-bottom: 28px; padding: 6px 0; transition: color 0.15s;
}
.back-btn:hover { color: var(--blue); }
.back-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

.calc-page-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.calc-page-icon svg { width: 26px; height: 26px; stroke: var(--blue); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.calc-left-panel h1 { font-size: clamp(20px, 2.5vw, 28px); font-weight: 700; letter-spacing: -0.5px; margin-bottom: 8px; }
.calc-left-panel .subtitle { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 32px; }

.page-nav { display: flex; flex-direction: column; gap: 4px; }
.page-nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  border: none; background: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-size: 13px;
  color: var(--muted); font-weight: 500; transition: all 0.15s;
  text-align: left; width: 100%;
}
.page-nav-btn:hover { color: var(--text); background: rgba(37,99,235,0.06); }
.page-nav-btn.active { color: var(--blue); background: var(--blue-light); font-weight: 600; }
.page-nav-btn-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border); flex-shrink: 0; transition: background 0.15s;
}
.page-nav-btn.active .page-nav-btn-dot { background: var(--blue); }

.calc-right-panel {
  padding: clamp(28px, 4vw, 52px) clamp(24px, 4vw, 52px) 80px;
  overflow-y: auto;
}

/* Tabs — handled by new .learn block above */

/* Calc card */
.c-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: clamp(20px, 3vw, 28px); margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.c-card-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  margin-bottom: 20px; display: flex; align-items: center; gap: 10px;
}
.c-card-title svg { width: 18px; height: 18px; stroke: var(--blue); fill: none; stroke-width: 1.5; stroke-linecap: round; }
.field-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.field { flex: 1; min-width: 120px; }
.field label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--muted); margin-bottom: 6px; letter-spacing: 0.01em;
}
.field input, .field select {
  width: 100%; padding: 10px 14px; font-size: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); outline: none;
  font-family: 'DM Sans', sans-serif; transition: border 0.15s, background 0.15s;
}
.field input:focus, .field select:focus { border-color: var(--blue); background: var(--surface); }
.btn-primary {
  background: var(--blue); color: white; border: none;
  padding: 10px 22px; border-radius: var(--radius-sm); font-size: 14px;
  font-weight: 500; cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: background 0.15s; letter-spacing: 0.01em;
}
.btn-primary:hover { background: var(--blue-hover); }

/* Result */
.result {
  display: none; margin-top: 18px; background: #0f172a;
  border-radius: var(--radius-sm); padding: 18px 20px;
  flex-wrap: wrap; gap: 20px;
}
.result.show { display: flex; }
.result-label { font-size: 11px; font-weight: 500; color: #64748b; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 3px; }
.result-val { font-family: 'DM Mono', monospace; font-size: 22px; font-weight: 500; color: #f8fafc; }
.result-val.sm { font-size: 16px; margin-top: 2px; }

/* Learn panel */
.learn {
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border: 1px solid var(--blue-mid);
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 22px; margin-top: 20px;
}
.learn-title {
  font-size: 12px; font-weight: 700; color: var(--blue);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.learn-title::before {
  content: ''; display: inline-block;
  width: 16px; height: 16px; flex-shrink: 0;
  background: var(--blue); border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round'%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");
  background-size: 12px; background-repeat: no-repeat; background-position: center;
}
.learn-text { font-size: 13px; color: var(--muted); line-height: 1.75; margin-bottom: 6px; }
.formula {
  display: inline-flex; align-items: center;
  font-family: 'DM Mono', monospace;
  font-size: 14px; background: var(--surface); border: 1px solid var(--blue-mid);
  border-radius: var(--radius-sm); padding: 8px 16px; margin: 10px 0 8px;
  color: var(--blue); font-weight: 500; letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(37,99,235,0.08);
}
.learn-steps { margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.learn-step {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px; color: var(--muted); line-height: 1.6;
}
.learn-step-num {
  flex-shrink: 0; width: 20px; height: 20px;
  background: var(--blue); color: white;
  border-radius: 50%; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.learn-tip {
  background: rgba(37,99,235,0.06); border-radius: var(--radius-sm);
  padding: 8px 12px; margin-top: 10px; font-size: 12px; color: var(--blue);
  border: 1px solid rgba(37,99,235,0.12);
}
.learn-tip strong { font-weight: 600; }
.learn-divider { height: 1px; background: var(--blue-mid); margin: 12px 0; opacity: 0.5; }
.learn-example {
  font-family: 'DM Mono', monospace; font-size: 12px;
  color: #475569; background: var(--surface); border-radius: var(--radius-sm);
  padding: 8px 12px; margin: 6px 0; border: 1px solid var(--border);
}

/* Tabs with icons */
.tabs { display: flex; gap: 2px; margin-bottom: 28px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab {
  padding: 10px 16px; font-size: 13px; font-weight: 500;
  color: var(--muted); cursor: pointer; border: none; background: none;
  font-family: 'DM Sans', sans-serif; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all 0.15s; white-space: nowrap;
  display: flex; align-items: center; gap: 6px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab:hover { color: var(--text); background: var(--bg); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); background: var(--blue-light); }
.tab svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Shape selector */
.shape-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.shape-btn {
  padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg);
  font-size: 13px; color: var(--muted); cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-weight: 500;
  transition: all 0.15s;
}
.shape-btn:hover { border-color: var(--blue-mid); color: var(--text); }
.shape-btn.active { border-color: var(--blue); background: var(--blue-light); color: var(--blue); font-weight: 600; }

.hint { font-size: 12px; color: var(--faint); margin-bottom: 16px; }
.date-format-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500; color: var(--muted);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 99px; padding: 2px 8px; margin-top: 5px;
  font-family: 'DM Mono', monospace; letter-spacing: 0.02em;
}

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up   { animation: fadeUp 0.35s ease both; }
.fade-up-2 { animation: fadeUp 0.35s 0.06s ease both; }
.fade-up-3 { animation: fadeUp 0.35s 0.12s ease both; }
.fade-up-4 { animation: fadeUp 0.35s 0.18s ease both; }

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .home-split {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .home-left {
    position: static; height: auto;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 40px 24px 36px;
  }
  .home-left-inner { max-width: 100%; }
  .home-right { padding: 32px 20px 60px; }

  .calc-split {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .calc-left-panel {
    position: static; height: auto;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 28px 20px 24px;
  }
  .page-nav { flex-direction: row; flex-wrap: wrap; }
  .calc-right-panel { padding: 24px 20px 60px; }
  .nav-links { display: none; }
}

@media (max-width: 900px) {
  nav { padding: 0 14px; }
  .hero-title { font-size: 1.9rem; }
  .bc-btn { padding: 14px 0; font-size: 14px; }
  .cat-grid { grid-template-columns: 1fr 1fr; }
  .tabs { gap: 0; }
  .tab { padding: 8px 10px; font-size: 12px; }
  .c-card { padding: 16px; }
  .nav-hamburger { display: flex; }
}

/* ─── HAMBURGER BUTTON ─── */
.nav-hamburger {
  display: none;
  width: 40px; height: 40px;
  border: none; background: none; cursor: pointer;
  border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  color: var(--text); transition: background 0.15s; flex-shrink: 0;
}
.nav-hamburger:hover { background: var(--bg); }
.nav-hamburger svg { width: 22px; height: 22px; }

/* ─── MOBILE MENU ─── */
.mobile-menu { display: none; position: fixed; inset: 0; z-index: 400; }
.mobile-menu.open { display: block; }
.mobile-menu-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.mobile-menu-panel {
  position: absolute; top: 0; right: 0; height: 100%;
  width: min(300px, 85vw); background: var(--surface);
  display: flex; flex-direction: column;
  box-shadow: -4px 0 32px rgba(0,0,0,0.15);
  animation: menuSlideIn 0.22s ease;
}
@keyframes menuSlideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.mobile-menu-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.mobile-menu-title { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.mobile-menu-close {
  width: 32px; height: 32px; border: none; background: none;
  cursor: pointer; font-size: 18px; color: var(--muted);
  border-radius: var(--radius-sm); transition: background 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.mobile-menu-close:hover { background: var(--bg); color: var(--text); }
.mobile-menu-links { display: flex; flex-direction: column; padding: 8px 0; overflow-y: auto; }
.mobile-menu-links button {
  padding: 14px 20px; text-align: left; border: none; background: none;
  font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--text);
  cursor: pointer; transition: background 0.15s; font-weight: 500;
  display: flex; align-items: center; gap: 12px;
}
.mobile-menu-links button:hover { background: var(--blue-light); color: var(--blue); }
.mmlink-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--blue-light); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.mmlink-icon svg { width: 16px; height: 16px; stroke: var(--blue); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ─── COPY BUTTON ─── */
.copy-btn {
  margin-left: auto; padding: 4px 10px; border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.08);
  color: #94a3b8; font-size: 11px; font-family: 'DM Sans', sans-serif;
  cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 4px;
  white-space: nowrap; align-self: flex-start; margin-top: 4px;
}
.copy-btn:hover { background: rgba(255,255,255,0.16); color: #f8fafc; }
.copy-btn.copied { color: #4ade80; border-color: rgba(74,222,128,0.3); }

/* ── multi-page additions ─────────────────────────────────────── */
a { color: inherit; }
a.page-nav-btn { text-decoration: none; }
.nav-link, .nav-home-btn { text-decoration: none; display: inline-flex; align-items: center; }

.breadcrumb { font-size: 12px; color: var(--muted); margin-bottom: 22px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb .sep { color: var(--faint); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 500; }

/* Long-form article content on calculator pages */
.calc-article { max-width: 720px; margin: 28px 0 4px; }
.calc-article h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.4px; color: var(--text); margin: 26px 0 10px; }
.calc-article h2:first-child { margin-top: 0; }
.calc-article p { font-size: 14.5px; color: var(--muted); line-height: 1.75; margin-bottom: 12px; }
.calc-article ul { margin: 0 0 12px 18px; display: flex; flex-direction: column; gap: 7px; }
.calc-article li { font-size: 14.5px; color: var(--muted); line-height: 1.7; }
.calc-article strong { color: var(--text); font-weight: 600; }
.calc-article em { font-style: italic; }
.calc-article sup { font-size: 0.7em; }

/* FAQ */
.faq-section { margin-top: 24px; max-width: 720px; }
.faq-section h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 10px; }
.faq-item { border-top: 1px solid var(--border); padding: 16px 0; }
.faq-q { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.faq-a { font-size: 14px; color: var(--muted); line-height: 1.7; }

/* Category pages */
.cat-page { max-width: 1000px; margin: 0 auto; padding: clamp(28px,4vw,52px) clamp(20px,4vw,40px) 60px; }
.cat-hero { margin-bottom: 32px; }
.cat-hero h1 { font-size: clamp(24px,3vw,34px); font-weight: 700; letter-spacing: -0.8px; margin: 4px 0 10px; }
.cat-hero p { font-size: 15px; color: var(--muted); line-height: 1.7; max-width: 640px; }
.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.list-card { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; transition: all 0.18s; box-shadow: var(--shadow); }
.list-card:hover { border-color: var(--blue-mid); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.list-card-icon { width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px; background: var(--blue-light); display: flex; align-items: center; justify-content: center; }
.list-card-icon svg { width: 19px; height: 19px; stroke: var(--blue); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.list-card-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.list-card-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* Logo: exact favicon geometry (blue rounded square + white plus), vector-crisp.
   The SVG provides its own blue tile, so strip the container's background. */
.nav-logo-icon { background: none; border-radius: 0; width: 42px; height: 42px; }
.nav-logo-icon svg { width: 42px; height: 42px; display: block; }

/* Category cards: whole card is a link, but only underline the header */
.cat-card { text-decoration: none; }
.cat-card h3 { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.cat-card p { text-decoration: none; }

/* Hero (left) panel: pinned to the viewport (original behaviour) so the gradient
   always completes on-screen and fills the visible left side — just without the
   independent scrollbar. Gradient nudged slightly bluer so the top never reads
   as a white "cut-off". */
/* The sidebar panel fills the FULL column height so its gradient never leaves a
   white gap when you scroll; the inner content is sticky so it still travels with
   you until the footer. No independent scrollbars. */
@media (min-width: 901px) {
  .home-left,
  .calc-left-panel {
    position: static;
    max-height: none;
    overflow: visible;
    justify-content: flex-start;
    background: linear-gradient(160deg, #eef4ff 0%, #dce8ff 100%);
  }
  .home-left-inner,
  .calc-left-inner {
    position: sticky;
    top: calc(var(--nav-h) + 32px);
  }
  .home-right,
  .calc-right-panel { overflow: visible; }
}

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg); }
.footer-inner { max-width: 1100px; margin: 0 auto; padding: 44px clamp(20px,4vw,56px) 40px; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 28px 24px; margin-bottom: 32px; }
.footer-col h3 { font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.footer-col h3 a { color: var(--text); text-decoration: none; }
.footer-col h3 a:hover { color: var(--blue); }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-size: 13px; color: var(--muted); text-decoration: none; }
.footer-col li a:hover { color: var(--blue); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 24px; display: flex; flex-direction: column; gap: 8px; }
.footer-brand { font-size: 15px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -0.3px; }
.footer-bottom p { font-size: 12px; color: var(--faint); line-height: 1.6; max-width: 640px; }

/* ── Scientific keypad (original calculator style, upgraded) ───── */
.basic-calc-wrap.sci { max-width: 460px; }
.bc-grid.sci { grid-template-columns: repeat(5, 1fr); }
.bc-btn.fn { color: var(--muted); font-size: 13px; }
.bc-btn.mode { color: #059669; font-size: 12px; font-weight: 600; letter-spacing: 0.03em; }
.bc-btn.eq.tall { grid-row: span 2; }

/* chips (used on the 404 page) */
.tool-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 500; color: var(--muted); text-decoration: none; transition: all 0.15s; }
.tool-chip:hover { border-color: var(--blue-mid); color: var(--blue); background: var(--blue-light); }

/* ── Legal / info (doc) pages ─────────────────────────────────── */
.doc-page { max-width: 760px; margin: 0 auto; padding: clamp(28px,4vw,52px) clamp(20px,4vw,32px) 64px; }
.doc-page h1 { font-size: clamp(24px,3vw,32px); font-weight: 700; letter-spacing: -0.8px; margin: 4px 0 6px; }
.doc-updated { font-size: 13px; color: var(--faint); margin-bottom: 28px; }
.doc-body h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; margin: 28px 0 10px; }
.doc-body p { font-size: 14.5px; color: var(--muted); line-height: 1.75; margin-bottom: 12px; }
.doc-body ul { margin: 0 0 12px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.doc-body li { font-size: 14.5px; color: var(--muted); line-height: 1.7; }
.doc-body a { color: var(--blue); text-decoration: none; }
.doc-body a:hover { text-decoration: underline; }
.doc-body strong { color: var(--text); font-weight: 600; }

/* ── Contact form ─────────────────────────────────────────────── */
.contact-form { margin: 8px 0 24px; }
.contact-form .field textarea { width: 100%; padding: 10px 14px; font-size: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); outline: none; font-family: 'DM Sans', sans-serif; line-height: 1.6; resize: vertical; transition: border 0.15s, background 0.15s; }
.contact-form .field textarea:focus { border-color: var(--blue); background: var(--surface); }
.contact-form .btn-primary { margin-top: 4px; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { font-size: 14px; margin-top: 14px; line-height: 1.6; }
.form-status.ok { color: #15803d; }
.form-status.err { color: #dc2626; }

/* ── Ad slot ──────────────────────────────────────────────────── */
.ad-slot { margin: 20px 0; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); text-align: center; min-height: 100px; }
.ad-label { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }

/* ── Footer legal row ─────────────────────────────────────────── */
.footer-legal { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.footer-legal a { font-size: 12px; color: var(--muted); text-decoration: none; }
.footer-legal a:hover { color: var(--blue); }
.footer-legal .dot { color: var(--faint); font-size: 12px; }
.footer-copy { font-size: 12px; color: var(--faint); margin-top: 4px; }

@media (max-width: 900px) {
  .nav-home-btn { display: none; }
  .basic-calc-wrap.sci { max-width: 100%; }
}
