/*
Theme Name: Market Truth
Theme URI: https://market-truth.com
Author: Market Truth
Description: Standalone editorial theme for Market Truth. Archetype H (Storyteller): tall left-aligned hero on tinted paper, alternating section tints, pull-quote rhythm. No parent theme.
Version: 1.0.0
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: markettruth
*/

/* ============================================================
   1. TOKENS
   ============================================================ */
:root {
  /* Warm paper ground. Every health competitor is blue or green;
     this site reads as an investigative publication instead. */
  --paper:        #FBF7F0;
  --paper-2:      #F3EDE3;   /* header + hero tint */
  --paper-3:      #EFEEE8;   /* cooler alternating section */
  --card:         #FFFFFF;

  --ink:          #1C1A17;
  --ink-2:        #4A453D;
  --ink-3:        #6B6459;

  --accent:       #9E2B25;   /* oxblood: scrutiny, not reassurance */
  --accent-deep:  #7A1F1A;
  --accent-tint:  #F7E9E6;

  --line:         #DED4C5;
  --line-2:       #C4B79F;

  /* Evidence verdict scale — only used inside verdict badges */
  --v-strong:     #2E6B4E;
  --v-strong-bg:  #E6F0EA;
  --v-mixed:      #9A6510;
  --v-mixed-bg:   #F8EEDC;
  --v-weak:       #9E2B25;
  --v-weak-bg:    #F7E9E6;

  --focus:        #1C1A17;

  --font-display: "Zilla Slab", "Rockwell", Georgia, serif;
  --font-body:    "Libre Franklin", "Helvetica Neue", Arial, sans-serif;

  /* 4px base */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;

  --wrap: 1140px;
  --measure: 68ch;
  --radius: 3px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:       #191713;
    --paper-2:     #211E18;
    --paper-3:     #1E1C17;
    --card:        #232019;
    --ink:         #F0EADF;
    --ink-2:       #C7BFB0;
    --ink-3:       #9C9384;
    --accent:      #E2837A;
    --accent-deep: #F0A79F;
    --accent-tint: #33211E;
    --line:        #3A342B;
    --line-2:      #4E4739;
    --v-strong:    #7FC5A2; --v-strong-bg: #1B2A22;
    --v-mixed:     #DCAE5C; --v-mixed-bg:  #2C2418;
    --v-weak:      #E2837A; --v-weak-bg:   #33211E;
    --focus:       #F0EADF;
  }
}

/* ============================================================
   2. RESET + BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
figure { margin: var(--s6) 0; }
figcaption {
  font-size: 14px; color: var(--ink-3); margin-top: var(--s3);
  padding-left: var(--s3); border-left: 2px solid var(--line-2);
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-deep); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.2;
  font-weight: 600;
  margin: 0 0 var(--s4);
  letter-spacing: -0.005em;
}
h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); line-height: 1.12; font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2.05rem); margin-top: var(--s8); }
h3 { font-size: clamp(1.18rem, 2vw, 1.4rem); margin-top: var(--s6); }
h4 { font-size: 1.06rem; margin-top: var(--s5); }
p  { margin: 0 0 var(--s5); }
strong { font-weight: 600; color: var(--ink); }

ul, ol { margin: 0 0 var(--s5); padding-left: var(--s5); }
li { margin-bottom: var(--s2); }

blockquote {
  margin: var(--s7) 0;
  padding: var(--s5) 0 var(--s5) var(--s6);
  border-left: 3px solid var(--accent);
  font-family: var(--font-display);
  font-size: 1.22rem;
  line-height: 1.45;
  color: var(--ink);
}
blockquote p:last-child { margin-bottom: 0; }

code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: .9em; background: var(--paper-2);
  padding: 2px 5px; border-radius: 2px; border: 1px solid var(--line);
}

hr { border: 0; border-top: 1px solid var(--line); margin: var(--s8) 0; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--ink); color: var(--paper);
  padding: var(--s3) var(--s5); text-decoration: none;
}
.skip-link:focus { left: var(--s4); top: var(--s4); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s5); }
.narrow { max-width: 760px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ============================================================
   3. HEADER — archetype H: logo left, nav right, tinted (not white)
   ============================================================ */
.site-header {
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s5); min-height: 76px;
}
.brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand-text { font-family: var(--font-display); font-weight: 700; font-size: 1.32rem; color: var(--ink); letter-spacing: -0.01em; white-space: nowrap; }
.brand-text em { font-style: normal; color: var(--accent); }
.brand:hover .brand-text { color: var(--ink); }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: var(--s2) var(--s3);
  font: inherit; font-size: 15px; color: var(--ink); cursor: pointer;
  min-height: 44px; min-width: 48px;
}
.main-nav ul { display: flex; gap: var(--s4); list-style: none; margin: 0; padding: 0; align-items: center; }
.main-nav li { margin: 0; }
.main-nav a {
  color: var(--ink-2); text-decoration: none;
  font-size: 15px; font-weight: 500; letter-spacing: .01em;
  padding: var(--s3) 2px; display: inline-block; min-height: 44px; line-height: 26px;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover, .main-nav .current-menu-item > a { color: var(--accent); border-bottom-color: var(--accent); }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .main-nav { display: none; width: 100%; order: 3; }
  .main-nav.is-open { display: block; }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding-bottom: var(--s4); }
  .main-nav li { border-top: 1px solid var(--line); }
  .main-nav a { display: block; padding: var(--s4) 0; }
  .site-header .wrap { flex-wrap: wrap; padding-top: var(--s3); padding-bottom: var(--s3); }
}

/* ============================================================
   4. HERO — archetype H: tall left stack, right ruled pattern
   ============================================================ */
.hero {
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
/* Decorative measurement rules on the right edge — not a gradient, not a blob */
.hero::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0;
  width: 26%; pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      var(--line-2) 0 1px,
      transparent 1px 22px
    );
  -webkit-mask-image: linear-gradient(to left, #000 0%, transparent 92%);
  mask-image: linear-gradient(to left, #000 0%, transparent 92%);
  opacity: .8;
}
@media (max-width: 860px) { .hero::after { display: none; } }

.hero-inner { padding: var(--s9) 0 var(--s8); max-width: 720px; position: relative; z-index: 1; }
.eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-tint);
  border: 1px solid var(--line);
  padding: var(--s2) var(--s3); border-radius: var(--radius);
  margin-bottom: var(--s5);
}
.hero h1 { margin-bottom: var(--s5); max-width: 16ch; }
.hero-capsule {
  font-size: 1.16rem; line-height: 1.62; color: var(--ink-2);
  max-width: 60ch; margin-bottom: var(--s6);
  padding-left: var(--s5); border-left: 3px solid var(--accent);
}
.hero-meta { font-size: 14px; color: var(--ink-3); margin-top: var(--s5); }

.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  background: var(--accent); color: #FFF7F5;
  font-family: var(--font-body); font-weight: 600; font-size: 16px;
  padding: var(--s4) var(--s6); border: 1px solid var(--accent-deep);
  border-radius: var(--radius); text-decoration: none;
  min-height: 48px; cursor: pointer;
}
.btn:hover { background: var(--accent-deep); color: #FFF7F5; text-decoration: none; }
.btn-ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line-2);
}
.btn-ghost:hover { background: var(--paper); color: var(--ink); border-color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn { color: #1A1512; }
}

/* ============================================================
   5. SECTION RHYTHM — alternating tints (archetype H)
   ============================================================ */
.section { padding: var(--s9) 0; border-bottom: 1px solid var(--line); }
.section-warm { background: var(--paper); }
.section-cool { background: var(--paper-3); }
.section-head { max-width: 62ch; margin-bottom: var(--s7); }
.section-head h2 { margin-top: 0; }
.section-head p { color: var(--ink-2); margin-bottom: 0; }
.section-kicker {
  font-size: 12px; font-weight: 600; letter-spacing: .13em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--s3);
}

/* Pull quote between sections */
.pullquote {
  background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: var(--s8) 0;
}
.pullquote p {
  font-family: var(--font-display); font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  line-height: 1.4; max-width: 30ch; margin: 0; color: var(--ink);
}
.pullquote cite { display: block; font-family: var(--font-body); font-style: normal; font-size: 14px; color: var(--ink-3); margin-top: var(--s4); }

/* ============================================================
   6. POST LISTS + PILLAR CARDS
   ============================================================ */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list > li { border-top: 1px solid var(--line); }
.post-list > li:last-child { border-bottom: 1px solid var(--line); }

.post-row {
  display: grid; grid-template-columns: 190px 1fr; gap: var(--s6);
  padding: var(--s6) 0; align-items: start;
}
.post-row .thumb { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper-2); }
.post-row .thumb img { width: 100%; aspect-ratio: 40 / 21; object-fit: cover; }
.post-row h3 { margin: 0 0 var(--s3); font-size: 1.26rem; line-height: 1.25; }
.post-row h3 a { color: var(--ink); text-decoration: none; }
.post-row h3 a:hover { color: var(--accent); text-decoration: underline; }
.post-row p { margin: 0 0 var(--s3); color: var(--ink-2); font-size: 15.5px; }
.post-meta { font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.post-meta a { color: var(--ink-3); }
@media (max-width: 700px) {
  .post-row { grid-template-columns: 1fr; gap: var(--s4); }
  .post-row .thumb { max-width: 100%; }
}

.pillar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s5); }
.pillar {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s6); display: flex; flex-direction: column;
  border-top: 3px solid var(--accent);
}
.pillar h3 { margin: 0 0 var(--s3); font-size: 1.16rem; }
.pillar h3 a { color: var(--ink); text-decoration: none; }
.pillar h3 a:hover { color: var(--accent); text-decoration: underline; }
.pillar p { color: var(--ink-2); font-size: 15px; margin-bottom: var(--s4); flex: 1; }
.pillar .more { font-size: 14px; font-weight: 600; }

/* ============================================================
   7. TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; margin: var(--s6) 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 15.5px; }
caption { caption-side: top; text-align: left; padding: var(--s4) var(--s5) 0; font-size: 14px; color: var(--ink-3); }
th, td { padding: var(--s4) var(--s5); text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  background: var(--paper-2); font-family: var(--font-body); font-weight: 600; font-size: 13px;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2);
  border-bottom: 1px solid var(--line-2);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--paper-2) 45%, transparent); }

/* Verdict badges */
.verdict { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 3px var(--s3); border-radius: var(--radius); white-space: nowrap; border: 1px solid currentColor; }
.verdict-strong { color: var(--v-strong); background: var(--v-strong-bg); }
.verdict-mixed  { color: var(--v-mixed);  background: var(--v-mixed-bg); }
.verdict-weak   { color: var(--v-weak);   background: var(--v-weak-bg); }

/* ============================================================
   8. ARTICLE
   ============================================================ */
.article-head { background: var(--paper-2); border-bottom: 1px solid var(--line); padding: var(--s8) 0 var(--s7); }
.article-head h1 { max-width: 20ch; }
.article-head .article-standfirst { font-size: 1.1rem; color: var(--ink-2); max-width: 62ch; margin-bottom: var(--s5); }

.breadcrumbs { font-size: 13.5px; color: var(--ink-3); margin-bottom: var(--s5); }
.breadcrumbs a { color: var(--ink-3); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs span[aria-current] { color: var(--ink-2); }

.byline { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; font-size: 14.5px; color: var(--ink-2); }
.byline img { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-2); }
.byline a { font-weight: 600; }
.byline .reviewed { color: var(--ink-3); font-size: 13.5px; }

.entry { padding: var(--s8) 0 var(--s9); }
.entry-content { max-width: var(--measure); }
.entry-content > h2:first-child { margin-top: 0; }

/* Answer capsule */
.answer-capsule {
  background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: var(--s5) var(--s6); border-radius: var(--radius);
  margin: 0 0 var(--s7);
}
.answer-capsule .label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent); display: block; margin-bottom: var(--s2);
}
.answer-capsule p { margin: 0; font-size: 1.06rem; line-height: 1.6; }

/* Table of contents */
.toc {
  background: var(--paper-3); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s5) var(--s6); margin: 0 0 var(--s7); max-width: var(--measure);
}
.toc h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; margin: 0 0 var(--s3); font-family: var(--font-body); color: var(--ink-3); }
.toc ol { margin: 0; padding-left: var(--s5); font-size: 15px; }
.toc li { margin-bottom: var(--s2); }
.toc a { color: var(--ink-2); }
.toc a:hover { color: var(--accent); }

/* Info box / callout inside content */
.callout {
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s5) var(--s6); margin: var(--s6) 0;
}
.callout > :last-child { margin-bottom: 0; }
.callout .callout-title { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; margin-bottom: var(--s3); display: block; }

/* FAQ — conversation flow, not accordion cards */
.faq { max-width: var(--measure); margin: var(--s8) 0 0; }
.faq h2 { margin-top: 0; }
.faq-item { border-top: 1px solid var(--line); padding: var(--s5) 0; }
.faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-q { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; margin: 0 0 var(--s3); color: var(--ink); }
.faq-a { margin: 0; color: var(--ink-2); }

/* Sources */
.sources { max-width: var(--measure); margin: var(--s8) 0 0; border-top: 2px solid var(--ink); padding-top: var(--s5); }
.sources h2 { font-size: 1.1rem; margin: 0 0 var(--s4); }
.sources ol { font-size: 14.5px; color: var(--ink-2); padding-left: var(--s5); }
.sources .checked { font-size: 13px; color: var(--ink-3); margin-top: var(--s4); }

/* CTA card */
.cta-card {
  background: var(--paper-2); border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: var(--s6);
  margin: var(--s8) 0 0; max-width: var(--measure);
}
.cta-card h2 { margin: 0 0 var(--s3); font-size: 1.25rem; }
.cta-card p { color: var(--ink-2); margin-bottom: var(--s5); }

/* Disclosure */
.disclosure {
  background: var(--accent-tint); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s4) var(--s5);
  font-size: 14px; color: var(--ink-2); margin: 0 0 var(--s6); max-width: var(--measure);
}
.disclosure strong { color: var(--ink); }

/* Author bio card */
.author-card {
  display: grid; grid-template-columns: 96px 1fr; gap: var(--s5);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s6); margin: var(--s8) 0 0; max-width: var(--measure);
}
.author-card img { width: 96px; height: 96px; border-radius: 50%; border: 1px solid var(--line-2); }
.author-card h2 { margin: 0 0 var(--s2); font-size: 1.15rem; }
.author-card p { margin: 0 0 var(--s3); font-size: 15px; color: var(--ink-2); }
@media (max-width: 560px) { .author-card { grid-template-columns: 1fr; } }

/* Related */
.related { margin-top: var(--s9); border-top: 1px solid var(--line); padding-top: var(--s7); }
.related h2 { margin-top: 0; font-size: 1.3rem; }

/* ============================================================
   9. AUTHOR PAGE
   ============================================================ */
.author-hero { background: var(--paper-2); border-bottom: 1px solid var(--line); padding: var(--s8) 0; }
.author-hero-inner { display: grid; grid-template-columns: 140px 1fr; gap: var(--s7); align-items: start; max-width: 900px; }
.author-hero img { width: 140px; height: 140px; border-radius: 50%; border: 1px solid var(--line-2); }
.author-hero h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); margin-bottom: var(--s3); }
.author-role { font-size: 15px; color: var(--accent); font-weight: 600; margin-bottom: var(--s4); }
.author-hero p { color: var(--ink-2); max-width: 62ch; }
.credentials { list-style: none; padding: 0; margin: var(--s5) 0 0; font-size: 15px; }
.credentials li { padding-left: var(--s5); position: relative; color: var(--ink-2); }
.credentials li::before { content: "—"; position: absolute; left: 0; color: var(--accent); }
@media (max-width: 700px) { .author-hero-inner { grid-template-columns: 1fr; gap: var(--s5); } }

/* ============================================================
   10. TRUST ROW + FOOTER
   ============================================================ */
.trust-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--s6); }
.trust-item h3 { font-size: 1.02rem; margin: 0 0 var(--s2); }
.trust-item p { font-size: 14.5px; color: var(--ink-2); margin: 0; }

.site-footer { background: var(--paper-2); border-top: 1px solid var(--line-2); padding: var(--s8) 0 var(--s6); font-size: 14.5px; }
.footer-cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: var(--s7); margin-bottom: var(--s7); }
.footer-cols h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; font-family: var(--font-body); color: var(--ink-3); margin: 0 0 var(--s4); }
.footer-cols ul { list-style: none; padding: 0; margin: 0; }
.footer-cols li { margin-bottom: var(--s3); }
.footer-cols a { color: var(--ink-2); text-decoration: none; }
.footer-cols a:hover { color: var(--accent); text-decoration: underline; }
.footer-about p { color: var(--ink-2); margin-bottom: var(--s4); font-size: 14.5px; }
.site-disclaimer {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: var(--s5) 0; color: var(--ink-2); font-size: 13.5px; margin-bottom: var(--s5);
}
.site-disclaimer strong { color: var(--ink); }
.footer-bottom { display: flex; justify-content: space-between; gap: var(--s5); flex-wrap: wrap; color: var(--ink-3); font-size: 13.5px; }
@media (max-width: 860px) { .footer-cols { grid-template-columns: 1fr 1fr; gap: var(--s6); } }
@media (max-width: 520px) { .footer-cols { grid-template-columns: 1fr; } }

/* ============================================================
   11. ARCHIVE / SEARCH / 404
   ============================================================ */
.archive-head { background: var(--paper-2); border-bottom: 1px solid var(--line); padding: var(--s8) 0; }
.archive-head h1 { margin-bottom: var(--s4); }
.archive-head p { color: var(--ink-2); max-width: 62ch; margin: 0; }

.pagination { display: flex; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s7); }
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 48px; min-height: 48px; padding: 0 var(--s3);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  text-decoration: none; color: var(--ink-2); font-size: 15px;
}
.pagination .page-numbers.current { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pagination .page-numbers:hover { border-color: var(--accent); color: var(--accent); }

.search-form { display: flex; gap: var(--s3); max-width: 460px; margin: var(--s5) 0; }
.search-form input[type="search"] {
  flex: 1; padding: var(--s3) var(--s4); font: inherit; font-size: 16px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--card); color: var(--ink); min-height: 48px;
}
.search-form button { min-height: 48px; }
