/* ==========================================================================
   Pedia SGH – Medical Knowledge Hub
   Modern Medical Technology Design System
   ========================================================================== */

:root {
  /* Brand Palette */
  --navy-950: #08162b;
  --navy-900: #0f2544;
  --navy-800: #163661;
  --navy-700: #1e467a;
  --navy-100: #e6eef8;
  --navy-50: #f2f6fb;

  --teal-700: #0f766e;
  --teal-600: #0d9488;
  --teal-500: #14b8a6;
  --teal-100: #ccfbf1;
  --teal-50: #f0fdfa;

  /* Neutrals */
  --white: #ffffff;
  --bg-page: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-muted: #f1f5f9;
  --border-light: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Semantic */
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --pro-purple: #6d28d9;
  --pro-purple-bg: #f5f3ff;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Radii & Shadows */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(15, 37, 68, 0.05);
  --shadow-sm: 0 2px 8px rgba(15, 37, 68, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 37, 68, 0.08);
  --shadow-lg: 0 18px 40px rgba(15, 37, 68, 0.12);

  /* Layout */
  --container-max: 1200px;
  --header-height: 74px;
  --transition: 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

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

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

a:hover {
  color: var(--navy-900);
}

:focus-visible {
  outline: 3px solid var(--teal-500);
  outline-offset: 2px;
}

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

.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 1000;
  background: var(--navy-900);
  color: var(--white);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
  color: var(--white);
}

/* Container & Sections */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

.section {
  padding: 72px 0;
}

.section-sm {
  padding: 48px 0;
}

.section-subtle {
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.section-navy {
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-800) 100%);
  color: var(--white);
}

.section-header {
  max-width: 720px;
  margin: 0 auto 44px;
  text-align: center;
}

.section-header.text-left {
  margin-left: 0;
  text-align: left;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--teal-50);
  color: var(--teal-700);
  border: 1px solid rgba(13, 148, 136, 0.22);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.section-navy .eyebrow {
  background: rgba(20, 184, 166, 0.16);
  color: #5eead4;
  border-color: rgba(94, 234, 212, 0.3);
}

h1, h2, h3, h4 {
  margin: 0 0 12px;
  color: var(--navy-900);
  line-height: 1.22;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.section-navy h1,
.section-navy h2,
.section-navy h3 {
  color: var(--white);
}

h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; font-weight: 700; }
h4 { font-size: 1.0625rem; font-weight: 700; }

p {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

.lead {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.section-navy .lead,
.section-navy p {
  color: #cbd5e1;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--navy-900);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  box-shadow: var(--shadow-xs);
}

.brand-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--teal-700);
  background: var(--teal-50);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(13, 148, 136, 0.2);
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--navy-900);
  background: var(--navy-50);
}

.nav-link.active {
  color: var(--teal-700);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-toggle {
  display: none;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  color: var(--navy-900);
}

/* Mobile Drawer */
.nav-mobile {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--white);
  z-index: 890;
  padding: 24px 20px;
  overflow-y: auto;
  border-top: 1px solid var(--border-light);
}

.nav-mobile.open {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-mobile .nav-link {
  padding: 12px 14px;
  font-size: 1rem;
  border: 1px solid transparent;
}

.nav-mobile .nav-link.active {
  background: var(--teal-50);
  border-color: rgba(13, 148, 136, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-sm {
  padding: 9px 16px;
  font-size: 0.875rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 100%);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  color: var(--white);
  box-shadow: var(--shadow-md);
}

.btn-teal {
  background: linear-gradient(135deg, var(--teal-600) 0%, var(--teal-700) 100%);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-teal:hover {
  color: var(--white);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--white);
  color: var(--navy-900);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--navy-50);
  border-color: var(--navy-700);
}

.btn-ghost-light {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-ghost-light:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
}

/* Hero */
.hero {
  padding: 64px 0 72px;
  background:
    radial-gradient(circle at 85% 15%, rgba(13, 148, 136, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 10% 80%, rgba(15, 37, 68, 0.05) 0%, transparent 40%),
    var(--white);
  border-bottom: 1px solid var(--border-light);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  align-items: center;
  gap: 48px;
}

.hero-title {
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
  max-width: 580px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.hero-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--navy-800);
}

.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
}

.hero-card-frame {
  background: linear-gradient(160deg, var(--navy-50) 0%, var(--teal-50) 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  max-width: 440px;
  width: 100%;
}

/* Page Hero (Subpages) */
.page-hero {
  padding: 44px 0 40px;
  background: linear-gradient(180deg, var(--navy-50) 0%, var(--white) 100%);
  border-bottom: 1px solid var(--border-light);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.breadcrumbs a {
  color: var(--text-secondary);
  font-weight: 600;
}

.breadcrumbs a:hover {
  color: var(--teal-700);
}

.breadcrumbs span[aria-current="page"] {
  color: var(--navy-900);
  font-weight: 700;
}

/* Cards & Grids */
.grid {
  display: grid;
  gap: 24px;
}

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

.card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card-interactive:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(13, 148, 136, 0.35);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--teal-50);
  color: var(--teal-700);
  margin-bottom: 16px;
  border: 1px solid rgba(13, 148, 136, 0.18);
}

.card-icon.navy {
  background: var(--navy-50);
  color: var(--navy-800);
  border-color: rgba(15, 37, 68, 0.14);
}

.card-icon.pro {
  background: var(--pro-purple-bg);
  color: var(--pro-purple);
  border-color: rgba(109, 40, 217, 0.2);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-free {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-pro {
  background: var(--pro-purple-bg);
  color: var(--pro-purple);
  border: 1px solid #ddd6fe;
}

.badge-teal {
  background: var(--teal-50);
  color: var(--teal-700);
  border: 1px solid #99f6e4;
}

/* Feature Tabs */
.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}

.tab-btn {
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--white);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover {
  border-color: var(--teal-500);
  color: var(--navy-900);
}

.tab-btn.active {
  background: var(--navy-900);
  color: var(--white);
  border-color: var(--navy-900);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Lists */
.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.check-list li {
  position: relative;
  padding-left: 26px;
  color: var(--text-secondary);
}

.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--teal-600);
  font-weight: 800;
}

/* References Strip & Cards */
.ref-pill-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.ref-pill {
  padding: 10px 18px;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy-800);
  box-shadow: var(--shadow-xs);
}

/* FAQ Accordion */
.faq-list {
  display: grid;
  gap: 12px;
  max-width: 860px;
  margin: 0 auto;
}

.faq-item {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-trigger {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 18px 22px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--navy-900);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: inherit;
}

.faq-trigger:hover {
  background: var(--bg-subtle);
}

.faq-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--navy-50);
  color: var(--navy-900);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: transform var(--transition);
}

.faq-item[data-open="true"] .faq-icon {
  transform: rotate(45deg);
  background: var(--teal-600);
  color: var(--white);
}

.faq-panel {
  display: none;
  padding: 0 22px 18px;
  color: var(--text-secondary);
}

.faq-item[data-open="true"] .faq-panel {
  display: block;
}

/* Callout / Clinical Notice */
.callout {
  padding: 18px 22px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--teal-600);
  background: var(--teal-50);
  margin: 20px 0;
}

.callout.warning {
  border-left-color: var(--warning);
  background: #fffbeb;
}

.callout h4 {
  margin-bottom: 6px;
  color: var(--navy-900);
}

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

/* Download Banner */
.download-box {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 36px;
  align-items: center;
  padding: 40px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-800) 65%, #0f4c5c 100%);
  color: var(--white);
  box-shadow: var(--shadow-lg);
}

.download-box h2,
.download-box h3 {
  color: var(--white);
}

.download-box p {
  color: #cbd5e1;
}

.store-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--navy-900);
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform var(--transition), box-shadow var(--transition);
}

.store-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: var(--navy-900);
}

.store-btn small {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.store-btn.outline {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.store-btn.outline small {
  color: #94a3b8;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--white);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

th, td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

th {
  background: var(--navy-50);
  color: var(--navy-900);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: none;
}

/* Forms & Search Inputs */
.input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.14);
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy-900);
  margin-bottom: 6px;
}

/* Article Layout */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  align-items: start;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 14px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.sidebar-card {
  position: sticky;
  top: 96px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 22px;
}

/* Footer */
.site-footer {
  background: var(--navy-950);
  color: #cbd5e1;
  padding: 60px 0 28px;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 36px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand {
  color: var(--white);
  font-weight: 800;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.footer-brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.site-footer h4 {
  color: var(--white);
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 9px;
  font-size: 0.9rem;
}

.footer-links a {
  color: #94a3b8;
}

.footer-links a:hover {
  color: #5eead4;
}

.footer-bottom {
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  color: #94a3b8;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  background: var(--navy-900);
  color: var(--white);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  display: none;
}

.toast.show {
  display: block;
}

/* Responsive */
@media (max-width: 980px) {
  .hero-grid,
  .download-box,
  .article-layout {
    grid-template-columns: 1fr;
  }

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

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

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

  .nav-desktop,
  .header-actions .btn {
    display: none;
  }

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

@media (max-width: 640px) {
  .section {
    padding: 52px 0;
  }

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

  .download-box {
    padding: 26px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
