/*
Theme Name: The Fitness Calculator
Theme URI: https://thefitnesscalculator.com/
Description: Free health & fitness calculator suite (BMI, calories/TDEE, body fat, ideal weight, water intake). Fast, mobile-friendly, AdSense-ready. Single-purpose tool theme.
Author: Ammar
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: thefitnesscalculator
Tags: calculator, health, fitness, tools
*/

:root {
  --bg: #0e1214;
  --surface: #151b1e;
  --surface-2: #1c2429;
  --border: #2a343a;
  --text: #e8eef0;
  --muted: #97a6ad;
  --accent: #14b8a6;
  --accent-2: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  /* aliases used by the guide cards and figure borders */
  --card: #151b1e;
  --line: #2a343a;
  font-size: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #12211f 0%, var(--bg) 55%);
  color: var(--text); line-height: 1.55; min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* circumference field visibility (body fat), driven by body class */
body.metric .imperial-only { display: none !important; }
body.imperial .metric-only { display: none !important; }

header.site { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px); background: rgba(14,18,20,.78); border-bottom: 1px solid var(--border); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }
.nav { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand:hover .bn-com { filter: brightness(1.15); }
.brand-mark { display: block; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; }
.brand-name { font-size: 1.12rem; letter-spacing: -.015em; white-space: nowrap; line-height: 1; }
.bn-light { font-weight: 400; color: var(--muted); }
.bn-bold  { font-weight: 800; color: var(--text); }
.bn-com   { font-weight: 800; color: var(--accent-2); }
.brand img { display: block; height: 34px; width: auto; }
@media (max-width: 420px) {
  .brand-name { font-size: .95rem; }
  .brand-mark { width: 26px; height: 26px; }
}

/* right-hand side of the header: primary nav + the metric/imperial switch */
.nav-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.site-nav { display: flex; align-items: center; gap: 2px; }
.site-nav a {
  display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 12px; border-radius: 10px;
  color: var(--muted); font-size: .95rem; font-weight: 600; white-space: nowrap;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--text); }

.unit-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; flex: 0 0 auto; }
.unit-toggle button {
  background: var(--surface); color: var(--muted); border: none;
  min-height: 44px; padding: 0 16px; cursor: pointer;
  font-size: .85rem; font-weight: 700; font-family: inherit;
}
.unit-toggle button.active { background: linear-gradient(135deg, var(--accent), #0d9488); color: #fff; }

/* The header holds a logo, three links and a two-button switch, so it wraps to
   a second row before any of that has to shrink below a comfortable tap size. */
@media (max-width: 760px) {
  .nav { height: auto; min-height: 62px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; gap: 4px 12px; }
  .nav-right { width: 100%; justify-content: space-between; gap: 8px; }
  .site-nav a { padding: 0 10px; font-size: .9rem; }
}
@media (max-width: 380px) {
  .site-nav a { padding: 0 7px; font-size: .85rem; }
  .unit-toggle button { padding: 0 12px; }
}

.hero { text-align: center; padding: 44px 0 10px; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); letter-spacing: -.02em; }
.hero p { color: var(--muted); margin-top: 10px; max-width: 640px; margin-inline: auto; }

.ad-slot { max-width: 980px; margin: 22px auto; padding: 0 20px; }
.ad-box { border: 1px dashed var(--border); border-radius: 12px; min-height: 90px; display: grid; place-items: center; color: #566067; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; background: repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(255,255,255,.015) 12px, rgba(255,255,255,.015) 24px); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 18px auto 6px; }
.tab { display: inline-flex; align-items: center; min-height: 44px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); padding: 0 16px; border-radius: 999px; cursor: pointer; font-size: .92rem; font-weight: 600; font-family: inherit; transition: .15s; }
.tab:hover { color: var(--text); border-color: #3a464d; }
.tab.active { background: linear-gradient(135deg, var(--accent), #0d9488); color: #fff; border-color: transparent; }

.panel { display: none; }
.panel.active { display: block; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; margin: 18px auto; max-width: 980px; }
.card h2 { font-size: 1.25rem; margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: .92rem; margin-bottom: 20px; }

/* readable prose inside content pages (about, privacy, etc.) */
.card p { color: var(--muted); margin-bottom: 14px; }
.card h3 { margin: 18px 0 8px; font-size: 1.05rem; color: var(--text); }
.card ul { color: var(--muted); margin: 0 0 14px 20px; }
.card li { margin-bottom: 6px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input[type="number"], .field select { width: 100%; }
.field input[type="number"], .field select { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 11px 12px; font-size: 1rem; }
.field input[type="number"]:focus, .field select:focus { outline: none; border-color: var(--accent); }
.with-unit { position: relative; }
.with-unit .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; }
.ftin { display: flex; gap: 10px; }
.ftin > div { flex: 1; }
select.hunit, select.wunit { margin-bottom: 8px; }

.result { margin-top: 22px; padding: 22px; border-radius: 12px; background: linear-gradient(135deg, rgba(20,184,166,.12), rgba(52,211,153,.10)); border: 1px solid var(--border); }
.result .big { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.result .big small { font-size: .95rem; color: var(--muted); font-weight: 600; }
.badge { display: inline-block; margin-top: 6px; padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; }
.breakdown { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 16px; }
.breakdown div { min-width: 120px; }
.breakdown .k { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.breakdown .v { font-size: 1.15rem; font-weight: 700; margin-top: 2px; }

.goals { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 16px; }
@media (max-width: 640px) { .goals { grid-template-columns: 1fr; } }
.goals .g { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.goals .g .k { color: var(--muted); font-size: .78rem; }
.goals .g .v { font-size: 1.1rem; font-weight: 700; margin-top: 3px; }

.explain { margin: 6px auto 0; max-width: 980px; }
.explain details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; margin-top: 12px; }
.explain summary { cursor: pointer; font-weight: 700; }
.explain p { color: var(--muted); margin-top: 10px; font-size: .95rem; }

footer.site { border-top: 1px solid var(--border); margin-top: 40px; padding: 30px 0; color: var(--muted); font-size: .9rem; }
footer .links { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 14px; }
footer .links a { color: var(--muted); }
.disclaimer { font-size: .82rem; color: #6b7280; max-width: 760px; }

/* ---- Articles: blog index, single guide, long-form pages ---- */
.card h1 { font-size: clamp(1.5rem, 3.4vw, 2rem); letter-spacing: -.02em; margin-bottom: 6px; }
.post-list { display: grid; gap: 16px; }
.post-card { transition: border-color .15s ease, transform .15s ease; }
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-card-title { font-size: 1.25rem; letter-spacing: -.015em; }
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent-2); text-decoration: none; }
.post-meta { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.post-card-excerpt { color: var(--muted); margin-top: 10px; }
.post-card-more { display: inline-block; margin-top: 12px; font-weight: 700; font-size: .9rem; }

.prose .post-title { margin-bottom: 4px; }
.prose h2 { margin-top: 30px; font-size: 1.35rem; letter-spacing: -.015em; }
.prose h3 { margin-top: 22px; font-size: 1.08rem; }
.prose p, .prose li { color: #cfd9dd; }
.prose p { margin-top: 12px; }
.prose ul, .prose ol { margin-top: 12px; padding-left: 22px; }
.prose li { margin-top: 6px; }
.prose blockquote { margin: 18px 0; padding: 12px 18px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--muted); }
.prose table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: .94rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
.prose th { background: var(--surface-2); font-weight: 700; }

.post-cta { margin-top: 16px; background: linear-gradient(135deg, rgba(20,184,166,.12), rgba(52,211,153,.10)); }
.post-cta h2 { font-size: 1.15rem; }
.post-cta p { color: var(--muted); margin-top: 8px; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 640px) { .post-nav { grid-template-columns: 1fr; } }
.post-nav-link { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.post-nav-link:hover { border-color: var(--accent); text-decoration: none; }
.post-nav-dir { display: block; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.post-nav-title { display: block; color: var(--text); font-weight: 700; margin-top: 4px; }

.pagination { margin: 22px 0 8px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pagination .page-numbers { display: inline-block; padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); font-weight: 700; font-size: .9rem; }
.pagination .page-numbers:hover { border-color: var(--accent); text-decoration: none; }
.pagination .page-numbers.current { background: linear-gradient(135deg, var(--accent), #0d9488); color: #fff; border-color: transparent; }

/* ---------- home page guide cluster ---------- */
.guides-home { margin-top: 34px; }
.guides-home h2 { font-size: 1.35rem; margin: 0 0 6px; }
.guides-home-intro { color: var(--muted); margin: 0 0 18px; max-width: 62ch; }
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 14px;
}
.guide-item {
  display: block;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
  transition: border-color .16s ease, transform .16s ease;
}
.guide-item:hover { border-color: var(--accent); transform: translateY(-2px); }
.guide-item-title {
  display: block;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 6px;
}
.guide-item-excerpt {
  display: block;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.5;
}


/* ---------- breadcrumbs ---------- */
.crumbs { margin: 0 0 16px; font-size: .88rem; color: var(--muted); line-height: 1.6; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent-2); text-decoration: underline; }
.crumbs .separator { margin: 0 8px; opacity: .55; }
.crumbs .last { color: var(--text); }

/* ---------- featured diagrams ---------- */
.post-hero { margin: 4px 0 26px; }
.post-hero img,
.post-card-thumb img,
.guide-item-thumb img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.post-hero figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
}
.post-card-thumb { display: block; margin-bottom: 14px; }
.guide-item { padding: 0; overflow: hidden; }
.guide-item-thumb { display: block; }
.guide-item-thumb img { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.guide-item-title { margin: 14px 18px 6px; }
.guide-item-excerpt { margin: 0 18px 16px; }
.archive-intro { color: var(--muted); margin: 8px 0 0; max-width: 68ch; }

/* ---------- small screens ---------- */
/* Every tappable control clears 44px, nothing overflows the viewport, and
   inputs stay at 16px so iOS Safari does not zoom the page on focus. */
.pagination .page-numbers { min-height: 44px; display: inline-flex; align-items: center; padding: 0 15px; }
footer .links a { display: inline-block; padding: 6px 0; }
.explain summary { padding: 4px 0; }
.field input[type="number"], .field select { min-height: 46px; }
.prose img, .card img { max-width: 100%; height: auto; }
.prose { overflow-wrap: break-word; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .card { padding: 20px 18px; border-radius: 12px; }
  .hero { padding: 30px 0 6px; }
  .result { padding: 18px; }
  .breakdown { gap: 16px; }
  /* wide comparison tables scroll on their own instead of stretching the page */
  .prose table { display: block; overflow-x: auto; }
  .post-hero { margin-bottom: 20px; }
}
