/* ============================================================
   BicepCalc — shared stylesheet
   Replaces the Tailwind Play CDN (dev-only) with a single
   production-safe, self-hosted stylesheet used by every page.
   ============================================================ */

:root {
  --blue-900: #0c4a6e;
  --blue-800: #1e40af;
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-100: #dbeafe;
  --blue-50:  #eff6ff;
  --green-600: #16a34a;
  --green-100: #dcfce7;
  --purple-600: #9333ea;
  --purple-100: #f3e8ff;
  --orange-600: #ea580c;
  --red-600: #dc2626;
  --red-400: #f87171;
  --yellow-600: #ca8a04;
  --yellow-500: #eab308;
  --gray-900: #111827;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50:  #f9fafb;
  --white: #ffffff;

  --maxw: 72rem;       /* matches Tailwind max-w-6xl */
  --maxw-narrow: 56rem;/* matches max-w-4xl */
  --radius: 0.5rem;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
.container--narrow { max-width: var(--maxw-narrow); }

a { color: var(--blue-600); }
a:hover { text-decoration: underline; }

/* ---------- Sticky top: header + nav share ONE sticky block ----------
   (Fixes the mobile overlap bug from two independent sticky bars with a
   hard-coded offset. Now there's no offset to get wrong.) */
.site-top { position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-md); }

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, var(--blue-800) 0%, var(--blue-900) 100%);
  color: var(--white);
}
.site-header .container { padding-top: 0.6rem; padding-bottom: 0.6rem; }
.site-header a.brand-link { text-decoration: none; color: var(--white); display: inline-block; }
.site-title { font-size: 1.25rem; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
.site-tagline { color: var(--blue-100); font-size: 0.75rem; margin: 0.1rem 0 0; }
@media (min-width: 768px) {
  .site-header .container { padding-top: 1rem; padding-bottom: 1rem; }
  .site-title { font-size: 1.75rem; }
  .site-tagline { font-size: 0.875rem; }
}

/* ---------- Nav: single row, swipeable on mobile (no wrapping) ---------- */
.site-nav-wrap { background: var(--white); border-bottom: 2px solid var(--gray-200); }
.site-nav {
  display: flex;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;              /* Firefox */
  -webkit-overflow-scrolling: touch;  /* momentum scroll on iOS */
}
.site-nav::-webkit-scrollbar { display: none; }  /* Chrome / Safari */
.site-nav a {
  padding: 0.85rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--gray-600);            /* darker = better contrast than before */
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  border-bottom: 3px solid transparent;
  flex: 0 0 auto;                    /* don't shrink; let them scroll */
}
.site-nav a:hover { color: var(--blue-800); text-decoration: none; }
.site-nav a.active {
  color: var(--blue-800);
  border-bottom-color: var(--blue-800);
  background: var(--blue-50);
}

/* ---------- Ad slots ---------- */
.ad-strip {
  background: var(--gray-100);
  border-top: 1px solid var(--gray-300);
  border-bottom: 1px solid var(--gray-300);
  padding: 0.75rem 0;
}
.ad-strip--my { margin: 2rem 0; }
.ad-slot {
  background: var(--white);
  border-radius: 0.25rem;
  padding: 0.75rem;
  text-align: center;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-slot .ad-label { color: var(--gray-400); font-size: 0.8rem; margin: 0; }

/* ---------- Typography helpers ---------- */
.page-hero { background: linear-gradient(to bottom, var(--blue-50), transparent); padding: 2.5rem 0; }
.h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 1rem; }
@media (min-width: 768px) { .h1 { font-size: 3rem; } .page-hero { padding: 3rem 0; } }
.h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.01em; color: var(--gray-900); margin: 0 0 0.5rem; }
@media (min-width: 768px) { .h2 { font-size: 1.875rem; } }
.h3 { font-size: 1.2rem; font-weight: 700; color: var(--gray-900); margin: 0 0 0.5rem; }
.lead { font-size: 1.125rem; color: var(--gray-700); max-width: 48rem; }
.muted { color: var(--gray-600); }
.center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-2 { margin-top: 0.5rem; } .mt-4 { margin-top: 1rem; } .mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; } .mb-8 { margin-bottom: 2rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }

/* ---------- Cards / grid ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
}
@media (min-width: 768px) { .card { padding: 2rem; } }

.grid-2 { display: grid; gap: 1.5rem; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.tool-grid { display: grid; gap: 1.5rem; }
@media (min-width: 768px) { .tool-grid { grid-template-columns: 1fr 1fr; } }

.tool-card {
  display: block;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.tool-card h3 { font-size: 1.5rem; font-weight: 700; margin: 0 0 0.5rem; }
.tool-card p { color: var(--gray-600); margin: 0 0 1rem; }
.tool-card .cta { color: var(--blue-600); font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 1rem; text-align: center;
}
.stat .num { font-size: 1.875rem; font-weight: 700; color: var(--blue-600); margin: 0; }
.stat .label { color: var(--gray-600); font-size: 0.875rem; margin: 0.25rem 0 0; }

/* ---------- Info callout ---------- */
.callout {
  background: var(--blue-50);
  border-left: 4px solid var(--blue-600);
  padding: 0.75rem;
  font-size: 0.875rem;
  color: var(--gray-700);
  margin-bottom: 1.5rem;
  border-radius: 0 0.25rem 0.25rem 0;
}

/* ---------- Forms ---------- */
.field { margin-bottom: 1rem; }
.field label { display: block; color: var(--gray-700); font-weight: 600; margin-bottom: 0.5rem; }
.field .hint { color: var(--gray-500); font-size: 0.75rem; margin: 0.25rem 0 0; }
input[type="number"], input[type="text"], select {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  accent-color: var(--blue-800);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.4);
}
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--blue-800) 0%, var(--blue-900) 100%);
  color: var(--white);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { opacity: 0.9; transform: scale(1.02); }

.error-msg {
  color: var(--red-600);
  font-size: 0.875rem;
  margin-top: 0.75rem;
  min-height: 1.2em;
}

/* ---------- Results ---------- */
.hidden { display: none !important; }
.result-box {
  background: linear-gradient(135deg, var(--blue-100) 0%, #e0e7ff 100%);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.result-row {
  background: var(--white);
  border-radius: 0.25rem;
  padding: 0.75rem;
  border-left: 4px solid var(--blue-600);
  margin-bottom: 0.75rem;
}
.result-row:last-child { margin-bottom: 0; }
.result-row .label { color: var(--gray-600); font-size: 0.875rem; font-weight: 600; margin: 0; }
.result-row .sub { color: var(--gray-600); font-size: 0.75rem; margin: 0.25rem 0; }
.result-row .value { font-size: 1.5rem; font-weight: 700; color: var(--blue-600); margin: 0; }
.result-row .value.big { font-size: 1.875rem; }
.badge { font-size: 0.75rem; background: var(--blue-100); padding: 0.1rem 0.5rem; border-radius: 0.25rem; }

.result-row--green { border-left-color: var(--green-600); } .result-row--green .value { color: var(--green-600); } .result-row--green .badge { background: var(--green-100); }
.result-row--purple { border-left-color: var(--purple-600); } .result-row--purple .value { color: var(--purple-600); } .result-row--purple .badge { background: var(--purple-100); }
.result-row--orange { border-left-color: var(--orange-600); } .result-row--orange .value { color: var(--orange-600); }
.result-row--red { border-left-color: var(--red-600); } .result-row--red .value { color: var(--red-600); }
.result-row--red-soft { border-left-color: var(--red-400); } .result-row--red-soft .value { color: var(--red-600); }
.result-row--yellow { border-left-color: var(--yellow-500); } .result-row--yellow .value { color: var(--yellow-600); }
.result-row--highlight { background: var(--blue-100); border-left-color: var(--blue-600); }

.text-blue { color: var(--blue-600); } .text-green { color: var(--green-600); }
.text-yellow { color: var(--yellow-600); } .text-red { color: var(--red-600); }

/* ---------- Content / SEO prose ---------- */
.prose { color: var(--gray-700); }
.prose h2 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin: 2rem 0 0.75rem; }
.prose h3 { font-size: 1.15rem; font-weight: 700; color: var(--gray-900); margin: 1.5rem 0 0.5rem; }
.prose p { margin: 0 0 1rem; }
.prose ul { margin: 0 0 1rem; padding-left: 1.25rem; }
.prose li { margin-bottom: 0.4rem; }

.faq-item { border-bottom: 1px solid var(--gray-200); padding-bottom: 1.5rem; margin-bottom: 1.5rem; }
.faq-item:last-child { border-bottom: none; margin-bottom: 0; }

/* ---------- Related links ---------- */
.related { display: grid; gap: 1rem; }
@media (min-width: 640px) { .related { grid-template-columns: 1fr 1fr; } }
.related a {
  display: block; padding: 1rem; border: 1px solid var(--gray-200);
  border-radius: var(--radius); text-decoration: none; color: inherit; background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.related a:hover { border-color: var(--blue-600); box-shadow: var(--shadow-sm); text-decoration: none; }
.related strong { color: var(--blue-800); }

/* ---------- Footer ---------- */
.site-footer { background: var(--gray-900); color: var(--gray-400); padding: 2rem 0; margin-top: 3rem; }
.site-footer p { margin: 0 0 1rem; }
.site-footer .disclaimer { font-size: 0.875rem; }
.site-footer .copyright { font-size: 0.75rem; color: var(--gray-500); }
.site-footer a { color: var(--gray-400); }
.site-footer a:hover { color: var(--gray-300); }

/* ---------- Legal pages ---------- */
.legal-header {
  background: linear-gradient(135deg, var(--blue-800) 0%, var(--blue-900) 100%);
  color: var(--white); padding: 2rem 0;
}
.legal-header h1 { font-size: 1.875rem; font-weight: 700; margin: 0.5rem 0 0; }
.legal-header .updated { color: var(--blue-100); font-size: 0.875rem; margin-top: 0.5rem; }
.legal-header a { color: var(--blue-100); }
.legal-body h2 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin: 1.5rem 0 1rem; }
.legal-body h3 { font-size: 1.15rem; font-weight: 600; color: var(--gray-900); margin: 1rem 0 0.5rem; }
.legal-body p, .legal-body li { color: var(--gray-700); }
.legal-body ul { margin-bottom: 1.5rem; padding-left: 1.25rem; }
.legal-body li { margin-bottom: 0.5rem; }

/* ---------- Consent banner (mobile-first) ---------- */
#consent-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  transform: translateY(110%);
  transition: transform 0.3s ease;
}
#consent-banner.show { transform: translateY(0); }
.consent-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;   /* stacked on mobile */
  gap: 0.75rem;
}
.consent-text { margin: 0; font-size: 0.875rem; color: var(--gray-700); line-height: 1.45; }
.consent-actions { display: flex; gap: 0.5rem; }
.consent-btn {
  flex: 1 1 0;              /* full-width split on mobile */
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  min-height: 44px;        /* comfortable tap target */
}
.consent-reject { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-300); }
.consent-reject:hover { background: var(--gray-200); }
.consent-accept { background: linear-gradient(135deg, var(--blue-800), var(--blue-900)); color: #fff; }
.consent-accept:hover { opacity: 0.92; }
@media (min-width: 700px) {
  .consent-inner { flex-direction: row; align-items: center; }
  .consent-text { flex: 1; }
  .consent-actions { flex: 0 0 auto; }
  .consent-btn { flex: 0 0 auto; min-width: 130px; }
}
