/*
Theme Name: TPE Ledger
Description: Lightweight broadsheet-style theme for The Private Equiteer. No page builder.
Version: 0.3.0
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: tpe-ledger
*/

:root {
  --paper: #fbfaf5;
  --surface: #f4f2ea;
  --ink: #1a1a1a;
  --ink-soft: #3a3a3a;
  --ink-mute: #696969;
  --rule: #1a1a1a;
  --rule-dot: #c9c2b2;
  --accent: #9b1c1c;
  --display: "Playfair Display", "Times New Roman", Times, serif;
  --serif: "Source Serif 4", Georgia, serif;
  --wide: 1152px;
  --read: 780px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16140f; --surface: #1f1c15; --ink: #ece7da; --ink-soft: #b9b3a4; --ink-mute: #8a8475;
    --rule: #ece7da; --rule-dot: #3a352b; --accent: #d2674f;
  }
  /* Dark paper: the logo and signature are dark artwork on white, so flip them and drop the white; photos keep their own colours. */
  .site-logo img, .entry .signature { filter: invert(1) !important; mix-blend-mode: screen !important; }
  .box--book img, .hero img, .offer img, .entry .step-book img, .entry .rated img { mix-blend-mode: normal !important; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 18px; line-height: 1.65; }
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: var(--rule-dot); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 24px; }
.label { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.label a { text-decoration: none; }
.label--accent, .label--accent a { color: var(--accent); }
.screen-reader-text { position: absolute; left: -9999px; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--paper); padding: 10px 16px; z-index: 10; }
.skip-link:focus { left: 8px; top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.entry h2, .entry h3 { scroll-margin-top: 16px; }

/* Masthead */
.masthead { padding-top: 14px; }
.masthead__top { display: flex; justify-content: space-between; gap: 16px; }
.site-logo { display: block; text-align: center; padding: 14px 0 12px; }
.site-logo img { height: 54px; width: auto; mix-blend-mode: multiply; }
.site-title { font-family: var(--display); font-weight: 700; font-size: 2.6rem; letter-spacing: -0.02em; text-decoration: none; }
.masthead__nav { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.masthead__nav ul { list-style: none; margin: 0; padding: 9px 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 28px; }
.masthead__nav a { display: inline-block; padding: 4px 0; font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; color: var(--ink-soft); }
.masthead__nav a:hover, .masthead__nav .current-menu-item a { color: var(--accent); }

/* Article */
.article { max-width: var(--read); margin: 0 auto; padding: 44px 0 20px; }
.article__head { margin-bottom: 26px; }
.article__title { font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 4.6vw, 2.9rem); line-height: 1.08; letter-spacing: -0.02em; margin: 10px 0 14px; }
.article__meta { border-top: 1px solid var(--rule); border-bottom: 1px dotted var(--rule-dot); padding: 8px 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.entry { font-size: 1.14rem; line-height: 1.72; color: var(--ink-soft); overflow-wrap: break-word; }
.entry > *:first-child { margin-top: 0; }
.entry p, .entry ul, .entry ol, .entry blockquote, .entry pre, .entry table, .entry figure { margin: 0 0 1.25em; }
.entry h2 { font-family: var(--display); font-weight: 700; font-size: 1.75rem; line-height: 1.18; color: var(--ink); margin: 1.9em 0 0.6em; padding-top: 0.55em; border-top: 1px solid var(--rule); }
.entry h3 { font-family: var(--serif); font-weight: 600; font-size: 1.22rem; line-height: 1.3; color: var(--ink); margin: 1.6em 0 0.5em; }
.entry h4 { font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); margin: 1.6em 0 0.5em; }
.entry strong { color: var(--ink); font-weight: 600; }
.entry a { color: var(--ink); text-decoration-color: var(--accent); }
.entry a:hover { color: var(--accent); }
.entry ul, .entry ol { padding-left: 1.3em; }
.entry li { margin-bottom: 0.4em; }
.entry blockquote { margin-left: 0; padding: 2px 0 2px 20px; border-left: 3px solid var(--accent); color: var(--ink); font-style: italic; }
.entry blockquote p:last-child { margin-bottom: 0; }
.entry pre { background: var(--surface); border: 1px solid var(--rule-dot); padding: 16px 18px; font: 0.82rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; color: var(--ink); }
.entry code { font: 0.86em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface); padding: 1px 5px; }
.entry pre code { background: none; padding: 0; font-size: inherit; }
.entry table { width: 100%; border-collapse: collapse; font-size: 0.95rem; line-height: 1.4; display: block; overflow-x: auto; }
.entry th, .entry td { text-align: left; vertical-align: top; padding: 9px 12px 9px 0; border-bottom: 1px dotted var(--rule-dot); }
.entry th { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); border-bottom: 1px solid var(--rule); font-weight: 400; }
.entry hr { border: 0; border-top: 1px dotted var(--rule-dot); margin: 2em 0; }
.entry figure { margin-left: 0; margin-right: 0; }
.entry figcaption { font-size: 0.8rem; color: var(--ink-mute); }

/* Posts carry some hard-coded inline colours (verdict boxes, table cells). Bring them into the palette so they work on paper and in dark mode. */
.entry div[style*="border-left"] { background: var(--surface) !important; border-left-color: var(--accent) !important; color: var(--ink-soft); }
.entry table[style] { table-layout: auto !important; }
.entry th[style], .entry td[style] { border: 0 !important; border-bottom: 1px dotted var(--rule-dot) !important; background: transparent !important; padding: 9px 12px 9px 0 !important; }
.entry th[style] { border-bottom: 1px solid var(--rule) !important; }

/* Contents list at the top of long articles */
.toc { border: 1px solid var(--rule-dot); background: var(--surface); padding: 14px 20px; margin: 0 0 1.6em; font-size: 0.98rem; line-height: 1.45; }
.toc summary { cursor: pointer; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.toc ol { margin: 10px 0 2px; padding-left: 1.3em; columns: 2; column-gap: 32px; }
.toc li { margin-bottom: 6px; break-inside: avoid; }
.toc a { text-decoration: none; color: var(--ink-soft); }
.toc a:hover { color: var(--accent); }

/* Sales and resource pages (ebook, recommended resources) */
.entry h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 4.6vw, 2.9rem); line-height: 1.08; letter-spacing: -0.02em; color: var(--ink); margin: 0 0 22px; padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.entry h1 strong { font-weight: 700; }
.entry .lede { font-size: 1.24rem; line-height: 1.6; color: var(--ink); }
.offer { border: 1px solid var(--rule); padding: 24px; margin: 1.8em 0; display: flex; gap: 28px; align-items: center; }
.offer > p { margin: 0; flex: 0 0 150px; }
.offer > p:empty, .entry .step-book > p:empty { display: none; }
.offer > img { flex: 0 0 150px; }
.entry .step-book > img { flex: 0 0 120px; width: 120px; }
.offer > div { flex: 1; min-width: 0; }
.offer img { width: 150px; mix-blend-mode: multiply; }
.offer__price { font-family: var(--display); font-weight: 700; font-size: 1.6rem; line-height: 1.2; color: var(--ink); margin: 0 0 12px; }
.offer__price s { color: var(--ink-mute); font-weight: 400; font-size: 1.1rem; margin-right: 8px; }
.offer__note { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); margin: 12px 0 0 !important; }
.entry ul.ticks { list-style: none; padding-left: 0; }
.entry ul.ticks li { padding: 10px 0 10px 30px; border-bottom: 1px dotted var(--rule-dot); position: relative; margin: 0; }
.entry ul.ticks li::before { content: "✓"; position: absolute; left: 2px; color: var(--accent); font-weight: 600; }
.entry blockquote.quote { border-left: 0; border-top: 1px solid var(--rule); padding: 16px 0 0; font-size: 1.16rem; }
.entry blockquote.quote cite { display: block; margin-top: 8px; font-style: normal; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.entry ol.chapters { padding-left: 1.6em; }
.entry ol.chapters li { padding: 6px 0; border-bottom: 1px dotted var(--rule-dot); margin: 0; }
.entry .signature { max-width: 220px; mix-blend-mode: multiply; }
.entry .rated { display: flex; align-items: center; gap: 12px; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.entry .rated img { height: 22px; width: auto; mix-blend-mode: multiply; }
.resource { border-top: 1px dotted var(--rule-dot); padding: 18px 0 6px; }
.entry h2 + .resource { border-top: 0; padding-top: 0; }
.resource .wp-block-buttons { margin: 0.4em 0 1em; display: flex; flex-wrap: wrap; gap: 10px; }
.entry .step-book { display: flex; gap: 22px; align-items: flex-start; }
.entry .step-book > p { margin: 0; flex: 0 0 120px; }
.entry .step-book > div { flex: 1; min-width: 0; }
.entry .step-book img { mix-blend-mode: multiply; }

/* Search form (footer, 404) */
.search-form { display: flex; justify-content: center; gap: 8px; margin: 0 auto 20px; max-width: 420px; }
.search-form label { flex: 1; }
.search-form input[type="search"] { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--rule); padding: 8px 2px; font: inherit; color: var(--ink); border-radius: 0; }
.search-form input[type="submit"] { background: transparent; border: 0; font: 400 0.72rem var(--serif); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); cursor: pointer; }

/* Buttons: block editor buttons and affiliate calls to action */
.entry .wp-block-buttons { margin: 1.6em 0; }
.entry .wp-block-button__link, .btn {
  display: inline-block; background: var(--ink); color: var(--paper) !important; border: 1px solid var(--ink); border-radius: 0;
  padding: 13px 22px; font: 400 0.74rem/1.3 var(--serif); letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none;
}
/* Bold or italic text inside a button must take the button's text colour, not the article's. */
.entry .wp-block-button__link *, .btn * { color: inherit !important; }
.entry .wp-block-button__link:hover, .btn:hover { background: var(--accent); border-color: var(--accent); }
.btn--ghost { background: transparent; color: var(--ink) !important; }
.btn--ghost:hover { color: var(--paper) !important; }

/* After the article */
.after { max-width: var(--read); margin: 0 auto; padding-bottom: 56px; }
.share { border-top: 1px solid var(--rule); border-bottom: 1px dotted var(--rule-dot); padding: 9px 0; display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: baseline; }
.share a { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; color: var(--ink-soft); }
.box { border: 1px solid var(--rule); padding: 22px 24px; margin-top: 32px; }
.box__title { font-family: var(--display); font-weight: 700; font-size: 1.5rem; line-height: 1.15; margin: 6px 0 8px; }
.box p { margin: 0 0 14px; color: var(--ink-soft); font-size: 1rem; }
.box--book { display: grid; grid-template-columns: 110px 1fr; gap: 22px; align-items: start; }
.box--book img { width: 110px; mix-blend-mode: multiply; }
.section-head { text-align: center; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 7px 0; margin: 44px 0 20px; font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; font-family: var(--display); }
.story-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px 28px; }
.story-list--two { grid-template-columns: repeat(2, 1fr); }
.story h3 { font-family: var(--serif); font-weight: 600; font-size: 1.02rem; line-height: 1.3; margin: 0 0 4px; }
.story h3 a { text-decoration: none; }
.story p { margin: 6px 0 0; font-size: 0.92rem; line-height: 1.5; color: var(--ink-soft); }

/* Homepage */
.hero { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 40px; align-items: center; max-width: 920px; margin: 0 auto; padding: 40px 0 34px; }
.hero img { width: 200px; mix-blend-mode: multiply; }
.hero h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 4.4vw, 3rem); line-height: 1.06; letter-spacing: -0.02em; margin: 6px 0 12px; }
.hero p { margin: 0 0 20px; color: var(--ink-soft); font-size: 1.08rem; }
.hero strong { color: var(--ink); font-weight: 600; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.front-top { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: 0 44px; margin-top: 0; padding-top: 26px; border-top: 1px solid var(--rule); }
.lead h2 { font-family: var(--display); font-weight: 700; font-size: clamp(1.7rem, 3.4vw, 2.35rem); line-height: 1.1; letter-spacing: -0.015em; margin: 8px 0 12px; }
.lead h2 a { text-decoration: none; }
.lead p { margin: 0 0 16px; color: var(--ink-soft); font-size: 1.08rem; }
.lead__more { font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; color: var(--accent); }
.side { border-left: 1px solid var(--rule-dot); padding-left: 28px; }
.side ul { list-style: none; margin: 8px 0 0; padding: 0; }
.side li { padding: 13px 0; border-top: 1px dotted var(--rule-dot); }
.side li:first-child { border-top: 0; padding-top: 4px; }
.side h3 { font-family: var(--serif); font-weight: 600; font-size: 1.04rem; line-height: 1.3; margin: 0 0 3px; }
.side h3 a { text-decoration: none; }
.side p { margin: 0; font-size: 0.9rem; line-height: 1.45; color: var(--ink-soft); }
.section-head a { text-decoration: none; }
.section-intro { text-align: center; max-width: 720px; margin: -6px auto 22px; color: var(--ink-soft); font-size: 0.98rem; }
.section-more { text-align: right; margin-top: 14px; }
.section-more a { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; color: var(--ink-mute); }
.front-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 44px; }
.front-boxes .box { margin-top: 0; }

/* Articles page: filter row */
.topic-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; list-style: none; margin: 18px auto 0; padding: 10px 0; max-width: 820px; border-top: 1px solid var(--rule); border-bottom: 1px dotted var(--rule-dot); }
.topic-row a { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; color: var(--ink-soft); }
.topic-row + .archive-list li:first-child { border-top: 0; }

/* Archives and plain pages */
.page-head { text-align: center; padding: 40px 0 8px; }
.page-head h1 { font-family: var(--display); font-weight: 700; font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.1; margin: 8px 0; letter-spacing: -0.02em; }
.page-head p { color: var(--ink-soft); max-width: 640px; margin: 0 auto; }
.archive-list { list-style: none; margin: 26px auto 0; padding: 0; max-width: 820px; }
.archive-list li { padding: 18px 0; border-top: 1px dotted var(--rule-dot); }
.archive-list li:first-child { border-top: 1px solid var(--rule); }
.archive-list h2 { font-family: var(--display); font-weight: 700; font-size: 1.45rem; line-height: 1.2; margin: 4px 0 6px; }
.archive-list h2 a { text-decoration: none; }
.archive-list p { margin: 0; color: var(--ink-soft); font-size: 1rem; }
.pagination { max-width: 820px; margin: 24px auto 56px; display: flex; justify-content: space-between; }
.pagination a { font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); margin-top: 40px; padding: 26px 0 40px; }
.footer-topics { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; list-style: none; margin: 0 0 18px; padding: 0 0 18px; border-bottom: 1px dotted var(--rule-dot); }
.footer-topics a, .footer-links a { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; color: var(--ink-soft); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; list-style: none; margin: 0 0 12px; padding: 0; }
.site-footer .label { text-align: center; display: block; }

@media (max-width: 760px) {
  body { font-size: 17px; }
  .wrap { padding: 0 16px; }
  .masthead__top .label:last-child { display: none; }
  .site-logo img { height: 42px; }
  .story-list, .story-list--two { grid-template-columns: 1fr; }
  .front-top, .front-boxes { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; gap: 18px; text-align: center; padding: 26px 0 26px; }
  .hero img { width: 130px; margin: 0 auto; }
  .hero__actions { justify-content: center; }
  .offer { flex-direction: column; align-items: flex-start; gap: 16px; }
  .offer > p { flex: none; }
  .entry .step-book { flex-direction: column; }
  .entry .step-book > p { flex: none; }
  .offer img { width: 120px; }
  .toc ol { columns: 1; }
  .masthead__nav ul { gap: 2px 18px; }
  .masthead__nav a { padding: 8px 0; }
  .entry { font-size: 1.08rem; }
  .side { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); margin-top: 26px; padding-top: 16px; }
  .box--book { grid-template-columns: 1fr; }
  .box--book img { width: 90px; }
  .article { padding-top: 30px; }
}
