/* ── AheadT1D Design System & Shared Styles ── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,600&family=Space+Grotesk:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Brand Master Palette */
  --bg-deep:        #28044d; /* Deep Midnight Plum base */
  --bg-surface:     #330861; /* Level 1 card */
  --bg-surface-2:   #400d77; /* Level 2 card / hover */
  --bg-surface-3:   #4e148c; /* Level 3 elevated / inputs */
  --bg-nav:         rgba(40, 4, 77, 0.92);
  
  /* Text & Ink */
  --ink:            #F7F3FF; /* Bright crisp text */
  --ink-dim:        #C8BEE8; /* Readable secondary text */
  --ink-muted:      #9B8BBF; /* Subtitle / metadata */
  --ink-faint:      #736296; /* Decorative / borders */

  /* Semantic Health Accents */
  --purple-brand:   #9D65FF; /* Vibrant energetic violet */
  --purple-light:   #C49BFF;
  --purple-glow:    rgba(157, 101, 255, 0.22);
  
  --green:          #2EE59D; /* In-Range / Safe */
  --green-glow:     rgba(46, 229, 157, 0.2);
  --green-bg:       rgba(46, 229, 157, 0.08);
  --green-border:   rgba(46, 229, 157, 0.28);
  
  --amber:          #FFB74D; /* Rising / Warning / Moderate Fall */
  --amber-glow:     rgba(255, 183, 77, 0.2);
  --amber-bg:       rgba(255, 183, 77, 0.08);
  --amber-border:   rgba(255, 183, 77, 0.28);

  --red:            #FF5252; /* Critical Low / Severe Alert */
  --red-glow:       rgba(255, 82, 82, 0.25);
  --red-bg:         rgba(255, 82, 82, 0.09);
  --red-border:     rgba(255, 82, 82, 0.35);

  --border:         #4B1F7E;
  --border-light:   #63329E;

  /* Typography */
  --font-display:   'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:      'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:      'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  background-color: var(--bg-deep);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

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

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

/* ── Global Layout Containers ── */
.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 28px;
}

.wrap-narrow {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ── Typography Utilities ── */
h1, h2, h3, h4, .display-font {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
}

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--purple-light);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow-green {
  color: var(--green);
}

.eyebrow-amber {
  color: var(--amber);
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Master Navigation ── */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

nav.main-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
  gap: 20px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.brand-logo .brand-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--purple-light);
  background: rgba(157, 101, 255, 0.16);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 2px;
}

/* Live Status Orb in Nav */
.status-orb {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  transition: background 0.4s ease;
}

.status-orb::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.45;
  animation: orbPing 2.4s cubic-bezier(0,0,0.2,1) infinite;
}

@keyframes orbPing {
  0% { transform: scale(0.6); opacity: 0.6; }
  75%, 100% { transform: scale(2.5); opacity: 0; }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-dim);
  transition: color 0.15s ease;
  position: relative;
}

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

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--purple-brand);
  border-radius: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-cta {
  font-size: 13.5px;
  font-weight: 600;
  background: var(--purple-brand);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 8px;
  transition: transform 0.15s ease, background 0.15s ease;
  border: 1px solid rgba(255,255,255,0.15);
}

.nav-cta:hover {
  background: #8b4cf7;
  transform: translateY(-1px);
}

/* Mobile Menu Toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
}

/* ── Shared Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--purple-brand);
  color: #ffffff;
  box-shadow: 0 4px 18px var(--purple-glow);
}

.btn-primary:hover {
  background: #8b4cf7;
  transform: translateY(-1.5px);
  box-shadow: 0 6px 24px rgba(157, 101, 255, 0.35);
}

.btn-secondary {
  background: var(--bg-surface-2);
  color: var(--ink);
  border-color: var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-surface-3);
  border-color: var(--purple-brand);
  transform: translateY(-1.5px);
}

.btn-outline {
  background: transparent;
  color: var(--ink-dim);
  border-color: var(--border);
}

.btn-outline:hover {
  color: var(--ink);
  border-color: var(--purple-light);
  transform: translateY(-1px);
}

.btn-green {
  background: var(--green);
  color: #0c1a14;
  font-weight: 700;
  box-shadow: 0 4px 16px var(--green-glow);
}

.btn-green:hover {
  background: #3affb0;
  transform: translateY(-1.5px);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 7px;
}

/* ── Section & Cards Layouts ── */
section.page-section {
  padding: 84px 0;
  position: relative;
}

.section-divider {
  border-bottom: 1px solid var(--border);
}

.section-head {
  margin-bottom: 48px;
}

.section-head h2 {
  font-size: clamp(26px, 3.5vw, 38px);
  line-height: 1.15;
  margin-bottom: 14px;
}

.section-head p.section-lead {
  font-size: 17px;
  color: var(--ink-dim);
  max-width: 62ch;
  line-height: 1.65;
}

/* Asymmetric Bento & Elevated Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  position: relative;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: var(--border-light);
}

.card-interactive:hover {
  transform: translateY(-2px);
  border-color: var(--purple-brand);
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.tag-green { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.tag-amber { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.tag-red   { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red-border); }
.tag-purple{ background: rgba(157, 101, 255, 0.12); color: var(--purple-light); border: 1px solid rgba(157, 101, 255, 0.25); }

@media (prefers-reduced-motion: reduce) {
  .status-orb::after {
    animation: none;
  }
}

/* ── Code / Math Callouts ── */
.code-box {
  background: #17042f;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  overflow-x: auto;
  line-height: 1.6;
}

/* ── Master Footer ── */
footer.site-footer {
  border-top: 1px solid var(--border);
  background: #1d033a;
  padding: 64px 0 32px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 48px;
}

.footer-brand h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.footer-brand p {
  font-size: 14px;
  color: var(--ink-dim);
  line-height: 1.6;
  max-width: 32ch;
  margin-bottom: 16px;
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--purple-light);
  margin-bottom: 16px;
}

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

.footer-col ul li {
  margin-bottom: 10px;
}

.footer-col ul li a {
  font-size: 14px;
  color: var(--ink-dim);
  transition: color 0.15s ease;
}

.footer-col ul li a:hover {
  color: var(--ink);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-muted);
}

.footer-disclaimer {
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.5;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border-left: 3px solid var(--purple-brand);
}

/* ── Reveal Animations ── */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ── Responsive Rules ── */
@media (max-width: 960px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .mobile-toggle {
    display: block;
  }
  nav.main-nav.menu-open .nav-links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 74px;
    left: 0;
    width: 100%;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
    padding: 24px;
    gap: 18px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}
