/* TDEE Calculator — mobile-first. v5 remove page 108px pad */
:root {
  --bg: #f4f8fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0ea5e9;
  --accent-dark: #0284c7;
  --accent-soft: #e0f2fe;
  --border: #e2e8f0;
  --success: #059669;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --nav-h: 64px;
  --content-max: 1100px;
  --page-pad: 18px;
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  max-width: 100%;
}
body {
  margin: 0;
  max-width: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
[hidden] { display: none !important; }
a { color: var(--accent-dark); text-decoration: none; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4, p, li, label, .lead, .nav-link, .disclaimer {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.container,
.nav-container,
.footer-grid,
.footer-bottom {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-inline: var(--page-pad);
  box-sizing: border-box;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.nav-container {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}
.nav-logo { min-width: 0; }
.nav-logo a, .nav-logo h2 {
  margin: 0; font-size: 1.15rem; color: var(--text); text-decoration: none;
}
.nav-logo span { color: var(--accent-dark); }
.nav-menu {
  list-style: none; display: flex; gap: 1.25rem; margin: 0; padding: 0;
}
.nav-link { color: var(--text); font-weight: 500; font-size: 0.95rem; }
.nav-link.active { color: var(--accent-dark); }
.hamburger {
  display: none; flex-direction: column; gap: 5px; cursor: pointer;
  background: none; border: 0; padding: 8px;
  min-width: 44px; min-height: 44px;
  align-items: center; justify-content: center;
}
.hamburger .bar {
  width: 22px; height: 2px; background: var(--text); display: block; border-radius: 2px;
}

.hero {
  padding: 2.5rem 0 1.5rem;
  background: linear-gradient(180deg, #e0f2fe 0%, var(--bg) 70%);
}
.hero-grid {
  display: grid;
  gap: 1.75rem;
  min-width: 0;
}
.hero-intro { min-width: 0; }
.hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.4rem);
  line-height: 1.2; margin: 0 0 0.75rem;
}
.hero .lead {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 1.25rem;
  max-width: 40rem;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem; border-radius: 999px; padding: 0.8rem 1.35rem;
  font-weight: 600; border: 0; cursor: pointer; font-size: 1rem;
  min-height: 44px;
  transition: background .15s ease, opacity .15s ease, color .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem;
  min-width: 0;
}
.calc-card { margin: -0.5rem 0 2rem; }
.section { padding: 2rem 0; }
.section h2 { margin: 0 0 0.75rem; font-size: 1.4rem; }
.muted { color: var(--muted); }
.grid-3 {
  display: grid; gap: 1rem;
  grid-template-columns: 1fr;
  min-width: 0;
}
.feature {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem;
  min-width: 0;
}
.feature h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }

.calc-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.calc-title-row h2 { margin: 0; font-size: 1.25rem; min-width: 0; }

.form-grid {
  display: grid; gap: 1rem;
  grid-template-columns: 1fr 1fr;
  min-width: 0;
}
.form-group { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.form-group.full { grid-column: 1 / -1; }
label { font-weight: 600; font-size: 0.9rem; }
.hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; }
input, select, textarea {
  font: inherit;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  min-height: 48px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-soft); border-color: var(--accent);
}
.unit-toggle {
  display: inline-flex; background: var(--bg); border-radius: 999px;
  padding: 3px; border: 1px solid var(--border); gap: 2px;
  flex-shrink: 0;
}
.unit-toggle button {
  border: 0; background: transparent; padding: 0.45rem 0.9rem;
  border-radius: 999px; font-weight: 600; cursor: pointer; color: var(--muted);
  min-height: 40px;
}
.unit-toggle button.active {
  background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.row-inline {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}
.row-inline > * {
  flex: 1 1 8rem;
  min-width: 0;
}
.calc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.results {
  display: none; margin-top: 1.25rem; padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.results.visible { display: block; }
.result-grid {
  display: grid; gap: 0.75rem;
  grid-template-columns: 1fr 1fr;
  min-width: 0;
}
.result-pill {
  background: var(--accent-soft); border-radius: 12px; padding: 1rem;
  min-width: 0;
}
.result-pill .label { font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.result-pill .value { font-size: 1.55rem; font-weight: 700; color: var(--accent-dark); }
.result-pill .unit { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.macros {
  margin-top: 1rem; display: grid; gap: 0.5rem;
}
.macro-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.75rem; flex-wrap: wrap;
  padding: 0.65rem 0.85rem; background: var(--bg); border-radius: 10px;
  border: 1px solid var(--border);
}
.disclaimer {
  margin-top: 1rem; font-size: 0.85rem; color: var(--muted);
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; padding: 0.85rem;
}

.page-main { padding: 2rem 0 3rem; }
.page-main h1 { margin: 0 0 0.5rem; font-size: clamp(1.6rem, 4vw, 2rem); }
.page-main .subtitle { color: var(--muted); margin: 0 0 1.5rem; }
.content-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.35rem; margin-bottom: 1rem;
  min-width: 0;
}
.content-card h2 { margin-top: 0; font-size: 1.15rem; }
.faq-item { margin-bottom: 1rem; }
.faq-item h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.faq-item p { margin: 0; color: var(--muted); }

.footer {
  background: #0f172a; color: #cbd5e1; padding: 2.5rem 0 1.25rem; margin-top: 2rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}
.footer a { color: #e2e8f0; }
.footer-grid {
  display: grid; gap: 1.5rem; grid-template-columns: 1.4fr 1fr 1fr 1fr;
}
.footer h3, .footer h4 { color: #fff; margin: 0 0 0.6rem; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 0.35rem; }
.footer-bottom {
  margin-top: 1.5rem;
  padding-top: 1rem; border-top: 1px solid #1e293b;
  font-size: 0.85rem; color: #94a3b8;
}

@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration: underline; }
  .nav-link:hover { color: var(--accent-dark); text-decoration: none; }
  .btn-primary:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }
  .btn-secondary:hover { background: var(--accent-soft); text-decoration: none; }
}

@media (max-width: 800px) {
  .hero-intro { text-align: center; }
  .hero-intro .lead { margin-inline: auto; }
  .hero-intro .hero-actions { justify-content: center; }
  .hamburger { display: flex; }
  .nav-menu {
    position: fixed;
    top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 1rem max(1.25rem, env(safe-area-inset-right, 0px)) 1.25rem max(1.25rem, env(safe-area-inset-left, 0px));
    border-bottom: 1px solid var(--border);
    display: none;
    gap: 0.35rem;
  }
  .nav-menu.active { display: flex; }
  .nav-link { padding: 0.7rem 0.2rem; }
  .form-grid, .result-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 801px) {
  .hero-grid { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .calc-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .row-inline {
    flex-direction: column;
    align-items: stretch;
  }
  .row-inline > * { flex: 1 1 auto; }
}
