/* ─────────────────────────────────────────────────────────────
   DoseLoop shared stylesheet for article / guide / utility pages
   Used by: guides, guide articles, about, medical-disclaimer, 404
   (Homepage and the older topic pages keep their own inline CSS.)
   ───────────────────────────────────────────────────────────── */

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

:root {
  --bg: #FAF7F2;
  --bg-alt: #F3EEE6;
  --surface: #FFFFFF;
  --primary: #7C5614;
  --primary-hover: #6A480E;
  --primary-light: #F5EDD8;
  --teal: #2D9B7F;
  --teal-light: #E5F5F0;
  --orange: #E8962A;
  --orange-light: #FEF5E7;
  --text: #1C1208;
  --text-2: #5C4A30;
  --text-3: #9B8570;
  --border: #EAE2D5;
  --radius-sm: 10px;
  --radius: 16px;
  --shadow-lg: 0 12px 48px rgba(28, 16, 8, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171310;
    --bg-alt: #201A15;
    --surface: #221C17;
    --primary: #E0B167;
    --primary-hover: #EFC687;
    --primary-light: #33271A;
    --teal: #63C7AC;
    --teal-light: #16302A;
    --orange: #F0A54A;
    --orange-light: #33240F;
    --text: #F7F2EA;
    --text-2: #C8BCAC;
    --text-3: #94897C;
    --border: #3A3028;
  }
}

html { scroll-behavior: smooth; }

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

html:lang(zh) body {
  font-family: "Noto Sans SC", Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

html:lang(ja) body {
  font-family: "Noto Sans JP", Inter, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
}

a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 4px; }

/* ── NAV ─────────────────────────────────────────────── */
nav.top-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: rgba(250, 247, 242, 0.9);
  border-bottom: 1px solid rgba(234, 226, 213, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

@media (prefers-color-scheme: dark) {
  nav.top-nav { background: rgba(23, 19, 16, 0.9); border-bottom-color: rgba(58, 48, 40, 0.9); }
}

.nav-logo, .footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.nav-logo-img { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; }
.nav-links { display: none; gap: 26px; list-style: none; }
.nav-links a, .footer-links a { color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-links a:hover, .footer-links a:hover { color: var(--text); }

.nav-cta {
  background: var(--primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.nav-cta:hover { background: var(--primary-hover); }

@media (prefers-color-scheme: dark) {
  .nav-cta { color: #1C1208; }
}

/* ── ARTICLE SHELL ───────────────────────────────────── */
main { max-width: 900px; margin: 0 auto; padding: 64px 24px 88px; }

.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

h1 { font-size: clamp(32px, 6.5vw, 56px); line-height: 1.1; letter-spacing: -1.5px; margin-bottom: 18px; }
.lede { color: var(--text-2); font-size: 18px; max-width: 720px; margin-bottom: 20px; }

.article-meta {
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.article-meta a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }

.toc {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.toc p { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.toc ol { padding-left: 20px; }
.toc li { font-size: 14px; margin-bottom: 4px; }
.toc a { color: var(--text-2); text-decoration: none; }
.toc a:hover { color: var(--primary); text-decoration: underline; }

.content-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 18px;
}
.content-section h2 { font-size: 24px; line-height: 1.25; margin-bottom: 14px; letter-spacing: -0.4px; }
.content-section h3 { font-size: 17px; margin: 20px 0 6px; }
.content-section p, .content-section li { color: var(--text-2); font-size: 15px; }
.content-section p + p { margin-top: 12px; }
.content-section ul, .content-section ol { padding-left: 22px; margin: 10px 0; }
.content-section li { margin-bottom: 6px; }
.content-section a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.faq-item + .faq-item { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 18px; }
.faq-item h3 { margin-top: 0; }

.content-section table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14px; display: block; overflow-x: auto; }
.content-section th, .content-section td { text-align: left; padding: 10px 12px; border: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
.content-section th { background: var(--primary-light); color: var(--text); font-weight: 600; }

.callout {
  border-left: 3px solid var(--teal);
  background: var(--teal-light);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin: 18px 0 0;
}
.callout p { color: var(--text-2); font-size: 14.5px; }
.callout strong { color: var(--text); }

.callout.warn { border-left-color: var(--orange); background: var(--orange-light); }

/* ── CARD GRID (hub + about) ─────────────────────────── */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 18px; }
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  transition: border-color 180ms ease, transform 180ms ease;
}
.card:hover { border-color: var(--primary); transform: translateY(-2px); }
.card h2, .card h3 { font-size: 19px; line-height: 1.3; margin-bottom: 8px; color: var(--text); }
.card p { color: var(--text-2); font-size: 14.5px; }
.card .card-kicker { color: var(--teal); font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; display: block; margin-bottom: 8px; }

/* ── LINKS / CTA ─────────────────────────────────────── */
.related-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.related-links a { background: var(--text); color: var(--bg); border-radius: var(--radius-sm); padding: 12px 16px; text-decoration: none; font-weight: 600; font-size: 14px; }
.related-links a:hover { background: var(--primary); color: #fff; }

.download-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.download-links a { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 10px 18px; text-decoration: none; font-size: 14px; font-weight: 600; color: var(--text); }
.download-links a:hover { border-color: var(--primary); color: var(--primary); }

/* ── 404 ─────────────────────────────────────────────── */
main.error-page { max-width: 720px; padding-top: 96px; }
.error-code { color: var(--primary); font-size: 14px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 12px; }

/* ── FOOTER ──────────────────────────────────────────── */
footer { border-top: 1px solid var(--border); padding: 36px 24px; }
.footer-inner { max-width: 1160px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; align-items: center; text-align: center; }
.footer-logo-img { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
.footer-disclaimer, .footer-copy { color: var(--text-3); font-size: 12px; }
.footer-disclaimer { max-width: 560px; }

@media (max-width: 479px) {
  nav.top-nav { gap: 10px; padding: 0 16px; }
}

@media (min-width: 768px) {
  nav.top-nav { padding: 0 40px; }
  .nav-links { display: flex; }
  main { padding: 80px 40px 104px; }
  .footer-inner { flex-direction: row; justify-content: space-between; text-align: left; }
  .card-grid { grid-template-columns: 1fr 1fr; }
}
