/*
Theme Name: Panhinda
Theme URI: https://panhinda.sirisaddharmaya.net/
Author: Siri Saddharmaya
Author URI: https://sirisaddharmaya.net/
Description: A modern, reading-first WordPress theme for the Parama Pavithra Siri Saddharmaya Dhamma blog. Built for maximum readability of long-form Sinhala (Unicode) and English Buddhist texts, with a warm, calm aesthetic matching sirisaddharmaya.net. Fully responsive and elderly-friendly, with large touch targets, a reading-progress bar, chapter navigation and an on-page table of contents.
Version: 1.0.0
Requires at least: 5.9
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: panhinda
Tags: blog, custom-menu, featured-images, threaded-comments, translation-ready, sticky-post, right-sidebar, one-column, two-columns, custom-logo, editor-style, full-width-template, accessibility-ready
*/

/* =====================================================================
   Panhinda theme — design system ported from sirisaddharmaya.net,
   extended for long-form reading UX.
   Table of contents:
     1. Design tokens
     2. Base / reset / typography
     3. Layout & wrappers
     4. Skip link, focus, a11y
     5. Site header + navigation
     6. Mobile menu
     7. Search
     8. Buttons & pills
     9. Reading progress bar
    10. Page hero / titles / breadcrumbs
    11. Article (prose) — the reading core
    12. Post cards / archive grid
    13. Chapter table of contents (aside)
    14. Post navigation (prev/next chapter)
    15. Comments
    16. Widgets / sidebar / footer
    17. Reading toolbar (font size, top)
    18. Utilities, WP core classes
    19. Responsive
    20. Print
   ===================================================================== */

/* 1. Design tokens ---------------------------------------------------- */
:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-2: #F2EDE4;
  --ink: #1F2A37;
  --ink-soft: #4A5563;
  --sage: #3D7A6A;
  --sage-deep: #2E5F53;
  --saffron: #C58B3A;
  --rose: #B86A6A;
  --line: #E6DFD2;

  --shadow-sm: 0 2px 8px rgba(31, 42, 55, 0.05);
  --shadow-md: 0 10px 30px rgba(31, 42, 55, 0.07);
  --shadow-lg: 0 18px 40px rgba(31, 42, 55, 0.12);

  --wrap: 1180px;          /* full site width */
  --read: 46rem;           /* comfortable reading measure (~68ch) */
  --radius: 14px;
  --radius-lg: 18px;
  --pill: 999px;

  --font-ui: 'Inter', 'Noto Sans Sinhala', system-ui, -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-si: 'Noto Sans Sinhala', 'Inter', system-ui, sans-serif;

  --reader-scale: 1;       /* controlled by the font-size adjuster */
}

/* 2. Base / reset / typography --------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

:lang(si), .sinhala { font-family: var(--font-si); line-height: 1.85; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-si);
  color: var(--sage-deep);
  line-height: 1.35;
  margin: 0 0 0.5em;
  font-weight: 700;
}

p { margin: 0 0 1.15em; }

a { color: var(--sage-deep); text-decoration: none; }
a:hover { color: var(--sage); text-decoration: underline; text-underline-offset: 3px; }

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

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

blockquote {
  margin: 1.8rem 0;
  padding: 0.6rem 1.4rem;
  border-inline-start: 4px solid var(--saffron);
  background: var(--surface-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-soft);
  font-style: normal;
}
blockquote p:last-child { margin-bottom: 0; }

code, pre, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}
pre {
  background: #2b2f36;
  color: #f5f2ec;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
}
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 5px; }
pre code { background: none; padding: 0; }

/* 3. Layout & wrappers ----------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 22px; }
.site { display: flex; flex-direction: column; min-height: 100vh; }
.site-main { flex: 1 0 auto; padding-block: clamp(28px, 5vw, 56px); }

/* 4. Skip link, focus, a11y ------------------------------------------ */
.skip-link {
  position: absolute; left: -1000px; top: -1000px;
  background: var(--ink); color: #fff; padding: 12px 18px;
  border-radius: 8px; z-index: 200;
}
.skip-link:focus { left: 16px; top: 16px; }

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

.screen-reader-text {
  border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
  height: 1px; width: 1px; margin: -1px; padding: 0;
  overflow: hidden; position: absolute !important; word-wrap: normal !important;
}
.screen-reader-text:focus {
  background: var(--surface); clip: auto; clip-path: none;
  color: var(--sage-deep); display: block; height: auto; width: auto;
  left: 16px; top: 16px; padding: 12px 18px; z-index: 200;
  border-radius: 8px; box-shadow: var(--shadow-md);
}

/* 5. Site header + navigation ---------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(250, 247, 242, 0.94);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}

/* Row 1: brand + tools */
.site-header__top-inner {
  display: flex; align-items: center; gap: 18px;
  min-height: 68px; padding-block: 9px;
}
.site-branding { display: flex; align-items: center; gap: 13px; min-width: 0; flex: 1 1 auto; }
.site-branding__logo img { max-height: 50px; width: auto; }
.site-branding__text { min-width: 0; }
.site-title {
  font-family: var(--font-si); font-weight: 700; font-size: clamp(19px, 2vw, 25px);
  line-height: 1.2; margin: 0; color: var(--sage-deep);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-title a { color: inherit; text-decoration: none; }
.site-description {
  margin: 2px 0 0; font-size: 12.5px; color: var(--ink-soft);
  line-height: 1.3; max-width: 60ch;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.header-tools { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; margin-inline-start: auto; }

/* Row 2: nav bar */
.site-nav-bar { border-top: 1px solid var(--line); background: rgba(255,255,255,0.35); }
.primary-nav { display: flex; }
.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.primary-nav a {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 11px 15px; border-radius: 10px;
  color: var(--ink); font-size: 16.5px; font-weight: 500; text-decoration: none;
  white-space: nowrap; transition: background .18s, color .18s;
}
.primary-nav a:hover,
.primary-nav .current-menu-item > a,
.primary-nav .current-menu-parent > a,
.primary-nav .current-menu-ancestor > a { background: var(--surface-2); color: var(--sage-deep); }

/* Dropdown submenus */
.primary-nav li { position: relative; }
.primary-nav .menu-item-has-children > a::after {
  content: ""; width: 7px; height: 7px; margin-left: 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); opacity: .6;
}
.primary-nav ul ul {
  position: absolute; top: 100%; inset-inline-start: 0;
  display: block; min-width: 240px; max-width: 320px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 8px; margin-top: 6px;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .18s, transform .18s, visibility 0s linear .18s;
  z-index: 50; max-height: calc(100vh - 110px); overflow-y: auto;
}
.primary-nav li:hover > ul,
.primary-nav li:focus-within > ul {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .18s, transform .18s, visibility 0s;
}
.primary-nav ul ul li { position: relative; }
.primary-nav ul ul a { display: block; padding: 9px 12px; border-radius: 8px; font-size: 15.5px; font-weight: 500; white-space: normal; }
.primary-nav ul ul ul { top: 0; inset-inline-start: 100%; margin: 0 0 0 6px; }

/* Hamburger (shown on mobile) */
.menu-toggle {
  display: none; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 16px 0 14px; border: 1px solid var(--line);
  background: var(--surface); border-radius: var(--pill); cursor: pointer; color: var(--sage-deep);
  font-family: var(--font-si); font-size: 16px; font-weight: 600;
}
.menu-toggle svg { width: 22px; height: 22px; }
.menu-toggle__label { line-height: 1; }

/* 6. Mobile menu ------------------------------------------------------ */
.mobile-menu {
  position: fixed; inset: 0; z-index: 80;
  background: var(--bg);
  transform: translateX(100%); transition: transform .3s ease;
  overflow-y: auto; visibility: hidden;
}
.mobile-menu.open { transform: translateX(0); visibility: visible; }
.mobile-menu__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg);
}
.mobile-menu__close {
  width: 46px; height: 46px; border: 1px solid var(--line);
  background: var(--surface); border-radius: 12px; cursor: pointer;
  font-size: 22px; color: var(--ink); display: grid; place-items: center;
}
.mobile-menu nav ul { list-style: none; margin: 0; padding: 0; }
.mobile-menu nav a {
  display: block; padding: 15px 22px; font-size: 18px;
  border-bottom: 1px solid var(--line); color: var(--ink);
  text-decoration: none; font-weight: 500;
}
.mobile-menu nav a:hover,
.mobile-menu nav .current-menu-item > a { background: var(--surface-2); color: var(--sage-deep); }
.mobile-menu nav .sub-menu a { padding-inline-start: 42px; font-size: 16px; color: var(--ink-soft); }
.mobile-menu nav .sub-menu .sub-menu a { padding-inline-start: 62px; }
.mobile-menu__search { padding: 18px 22px; border-bottom: 1px solid var(--line); }

.menu-backdrop {
  position: fixed; inset: 0; background: rgba(15,22,30,.4);
  opacity: 0; visibility: hidden; transition: opacity .3s; z-index: 79;
}
.menu-backdrop.open { opacity: 1; visibility: visible; }

body.menu-open { overflow: hidden; }

/* 7. Search ----------------------------------------------------------- */
.search-form { position: relative; display: flex; align-items: center; }
.search-field {
  width: 100%; min-width: 180px; height: 44px;
  border-radius: var(--pill); border: 1px solid var(--line);
  background: var(--surface); padding: 0 46px 0 18px;
  font-size: 16px; font-family: var(--font-ui); color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.search-field::placeholder { color: var(--ink-soft); }
.search-field:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 4px rgba(61,122,106,.15); }
.search-submit {
  position: absolute; inset-inline-end: 5px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: none; border-radius: var(--pill);
  background: transparent; color: var(--ink-soft); cursor: pointer;
  display: grid; place-items: center;
}
.search-submit:hover { color: var(--sage-deep); }
.search-submit svg { width: 18px; height: 18px; }
.header-search { width: clamp(180px, 20vw, 260px); }

/* 8. Buttons & pills -------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--pill);
  font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none;
  border: 1px solid transparent; transition: background .2s, transform .2s, color .2s, border-color .2s;
}
.btn-primary { background: var(--sage); color: #fff; }
.btn-primary:hover { background: var(--sage-deep); color: #fff; transform: translateY(-1px); text-decoration: none; }
.btn-outline { background: transparent; color: var(--sage-deep); border-color: var(--sage); }
.btn-outline:hover { background: var(--sage); color: #fff; text-decoration: none; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px; border-radius: var(--pill);
  background: var(--surface-2); color: var(--sage-deep);
  font-size: 13.5px; font-weight: 600; text-decoration: none;
  border: 1px solid transparent;
}
.pill:hover { background: var(--sage); color: #fff; text-decoration: none; }

/* 9. Reading progress bar -------------------------------------------- */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--saffron), var(--sage));
  z-index: 70; transition: width .1s linear;
}

/* 10. Page hero / titles / breadcrumbs -------------------------------- */
.page-hero { padding-block: clamp(22px, 4vw, 40px) clamp(14px, 2.5vw, 22px); }
.page-hero__eyebrow {
  display: inline-block; color: var(--saffron); font-weight: 600;
  font-size: 14px; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 10px;
}
.page-hero h1 { font-size: clamp(28px, 4.2vw, 42px); margin: 0; }
.page-hero__meta { margin-top: 12px; color: var(--ink-soft); font-size: 15px; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }

.breadcrumbs {
  font-size: 14.5px; color: var(--ink-soft); margin-bottom: 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.breadcrumbs a { color: var(--ink-soft); }
.breadcrumbs a:hover { color: var(--sage-deep); }
.breadcrumbs .sep { opacity: .5; }
.breadcrumbs .current { color: var(--ink); font-weight: 500; }

/* 11. Article (prose) — the reading core ------------------------------ */
.reading-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}
.reading-layout.has-toc {
  grid-template-columns: minmax(0, 1fr) 260px;
}
/* Book index (left) + article (right) */
.reading-layout.has-index {
  grid-template-columns: var(--index-w, 300px) minmax(0, 1fr);
}
.reading-layout.has-index.index-hidden {
  grid-template-columns: minmax(0, 1fr);
}
.reading-layout.index-hidden .reading-index { display: none; }
.reading-layout.has-index .article-card { margin-inline: 0; }
.archive-body { min-width: 0; }

.article-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  padding: clamp(22px, 4vw, 52px);
  margin-inline: auto; width: 100%; max-width: calc(var(--read) + 8rem);
}

.entry-content {
  font-size: calc(19px * var(--reader-scale));
  max-width: var(--read); margin-inline: auto;
}
.entry-content :lang(si),
html[lang^="si"] .entry-content,
.entry-content { line-height: 1.9; }
.entry-content p { margin: 0 0 1.25em; text-align: justify; text-justify: inter-word; hyphens: none; }
.entry-content h2 { font-size: 1.5em; margin: 2em 0 .6em; padding-bottom: .25em; border-bottom: 1px solid var(--line); scroll-margin-top: 96px; }
.entry-content h3 { font-size: 1.25em; margin: 1.6em 0 .5em; scroll-margin-top: 96px; }
.entry-content h4 { font-size: 1.1em; margin: 1.4em 0 .4em; }
.entry-content ul, .entry-content ol { margin: 0 0 1.25em; padding-inline-start: 1.5em; }
.entry-content li { margin-bottom: .5em; }
.entry-content img,
.entry-content figure { border-radius: var(--radius); margin: 1.6rem auto; }
.entry-content figure img { border-radius: var(--radius); }
.entry-content figcaption { text-align: center; color: var(--ink-soft); font-size: .85em; margin-top: .6em; }
.entry-content a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(61,122,106,.4); }
.entry-content a:hover { text-decoration-color: var(--sage); }
.entry-content table { width: 100%; border-collapse: collapse; margin: 1.6rem 0; font-size: .92em; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 10px 12px; text-align: start; }
.entry-content th { background: var(--surface-2); }
.entry-content .wp-caption { max-width: 100%; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content > *:last-child { margin-bottom: 0; }

/* Drop-first-letter feel is intentionally avoided for Sinhala legibility */

/* 12. Post cards / archive grid --------------------------------------- */
.posts-grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.post-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: 24px 24px 22px; display: flex; flex-direction: column; gap: 12px;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #dccfb8; }
.post-card__cats { display: flex; flex-wrap: wrap; gap: 6px; }
.post-card__title { font-size: 1.28rem; line-height: 1.4; margin: 0; }
.post-card__title a { color: var(--sage-deep); text-decoration: none; }
.post-card__title a:hover { color: var(--sage); }
.post-card__excerpt { color: var(--ink-soft); font-size: .98rem; margin: 0; line-height: 1.75;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.post-card__meta { margin-top: auto; padding-top: 10px; display: flex; align-items: center; gap: 12px;
  color: var(--ink-soft); font-size: 13.5px; border-top: 1px solid var(--line); }
.post-card__more { margin-inline-start: auto; color: var(--sage-deep); font-weight: 600; font-size: 14px; }

/* Featured / list intro on home */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head h2 { margin: 0; font-size: clamp(20px, 3vw, 28px); }
.section-head .more-link { color: var(--sage-deep); font-weight: 600; white-space: nowrap; }

/* 13. Book contents index (පටුන) — collapsible chapter tree ----------- */
.reading-index { position: sticky; top: 130px; align-self: start; }
.book-index {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  font-size: 15px; overflow: hidden;
}
.book-index__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.book-index__title { display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-si); font-weight: 700; font-size: 15px; color: var(--sage-deep); }
.book-index__collapse {
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
  display: grid; place-items: center; flex: 0 0 auto;
}
.book-index__collapse:hover { color: var(--sage-deep); background: #fff; }
.bx-collapse-icon { width: 12px; height: 2px; background: currentColor; border-radius: 2px; position: relative; }
.bx-collapse-icon::before { /* chevron-left when expanded to hint "collapse" */
  content: ""; position: absolute; left: -1px; top: 50%;
  width: 7px; height: 7px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}
.book-index__body { max-height: calc(100vh - 190px); overflow-y: auto; padding: 8px; overscroll-behavior: contain; }

.book-index .bx-list { list-style: none; margin: 0; padding: 0; }
.book-index .bx-children { list-style: none; margin: 2px 0 6px; padding: 0 0 0 12px;
  border-inline-start: 1px solid var(--line); }
.book-index .bx-children[hidden] { display: none; }
.bx-item { margin: 1px 0; }
.bx-row { display: flex; align-items: stretch; gap: 2px; }
.bx-link {
  flex: 1 1 auto; display: block; padding: 8px 10px; border-radius: 8px;
  color: var(--ink); line-height: 1.4; text-decoration: none; min-width: 0;
}
.bx-link:hover { background: var(--surface-2); color: var(--sage-deep); text-decoration: none; }
.bx-depth-0 > .bx-row > .bx-link { font-weight: 600; color: var(--sage-deep); }
.bx-item.is-current > .bx-row > .bx-link {
  background: var(--surface-2); color: var(--sage-deep); font-weight: 700;
  box-shadow: inset 3px 0 0 var(--saffron);
}
.bx-toggle {
  flex: 0 0 auto; width: 34px; border: 0; background: none; cursor: pointer;
  color: var(--ink-soft); display: grid; place-items: center; border-radius: 8px;
}
.bx-toggle:hover { background: var(--surface-2); color: var(--sage-deep); }
.bx-caret { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s ease; margin-top: -2px; }
.bx-has-children.is-open > .bx-row > .bx-toggle .bx-caret { transform: rotate(45deg); }

/* Reopen tab, shown only when the index is collapsed away */
.index-reopen {
  display: none; align-items: center; gap: 8px; margin: 0 0 18px;
  padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--pill);
  background: var(--surface); color: var(--sage-deep); font-family: var(--font-si);
  font-weight: 600; font-size: 15px; cursor: pointer; box-shadow: var(--shadow-sm);
}
.index-reopen:hover { background: var(--surface-2); }

/* 14. Post navigation (prev/next chapter) ----------------------------- */
.post-nav {
  max-width: calc(var(--read) + 8rem); margin: 34px auto 0;
  display: grid; gap: 14px; grid-template-columns: 1fr 1fr;
}
.post-nav__link {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; text-decoration: none;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.post-nav__link:hover { border-color: var(--sage); box-shadow: var(--shadow-sm); transform: translateY(-2px); text-decoration: none; }
.post-nav__dir { font-size: 13px; color: var(--saffron); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.post-nav__link.next { text-align: end; }
.post-nav__link.next .post-nav__dir { justify-content: flex-end; }
.post-nav__title { color: var(--sage-deep); font-weight: 600; font-size: 15.5px; line-height: 1.4; }

/* 15. Comments -------------------------------------------------------- */
.comments-area { max-width: calc(var(--read) + 8rem); margin: 40px auto 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(22px, 4vw, 40px); box-shadow: var(--shadow-sm); }
.comments-title, .comment-reply-title { font-size: 1.4rem; margin: 0 0 1rem; }
.comment-list { list-style: none; margin: 0 0 2rem; padding: 0; }
.comment-list .children { list-style: none; margin: 0; padding-inline-start: clamp(14px, 4vw, 40px); }
.comment-body { padding: 16px 0; border-top: 1px solid var(--line); }
.comment-author { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.comment-author .avatar { border-radius: var(--pill); }
.comment-metadata { font-size: 13px; color: var(--ink-soft); margin: 2px 0 8px; }
.comment-content { color: var(--ink); }
.comment-form { display: grid; gap: 14px; }
.comment-form label { font-weight: 600; font-size: 14.5px; display: block; margin-bottom: 4px; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 12px 14px; font: inherit; font-size: 16px; color: var(--ink);
}
.comment-form textarea:focus,
.comment-form input:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 4px rgba(61,122,106,.12); }
.comment-form .form-submit .submit { /* inherits .btn via markup */ }

/* 16. Widgets / sidebar / footer -------------------------------------- */
.widget { margin-bottom: 28px; }
.widget-title { font-size: 1.05rem; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); color: var(--sage-deep); }
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.widget li:last-child { border-bottom: 0; }
.widget a { color: var(--ink-soft); }
.widget a:hover { color: var(--sage-deep); }
.widget .children { padding-inline-start: 16px; }

.site-footer {
  flex-shrink: 0; margin-top: clamp(40px, 6vw, 72px);
  background: #24322e; color: #d8e0dc;
}
.site-footer a { color: #eadfc9; }
.site-footer a:hover { color: #fff; }
.site-footer__inner { display: grid; gap: 34px; padding-block: clamp(34px, 5vw, 56px);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.site-footer .widget-title { color: #f3ecdd; border-bottom-color: rgba(255,255,255,.12); }
.site-footer .widget li { border-bottom-color: rgba(255,255,255,.08); }
.site-footer__brand .site-title { color: #fff; }
.site-footer__brand p { color: #b9c6c0; font-size: 15px; }
.site-footer__bottom { border-top: 1px solid rgba(255,255,255,.1); padding-block: 18px;
  font-size: 14px; color: #a9b7b1; display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; }

/* 17. Reading toolbar (font size, back-to-top) ------------------------ */
.reader-tools {
  position: fixed; inset-inline-end: 18px; bottom: 18px; z-index: 55;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.reader-tools button {
  width: 46px; height: 46px; border-radius: var(--pill);
  background: var(--surface); border: 1px solid var(--line); color: var(--sage-deep);
  cursor: pointer; box-shadow: var(--shadow-md); display: grid; place-items: center;
  font-size: 16px; font-weight: 700; transition: background .2s, transform .2s;
}
.reader-tools button:hover { background: var(--surface-2); transform: translateY(-2px); }
.reader-tools .to-top { opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s, transform .2s; }
.reader-tools .to-top.show { opacity: 1; visibility: visible; }
.reader-tools svg { width: 20px; height: 20px; }
.reader-tools__group { display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--pill); box-shadow: var(--shadow-md); overflow: hidden; }
.reader-tools__group button { border: 0; border-radius: 0; box-shadow: none; width: 46px; height: 42px; }
.reader-tools__group button + button { border-top: 1px solid var(--line); }

/* Only show the font tools on singular reading views (set via body class) */
body:not(.is-reading) .reader-tools__group { display: none; }

/* 18. Utilities, WP core classes -------------------------------------- */
.alignleft { float: left; margin: .4rem 1.6rem 1rem 0; }
.alignright { float: right; margin: .4rem 0 1rem 1.6rem; }
.aligncenter { margin-inline: auto; }
.alignwide { width: min(100%, calc(var(--read) + 6rem)); margin-inline: auto; }
.alignfull { width: 100%; }
.wp-caption-text { color: var(--ink-soft); font-size: .85em; text-align: center; }
.sticky-badge { background: var(--saffron); color: #fff; }
.updated:not(.published) { display: none; }
.gallery { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin: 1.4rem 0; }
.gallery img { border-radius: 10px; }
.text-si { font-family: var(--font-si); }
.muted { color: var(--ink-soft); }

/* Language toggle-ish pill row for bilingual posts (optional helper) */
.lang-note { display: inline-flex; gap: 8px; align-items: center; color: var(--ink-soft); font-size: 14px; }

/* Pagination (the_posts_pagination / comments) */
.pagination, .comments-pagination { margin-top: 36px; }
.pagination .nav-links,
.comments-pagination .nav-links {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center;
}
.pagination .page-numbers,
.comments-pagination .page-numbers {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 44px; height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--pill);
  background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none;
  justify-content: center; transition: background .18s, color .18s, border-color .18s;
}
.pagination a.page-numbers:hover,
.comments-pagination a.page-numbers:hover { background: var(--surface-2); color: var(--sage-deep); border-color: #dccfb8; }
.pagination .page-numbers.current,
.comments-pagination .page-numbers.current { background: var(--sage); color: #fff; border-color: var(--sage); }
.pagination .page-numbers.dots { border-color: transparent; background: transparent; }

/* wp_link_pages inside long posts */
.page-links { margin: 2rem 0 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-weight: 600; }
.page-links > .pill,
.page-links a .pill { text-decoration: none; }

/* Tag list */
.entry-tags a, .tagcloud a {
  display: inline-block; padding: 5px 13px; border-radius: var(--pill);
  background: var(--surface-2); color: var(--sage-deep);
  font-size: 13.5px; font-weight: 600; text-decoration: none; margin: 2px 0;
}
.entry-tags a:hover, .tagcloud a:hover { background: var(--sage); color: #fff; }

/* Comment submit button uses .btn via filter; ensure sane sizing */
.comment-form .form-submit { margin: 0; }
.comment-form .submit { font-family: var(--font-ui); }

/* 19. Responsive ------------------------------------------------------ */
@media (max-width: 1024px) {
  .reading-layout.has-toc { grid-template-columns: minmax(0,1fr); }
  .toc { position: static; max-height: none; order: -1; }
  /* Book index stacks above the article and is collapsed by default (JS). */
  .reading-layout.has-index,
  .reading-layout.has-index.index-hidden { grid-template-columns: minmax(0,1fr); }
  .reading-index { position: static; top: 0; margin-bottom: 4px; }
  .book-index__body { max-height: 60vh; }
  .site-nav-bar { display: none; }
  .menu-toggle { display: inline-flex; }
}
@media (max-width: 560px) {
  .header-search { display: none; }
  .site-description { display: none; }
}
@media (max-width: 600px) {
  body { font-size: 17px; }
  .entry-content { font-size: calc(18px * var(--reader-scale)); }
  .post-nav { grid-template-columns: 1fr; }
  .article-card { padding: 22px 18px; border-radius: var(--radius); }
  .site-description { display: none; }
  .reader-tools { inset-inline-end: 12px; bottom: 12px; }
}

/* 20. Reduced motion + print ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media print {
  .site-header, .site-footer, .reader-tools, .reading-progress,
  .post-nav, .comments-area, .toc, .breadcrumbs, .mobile-menu, .menu-backdrop { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .article-card { box-shadow: none; border: 0; padding: 0; max-width: none; }
  .entry-content { max-width: none; }
  a { color: #000; text-decoration: underline; }
}
