/*
Theme Name: MedIntelHub Modern
Theme URI: https://medintelhub.com/
Author: MedIntelHub
Author URI: https://medintelhub.com/
Description: A fast, modern, builder-free theme for MedIntelHub. No jQuery, no frameworks, one small stylesheet and one tiny deferred script. Built for Core Web Vitals: minimal render-blocking, reserved image space, system fonts, and lazy-loaded media.
Version: 1.0.24
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: medintelhub
Tags: blog, news, accessibility-ready, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ============================================================
   1. Tokens & reset
   ============================================================ */
:root {
  --navy: #0a2540;
  --heading: var(--navy);
  --navy-2: #103258;
  --navy-3: #0d1f33;
  --teal: #0d9488;
  --teal-dark: #0b6e66;
  --teal-darker: #0a5c54;
  --teal-bright: #14b8a6;
  --teal-soft: #e5f6f3;
  --teal-softer: #f2faf8;
  --ink: #16283a;
  --muted: #54677c;
  --faint: #5a6a7d;
  --line: #e2e8ef;
  --line-soft: #edf1f5;
  --bg: #fff;
  --bg-soft: #f4f7f9;
  --amber: #b45309;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(10, 37, 64, .06), 0 8px 24px -12px rgba(10, 37, 64, .18);
  --shadow-lg: 0 2px 4px rgba(10, 37, 64, .07), 0 18px 44px -18px rgba(10, 37, 64, .28);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container: 1200px;
  --header-h: 68px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  overflow-x: clip;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--teal-dark); text-decoration: none; }
a:hover { color: var(--teal-darker); text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; color: var(--heading); margin: 0 0 .6em; font-weight: 800; }
h1 { font-size: clamp(2rem, 4.6vw, 2.9rem); }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
p { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.4em; }
li { margin-bottom: .35em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--teal-bright); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--teal-soft); color: var(--heading); }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 24px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 200;
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-weight: 700; transition: top .15s ease;
}
.skip-link:focus { top: 12px; color: #fff; text-decoration: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: .98rem; line-height: 1.2; text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--teal-dark); color: #fff; }
.btn-primary:hover { background: var(--teal-darker); color: #fff; }
.btn-ghost { border-color: rgba(255, 255, 255, .45); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.btn-outline { border-color: var(--line); color: var(--heading); background: var(--bg); }
.btn-outline:hover { border-color: var(--teal); color: var(--teal-dark); }

/* Eyebrow + section headers */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--teal-dark);
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--teal-bright); border-radius: 2px; }
.section { padding: 64px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 6px 0 0; color: var(--muted); max-width: 560px; }
.section-head .btn { flex-shrink: 0; }

/* ============================================================
   2. Header
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--line);
  height: var(--header-h);
}
.site-header .container { display: flex; align-items: center; gap: 28px; height: var(--header-h); }
.site-brand { display: flex; align-items: center; gap: 6px; flex-shrink: 0; text-decoration: none; position: relative; }
.site-brand:hover { text-decoration: none; }
.site-brand .logo-mark {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: var(--navy); color: var(--teal-bright);
  display: grid; place-items: center;
}
.site-brand .logo-mark svg { width: 22px; height: 22px; }
.site-brand .logo-text { font-family: var(--font); font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; color: var(--heading); line-height: 1; }
.site-brand .logo-text span { color: var(--teal); }
/* Brand with a custom logo image: one complete logo image (icon + wordmark + pulse), shown at 42px height. */
.site-brand .custom-logo { height: 42px; width: auto; flex-shrink: 0; }
.main-nav { margin-left: auto; }
.main-nav ul { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.main-nav a {
  display: block; padding: 9px 13px; border-radius: 8px;
  color: var(--ink); font-weight: 600; font-size: .98rem; text-decoration: none;
}
.main-nav a:hover { background: var(--bg-soft); color: var(--teal-dark); text-decoration: none; }
.main-nav .current-menu-item > a,
.main-nav .current-category-ancestor > a { color: var(--teal-dark); background: var(--teal-soft); }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.main-nav + .header-actions { margin-left: 0; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--heading);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--teal); color: var(--teal-dark); }
.icon-btn svg { width: 20px; height: 20px; }
.menu-toggle { display: none; }

/* Search overlay */
.search-overlay {
  position: fixed; inset: 0; z-index: 300; display: none;
  background: rgba(10, 31, 51, .72);
  padding: 18vh 24px 24px;
}
.search-overlay.open { display: block; }
.search-overlay__box { max-width: 640px; margin: 0 auto; background: var(--bg); border-radius: 18px; padding: 28px; box-shadow: var(--shadow-lg); }
.search-overlay__box h2 { margin-bottom: 4px; }
.search-overlay__box p { color: var(--muted); margin-bottom: 18px; }
.search-form { display: flex; gap: 10px; }
.search-form label { flex: 1; }
.search-form input[type="search"] {
  width: 100%; padding: 14px 18px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 1.05rem; background: var(--bg-soft);
}
.search-form input[type="search"]:focus { outline: none; border-color: var(--teal); background: var(--bg); }
.search-form button[type="submit"] {
  padding: 14px 22px; border: 0; border-radius: 12px;
  background: var(--navy); color: #fff; font-weight: 700;
}
.search-form button[type="submit"]:hover { background: var(--navy-2); }
.search-overlay__close { position: absolute; top: 20px; right: 20px; background: var(--bg); }

/* Reading progress */
.reading-progress {
  position: fixed; top: 0; left: 0; z-index: 150; height: 3px; width: 100%;
  background: transparent;
}
.reading-progress span { display: block; height: 100%; background: var(--teal-bright); transform: scaleX(0); transform-origin: 0 50%; }

/* ============================================================
   3. Hero (front page)
   ============================================================ */
.hero {
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(20, 184, 166, .28), transparent 60%),
    radial-gradient(700px 380px at -10% 110%, rgba(20, 184, 166, .14), transparent 60%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-3) 100%);
  color: #fff; padding: 76px 0 72px;
}
.hero h1 { color: #fff; max-width: 640px; margin: .35em 0 .5em; }
.hero .lead { color: #c6d4e2; font-size: 1.18rem; max-width: 600px; margin-bottom: 28px; }
.hero .hero-search { max-width: 620px; }
.hero .hero-search .search-form input[type="search"] {
  background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); color: #fff;
  padding: 16px 20px; border-radius: 14px;
}
.hero .hero-search .search-form input[type="search"]::placeholder { color: #9db2c6; }
.hero .hero-search .search-form input[type="search"]:focus { background: rgba(255, 255, 255, .14); border-color: var(--teal-bright); }
.hero .hero-search .search-form button[type="submit"] { background: var(--teal-dark); border-radius: 14px; }
.hero .hero-search .search-form button[type="submit"]:hover { background: var(--teal-darker); }
.hero-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero-chips a {
  padding: 8px 16px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  color: #d7e5ef; border: 1px solid rgba(255, 255, 255, .25); text-decoration: none;
}
.hero-chips a:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 32px; margin-top: 44px; padding-top: 28px; border-top: 1px solid rgba(255, 255, 255, .14); }
.hero-stats div { line-height: 1.3; }
.hero-stats strong { display: block; font-size: 1.6rem; color: #fff; letter-spacing: -.02em; }
.hero-stats span { font-size: .88rem; color: #9db2c6; }

/* Hero two-column layout: copy left, spotlight visual right. */
.hero__grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero__visual { position: relative; min-width: 0; }
.hero__pulse { display: block; width: 100%; height: 56px; margin-bottom: 20px; }
.hero__pulse .hero__pulse--base { opacity: .35; }
.hero__pulse .hero__pulse--sweep { stroke-dasharray: 150 490; stroke-dashoffset: 640; animation: hero-pulse-sweep 2.8s linear infinite; }
@keyframes hero-pulse-sweep { from { stroke-dashoffset: 640; } to { stroke-dashoffset: 0; } }
.hero-code { position: relative; display: block; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22); border-radius: 20px; padding: 28px 30px 30px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); transform: rotate(-1deg); }
.hero-code::before { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .14); border-radius: 20px; transform: rotate(2.5deg) translate(12px, 12px); z-index: -1; }
.hero-code__label { display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--teal-dark); color: #fff; font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.hero-code__code { display: block; margin-top: 16px; font-size: clamp(2.6rem, 4vw, 3.4rem); font-weight: 800; letter-spacing: -.02em; line-height: 1; color: #fff; }
.hero-code__title { display: block; margin-top: 10px; color: #d7e5ef; font-size: 1.05rem; line-height: 1.45; text-decoration: none; }
.hero-code__title:hover { color: #fff; text-decoration: underline; }
.hero-code__cta { display: inline-block; margin-top: 14px; color: var(--teal-bright); font-weight: 700; text-decoration: none; }
.hero-code__cta:hover { color: #fff; }
.hero-code__chip { position: absolute; right: 18px; bottom: -14px; display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; background: #fff; color: var(--navy); font-size: .85rem; font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.hero-code__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-bright); animation: hero-dot 2s ease-in-out infinite; }
@keyframes hero-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ============================================================
   4. Featured story + cards
   ============================================================ */
.featured-story {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.featured-story__image { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-soft); }
.featured-story__image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.featured-story__badge { position: absolute; top: 16px; left: 16px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--teal-dark); color: #fff; font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.featured-story:hover .featured-story__image img { transform: scale(1.03); }
.featured-story__content { padding: 24px 40px; display: flex; flex-direction: column; justify-content: center; }
/* Title and excerpt are clamped so the text column never grows taller than
   the 16:9 image beside it: the image then shows whole, with no crop and
   no blank band. */
.featured-story__content h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); margin: .5em 0 .4em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.featured-story__content h2 a { color: var(--heading); }
.featured-story__content h2 a:hover { color: var(--teal-dark); }
.featured-story__content p { color: var(--muted); margin-bottom: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px; font-size: .78rem; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
  background: var(--teal-soft); color: var(--teal-dark); text-decoration: none;
}
.cat-chip:hover { background: var(--teal-dark); color: #fff; text-decoration: none; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; color: var(--faint); font-size: .88rem; margin-top: auto; padding-top: 12px; }
.post-meta time, .post-meta span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.post-meta svg, .article-meta svg { width: 15px; height: 15px; flex-shrink: 0; }
.article-meta span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* RankMath breadcrumbs (used when RankMath is active) */
.rank-math-breadcrumb { font-size: .88rem; color: var(--faint); margin-bottom: 18px; }
.rank-math-breadcrumb a { color: var(--muted); }
.rank-math-breadcrumb a:hover { color: var(--teal-dark); }
.rank-math-breadcrumb .separator { margin: 0 8px; color: var(--muted); }
.rank-math-breadcrumb .last { color: var(--muted); }

.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.post-card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.post-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: #cfdae4; }
.post-card__image { aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-soft); }
.post-card__image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.post-card:hover .post-card__image img { transform: scale(1.04); }
.post-card__body { padding: 22px 22px 20px; display: flex; flex-direction: column; flex: 1; }
.post-card__body h3 { font-size: 1.12rem; line-height: 1.35; margin: .55em 0 .45em; }
.post-card__body h3 a { color: var(--heading); }
.post-card__body h3 a:hover { color: var(--teal-dark); }
.post-card__body p { color: var(--muted); font-size: .96rem; margin-bottom: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card__body .post-meta { padding-top: 0; margin-top: auto; }

/* Category cards */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.cat-card {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 24px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); text-decoration: none; transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.cat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--teal-bright); text-decoration: none; }
.cat-card__icon {
  width: 48px; height: 48px; flex-shrink: 0; border-radius: 12px;
  background: var(--teal-soft); color: var(--teal-dark);
  display: grid; place-items: center;
}
.cat-card__icon svg { width: 24px; height: 24px; }
.cat-card h3 { font-size: 1.08rem; margin: 0 0 3px; }
.cat-card p { color: var(--muted); font-size: .92rem; margin: 0; }
.cat-card .count { display: block; margin-top: 8px; font-size: .82rem; font-weight: 700; color: var(--teal-dark); }

/* Trust band */
.trust { background: var(--bg-soft); border-block: 1px solid var(--line-soft); }
.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.trust-item { display: flex; gap: 16px; }
.trust-item__icon {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line); color: var(--teal-dark);
  display: grid; place-items: center;
}
.trust-item__icon svg { width: 22px; height: 22px; }
.trust-item h3 { font-size: 1.05rem; margin: 2px 0 4px; }
.trust-item p { color: var(--muted); font-size: .95rem; margin: 0; }

/* ============================================================
   5. Single article
   ============================================================ */
.article-hero { background: linear-gradient(180deg, #e8f5f2 0%, var(--bg-soft) 100%); border-bottom: 1px solid var(--line-soft); padding: 44px 0 0; }
.article-hero .container { max-width: 860px; }
.breadcrumbs { font-size: .88rem; color: var(--faint); margin-bottom: 18px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--teal-dark); }
.breadcrumbs .sep { margin: 0 8px; color: var(--muted); }
.article-hero h1 { margin: .4em 0 .45em; }
.article-hero .standfirst { color: var(--muted); font-size: 1.14rem; margin-bottom: 22px; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-bottom: 26px; color: var(--muted); font-size: .92rem; }
.article-meta .author { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
.article-meta .author img { border-radius: 50%; }
.article-featured { max-width: 860px; margin: 0 auto; padding: 28px 24px 0; }
.article-featured figure { margin: 0; }
.article-featured img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.article-featured figcaption { font-size: .85rem; color: var(--faint); padding: 10px 4px 0; }

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 56px; max-width: var(--container); margin: 0 auto; padding: 44px 24px 64px; }
.entry-content { font-size: 1.075rem; min-width: 0; overflow-wrap: break-word; }
.table-scroll { overflow-x: auto; margin: 1.6em 0; }
.table-scroll table { margin: 0; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content > p:first-of-type { font-size: 1.18rem; line-height: 1.75; color: #2f4257; }
.entry-content h2 { margin: 1.6em 0 .55em; padding-top: .4em; padding-bottom: 12px; scroll-margin-top: 90px; position: relative; }
.entry-content h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 48px; height: 3px; border-radius: 3px; background: var(--teal-bright); }
.entry-content h3 { margin: 1.5em 0 .5em; scroll-margin-top: 90px; }
.entry-content img { border-radius: var(--radius); }
.entry-content a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(11, 110, 102, .4); }
.entry-content a:hover { text-decoration-color: var(--teal); }
.entry-content ul li::marker { color: var(--teal); }
.entry-content blockquote {
  margin: 1.8em 0; padding: 26px 28px 26px 68px; border-left: 4px solid var(--teal-bright);
  background: var(--teal-softer); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic; font-size: 1.12rem; line-height: 1.7; color: var(--heading); position: relative;
}
.entry-content blockquote::before {
  content: "\201C"; position: absolute; left: 18px; top: 4px;
  font-family: Georgia, 'Times New Roman', serif; font-size: 3.6rem; line-height: 1;
  color: var(--teal-dark); font-style: normal;
}
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content table { width: 100%; border-collapse: collapse; margin: 1.6em 0; font-size: .95rem; }
.entry-content th, .entry-content td { padding: 10px 14px; border: 1px solid var(--line); text-align: left; }
.entry-content th { background: var(--bg-soft); color: var(--heading); }
.entry-content figure { margin: 1.8em 0; }
.entry-content figcaption { font-size: .86rem; color: var(--faint); text-align: center; margin-top: 8px; }
.entry-content hr { border: 0; border-top: 1px solid var(--line); margin: 2.2em 0; }

/* TOC sidebar */
.toc { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; }
.toc__box { border: 1px solid var(--line); border-top: 3px solid var(--teal-bright); border-radius: var(--radius); padding: 22px; background: var(--bg); box-shadow: var(--shadow); }
.toc__box h2 { font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 14px; }
.toc__box ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc__box li { margin-bottom: 2px; }
.toc__box a {
  display: block; padding: 7px 10px; border-radius: 8px; color: var(--muted);
  font-size: .93rem; line-height: 1.45; text-decoration: none;
}
.toc__box a:hover { background: var(--bg-soft); color: var(--heading); text-decoration: none; }
.toc__box a.active { background: var(--teal-soft); color: var(--teal-dark); font-weight: 700; }
.toc__box a::before { counter-increment: toc; content: counter(toc, decimal-leading-zero) ". "; color: var(--teal-dark); font-weight: 700; font-size: .85rem; }

/* Article footer: tags, share, author, related */
.article-footer { max-width: 860px; margin: 0 auto; padding: 0 24px 64px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 32px; padding: 0; list-style: none; }
.tag-list a { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--muted); }
.tag-list a:hover { border-color: var(--teal); color: var(--teal-dark); text-decoration: none; }
/* Share bar */
.share-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 20px 0; margin: 12px 0 30px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.share-bar strong { font-size: .92rem; color: var(--heading); margin-right: 4px; }
.share-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--muted); font-size: .88rem; font-weight: 600; font-family: inherit; line-height: 1.2; cursor: pointer; text-decoration: none; }
.share-btn:hover { border-color: var(--teal); color: var(--teal-dark); text-decoration: none; }
.share-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.share-btn--copy.copied { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-soft); }

/* Author card */
.author-box { display: flex; gap: 22px; align-items: flex-start; padding: 30px; border: 0; border-radius: var(--radius); background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; margin-bottom: 56px; box-shadow: var(--shadow-lg); }
.author-box__avatar { flex-shrink: 0; }
.author-box__avatar img { display: block; width: 96px; height: 96px; border-radius: 50%; border: 3px solid var(--teal-bright); box-shadow: 0 0 0 4px rgba(20, 184, 166, .25); }
.author-box__label { display: block; font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--teal-bright); margin-bottom: 6px; }
.author-box h3 { font-size: 1.3rem; margin: 0 0 6px; color: #fff; }
.author-box p { color: #c6d4e2; font-size: .98rem; line-height: 1.65; margin: 0 0 14px; }
.author-box__link { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; background: var(--teal-dark); color: #fff; font-size: .9rem; font-weight: 700; text-decoration: none; }
.author-box__link:hover { background: var(--teal-darker); color: #fff; text-decoration: none; }
.related .eyebrow { margin-bottom: 6px; }
.related h2 { margin-bottom: 20px; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 48px; }
.post-nav a { display: block; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; background: var(--bg); transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.post-nav a:hover { border-color: var(--teal-bright); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.post-nav span { display: block; font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.post-nav strong { color: var(--heading); font-size: 1rem; line-height: 1.4; display: block; }
.post-nav .next { text-align: right; }

/* ============================================================
   6. Archives, pages, search, 404
   ============================================================ */
.page-hero { background: var(--navy); color: #fff; padding: 56px 0 52px; }
.page-hero h1 { color: #fff; margin: .25em 0 .3em; }
.page-hero p { color: #c6d4e2; max-width: 640px; margin: 0; }
.page-hero .count { color: var(--teal-bright); font-weight: 700; }
.archive-grid { padding: 48px 0 64px; }
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 44px; flex-wrap: wrap; }
.pagination .page-numbers {
  min-width: 44px; height: 44px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-weight: 700; text-decoration: none; background: var(--bg);
}
.pagination a.page-numbers:hover { border-color: var(--teal); color: var(--teal-dark); text-decoration: none; }
.pagination .current { background: var(--navy); border-color: var(--navy); color: #fff; }
.page-content { max-width: 820px; margin: 0 auto; padding: 52px 24px 72px; }
.page-content h1 { margin-bottom: .5em; }
.no-results { text-align: center; padding: 72px 0; }
.no-results h2 { margin-bottom: 8px; }
.no-results p { color: var(--muted); }
.no-results .search-form { max-width: 520px; margin: 24px auto 0; }

/* Comments */
.comments-area { max-width: 860px; margin: 0 auto; padding: 0 24px 72px; }
.comments-area h2 { font-size: 1.4rem; }
.comment-list { list-style: none; margin: 0 0 32px; padding: 0; }
.comment-list .comment { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.comment-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; font-size: .9rem; color: var(--muted); }
.comment-meta img { border-radius: 50%; }
.comment-meta .fn { font-weight: 700; color: var(--heading); font-style: normal; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg-soft); margin-bottom: 12px;
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--teal); background: var(--bg); }
.comment-form .submit {
  padding: 12px 24px; border: 0; border-radius: 999px; background: var(--navy); color: #fff; font-weight: 700;
}
.comment-form .submit:hover { background: var(--navy-2); }

/* ============================================================
   7. Footer
   ============================================================ */
.site-footer { background: var(--navy-3); color: #b9c9d8; }
.site-footer__main { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; padding: 60px 0 44px; }
.site-footer h3 { color: #fff; font-size: .95rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 16px; }
.site-footer a { color: #b9c9d8; }
.site-footer a:hover { color: #fff; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 9px; }
.site-footer .brand p { font-size: .95rem; margin: 14px 0 0; max-width: 320px; }
.site-footer .brand .site-brand .logo-text { color: #fff; }
.site-footer__bottom { border-top: 1px solid rgba(255, 255, 255, .1); padding: 22px 0; font-size: .88rem; }
.site-footer__bottom .container { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; align-items: center; }
.site-footer__bottom nav ul { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-footer__bottom nav a { font-size: .88rem; }

/* Back to top */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg); color: var(--heading); box-shadow: var(--shadow);
  display: none; align-items: center; justify-content: center;
}
.to-top.show { display: inline-flex; }
.to-top:hover { border-color: var(--teal); color: var(--teal-dark); }
.to-top svg { width: 20px; height: 20px; }

/* ============================================================
   8. Responsive
   ============================================================ */
@media (max-width: 1200px) {
  .site-brand .custom-logo { height: 42px; }
  /* Featured stacks below 1200px: at narrower widths the 16:9 image gets
     shorter than the text beside it, so two-column would show a band. */
  .featured-story { grid-template-columns: 1fr; }
  .featured-story__content { padding: 26px 24px 30px; }
}
@media (max-width: 1100px) {
  /* The desktop nav (logo + 6 links + search + theme toggle) overflows
     below ~1100px: at 1024px "Education" and "About" overlapped and the
     toggle was cut off. Collapse to the hamburger menu here instead of
     waiting for 860px, so tablet widths get a clean header. */
  .main-nav {
    display: none; position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg);
    padding: 12px 24px 20px;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 2px; }
  .main-nav a { padding: 12px 10px; font-size: 1.05rem; }
  .menu-toggle { display: inline-flex; }
}
@media (max-width: 1020px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .trust-grid { grid-template-columns: 1fr; gap: 20px; }
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  /* TOC moves above the article on small screens instead of hiding. */
  .toc { display: block; order: -1; position: static; margin-bottom: 28px; }
  .site-footer__main { grid-template-columns: 1fr 1fr; }
  /* Hero stacks: visual below the copy. The pulse stays visible on all
     screens so the effect shows everywhere. */
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-code { transform: none; }
}
@media (max-width: 860px) {
  /* Nav collapse lives at 1100px now (see above); only the
     smaller-screen spacing rules remain here. */
  .site-brand .custom-logo { height: 38px; }
  .section { padding: 48px 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .hero { padding: 56px 0; }
}
@media (max-width: 640px) {
  .container { padding-inline: 18px; }
  .post-grid, .cat-grid { grid-template-columns: 1fr; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
  .site-footer__main { grid-template-columns: 1fr; gap: 32px; padding: 48px 0 36px; }
  .author-box { flex-direction: column; padding: 24px; }
  .author-box__avatar img { width: 72px; height: 72px; }
  .site-brand .custom-logo { height: 34px; }
  .search-form { flex-direction: column; }
  .search-form button[type="submit"] { width: 100%; }
  .hero-stats { gap: 20px; }
  .hero-code__chip { display: none; }
}
/* ============================================================
   9. Dark mode (day / night)
   The toggle sets data-theme="dark" on <html>; the choice is saved
   in localStorage and the system preference is the default.
   Colours are the same tokens, redefined — no extra stylesheet
   and no layout change, so this costs ~2 KB of CSS and no speed.
   ============================================================ */
html[data-theme="dark"] {
  --bg: #0b1a2e;
  --bg-soft: #12233a;
  --ink: #e8eef5;
  --muted: #b8c7d6;
  --faint: #a3b4c6;
  --line: #22344d;
  --line-soft: #1a2a42;
  --teal: #14b8a6;
  --teal-dark: #14b8a6;
  --teal-darker: #0d9488;
  --teal-bright: #2dd4bf;
  --teal-soft: #0f2a28;
  --teal-softer: #0d211f;
  --heading: #eef3f8;
  --amber: #f59e0b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px -12px rgba(0, 0, 0, .55);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 18px 44px -18px rgba(0, 0, 0, .65);
  color-scheme: dark;
}
/* Header: translucent dark instead of translucent white. */
html[data-theme="dark"] .site-header { background: rgba(11, 26, 46, .97); }
/* The logo is a navy wordmark on transparency. In dark mode the header
   swaps to a dedicated dark logo (white wordmark, teal pulse, white
   shield with a dark cross) instead of inverting the light one, which
   washed out the shield detail and the teal line. The dark logo is a
   theme asset (assets/img/logo-dark.png); header.php outputs both. */
.site-brand .custom-logo--dark { display: none; }
html[data-theme="dark"] .site-brand .custom-logo--light { display: none; }
html[data-theme="dark"] .site-brand .custom-logo--dark { display: block; }
/* Featured images are white-background cards: dim them clearly in dark
   mode so they stop glaring against the dark page. 0.85 was too subtle
   to notice — 0.75 is visibly softer while the artwork stays readable. */
html[data-theme="dark"] .featured-story__image img,
html[data-theme="dark"] .post-card__image img,
html[data-theme="dark"] .article-featured img,
html[data-theme="dark"] .entry-content img { filter: brightness(.75); }
/* Outline buttons (e.g. "Browse all 4 topics") are dark-on-dark in the
   hero — give them a teal border and text so they stand out. */
html[data-theme="dark"] .btn-outline {
  border-color: var(--teal-bright);
  color: var(--teal-bright);
  background: transparent;
}
html[data-theme="dark"] .btn-outline:hover {
  background: var(--teal-soft);
  border-color: var(--teal-bright);
  color: var(--teal-bright);
}
/* Article hero: dark teal tint instead of the pale one. */
html[data-theme="dark"] .article-hero { background: linear-gradient(180deg, #0f2a28 0%, var(--bg-soft) 100%); }
/* Lead paragraph uses a hardcoded dark grey — lighten it. */
html[data-theme="dark"] .entry-content > p:first-of-type { color: #c6d4e2; }
/* Link underlines: brighten the teal so they read on dark. */
html[data-theme="dark"] .entry-content a { text-decoration-color: rgba(45, 212, 191, .5); }
/* Solid teal buttons keep white text: use a deeper teal for the fill so
   the contrast stays strong on dark. */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .hero .hero-search .search-form button[type="submit"],
html[data-theme="dark"] .hero-code__label,
html[data-theme="dark"] .featured-story__badge,
html[data-theme="dark"] .author-box__link { background: #0f766e; }
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .hero .hero-search .search-form button[type="submit"]:hover,
html[data-theme="dark"] .author-box__link:hover { background: #0b6e66; }
html[data-theme="dark"] .cat-chip:hover { background: #0f766e; }
/* Card hover border: the pale grey would glare on dark — use a muted blue. */
html[data-theme="dark"] .post-card:hover { border-color: #33507a; }
/* Toggle icons: moon in light mode, sun in dark mode. */
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  /* The hero pulse is the site's brand mark and the owner wants it drawing
     even when other motion is reduced, so keep just this one animation
     running instead of freezing it. */
  .hero__pulse .hero__pulse--base { opacity: .35; }
  .hero__pulse .hero__pulse--sweep { display: block; animation: hero-pulse-sweep 2.8s linear infinite !important; }
}
