/*
Theme Name: TrustPost
Theme URI: https://trustpost.org
Author: Ayush Shah
Author URI: https://trustpost.org
Description: A fast, clean, SEO-friendly blog theme with reading-optimized typography, real dark mode, and a reading-progress bar. Built for trustpost.org.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
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: trustpost
Tags: blog, one-column, custom-menu, featured-images, translation-ready, full-width-template
*/

/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1a1a18;
  --text-soft: #55534d;
  --text-faint: #8a8781;
  --border: #e8e5dd;
  --accent: #b5432a;
  --accent-soft: #f7ece8;
  --radius: 12px;
  --maxw: 44rem;
  --wide: 60rem;
  --xwide: 74rem;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Georgia", Charter, serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
[data-theme="dark"] {
  --bg: #131311;
  --surface: #1b1b18;
  --text: #ece9e2;
  --text-soft: #b3afa6;
  --text-faint: #7d7a72;
  --border: #2c2b27;
  --accent: #e2795f;
  --accent-soft: #2a1c17;
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .3s ease, color .3s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }
::selection { background: var(--accent); color: #fff; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }

.screen-reader-text {
  border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
  height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(150%) blur(10px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}
.header-top .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; max-width: var(--wide);
}
.brand { font-weight: 700; font-size: 1.35rem; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.custom-logo { max-height: 40px; width: auto; display: block; }

.header-tools { display: flex; align-items: center; gap: 10px; }
.tool-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); cursor: pointer;
  transition: color .2s, border-color .2s;
}
.tool-btn:hover { color: var(--text); border-color: var(--text-faint); }

/* Search drawer */
.header-search { border-top: 1px solid var(--border); }
.header-search .wrap { max-width: var(--wide); padding-top: .75rem; padding-bottom: .75rem; }
.header-search form { display: flex; gap: .5rem; }
.header-search .search-field {
  flex: 1; padding: .7rem 1rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 1rem; font-family: var(--font-sans);
}
.header-search .search-field:focus { outline: none; border-color: var(--accent); }
.header-search .search-submit {
  padding: .7rem 1.25rem; border: none; border-radius: 8px; background: var(--accent);
  color: #fff; font-weight: 600; cursor: pointer; font-family: var(--font-sans);
}

/* Category nav bar */
.header-nav { border-top: 1px solid var(--border); }
.header-nav .wrap { max-width: var(--wide); padding: 0 1.5rem; }
.header-nav ul {
  display: flex; list-style: none; margin: 0; padding: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.header-nav ul::-webkit-scrollbar { display: none; }
.header-nav li { flex: 0 0 auto; }
.header-nav a {
  display: block; padding: .8rem 1rem; white-space: nowrap;
  font-family: var(--font-sans); font-size: .9rem; font-weight: 500;
  color: var(--text-soft); border-bottom: 2px solid transparent;
}
.header-nav a:hover { color: var(--accent); text-decoration: none; border-bottom-color: var(--accent); }
.header-nav .current-menu-item > a,
.header-nav .current_page_item > a { color: var(--text); border-bottom-color: var(--accent); }

.theme-toggle {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); cursor: pointer; font-size: 1.05rem;
  transition: color .2s, border-color .2s, transform .2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-faint); transform: rotate(15deg); }

/* ============================================================
   Hero / intro
   ============================================================ */
.hero { padding: 4.5rem 0 2.5rem; text-align: center; }
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1.08; letter-spacing: -.03em; margin: 0 0 1rem;
}
.hero p { font-size: 1.15rem; color: var(--text-soft); max-width: 34rem; margin: 0 auto; }

/* ============================================================
   Post list
   ============================================================ */
.posts { padding: 1rem 0 5rem; }
.post-card {
  display: block; padding: 1.75rem 0; border-top: 1px solid var(--border); color: inherit;
}
.post-card:hover { text-decoration: none; }
.post-card:hover .post-card-title { color: var(--accent); }
.post-card-thumb { margin-bottom: 1rem; overflow: hidden; border-radius: var(--radius); }
.post-card-thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; transition: transform .4s ease; }
.post-card:hover .post-card-thumb img { transform: scale(1.03); }
.post-meta { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; font-size: .82rem; color: var(--text-faint); margin-bottom: .55rem; }
.tag {
  font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: .18rem .5rem; border-radius: 999px;
}
.tag:hover { text-decoration: none; opacity: .85; }
.post-card-title {
  font-family: var(--font-serif); font-size: 1.6rem; line-height: 1.2;
  letter-spacing: -.02em; margin: 0 0 .5rem; color: var(--text); transition: color .2s;
}
.post-card-excerpt { color: var(--text-soft); margin: 0; font-size: 1.02rem; }
.featured {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; margin-bottom: .5rem;
}
.featured .post-card { border-top: none; padding: 0; }
.featured .post-card-title { font-size: 2rem; }

/* ============================================================
   Magazine homepage (home.php)
   ============================================================ */
.container { max-width: var(--xwide); margin: 0 auto; padding: 0 1.5rem; }

.home-lead { padding: 2.5rem 0 1rem; }
.lead-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 2.5rem; align-items: start; }

.c-lead { display: block; color: inherit; }
.c-lead:hover { text-decoration: none; }
.c-lead-thumb { border-radius: 12px; overflow: hidden; margin-bottom: 1.1rem; }
.c-lead-thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; transition: transform .5s ease; }
.c-lead:hover .c-lead-thumb img { transform: scale(1.03); }
.c-lead-title {
  font-family: var(--font-serif); font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.14; letter-spacing: -.02em; margin: .55rem 0 .55rem; color: var(--text); transition: color .2s;
}
.c-lead:hover .c-lead-title { color: var(--accent); }
.c-lead-excerpt { color: var(--text-soft); font-size: 1.05rem; line-height: 1.6; margin: 0; }

.lead-side { display: flex; flex-direction: column; }
.c-mini {
  display: grid; grid-template-columns: 92px 1fr; gap: 1rem; align-items: start;
  padding: 1.1rem 0; border-top: 1px solid var(--border); color: inherit;
}
.lead-side .c-mini:first-child { border-top: none; padding-top: 0; }
.c-mini:hover { text-decoration: none; }
.c-mini-thumb { border-radius: 8px; overflow: hidden; }
.c-mini-thumb img { width: 92px; height: 69px; object-fit: cover; display: block; }
.c-mini-title {
  font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.25; margin: .35rem 0 0;
  color: var(--text); transition: color .2s;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.c-mini:hover .c-mini-title { color: var(--accent); }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 2.75rem 0 1.5rem; border-bottom: 1px solid var(--border);
}
.section-head h2 {
  font-family: var(--font-sans); font-size: 1rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; margin: 0;
  padding-bottom: .6rem; border-bottom: 2px solid var(--accent);
}
.section-head a { font-size: .85rem; color: var(--text-soft); }

.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2.25rem 1.75rem; }
.g-card { display: block; color: inherit; }
.g-card:hover { text-decoration: none; }
.g-card-thumb { border-radius: 10px; overflow: hidden; margin-bottom: .85rem; }
.g-card-thumb img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; transition: transform .5s ease; }
.g-card:hover .g-card-thumb img { transform: scale(1.04); }
.g-card-thumb--empty { aspect-ratio: 16 / 10; background: var(--surface); border: 1px solid var(--border); }
.g-card-title {
  font-family: var(--font-serif); font-size: 1.2rem; line-height: 1.25; letter-spacing: -.01em;
  margin: .4rem 0 .4rem; color: var(--text); transition: color .2s;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.g-card:hover .g-card-title { color: var(--accent); }
.g-card-excerpt {
  color: var(--text-soft); font-size: .95rem; line-height: 1.55; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

@media (max-width: 800px) {
  .lead-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .lead-side { margin-top: .25rem; }
}

/* ============================================================
   Article (single)
   ============================================================ */
.article { padding: 3rem 0 4rem; }
.article-header { margin-bottom: 2.5rem; }
.article-header h1 {
  font-family: var(--font-serif); font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.12; letter-spacing: -.025em; margin: .75rem 0 1rem;
}
.article-lead { font-size: 1.25rem; color: var(--text-soft); line-height: 1.55; }
.article-hero { max-width: var(--wide); margin: 0 auto 2.5rem; padding: 0 1.5rem; }
.article-hero img { width: 100%; border-radius: var(--radius); }
.byline { display: flex; align-items: center; gap: .75rem; margin-top: 1.75rem; font-size: .9rem; color: var(--text-faint); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.avatar + div strong { color: var(--text); font-weight: 600; }

.prose { font-family: var(--font-serif); font-size: 1.22rem; line-height: 1.75; color: var(--text); }
.prose > * { margin-block: 1.4rem; }
.prose h2 { font-size: 1.7rem; letter-spacing: -.02em; margin-top: 2.6rem; line-height: 1.25; }
.prose h3 { font-size: 1.35rem; margin-top: 2rem; }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose blockquote {
  border-left: 3px solid var(--accent); margin-inline: 0; padding: .3rem 0 .3rem 1.5rem;
  color: var(--text-soft); font-style: italic;
}
.prose code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--surface); border: 1px solid var(--border);
  padding: .12em .38em; border-radius: 6px;
}
.prose pre {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; overflow-x: auto; font-size: .95rem;
}
.prose pre code { background: none; border: none; padding: 0; }
.prose img { border-radius: var(--radius); margin-block: 2rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-block: .5rem; }
.prose hr { border: none; border-top: 1px solid var(--border); margin-block: 3rem; }

/* ============================================================
   WordPress core classes
   ============================================================ */
.alignleft { float: left; margin: .3rem 1.5rem 1rem 0; }
.alignright { float: right; margin: .3rem 0 1rem 1.5rem; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: .85rem; color: var(--text-faint); text-align: center; margin-top: .5rem; font-family: var(--font-sans); }
.sticky .post-card-title::before { content: "★ "; color: var(--accent); }
.wp-block-image img { border-radius: var(--radius); }

/* ============================================================
   Pagination
   ============================================================ */
.pagination { padding: 1rem 0 4rem; }
.pagination .nav-links { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.pagination .page-numbers {
  display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 .5rem;
  border: 1px solid var(--border); border-radius: 8px; color: var(--text-soft); font-size: .95rem;
}
.pagination .page-numbers.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a.page-numbers:hover { border-color: var(--text-faint); text-decoration: none; color: var(--text); }

/* ============================================================
   Reading progress bar
   ============================================================ */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 30; transition: width .1s linear; }

/* ============================================================
   Comments
   ============================================================ */
.comments-area { max-width: var(--maxw); margin: 3rem auto 0; padding: 2rem 1.5rem 0; border-top: 1px solid var(--border); }
.comments-area h2 { font-family: var(--font-serif); }
.comment-list { list-style: none; padding: 0; }
.comment-body { padding: 1rem 0; border-bottom: 1px solid var(--border); }

/* ============================================================
   Footer
   ============================================================ */
.site-footer { border-top: 1px solid var(--border); padding: 3rem 0 2rem; color: var(--text-faint); font-size: .9rem; margin-top: 2rem; }
.site-footer a { color: var(--text-soft); }
.site-footer a:hover { color: var(--text); }
.footer-inner {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 1.5rem 2rem; max-width: var(--wide);
}
.footer-brand { display: flex; flex-direction: column; gap: .25rem; }
.footer-title { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.footer-tagline { color: var(--text-faint); max-width: 18rem; }
.footer-menu-list {
  display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; list-style: none; margin: 0; padding: 0;
  max-width: 26rem; justify-content: center;
}
.footer-menu-list a { font-size: .9rem; }
.footer-social { display: flex; gap: .75rem; align-items: center; }
.footer-social a {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  transition: color .2s, border-color .2s;
}
.footer-social a:hover { color: var(--accent); border-color: var(--text-faint); }
.footer-copy { max-width: var(--wide); margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

@media (max-width: 500px) {
  .nav ul { display: none; }
}

/* ============================================================
   Accessibility
   ============================================================ */
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 8px;
  transition: top .2s;
}
.skip-link:focus { top: 8px; text-decoration: none; clip: auto; clip-path: none; width: auto; height: auto; }

/* ============================================================
   Breadcrumbs
   ============================================================ */
.breadcrumbs { margin: 0 0 1.25rem; font-family: var(--font-sans); font-size: .82rem; color: var(--text-faint); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; }
.breadcrumbs li { display: flex; align-items: center; gap: .4rem; }
.breadcrumbs li:not(:last-child)::after { content: "/"; color: var(--text-faint); }
.breadcrumbs a { color: var(--text-soft); }
.breadcrumbs [aria-current="page"] { color: var(--text-faint); }

/* ============================================================
   Byline avatar + featured figure
   ============================================================ */
.byline { align-items: center; }
.byline-avatar { flex: 0 0 auto; }
.byline-avatar img, img.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: block; }
.byline strong a { color: var(--text); }
.byline strong a:hover { color: var(--accent); }

.article-hero { margin: 0 auto 2.5rem; }
.article-hero figcaption {
  max-width: var(--maxw); margin: .6rem auto 0; padding: 0 1.5rem;
  font-family: var(--font-sans); font-size: .85rem; color: var(--text-faint);
}

/* ============================================================
   Tags
   ============================================================ */
.post-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 2.5rem 0 0; font-family: var(--font-sans); }
.post-tags-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-right: .25rem; }
.post-tags a { font-size: .85rem; color: var(--text-soft); background: var(--surface); border: 1px solid var(--border); padding: .3rem .7rem; border-radius: 999px; }
.post-tags a:hover { color: var(--accent); border-color: var(--text-faint); text-decoration: none; }

/* ============================================================
   Share row
   ============================================================ */
.share { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin: 2rem 0; padding: 1.1rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-family: var(--font-sans); }
.share-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-right: .25rem; }
.share-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); cursor: pointer; transition: color .2s, border-color .2s; }
.share-btn:hover { color: var(--accent); border-color: var(--text-faint); text-decoration: none; }
.copied-note { position: absolute; top: -30px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: .72rem; padding: .2rem .5rem; border-radius: 6px; white-space: nowrap; }

/* ============================================================
   Author box
   ============================================================ */
.author-box { display: flex; gap: 1.1rem; align-items: flex-start; margin: 2.5rem 0; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; font-family: var(--font-sans); }
.author-box-avatar img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: block; }
.author-box-eyebrow { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.author-box-name { display: block; font-size: 1.15rem; font-weight: 700; margin: .1rem 0 .5rem; color: var(--text); }
.author-box-bio { margin: 0 0 .6rem; color: var(--text-soft); font-size: .95rem; line-height: 1.6; }
.author-box-link { font-size: .9rem; font-weight: 500; }

/* ============================================================
   Post navigation
   ============================================================ */
.post-navigation { margin: 2.5rem 0; }
.post-navigation .nav-links { display: flex; gap: 1rem; }
.post-navigation .nav-previous, .post-navigation .nav-next { flex: 1; }
.post-navigation .nav-next { text-align: right; }
.post-navigation a { display: block; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: 12px; font-family: var(--font-sans); }
.post-navigation a:hover { border-color: var(--text-faint); text-decoration: none; }
.post-navigation .nav-dir { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-bottom: .3rem; }
.post-navigation .nav-label { display: block; font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.3; color: var(--text); }
.post-navigation a:hover .nav-label { color: var(--accent); }

/* ============================================================
   Related
   ============================================================ */
.related { margin: 3rem 0; }
.related-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.75rem 1.25rem; }
.related-grid .g-card-title { font-size: 1.05rem; }
.related-grid .g-card-excerpt { display: none; }

/* ============================================================
   Newsletter / CTA
   ============================================================ */
.cta { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; text-align: center; margin: 3rem 0; font-family: var(--font-sans); }
.cta h3 { font-family: var(--font-serif); font-size: 1.5rem; margin: 0 0 .5rem; }
.cta p { color: var(--text-soft); margin: 0 0 1.25rem; }
.cta-form { display: flex; gap: .5rem; max-width: 24rem; margin: 0 auto; }
.cta-form input { flex: 1; padding: .7rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 1rem; font-family: var(--font-sans); }
.cta-form input:focus { outline: none; border-color: var(--accent); }
.cta-form button { padding: .7rem 1.25rem; border: none; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; font-size: 1rem; cursor: pointer; font-family: var(--font-sans); }
.cta-form button:hover { opacity: .9; }
.cta-thanks { margin: 0; color: var(--text); font-weight: 500; }

/* ============================================================
   Comments
   ============================================================ */
.comments-area { max-width: var(--maxw); margin: 3rem auto 0; padding: 2rem 0 0; border-top: 1px solid var(--border); font-family: var(--font-sans); }
.comments-title { font-family: var(--font-serif); font-size: 1.5rem; margin: 0 0 1.5rem; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list ol.children { list-style: none; margin: 0 0 0 1.5rem; padding: 0; }
.comment-body { padding: 1.25rem 0; border-bottom: 1px solid var(--border); }
.comment-author { display: flex; align-items: center; gap: .6rem; font-size: .95rem; }
.comment-author .avatar { width: 40px; height: 40px; }
.comment-author .fn { font-weight: 600; font-style: normal; color: var(--text); }
.comment-metadata { font-size: .8rem; color: var(--text-faint); margin: .2rem 0 .5rem; }
.comment-metadata a { color: var(--text-faint); }
.comment-content { color: var(--text-soft); line-height: 1.7; }
.comment-content p { margin: .5rem 0; }
.reply { font-size: .85rem; }
.comment-respond { margin-top: 2rem; }
.comment-reply-title { font-family: var(--font-serif); font-size: 1.3rem; }
.comment-form { display: grid; gap: 1rem; margin-top: 1rem; }
.comment-form input[type=text], .comment-form input[type=email], .comment-form input[type=url], .comment-form textarea {
  width: 100%; padding: .7rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-family: var(--font-sans); font-size: 1rem;
}
.comment-form textarea { min-height: 120px; }
.comment-submit {
  justify-self: start; padding: .7rem 1.4rem; border: none; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; font-family: var(--font-sans);
}
.comment-submit:hover { opacity: .9; }

/* ============================================================
   404
   ============================================================ */
.error-404 { text-align: center; padding: 3rem 0 2rem; }
.error-404 .error-code { display: block; font-family: var(--font-serif); font-size: clamp(4rem, 14vw, 7rem); font-weight: 700; color: var(--accent); line-height: 1; letter-spacing: -.03em; }
.error-404 h1 { font-family: var(--font-serif); margin: .5rem 0 1rem; }
.error-404 p { color: var(--text-soft); max-width: 32rem; margin: 0 auto 1.5rem; }
.error-404 .search-form { max-width: 26rem; margin: 0 auto 1rem; }
.error-404 .error-home-link { display: inline-block; margin-bottom: 2.5rem; font-family: var(--font-sans); font-weight: 500; }
.error-404 .section-head, .error-404 .g-grid { text-align: left; }

/* ============================================================
   Footer widgets
   ============================================================ */
.footer-widgets { border-top: 1px solid var(--border); padding: 3rem 0 1rem; }
.footer-widgets-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; max-width: var(--wide); }
.footer-col .widget { margin-bottom: 1.5rem; font-family: var(--font-sans); font-size: .95rem; color: var(--text-soft); }
.widget-title { font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text); margin: 0 0 1rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: .4rem 0; }
.footer-col a { color: var(--text-soft); }
.footer-col a:hover { color: var(--accent); }

/* ============================================================
   Generic search form
   ============================================================ */
.search-form { display: flex; gap: .5rem; }
.search-form .search-field { flex: 1; padding: .7rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-family: var(--font-sans); font-size: 1rem; }
.search-form .search-submit { padding: .7rem 1.25rem; border: none; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; font-family: var(--font-sans); }

@media (max-width: 600px) {
  .post-navigation .nav-links { flex-direction: column; }
  .post-navigation .nav-next { text-align: left; }
  .author-box { flex-direction: column; }
}

/* ============================================================
   Live search dropdown
   ============================================================ */
.header-search .wrap { position: relative; }
.search-results { position: absolute; left: 1.5rem; right: 1.5rem; top: calc(100% - .1rem); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; z-index: 40; }
.search-results a { display: block; padding: .7rem 1rem; color: var(--text); font-size: .95rem; border-bottom: 1px solid var(--border); }
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--bg); color: var(--accent); text-decoration: none; }
.search-empty { padding: .8rem 1rem; color: var(--text-faint); font-size: .9rem; }

/* ============================================================
   Load more
   ============================================================ */
.load-more-wrap { text-align: center; padding: 1rem 0 4rem; }
.load-more { font-family: var(--font-sans); font-size: .95rem; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border); padding: .8rem 1.8rem; border-radius: 999px; cursor: pointer; transition: border-color .2s, color .2s; }
.load-more:hover { border-color: var(--text-faint); color: var(--accent); }
.load-more[disabled] { opacity: .6; cursor: default; }

/* ============================================================
   Trending strip
   ============================================================ */
.home-trending { padding: 1rem 0; }
.trending-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1.5rem; }
.trending-item { display: flex; gap: .75rem; align-items: baseline; color: inherit; padding: .7rem 0; border-top: 1px solid var(--border); }
.trending-item:hover { text-decoration: none; }
.trending-num { font-family: var(--font-serif); font-size: 1.4rem; font-weight: 700; color: var(--accent); line-height: 1; flex: 0 0 auto; width: 1.4rem; }
.trending-text { display: flex; flex-direction: column; gap: .15rem; }
.trending-cat { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.trending-title { font-family: var(--font-serif); font-size: 1rem; line-height: 1.25; color: var(--text); }
.trending-item:hover .trending-title { color: var(--accent); }

/* ============================================================
   Reading tools (single post)
   ============================================================ */
.reading-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0 0 1.75rem; padding: .6rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-family: var(--font-sans); }
.rt-group { display: inline-flex; }
.rt-btn { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--font-sans); font-size: .85rem; color: var(--text-soft); background: var(--surface); border: 1px solid var(--border); padding: .4rem .7rem; border-radius: 8px; cursor: pointer; transition: color .2s, border-color .2s; }
.rt-btn:hover { color: var(--accent); border-color: var(--text-faint); }
.rt-group .rt-btn { border-radius: 0; }
.rt-group .rt-btn:first-child { border-radius: 8px 0 0 8px; }
.rt-group .rt-btn:last-child { border-radius: 0 8px 8px 0; border-left: none; }
.rt-btn.is-active, .rt-save.is-saved { color: var(--accent); border-color: var(--accent); }
.reading-tools .rt-save { margin-left: auto; }

/* ============================================================
   Table of contents
   ============================================================ */
.toc { font-family: var(--font-sans); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.25rem; margin: 0 0 2rem; }
.toc summary { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); cursor: pointer; }
.toc ol { margin: .75rem 0 0; padding-left: 1.2rem; }
.toc li { margin: .35rem 0; }
.toc a { color: var(--text-soft); font-size: .95rem; }
.toc a:hover { color: var(--accent); }
.toc .toc-sub { margin-left: 1rem; list-style: circle; }

/* ============================================================
   Saved articles dropdown
   ============================================================ */
.header-tools { position: relative; }
.saved-panel { position: absolute; top: calc(100% + .5rem); right: 0; width: 280px; max-height: 360px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .5rem; z-index: 50; }
.saved-item { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem; border-bottom: 1px solid var(--border); }
.saved-item:last-child { border-bottom: none; }
.saved-item a { font-size: .9rem; color: var(--text); line-height: 1.3; }
.saved-item a:hover { color: var(--accent); }
.saved-remove { border: none; background: none; color: var(--text-faint); font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 0 .2rem; }
.saved-remove:hover { color: var(--accent); }
.saved-empty { padding: .8rem; color: var(--text-faint); font-size: .9rem; margin: 0; text-align: center; }

/* ============================================================
   Back to top
   ============================================================ */
.to-top { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 40; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; border: none; cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .2s, transform .2s, visibility .2s; }
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { opacity: .9; }

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .post-card-thumb img, .g-card-thumb img, .c-lead-thumb img, .c-mini-thumb img { transition: none; }
  .to-top { transition: none; }
}
