/* =============================================
   BODY FAT CALCULATOR — DESIGN SYSTEM
   Aesthetic: Clean editorial with bold type,
   deep navy/charcoal + energetic amber accent
   ============================================= */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1f2733;
  --border: #2a3441;
  --text: #e8edf3;
  --text-muted: #8b9ab0;
  --accent: #f5a623;
  --accent-glow: rgba(245, 166, 35, 0.15);
  --accent-dark: #c8851a;
  --success: #3ddc84;
  --danger: #ff6b6b;
  --warning: #ffd166;
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ---- Container ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Navigation ---- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  color: var(--accent);
  font-size: 1.3rem;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 32px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

/* ---- Hero ---- */
.hero {
  position: relative;
  padding: 80px 0 60px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(245,166,35,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-text {
  max-width: 680px;
}

.hero-badge {
  display: inline-block;
  background: var(--accent-glow);
  border: 1px solid rgba(245,166,35,0.3);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 20px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 20px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 560px;
}

/* ---- Page Hero (inner pages) ---- */
.page-hero {
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--border);
}

.page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 12px 0 12px;
  line-height: 1.1;
}

.page-hero p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 560px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.post-meta-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- Calculator ---- */
.calculator-section {
  padding: 48px 0 64px;
}

.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

/* Tabs */
.tab-group {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  width: fit-content;
  margin-bottom: 24px;
}

.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: var(--accent);
  color: #000;
  font-weight: 600;
}

.tab:hover:not(.active) { color: var(--text); }

/* Unit toggle */
.unit-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
}

.unit-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
}

.unit-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* Gender */
.gender-group {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.gender-card {
  flex: 1;
  cursor: pointer;
  position: relative;
}

.gender-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gender-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s;
  background: var(--bg);
}

.gender-icon { font-size: 1.2rem; }

.gender-card input:checked + .gender-label {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* Fields */
.fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.field-group { display: flex; flex-direction: column; gap: 6px; }

.field-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.unit-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.field-group input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  -moz-appearance: textfield;
}

.field-group input:focus { border-color: var(--accent); }
.field-group input::placeholder { color: var(--text-muted); opacity: 0.5; }
.field-group input::-webkit-outer-spin-button,
.field-group input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Calc Button */
.calc-btn {
  width: 100%;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 28px;
}

.calc-btn:hover {
  background: #f0b840;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(245,166,35,0.3);
}

.calc-btn:active { transform: translateY(0); }

/* Result Panel */
.result-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: none;
}

.result-panel.visible { display: block; animation: fadeUp 0.4s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.result-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
}

.result-value {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.result-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.result-details {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.result-item { display: flex; flex-direction: column; gap: 2px; }

.ri-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ri-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

/* Fat Bar */
.fat-bar-wrap { margin-bottom: 16px; }

.fat-bar {
  position: relative;
  height: 10px;
  border-radius: 100px;
  background: linear-gradient(to right, #3ddc84 0%, #3ddc84 15%, #7bc67e 15%, #a8d8a8 28%, #ffd166 28%, #ffa756 50%, #ff9a5c 50%, #ff7043 75%, #ff5252 75%, #e53935 100%);
  margin-bottom: 8px;
  overflow: visible;
}

.fat-bar-fill { display: none; }

.fat-bar-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  background: #fff;
  border: 3px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: none;
}

.fat-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.result-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.calc-disclaimer {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  opacity: 0.7;
  margin-top: -8px;
}

/* ---- Info Section ---- */
.info-section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color 0.2s;
}

.info-card:hover { border-color: rgba(245,166,35,0.4); }

.info-icon {
  display: block;
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.info-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.info-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ---- Table Section ---- */
.table-section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.table-section h2,
.faq-section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

.table-wrap { overflow-x: auto; }

.bfp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.bfp-table th {
  text-align: left;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.bfp-table td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
}

.bfp-table tr:last-child td { border-bottom: none; }

.cat-essential td:first-child { color: #3ddc84; font-weight: 600; }
.cat-athletes td:first-child { color: #73c8a9; font-weight: 600; }
.cat-fitness td:first-child { color: #ffd166; font-weight: 600; }
.cat-average td:first-child { color: #ffa756; font-weight: 600; }
.cat-obese td:first-child { color: #ff5252; font-weight: 600; }

/* ---- FAQ Section ---- */
.faq-section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.faq-list { display: flex; flex-direction: column; gap: 8px; margin-top: 32px; }

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

.faq-item[open] { border-color: rgba(245,166,35,0.4); }

.faq-item summary {
  padding: 18px 24px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--accent);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item p {
  padding: 0 24px 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ---- Blog CTA ---- */
.blog-cta {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  flex-wrap: wrap;
}

.cta-inner h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.cta-inner p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.cta-btn {
  display: inline-block;
  background: var(--accent);
  color: #000;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 14px 28px;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: all 0.2s;
}

.cta-btn:hover {
  background: #f0b840;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(245,166,35,0.3);
}

/* ---- Blog Grid ---- */
.blog-index-section { padding: 56px 0; }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s, transform 0.2s;
}

.blog-card:hover {
  border-color: rgba(245,166,35,0.4);
  transform: translateY(-2px);
}

.blog-card-placeholder { opacity: 0.5; }
.blog-card-placeholder:hover { transform: none; }

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.blog-tag {
  background: var(--accent-glow);
  border: 1px solid rgba(245,166,35,0.3);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
}

.blog-card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.blog-card-title a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.blog-card-title a:hover { color: var(--accent); }

.blog-card-excerpt {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
}

.blog-read-more {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: gap 0.2s;
}

.blog-read-more:hover { text-decoration: underline; }

.blog-tool-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.blog-tool-cta p { color: var(--text-muted); font-size: 0.95rem; }

/* ---- Blog Post ---- */
.post-section { padding: 56px 0 80px; }

.post-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  align-items: start;
}

.post-content {
  max-width: 100%;
}

.post-content h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 40px 0 14px;
  color: var(--text);
}

.post-content h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 28px 0 10px;
  color: var(--text);
}

.post-content p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 16px;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.placeholder-text {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--text-muted) !important;
  font-style: italic;
  font-size: 0.88rem !important;
  line-height: 1.65 !important;
}

.post-tool-cta {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--accent-glow);
  border: 1px solid rgba(245,166,35,0.3);
  border-radius: var(--radius);
  padding: 20px;
  margin: 28px 0;
  font-size: 0.9rem;
}

.post-tool-cta span { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
.post-tool-cta strong { color: var(--text); }
.post-tool-cta a { color: var(--accent); font-weight: 600; }

.post-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem !important;
  color: var(--text-muted);
}

/* Sidebar */
.post-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 84px;
}

.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.sidebar-card h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}

.sidebar-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.sidebar-cta {
  display: inline-block;
  background: var(--accent);
  color: #000;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 18px;
  border-radius: 8px;
  transition: all 0.2s;
}

.sidebar-cta:hover { background: #f0b840; }

.sidebar-toc ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-toc ul a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.83rem;
  transition: color 0.2s;
}

.sidebar-toc ul a:hover { color: var(--accent); }

.related-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.related-list a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: opacity 0.2s;
}

.related-list a:hover { opacity: 0.75; }

/* ---- Footer ---- */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text);
}

.footer-nav {
  display: flex;
  gap: 24px;
}

.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}

.footer-nav a:hover { color: var(--accent); }

.footer-copy {
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .calc-card { padding: 24px; }
  .fields-grid { grid-template-columns: 1fr 1fr; }
  .result-inner { flex-direction: column; gap: 20px; }
  .result-details { width: 100%; justify-content: space-between; }
  .cta-inner { flex-direction: column; text-align: center; }
  .post-layout { grid-template-columns: 1fr; }
  .post-sidebar { display: none; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .info-grid { grid-template-columns: 1fr; }
  .gender-group { flex-direction: row; }
}

@media (max-width: 480px) {
  .fields-grid { grid-template-columns: 1fr; }
  .tab-group { width: 100%; }
  .tab { flex: 1; }
}
