/*
Theme Name: Site Blog Child
Theme URI: https://example.com
Description: Child theme for the editorial blog design (pine/ochre design system, article + CTA components). Built on top of Kadence.
Author: Your Name
Template: kadence
Version: 1.0.1
Text Domain: site-blog-child
*/

/* =========================================================
   DESIGN TOKENS
   Paste into child theme style.css or Appearance > Custom CSS
   ========================================================= */
:root {
  --ink: #1B2420;
  --pine: #1F4E44;
  --pine-dark: #163A32;
  --ochre: #C98A2C;
  --ochre-dark: #A96F1D;
  --paper: #FBF9F4;
  --surface: #FFFFFF;
  --border: #E3DED0;
  --muted: #5B6560;
  --success-bg: #EEF3EC;

  --font-headline: "Source Serif 4", "Lora", Georgia, serif;
  --font-body: "Public Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-card: 8px;
  --radius-pill: 999px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;

  --content-max: 720px;
  --container-max: 1280px;
}

* { box-sizing: border-box; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
}

@media (min-width: 768px) {
  body { font-size: 18px; }
}

h1, h2, h3, h4 {
  font-family: var(--font-headline);
  color: var(--ink);
  line-height: 1.2;
  font-weight: 700;
  margin: 0 0 var(--space-2);
}

h1 { font-size: clamp(1.9rem, 1.5rem + 2vw, 3rem); }
h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 2rem); margin-top: var(--space-4); }
h3 { font-size: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem); margin-top: var(--space-3); }

a { color: var(--pine); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--pine-dark); }

/* Visible focus state everywhere, replaces default outline removal */
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--ochre);
  outline-offset: 2px;
}

.container { max-width: var(--container-max); margin: 0 auto; padding: 0 var(--space-2); }

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
}
.site-logo { font-family: var(--font-headline); font-weight: 700; font-size: 1.4rem; color: var(--ink); text-decoration: none; }

.site-nav { display: none; gap: var(--space-3); }
@media (min-width: 900px) { .site-nav { display: flex; } }

.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { border-color: var(--ochre); color: var(--pine); }

.header-actions { display: flex; align-items: center; gap: var(--space-2); }
.icon-btn {
  background: none; border: none; cursor: pointer; padding: 0.5rem;
  min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center;
}

.mobile-menu-toggle { display: flex; }
@media (min-width: 900px) { .mobile-menu-toggle { display: none; } }

/* Mobile slide-in panel */
.mobile-menu {
  position: fixed; inset: 0; background: var(--surface); z-index: 50;
  transform: translateX(100%); transition: transform 0.2s ease;
  padding: var(--space-3);
}
.mobile-menu.is-open { transform: translateX(0); }
.mobile-menu a { display: block; padding: var(--space-2) 0; font-size: 1.1rem; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--ink); }

/* =========================================================
   BUTTONS & PILLS
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill);
  padding: 0.85rem 1.75rem;
  font-weight: 600;
  font-size: 1rem;
  min-height: 44px;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.btn--primary { background: var(--ochre); color: #fff; }
.btn--primary:hover { background: var(--ochre-dark); color: #fff; }
.btn--secondary { background: transparent; color: var(--pine); border: 1px solid var(--pine); }

.category-pill {
  display: inline-block;
  background: var(--pine);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  text-decoration: none;
}

/* =========================================================
   ARTICLE CARDS (blog index, category, related, search)
   ========================================================= */
.card-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}
@media (min-width: 768px) { .card-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: 1fr 1fr 1fr; } }

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.article-card img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block;
}
.article-card__body { padding: var(--space-2); display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.article-card__title {
  font-family: var(--font-headline); font-size: 1.15rem; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.article-card__title a { color: var(--ink); text-decoration: none; }
.article-card__excerpt { color: var(--muted); font-size: 0.95rem; margin: 0; }
.article-card__meta { color: var(--muted); font-size: 0.85rem; margin-top: auto; }
.article-card__readmore { font-weight: 600; color: var(--pine); text-decoration: none; font-size: 0.9rem; }
.article-card__readmore::after { content: " \2192"; }

/* =========================================================
   HERO (homepage lead story)
   ========================================================= */
.hero {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
  padding: var(--space-4) 0;
}
@media (min-width: 1024px) { .hero { grid-template-columns: 7fr 5fr; } }

.hero__feature img { width: 100%; border-radius: var(--radius-card); aspect-ratio: 16/10; object-fit: cover; }
.hero__feature .category-pill { margin: var(--space-2) 0 0.5rem; }
.hero__feature h1, .hero__feature h2 { margin-top: 0.25rem; }
.hero__dek { color: var(--muted); font-size: 1.05rem; }

.hero__rail-title { font-family: var(--font-body); font-weight: 700; font-size: 0.9rem; color: var(--muted); margin-bottom: var(--space-1); }
.hero__rail-item { border-bottom: 1px solid var(--border); padding: var(--space-1) 0; }
.hero__rail-item a { color: var(--ink); text-decoration: none; font-weight: 600; }
.hero__rail-item .meta { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 0.2rem; }

/* =========================================================
   ARTICLE PAGE
   ========================================================= */
.article {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-3) var(--space-2) var(--space-5);
}
.breadcrumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: var(--space-2); }
.breadcrumbs a { color: var(--muted); }

.article__meta { color: var(--muted); font-size: 0.9rem; margin: var(--space-1) 0 var(--space-3); }

.article__featured-img { width: 100%; border-radius: var(--radius-card); margin-bottom: var(--space-3); }

.article__body p { margin: 0 0 1.25em; }
.article__body ul, .article__body ol { margin: 0 0 1.25em; padding-left: 1.4em; }
.article__body table { width: 100%; border-collapse: collapse; margin: 0 0 1.5em; }
.article__body th, .article__body td { border: 1px solid var(--border); padding: 0.6rem 0.8rem; text-align: left; }
.article__body th { background: var(--paper); }

/* Tables scroll horizontally on mobile instead of squeezing columns */
.table-wrap { overflow-x: auto; margin-bottom: 1.5em; }

/* Table of contents */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-3) 0;
}
.toc__title { font-weight: 700; margin-bottom: 0.5rem; font-size: 0.95rem; }
.toc ol { margin: 0; padding-left: 1.2em; }
.toc a { color: var(--pine); text-decoration: none; }

/* Neutral info callout — never uses alarm colors */
.callout {
  background: var(--success-bg);
  border-left: 4px solid var(--pine);
  border-radius: 6px;
  padding: var(--space-2) var(--space-3);
  margin: var(--space-3) 0;
}
.callout p:last-child { margin-bottom: 0; }

/* =========================================================
   AFFILIATE CTA COMPONENT
   ========================================================= */
.affiliate-cta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-3);
  margin: var(--space-4) 0;
  text-align: left;
}
.affiliate-cta__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.affiliate-cta__context { margin: 0 0 var(--space-2); color: var(--ink); }
.affiliate-cta .btn { width: 100%; }
@media (min-width: 600px) { .affiliate-cta .btn { width: auto; } }

/* Disclosure — quiet, small */
.disclosure {
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  padding-top: var(--space-2);
  margin-top: var(--space-4);
}
.disclosure a { color: var(--muted); text-decoration: underline; }

/* =========================================================
   FAQ ACCORDION
   ========================================================= */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item__question {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: var(--space-2) 0;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink);
}
.faq-item__icon { transition: transform 0.15s ease; flex-shrink: 0; margin-left: var(--space-2); }
.faq-item[open] .faq-item__icon { transform: rotate(45deg); }
.faq-item__answer { padding: 0 0 var(--space-2); color: var(--muted); }

/* =========================================================
   AUTHOR BOX
   ========================================================= */
.author-box {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  background: var(--paper);
  border-radius: var(--radius-card);
  padding: var(--space-2);
  margin-top: var(--space-4);
}
.author-box img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.author-box__name { font-weight: 700; margin: 0; }
.author-box__bio { color: var(--muted); font-size: 0.9rem; margin: 0; }

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  background: var(--ink);
  color: #E8E6DF;
  padding: var(--space-5) 0 var(--space-3);
  margin-top: var(--space-5);
}
.site-footer a { color: #E8E6DF; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}
@media (min-width: 768px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-grid h4 { color: #fff; font-family: var(--font-body); font-size: 0.9rem; margin-bottom: var(--space-1); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 0.4rem; font-size: 0.9rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.15); margin-top: var(--space-3); padding-top: var(--space-2); font-size: 0.8rem; color: #B8B5AC; }

/* =========================================================
   ACCESSIBILITY UTILITIES
   ========================================================= */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* =========================================================
   FORCE OVERRIDE — safety net
   Kadence (and most block themes) inject their own global
   colors/fonts via theme.json as an inline stylesheet. Depending
   on caching or load order, that can outrank the plain selectors
   above. These rules use !important specifically so the brand
   colors/fonts always win, regardless of theme.json or cache
   timing. Keep this block at the very end of the file.
   ========================================================= */
body,
.wp-site-blocks {
  background: var(--paper) !important;
  color: var(--ink) !important;
  font-family: var(--font-body) !important;
}

h1, h2, h3, h4,
.wp-block-post-title,
.entry-title,
.article-card__title {
  font-family: var(--font-headline) !important;
}

a,
.wp-block-post-title a,
.entry-title a {
  color: var(--pine) !important;
}

.category-pill,
.wp-block-post-terms a,
.entry-category a {
  background: var(--pine) !important;
  color: #fff !important;
  border-radius: 4px !important;
}

.btn--primary,
.wp-block-button__link {
  background: var(--ochre) !important;
  color: #fff !important;
  border-radius: var(--radius-pill) !important;
}

.article-card,
.wp-block-query .wp-block-post {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-card) !important;
}
