/*
Theme Name: Ledger
Description: Editorial theme for charliewellbeing.com. Standalone — no parent.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.8
License: GPLv2 or later
Text Domain: ledger
*/

/* ===========================================================================
   Ledger — every rule the site uses lives in this file.

   Direction: a newsroom desk, not a casino. Heavy sans headlines over a serif
   reading column, warm paper, one maple accent, a hairline rule down the left
   of each story.

   Floors this theme guarantees (they were the round-2 defects):
   - root font-size declared here, so rem never gets rescaled by anyone else
   - nothing below 14px anywhere
   - the reading measure is set in ONE place (--measure on .piece__body)
   - one author card, square portrait, inside the content column
   =========================================================================== */

:root {
  --paper:   #fbfaf7;
  --card:    #ffffff;
  --ink:     #14161a;
  --body:    #33363d;
  --muted:   #5f636b;          /* 6.0:1 on paper */
  --rule:    #e2ded4;
  --rule-2:  #cdc7b8;
  --maple:   #a63d2a;          /* 6.1:1 on white */
  --maple-d: #7d2c1d;

  --measure: 66ch;
  --shell:   1140px;
  --gap:     1.5rem;

  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}

/* --- reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;             /* declared, never inherited from elsewhere */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-wrap: break-word;
  background: var(--paper);
  color: var(--body);
  font-family: var(--serif);
  font-size: 1.0625rem;        /* 17px */
  line-height: 1.7;
  overflow-x: hidden;
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--maple); }
a:hover { color: var(--maple-d); }
a:focus-visible, button:focus-visible, input:focus-visible, label:focus-visible {
  outline: 2px solid var(--maple);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.32;
  letter-spacing: -0.022em;
  margin: 0;
}

p, ul, ol { margin: 0 0 1.35rem; }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.skip {
  position: absolute;
  left: -9999px;
  background: var(--ink);
  color: #fff;
  padding: .75rem 1rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.skip:focus { left: 1rem; top: 1rem; z-index: 50; }

/* --- masthead ------------------------------------------------------------- */
.masthead {
  background: var(--ink);
  border-bottom: 3px solid var(--maple);
}
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 76px;
  flex-wrap: wrap;
}
.masthead__title {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.3;
  /* a long, keyword-stuffed site name would otherwise fill the whole bar */
  max-width: 30ch;
}
.masthead__title a { color: #f7f5f0; text-decoration: none; }
.masthead__title a:hover { color: #fff; }
.masthead__logo img { max-height: 44px; width: auto; }

/* --- navigation: CSS-only burger, no JavaScript --------------------------- */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }

.nav-burger {
  display: none;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  color: #f7f5f0;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.5;
  padding: .5rem .25rem;
}
.nav-burger__bars,
.nav-burger__bars::before,
.nav-burger__bars::after {
  display: block;
  width: 22px;
  height: 2px;
  background: #f7f5f0;
  content: "";
}
.nav-burger__bars { position: relative; }
.nav-burger__bars::before { position: absolute; top: -7px; }
.nav-burger__bars::after  { position: absolute; top: 7px; }

.nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__list a {
  display: block;
  padding: .7rem .9rem;
  color: #ddd8d0;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
}
.nav__list a:hover { color: #fff; box-shadow: inset 0 -3px 0 var(--maple); }
.nav__list .current-menu-item > a { color: #fff; box-shadow: inset 0 -3px 0 var(--maple); }

/* --- page furniture ------------------------------------------------------- */
main { padding-block: 2.75rem 3.5rem; }

.lede { margin-bottom: 2.5rem; }
.lede__title {
  font-size: clamp(1.6rem, 3.4vw, 2.1rem);
  font-weight: 800;
  line-height: 1.32;
  padding-bottom: .8rem;
  border-bottom: 2px solid var(--ink);
}
.lede__standfirst {
  margin: 1rem 0 0;
  max-width: var(--measure);
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.65;
}
.lede__search, .lede__back { margin-top: 1.25rem; }

.empty {
  max-width: var(--measure);
  color: var(--muted);
}

/* --- story cards ---------------------------------------------------------- */
.stream {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
  align-items: start;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--maple);
  overflow: hidden;
}
.card__figure { display: block; }
.card__figure img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }

.card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 1.25rem 1.35rem 1.4rem;
}

.eyebrow {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--maple);
  text-decoration: none;
  margin-bottom: .5rem;
}
.eyebrow:hover { color: var(--maple-d); text-decoration: underline; }

.card__title {
  font-size: 1.1875rem;
  font-weight: 800;
  line-height: 1.34;
  margin-bottom: .5rem;
}
.card__title a { color: var(--ink); text-decoration: none; }
.card__title a:hover { color: var(--maple); }

.card__meta {
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 .7rem;
}

.card__excerpt {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--body);
  margin: 0 0 1.1rem;
}

.card__more { margin: 0; }
.card__more a {
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--maple);
  padding-bottom: 2px;
}
.card__more a:hover { color: var(--maple); }

/* --- pagination ----------------------------------------------------------- */
.pagination {
  margin-top: 2.5rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.pagination .page-numbers {
  display: block;
  padding: .55rem .85rem;
  border: 1px solid var(--rule-2);
  color: var(--ink);
  text-decoration: none;
}
.pagination .page-numbers:hover { border-color: var(--maple); color: var(--maple); }
.pagination .page-numbers.current { background: var(--ink); border-color: var(--ink); color: #f7f5f0; }

/* --- single article ------------------------------------------------------- */
.piece {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--maple);
  padding: 2.25rem 2.5rem 2.75rem;
}
.piece__head { margin-bottom: 1.75rem; }
.piece__title {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.32;
  letter-spacing: -0.03em;
  max-width: 26ch;
  margin-bottom: .75rem;
}
.piece__meta {
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}
.piece__dot { margin: 0 .4rem; }

.piece__figure { margin: 0 0 2rem; }
.piece__figure img { width: 100%; border: 1px solid var(--rule); }

/* the single place the reading measure is set */
.piece__body { max-width: var(--measure); }
.piece__body > * { max-width: 100%; }

.piece__body p { margin: 0 0 1.4rem; }
.piece__body h2 {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.33;
  margin: 2.75rem 0 1rem;
}
.piece__body h3 {
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 2.1rem 0 .75rem;
}
.piece__body h2 + p, .piece__body h3 + p { margin-top: 0; }
.piece__body ul, .piece__body ol { margin: 0 0 1.5rem 1.35rem; }
.piece__body li { margin-bottom: .55rem; line-height: 1.7; }
.piece__body a { text-decoration: underline; text-underline-offset: 2px; }
.piece__body img { margin: 2rem 0; border: 1px solid var(--rule); }
.piece__body figure { margin: 2rem 0; }
.piece__body figcaption {
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
  margin-top: .5rem;
}
.piece__body blockquote {
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  border-left: 3px solid var(--maple);
  margin: 2.2rem 0;
  padding: .2rem 0 .2rem 1.5rem;
}

/* tables scroll on their own rather than pushing the page sideways */
.piece__body table {
  width: 100%;
  border-collapse: collapse;
  margin: 2.2rem 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  display: block;
  overflow-x: auto;
}
.piece__body thead, .piece__body tbody { display: table; width: 100%; }
.piece__body th {
  background: var(--ink);
  color: #f7f5f0;
  text-align: left;
  font-weight: 700;
  padding: .75rem .95rem;
  line-height: 1.45;
}
.piece__body td {
  padding: .7rem .95rem;
  border-bottom: 1px solid var(--rule);
  line-height: 1.55;
}
.piece__body tr:nth-child(even) td { background: #faf8f4; }

/* --- author card ---------------------------------------------------------- */
.author-card {
  display: flex;
  gap: 1.15rem;
  align-items: flex-start;
  max-width: var(--measure);
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--ink);
}
.author-card__portrait { flex: 0 0 auto; display: block; }
.author-card__portrait img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border: 1px solid var(--rule);
}
.author-card__body { min-width: 0; }
.author-card__name {
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 800;
  line-height: 1.4;
  margin: 0 0 .15rem;
}
.author-card__name a { color: var(--ink); text-decoration: none; }
.author-card__name a:hover { color: var(--maple); }
.author-card__role {
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--maple);
  margin: 0 0 .55rem;
}
.author-card__bio {
  font-size: 1rem;
  line-height: 1.6;
  margin: 0 0 .5rem;
}
.author-card__more {
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  margin: 0;
}

/* --- prev / next ---------------------------------------------------------- */
.alongside {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
}
.alongside__item {
  display: block;
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 1.1rem 1.25rem;
  text-decoration: none;
}
.alongside__item:hover { border-color: var(--maple); }
.alongside__item--next { text-align: right; }
.alongside__label {
  display: block;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--maple);
  margin-bottom: .3rem;
}
.alongside__title {
  display: block;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
}

/* --- search form ---------------------------------------------------------- */
.searchform__label {
  display: block;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: .45rem;
}
.searchform__row { display: flex; gap: .5rem; max-width: 26rem; }
.searchform__input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  padding: .6rem .75rem;
  border: 1px solid var(--rule-2);
  background: var(--card);
  color: var(--ink);
}
.searchform__button {
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.5;
  padding: .6rem 1.1rem;
  border: 0;
  background: var(--ink);
  color: #f7f5f0;
  cursor: pointer;
}
.searchform__button:hover { background: var(--maple); }

/* --- footer --------------------------------------------------------------- */
.colophon {
  background: var(--ink);
  color: #b9b4ab;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  padding-block: 2.75rem 1.75rem;
}
.colophon__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.25rem;
}
.colophon__head {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.5;
  text-transform: uppercase;
  color: #f7f5f0;
  margin-bottom: .9rem;
}
.colophon p { margin: 0 0 .7rem; max-width: 44ch; }
.colophon__list { list-style: none; margin: 0; padding: 0; }
.colophon__list li { margin-bottom: .45rem; }
.colophon a { color: #ddd8d0; text-decoration: none; }
.colophon a:hover { color: #fff; text-decoration: underline; }
.colophon__age { color: #8f8a82; }
.colophon__base {
  margin-top: 2rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, .14);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #8f8a82;
}

/* --- responsive ----------------------------------------------------------- */
@media (max-width: 860px) {
  .nav-burger { display: inline-flex; }
  .nav {
    flex-basis: 100%;
    display: none;
  }
  .nav-toggle:checked ~ .nav { display: block; }
  .nav__list { flex-direction: column; gap: 0; padding-bottom: .75rem; }
  .nav__list a { padding: .8rem .25rem; border-bottom: 1px solid rgba(255,255,255,.12); }
  .nav__list a:hover { box-shadow: none; }

  .piece { padding: 1.5rem 1.35rem 2rem; }
  .colophon__grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .alongside { grid-template-columns: 1fr; }
  .alongside__item--next { text-align: left; }
  .author-card { flex-direction: column; }
}

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