/* ===================================================================
   PeptiDex — thepeptidex.net
   Design tokens: scientific/research aesthetic
   =================================================================== */

:root {
  /* Palette — navy primary, teal accent, off-white surface */
  --ink: #0B2545;
  --ink-soft: #1B3A5B;
  --ink-muted: #5A6B80;
  --paper: #F7F9FB;
  --paper-elevated: #FFFFFF;
  --rule: #E2E8EF;
  --accent: #13C2C2;
  --accent-strong: #0EA5A5;
  --accent-soft: #D4F5F5;
  --warning: #C2410C;
  --success: #15803D;

  /* Type */
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Menlo", monospace;

  /* Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Radius + shadow */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(11, 37, 69, 0.04);
  --shadow: 0 4px 12px rgba(11, 37, 69, 0.06);
  --shadow-lg: 0 12px 32px rgba(11, 37, 69, 0.08);

  /* Layout */
  --page-max: 1160px;
  --read-max: 720px;
}

[data-theme="dark"] {
  --ink: #E8EEF5;
  --ink-soft: #C9D4E2;
  --ink-muted: #8295AD;
  --paper: #0A1628;
  --paper-elevated: #12203A;
  --rule: #243857;
  --accent: #2EE6E6;
  --accent-strong: #13C2C2;
  --accent-soft: #0E3838;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
input, textarea, select { font: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }

p { max-width: var(--read-max); }

/* Layout */
.container { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--space-6); }
.prose { max-width: var(--read-max); }
.prose > * + * { margin-top: var(--space-4); }
.prose h2 { margin-top: var(--space-12); }
.prose h3 { margin-top: var(--space-8); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper-elevated);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: saturate(1.1);
}
.site-header .row {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; }
.brand-text { font-family: var(--font-serif); font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.01em; }
.brand-text em { font-style: normal; color: var(--accent-strong); }

nav.primary { display: flex; gap: var(--space-6); align-items: center; }
nav.primary a { color: var(--ink-soft); font-size: var(--text-sm); font-weight: 500; }
nav.primary a:hover { color: var(--accent-strong); text-decoration: none; }
nav.primary .btn { padding: 8px 14px; border-radius: var(--radius); background: var(--accent); color: #fff; }
nav.primary .btn:hover { background: var(--accent-strong); }

.theme-toggle { width: 36px; height: 36px; border-radius: var(--radius); display: grid; place-items: center; color: var(--ink-soft); }
.theme-toggle:hover { background: var(--paper); color: var(--accent-strong); }

/* Mobile nav */
.nav-toggle { display: none; }
@media (max-width: 820px) {
  nav.primary a:not(.btn) { display: none; }
  .nav-toggle { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius); }
  .nav-toggle:hover { background: var(--paper); }
  nav.primary.open a { display: inline-block; }
  nav.primary.open {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: var(--paper-elevated); border-bottom: 1px solid var(--rule);
    padding: var(--space-4); gap: var(--space-2);
  }
}

/* Hero */
.hero {
  padding: var(--space-24) 0 var(--space-16);
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--paper-elevated) 0%, var(--paper) 100%);
}
.hero .eyebrow {
  display: inline-block; font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent-strong);
  margin-bottom: var(--space-4);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, var(--text-5xl));
  max-width: 780px; margin-bottom: var(--space-6);
}
.hero .lede { font-size: var(--text-lg); color: var(--ink-soft); max-width: var(--read-max); }
.hero-actions { display: flex; gap: var(--space-4); margin-top: var(--space-8); flex-wrap: wrap; }

/* Buttons */
.btn, .btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 12px 22px; border-radius: var(--radius);
  font-weight: 600; font-size: var(--text-sm);
  transition: transform 0.1s ease, background 0.15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); text-decoration: none; }
.btn-secondary { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn-secondary:hover { border-color: var(--accent-strong); color: var(--accent-strong); text-decoration: none; }
.btn-primary:active, .btn-secondary:active { transform: translateY(1px); }

/* Search bar */
.search-wrap { position: relative; margin: var(--space-12) 0 var(--space-8); }
.search-wrap input {
  width: 100%; padding: 14px 18px 14px 46px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-elevated); color: var(--ink); font-size: var(--text-base);
}
.search-wrap input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-wrap .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-muted); }

/* Category filter pills */
.filters { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-8); }
.filters button {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--paper-elevated); color: var(--ink-soft);
  font-size: var(--text-sm); font-weight: 500;
}
.filters button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.filters button:hover:not(.active) { border-color: var(--accent-strong); color: var(--accent-strong); }

/* Peptide cards grid */
.peptide-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
}
.peptide-card {
  background: var(--paper-elevated); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.peptide-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-lg);
  border-color: var(--accent); text-decoration: none;
}
.peptide-card .cat {
  display: inline-block; font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--accent-strong); margin-bottom: var(--space-3);
}
.peptide-card h3 { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.peptide-card p { font-size: var(--text-sm); color: var(--ink-muted); }

/* Section spacing */
section { padding: var(--space-20) 0; }
.section-head { margin-bottom: var(--space-12); }
.section-head h2 { margin-bottom: var(--space-3); }
.section-head p { color: var(--ink-muted); font-size: var(--text-lg); }

/* External research supplier card (affiliate) */
.supplier-card {
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--paper-elevated) 100%);
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  padding: var(--space-8); margin: var(--space-12) 0;
  display: grid; gap: var(--space-4);
}
.supplier-card .eyebrow { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-strong); }
.supplier-card h3 { font-family: var(--font-serif); font-size: var(--text-2xl); }
.supplier-card p { color: var(--ink-soft); }

/* Email capture */
.email-capture {
  background: var(--paper-elevated); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  padding: var(--space-8); margin: var(--space-12) 0;
}
.email-capture h3 { font-size: var(--text-2xl); margin-bottom: var(--space-2); }
.email-capture p { color: var(--ink-muted); margin-bottom: var(--space-6); }
.email-capture form { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.email-capture input[type="email"] {
  flex: 1 1 280px; padding: 12px 16px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
.email-capture input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Peptide detail page */
.peptide-detail { padding: var(--space-16) 0; }
.peptide-detail .breadcrumbs {
  font-size: var(--text-sm); color: var(--ink-muted); margin-bottom: var(--space-6);
}
.peptide-detail h1 { font-size: clamp(2rem, 4vw, var(--text-4xl)); margin-bottom: var(--space-4); }
.peptide-detail .summary { font-size: var(--text-lg); color: var(--ink-soft); max-width: var(--read-max); margin-bottom: var(--space-12); }
.peptide-detail .section { margin-top: var(--space-10); }
.peptide-detail .section h2 { font-size: var(--text-2xl); margin-bottom: var(--space-4); }

/* Disclaimer banner */
.disclaimer-banner {
  background: var(--paper-elevated); border-left: 3px solid var(--warning);
  padding: var(--space-4) var(--space-6); margin: var(--space-6) 0;
  font-size: var(--text-sm); color: var(--ink-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Footer */
footer.site-footer {
  background: var(--paper-elevated);
  border-top: 1px solid var(--rule);
  padding: var(--space-16) 0 var(--space-8);
  margin-top: var(--space-24);
}
footer .footer-grid {
  display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: var(--space-12);
  margin-bottom: var(--space-12);
}
@media (max-width: 720px) {
  footer .footer-grid { grid-template-columns: 1fr 1fr; }
}
footer h4 { font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink);
  margin-bottom: var(--space-4); }
footer ul { list-style: none; padding: 0; }
footer li { margin-bottom: var(--space-2); }
footer a { color: var(--ink-muted); font-size: var(--text-sm); }
footer a:hover { color: var(--accent-strong); }
footer .colophon {
  border-top: 1px solid var(--rule); padding-top: var(--space-6);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-3);
  font-size: var(--text-xs); color: var(--ink-muted);
}

/* Utility */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.visually-hidden { position: absolute; left: -10000px; }
.hidden { display: none !important; }
.text-muted { color: var(--ink-muted); }
.text-center { text-align: center; }
.badge { display: inline-block; padding: 2px 8px; font-size: var(--text-xs); font-weight: 600; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); }

/* 404 */
.error-page { padding: var(--space-24) 0; text-align: center; }
.error-page .big { font-family: var(--font-serif); font-size: clamp(4rem, 12vw, 8rem); color: var(--accent); line-height: 1; }
.error-page h1 { margin-top: var(--space-4); }
.error-page p { margin: var(--space-4) auto var(--space-8); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto; }
}

/* Focus ring */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm);
}

/* ----- Blog & guides ----- */
.hero-sub {
  padding: 4rem 0 2rem;
  background: linear-gradient(180deg, var(--bg-alt, #F7F9FB) 0%, var(--bg, #fff) 100%);
}
.hero-sub .eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--accent, #13C2C2);
  margin-bottom: 0.75rem;
}
.hero-sub h1 {
  font-family: 'Source Serif 4', serif;
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  color: var(--ink, #0B2545);
}
.hero-sub .lede {
  font-size: 1.125rem;
  line-height: 1.6;
  max-width: 60ch;
  color: var(--ink-muted, #3a4a5c);
}
.container.narrow { max-width: 760px; }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}
.blog-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.75rem;
  border: 1px solid var(--border, rgba(11,37,69,0.1));
  border-radius: 12px;
  background: var(--bg, #fff);
  text-decoration: none;
  color: inherit;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.blog-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(11,37,69,0.08);
  border-color: var(--accent, #13C2C2);
}
.blog-card .badge {
  align-self: flex-start;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(19, 194, 194, 0.1);
  color: var(--accent, #13C2C2);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.blog-card h3 {
  font-family: 'Source Serif 4', serif;
  font-size: 1.35rem;
  line-height: 1.25;
  margin: 0.5rem 0 0.25rem;
  color: var(--ink, #0B2545);
}
.blog-card p {
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
  color: var(--ink-muted, #3a4a5c);
}
.blog-card .meta {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* Article prose */
.article { padding: 2.5rem 0 4rem; }
.article .breadcrumbs { margin-bottom: 1rem; font-size: 0.85rem; opacity: 0.7; }
.article .badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(19, 194, 194, 0.12);
  color: var(--accent, #13C2C2);
  font-weight: 600;
}
.article .prose { font-size: 1.05rem; line-height: 1.75; color: var(--ink, #0B2545); }
.article .prose h1 {
  font-family: 'Source Serif 4', serif;
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  line-height: 1.15;
  margin: 1rem 0 1.5rem;
}
.article .prose h2 {
  font-family: 'Source Serif 4', serif;
  font-size: 1.6rem;
  margin: 2.5rem 0 1rem;
  color: var(--ink, #0B2545);
}
.article .prose h3 {
  font-family: 'Source Serif 4', serif;
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
}
.article .prose p { margin: 0 0 1.25rem; }
.article .prose ul, .article .prose ol { padding-left: 1.25rem; margin: 0 0 1.25rem; }
.article .prose li { margin: 0.4rem 0; }
.article .prose blockquote {
  border-left: 3px solid var(--accent, #13C2C2);
  background: rgba(19,194,194,0.06);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
  font-style: normal;
  color: var(--ink, #0B2545);
}
.article .prose a {
  color: var(--accent, #13C2C2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.article .prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.article .prose th, .article .prose td {
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--border, rgba(11,37,69,0.1));
}
.article .prose th { font-weight: 600; background: var(--bg-alt, #F7F9FB); }
.article .prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: rgba(11,37,69,0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* Starter guide landing */
.guide-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
  align-items: start;
}
@media (max-width: 768px) { .guide-layout { grid-template-columns: 1fr; } }
.cover-card {
  aspect-ratio: 3 / 4;
  background: linear-gradient(160deg, #0B2545 0%, #1a3a66 100%);
  color: #F7F9FB;
  border-radius: 12px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 40px rgba(11,37,69,0.2);
  position: relative;
  overflow: hidden;
}
.cover-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: #13C2C2;
}
.cover-eyebrow { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: #13C2C2; font-weight: 600; }
.cover-title { font-family: 'Source Serif 4', serif; font-size: 1.75rem; line-height: 1.2; margin-top: auto; }
.cover-sub { font-size: 0.85rem; opacity: 0.8; margin-top: 0.5rem; }

.check-list { list-style: none; padding: 0; margin: 1rem 0 1.5rem; }
.check-list li {
  padding: 0.5rem 0 0.5rem 1.75rem;
  position: relative;
  line-height: 1.5;
}
.check-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent, #13C2C2);
  font-weight: 700;
}

.form-card {
  margin-top: 1.5rem;
  padding: 1.75rem;
  background: var(--bg-alt, #F7F9FB);
  border: 1px solid var(--border, rgba(11,37,69,0.1));
  border-radius: 12px;
}
.form-card h3 { margin: 0 0 0.5rem; font-family: 'Source Serif 4', serif; font-size: 1.3rem; }
.capture-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.capture-form input[type="email"] {
  flex: 1;
  min-width: 220px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border, rgba(11,37,69,0.15));
  border-radius: 8px;
  font: inherit;
}
.capture-form .btn-primary { padding: 0.75rem 1.25rem; }
.fine-print { font-size: 0.85rem; opacity: 0.7; margin-top: 0.75rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* Dark mode overrides */
[data-theme="dark"] .hero-sub { background: linear-gradient(180deg, #0d1b2a 0%, #0a1523 100%); }
[data-theme="dark"] .blog-card { background: #0f1f33; border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .form-card { background: #0f1f33; border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .capture-form input[type="email"] { background: #0a1523; color: #F7F9FB; border-color: rgba(255,255,255,0.15); }
[data-theme="dark"] .article .prose th { background: #0f1f33; }
[data-theme="dark"] .article .prose code { background: rgba(255,255,255,0.08); }

/* ----- Peptide detail + disclaimer banner ----- */
.peptide-detail { padding: 2rem 0 4rem; }
.peptide-detail .breadcrumbs { margin-bottom: 0.75rem; font-size: 0.85rem; opacity: 0.7; }
.peptide-detail > .container > .badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(19,194,194,0.12);
  color: var(--accent, #13C2C2);
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
}
.peptide-detail h1 {
  font-family: 'Source Serif 4', serif;
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  line-height: 1.15;
  margin: 0.5rem 0 0.75rem;
  color: var(--ink, #0B2545);
}
.peptide-detail .summary {
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 65ch;
  color: var(--ink-muted, #3a4a5c);
  margin: 0 0 1.25rem;
}
.peptide-detail .section.prose { margin-top: 1.5rem; padding: 0; max-width: 70ch; }
.peptide-detail .section.prose h2 {
  font-family: 'Source Serif 4', serif;
  font-size: 1.4rem;
  margin: 2rem 0 0.75rem;
  color: var(--ink, #0B2545);
}
.peptide-detail .section.prose p { line-height: 1.7; margin: 0 0 1rem; }

.disclaimer-banner {
  margin: 1rem 0 0;
  padding: 1rem 1.25rem;
  background: rgba(19,194,194,0.06);
  border-left: 3px solid var(--accent, #13C2C2);
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink, #0B2545);
}
.disclaimer-banner strong { color: var(--ink, #0B2545); }

[data-theme="dark"] .disclaimer-banner { background: rgba(19,194,194,0.08); color: #F7F9FB; }
[data-theme="dark"] .disclaimer-banner strong { color: #F7F9FB; }
