/* ============================================================
   main.css — A1C Calculator · v1
   Base: CSS variables · reset · layout · typography · colors
   Load on: ALL pages
   ============================================================ */

/* ── CSS VARIABLES ── */
:root {
  /* Backgrounds */
  --bg-0: #f8fafc;
  --bg-1: #ffffff;
  --bg-2: #f1f5f9;
  --bg-3: #e2e8f0;

  /* Text */
  --text-0: #0f172a;
  --text-1: #334155;
  --text-2: #64748b;
  --text-3: #94a3b8;

  /* Borders */
  --line:   rgba(15, 23, 42, .10);
  --line-s: rgba(15, 23, 42, .06);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow:    0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.05);
  --shadow-md: 0 4px 12px rgba(15,23,42,.10);
  --shadow-lg: 0 8px 24px rgba(15,23,42,.12);

  /* Accent — Sky Blue (primary) */
  --accent:      #0ea5e9;
  --accent-dark: #0284c7;
  --accent-dim:  rgba(14, 165, 233, .08);
  --accent-line: rgba(14, 165, 233, .25);

  /* Green (normal/good results) */
  --green:      #10b981;
  --green-dark: #059669;
  --green-dim:  rgba(16, 185, 129, .08);
  --green-line: rgba(16, 185, 129, .25);

  /* Yellow (prediabetes / warning) */
  --yellow:      #f59e0b;
  --yellow-dark: #d97706;
  --yellow-dim:  rgba(245, 158, 11, .08);
  --yellow-line: rgba(245, 158, 11, .25);

  /* Red (above target / high) */
  --red:      #ef4444;
  --red-dark: #dc2626;
  --red-dim:  rgba(239, 68, 68, .07);
  --red-line: rgba(239, 68, 68, .22);

  /* Purple (guides accent) */
  --purple:      #8b5cf6;
  --purple-dim:  rgba(139, 92, 246, .07);
  --purple-line: rgba(139, 92, 246, .22);

  /* Orange */
  --orange:      #f97316;
  --orange-dim:  rgba(249, 115, 22, .08);
  --orange-line: rgba(249, 115, 22, .25);

  /* Typography */
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Syne', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Spacing scale */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Border radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-full: 9999px;

  /* Transitions */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 300ms;

  /* Layout */
  --max-w:      1060px;
  --max-w-wide: 1200px;
  --max-w-text: 680px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-0);
  background: var(--bg-0);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ── LAYOUT CONTAINERS ── */
.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-6) var(--sp-16);
}

.wrap-wide {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

/* ── SITE HEADER ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.site-header .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-6);
  height: 56px;
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text-0);
  flex-shrink: 0;
}

.site-logo span {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-left: auto;
}

.site-nav a {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}

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

/* ── SITE FOOTER ── */
.site-footer {
  background: var(--bg-1);
  border-top: 1px solid var(--line);
  padding: var(--sp-10) var(--sp-6) var(--sp-8);
  margin-top: var(--sp-16);
}

.site-footer .inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.footer-disclaimer {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.6;
  padding: var(--sp-4) var(--sp-5);
  background: var(--red-dim);
  border: 1px solid var(--red-line);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-6);
}

.footer-disclaimer strong {
  color: var(--red);
  font-weight: 600;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  font-size: 13px;
  color: var(--text-3);
}

.footer-links {
  display: flex;
  gap: var(--sp-5);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-2);
  font-size: 13px;
  transition: color var(--dur-fast) var(--ease);
}

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

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-2);
  transition: color var(--dur-fast) var(--ease);
}

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

.breadcrumb-sep {
  font-size: 11px;
  color: var(--text-3);
}

.breadcrumb-current {
  color: var(--text-0);
  font-weight: 500;
}

/* ── PAGE HERO (tool + guide shared) ── */
.page-hero {
  padding: var(--sp-10) 0 var(--sp-8);
  border-bottom: 1px solid var(--line-s);
  margin-bottom: var(--sp-8);
}

.page-hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.025em;
  color: var(--text-0);
  margin-bottom: var(--sp-3);
}

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

.page-hero .subtitle {
  font-size: 15.5px;
  color: var(--text-2);
  max-width: var(--max-w-text);
  line-height: 1.6;
}

/* ── TYPOGRAPHY ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-0);
  letter-spacing: -.015em;
}

h2 { font-size: clamp(18px, 2.5vw, 22px); margin-bottom: var(--sp-4); margin-top: var(--sp-10); }
h3 { font-size: 17px; margin-bottom: var(--sp-3); margin-top: var(--sp-8); }
h4 { font-size: 15px; font-weight: 700; margin-bottom: var(--sp-2); }

p {
  color: var(--text-1);
  margin-bottom: var(--sp-4);
  line-height: 1.7;
}

p:last-child {
  margin-bottom: 0;
}

ul.content-list {
  list-style: disc;
  padding-left: var(--sp-6);
  color: var(--text-1);
  line-height: 1.75;
}

ul.content-list li {
  margin-bottom: var(--sp-2);
}

ol.content-list {
  list-style: decimal;
  padding-left: var(--sp-6);
  color: var(--text-1);
  line-height: 1.75;
}

ol.content-list li {
  margin-bottom: var(--sp-2);
}

.mono {
  font-family: var(--font-mono);
  font-size: .875em;
}

/* ── SECTION DIVIDER ── */
.section-divider {
  height: 1px;
  background: var(--line);
  margin: var(--sp-10) 0;
}

/* ── INFO BOXES ── */
.info-box {
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 13.5px;
  color: var(--text-1);
  line-height: 1.65;
  margin-bottom: var(--sp-5);
}

.info-box.info-blue {
  background: var(--accent-dim);
  border-color: var(--accent-line);
}

.info-box.info-green {
  background: var(--green-dim);
  border-color: var(--green-line);
}

.info-box.info-yellow {
  background: var(--yellow-dim);
  border-color: var(--yellow-line);
}

.info-box.info-red {
  background: var(--red-dim);
  border-color: var(--red-line);
}

.info-box strong {
  font-weight: 600;
  color: var(--text-0);
}

/* ── MEDICAL DISCLAIMER (inline) ── */
.medical-disclaimer {
  padding: var(--sp-4) var(--sp-5);
  background: var(--red-dim);
  border: 1px solid var(--red-line);
  border-radius: var(--r-md);
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin-top: var(--sp-10);
}

.medical-disclaimer strong {
  color: var(--red);
  font-weight: 600;
  display: block;
  margin-bottom: var(--sp-1);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── FAQ SECTION ── */
.faq-section {
  margin-top: var(--sp-10);
}

.faq-section h2 {
  margin-top: 0;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-3);
  overflow: hidden;
  background: var(--bg-1);
}

.faq-question {
  padding: var(--sp-4) var(--sp-5);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text-0);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  transition: background var(--dur-fast) var(--ease);
  user-select: none;
}

.faq-question:hover {
  background: var(--bg-2);
}

.faq-question::after {
  content: '+';
  font-size: 20px;
  font-weight: 300;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform var(--dur-base) var(--ease);
  line-height: 1;
}

.faq-item.open .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  display: none;
  padding: 0 var(--sp-5) var(--sp-4);
  font-size: 14px;
  color: var(--text-1);
  line-height: 1.7;
  border-top: 1px solid var(--line-s);
  padding-top: var(--sp-3);
}

.faq-item.open .faq-answer {
  display: block;
}

/* ── MOBILE RESPONSIVE ── */
@media (max-width: 640px) {
  .wrap {
    padding: 0 var(--sp-4) var(--sp-12);
  }

  .site-header .inner {
    padding: 0 var(--sp-4);
    height: 52px;
  }

  .site-nav a {
    font-size: 13px;
    padding: var(--sp-2) var(--sp-2);
  }

  .page-hero {
    padding: var(--sp-6) 0 var(--sp-5);
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-3);
  }
}

@media (max-width: 375px) {
  /* iPhone SE specific */
  body {
    font-size: 14.5px;
  }

  .site-nav {
    gap: 0;
  }
}
