/* ============================================================
   MilFitCalc — Military Utilitarian Design System
   Barlow Condensed display + Barlow body
   Color: slate/charcoal + branch accent per page
   ============================================================ */

:root {
  --c-bg:        #0f1014;
  --c-surface:   #191c22;
  --c-surface2:  #21252e;
  --c-border:    #2d3240;
  --c-border2:   #3a4055;
  --c-text:      #e8eaf0;
  --c-muted:     #8b90a0;
  --c-dim:       #555c6e;

  /* Branch accent — override per page */
  --c-accent:    #4a90d9;
  --c-accent-bg: rgba(74,144,217,0.12);
  --c-accent-glow: rgba(74,144,217,0.25);

  --c-success:   #4caf72;
  --c-warning:   #e8a020;
  --c-danger:    #d9534f;
  --c-info:      #4a90d9;

  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body:    'Barlow', 'Arial', sans-serif;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;

  --max-w: 1100px;
  --sidebar-w: 300px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }

/* ---- Layout ---- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- Site Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,16,20,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-border);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 54px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-mark { color: var(--c-accent); font-size: 18px; }
.logo-text {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--c-text);
  text-transform: uppercase;
}
.logo-accent { color: var(--c-accent); }
.branch-nav {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
}
.branch-link {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  text-decoration: none;
  transition: color .15s, background .15s;
}
.branch-link:hover { color: var(--c-text); background: var(--c-surface); text-decoration: none; }
.branch-link.active { color: var(--c-accent); background: var(--c-accent-bg); }
.support-btn {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-muted);
  padding: 6px 12px;
  border: 1px solid var(--c-border2);
  border-radius: var(--radius-md);
  text-decoration: none;
  white-space: nowrap;
  transition: all .15s;
}
.support-btn:hover { color: var(--c-text); border-color: var(--c-accent); text-decoration: none; }

/* ---- Branch Hero ---- */
.branch-hero {
  border-bottom: 1px solid var(--c-border);
  padding: 36px 0 28px;
  position: relative;
  overflow: hidden;
}
.branch-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 100% at 50% 0%, var(--c-accent-glow), transparent 70%);
  pointer-events: none;
}
.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.branch-badge {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 3px;
}
.usaf-badge { background: #1a3a5c; color: #4a90d9; }
.updated-badge {
  font-size: 11px;
  color: var(--c-muted);
  background: var(--c-surface);
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid var(--c-border);
}
.hero-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 6px;
}
.hero-sub {
  font-size: 13px;
  color: var(--c-muted);
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}
.hero-stats {
  display: flex;
  align-items: center;
  gap: 0;
}
.hstat {
  display: flex;
  flex-direction: column;
  padding: 0 20px 0 0;
}
.hstat:first-child { padding-left: 0; }
.hstat-n {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--c-accent);
  line-height: 1;
}
.hstat-l {
  font-size: 11px;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}
.hstat-div {
  width: 1px;
  height: 32px;
  background: var(--c-border);
  margin: 0 20px 0 0;
}

/* ---- Ad Slots ---- */
.ad-slot { padding: 12px 0; }
.ad-slot--top { border-bottom: 1px solid var(--c-border); }
.ad-placeholder {
  background: var(--c-surface);
  border: 1px dashed var(--c-border2);
  color: var(--c-dim);
  font-size: 12px;
  text-align: center;
  padding: 14px;
  border-radius: var(--radius-md);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.ad-placeholder--small { min-height: 100px; margin: 0; }
.ad-slot--sidebar { margin-top: 16px; }

/* ---- Calculator Layout ---- */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: 24px;
  padding-top: 24px;
  padding-bottom: 40px;
  align-items: start;
}

/* ---- Calc Cards ---- */
.calc-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.calc-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c-accent-bg);
  border: 1px solid var(--c-accent);
  color: var(--c-accent);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex: 1;
}
.pts-chip {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--c-accent);
  background: var(--c-accent-bg);
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.card-note {
  font-size: 12px;
  color: var(--c-muted);
  margin-bottom: 12px;
  padding-left: 2px;
}

/* ---- Form Fields ---- */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--c-muted);
}
.field-input {
  width: 100%;
  background: var(--c-surface2);
  border: 1px solid var(--c-border2);
  border-radius: var(--radius-md);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.field-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-glow);
}
.field-input::placeholder { color: var(--c-dim); }
.field-note {
  font-size: 12px;
  color: var(--c-warning);
  background: rgba(232,160,32,0.1);
  border-left: 3px solid var(--c-warning);
  padding: 6px 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 4px;
}

/* WHtR display */
.whtr-display {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
}
.whtr-display.low  { border-color: var(--c-success); color: var(--c-success); background: rgba(76,175,114,0.1); }
.whtr-display.mod  { border-color: var(--c-warning); color: var(--c-warning); background: rgba(232,160,32,0.1); }
.whtr-display.high { border-color: var(--c-danger);  color: var(--c-danger);  background: rgba(217,83,79,0.1); }

/* Risk guide */
.risk-guide {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.risk-item {
  flex: 1;
  min-width: 80px;
  font-size: 11px;
  text-align: center;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  line-height: 1.4;
}
.risk-item span { display: block; font-weight: 700; font-size: 12px; margin-bottom: 2px; }
.risk-low  { background: rgba(76,175,114,0.15); color: var(--c-success); border: 1px solid rgba(76,175,114,0.3); }
.risk-mod  { background: rgba(232,160,32,0.15);  color: var(--c-warning); border: 1px solid rgba(232,160,32,0.3); }
.risk-high { background: rgba(217,83,79,0.15);   color: var(--c-danger);  border: 1px solid rgba(217,83,79,0.3); }

/* Option buttons */
.option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.opt-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--c-surface2);
  border: 1px solid var(--c-border2);
  border-radius: var(--radius-md);
  color: var(--c-muted);
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
  width: 100%;
}
.opt-btn:hover { border-color: var(--c-border2); color: var(--c-text); }
.opt-btn.active {
  border-color: var(--c-accent);
  background: var(--c-accent-bg);
  color: var(--c-text);
}
.opt-title {
  font-size: 14px;
  font-weight: 500;
}
.opt-sub {
  font-size: 11px;
  color: var(--c-dim);
  text-align: right;
}
.opt-btn.active .opt-sub { color: var(--c-muted); }

/* Min hint */
.min-hint {
  font-size: 12px;
  color: var(--c-muted);
  margin-top: 6px;
  padding-left: 2px;
  min-height: 18px;
  transition: color .2s;
}
.min-hint.warn { color: var(--c-danger); }

/* hidden */
.hidden { display: none !important; }

/* ---- Result Panel ---- */
.calc-result-col { position: relative; }
.result-panel {
  position: sticky;
  top: 70px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.result-panel-header {
  padding: 20px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface2);
}
.result-branch-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: 8px;
}
.result-score-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}
.result-total {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  color: var(--c-text);
  transition: color .3s;
}
.result-total.excellent    { color: var(--c-success); }
.result-total.satisfactory { color: var(--c-warning); }
.result-total.unsatisfactory { color: var(--c-danger); }
.result-denom {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--c-dim);
}
.status-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 3px;
}
.status-badge.excellent    { background: rgba(76,175,114,0.2);   color: var(--c-success); border: 1px solid var(--c-success); }
.status-badge.satisfactory { background: rgba(232,160,32,0.2);   color: var(--c-warning); border: 1px solid var(--c-warning); }
.status-badge.unsatisfactory { background: rgba(217,83,79,0.2);  color: var(--c-danger);  border: 1px solid var(--c-danger); }

/* Result breakdown */
.result-breakdown { padding: 16px 20px; }
.result-row {
  margin-bottom: 12px;
}
.rr-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rr-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rr-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rr-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--c-surface2);
  border-radius: 3px;
  overflow: hidden;
}
.rr-bar {
  height: 100%;
  border-radius: 3px;
  transition: width .4s cubic-bezier(.4,0,.2,1);
}
.rr-pts {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
  min-width: 52px;
  text-align: right;
}
.rr-pts span {
  font-size: 12px;
  color: var(--c-dim);
  font-weight: 400;
}
.rr-pts.fail { color: var(--c-danger); }

/* Warnings */
#r-warnings { padding: 0 20px; }
.warn-item {
  font-size: 12px;
  color: var(--c-danger);
  background: rgba(217,83,79,0.1);
  border-left: 3px solid var(--c-danger);
  padding: 8px 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 8px;
}

/* Pass thresholds */
.pass-thresholds {
  padding: 12px 20px;
  border-top: 1px solid var(--c-border);
}
.thresh-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--c-muted);
  padding: 3px 0;
}
.thresh-val { font-weight: 600; color: var(--c-text); }

/* Ko-fi button */
.kofi-btn {
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-muted);
  padding: 12px 20px;
  border-top: 1px solid var(--c-border);
  text-decoration: none;
  transition: color .15s, background .15s;
}
.kofi-btn:hover { color: var(--c-text); background: var(--c-surface2); text-decoration: none; }

/* ---- Info Section ---- */
.info-section {
  padding: 40px 20px;
  border-top: 1px solid var(--c-border);
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.info-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.info-card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: var(--c-accent);
}
.info-card p { font-size: 13px; color: var(--c-muted); line-height: 1.65; }
.info-list {
  list-style: none;
  margin-top: 10px;
}
.info-list li {
  font-size: 13px;
  color: var(--c-muted);
  padding: 4px 0 4px 14px;
  position: relative;
  border-bottom: 1px solid var(--c-border);
}
.info-list li:last-child { border-bottom: none; }
.info-list li::before { content: '›'; position: absolute; left: 0; color: var(--c-accent); }

/* ---- Sources ---- */
.sources-section {
  padding: 24px 20px 40px;
}
.sources-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-dim);
  margin-bottom: 10px;
}
.sources-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sources-list li { font-size: 12px; color: var(--c-dim); }
.sources-list a { color: var(--c-muted); }
.sources-list a:hover { color: var(--c-accent); }
.sources-disclaimer {
  margin-top: 12px;
  font-size: 11px;
  color: var(--c-dim);
  font-style: italic;
}

/* ---- Site Footer ---- */
.site-footer {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding: 20px 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.footer-brand {
  font-size: 13px;
  color: var(--c-muted);
  font-weight: 500;
  flex: 1;
  min-width: 160px;
}
.footer-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-nav a { font-size: 12px; color: var(--c-dim); }
.footer-nav a:hover { color: var(--c-muted); }
.footer-note {
  font-size: 11px;
  color: var(--c-dim);
  width: 100%;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }
  .calc-result-col { order: -1; }
  .result-panel { position: static; }
  .branch-nav { display: none; }
  .hero-title { font-size: 30px; }
  .hero-stats { flex-wrap: wrap; gap: 12px; }
  .hstat-div { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
