/* ============================================================
   Simplified Weight Loss - styles.css
   Domain: simplifiedweightloss.com | Est. 2001
   ============================================================ */

/* ---------- CSS Custom Properties (Light Theme Default) ---------- */
:root {
  --bg-primary: #fafaf9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f5f1;
  --bg-hero: linear-gradient(135deg, #1b4332 0%, #2d6a4f 50%, #40916c 100%);
  --bg-hero-inner: linear-gradient(135deg, #2d6a4f 0%, #40916c 100%);
  --text-primary: #1a1a2e;
  --text-secondary: #3d3d56;
  --text-muted: #6b7280;
  --text-on-dark: #f0fdf4;
  --accent: #2d6a4f;
  --accent-hover: #1b4332;
  --accent-light: #d8f3dc;
  --accent-subtle: #e8f5e9;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  --transition: 0.25s ease;
  --max-width: 1200px;
  --content-width: 780px;
  --nav-height: 68px;

  /* Glucose visualizer */
  --glucose-normal: #52b788;
  --glucose-spike: #e63946;
  --glucose-zone: #d8f3dc;
  --glucose-zone-spike: #fde8e8;
}

/* ---------- Dark Theme ---------- */
[data-theme="dark"] {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2530;
  --bg-hero: linear-gradient(135deg, #0d1117 0%, #1b4332 50%, #2d6a4f 100%);
  --bg-hero-inner: linear-gradient(135deg, #1b4332 0%, #2d6a4f 100%);
  --text-primary: #e6edf3;
  --text-secondary: #b1bac4;
  --text-muted: #8b949e;
  --text-on-dark: #e6edf3;
  --accent: #52b788;
  --accent-hover: #74c69d;
  --accent-light: #1a3328;
  --accent-subtle: #132a1f;
  --border: #30363d;
  --border-light: #21262d;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.3);
  --glucose-zone: #1a3328;
  --glucose-zone-spike: #3a1a1a;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-height) + 20px);
}

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

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

::selection {
  background: var(--accent-light);
  color: var(--accent);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 0.5em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); margin-bottom: 0.5em; }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); margin-bottom: 0.4em; }
h4 { font-size: 1.15rem; margin-bottom: 0.4em; }

p {
  margin-bottom: 1.25em;
  color: var(--text-secondary);
}

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

strong {
  color: var(--text-primary);
  font-weight: 600;
}

ul, ol {
  margin-bottom: 1.25em;
  padding-left: 1.5em;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.4em;
}

li::marker {
  color: var(--accent);
}

blockquote {
  border-left: 4px solid var(--accent);
  padding: 1em 1.5em;
  margin: 1.5em 0;
  background: var(--bg-tertiary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-secondary);
}

hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2.5em 0;
}

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

.content-narrow {
  max-width: var(--content-width);
  margin: 0 auto;
}

.section {
  padding: 5rem 0;
}

.section-alt {
  background-color: var(--bg-tertiary);
}

.grid {
  display: grid;
  gap: 2rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.text-center { text-align: center; }
.text-accent { color: var(--accent); }

/* ---------- Header & Navigation ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  transition: background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.nav-logo svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  display: block;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
}

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

/* Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown > a {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-dropdown > a::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  transition: transform var(--transition);
}

.nav-dropdown:hover > a::after {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  list-style: none;
  z-index: 100;
}

.nav-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: 10px 14px;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
}

.dropdown-menu a:hover {
  background: var(--accent-light);
}

/* Nav right side (theme toggle) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }

[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ---------- Hero Sections ---------- */
.hero {
  background: var(--bg-hero);
  color: var(--text-on-dark);
  padding: 8rem 0 6rem;
  margin-top: var(--nav-height);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero h1 {
  color: #ffffff;
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  margin-bottom: 0.4em;
  letter-spacing: -0.03em;
}

.hero .subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  color: rgba(255,255,255,0.85);
  margin-bottom: 2rem;
  line-height: 1.6;
  max-width: 600px;
}

.hero .badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.9);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

/* Inner page hero (smaller) */
.hero-inner {
  background: var(--bg-hero-inner);
  color: var(--text-on-dark);
  padding: 6rem 0 3.5rem;
  margin-top: var(--nav-height);
}

.hero-inner h1 {
  color: #ffffff;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 0.4em;
}

.hero-inner .subtitle {
  color: rgba(255,255,255,0.8);
  font-size: 1.1rem;
  max-width: 600px;
}

.hero-inner .chapter-label {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  padding: 4px 14px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- Breadcrumbs ---------- */
.breadcrumb {
  padding: 1rem 0;
  font-size: 0.85rem;
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em;
  padding: 0;
  margin: 0;
}

.breadcrumb li + li::before {
  content: '/';
  color: var(--text-muted);
  margin-right: 0.3em;
}

.breadcrumb a {
  color: var(--text-muted);
}

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

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  font-family: inherit;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: #ffffff;
  border-color: rgba(255,255,255,0.4);
}

.btn-outline:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.7);
  color: #ffffff;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--accent);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card-icon {
  width: 52px;
  height: 52px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.2rem;
  font-size: 1.5rem;
}

.card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.6em;
}

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

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.card-link:hover {
  gap: 10px;
}

/* ---------- Feature / Step Cards ---------- */
.step-card {
  position: relative;
  padding-left: 70px;
  min-height: 60px;
}

.step-number {
  position: absolute;
  left: 0;
  top: 0;
  width: 52px;
  height: 52px;
  background: var(--accent);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
}

/* ---------- Callout Boxes ---------- */
.callout {
  padding: 1.5rem 1.75rem;
  border-radius: var(--radius-md);
  margin: 2rem 0;
  border-left: 4px solid;
}

.callout-tip {
  background: var(--accent-subtle);
  border-color: var(--accent);
}

.callout-tip .callout-title {
  color: var(--accent);
}

.callout-warning {
  background: #fff8e1;
  border-color: #f9a825;
}

[data-theme="dark"] .callout-warning {
  background: #2a2310;
}

.callout-warning .callout-title {
  color: #f9a825;
}

.callout-info {
  background: #e3f2fd;
  border-color: #1976d2;
}

[data-theme="dark"] .callout-info {
  background: #0d1f3c;
}

.callout-info .callout-title {
  color: #1976d2;
}

.callout-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.callout p {
  font-size: 0.95rem;
  margin-bottom: 0.5em;
}

/* Key Takeaway */
.key-takeaway {
  background: var(--accent-light);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 2.5rem 0;
  position: relative;
}

.key-takeaway::before {
  content: 'Key Takeaway';
  position: absolute;
  top: -14px;
  left: 20px;
  background: var(--accent);
  color: #ffffff;
  padding: 4px 16px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.key-takeaway p {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* ---------- Chapter Article Content ---------- */
.article-content {
  padding: 4rem 0;
}

.article-content h2 {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.article-content h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.article-content h3 {
  margin-top: 1.8rem;
}

/* Table of Contents (in-page) */
.toc {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 3rem;
}

.toc-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.toc ol {
  list-style: decimal;
  padding-left: 1.2em;
  margin: 0;
}

.toc li {
  margin-bottom: 0.35em;
}

.toc a {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

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

/* ---------- Chapter Navigation (Prev/Next) ---------- */
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

.chapter-nav a {
  display: block;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  text-decoration: none;
}

.chapter-nav a:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.chapter-nav .label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.chapter-nav .title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chapter-nav .prev { text-align: left; }
.chapter-nav .next { text-align: right; grid-column: 2; }

/* ---------- Meal Cards ---------- */
.meal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.meal-card:hover {
  box-shadow: var(--shadow-md);
}

.meal-card-header {
  background: var(--accent-light);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.meal-card-header h3 {
  font-size: 1.05rem;
  color: var(--accent);
  margin: 0;
}

.meal-card-body {
  padding: 1.5rem;
}

.meal-step {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.meal-step:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.meal-step-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.6rem;
  letter-spacing: 0.02em;
}

.meal-step-badge.fiber { background: #4caf50; }
.meal-step-badge.protein { background: #ff7043; }
.meal-step-badge.carbs { background: #ffc107; color: #333; }

.meal-step p {
  margin: 0;
  font-size: 0.95rem;
}

/* ---------- Glucose Visualizer ---------- */
.glucose-viz {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 2rem 0;
  overflow: hidden;
}

.glucose-viz svg {
  width: 100%;
  height: auto;
}

.glucose-legend {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.standard { background: var(--glucose-spike); }
.legend-dot.sequenced { background: var(--glucose-normal); }

/* ---------- FAQ Accordion ---------- */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: border-color var(--transition);
}

.faq-item:hover {
  border-color: var(--accent);
}

.faq-question {
  width: 100%;
  background: var(--bg-secondary);
  border: none;
  padding: 1.25rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  text-align: left;
  font-family: inherit;
  line-height: 1.4;
  transition: background var(--transition);
}

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

.faq-question::after {
  content: '+';
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.faq-item.active .faq-question::after {
  content: '-';
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.faq-answer-inner {
  padding: 0 1.5rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.faq-item.active .faq-answer {
  max-height: 600px;
}

/* ---------- Stats / Numbers ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat-card {
  text-align: center;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-weight: 500;
}

/* ---------- Comparison Table ---------- */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
}

.comparison-table th {
  background: var(--accent);
  color: #ffffff;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
}

.comparison-table th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

.comparison-table th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

.comparison-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.comparison-table tr:nth-child(even) td {
  background: var(--bg-tertiary);
}

.comparison-table tr:last-child td:first-child {
  border-radius: 0 0 0 var(--radius-sm);
}

.comparison-table tr:last-child td:last-child {
  border-radius: 0 0 var(--radius-sm) 0;
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-light);
}

.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -33px;
  top: 4px;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  border: 3px solid var(--bg-primary);
}

.timeline-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

/* ---------- Legacy Banner ---------- */
.legacy-banner {
  background: linear-gradient(135deg, var(--accent) 0%, #1b4332 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  margin: 2rem 0;
  position: relative;
  overflow: hidden;
}

.legacy-banner::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.legacy-banner h3 {
  color: #ffffff;
  margin-bottom: 0.5em;
}

.legacy-banner p {
  color: rgba(255,255,255,0.85);
  font-size: 1.05rem;
}

.legacy-year {
  font-size: 3rem;
  font-weight: 800;
  color: rgba(255,255,255,0.2);
  position: absolute;
  right: 2rem;
  bottom: 1rem;
}

/* ---------- Interactive Element Placeholders ---------- */
.interactive-box {
  background: var(--bg-tertiary);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  margin: 2rem 0;
}

.interactive-box h4 {
  margin-bottom: 0.5em;
}

.interactive-box p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 4rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  max-width: 300px;
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: 0.5em;
}

.footer-col a {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

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

.footer-disclaimer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-bottom: 0;
}

.footer-disclaimer p {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-legal-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.footer-legal-links a {
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: color var(--transition);
}

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

/* ---------- Scroll-to-top ---------- */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  box-shadow: var(--shadow-md);
  z-index: 900;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

/* ---------- Utility Classes ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }

/* ---------- Mobile Responsive ---------- */
@media (max-width: 992px) {
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem;
    gap: 0;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.35s ease;
    border-top: 1px solid var(--border);
    z-index: 999;
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .nav-links a {
    font-size: 1rem;
    padding: 12px 16px;
  }

  .menu-toggle {
    display: flex;
  }

  .nav-dropdown .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    padding: 0 0 0 1rem;
    min-width: auto;
    display: none;
  }

  .nav-dropdown.open .dropdown-menu {
    display: block;
  }

  .nav-dropdown > a::after {
    margin-left: auto;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .hero {
    padding: 6rem 0 4rem;
  }

  .hero-inner {
    padding: 5rem 0 2.5rem;
  }

  .section {
    padding: 3.5rem 0;
  }

  .chapter-nav {
    grid-template-columns: 1fr;
  }

  .chapter-nav .next {
    grid-column: 1;
    text-align: left;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .container {
    padding: 0 16px;
  }

  .card {
    padding: 1.5rem;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .hero {
    padding: 5rem 0 3rem;
  }

  .glucose-viz {
    padding: 1rem;
  }

  .legacy-banner {
    padding: 2rem 1.5rem;
  }

  .legacy-year {
    font-size: 2rem;
    right: 1rem;
  }

  .comparison-table {
    font-size: 0.85rem;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Glucose curve animation */
@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

.glucose-line {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}

.glucose-line.animate {
  animation: drawLine 2s ease forwards;
}

/* ---------- Print Styles ---------- */
@media print {
  .site-header, .site-footer, .theme-toggle, .scroll-top, .chapter-nav, .menu-toggle {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  .hero, .hero-inner {
    background: #f5f5f5 !important;
    color: #000 !important;
    padding: 2rem 0 !important;
    margin-top: 0 !important;
  }

  .hero h1, .hero-inner h1 {
    color: #000 !important;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}
