/* ============================================================
   Steady Cents — one stylesheet, no framework.
   Light is the default; dark is a token swap at the bottom.
   ============================================================ */

:root {
  --bg:          #fbfaf7;
  --bg-raised:   #ffffff;
  --bg-sunken:   #f2efe9;
  --ink:         #1b1a17;
  --ink-soft:    #56534c;
  --ink-faint:   #8a867d;
  --line:        #e3ded4;
  --line-strong: #cfc8ba;
  --accent:      #1f6f50;
  --accent-ink:  #ffffff;
  --accent-soft: #e6f0ea;
  --highlight:   #b8860b;

  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 1px 2px rgba(27, 26, 23, .04), 0 8px 24px -12px rgba(27, 26, 23, .12);
  --shadow-lg: 0 2px 4px rgba(27, 26, 23, .05), 0 20px 48px -20px rgba(27, 26, 23, .2);

  --font-sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-mono:  ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --wrap: 1120px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  line-height: 1.2;
  letter-spacing: -.015em;
  margin: 0 0 .5em;
  font-weight: 600;
}

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }

.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;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: .75rem 1.25rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------------------------------------------------------- Header */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex; align-items: center; gap: 1.25rem;
  min-height: 64px;
}

.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand__mark {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  font: 600 13px/1 var(--font-sans); letter-spacing: .02em;
}
.brand__text { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600; letter-spacing: -.02em; }

.site-nav { display: flex; gap: 1.5rem; }
.site-nav a {
  color: var(--ink-soft); text-decoration: none;
  font-size: .92rem; font-weight: 500;
  padding: .35rem 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.theme-toggle, .nav-toggle {
  display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  background: transparent; border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; color: var(--ink-soft);
}
.theme-toggle:hover, .nav-toggle:hover { border-color: var(--line-strong); color: var(--ink); }

.theme-toggle__icon {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.nav-toggle { display: none; }
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px;
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before, .nav-toggle__bars::after { content: ''; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -5px; }
.nav-toggle__bars::after  { top: 5px; }

@media (max-width: 780px) {
  .nav-toggle { display: grid; order: 3; }
  .theme-toggle { order: 2; }
  .site-nav {
    order: 4; flex-basis: 100%; flex-direction: column; gap: 0;
    display: none; padding-bottom: .75rem;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: .7rem 0; border-bottom: 1px solid var(--line); }
}

/* ---------------------------------------------------------- Hero */

.hero {
  padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2.5rem, 5vw, 3.5rem);
  background:
    radial-gradient(60rem 30rem at 15% -10%, var(--accent-soft), transparent 60%),
    linear-gradient(180deg, var(--bg-sunken), var(--bg));
  border-bottom: 1px solid var(--line);
}
.hero__inner { max-width: 46rem; }
.hero__eyebrow {
  margin: 0 0 1rem; font-size: .78rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
}
.hero__title { font-size: clamp(2.1rem, 5.5vw, 3.4rem); margin-bottom: .6em; }
.hero__title em { font-style: italic; color: var(--accent); }
.hero__lede { font-size: 1.1rem; color: var(--ink-soft); margin: 0 0 2rem; max-width: 38rem; }

.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.btn {
  display: inline-block; padding: .7rem 1.35rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--bg-raised); color: var(--ink);
  text-decoration: none; font-size: .93rem; font-weight: 500;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.hero__stats { display: flex; flex-wrap: wrap; gap: 2.5rem; margin: 2.75rem 0 0; }
.hero__stats div { margin: 0; }
.hero__stats dt { font-size: .78rem; color: var(--ink-faint); letter-spacing: .04em; text-transform: uppercase; }
.hero__stats dd { margin: .2rem 0 0; font-family: var(--font-serif); font-size: 1.9rem; font-weight: 600; }

/* ---------------------------------------------------------- Sections */

.section { padding: clamp(2.5rem, 6vw, 4rem) 0 0; }
.section__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.75rem;
  padding-bottom: .75rem; border-bottom: 1px solid var(--line);
}
.section__head h2 { font-size: 1.45rem; margin: 0; }
.section__more { font-size: .9rem; text-decoration: none; white-space: nowrap; }
.section__more:hover { text-decoration: underline; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.grid--featured { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--featured .card--featured { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .grid--featured { grid-template-columns: repeat(3, 1fr); }
  .grid--featured .card--featured { grid-column: span 3; }
}

/* ---------------------------------------------------------- Cards */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  height: 100%;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card__link { display: block; padding: 1.4rem; text-decoration: none; color: inherit; height: 100%; }

.card__meta {
  display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
  margin: 0 0 .8rem; font-size: .78rem; color: var(--ink-faint);
}
.pill {
  background: var(--accent-soft); color: var(--accent);
  padding: .2rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
}

.card__title { font-size: 1.2rem; margin: 0 0 .5rem; }
.card__excerpt { margin: 0 0 1rem; color: var(--ink-soft); font-size: .93rem; line-height: 1.6; }
.card__more { margin: 0; font-size: .82rem; font-weight: 600; color: var(--accent); }

.card--featured .card__link { padding: 2rem; }
.card--featured .card__title { font-size: clamp(1.5rem, 3vw, 2rem); }
.card--featured .card__excerpt { font-size: 1.02rem; max-width: 44rem; }

/* ---------------------------------------------------------- Topics */

.topics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .85rem; }
.topic {
  display: flex; flex-direction: column; gap: .2rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: inherit;
  transition: border-color .15s ease, background .15s ease;
}
.topic:hover { border-color: var(--accent); background: var(--accent-soft); }
.topic__name { font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600; }
.topic__count { font-size: .8rem; color: var(--ink-faint); }

/* ---------------------------------------------------------- Promise block */

.promise {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(1.75rem, 4vw, 2.75rem);
}
.promise h2 { font-size: 1.4rem; margin-bottom: 1rem; }
.promise ul { margin: 0 0 1.25rem; padding-left: 1.15rem; display: grid; gap: .5rem; }
.promise li { color: var(--ink-soft); }
.promise li strong { color: var(--ink); }
.promise__foot { margin: 0; font-size: .9rem; color: var(--ink-faint); }

/* ---------------------------------------------------------- Page heads */

.page-head { padding: clamp(2.5rem, 6vw, 4rem) 0 0; }
.page-head--narrow { max-width: 46rem; }
.page-head h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); }
.page-head__lede { font-size: 1.08rem; color: var(--ink-soft); max-width: 42rem; margin: 0 0 1.5rem; }
.page-head__updated { font-size: .85rem; color: var(--ink-faint); margin: 0; }

.breadcrumbs { font-size: .84rem; color: var(--ink-faint); margin-bottom: 1.25rem; }
.breadcrumbs a { color: var(--ink-faint); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumbs span { margin: 0 .35rem; }

/* ---------------------------------------------------------- Filter */

.filter { margin-bottom: 1rem; }
.filter input {
  width: min(100%, 28rem); padding: .7rem 1rem;
  font: inherit; font-size: .95rem;
  background: var(--bg-raised); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 999px;
}
.filter input::placeholder { color: var(--ink-faint); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  padding: .4rem .9rem; font: inherit; font-size: .84rem;
  background: transparent; color: var(--ink-soft);
  border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.empty { text-align: center; color: var(--ink-faint); padding: 3rem 0; }

/* ---------------------------------------------------------- Article */

.article { padding: clamp(2rem, 5vw, 3.5rem) 0 0; max-width: 46rem; }
.page-article .article { margin-inline: auto; }

.article__header { margin-bottom: 2rem; }
.article__header h1 { font-size: clamp(2rem, 5vw, 3rem); }
.article__standfirst {
  font-size: 1.15rem; line-height: 1.55; color: var(--ink-soft);
  font-family: var(--font-serif); margin: 0 0 1.25rem;
}
.article__meta { font-size: .85rem; color: var(--ink-faint); margin: 0; }

.toc {
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 2.5rem;
}
.toc__title {
  margin: 0 0 .6rem; font-size: .75rem; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink-faint);
}
.toc ol { margin: 0; padding-left: 1.15rem; display: grid; gap: .35rem; }
.toc a { color: var(--ink-soft); text-decoration: none; font-size: .92rem; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

/* ---------------------------------------------------------- Prose */

.prose { font-size: 1.075rem; line-height: 1.75; }
.prose > * + * { margin-top: 1.25em; }

.prose h2 { font-size: 1.65rem; margin-top: 2.5em; scroll-margin-top: 5rem; }
.prose h3 { font-size: 1.25rem; margin-top: 2em; scroll-margin-top: 5rem; }
.prose h2 + p, .prose h3 + p { margin-top: .6em; }

.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: .45em; }
.prose li::marker { color: var(--ink-faint); }

.prose strong { font-weight: 650; }

.prose blockquote {
  margin-inline: 0; padding: .25rem 0 .25rem 1.5rem;
  border-left: 3px solid var(--accent);
  font-family: var(--font-serif); font-size: 1.1rem; color: var(--ink-soft);
}
.prose blockquote p { margin: 0; }

.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }

.prose code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--bg-sunken); padding: .15em .4em;
  border-radius: 5px; border: 1px solid var(--line);
}
.prose pre {
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 1.1rem 1.25rem; overflow-x: auto;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: .87rem; line-height: 1.6; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.prose table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.prose th, .prose td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--line); }
.prose thead th {
  background: var(--bg-sunken); font-size: .8rem;
  text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft);
}
.prose tbody tr:last-child td { border-bottom: 0; }

.callout {
  border: 1px solid var(--line); border-left: 3px solid var(--highlight);
  background: var(--bg-raised); border-radius: var(--radius-sm);
  padding: 1.1rem 1.35rem; font-size: .98rem;
}
.callout > * + * { margin-top: .75em; }
.callout__title { margin: 0; font-weight: 650; font-size: .92rem; }
.callout--tip     { border-left-color: var(--accent); }
.callout--warning { border-left-color: #b4531f; }

.article__disclaimer {
  margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line);
  font-size: .85rem; color: var(--ink-faint);
}

/* ---------------------------------------------------------- Author */

.author-box {
  display: flex; gap: 1.25rem; align-items: flex-start;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.5rem; margin: 2rem 0;
}
.author-box__avatar {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 1.05rem;
}
.author-box__name { margin: 0 0 .4rem; font-weight: 650; font-size: .98rem; }
.author-box__name span { font-weight: 400; color: var(--ink-faint); }
.author-box__bio { margin: 0 0 .6rem; font-size: .92rem; color: var(--ink-soft); line-height: 1.6; }
.author-box__links { margin: 0; font-size: .85rem; color: var(--ink-faint); }

.related { margin-top: 3.5rem; }
.related h2 { font-size: 1.35rem; padding-bottom: .75rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }

/* ---------------------------------------------------------- Ad slots */

.ad-slot { margin: 2.5rem 0; }
.ad-slot[aria-hidden="true"] {
  display: grid; place-items: center; min-height: 110px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, var(--bg-sunken) 10px, var(--bg-sunken) 20px);
}
.ad-slot[aria-hidden="true"] span {
  font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint);
  background: var(--bg); padding: .3rem .7rem; border-radius: 999px;
}

/* ---------------------------------------------------------- Footer */

.site-footer {
  margin-top: clamp(4rem, 9vw, 7rem);
  padding: clamp(2.5rem, 5vw, 3.5rem) 0 2rem;
  background: var(--bg-sunken); border-top: 1px solid var(--line);
}
.site-footer__top {
  display: flex; flex-wrap: wrap; gap: 2rem;
  justify-content: space-between; align-items: flex-start;
  padding-bottom: 2rem; border-bottom: 1px solid var(--line);
}
.site-footer__brand { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 600; margin: 0 0 .4rem; }
.site-footer__tagline { margin: 0; max-width: 34rem; font-size: .9rem; color: var(--ink-soft); }
.site-footer__nav { display: grid; grid-template-columns: repeat(2, auto); gap: .5rem 2rem; }
.site-footer__nav a { color: var(--ink-soft); text-decoration: none; font-size: .88rem; }
.site-footer__nav a:hover { color: var(--accent); text-decoration: underline; }
.site-footer__legal { margin: 1.5rem 0 0; font-size: .82rem; color: var(--ink-faint); }

/* ---------------------------------------------------------- Dark */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #14150f;
    --bg-raised:   #1b1d16;
    --bg-sunken:   #191b14;
    --ink:         #eceadf;
    --ink-soft:    #adaa9c;
    --ink-faint:   #7d7a6e;
    --line:        #2d2f25;
    --line-strong: #414437;
    --accent:      #6bbf95;
    --accent-ink:  #10231a;
    --accent-soft: #1c2a22;
    --highlight:   #d8b357;
    --shadow:      0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
  }
}

:root[data-theme="dark"] {
  --bg:          #14150f;
  --bg-raised:   #1b1d16;
  --bg-sunken:   #191b14;
  --ink:         #eceadf;
  --ink-soft:    #adaa9c;
  --ink-faint:   #7d7a6e;
  --line:        #2d2f25;
  --line-strong: #414437;
  --accent:      #6bbf95;
  --accent-ink:  #10231a;
  --accent-soft: #1c2a22;
  --highlight:   #d8b357;
  --shadow:      0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
}

@media print {
  .site-header, .site-footer, .ad-slot, .related, .toc, .author-box { display: none; }
  body { background: #fff; color: #000; }
}
