/* ═══════════════════════════════════════════════════════════════════════════
   PHYSICSFORUM — LONG-FORM CONTENT TYPOGRAPHY  (v5.3)

   THE PROBLEM THIS SOLVES
   -----------------------
   Plain pages and posts — Privacy Policy, Terms, About, Guidelines, and every
   blog post — rendered with almost no styling at all:

     • `.post-content` was only ever styled inside forum.css, which does NOT
       load on a page. So headings, lists, tables, quotes and links inside page
       content had zero rules applied.
     • The wrapper used `.max-w-2xl`, which in this theme is **1280px**. Body
       text ran the full width of a desktop monitor. Comfortable reading is
       roughly 65–75 characters per line; 1280px of 16px text is well over 150.
     • No vertical rhythm: paragraphs, headings and lists all sat on default
       browser margins, so nothing grouped visually.

   The result looked unfinished next to the designed sections, which is exactly
   what a visitor notices when they click "Privacy Policy" in the footer.

   THE APPROACH
   ------------
   One `.entry-content` scope, applied to every long-form surface. Measure is
   capped in `ch` (character units) so it stays correct at any font size.
   Everything below uses the semantic tokens, so it is correct in dark mode by
   construction.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page shell ──────────────────────────────────────────────────────────── */
.content-page {
  max-width: 100%;
  padding: clamp(24px, 5vw, 56px) 20px clamp(48px, 8vw, 96px);
}
.content-page-inner {
  max-width: 74ch;        /* ~68–72 characters — the readable range */
  margin: 0 auto;
}
.content-page-wide { max-width: 92ch; }   /* opt-in for tables/figures */

/* ── Page header ─────────────────────────────────────────────────────────── */
.entry-header {
  margin-bottom: clamp(24px, 3vw, 34px);
  padding-bottom: clamp(16px, 2.2vw, 22px);
  border-bottom: 1px solid var(--border);
}
.entry-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.85rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
  text-wrap: balance;          /* avoids a lonely last word */
}
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--text-muted);
}
.entry-meta a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.entry-meta a:hover { color: var(--border-focus); }

/* ── The content itself ──────────────────────────────────────────────────── */
.entry-content {
  font-family: var(--font-body);
  font-size: clamp(1.02rem, 0.99rem + 0.16vw, 1.14rem);
  line-height: 1.75;
  color: var(--text-secondary);
  overflow-wrap: break-word;
}

/* Vertical rhythm: space comes from the element ABOVE, so the first child
   never adds an unwanted gap under the header. */
.entry-content > * { margin-top: 0; margin-bottom: 1.15em; }
.entry-content > *:last-child { margin-bottom: 0; }

.entry-content p { margin-bottom: 1.15em; }

/* Lead paragraph: slightly larger, so a page opens with a clear voice
   instead of dropping straight into uniform body text. */
.entry-content > p:first-of-type {
  font-size: 1.1em;
  line-height: 1.65;
  color: var(--text);
}
.entry-toc + p { font-size: 1.1em; line-height: 1.65; color: var(--text); }

/* Headings: generous space above, tight below — binds each heading to the
   text it introduces rather than floating between two blocks. */
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
  font-family: var(--font-display);
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-top: 1.85em;
  margin-bottom: 0.55em;
  text-wrap: balance;
  scroll-margin-top: 90px;   /* TOC anchors clear the fixed navbar */
}
.entry-content h2 { font-size: 1.6em;  font-weight: 750; }
.entry-content h3 { font-size: 1.3em;  font-weight: 700; }
.entry-content h4 { font-size: 1.12em; font-weight: 700; }
.entry-content h5,
.entry-content h6 {
  font-size: 1em; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted);
}
.entry-content > h2:first-child,
.entry-content > h3:first-child { margin-top: 0; }

/* A hairline under h2 gives legal/policy pages clear section breaks. */
.entry-content h2 {
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border-subtle);
}

/* ── Links ───────────────────────────────────────────────────────────────── */
.entry-content a {
  color: var(--border-focus);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2.5px;
  text-decoration-color: color-mix(in srgb, var(--border-focus) 40%, transparent);
  transition: text-decoration-color .15s ease;
}
.entry-content a:hover { text-decoration-color: currentColor; }

/* ── Lists ───────────────────────────────────────────────────────────────── */
.entry-content ul,
.entry-content ol { padding-left: 1.5em; margin-bottom: 1.15em; }
.entry-content li { margin-bottom: 0.45em; padding-left: 0.2em; }
.entry-content li::marker { color: var(--text-faint); }
.entry-content ol > li::marker { font-weight: 700; color: var(--text-muted); }
.entry-content li > ul,
.entry-content li > ol { margin-top: 0.45em; margin-bottom: 0.45em; }

/* ── Quotes ──────────────────────────────────────────────────────────────── */
.entry-content blockquote {
  margin: 1.8em 0;
  padding: 4px 0 4px 1.25em;
  border-left: 3px solid var(--border-focus);
  color: var(--text);
  font-style: italic;
}
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content blockquote cite {
  display: block; margin-top: .6em;
  font-size: .88em; font-style: normal; color: var(--text-muted);
}

/* ── Code ────────────────────────────────────────────────────────────────── */
.entry-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-sunken);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}
.entry-content pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 16px 18px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 1.6em 0;
  font-size: 0.88em;
  line-height: 1.6;
}
.entry-content pre code {
  background: none; border: 0; padding: 0;
  color: inherit; font-size: inherit;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.entry-content .table-scroll { overflow-x: auto; margin: 1.8em 0; }
.entry-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94em;
  margin: 1.8em 0;
}
.entry-content thead th {
  background: var(--surface-sunken);
  color: var(--text);
  font-weight: 700;
  text-align: left;
}
.entry-content th,
.entry-content td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  vertical-align: top;
}
.entry-content tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-sunken) 45%, transparent); }

/* ── Media ───────────────────────────────────────────────────────────────── */
.entry-content img,
.entry-content video,
.entry-content iframe {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}
.entry-content figure { margin: 1.8em 0; }
.entry-content figcaption {
  margin-top: .6em;
  font-size: .86em;
  color: var(--text-muted);
  text-align: center;
}
/* Let images breathe past the measure on wide screens. */
@media (min-width: 900px) {
  .entry-content .alignwide,
  .entry-content figure.alignwide { width: min(92ch, 100vw - 40px); margin-left: 50%; transform: translateX(-50%); }
}

/* ── Rules & misc ────────────────────────────────────────────────────────── */
.entry-content hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 2.4em 0;
}
.entry-content dl { margin-bottom: 1.15em; }
.entry-content dt { font-weight: 700; color: var(--text); margin-top: 1em; }
.entry-content dd { margin: .3em 0 0 1.2em; color: var(--text-secondary); }
.entry-content abbr[title] { text-decoration: underline dotted; cursor: help; }
.entry-content mark { background: var(--state-warning-bg); color: var(--state-warning-fg); padding: 0 .2em; border-radius: 3px; }
.entry-content small { font-size: .86em; color: var(--text-muted); }

/* WordPress core alignment classes — these ship in editor output and were
   completely unstyled, so aligned images simply did not align. */
.entry-content .alignleft  { float: left;  margin: .4em 1.4em 1em 0; }
.entry-content .alignright { float: right; margin: .4em 0 1em 1.4em; }
.entry-content .aligncenter{ margin-left: auto; margin-right: auto; }
.entry-content .wp-caption { max-width: 100%; }
.entry-content .screen-reader-text {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap;
}
@media (max-width: 600px) {
  .entry-content .alignleft,
  .entry-content .alignright { float: none; margin: 1.2em auto; }
}

/* ── Footer of a page: last-updated, share, etc. ─────────────────────────── */
.entry-footer {
  margin-top: clamp(36px, 6vw, 64px);
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  justify-content: space-between;
}

/* ── Archive / listing cards ─────────────────────────────────────────────── */
.archive-head { max-width: 74ch; margin: 0 auto clamp(28px, 4vw, 40px); }
.archive-title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem);
  font-weight: 800; color: var(--text); margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.archive-desc { color: var(--text-muted); font-size: 1.02rem; line-height: 1.6; margin: 0; }

.post-list { max-width: 74ch; margin: 0 auto; display: flex; flex-direction: column; gap: 4px; }
.post-list-item {
  padding: 22px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.post-list-item:last-child { border-bottom: 0; }
.post-list-title {
  font-family: var(--font-display);
  font-size: 1.24rem; font-weight: 700; line-height: 1.35;
  margin: 0 0 6px;
}
.post-list-title a { color: var(--text); text-decoration: none; }
.post-list-title a:hover { color: var(--border-focus); }
.post-list-meta {
  display: flex; flex-wrap: wrap; gap: 14px;
  font-size: 12.5px; color: var(--text-faint); margin-bottom: 8px;
}
.post-list-excerpt {
  font-size: .96rem; line-height: 1.65; color: var(--text-muted); margin: 0;
}

/* ── Reading progress bar (single posts) ─────────────────────────────────── */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--border-focus); z-index: 1200;
  transition: width .1s linear;
}
body.admin-bar .reading-progress { top: 32px; }
@media screen and (max-width: 782px) { body.admin-bar .reading-progress { top: 46px; } }
@media screen and (max-width: 600px) { body.admin-bar .reading-progress { top: 0; } }
@media (prefers-reduced-motion: reduce) { .reading-progress { transition: none; } }

/* ── Table of contents (auto-built on long pages) ────────────────────────── */
.entry-toc {
  margin: 0 0 2em;
  padding: 16px 20px;
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  font-family: var(--font-display);
}
.entry-toc-title {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin: 0 0 10px;
}
.entry-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.entry-toc li { margin: 0 0 6px; font-size: .93rem; line-height: 1.45; }
.entry-toc li.toc-h3 { padding-left: 16px; font-size: .88rem; }
.entry-toc a { color: var(--text-secondary); text-decoration: none; }
.entry-toc a:hover { color: var(--border-focus); text-decoration: underline; }

/* ── Print ───────────────────────────────────────────────────────────────── */
@media print {
  .pf-navbar, .site-footer, .entry-toc, .reading-progress, .entry-footer { display: none !important; }
  .content-page-inner { max-width: 100%; }
  .entry-content { font-size: 11pt; line-height: 1.5; }
  .entry-content a::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
}

/* ── Comments on pages/posts ─────────────────────────────────────────────── */
.entry-comments {
  max-width: 74ch;
  margin: clamp(40px, 6vw, 64px) auto 0;
  padding-top: clamp(28px, 4vw, 40px);
  border-top: 1px solid var(--border);
}
.entry-comments .comment-list { list-style: none; margin: 0; padding: 0; }
.entry-comments .comment-body {
  padding: 18px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.entry-comments .comment-meta { font-size: 13px; color: var(--text-muted); }
.entry-comments .comment-content { font-size: .97rem; line-height: 1.7; color: var(--text-secondary); }
.entry-comments textarea,
.entry-comments input[type="text"],
.entry-comments input[type="email"],
.entry-comments input[type="url"] {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .96rem;
}
.entry-comments textarea:focus,
.entry-comments input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 18%, transparent);
}
.entry-comments .form-submit { margin-top: 14px; }

/* ── Search form (404, archives, widgets) ────────────────────────────────
   Previously styled with inline attributes and --color-ice-blue, giving a
   pale-grey placeholder on a pale-blue field — unreadable, and untouchable
   by dark mode because inline styles win. */
.search-form { display: flex; gap: 8px; align-items: stretch; }
.search-field-wrap {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-field-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 18%, transparent);
}
.search-field-icon { color: var(--text-faint); flex-shrink: 0; }
.search-field {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: none;
  padding: 11px 0;
  font: inherit; font-size: .96rem;
  color: var(--text);
}
.search-field::placeholder { color: var(--text-faint); opacity: 1; }
.search-field::-webkit-search-cancel-button { cursor: pointer; }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.content-page .breadcrumb {
  margin: 0 0 22px;
  padding: 0;
  font-size: 13px;
  color: var(--text-faint);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.content-page .breadcrumb a { color: var(--text-muted); text-decoration: none; }
.content-page .breadcrumb a:hover { color: var(--border-focus); text-decoration: underline; }
.content-page .breadcrumb .separator { color: var(--border-strong); }
