@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg: #f7f5f0;
  --bg-card: #ffffff;
  --bg-result: #1a1a2e;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --text-light: #9a9a9a;
  --accent: #e8563a;
  --accent-dark: #c93f24;
  --accent-light: #fff1ee;
  --green: #2d7a4f;
  --green-light: #edf7f1;
  --border: #e5e2db;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --nav-h: 64px;
  --max-w: 1120px;
}

/* ── DARK MODE ── */
body.dark {
  --bg: #111118;
  --bg-card: #1c1c26;
  --bg-result: #0d0d14;
  --text: #f0ede8;
  --text-muted: #9a97a0;
  --text-light: #5a575f;
  --accent-light: #2a1510;
  --border: #2e2e3e;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
}
body.dark nav {
  background: rgba(17,17,24,0.92);
}
body.dark input[type="number"],
body.dark input[type="text"],
body.dark select {
  background: #0d0d14;
  color: var(--text);
  border-color: var(--border);
}
body.dark .radio-option {
  background: #0d0d14;
}
body.dark .radio-option.selected {
  background: var(--accent-light);
  border-color: var(--accent);
}
body.dark .unit-toggle {
  background: #0d0d14;
}
body.dark .unit-toggle button.active {
  background: #1c1c26;
}
body.dark .disclaimer {
  background: #1a100d;
  border-color: #3a2020;
  color: #b07070;
}
body.dark .ad-slot {
  background: #1c1c26;
  border-color: #2e2e3e;
}
body.dark .calc-card {
  background: var(--bg-card);
}
body.dark .calc-card.featured {
  background: #0d0d14;
}

/* ── DARK MODE TOGGLE BUTTON ── */
.dark-toggle {
  background: none; border: 1px solid var(--border);
  border-radius: 20px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; font-family: var(--font-body);
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  transition: all 0.15s; flex-shrink: 0;
}
.dark-toggle:hover { border-color: var(--accent); color: var(--accent); }
.dark-toggle-icon { font-size: 14px; }

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

/* ── NAV ── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(247,245,240,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  display: flex; align-items: center;
}
.nav-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 24px;
  width: 100%; display: flex; align-items: center; gap: 32px;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 20px; color: var(--text);
  text-decoration: none; flex-shrink: 0;
  display: flex; align-items: center; gap: 9px;
}
.nav-logo-text { line-height: 1; }
.nav-logo-text span { color: var(--accent); }
.nav-links {
  display: flex; gap: 4px; flex-wrap: wrap;
  list-style: none; margin-left: auto;
}
.nav-links a {
  font-size: 13px; font-weight: 500;
  color: var(--text-muted); text-decoration: none;
  padding: 6px 12px; border-radius: 6px;
  transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text); background: var(--border);
}

/* ── LAYOUT ── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.page-wrap { min-height: 100vh; padding-bottom: 80px; }

/* ── HERO ── */
.hero {
  padding: 64px 0 48px;
  text-align: center;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-light); border-radius: 20px;
  padding: 5px 14px; margin-bottom: 20px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.1; color: var(--text);
  margin-bottom: 16px;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero p {
  font-size: 17px; color: var(--text-muted);
  max-width: 520px; margin: 0 auto 32px;
  line-height: 1.7;
}
.hero-badges {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.badge {
  font-size: 12px; font-weight: 500;
  padding: 4px 12px; border-radius: 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ── CALC GRID (HOME) ── */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px; margin: 48px 0;
}
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none; color: inherit;
  transition: all 0.2s;
  display: block;
}
.calc-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.calc-card.featured {
  background: var(--bg-result);
  border-color: transparent; color: #fff;
  grid-column: span 2;
}
.calc-card-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 14px;
}
.calc-card.featured .calc-card-icon {
  background: rgba(232,86,58,0.2); color: var(--accent);
}
.calc-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.calc-card p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.calc-card.featured p { color: rgba(255,255,255,0.6); }
.calc-card .arrow {
  margin-top: 16px; font-size: 13px; font-weight: 500;
  color: var(--accent); display: flex; align-items: center; gap: 4px;
}

/* ── CALCULATOR PAGE ── */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px; align-items: start;
  padding: 48px 0;
}
.calc-main { }
.calc-sidebar { }

.calc-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.calc-box h2 {
  font-family: var(--font-display);
  font-size: 28px; margin-bottom: 8px;
}
.calc-box .subtitle {
  font-size: 14px; color: var(--text-muted); margin-bottom: 28px;
}

/* ── FORM ELEMENTS ── */
.form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label {
  font-size: 13px; font-weight: 500; color: var(--text-muted);
}
input[type="number"], input[type="text"], select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: var(--font-body); font-size: 15px;
  color: var(--text);
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
input:focus, select:focus {
  outline: none; border-color: var(--accent);
}

/* unit toggle */
.unit-toggle {
  display: inline-flex;
  background: var(--border); border-radius: 8px; padding: 3px;
  margin-bottom: 24px;
}
.unit-toggle button {
  background: none; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  padding: 6px 16px; border-radius: 6px; color: var(--text-muted);
  transition: all 0.15s;
}
.unit-toggle button.active {
  background: var(--bg-card); color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* radio group */
.radio-group {
  display: flex; flex-direction: column; gap: 8px;
}
.radio-option {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer;
  transition: all 0.15s; background: var(--bg);
}
.radio-option:hover { border-color: var(--accent); }
.radio-option.selected {
  border-color: var(--accent); background: var(--accent-light);
}
.radio-option input { margin-top: 2px; accent-color: var(--accent); }
.radio-label { font-size: 14px; font-weight: 500; }
.radio-sub { font-size: 12px; color: var(--text-muted); }

/* CTA button */
.btn-calc {
  width: 100%; padding: 14px;
  background: var(--accent); color: white;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 16px; font-weight: 600;
  cursor: pointer; margin-top: 24px;
  transition: all 0.2s;
}
.btn-calc:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-calc:active { transform: translateY(0); }

/* ── RESULTS ── */
.results-box {
  background: var(--bg-result);
  border-radius: var(--radius);
  padding: 28px; margin-top: 24px;
  color: #fff; display: none;
}
.results-box.visible { display: block; }
.results-title {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: rgba(255,255,255,0.5);
  margin-bottom: 20px;
}
.result-main {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 8px;
}
.result-number {
  font-family: var(--font-display);
  font-size: 56px; color: var(--accent); line-height: 1;
}
.result-unit { font-size: 20px; color: rgba(255,255,255,0.5); }
.result-label {
  font-size: 14px; color: rgba(255,255,255,0.6); margin-bottom: 24px;
}
.result-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 20px;
}
.result-card {
  background: rgba(255,255,255,0.06);
  border-radius: 8px; padding: 14px;
}
.result-card-label {
  font-size: 11px; color: rgba(255,255,255,0.45);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px;
}
.result-card-val {
  font-size: 22px; font-weight: 600; color: #fff;
}
.result-card-sub { font-size: 12px; color: rgba(255,255,255,0.5); }

/* macro bars */
.macro-bars { margin-top: 16px; }
.macro-bar-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.macro-bar-label {
  width: 80px; font-size: 13px; font-weight: 500;
}
.macro-bar-track {
  flex: 1; height: 6px; background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden;
}
.macro-bar-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.6s ease;
}
.macro-bar-val { font-size: 13px; color: rgba(255,255,255,0.6); min-width: 50px; text-align: right; }
.bar-protein { background: #e8563a; }
.bar-carbs { background: #f4a261; }
.bar-fat { background: #2dc6a0; }

/* ── SIDEBAR ── */
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.sidebar-card h4 {
  font-size: 14px; font-weight: 600; margin-bottom: 12px;
}
.related-links { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.related-links a {
  font-size: 14px; color: var(--text-muted);
  text-decoration: none; display: flex; align-items: center; gap: 6px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.related-links a:last-child { border-bottom: none; }
.related-links a:hover { color: var(--accent); }

/* ── AD SLOTS ── */
.ad-slot {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light); font-size: 12px;
  text-align: center; line-height: 1.4;
}
.ad-slot-banner { height: 90px; margin: 24px 0; }
.ad-slot-rect { height: 250px; margin-bottom: 16px; }
.ad-slot-inline { height: 100px; margin: 20px 0; }

/* ── FAQ ── */
.faq { margin: 48px 0; }
.faq h2 {
  font-family: var(--font-display);
  font-size: 32px; margin-bottom: 24px;
}
.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-q {
  width: 100%; background: none; border: none; cursor: pointer;
  text-align: left; padding: 18px 0;
  font-family: var(--font-body); font-size: 15px; font-weight: 500;
  color: var(--text); display: flex; justify-content: space-between; align-items: center;
}
.faq-q::after { content: '+'; font-size: 20px; color: var(--accent); flex-shrink: 0; }
.faq-q.open::after { content: '−'; }
.faq-a {
  font-size: 15px; color: var(--text-muted); line-height: 1.7;
  padding: 0 0 18px; display: none;
}
.faq-a.open { display: block; }

/* ── EXPLAINER ── */
.explainer {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px; margin: 32px 0;
}
.explainer h3 {
  font-family: var(--font-display); font-size: 22px; margin-bottom: 12px;
}
.explainer p { font-size: 15px; color: var(--text-muted); line-height: 1.7; margin-bottom: 12px; }
.explainer p:last-child { margin-bottom: 0; }

/* ── FOOTER ── */
footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  margin-top: 64px;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px; margin-bottom: 32px;
}
.footer-brand { }
.footer-logo {
  font-family: var(--font-display); font-size: 20px;
  color: var(--text); text-decoration: none; display: block; margin-bottom: 10px;
}
.footer-logo span { color: var(--accent); }
.footer-desc { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.footer-col h5 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-light); margin-bottom: 12px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-size: 14px; color: var(--text-muted); text-decoration: none; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 20px;
  font-size: 12px; color: var(--text-light);
  display: flex; justify-content: space-between; align-items: center;
}
.disclaimer {
  background: #fff8f7; border: 1px solid #fdd; border-radius: var(--radius-sm);
  padding: 14px 18px; font-size: 13px; color: #a05050; margin: 32px 0;
  line-height: 1.6;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-main { order: unset; }
  .calc-sidebar { order: unset; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .calc-card.featured { grid-column: span 1; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .ad-slot-rect { height: 100px; }
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
  .result-number { font-size: 40px; }
  .hero h1 { font-size: 32px; }
  .result-grid { grid-template-columns: 1fr 1fr; }
}
