/* ==========================================================================
   Mr. Grummel — blog index and post pages
   ========================================================================== */

.blog-page { min-height: 100vh; }

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

.blog-head {
  padding: 64px 6% 56px;
  background: linear-gradient(180deg, #d9c9a8 0%, #c4b08a 100%);
  border-bottom: 3px solid var(--ink);
}
.blog-head .board { padding: 40px 44px 44px; text-align: center; }
.blog-head .board__eyebrow { margin-bottom: 12px; }
.blog-head h1 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.06;
  color: var(--cream);
}
.blog-head p {
  margin: 0 auto;
  max-width: 54ch;
  font-family: var(--font-hand);
  font-size: clamp(16px, 1.5vw, 20px);
  line-height: 1.4;
  color: var(--chalk-body);
}

/* --------------------------------------------------------------------------
   Search + filters
   -------------------------------------------------------------------------- */

.blog-filters { padding: 48px 6% 0; }

.search {
  max-width: 560px;
  margin: 0 auto 26px;
  position: relative;
}
.search svg {
  position: absolute;
  left: 18px; top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 14px 18px 14px 50px;
  font-family: var(--font-hand);
  font-size: 17px;
  color: var(--cream);
  background: rgba(47, 82, 64, 0.35);
  border: 2px solid rgba(244, 241, 228, 0.3);
  border-radius: 40px;
  outline: none;
}
.search input::placeholder { color: var(--dim); }
.search input:focus { border-color: var(--yellow); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 14px;
}
.chip {
  font-family: var(--font-hand);
  font-size: 16px;
  padding: 8px 18px;
  border-radius: 40px;
  cursor: pointer;
  border: 2px solid rgba(244, 241, 228, 0.3);
  background: transparent;
  color: var(--tan);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.chip:hover { border-color: var(--yellow); color: var(--yellow); }
.chip[aria-pressed="true"] {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--ink);
}

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 34px;
}
.keyword {
  font-family: var(--font-body);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 40px;
  cursor: pointer;
  background: transparent;
  border: 1px solid rgba(244, 241, 228, 0.28);
  color: var(--muted);
}
.keyword:hover { border-color: var(--yellow); color: var(--yellow); }

.result-line {
  text-align: center;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--dim);
  margin-bottom: 24px;
  min-height: 1.2em;
}

/* --------------------------------------------------------------------------
   Post cards
   -------------------------------------------------------------------------- */

.posts { padding: 0 6% 40px; }

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 22px;
}

.post-card {
  --margin-x: 32px;
  display: block;
  padding: 22px 22px 24px 44px;
  color: var(--ink);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 140ms ease;
}
.post-card:hover { color: var(--ink); }
a.post-card:hover { transform: rotate(0deg) translateY(-3px); }
.post-card[hidden] { display: none; }

.post-card__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-body);
  color: #8a6a3a;
}
.post-card__cat { font-size: 10px; letter-spacing: 2px; }
.post-card__read { font-size: 11px; }
.post-card__title {
  font-family: var(--font-display);
  font-size: 23px;
  line-height: 1.2;
  margin: 8px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-blue);
}
.post-card__desc {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  color: #4a3a24;
}
.post-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  font-family: var(--font-body);
  font-size: 11px;
  color: #6b5a3e;
}
.post-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  font-family: var(--font-hand);
  font-size: 14px;
  color: #8a6a3a;
}
.post-card__status { color: #2f6b41; }

/* nothing matched */
.empty {
  text-align: center;
  padding: 60px 0 40px;
}
.empty[hidden] { display: none; }
.empty__title {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--cream);
  margin-bottom: 10px;
}
.empty__line {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 20px;
}

/* --------------------------------------------------------------------------
   Latest list
   -------------------------------------------------------------------------- */

.latest { padding: 40px 6% 80px; }
.latest[hidden] { display: none; }
.latest h2 {
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(24px, 2.6vw, 34px);
  color: var(--cream);
}
.latest__list { border-top: 1px solid rgba(244, 241, 228, 0.2); }

.latest__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 4px;
  border-bottom: 1px solid rgba(244, 241, 228, 0.2);
  color: inherit;
}
.latest__row:hover { background: rgba(47, 82, 64, 0.28); color: inherit; }
.latest__row[hidden] { display: none; }
.latest__main { min-width: 0; }
.latest__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.latest__cat {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: #8fc7a3;
  border: 1px solid rgba(143, 199, 163, 0.5);
  border-radius: 20px;
  padding: 2px 8px;
}
.latest__read {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--dim);
}
.latest__title {
  font-family: var(--font-hand);
  font-size: 19px;
  color: var(--cream);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.latest__right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--dim);
}
.latest__right svg { width: 18px; height: 18px; }

/* --------------------------------------------------------------------------
   Post page
   -------------------------------------------------------------------------- */

.post-head {
  padding: 44px 6% 56px;
  background: linear-gradient(180deg, #d9c9a8 0%, #c4b08a 100%);
  border-bottom: 3px solid var(--ink);
}
.post-head__wrap { max-width: 860px; margin: 0 auto; }

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  font-family: var(--font-hand);
  font-size: 15px;
  color: #6b4a2a;
}
.back-link:hover { color: var(--red); }

.post-head .board { padding: 38px 42px 42px; }
.post-head__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--chalk-dim);
}
.post-head__meta .tag {
  border: 1px solid rgba(207, 200, 168, 0.55);
  border-radius: 20px;
  padding: 3px 10px;
}
.post-head h1 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 3.6vw, 50px);
  line-height: 1.08;
  color: var(--cream);
  text-wrap: pretty;
}
.post-head__standfirst {
  margin: 0;
  max-width: 56ch;
  font-family: var(--font-hand);
  font-size: clamp(16px, 1.5vw, 20px);
  line-height: 1.4;
  color: var(--chalk-body);
}

/* the landing classroom's fluorescent tube, hung over the board on cords */
.board-light {
  position: relative;
  margin: 26px auto 20px;
  width: 180px;
  height: 14px;
  background: linear-gradient(180deg, #f8f4d8 0%, #fff8c2 50%, #d9cf90 100%);
  border: 2.5px solid var(--ink);
  border-radius: 3px;
  box-shadow: 0 0 18px 5px rgba(255, 240, 160, 0.55), 0 0 60px 20px rgba(255, 240, 160, 0.22);
}
.board-light span {
  position: absolute;
  top: -24px;
  width: 3px;
  height: 24px;
  background: var(--ink);
}
.board-light span:first-child { left: 16%; }
.board-light span:last-child { right: 16%; }

.post-body {
  padding: 56px 6% 40px;
  background: var(--dark);
  position: relative; /* anchors the reading buddy's gutter rail */
}

/* Reading buddy — injected by grummel.js when the post-body carries
   data-reading-buddy. An absolute rail spans the article's height; the
   sticky inner rides along at reading height, so scrolling needs no JS. */
.post-buddy {
  position: absolute;
  top: 120px;
  bottom: 80px;
  right: calc((100% - 800px) / 2 - 160px);
  width: 130px;
  pointer-events: none;
}
.post-buddy__inner { position: sticky; top: 38vh; }
.post-buddy svg { display: block; width: 100%; height: auto; }
.post-buddy__head {
  transform-box: view-box;
  transform-origin: 158px 200px;
}
.post-buddy.is-nodding .post-buddy__head { animation: lb-nod 0.9s ease-in-out infinite; }
.post-buddy__eyes {
  transform-box: view-box;
  transform-origin: 158px 132px;
  animation: lb-blink 6.4s ease-in-out 2s infinite;
}
/* the end-of-post line hangs toward the article, pointing back at the CTA */
.post-buddy .grummel-bubble { bottom: calc(100% - 6px); right: 30%; }

/* dozing off — lids close over the eyes, the head droops, chalk Zs drift up */
.post-buddy__head { transition: transform 600ms ease; }
.post-buddy__lids { display: none; }
.post-buddy.is-sleeping .post-buddy__lids { display: block; }
.post-buddy.is-sleeping .post-buddy__eyes { visibility: hidden; }
.post-buddy.is-sleeping .post-buddy__head { transform: rotate(7deg); }
.post-buddy.is-startled .post-buddy__head { animation: lb-startle 0.5s ease-out; }

.post-buddy__zzz {
  position: absolute;
  top: -4px;
  right: 10px;
  font-family: var(--font-marker);
  font-weight: 700;
  font-size: 18px;
  color: var(--paper);
  opacity: 0;
  pointer-events: none;
}
.post-buddy.is-sleeping .post-buddy__zzz { animation: lb-zzz 2.4s ease-out infinite; }
.post-buddy.is-sleeping .post-buddy__zzz:nth-child(3) { animation-delay: 0.8s; font-size: 15px; right: 26px; }
.post-buddy.is-sleeping .post-buddy__zzz:nth-child(4) { animation-delay: 1.6s; font-size: 12px; right: 2px; top: -14px; }

/* Below this the gutter beside the 800px article is too thin for him. */
@media (max-width: 1180px) {
  .post-buddy { display: none; }
}

.article {
  --margin-x: 54px;
  max-width: 800px;
  margin: 0 auto;
  padding: 44px 52px 52px 76px;
  box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.45);
}
.article p {
  margin: 0 0 22px;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: #33281a;
  text-wrap: pretty;
}
.article p:last-child { margin-bottom: 0; }
.article h2 {
  margin: 36px 0 12px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.2;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-blue);
}
/* body links only — buttons in the footer keep their own colours */
.article p a { color: #7a4f28; text-decoration: underline; }
.article p a:hover { color: var(--red); }

/* legal pages reuse the article sheet, but need list and address styling */
.article ul, .article ol {
  margin: 0 0 22px;
  padding-left: 22px;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: #33281a;
}
.article li { margin-bottom: 8px; }
.article li::marker { color: #8a6a3a; }
.article h3 {
  margin: 26px 0 8px;
  font-family: var(--font-marker);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.2;
}
.article address {
  font-style: normal;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: #33281a;
  margin-bottom: 22px;
}
/* Links on the cream paper inherit the top bar's pale ink otherwise, which
   lands at 1.65:1 — invisible. Matches .signup__fine a on the landing page. */
.article a:not(.btn) {
  color: #7a4f28;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.article a:not(.btn):hover { color: var(--red); }

/* an unfilled placeholder should be impossible to miss before publishing */
.article .todo {
  background: rgba(242, 197, 74, 0.45);
  border-bottom: 2px dotted #b07843;
  padding: 0 3px;
  font-family: var(--font-body);
  font-weight: 700;
}
.article__updated {
  font-family: var(--font-body);
  font-size: 13px;
  color: #6b5a3e;
  margin-bottom: 26px;
}

.pull-quote {
  margin: 30px 0;
  padding: 20px 24px;
  border-left: 5px solid var(--yellow);
  background: rgba(242, 197, 74, 0.14);
  font-family: var(--font-marker);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.3;
  color: #4a3a24;
}

/* comparison table on /alternatives/ pages — wide content scrolls in its own box, page never scrolls sideways */
.compare-table-wrap {
  margin: 26px 0;
  overflow-x: auto;
  border: 1px solid var(--tan);
  border-radius: 10px;
}
.compare-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 15px;
}
.compare-table caption {
  text-align: left;
  font-family: var(--font-marker);
  font-weight: 700;
  font-size: 19px;
  padding: 12px 16px;
  color: #4a3a24;
  background: rgba(242, 197, 74, 0.18);
}
.compare-table th,
.compare-table td {
  padding: 10px 16px;
  text-align: left;
  border-top: 1px solid var(--tan);
  line-height: 1.45;
}
.compare-table thead th {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 16px;
  color: var(--dark);
  border-top: none;
  background: rgba(111, 166, 201, 0.12);
}
.compare-table tbody th {
  font-weight: 700;
  color: #4a3a24;
  white-space: nowrap;
}
.compare-table tbody tr:nth-child(even) { background: rgba(207, 192, 164, 0.16); }

/* sources list on /guides/ pages */
.sources {
  margin: 30px 0;
  padding: 16px 20px;
  border: 1px solid var(--tan);
  border-radius: 10px;
  background: rgba(207, 192, 164, 0.12);
}
.sources__title {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b5a3a;
  margin: 0 0 10px;
}
.sources ol {
  margin: 0;
  padding-left: 20px;
}
.sources li {
  font-size: 14px;
  line-height: 1.55;
  color: #4a3a24;
  margin-bottom: 6px;
}
.sources li:last-child { margin-bottom: 0; }

.article__foot {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 2px dashed rgba(0, 0, 0, 0.2);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.article__status {
  font-family: var(--font-marker);
  font-weight: 700;
  font-size: 20px;
  color: #5b4a30;
}
.article__foot .btn { padding: 11px 22px; box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.4); }
.article__foot .btn:hover { box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.4); }

/* --------------------------------------------------------------------------
   Related notes (used on the post page and the landing teaser)
   -------------------------------------------------------------------------- */

.related { padding: 30px 6% 80px; }
.related h2 {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 2.4vw, 30px);
  color: var(--cream);
}
.related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 20px;
}
/* .note-card itself lives in site.css — the landing teaser uses it too. */

@media (max-width: 620px) {
  .blog-head { padding: 40px 5% 36px; }
  .blog-head .board { padding: 28px 20px 30px; }

  .blog-filters { padding: 32px 5% 0; }
  .search input { padding: 12px 16px 12px 46px; }
  .chip { padding: 10px 16px; }
  .keyword { padding: 8px 12px; }

  .posts { padding: 0 5% 32px; }
  .post-card { --margin-x: 28px; padding: 20px 18px 22px 40px; transform: none; }
  a.post-card:hover { transform: translateY(-3px); }

  /* the title is the whole point of the row — it gets its own line and
     wraps instead of being ellipsed down to half a headline */
  .latest { padding: 32px 5% 64px; }
  .latest__row { flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px 4px; }
  .latest__title { white-space: normal; overflow: visible; text-overflow: clip; }
  .latest__right { gap: 10px; }

  .post-head { padding: 32px 5% 40px; }
  .post-head .board { padding: 26px 20px 28px; }
  /* the only way back to the index from a post — worth a thumb */
  .back-link { display: inline-flex; align-items: center; min-height: 40px; }
  .post-body { padding: 36px 5% 30px; }
  .article { padding: 28px 22px 32px 46px; --margin-x: 28px; }
  .article h2 { font-size: 24px; }
  .article p, .article ul, .article ol, .article address { font-size: 16px; }
  .pull-quote { font-size: 22px; padding: 16px 18px; }
  .article__foot { gap: 12px; }
  .article__foot .btn { width: 100%; text-align: center; }

  .related { padding: 24px 5% 64px; }
}

@media (max-width: 430px) {
  .blog-head .board { padding: 24px 14px 26px; }
  .post-head .board { padding: 22px 14px 24px; }
  .post-card { --margin-x: 24px; padding: 18px 14px 20px 34px; }
  .article { padding: 24px 16px 26px 40px; --margin-x: 24px; }
  .article h2 { font-size: 22px; }
  .pull-quote { font-size: 20px; padding: 14px 14px; }
}
