/*
Theme Name: mHealth Alliance
Theme URI: https://mhealthalliance.org
Author: mHealth Alliance
Author URI: https://mhealthalliance.org
Description: Clean clinical news theme for mHealth Alliance: health news with a digital-health lean. Lead story front page, section rows, reading-column articles with source boxes, photo credits.
Version: 1.0.0
Requires at least: 6.2
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mhealth-alliance
Tags: news, blog, one-column, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ---------- tokens ---------- */
:root {
  --teal: #0f8b7e;
  --teal-dark: #0b6e64;
  --teal-soft: #e6f4f2;
  --teal-line: #bfe3de;
  --navy: #0e1e2b;
  --ink: #1b2a36;
  --muted: #5c6b78;
  --faint: #8d99a3;
  --line: #e4e9ec;
  --surface: #f5f8f9;
  --white: #ffffff;
  --accent-warm: #c8463c;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 1200px;
  --gutter: 20px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(14, 30, 43, 0.04), 0 8px 24px rgba(14, 30, 43, 0.06);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--teal-dark); text-decoration: none; }
a:hover { color: var(--teal); }
h1, h2, h3, h4 { margin: 0 0 0.5em; color: var(--navy); line-height: 1.2; letter-spacing: -0.015em; font-weight: 700; }
p { margin: 0 0 1.15em; }
ul, ol { margin: 0 0 1.15em; padding-left: 1.3em; }
button, input, textarea, select { font: inherit; color: inherit; }
figure { margin: 0; }
.screen-reader-text {
  position: absolute !important; clip: rect(1px, 1px, 1px, 1px); width: 1px; height: 1px; overflow: hidden; word-wrap: normal !important;
}
.skip-link:focus { clip: auto; width: auto; height: auto; left: 8px; top: 8px; z-index: 1000; background: var(--navy); color: #fff; padding: 8px 12px; border-radius: 6px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.wrap--narrow { max-width: 780px; }
.wrap--article { max-width: 740px; }
.wrap--cover { max-width: 1000px; }

/* ---------- header ---------- */
.top-line { height: 4px; background: linear-gradient(90deg, var(--teal) 0%, var(--teal-dark) 100%); }
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 18px; min-height: 66px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--navy); font-weight: 600; font-size: 21px; letter-spacing: -0.02em; white-space: nowrap; }
.brand:hover { color: var(--navy); }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-name b { font-weight: 800; color: var(--teal-dark); }
.brand img.custom-logo { height: 36px; width: auto; }
.primary-nav { margin-left: auto; }
.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; align-items: center; flex-wrap: nowrap; }
.primary-nav a {
  display: block; padding: 7px 10px; border-radius: 999px; color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap; line-height: 1.3;
}
.primary-nav a:hover, .primary-nav .current-menu-item > a, .primary-nav .current_page_item > a { background: var(--teal-soft); color: var(--teal-dark); }
.header-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn svg { width: 20px; height: 20px; }
.nav-toggle { display: none; }
.header-search { display: none; border-top: 1px solid var(--line); background: var(--white); }
.header-search.is-open { display: block; }
.header-search form { display: flex; gap: 8px; padding: 12px 0; }
.search-input, .field input, .field textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white);
}
.search-input:focus, .field input:focus, .field textarea:focus { outline: 2px solid var(--teal-line); border-color: var(--teal); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 999px;
  background: var(--teal); color: #fff; font-weight: 600; font-size: 15px; border: 0; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--teal-dark); color: #fff; }
.btn--ghost { background: transparent; color: var(--teal-dark); border: 1px solid var(--teal-line); }
.btn--ghost:hover { background: var(--teal-soft); }

/* ---------- labels & meta ---------- */
.kicker {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal-dark);
}
.kicker:hover { color: var(--teal); }
.meta { font-size: 13.5px; color: var(--muted); }
.meta a { color: var(--muted); }
.meta a:hover { color: var(--teal-dark); }
.meta .dot::before { content: "·"; margin: 0 6px; color: var(--faint); }

/* ---------- home ---------- */
.home-hero { padding: 36px 0 20px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 40px; align-items: start; }
.lead-story .lead-media { display: block; border-radius: var(--radius); overflow: hidden; background: var(--surface); aspect-ratio: 16 / 9; }
.lead-story .lead-media img { width: 100%; height: 100%; object-fit: cover; }
.lead-story .kicker { margin: 18px 0 8px; }
.lead-story h2 { font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -0.025em; margin-bottom: 10px; }
.lead-story h2 a { color: var(--navy); }
.lead-story h2 a:hover { color: var(--teal-dark); }
.lead-story .excerpt { font-size: 17.5px; color: var(--muted); margin-bottom: 10px; }
.latest-rail h3 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 6px; padding-bottom: 10px; border-bottom: 2px solid var(--navy); }
.rail-list { list-style: none; margin: 0; padding: 0; }
.rail-item { display: grid; grid-template-columns: 1fr 92px; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: start; }
.rail-item:last-child { border-bottom: 0; }
.rail-item .thumb { display: block; width: 92px; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.rail-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.rail-item h4 { font-size: 15.5px; font-weight: 600; line-height: 1.35; margin: 4px 0 6px; }
.rail-item h4 a { color: var(--navy); }
.rail-item h4 a:hover { color: var(--teal-dark); }
.rail-item .kicker { font-size: 11px; }

.section-block { padding: 34px 0 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 12px; margin-bottom: 22px; border-bottom: 2px solid var(--navy); }
.section-head h2 { font-size: 22px; margin: 0; }
.section-head h2 a { color: var(--navy); }
.section-head .more { font-size: 14px; font-weight: 600; color: var(--teal-dark); white-space: nowrap; }
.section-head .more:hover { color: var(--teal); }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 26px; }
.card-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { display: flex; flex-direction: column; }
.card .card-media { display: block; border-radius: var(--radius); overflow: hidden; background: var(--surface); aspect-ratio: 16 / 10; margin-bottom: 14px; }
.card .card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.card:hover .card-media img { transform: scale(1.03); }
.card .kicker { margin-bottom: 6px; }
.card h3 { font-size: 18px; font-weight: 600; line-height: 1.32; margin-bottom: 8px; }
.card h3 a { color: var(--navy); }
.card h3 a:hover { color: var(--teal-dark); }
.card .excerpt { font-size: 14.5px; color: var(--muted); margin: 0 0 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { margin-top: auto; }

.placeholder-media {
  width: 100%; height: 100%; display: flex; align-items: flex-end; padding: 14px;
  background: linear-gradient(135deg, var(--teal-soft) 0%, #d4ece8 100%); color: var(--teal-dark); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
}

.about-strip { margin: 44px 0 0; padding: 40px 0; background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.about-strip .inner { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.about-strip h2 { font-size: 24px; margin-bottom: 8px; }
.about-strip p { color: var(--muted); margin-bottom: 0; }
.about-strip .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- article ---------- */
.article-head { padding: 40px 0 10px; }
.article-head .kicker { margin-bottom: 14px; }
.article-head h1 { font-size: clamp(30px, 4.2vw, 44px); letter-spacing: -0.025em; margin-bottom: 14px; }
.standfirst { font-size: 19px; line-height: 1.5; color: var(--muted); margin-bottom: 18px; }
.byline { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.byline .avatar { width: 38px; height: 38px; border-radius: 999px; background: var(--teal-soft); display: grid; place-items: center; color: var(--teal-dark); flex: none; }
.byline .avatar svg { width: 20px; height: 20px; }
.byline .who { font-weight: 600; color: var(--navy); font-size: 14.5px; }
.byline .meta { display: block; }
.article-cover { padding: 26px 0 8px; }
.article-cover img { width: 100%; border-radius: var(--radius); aspect-ratio: 16 / 9; object-fit: cover; }
.article-cover figcaption, .wp-caption-text, figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
.sponsored-note {
  margin: 22px 0 0; padding: 12px 16px; border-left: 3px solid var(--accent-warm); background: #fdf4f3; font-size: 14px; color: var(--ink); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.article-body { padding: 18px 0 10px; font-size: 18px; line-height: 1.72; }
.article-body > * { max-width: 100%; }
.article-body p { margin-bottom: 1.3em; }
.article-body h2 { font-size: 24px; margin: 1.6em 0 0.6em; }
.article-body h3 { font-size: 20px; margin: 1.4em 0 0.5em; }
.article-body a { color: var(--teal-dark); text-decoration: underline; text-decoration-color: var(--teal-line); text-underline-offset: 3px; text-decoration-thickness: 2px; }
.article-body a:hover { color: var(--teal); text-decoration-color: var(--teal); }
.article-body blockquote { margin: 1.4em 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--teal); color: var(--navy); font-size: 19px; }
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body ul, .article-body ol { padding-left: 1.4em; }
.article-body li { margin-bottom: 0.4em; }
.article-body img { border-radius: var(--radius); }
.article-body figure { margin: 1.6em 0; }
.article-body .wp-block-image img, .article-body .alignwide { border-radius: var(--radius); }
.article-body table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 1.4em 0; }
.article-body th, .article-body td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: top; }
.article-body th { color: var(--navy); font-weight: 600; background: var(--surface); }
.article-body hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

.sources-box { margin: 30px 0 0; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.sources-box h2 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.sources-box ol { margin: 0; padding-left: 1.3em; font-size: 15px; }
.sources-box li { margin-bottom: 8px; }
.sources-box .pub { color: var(--muted); }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 26px 0 8px; }
.tag-row a { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.tag-row a:hover { background: var(--teal-soft); border-color: var(--teal-line); color: var(--teal-dark); }
.share-row { display: flex; align-items: center; gap: 10px; padding: 14px 0 30px; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.share-row a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); font-weight: 500; }
.share-row a:hover { border-color: var(--teal-line); color: var(--teal-dark); background: var(--teal-soft); }
.share-row svg { width: 15px; height: 15px; }
.editorial-note { font-size: 13.5px; color: var(--muted); padding: 18px 0 0; }
.related { padding: 40px 0 10px; }

/* ---------- archive / search ---------- */
.archive-head { padding: 44px 0 26px; border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.archive-head .kicker { margin-bottom: 8px; }
.archive-head h1 { font-size: clamp(28px, 4vw, 40px); margin-bottom: 6px; }
.archive-head p { color: var(--muted); margin: 0; max-width: 720px; }
.archive-grid { padding-bottom: 20px; }
.pagination { display: flex; justify-content: center; gap: 6px; padding: 30px 0 10px; }
.pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); font-size: 14px; }
.pagination .page-numbers.current { background: var(--navy); color: #fff; border-color: var(--navy); }
.pagination a.page-numbers:hover { background: var(--teal-soft); border-color: var(--teal-line); color: var(--teal-dark); }
.search-form-big { display: flex; gap: 10px; max-width: 640px; margin: 18px 0 0; }
.empty-state { padding: 40px 0 60px; color: var(--muted); }

/* ---------- pages ---------- */
.page-head { padding: 44px 0 16px; }
.page-head h1 { font-size: clamp(30px, 4vw, 42px); }
.page-body { padding-bottom: 40px; font-size: 17.5px; }
.page-body h2 { font-size: 24px; margin: 1.5em 0 0.6em; }
.page-body h3 { font-size: 19px; margin: 1.3em 0 0.5em; }
.page-body a { text-decoration: underline; text-decoration-color: var(--teal-line); text-underline-offset: 3px; }
.info-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 10px 0 30px; }
.info-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.info-card h3 { font-size: 16px; margin-bottom: 6px; }
.info-card p { font-size: 14.5px; color: var(--muted); margin: 0; }

/* ---------- forms ---------- */
.contact-form { margin: 10px 0 40px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.contact-form h2 { font-size: 22px; margin-bottom: 4px; }
.contact-form .lead { color: var(--muted); font-size: 15px; margin-bottom: 18px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--navy); }
.field textarea { min-height: 150px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }
.notice { padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 15px; }
.notice--ok { background: var(--teal-soft); color: var(--teal-dark); border: 1px solid var(--teal-line); }
.notice--err { background: #fdf4f3; color: var(--accent-warm); border: 1px solid #f1cfcb; }
.form-foot { font-size: 13px; color: var(--muted); margin-top: 12px; }

/* ---------- footer ---------- */
.site-footer { margin-top: 50px; background: var(--navy); color: #c9d3da; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: 40px; padding: 48px 0 30px; }
.site-footer .brand { color: #fff; }
.site-footer .brand-name b { color: #7fd7cb; }
.site-footer p { font-size: 14.5px; color: #a7b4be; margin: 14px 0 0; max-width: 460px; }
.site-footer h4 { color: #fff; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer a { color: #c9d3da; font-size: 14.5px; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.1); padding: 18px 0 26px; font-size: 13px; color: #8a97a2; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.footer-bottom a { color: #8a97a2; }
.footer-bottom a:hover { color: #fff; }

/* ---------- 404 ---------- */
.not-found { padding: 70px 0 60px; text-align: center; }
.not-found h1 { font-size: 40px; }
.not-found p { color: var(--muted); }

/* ---------- WordPress bits ---------- */
.alignleft { float: left; margin: 0.4em 1.4em 1em 0; }
.alignright { float: right; margin: 0.4em 0 1em 1.4em; }
.aligncenter { margin-left: auto; margin-right: auto; }
.wp-caption { max-width: 100%; }
.sticky {}
.bypostauthor {}
.gallery-caption {}

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .primary-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--white); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); padding: 10px var(--gutter) 16px; margin: 0; }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 2px; }
  .primary-nav a { padding: 11px 12px; font-size: 16px; border-radius: var(--radius-sm); }
  .nav-toggle { display: inline-flex; }
  .header-tools { margin-left: auto; }
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .card-grid, .card-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .about-strip .inner { grid-template-columns: 1fr; }
  .about-strip .actions { justify-content: flex-start; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .header-row { min-height: 60px; gap: 12px; }
  .brand { font-size: 18px; }
  .brand-mark { width: 30px; height: 30px; }
  .home-hero { padding-top: 22px; }
  .card-grid, .card-grid--4 { grid-template-columns: 1fr; gap: 24px; }
  .section-block { padding-top: 26px; }
  .article-head { padding-top: 26px; }
  .article-body { font-size: 17px; }
  .field-row { grid-template-columns: 1fr; }
  .info-cards { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; padding-top: 36px; }
  .contact-form { padding: 20px; }
}

/* chips and share buttons inside articles are not prose links */
.article-body .share-row a, .article-body .tag-row a, .article-body .sources-box .pub a { text-decoration: none; }
