/* =============================================
   VARIABLES & THEMES
   ============================================= */
:root {
  --primary: #4F46E5;
  --primary-light: #6366F1;
  --primary-dark: #3730A3;
  --secondary: #A855F7;
  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  --text: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --border: #E2E8F0;
  --border-input: #CBD5E1;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 40px rgba(79,70,229,.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --result-bg: linear-gradient(135deg, #EEF2FF 0%, #F5F3FF 100%);
  --result-text: #3730A3;
  --result-border: #C7D2FE;
  --btn-primary-bg: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
  --btn-primary-text: #fff;
  --btn-secondary-bg: #F1F5F9;
  --btn-secondary-text: #475569;
  --btn-secondary-border: #E2E8F0;
  --btn-example-bg: #EFF6FF;
  --btn-example-text: #1D4ED8;
  --btn-example-border: #BFDBFE;
  --btn-clear-bg: #FFF7ED;
  --btn-clear-text: #C2410C;
  --btn-clear-border: #FED7AA;
  --btn-delete-hover: #FFF1F2;
  --btn-delete-color: #9CA3AF;
  --btn-delete-hover-color: #F43F5E;
  --tag-bg: #EEF2FF;
  --tag-text: #4F46E5;
  --hero-gradient: linear-gradient(135deg, #F8FAFF 0%, #F0F4FF 40%, #FAF5FF 100%);
  --nav-bg: rgba(255,255,255,0.95);
  --nav-border: rgba(226,232,240,0.8);
  --section-alt: #F8FAFC;
  --formula-bg: linear-gradient(135deg, #EEF2FF, #F5F3FF);
  --formula-border: #C7D2FE;
  --table-head-bg: #4F46E5;
  --table-row-alt: #F8FAFF;
  --step-num-bg: linear-gradient(135deg, #4F46E5, #6366F1);
  --step-num-text: #fff;
  --card-hover-shadow: 0 20px 60px rgba(79,70,229,.15);
  --icon-bg: linear-gradient(135deg, #EEF2FF, #F5F3FF);
  --icon-color: #4F46E5;
  --highlight-bg: linear-gradient(135deg, #EEF2FF 0%, #F5F3FF 100%);
  --faq-open-bg: #EEF2FF;
}

[data-theme="dark"] {
  --bg: #0F172A;
  --bg-card: #1E293B;
  --bg-input: #0F172A;
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --text-light: #64748B;
  --border: #334155;
  --border-input: #475569;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.2);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.4);
  --result-bg: linear-gradient(135deg, #1E1B4B 0%, #2D1F5E 100%);
  --result-text: #A5B4FC;
  --result-border: #3730A3;
  --btn-primary-bg: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  --btn-primary-text: #fff;
  --btn-secondary-bg: #1E293B;
  --btn-secondary-text: #CBD5E1;
  --btn-secondary-border: #334155;
  --btn-example-bg: #172554;
  --btn-example-text: #93C5FD;
  --btn-example-border: #1D4ED8;
  --btn-clear-bg: #431407;
  --btn-clear-text: #FCA5A5;
  --btn-clear-border: #7F1D1D;
  --btn-delete-hover: #450A0A;
  --btn-delete-color: #64748B;
  --btn-delete-hover-color: #F87171;
  --tag-bg: #1E1B4B;
  --tag-text: #A5B4FC;
  --hero-gradient: linear-gradient(135deg, #0F172A 0%, #1E1B4B 50%, #1A0B2E 100%);
  --nav-bg: rgba(15,23,42,0.95);
  --nav-border: rgba(51,65,85,0.8);
  --section-alt: #1E293B;
  --formula-bg: linear-gradient(135deg, #1E1B4B, #2D1F5E);
  --formula-border: #3730A3;
  --table-head-bg: #3730A3;
  --table-row-alt: #1A1F35;
  --step-num-bg: linear-gradient(135deg, #4F46E5, #7C3AED);
  --step-num-text: #fff;
  --card-hover-shadow: 0 20px 60px rgba(0,0,0,.5);
  --icon-bg: linear-gradient(135deg, #1E1B4B, #2D1F5E);
  --icon-color: #818CF8;
  --highlight-bg: linear-gradient(135deg, #1E1B4B, #2D1F5E);
  --faq-open-bg: #1E1B4B;
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.container--narrow { max-width: 860px; }

/* =============================================
   TYPOGRAPHY
   ============================================= */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
}
h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); }
h4 { font-size: 1.05rem; }

p { color: var(--text-muted); line-height: 1.75; }

.section-title {
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  margin-bottom: 8px;
}
.section-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 40px;
}

/* =============================================
   HEADER & NAV
   ============================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--nav-border);
  transition: background 0.3s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.logo-link img { width: 32px; height: 32px; border-radius: 8px; }

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
}
.main-nav a:hover, .main-nav a.active {
  color: var(--primary);
  background: var(--tag-bg);
}

.header-controls { display: flex; align-items: center; gap: 8px; }

/* Language switcher */
.lang-switcher {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.lang-btn {
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  background: transparent;
  border: none;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  transition: all 0.2s;
}
.lang-btn.active {
  background: var(--primary);
  color: #fff;
}
.lang-btn:hover:not(.active) { background: var(--tag-bg); color: var(--primary); }

  /* Theme toggle button (moon/sun) */
  .theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
  }
  .theme-toggle:hover {
    background: var(--tag-bg);
    border-color: var(--primary);
    color: var(--primary);
  }
  /* In light mode show moon icon; in dark mode show sun icon */
  [data-theme="light"] .icon-sun { display: none; }
  [data-theme="light"] .icon-moon { display: block; }
  [data-theme="dark"] .icon-moon { display: none; }
  [data-theme="dark"] .icon-sun { display: block; }

/* Removed legacy multi-theme controls/dropdowns. Only the single .theme-toggle button is used. */
.theme-switcher, .theme-select, .theme-btn { display: none !important; }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--text);
  transition: all 0.2s;
  align-items: center;
  justify-content: center;
}
.nav-toggle:hover { background: var(--tag-bg); border-color: var(--primary); color: var(--primary); }
.nav-toggle.active { background: var(--tag-bg); border-color: var(--primary); color: var(--primary); }

/* =============================================
   HERO SECTION
   ============================================= */
.hero {
  background: var(--hero-gradient);
  padding: 48px 0 56px;
}

.hero-content {
  max-width: 760px;
  margin: 0 auto 32px;
  text-align: center;
}

/* Hero banner image section (below hero, separate) */
.hero-banner-section {
  background: var(--hero-gradient);
  padding: 0 0 48px;
  border-bottom: 1px solid var(--border);
}
.hero-banner-img {
  max-width: 800px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.hero-banner-img img {
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: cover;
  display: block;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--result-border);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 16px;
}

.hero-title {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 0;
  line-height: 1.7;
}

.hero-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.hero-image img { width: 100%; object-fit: cover; max-height: 320px; }

/* =============================================
   CALCULATOR
   ============================================= */
.calculator-section {
  padding: 0;
}

.calculator-wrapper {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

.calc-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calc-panel-inner {
  display: grid;
  grid-template-columns: 1fr 300px;
}

.calc-input-side {
  padding: 24px;
}

.calc-result-side {
  background: var(--result-bg);
  border-left: 1px solid var(--result-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

/* result-card inside calc-panel: no extra frame */
.calc-panel .result-card {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  position: static;
  border-radius: 0;
  border-top: none;
}

.calc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.calc-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.calc-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.calc-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.calc-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.calc-row:hover { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(99,102,241,.08); }

.calc-row-fields {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr 36px;
  gap: 10px;
  align-items: end;
}

.calc-field { display: flex; flex-direction: column; gap: 4px; }

.calc-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.calc-input {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.9rem;
  color: var(--text);
  font-family: inherit;
  transition: all 0.2s;
  width: 100%;
}
.calc-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
.calc-input::placeholder { color: var(--text-light); }

.btn-delete {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  color: var(--btn-delete-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  height: 38px;
  width: 36px;
  flex-shrink: 0;
}
.btn-delete:hover:not(:disabled) {
  background: var(--btn-delete-hover);
  border-color: var(--btn-delete-hover-color);
  color: var(--btn-delete-hover-color);
}
.btn-delete:disabled { opacity: 0.3; cursor: not-allowed; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(79,70,229,.25);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(79,70,229,.35); }

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border-color: var(--btn-secondary-border);
}

.btn-example {
  background: var(--btn-example-bg);
  color: var(--btn-example-text);
  border-color: var(--btn-example-border);
}

.btn-clear {
  background: var(--btn-clear-bg);
  color: var(--btn-clear-text);
  border-color: var(--btn-clear-border);
}

/* Result Card */
.result-card {
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
}

.result-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--result-text);
  opacity: 0.7;
  margin-bottom: 8px;
}

.result-value-wrapper {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

#result-value {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--result-text);
  line-height: 1;
  letter-spacing: -0.04em;
  transition: all 0.3s ease;
}
#result-value.has-value {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-subtitle {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 20px;
}

.no-result-msg {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 16px;
  text-align: center;
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.result-formula {
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.formula-display { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.formula-numerator { font-size: 0.78rem; color: var(--text-muted); word-break: break-all; text-align: center; }
.formula-divider { width: 80%; height: 1px; background: var(--border); margin: 4px 0; }
.formula-denominator { font-size: 0.78rem; color: var(--text-muted); }

.result-details { display: flex; flex-direction: column; gap: 6px; }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  padding: 6px 8px;
  background: var(--bg-card);
  border-radius: 6px;
  gap: 8px;
}
.detail-name { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.detail-calc { color: var(--text); white-space: nowrap; }

/* =============================================
   CONTENT SECTIONS
   ============================================= */
.section { padding: 72px 0; }
.section--alt { background: var(--section-alt); }

/* Definition Card */
.definition-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
}

.definition-icon {
  width: 56px;
  height: 56px;
  background: var(--icon-bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.definition-quote {
  background: var(--highlight-bg);
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text);
  margin: 16px 0;
  line-height: 1.7;
}

/* Formula */
.formula-card {
  background: var(--formula-bg);
  border: 2px solid var(--formula-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.formula-math {
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.02em;
  margin-bottom: 16px;
  font-family: 'Georgia', serif;
}

.formula-fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  vertical-align: middle;
  margin: 0 6px;
}
.formula-fraction-num, .formula-fraction-den { font-size: 1em; }
.formula-fraction-line { width: 100%; height: 2px; background: var(--primary); }

.formula-legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.formula-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
}
.formula-symbol {
  font-weight: 700;
  color: var(--primary);
  font-family: 'Georgia', serif;
  font-size: 1.1rem;
  min-width: 40px;
}

/* Example Table */
.example-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  background: var(--bg-card);
}

thead th {
  background: var(--table-head-bg);
  color: #fff;
  padding: 14px 18px;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

tbody td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tbody tr:nth-child(even) { background: var(--table-row-alt); }
tbody tr:last-child td { border-bottom: none; font-weight: 700; background: var(--highlight-bg); }

/* Calculation Steps */
.steps-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.step-card {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}
.step-card:hover { box-shadow: var(--card-hover-shadow); transform: translateY(-2px); }

.step-num {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: var(--step-num-bg);
  color: var(--step-num-text);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.step-content h4 { margin-bottom: 4px; font-size: 1rem; }
.step-content p { font-size: 0.9rem; margin: 0; }

/* How-to steps with infographic */
.how-to-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 40px;
  align-items: start;
}

.tips-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 40px;
  align-items: start;
}

.infographic-img {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  align-self: flex-start;
}
.infographic-img img { width: 100%; height: auto; display: block; }

/* Benefits / Features Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}
.feature-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-4px);
  border-color: var(--primary-light);
}

.card-icon {
  width: 48px;
  height: 48px;
  background: var(--icon-bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 14px;
  color: var(--icon-color);
}

.feature-card h3 { font-size: 1rem; margin-bottom: 8px; }
.feature-card p { font-size: 0.9rem; margin: 0; }

/* Tips Checklist */
.tips-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.tip-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.tip-item:last-child { border-bottom: none; }
.tip-item:hover { background: var(--highlight-bg); }

.tip-check {
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: var(--step-num-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.85rem;
}

.tip-item p { margin: 0; font-size: 0.95rem; }

/* Applications Grid */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}
.app-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-3px);
  border-color: var(--primary-light);
}

.app-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.app-card h3 { font-size: 1rem; margin-bottom: 8px; }
.app-card p { font-size: 0.88rem; margin: 0; line-height: 1.65; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 10px; }

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}
.faq-item.open { border-color: var(--primary); }

.faq-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  gap: 12px;
}
.faq-question:hover { background: var(--faq-open-bg); }
.faq-item.open .faq-question { color: var(--primary); background: var(--faq-open-bg); }

.faq-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  background: var(--tag-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1;
  transition: transform 0.3s ease;
}
.faq-item.open .faq-icon { transform: rotate(45deg); }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.faq-answer-inner {
  padding: 0 20px 18px;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.75;
}

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand .logo-link { margin-bottom: 12px; display: inline-flex; }
.footer-brand p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; max-width: 260px; }

.footer-col h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 14px;
}

.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: 0.9rem; color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--primary); }

.social-links { display: flex; gap: 10px; margin-top: 12px; }
.social-link {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 1rem;
}
.social-link:hover { background: var(--tag-bg); color: var(--primary); border-color: var(--primary); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-bottom p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* =============================================
   ANIMATIONS
   ============================================= */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.animate-on-scroll.visible { opacity: 1; transform: translateY(0); }

/* =============================================
   INNER PAGES
   ============================================= */
.page-hero {
  background: var(--hero-gradient);
  padding: 60px 0;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.page-hero h1 { margin-bottom: 12px; }
.page-hero p { max-width: 600px; margin: 0 auto; font-size: 1.05rem; }

.page-content { padding: 60px 0; }
.prose { max-width: 760px; margin: 0 auto; }
.prose h2 { font-size: 1.4rem; margin: 36px 0 12px; color: var(--text); }
.prose h3 { font-size: 1.15rem; margin: 24px 0 8px; }
.prose p { margin-bottom: 16px; }
.prose ul, .prose ol { padding-left: 20px; margin-bottom: 16px; }
.prose li { margin-bottom: 6px; color: var(--text-muted); }

/* Author page */
.author-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow);
  margin-bottom: 40px;
}
.author-photo {
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}
.author-photo img { width: 100%; height: 200px; object-fit: cover; }
.author-name { font-size: 1.5rem; margin-bottom: 6px; }
.author-title { color: var(--primary); font-weight: 600; margin-bottom: 16px; font-size: 0.95rem; }
.eeat-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.eeat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--result-border);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Contact page */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}
.contact-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.contact-item:last-child { border-bottom: none; }
.contact-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 10px;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
  font-size: 0; /* hide any leftover text/emoji */
}
.contact-icon svg { display: block; }
.contact-item h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 3px; }
.contact-item p, .contact-item a { font-size: 0.95rem; margin: 0; word-break: break-all; }

/* =============================================
   BREADCRUMB
   ============================================= */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-light); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .how-to-layout, .tips-layout { grid-template-columns: 1fr; }
  .how-to-layout .infographic-img,
  .tips-layout .infographic-img { max-width: 400px; }
}

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-image { display: none; }
  .calculator-wrapper { grid-template-columns: 1fr; }
  .result-card { position: static; }
  .definition-card { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .author-card { grid-template-columns: 1fr; }
  .author-photo { max-width: 160px; }
}

@media (max-width: 768px) {
  .main-nav { display: none; }
  .main-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 99;
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
  }
  .main-nav.open a {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .main-nav.open a:last-child { border-bottom: none; }
  .nav-toggle { display: flex; }
  .header-inner { position: relative; }
  /* Compact logo text on mobile */
  .logo-link span { font-size: 0.9rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .calc-row-fields { grid-template-columns: 1fr 1fr; }
  .calc-row-fields .calc-field:first-child { grid-column: 1 / -1; }
  .btn-delete { align-self: end; }
  .cards-grid { grid-template-columns: 1fr; }
  .apps-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .formula-legend { grid-template-columns: 1fr 1fr; }
  .theme-toggle { width: 32px; height: 32px; }
  .infographic-img { max-width: 100%; }
  .hero-banner-section { padding: 0 0 32px; }
  .calc-panel-inner { grid-template-columns: 1fr; }
  .calc-result-side { border-left: none; border-top: 1px solid var(--result-border); }
}

@media (max-width: 480px) {
  .hero { padding: 28px 0 24px; }
  .section { padding: 48px 0; }
  .calc-row-fields { grid-template-columns: 1fr; }
  .btn-delete { width: 100%; height: 36px; }
  .footer-grid { grid-template-columns: 1fr; }
  .calc-actions { flex-wrap: wrap; }
  .calc-actions .btn { flex: 1; justify-content: center; min-width: 90px; }
  .formula-legend { grid-template-columns: 1fr; }
  .lang-switcher .lang-btn { padding: 5px 8px; font-size: 0.75rem; }
  /* Very small: hide logo text, keep icon */
  .logo-link span { display: none; }
  .header-controls { gap: 6px; }
  .theme-toggle { width: 30px; height: 30px; }
}

/* =============================================
   AUTHOR / E-E-A-T SECTION
   ============================================= */
.author-eeat-card {
  display: flex;
  gap: 36px;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow);
}
.author-eeat-photo img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--result-border);
  display: block;
  flex-shrink: 0;
}
.author-eeat-content { flex: 1; min-width: 0; }
.author-eeat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 6px;
}
.author-eeat-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.author-eeat-expertise {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 20px;
}
.author-eeat-expertise span {
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--result-border);
  border-radius: 100px;
  padding: 3px 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* =============================================
   AUTHOR SECTION – RESPONSIVE
   ============================================= */
@media (max-width: 640px) {
  .author-eeat-card { flex-direction: column; padding: 24px; gap: 20px; }
  .author-eeat-photo img { width: 80px; height: 80px; }
  .author-eeat-name { font-size: 1.1rem; }
}

/* =============================================
   HERO – MOBILE ADJUSTMENTS
   ============================================= */
@media (max-width: 768px) {
  .hero-content { text-align: left; max-width: 100%; }
  .hero-badge { display: inline-flex; }
  .hero { padding: 32px 0 40px; }
}

/* =============================================
   LANG SEPARATOR
   ============================================= */
.lang-sep {
  color: var(--border-input);
  font-weight: 400;
  font-size: 0.85rem;
  user-select: none;
  line-height: 1;
  align-self: center;
}


/* =============================================
   FINAL UI FIXES: header, toggles, calculator, images
   ============================================= */
.header-controls { gap: 10px; }
.lang-switcher {
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  overflow: visible;
  flex-shrink: 0;
}
.lang-sep { color: var(--text-light); font-size: .78rem; padding: 0 2px; }
.lang-btn {
  min-width: 34px;
  border-radius: 999px;
  cursor: pointer;
}
.theme-toggle {
  border-radius: 999px !important;
  background: var(--bg-card) !important;
  box-shadow: 0 4px 14px rgba(15,23,42,.08);
  cursor: pointer;
}
.calc-panel {
  max-width: 980px;
  margin: 0 auto;
}
.calc-panel-inner {
  grid-template-columns: minmax(0, 1fr) 320px;
}
.hero-banner-img {
  max-width: 760px;
}
.hero-banner-img img {
  object-fit: contain;
  max-height: none;
  background: var(--bg-card);
}
.how-to-layout .infographic-img { max-width: 520px; justify-self: center; }
.tips-layout .infographic-img { max-width: 460px; justify-self: center; }
.infographic-img img { object-fit: contain; }
.social-link svg { width: 18px; height: 18px; display:block; }

@media (min-width: 769px) {
  .nav-toggle { display: none !important; }
}
@media (max-width: 768px) {
  .header-inner { height: 58px; gap: 8px; }
  .logo-link span { display: none !important; }
  .logo-link img { width: 34px; height: 34px; }
  .header-controls { margin-left: auto; gap: 6px; }
  .lang-switcher { padding: 2px; }
  .lang-btn { min-width: 30px; padding: 5px 7px !important; font-size: .72rem !important; }
  .theme-toggle { width: 32px !important; height: 32px !important; }
  .calc-panel { max-width: 100%; }
  .calc-panel-inner { grid-template-columns: 1fr; }
  .calc-input-side, .calc-result-side { padding: 18px; }
  .hero-title { font-size: clamp(1.7rem, 8vw, 2.35rem); }
  .hero-desc { font-size: .98rem; }
  .hero-banner-img { max-width: 100%; }
  .how-to-layout .infographic-img,
  .tips-layout .infographic-img { max-width: 100%; }
}
@media (max-width: 420px) {
  .header-controls { gap: 5px; }
  .lang-sep { display: none; }
  .lang-btn { min-width: 28px; }
  .theme-toggle { width: 30px !important; height: 30px !important; }
  .nav-toggle { padding: 5px 7px; }
}


/* Fix author photo empty space */
.author-card{align-items:start;}
.author-photo{height:fit-content;align-self:start;}
.author-photo img{display:block;height:auto;max-height:320px;object-fit:cover;}

/* Place infographics below content and make them larger */
.how-to-layout,
.tips-layout{
  display:block;
}
.how-to-layout .infographic-img,
.tips-layout .infographic-img{
  max-width:950px;
  margin:32px auto 0;
}
.how-to-layout .infographic-img img,
.tips-layout .infographic-img img{
  width:100%;
  height:auto;
}

@media (max-width:768px){
 .how-to-layout .infographic-img,
 .tips-layout .infographic-img{
   max-width:100%;
   margin-top:20px;
 }
}

/* Result export/share actions */
.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.result-actions .btn {
  flex: 1;
  justify-content: center;
  min-width: 132px;
  min-height: 42px;
}
.btn-pdf {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(79,70,229,.18);
}
.btn-pdf:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(79,70,229,.28);
}
.btn-share {
  background: var(--btn-example-bg);
  color: var(--btn-example-text);
  border-color: var(--btn-example-border);
}
.btn-share:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(29,78,216,.14);
}
.share-status {
  margin: 10px 0 0;
  font-size: .875rem;
  color: var(--primary-color);
  opacity: 0;
  min-height: 1.25em;
  transition: opacity .2s ease;
}
.share-status.visible { opacity: 1; }
.share-status.is-error { color: #e11d48; }
[data-theme="dark"] .share-status.is-error { color: #fda4af; }
@media (max-width: 640px) {
  .result-actions { flex-direction: column; }
  .result-actions .btn { width: 100%; }
}


/* Grade calculator page refinements */
.grade-result-card {
  background: linear-gradient(145deg, rgba(79,70,229,.12), rgba(14,165,233,.10));
  border: 1px solid rgba(99,102,241,.24);
  box-shadow: 0 18px 45px rgba(79,70,229,.14);
}
.grade-result-card #grade-result-value {
  font-size: clamp(2.5rem, 7vw, 4rem);
  line-height: 1;
  font-weight: 850;
  color: var(--primary);
  letter-spacing: -0.04em;
}
.grade-result-card .no-result-msg {
  background: rgba(255,255,255,.58);
  border: 1px dashed rgba(99,102,241,.28);
  border-radius: 14px;
  padding: 14px 16px;
}
[data-theme="dark"] .grade-result-card {
  background: linear-gradient(145deg, rgba(79,70,229,.22), rgba(14,165,233,.14));
  border-color: rgba(129,140,248,.25);
}
[data-theme="dark"] .grade-result-card .no-result-msg {
  background: rgba(15,23,42,.45);
}
.definition-icon svg,
.card-icon svg,
.app-icon svg,
.who-card-icon svg,
.related-tool-icon svg {
  width: 1.25em;
  height: 1.25em;
  display: block;
  margin: auto;
}
.card-icon,
.app-icon,
.who-card-icon,
.related-tool-icon {
  color: var(--primary);
}
.related-tools-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
@media (min-width: 769px) {
  #jak-obliczac img[src*="jak-obliczac-oceny"] {
    max-width: 760px !important;
  }
}


/* === Grade page final fixes === */
.grade-infographic {
  width: 100%;
  margin: 32px auto 0;
  text-align: center;
}
.grade-infographic img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.grade-infographic--small { max-width: 620px; }
@media (max-width: 768px) { .grade-infographic--small { max-width: 100%; } }

/* Replace emoji visuals with consistent modern icon bubbles */
.definition-icon,
.card-icon,
.app-icon,
.who-card-icon,
.related-tool-icon {
  font-size: 0 !important;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(99,102,241,.14), rgba(14,165,233,.12));
  border: 1px solid rgba(99,102,241,.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  box-shadow: 0 8px 18px rgba(79,70,229,.08);
}
.definition-icon::before,
.card-icon::before,
.app-icon::before,
.who-card-icon::before,
.related-tool-icon::before {
  content: '';
  width: 20px;
  height: 20px;
  display: block;
  background: currentColor;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg>') center / contain no-repeat;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg>') center / contain no-repeat;
}
.who-card-icon::before {
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M16 21v-2a4 4 0 0 0-8 0v2"/><circle cx="12" cy="7" r="4"/></svg>');
  mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M16 21v-2a4 4 0 0 0-8 0v2"/><circle cx="12" cy="7" r="4"/></svg>');
}
.definition-icon::before {
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="3" width="16" height="18" rx="2"/><path d="M8 7h8M8 11h8M8 15h5"/></svg>');
  mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="3" width="16" height="18" rx="2"/><path d="M8 7h8M8 11h8M8 15h5"/></svg>');
}

.grade-result-card {
  background: linear-gradient(145deg, rgba(99,102,241,.14), rgba(168,85,247,.12), rgba(14,165,233,.10));
}
.grade-result-card .result-actions { margin-top: 16px; }

/* =============================================
   NAV DROPDOWN
   ============================================= */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  color: var(--text-muted);
  font-weight: 500;
  padding: 4px 0;
  border-radius: 4px;
  transition: color 0.2s;
  white-space: nowrap;
}
.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle {
  color: var(--primary);
}
.nav-dropdown-chevron {
  transition: transform 0.22s ease;
  flex-shrink: 0;
  color: var(--text-muted);
}
.nav-dropdown.open .nav-dropdown-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  min-width: 230px;
  padding: 6px 0;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  pointer-events: none;
}
.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.nav-dropdown-menu a {
  display: block;
  padding: 10px 18px;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
  background: var(--highlight-bg);
  color: var(--primary);
}
.nav-dropdown-menu a.active {
  font-weight: 600;
}

/* Mobile: dropdown inline inside open mobile nav */
@media (max-width: 820px) {
  .nav-dropdown {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  .nav-dropdown-toggle {
    width: 100%;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 1rem;
    color: var(--text);
  }
  .nav-dropdown-menu {
    position: static;
    transform: none !important;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--primary);
    border-radius: 0;
    padding: 0;
    background: transparent;
    width: 100%;
    transition: opacity 0.2s, max-height 0.25s ease, visibility 0.2s;
  }
  .nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    max-height: 200px;
    pointer-events: auto;
  }
  .nav-dropdown-menu a {
    padding: 8px 14px;
    font-size: 0.92rem;
    color: var(--text-muted);
  }
}
