/*
 * Thier - blog styles
 * 2026-05-08 - built on top of `main.css`. Provides:
 *   - Blog index hero + card list (`.blog-shell`, `.blog-hero`,
 *     `.blog-list`, `.blog-card`)
 *   - Article shell with a narrow editorial measure
 *     (`.article-shell`, `.article`, `.article-header`,
 *     `.article-body`, `.container-narrow`)
 *   - Article CTA + related reading footer
 */

.container-narrow {
  width: min(720px, 100% - var(--gutter) * 2);
  margin: 0 auto;
}

/* ───── Blog index (redesign 2026-05-17) ─────
   Editorial / magazine feel. Narrow column for the masthead so
   the hero copy reads like a personal site rather than a
   marketing page. Topic chips for fast filtering. Card design
   trimmed to look more like an editorial list and less like a
   product-marketing grid. */
.blog-shell {
  background: var(--bg);
}

/* iter63 — cream paper masthead, no atmospheric imagery */
.blog-masthead {
  position: relative;
  padding: clamp(110px, 14vh, 160px) 0 clamp(40px, 6vh, 72px);
  background: linear-gradient(180deg, #FAFAF6 0%, #F5F2EA 60%, #FAFAF6 100%);
  border-bottom: 1px solid rgba(14, 30, 30, 0.06);
}
.blog-mast-eyebrow {
  display: inline-block;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal-deep, #086E66);
  font-weight: 700;
  margin-bottom: 16px;
}
.blog-mast-title {
  font-family: var(--display);
  font-size: clamp(2rem, 4vw + 0.3rem, 3rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0 0 18px;
  color: var(--mk-ink, #15161A);
  max-width: 28ch;
  text-wrap: balance;
}
.blog-mast-title em {
  font-style: italic;
  color: var(--teal-deep, #086E66);
  font-weight: 500;
}
.blog-mast-deck {
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink-3);
  margin: 0 0 18px;
  max-width: 56ch;
}
.blog-mast-cadence {
  font-size: 0.92rem;
  color: var(--ink-4);
  margin: 0;
}
.blog-mast-rss {
  color: var(--teal-700);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}
.blog-mast-rss:hover { border-bottom-style: solid; }

.blog-topics-section {
  padding-top: clamp(28px, 4vw, 48px);
  padding-bottom: 8px;
}
.blog-topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.blog-topic-chip {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2, var(--ink));
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
  letter-spacing: -0.005em;
}
.blog-topic-chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.blog-topic-chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.blog-list-section {
  padding-top: clamp(20px, 3vw, 32px);
  padding-bottom: clamp(72px, 10vw, 144px);
}
.blog-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 760px;
  margin-inline: auto;
}

.blog-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  transition: transform 180ms ease;
}
.blog-list > li:first-child .blog-card {
  border-top: none;
  padding-top: 8px;
}
.blog-card:hover {
  transform: none;
}
.blog-card:hover .blog-card-title {
  color: var(--teal-700);
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--ink-4);
  margin-bottom: 2px;
}
.blog-tag {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--teal-700);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0;
  border-radius: 0;
}
.blog-tag::after {
  content: "·";
  margin-left: 10px;
  color: var(--ink-5, var(--ink-4));
  font-weight: 400;
}
.blog-card-date {
  letter-spacing: -0.005em;
  color: var(--ink-4);
}
.blog-card-title {
  font-family: var(--display);
  font-size: clamp(1.35rem, 1.8vw, 1.6rem);
  line-height: 1.18;
  letter-spacing: -0.022em;
  font-weight: 600;
  margin: 0;
  color: var(--mk-ink, #15161A);
  transition: color 160ms ease;
}
.blog-card-excerpt {
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--ink-3);
  margin: 0;
}
.blog-card-cta {
  display: none;
}

.blog-list-footer {
  max-width: 760px;
  margin: 56px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--ink-3);
  font-size: 0.95rem;
}
.blog-list-footer a { color: var(--teal-700); font-weight: 600; text-decoration: none; border-bottom: 1px dotted currentColor; }
.blog-list-footer a:hover { border-bottom-style: solid; }

.blog-empty-state {
  max-width: 760px;
  margin: 56px auto 0;
  padding: 32px;
  text-align: center;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--r-xl);
}
.blog-empty-state a { color: var(--teal-700); font-weight: 600; }

@media (max-width: 560px) {
  .blog-mast-title { font-size: 1.7rem; }
  .blog-mast-deck { font-size: 1rem; }
}

/* ───── Article shell ───── */
.article-shell {
  background: var(--bg);
}

.article-header {
  padding: clamp(56px, 8vw, 120px) 0 clamp(24px, 4vw, 48px);
}
.article-header .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal-700);
  font-weight: 600;
  margin: 0 0 18px;
}
.article-header .eyebrow::before {
  content: '';
  width: 22px; height: 1.5px;
  background: currentColor;
  border-radius: 2px;
}
.article-header .eyebrow a {
  color: inherit;
  text-decoration: none;
}
.article-header .eyebrow a:hover { color: var(--teal-800); }

.article-title {
  font-size: clamp(2.1rem, 4.6vw, 3.25rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 20px;
  max-width: 22ch;
}
.article-deck {
  font-size: clamp(1.08rem, 1.55vw, 1.275rem);
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0 0 24px;
  max-width: 56ch;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-4);
  font-size: 0.92rem;
}

.article-body {
  padding: clamp(8px, 2vw, 24px) 0 clamp(56px, 8vw, 96px);
  font-size: 1.075rem;
  line-height: 1.7;
  color: var(--ink-2);
}
.article-body p {
  margin: 0 0 18px;
}
.article-body h2 {
  font-size: clamp(1.35rem, 2vw, 1.6rem);
  line-height: 1.2;
  letter-spacing: -0.022em;
  font-weight: 700;
  color: var(--ink);
  margin: 44px 0 14px;
}
.article-body h2 + p { margin-top: 0; }
.article-body h3 {
  font-size: 1.15rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 600;
  color: var(--ink);
  margin: 28px 0 8px;
}
.article-body ul, .article-body ol {
  margin: 0 0 22px;
  padding-left: 24px;
}
.article-body li {
  margin-bottom: 6px;
  line-height: 1.6;
}
.article-body li::marker { color: var(--ink-4); }
/* Prose links only. Audit F201: the bare `.article-body a` rule (0,1,1)
   out-ranked `.btn-primary` (0,1,0) in main.css, so the article CTA's
   primary button rendered teal text on its own teal fill - invisible.
   Buttons keep their own .btn colours. */
.article-body a:not(.btn) {
  color: var(--teal-700);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(7, 86, 79, 0.32);
  text-underline-offset: 3px;
}
.article-body a:not(.btn):hover {
  color: var(--teal-800);
  text-decoration-color: var(--teal-700);
}
.article-body strong { color: var(--ink); }
.article-body em { font-style: italic; }
.article-body hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 48px 0;
}

/* Article CTA at the bottom */
.article-cta {
  background: linear-gradient(180deg, var(--teal-50) 0%, var(--bg) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: clamp(28px, 4vw, 48px);
  margin: 8px 0 0;
  text-align: center;
}
.article-cta h3 {
  font-size: 1.4rem;
  line-height: 1.2;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
  letter-spacing: -0.022em;
}
.article-cta p {
  color: var(--ink-3);
  margin: 0 auto 22px;
  max-width: 52ch;
  line-height: 1.55;
}
.article-cta-row {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Related reading at bottom */
.article-related {
  border-top: 1px solid var(--line);
  padding: 56px 0 96px;
  background: var(--bg-2);
}
.article-related h3 {
  margin: 0 0 16px;
  color: var(--ink);
  font-weight: 600;
}
.article-related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.article-related a {
  display: block;
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  transition: border-color 180ms ease, transform 180ms ease;
}
.article-related a:hover {
  border-color: var(--teal-500);
  color: var(--teal-700);
  transform: translateX(2px);
}

/* ── iter66: editorial press treatment ─────────────────────────────── */

/* Chip stagger entrance — chips fade up one after the other */
.blog-topic-chip {
  opacity: 0;
  transform: translateY(8px);
  animation: blogChipIn 480ms cubic-bezier(.2,.9,.3,1) forwards;
}
.blog-topic-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.blog-topic-chips .blog-topic-chip:nth-child(1)  { animation-delay: 0ms; }
.blog-topic-chips .blog-topic-chip:nth-child(2)  { animation-delay: 40ms; }
.blog-topic-chips .blog-topic-chip:nth-child(3)  { animation-delay: 80ms; }
.blog-topic-chips .blog-topic-chip:nth-child(4)  { animation-delay: 120ms; }
.blog-topic-chips .blog-topic-chip:nth-child(5)  { animation-delay: 160ms; }
.blog-topic-chips .blog-topic-chip:nth-child(6)  { animation-delay: 200ms; }
.blog-topic-chips .blog-topic-chip:nth-child(7)  { animation-delay: 240ms; }
.blog-topic-chips .blog-topic-chip:nth-child(8)  { animation-delay: 280ms; }
.blog-topic-chips .blog-topic-chip:nth-child(9)  { animation-delay: 320ms; }
.blog-topic-chips .blog-topic-chip:nth-child(10) { animation-delay: 360ms; }
.blog-topic-chips .blog-topic-chip:nth-child(11) { animation-delay: 400ms; }
.blog-topic-chips .blog-topic-chip:nth-child(12) { animation-delay: 440ms; }
@keyframes blogChipIn {
  0%   { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .blog-topic-chip { animation: none; opacity: 1; transform: none; }
}

/* Featured (first) card — wider treatment */
.blog-list > li:first-child .blog-card {
  padding: 32px 28px;
  background: linear-gradient(180deg, #FFFFFF 0%, #FBFAF6 100%);
  border-radius: 18px;
  border: 1px solid rgba(15, 148, 139, 0.16);
  margin-bottom: 18px;
}
.blog-list > li:first-child .blog-card .blog-card-title {
  font-size: clamp(1.6rem, 2.4vw, 2rem);
}
.blog-list > li:first-child .blog-card::before {
  content: "FEATURED";
  display: inline-block;
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--teal-deep, #086E66);
  background: rgba(15, 148, 139, 0.10);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
  align-self: flex-start;
}
.blog-list > li:first-child .blog-card .blog-card-excerpt {
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--ink-3);
}

/* Reading-time radial — injected by blog-enhance.js */
.blog-card-meta { align-items: center; gap: 8px; }
.blog-time-ring {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-right: 4px;
  transform: rotate(-90deg);
}
.blog-time-ring circle {
  fill: none;
  stroke-width: 2;
  cx: 9px; cy: 9px; r: 7px;
}
.blog-time-ring .ring-bg {
  stroke: rgba(15, 148, 139, 0.14);
}
.blog-time-ring .ring-fg {
  stroke: var(--teal-deep, #086E66);
  stroke-linecap: round;
  stroke-dasharray: 44;
  stroke-dashoffset: 44;
  transition: stroke-dashoffset 800ms cubic-bezier(.2,.9,.3,1);
}
.blog-list .blog-card.is-revealed .blog-time-ring .ring-fg {
  stroke-dashoffset: var(--ring-target, 22);
}

/* Hover preview — first paragraph peeks above the card on hover */
.blog-card { position: relative; }
.blog-card-peek {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 8px;
  background: #1F2025;
  color: #E5E1F5;
  font-size: 13px;
  line-height: 1.55;
  padding: 14px 18px;
  border-radius: 12px;
  box-shadow: 0 20px 50px -10px rgba(20,21,26,0.40), 0 8px 18px rgba(20,21,26,0.20);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
  z-index: 20;
  max-width: 560px;
}
.blog-card-peek::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 30px;
  width: 12px; height: 12px;
  background: #1F2025;
  transform: rotate(45deg);
  border-radius: 2px;
}
.blog-card:hover .blog-card-peek {
  opacity: 1;
  transform: translateY(0);
}
@media (max-width: 720px) {
  .blog-card-peek { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .blog-card-peek { transition: none; }
}

/* ── iter73: per-topic colour-coded chips + tags ──────────────────── */
.blog-topic-chip { position: relative; padding-left: 22px; }
.blog-topic-chip::before {
  content: "";
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--chip-color, var(--teal-500, #0E8479));
  transition: transform 220ms cubic-bezier(.2, .9, .3, 1);
}
.blog-topic-chip[data-topic="all"]               { --chip-color: var(--ink-mute, #6E707A); }
.blog-topic-chip[data-topic="cardio fitness"]    { --chip-color: #F26770; }
.blog-topic-chip[data-topic="strength training"] { --chip-color: #FF8947; }
.blog-topic-chip[data-topic="sleep"]             { --chip-color: #4F8EFF; }
.blog-topic-chip[data-topic="recovery"]          { --chip-color: #9F7CE9; }
.blog-topic-chip[data-topic="nutrition"]         { --chip-color: #14A37F; }
.blog-topic-chip[data-topic="movement"]          { --chip-color: #0F948B; }
.blog-topic-chip[data-topic="brain health"]      { --chip-color: #5B2B91; }
.blog-topic-chip[data-topic="heat exposure"]     { --chip-color: #E5793C; }
.blog-topic-chip[data-topic="longevity"]         { --chip-color: var(--teal-deep, #086E66); }
.blog-topic-chip[data-topic="comparisons"]       { --chip-color: #2A5FB5; }
.blog-topic-chip[data-topic="wearables"]         { --chip-color: #6E707A; }
.blog-topic-chip:hover::before { transform: translateY(-50%) scale(1.4); }
.blog-topic-chip.is-active::before { background: #FFFFFF; /* accent dot on teal — stays white in dark */ }

/* Tag inside each card — same colour scheme */
.blog-tag[data-tag] {
  position: relative;
  padding-left: 14px;
}
.blog-tag[data-tag]::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--tag-color, var(--teal-700));
}
.blog-tag[data-tag="Nutrition"]    { --tag-color: #14A37F; color: #097a5c; }
.blog-tag[data-tag="Cardio"]       { --tag-color: #F26770; color: #b0353b; }
.blog-tag[data-tag="Strength"]     { --tag-color: #FF8947; color: #b65422; }
.blog-tag[data-tag="Sleep"]        { --tag-color: #4F8EFF; color: #2a5fb5; }
.blog-tag[data-tag="Recovery"]     { --tag-color: #9F7CE9; color: #6849c6; }
.blog-tag[data-tag="Movement"]     { --tag-color: #0F948B; color: var(--teal-deep, #086e66); }
.blog-tag[data-tag="Brain"]        { --tag-color: #5B2B91; color: #3d1b68; }
.blog-tag[data-tag="Heat"]         { --tag-color: #E5793C; color: #b65422; }
.blog-tag[data-tag="Longevity"]    { --tag-color: var(--teal-deep, #086E66); color: var(--teal-deep, #086e66); }
.blog-tag[data-tag="Comparisons"]  { --tag-color: #2A5FB5; color: #2a5fb5; }
.blog-tag[data-tag="Wearables"]    { --tag-color: #6E707A; color: #4a4a4a; }

/* ── Featured card — bigger cover treatment with abstract gradient art ── */
.blog-list > li:first-child .blog-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 32px;
  align-items: stretch;
  padding: 0;
  background: var(--card, #FFFFFF);
  overflow: hidden;
}
.blog-list > li:first-child .blog-card::before {
  content: "Featured";
  display: inline-block;
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal-deep, #086E66);
  background: rgba(255, 255, 255, 0.95);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 0;
  align-self: auto;
}
.blog-list > li:first-child .blog-card .blog-card-cover {
  position: relative;
  min-height: 220px;
  background:
    radial-gradient(120% 100% at 0% 100%, rgba(15, 148, 139, 0.18) 0%, transparent 60%),
    radial-gradient(120% 100% at 100% 0%, rgba(248, 169, 59, 0.18) 0%, transparent 55%),
    linear-gradient(180deg, #FBFAF6 0%, #F5F2EA 100%);
  overflow: hidden;
}
.blog-list > li:first-child .blog-card .blog-card-cover::before {
  /* Large serif italic numeral as decorative cover-art */
  content: "01";
  position: absolute;
  bottom: -32px;
  right: -8px;
  font-family: var(--serif, "Domine", Georgia, serif);
  font-style: italic;
  font-size: clamp(180px, 22vw, 280px);
  font-weight: 400;
  line-height: 1;
  color: rgba(15, 148, 139, 0.22);
  letter-spacing: -0.05em;
  pointer-events: none;
  user-select: none;
}
.blog-list > li:first-child .blog-card .blog-card-cover::after {
  /* "Thier" wordmark embedded in cover for branding */
  content: "Field note · 17 May";
  position: absolute;
  top: 22px;
  left: 22px;
  font-family: var(--serif, "Domine", Georgia, serif);
  font-style: italic;
  font-size: 13px;
  color: var(--teal-deep, #086E66);
  opacity: 0.75;
}
.blog-list > li:first-child .blog-card .blog-card-body {
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}
.blog-list > li:first-child .blog-card .blog-card-title {
  font-size: clamp(1.5rem, 2.2vw, 2rem);
}
.blog-list > li:first-child .blog-card .blog-card-excerpt {
  font-size: 1rem;
  color: var(--ink-3);
}
@media (max-width: 720px) {
  .blog-list > li:first-child .blog-card {
    grid-template-columns: 1fr;
  }
  .blog-list > li:first-child .blog-card .blog-card-cover {
    min-height: 160px;
  }
}


/* ══════════════════════════════════════════════════════════════
   Dark mode (Elevation B2) — the masthead bakes the cream paper
   band; give it the dark counterpart. Mirrored blocks (contract in
   main.css). ═══════════════════════════════════════════════════ */
:root[data-theme="dark"] .blog-masthead {
  background: linear-gradient(180deg, #0F1413 0%, #141A18 60%, #0F1413 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .blog-masthead {
    background: linear-gradient(180deg, #0F1413 0%, #141A18 60%, #0F1413 100%);
  }
}

/* Article links + CTA in dark (F201). Measured with CDP: prose links in
   --teal-700 (#0E8B7E in dark) sat at 4.44:1 on the dark canvas, and the
   CTA's white-on-#0E8B7E primary button at 4.19:1 - both under AA. Links
   step up to --teal-600 (~7.9:1); the button keeps white text on the
   deeper --teal-800 (~5.2:1). Mirrored blocks, identical values. */
:root[data-theme="dark"] .article-body a:not(.btn) {
  color: var(--teal-600);
  text-decoration-color: rgba(59, 188, 173, 0.40);
}
:root[data-theme="dark"] .article-body a:not(.btn):hover {
  color: #7ED6C6;
  text-decoration-color: var(--teal-600);
}
:root[data-theme="dark"] .article-cta .btn-primary { background: var(--teal-800); }
:root[data-theme="dark"] .article-cta .btn-primary:hover { background: #08665C; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .article-body a:not(.btn) {
    color: var(--teal-600);
    text-decoration-color: rgba(59, 188, 173, 0.40);
  }
  :root:not([data-theme="light"]) .article-body a:not(.btn):hover {
    color: #7ED6C6;
    text-decoration-color: var(--teal-600);
  }
  :root:not([data-theme="light"]) .article-cta .btn-primary { background: var(--teal-800); }
  :root:not([data-theme="light"]) .article-cta .btn-primary:hover { background: #08665C; }
}
