/* ============================================================
   Pear Health — blog read-mode styles
   Loads after ../styles.css and reuses its tokens and @font-face
   rules (font files resolve relative to dist/styles.css, so they
   load correctly from this directory). Editorial index: numbered
   entries over fine hairline rules, no cards, no JS required.
   ============================================================ */

/* --- Header · static, forest on the light page field. Column gap stays
   narrow so the shared language pill sits close beside the nav (the
   wordmark keeps its spacing through the nav's auto margin) --- */
.blog-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 20px clamp(20px, 5vw, 64px) 18px;
  border-bottom: 1px solid rgba(23, 60, 50, 0.18);
  color: var(--forest);
}
.blog-wordmark { font: 500 30px/36px var(--serif); color: inherit; text-decoration: none; }
.blog-nav { margin-left: auto; display: flex; align-items: center; gap: 28px; }
.blog-nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  font: 500 14px/20px var(--sans); color: inherit; text-decoration: none;
  opacity: 0.66; transition: opacity 0.18s ease;
}
.blog-nav a:hover, .blog-nav a:focus-visible { opacity: 1; }
.blog-nav a[aria-current="page"] {
  opacity: 1;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 7px;
}

/* --- Page column · broad white space, capped at 1200px --- */
.blog-main {
  max-width: 1200px; margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 64px);
}
.blog-intro { padding-block: clamp(72px, 10vw, 136px) clamp(16px, 2vw, 24px); }
.blog-title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(52px, 6.7vw, 96px);
  letter-spacing: -0.04em; line-height: 0.95;
  color: var(--forest);
}
.blog-lede {
  margin-top: clamp(20px, 2.4vw, 32px); max-width: 56ch;
  font: 500 var(--body-lg)/1.4 var(--sans); color: var(--ink-2);
}

/* --- Sections --- */
.blog-section { padding-block: clamp(48px, 7vw, 96px); }
.blog-section + .blog-section { border-top: 1px solid rgba(23, 60, 50, 0.16); }
.blog-section-title {
  font: 700 24px/30px var(--display); color: var(--forest);
}

/* Articles · honest empty state */
.articles-empty {
  margin-top: clamp(20px, 2.4vw, 28px);
  font: 500 var(--body-lg)/1.4 var(--sans); color: var(--ink-2);
}

/* --- Health Library · topic filters over the resource index.
       Controls ship hidden and are revealed by library.js, so the
       page stays fully readable with JS off; pills only, no cards,
       no illustration --- */
.library-eyebrow {
  font: 600 13px/18px var(--sans); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-2);
}
.library-heading {
  margin-top: 14px; max-width: 24ch;
  font: 700 clamp(30px, 3.6vw, 44px)/1.12 var(--display);
  letter-spacing: -0.02em; color: var(--forest);
}
.library-body {
  margin-top: clamp(16px, 2vw, 24px); max-width: 56ch;
  font: 500 var(--body-lg)/1.4 var(--sans); color: var(--ink-2);
}
.library-browse {
  margin-top: clamp(16px, 2vw, 24px);
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  font: 500 14px/20px var(--sans); color: var(--forest);
  text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px;
}
.library-browse:hover { text-decoration-thickness: 2px; }
.library-browse-arrow { font: 700 0.9em/1 var(--sans); }
.library-filters {
  margin-top: clamp(24px, 3vw, 36px);
  display: flex; flex-wrap: wrap; gap: 10px 12px;
}
.library-filters[hidden] { display: none; }   /* flex would out-weigh hidden */
.library-filters-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 18px;
  font: 500 14px/20px var(--sans); color: var(--forest);
  background: transparent; border: 1px solid rgba(23, 60, 50, 0.32);
  border-radius: 999px; cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.library-filters-btn:hover { border-color: var(--forest); }
.library-filters-btn:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.library-filters-btn[aria-pressed="true"] {
  background: var(--forest); border-color: var(--forest); color: var(--page);
}
.library-live {
  margin-top: 14px;
  font: 400 13px/18px var(--sans); color: var(--ink-2);
}

/* --- Resources · typographic index, hairline rules --- */
.resources-lede {
  margin-top: clamp(16px, 2vw, 24px); max-width: 56ch;
  font: 500 var(--body-lg)/1.4 var(--sans); color: var(--ink-2);
}
.resource-list {
  margin: clamp(32px, 4vw, 48px) 0 0; padding: 0; list-style: none;
  counter-reset: resource;
}
.resource {
  counter-increment: resource;
  display: grid; grid-template-columns: minmax(44px, 64px) minmax(0, 1fr);
  column-gap: clamp(12px, 2vw, 24px); align-items: start;
  padding-block: clamp(28px, 3.4vw, 40px);
}
.resource + .resource { border-top: 1px solid rgba(23, 60, 50, 0.16); }
.resource > * { grid-column: 2; }
.resource::before {
  grid-column: 1; grid-row: 1 / span 4;
  content: counter(resource, decimal-leading-zero);
  font: 600 13px/18px var(--sans); letter-spacing: 0.06em; color: var(--ink-2);
  padding-top: 9px;   /* optically aligns with the source label line */
}
.resource-source {
  font: 600 13px/18px var(--sans); letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-2);
}
.resource-title { margin-top: 8px; }
.resource-title a {
  font: 600 clamp(20px, 1.8vw, 24px)/1.3 var(--sans);
  color: var(--forest);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px;
}
.resource-title a:hover { text-decoration-thickness: 2px; }
.resource-arrow { margin-left: 7px; font: 700 0.66em/1 var(--sans); }
.resource-context {
  margin-top: 12px; max-width: 62ch;
  font: 400 16px/1.6 var(--sans); color: var(--ink-2);
}
.resource-note {
  margin-top: 10px;
  font: 400 13px/1.5 var(--sans); color: rgba(23, 60, 50, 0.8);
}
/* Library filter · explicit empty state; the [hidden] guard keeps
   display:grid rows hidden when filtered out */
.resources-empty {
  margin-top: clamp(28px, 3.4vw, 40px);
  font: 500 var(--body-lg)/1.4 var(--sans); color: var(--ink-2);
}
.resource[hidden] { display: none; }

.resources-fine {
  margin-top: clamp(28px, 3.4vw, 40px); max-width: 68ch;
  font: 400 13px/1.55 var(--sans); color: var(--ink-2);
}

/* CJK measure · ch is a half-width unit, so zh copy caps widen to em
   measures for a comparable 32–38 characters per line */
:lang(zh) .blog-lede, :lang(zh) .resources-lede, :lang(zh) .library-body { max-width: 32em; }
:lang(zh) .library-heading { max-width: 18em; }
:lang(zh) .resource-context { max-width: 34em; }
:lang(zh) .resources-fine { max-width: 38em; }

/* --- Footer · compact forest band --- */
.blog-footer {
  margin-top: clamp(64px, 9vw, 120px);
  background: var(--forest); color: var(--page);
  padding: clamp(28px, 4vw, 40px) clamp(20px, 5vw, 64px);
}
.blog-footer-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 40px;
}
.blog-footer-wordmark { font: 500 24px/30px var(--serif); }
.blog-footer-home {
  margin-left: auto; display: inline-flex; align-items: center; min-height: 44px;
  font: 500 14px/20px var(--sans); color: var(--page);
  text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px;
}
.blog-footer-home:hover { text-decoration-thickness: 2px; }
.blog-footer-disclaimer {
  margin-top: 14px; max-width: 900px;
  font: 400 14px/20px var(--sans); color: rgba(242, 244, 246, 0.75);
}

/* --- Mobile --- */
@media (max-width: 600px) {
  .resource { grid-template-columns: 36px minmax(0, 1fr); padding-block: 24px; }
  .resource::before { padding-top: 0; }
  .blog-nav { gap: 20px; }
}
@media (max-width: 480px) {
  /* Wordmark owns the first row; nav + language pill wrap to a
     right-aligned second row so a 390px viewport never overflows */
  .blog-wordmark { font-size: 24px; flex: 1 1 100%; }
  .blog-header { padding-top: 14px; padding-bottom: 12px; row-gap: 8px; }
}
@media (max-width: 360px) {
  /* CJK wordmark (Pear雪仪) keeps to one line on a 320px viewport;
     nav tightens beside the language pill instead of a third row */
  .blog-wordmark { font-size: clamp(19px, 6.4vw, 24px); }
  .blog-nav { gap: 14px; }
}
