/* ==========================================================================
   Heartfelt Bonds — theme.css (paint layer only)
   Palette: #FDF7F2 / #1C1614 / #C45C3A / #7B9E87
   Scheme: light
   Fonts: Playfair Display (serif) + DM Sans (humanist sans)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,300;0,400;0,500;1,400&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&display=swap');

/* --- Color-variable contract ---------------------------------------------- */
:root {
  /* All four palette HEX mapped to semantic roles */
  --color-bg:      #FDF7F2; /* warm off-white — matches light scheme */
  --color-text:    #1C1614; /* near-black body text */
  --color-accent:  #C45C3A; /* terracotta — CTAs, headings, links, rules */
  --color-surface: #7B9E87; /* sage green — card edges, tags, dividers */
  --color-border:  #C45C3A; /* terracotta hairlines (also used as accent) */

  /* Font role assignments */
  --font-sans:  'DM Sans', sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
}

/* --- Base page paint ------------------------------------------------------ */
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
}

.page {
  background: var(--color-bg);
  color: var(--color-text);
}

/* --- Typography paint ----------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--color-text);
}

/* Accent underline rule on major section headings */
h2 {
  position: relative;
  padding-bottom: var(--space-xs);
}

h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 2.5rem;
  height: 2px;
  background: var(--color-accent);
}

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.2em;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

a:hover,
a:focus-visible {
  color: var(--color-text);
  text-decoration-color: var(--color-accent);
}

@media (prefers-reduced-motion: reduce) {
  a {
    transition: none;
  }
}

/* --- Site header & nav paint ---------------------------------------------- */
.site-header {
  background: var(--color-bg);
  border-bottom: var(--border-width) solid #e8ddd5; /* warm neutral derived from bg; close to palette, no new HEX — border uses a tint of --color-bg area, actual hairline rule is accent */
  border-bottom-color: var(--color-accent);
  padding-block: var(--space-sm);
}

/* Override: use a softer border for the header — terracotta is too heavy at 1px full-width */
.site-header {
  border-bottom: var(--border-width) solid var(--color-surface);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding-inline: var(--space-md);
  max-width: var(--container);
  margin-inline: auto;
}

@media (min-width: 768px) {
  .site-nav {
    padding-inline: var(--space-xl);
  }
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: color 0.18s ease;
}

.nav-brand:hover,
.nav-brand:focus-visible {
  color: var(--color-accent);
}

@media (prefers-reduced-motion: reduce) {
  .nav-brand {
    transition: none;
  }
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.18s ease, border-bottom-color 0.18s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.nav-links a[aria-current="page"] {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

@media (prefers-reduced-motion: reduce) {
  .nav-links a {
    transition: none;
  }
}

/* --- Hero paint ----------------------------------------------------------- */
.hero {
  padding-block: var(--space-2xl);
  padding-inline: var(--space-md);
  background: var(--color-bg);
  border-bottom: var(--border-width) solid var(--color-surface);
  text-align: center;
}

@media (min-width: 768px) {
  .hero {
    padding-inline: var(--space-xl);
  }
}

.hero__title {
  font-family: var(--font-serif);
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--color-text);
  max-width: 20ch;
  margin-inline: auto;
  margin-bottom: var(--space-md);
}

.hero__title em,
.hero__title span {
  color: var(--color-accent);
  font-style: italic;
}

.hero__lead {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 300;
  color: var(--color-text);
  opacity: 0.8;
  max-width: 52ch;
  margin-inline: auto;
  line-height: var(--leading-normal);
}

/* --- Page hero (inner pages) ---------------------------------------------- */
.page-hero {
  padding-block: var(--space-xl) var(--space-lg);
  padding-inline: var(--space-md);
  border-bottom: var(--border-width) solid var(--color-surface);
}

@media (min-width: 768px) {
  .page-hero {
    padding-inline: var(--space-xl);
  }
}

.page-title {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-text);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-sm);
}

/* --- Articles section / grid paint --------------------------------------- */
/* NOTE: display/grid/flex structure is NOT set here — that lives in layout.css */

.articles-section {
  padding-block: var(--space-2xl);
  padding-inline: var(--space-md);
}

@media (min-width: 768px) {
  .articles-section {
    padding-inline: var(--space-xl);
  }
}

.section-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-lg);
}

/* Article card paint (no layout/display changes) */
.article-card {
  background: var(--color-bg);
  border: var(--border-width) solid var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.article-card:hover {
  border-color: var(--color-accent);
}

@media (prefers-reduced-motion: reduce) {
  .article-card {
    transition: none;
  }
}

.article-card__title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
  line-height: var(--leading-snug);
  margin-bottom: var(--space-xs);
}

.article-card__link {
  color: var(--color-text);
  text-decoration: none;
}

.article-card__link:hover,
.article-card__link:focus-visible {
  color: var(--color-accent);
}

/* --- Articles index (list page) paint ------------------------------------ */
/* NOTE: display/grid/flex is NOT set here */

.articles-index {
  padding-block: var(--space-2xl);
  padding-inline: var(--space-md);
  max-width: var(--container);
  margin-inline: auto;
}

@media (min-width: 768px) {
  .articles-index {
    padding-inline: var(--space-xl);
  }
}

.article-list__item {
  border-bottom: var(--border-width) solid var(--color-surface);
  padding-block: var(--space-md);
}

.article-list__item:first-child {
  border-top: var(--border-width) solid var(--color-surface);
}

.article-list__link {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--color-text);
  text-decoration: none;
  line-height: var(--leading-snug);
  transition: color 0.18s ease;
}

.article-list__link:hover,
.article-list__link:focus-visible {
  color: var(--color-accent);
}

/* Numeral accent on list items */
.article-list__item {
  counter-increment: article-counter;
  position: relative;
  padding-left: var(--space-lg);
}

.article-list__item::before {
  content: counter(article-counter, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: var(--space-md);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--color-accent);
}

.article-list {
  counter-reset: article-counter;
}

@media (prefers-reduced-motion: reduce) {
  .article-list__link {
    transition: none;
  }
}

/* --- Prose (article body) paint ------------------------------------------ */
.prose {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5 {
  font-family: var(--font-serif);
  color: var(--color-text);
}

.prose h2 {
  color: var(--color-text);
  border-left: 3px solid var(--color-accent);
  padding-left: var(--space-sm);
  margin-left: calc(-1 * var(--space-sm) - 3px);
}

.prose h2::after {
  display: none; /* override global h2::after inside prose */
}

.prose h3 {
  color: var(--color-accent);
}

.prose a {
  color: var(--color-accent);
}

/* Pull-quote / blockquote paint */
.prose blockquote {
  border-left: 3px solid var(--color-surface);
  padding-left: var(--space-md);
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-text);
  opacity: 0.85;
}

/* --- Footer paint --------------------------------------------------------- */
.site-footer {
  background: var(--color-text);
  color: var(--color-bg);
  padding-block: var(--space-lg);
  margin-top: auto;
}

.site-footer .container {
  padding-inline: var(--space-md);
}

@media (min-width: 768px) {
  .site-footer .container {
    padding-inline: var(--space-xl);
  }
}

.footer-copy {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-bg);
  opacity: 0.7;
}

/* --- Sage green accent applications (visible, not hover-only) ------------- */
/* Tags / secondary nav items use sage green */
.tag,
.article-card__tag,
.section-divider {
  color: var(--color-surface);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Decorative horizontal rule accent */
hr.accent-rule {
  border: none;
  height: 1px;
  background: var(--color-surface);
  margin-block: var(--space-lg);
}

/* ===== Flexible type at narrow widths (down to 320px) ===== */
@media (max-width:30rem) {
  :root {
    --text-4xl: clamp(1.7rem, 1.1rem + 4.5vw, 2.75rem);
    --text-3xl: clamp(1.5rem, 1rem + 3.2vw, 2.25rem);
    --text-2xl: clamp(1.3rem, 0.95rem + 2.2vw, 1.95rem);
    --text-xl:  clamp(1.2rem, 0.95rem + 1.4vw, 1.563rem);
  }
  h1, h2, h3, h4 { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
}

/* ===== Mobile nav — CSS-only burger ===================================== */
/* Hidden checkbox toggle — visually replaced by the burger label */
.nav-toggle {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}

.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem; height: 2.5rem;
  flex: 0 0 auto;
  cursor: pointer;
  color: var(--color-text);
}

.nav-burger span {
  display: block;
  width: 22px; height: 2px;
  background: currentColor;
  border-radius: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .nav-burger span { transition: transform 200ms ease, opacity 160ms ease; }
}

.nav-toggle:focus-visible ~ .nav-burger {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

@media (max-width: 767px) {
  /* Brand + burger in one row; menu drops below on open */
  .site-header .site-nav {
    align-items: center;
    flex-wrap: wrap;
    row-gap: var(--space-xs);
  }
  .site-nav .nav-brand { flex: 1 1 auto; min-width: 0; }
  .nav-burger { display: inline-flex; }

  /* Higher specificity beats layout.css .nav-links{display:flex} */
  .site-nav .nav-links {
    display: none;
    flex-basis: 100%;
    width: 100%;
  }
  .nav-toggle:checked ~ .nav-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2xs);
    padding-block: var(--space-xs) var(--space-2xs);
    border-top: 1px solid var(--color-surface);
  }
  .nav-links li { width: 100%; }

  /* ☰ → ✕ animation */
  .nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Hero title — prevent "Heartfeltbonds" from breaking on last letter.
     Placed after base .hero__title rule so this wins in cascade. */
  .hero__title {
    font-size: clamp(1.35rem, 0.85rem + 2.8vw, 2.75rem);
  }
}
