html {
  scroll-behavior: smooth;
}

:root {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --clinical-primary: #0ea5e9;
  --clinical-dark: #0284c7;
  --clinical-light: #e0f2fe;
  --navy-dark: #0f172a;
  --emerald-accent: #10b981;
  --amber-accent: #f59e0b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

html.dark {
  --bg-primary: #020617;
  --bg-surface: #0f172a;
  --bg-subtle: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --border-color: #1e293b;
  --clinical-light: #082f49;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.2s, color 0.2s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header & Navbar */
.top-strip {
  background: var(--navy-dark);
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #1e293b;
}

.top-strip .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-badge {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--clinical-dark), var(--clinical-primary));
  color: white;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--clinical-primary);
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.nav-links a:hover {
  color: var(--clinical-primary);
}

.actions-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 0.75rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--clinical-primary);
  color: white;
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.25);
}

.btn-primary:hover {
  background: var(--clinical-dark);
}

/* Article Cards & Grid */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.article-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.card-img-wrapper {
  position: relative;
  width: 100%;
  height: 12rem;
  overflow: hidden;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.article-card:hover .card-img {
  transform: scale(1.05);
}

.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

.badge-clinical {
  background: var(--clinical-light);
  color: var(--clinical-dark);
}

.badge-emerald {
  background: #d1fae5;
  color: #065f46;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0.5rem 0;
  color: var(--text-primary);
}

.card-excerpt {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1rem;
}

.card-footer {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Featured Hero Layout */
.hero-featured {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.hero-featured .card-img-wrapper {
  height: 100%;
  min-height: 22rem;
}

.hero-featured .card-body {
  padding: 2rem;
}

.hero-featured .card-title {
  font-size: 1.85rem;
}

/* Footer */
footer {
  background: var(--navy-dark);
  color: #cbd5e1;
  padding-top: 4rem;
  padding-bottom: 2rem;
  margin-top: auto;
  border-top: 1px solid #1e293b;
}

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

.footer-title {
  color: white;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  font-size: 0.85rem;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

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

.disclaimer-banner {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 1rem;
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 2rem;
}

/* Modal Search */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
  padding: 0.5rem;
}

/* Article Prose */
.prose h2 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  margin: 2rem 0 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  scroll-margin-top: 6rem;
}

.prose h3 {
  font-size: 1.35rem;
  margin: 1.5rem 0 0.75rem;
  scroll-margin-top: 6rem;
}

.prose p {
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

.clinical-blockquote {
  border-left: 4px solid var(--clinical-primary);
  background: var(--bg-subtle);
  padding: 1rem 1.5rem;
  font-style: italic;
  border-radius: 0 0.5rem 0.5rem 0;
  margin: 1.5rem 0;
}

.clinical-alert-box {
  background: #fffbeb;
  border-left: 4px solid var(--amber-accent);
  padding: 1rem 1.5rem;
  border-radius: 0 0.5rem 0.5rem 0;
  margin: 1.5rem 0;
}

/* Ad Box */
.ad-slot-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: 0.75rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 1.5rem 0;
}

.sticky-footer-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--navy-dark);
  color: white;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
}

/* Admin Dashboard Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th, .admin-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.admin-table th {
  background: var(--bg-subtle);
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

@media (max-width: 900px) {
  .hero-featured {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .nav-links {
    display: none;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
