/*
Theme Name: RichHimself Reader
Theme URI: https://www.richhimself.com/
Author: RichHimself
Author URI: https://www.richhimself.com/
Description: A reading-first technical blog theme for RichHimself. Editorial post list, focused article layout with automatic table of contents and copy-to-clipboard code blocks, light/dark mode, self-hosted fonts, and a deliberately restrained ad layout (two placements per page).
Version: 2.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: richhimself-reader
Tags: blog, technology, two-columns, right-sidebar, responsive-layout, accessibility-ready, custom-logo, custom-menu, featured-images
*/

/* ------------------------------------------------------------------ Fonts */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("assets/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "JetBrains Mono Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url("assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
}

/* ----------------------------------------------------------------- Tokens */
:root {
  --ink: #191a2e;          /* logo navy */
  --ink-2: #3a3f55;
  --muted: #646d7e;        /* logo tagline slate */
  --line: #e4e7ed;
  --line-2: #eef0f4;
  --bg: #fafafb;
  --surface: #ffffff;
  --tint: #f2f5fb;
  --accent: #2766ea;       /* logo blue */
  --accent-ink: #1b4fc0;
  --accent-soft: #e8effd;
  --code-bg: #14162a;
  --code-ink: #e6e9f2;
  --sel: #cfdcfb;

  --sans: "Inter Variable", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --max: 1200px;
  --read: 720px;
  --gutter: 24px;
  --r: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eef1f7; --ink-2: #c9cfdc; --muted: #969fb2; --line: #262a40; --line-2: #1d2035;
    --bg: #0e1020; --surface: #14172a; --tint: #191d33; --accent: #6b97ff; --accent-ink: #94b4ff;
    --accent-soft: #1c2647; --code-bg: #0a0b17; --code-ink: #e6e9f2; --sel: #2a3b70;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #eef1f7; --ink-2: #c9cfdc; --muted: #969fb2; --line: #262a40; --line-2: #1d2035;
  --bg: #0e1020; --surface: #14172a; --tint: #191d33; --accent: #6b97ff; --accent-ink: #94b4ff;
  --accent-soft: #1c2647; --code-bg: #0a0b17; --code-ink: #e6e9f2; --sel: #2a3b70;
  color-scheme: dark;
}

/* ------------------------------------------------------------------- Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.7;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--sel); }
img, video, iframe { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { color: var(--ink); text-wrap: balance; }

.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link:focus {
  position: fixed; z-index: 99999; top: 10px; left: 10px; width: auto; height: auto;
  padding: 10px 14px; margin: 0; clip: auto; background: var(--ink); color: var(--bg);
}

.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.container-narrow { max-width: calc(var(--read) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }

/* Small mono kickers echo the </> in the logo */
.kicker, .meta-line, .section-label, .intro-code, .toc-title, .ad-label, .badge, .widget-title, .post-nav span {
  font-family: var(--mono); letter-spacing: .02em;
}
.kicker {
  display: inline-block; color: var(--accent); font-size: .78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; text-decoration: none;
}
a.kicker:hover { text-decoration: underline; }
.meta-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0;
  color: var(--muted); font-size: .76rem; line-height: 1.5;
}
.meta-line > * + *::before { content: "·"; margin: 0 .55em; color: var(--line); color: color-mix(in srgb, var(--muted) 50%, transparent); }
.meta-line .kicker { font-size: .74rem; }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 4px; background: var(--accent); color: #fff;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
}
.meta-line .badge + *::before { content: none; }
.meta-line .badge { margin-right: .7em; }

/* ----------------------------------------------------------------- Header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter);
  min-height: 64px; display: flex; align-items: center; gap: 20px;
}
.site-branding { margin-right: auto; display: flex; align-items: center; }
.brand { display: block; line-height: 0; }
.brand img { height: 26px; width: auto; }
.custom-logo { max-height: 32px; width: auto; }
.brand-dark { display: none; }
:root[data-theme="dark"] .brand-light { display: none; }
:root[data-theme="dark"] .brand-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-light { display: none; }
  :root:not([data-theme="light"]) .brand-dark { display: block; }
}

.primary-navigation ul { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.primary-navigation li { position: relative; }
.primary-navigation a {
  display: block; padding: 7px 11px; color: var(--ink-2); text-decoration: none;
  font-size: .9rem; font-weight: 550; border-radius: 6px;
}
.primary-navigation a:hover { color: var(--ink); background: var(--tint); }
.primary-navigation .current-menu-item > a,
.primary-navigation .current-menu-ancestor > a,
.primary-navigation .current-post-ancestor > a { color: var(--accent); }
.primary-navigation .sub-menu {
  display: none; position: absolute; top: 100%; left: 0; min-width: 210px; padding: 6px;
  flex-direction: column; align-items: stretch; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 30px rgba(10,12,30,.12);
}
.primary-navigation li:hover > .sub-menu,
.primary-navigation li:focus-within > .sub-menu { display: flex; }

.header-tools { display: flex; align-items: center; gap: 2px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--tint); color: var(--ink); }
.menu-toggle { display: none; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

.header-search { border-top: 1px solid var(--line); background: var(--surface); }
.header-search-inner { max-width: 640px; margin: 0 auto; padding: 14px var(--gutter); }

.read-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; }
.read-progress span { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

/* ----------------------------------------------------------------- Search */
.search-form { display: flex; gap: 8px; }
.search-field {
  flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink);
}
.search-field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-submit {
  padding: 9px 14px; border: 0; border-radius: 8px; background: var(--ink); color: var(--bg);
  font-weight: 600; font-size: .9rem; cursor: pointer;
}
.search-submit:hover { background: var(--accent); color: #fff; }

/* ------------------------------------------------------------------- Main */
.site-main { padding: 48px 0 80px; }

.intro { padding: 8px 0 40px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.intro-code { margin: 0 0 12px; color: var(--muted); font-size: .82rem; }
.intro-code .b { color: var(--accent); font-weight: 700; }
.intro-title {
  max-width: 820px; margin: 0; font-size: clamp(1.9rem, 4.2vw, 3rem); line-height: 1.1;
  letter-spacing: -.035em; font-weight: 800;
}

.layout-listing {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; align-items: start;
}
.section-label {
  margin: 36px 0 4px; color: var(--muted); font-size: .76rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
}

/* Featured (newest) post */
.post-feature {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center;
  padding: 36px 0; border-bottom: 1px solid var(--line);
}
.post-feature-media {
  display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--r);
  background: var(--tint); border: 1px solid var(--line);
}
.post-feature-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.post-feature:hover .post-feature-media img { transform: scale(1.02); }
.media-fallback {
  display: grid; place-items: center; height: 100%; font-family: var(--mono); font-weight: 700;
  font-size: 3rem; color: var(--accent); opacity: .5;
}
.post-feature-title { margin: 10px 0 10px; font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.15; letter-spacing: -.03em; font-weight: 800; }
.post-feature-title a, .post-row-title a { color: inherit; text-decoration: none; }
.post-feature-title a:hover, .post-row-title a:hover { color: var(--accent); }
.post-feature-excerpt { margin: 0 0 16px; color: var(--muted); font-size: 1rem; line-height: 1.6; }
.read-link { font-weight: 650; font-size: .92rem; text-decoration: none; }
.read-link:hover span { margin-left: 3px; }

/* Post rows */
.post-list { display: flex; flex-direction: column; }
.post-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 176px; gap: 28px; align-items: start;
  padding: 26px 0; border-bottom: 1px solid var(--line);
}
.post-row:not(:has(.post-row-thumb)) { grid-template-columns: 1fr; }
.post-row-title { margin: 6px 0 6px; font-size: 1.24rem; line-height: 1.3; letter-spacing: -.02em; font-weight: 720; }
.post-row-excerpt {
  margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-row-thumb {
  display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 8px;
  background: var(--tint); border: 1px solid var(--line);
}
.post-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Pagination */
.pagination { margin-top: 36px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pagination .page-numbers {
  display: inline-block; min-width: 38px; padding: 7px 12px; text-align: center;
  border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2);
  text-decoration: none; font-size: .9rem; font-variant-numeric: tabular-nums;
}
.pagination a.page-numbers:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pagination .prev { margin-right: auto; }
.pagination .next { margin-left: auto; }

/* ---------------------------------------------------------------- Sidebar */
.sidebar { padding-top: 36px; display: flex; flex-direction: column; gap: 32px; align-self: stretch; }
.sidebar .widget { margin: 0; }
.widget-title {
  margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
}
.widget ul { margin: 0; padding: 0; list-style: none; }
.widget li { padding: 5px 0; font-size: .94rem; }
.widget li a { color: var(--ink-2); text-decoration: none; }
.widget li a:hover { color: var(--accent); }
.topic-list li { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-family: var(--mono); font-size: .78rem; }
.topic-list li a { font-family: var(--sans); font-size: .94rem; }
.sidebar-sticky { position: sticky; top: 88px; }

/* ---------------------------------------------------------------- Article */
.article-header { padding-top: 8px; margin-bottom: 28px; }
.article-title {
  margin: 10px 0 14px; font-size: clamp(2rem, 4.6vw, 3rem); line-height: 1.08;
  letter-spacing: -.035em; font-weight: 800;
}
.article-dek { margin: 0 0 16px; color: var(--muted); font-size: 1.15rem; line-height: 1.55; }
.article-meta { padding-top: 14px; border-top: 1px solid var(--line); }
.article-hero { margin: 0 auto 36px; }
.article-hero img { display: block; width: 100%; border-radius: var(--r); border: 1px solid var(--line); }

.article-grid {
  max-width: calc(var(--read) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter);
}
.article-rail { display: none; }

.article-content { font-size: 1.06rem; line-height: 1.75; color: var(--ink); }
.article-content > *:first-child { margin-top: 0; }
.article-content p, .article-content ul, .article-content ol { margin: 0 0 1.25em; }
.article-content li + li { margin-top: .35em; }
.article-content h2 {
  margin: 2.2em 0 .7em; font-size: 1.6rem; line-height: 1.22; letter-spacing: -.025em; font-weight: 780;
}
.article-content h3 { margin: 1.9em 0 .6em; font-size: 1.24rem; line-height: 1.3; letter-spacing: -.015em; font-weight: 720; }
.article-content h4 { margin: 1.6em 0 .5em; font-size: 1.05rem; }
.article-content a { font-weight: 520; }
.article-content strong { font-weight: 680; }
.article-content hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.article-content blockquote {
  margin: 1.6em 0; padding: 14px 20px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--ink-2);
}
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content figure { margin: 1.8em 0; }
.article-content img { border-radius: 8px; }
.article-content figcaption, .article-content .wp-element-caption {
  margin-top: 8px; color: var(--muted); font-size: .84rem; text-align: center;
}
.article-content .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.article-content .alignwide { margin-left: -60px; margin-right: -60px; max-width: none; }

/* Code */
.article-content code, .article-content kbd, .article-content samp { font-family: var(--mono); font-size: .86em; }
.article-content :not(pre) > code {
  padding: .12em .4em; border-radius: 5px; background: var(--tint);
  border: 1px solid var(--line-2); color: var(--ink); word-break: break-word;
}
.article-content kbd {
  padding: .1em .45em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface);
}
.code-wrap { position: relative; margin: 1.6em 0; }
.article-content pre {
  margin: 0; padding: 18px 20px; overflow: auto; background: var(--code-bg); color: var(--code-ink);
  border-radius: var(--r); font-size: .86rem; line-height: 1.65; tab-size: 4;
  border: 1px solid var(--line);
}
.article-content > pre { margin: 1.6em 0; }
.article-content pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.copy-btn {
  position: absolute; top: 8px; right: 8px; padding: 4px 9px; border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px; background: rgba(255,255,255,.06); color: #b9c0d4; font-family: var(--mono);
  font-size: .7rem; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code-wrap:hover .copy-btn, .copy-btn:focus-visible, .copy-btn.ok { opacity: 1; }
.copy-btn:hover { color: #fff; background: rgba(255,255,255,.12); }
.copy-btn.ok { color: #7ee2a8; border-color: rgba(126,226,168,.4); }
@media (hover: none) { .copy-btn { opacity: 1; } }

/* Tables */
.article-content .wp-block-table, .article-content table { overflow-x: auto; }
.article-content table { width: 100%; border-collapse: collapse; margin: 1.6em 0; font-size: .92rem; }
.article-content th, .article-content td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.article-content th { font-weight: 650; border-bottom: 2px solid var(--ink); }

.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 36px; }
.post-tags a {
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
  text-decoration: none; font-family: var(--mono); font-size: .74rem; font-weight: 400;
}
.post-tags a::before { content: "#"; color: var(--accent); }
.post-tags a:hover { border-color: var(--accent); color: var(--accent); }

/* TOC (desktop rail) */
.toc { font-size: .84rem; }
.toc-title { margin: 0 0 10px; color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; }
.toc ol { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent;
  color: var(--muted); text-decoration: none; line-height: 1.4;
}
.toc .toc-h3 a { padding-left: 26px; font-size: .8rem; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

@media (min-width: 1240px) {
  .article-grid.has-toc {
    max-width: 1320px; display: grid; gap: 56px;
    grid-template-columns: minmax(0, 1fr) var(--read) minmax(0, 1fr);
  }
  .article-grid.has-toc .article-content { grid-column: 2; }
  .article-grid.has-toc .article-rail { display: block; grid-column: 3; }
  .article-grid.has-toc .toc { position: sticky; top: 96px; max-width: 240px; max-height: calc(100vh - 120px); overflow: auto; }
}

/* Prev / next */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 48px 0 0; }
.post-nav a {
  display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r);
  color: var(--ink); text-decoration: none; font-weight: 650; line-height: 1.35; font-size: .95rem;
}
.post-nav a:hover { border-color: var(--accent); }
.post-nav span { display: block; margin-bottom: 4px; color: var(--muted); font-size: .72rem; font-weight: 500; }
.post-nav-next { grid-column: 2; text-align: right; }

.related { margin-top: 48px; }
.related .section-label { margin-top: 0; }

/* ------------------------------------------------------------------- Ads
   Ads sit in clearly separated, labelled bands with reserved height so the
   page doesn't jump when they load (better Core Web Vitals). */
.ad-slot {
  position: relative; margin: 36px 0; padding: 22px 0 18px; text-align: center;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  min-height: 140px; clear: both;
}
.ad-slot .widget { margin: 0; padding: 0; background: none; border: 0; }
.ad-slot .widget-title { display: none; }
.ad-label {
  position: absolute; top: -.7em; left: 50%; transform: translateX(-50%);
  padding: 0 10px; background: var(--bg); color: var(--muted); opacity: .8;
  font-size: .64rem; text-transform: uppercase; letter-spacing: .14em; line-height: 1.4;
}
.ad-slot--inline { min-height: 280px; margin: 2.2em 0; }
.ad-slot--feed { margin: 0; border-top: 0; min-height: 120px; padding: 30px 0 26px; }
.ad-slot--feed .ad-label { top: 8px; }
.ad-slot--sidebar { margin: 0; min-height: 250px; border: 1px solid var(--line); border-radius: var(--r); padding: 26px 12px 12px; }
.ad-slot--sidebar .ad-label { top: 6px; background: none; }
.ad-slot--end { margin-top: 48px; }

/* ----------------------------------------------------------- Archive/404 */
.archive-header { padding: 8px 0 32px; border-bottom: 1px solid var(--line); }
.archive-header h1 { margin: 0; font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.1; letter-spacing: -.035em; font-weight: 800; }
.archive-desc { max-width: 680px; margin-top: 10px; color: var(--muted); }
.archive-desc p { margin: 0; }
.notfound { padding: 40px var(--gutter); }
.notfound p { color: var(--muted); }
.empty { color: var(--muted); padding: 30px 0; }

/* ----------------------------------------------------------------- Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner {
  max-width: var(--max); margin: 0 auto; padding: 48px var(--gutter) 32px;
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px;
}
.footer-brand .brand img { height: 22px; }
.footer-tag { margin: 10px 0 8px; font-family: var(--mono); font-size: .76rem; color: var(--muted); letter-spacing: .04em; }
.site-footer p, .site-footer li { color: var(--muted); font-size: .9rem; }
.site-footer .widget li a { color: var(--muted); }
.footer-bottom {
  max-width: var(--max); margin: 0 auto; padding: 18px var(--gutter) 28px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem;
}
.footer-bottom p { margin: 0; font-size: .82rem; }
.footer-bottom ul { display: flex; flex-wrap: wrap; gap: 18px; margin: 0; padding: 0; list-style: none; }
.footer-bottom a { color: var(--muted); text-decoration: none; }
.footer-bottom a:hover { color: var(--accent); }

/* Comments (basic) */
.comments-area { margin-top: 48px; }
.comment-list { list-style: none; padding: 0; }
.comment-body { padding: 16px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.comment-form textarea, .comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"] {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
}
.comment-form .submit { padding: 9px 16px; border: 0; border-radius: 8px; background: var(--ink); color: var(--bg); font-weight: 600; cursor: pointer; }

/* ------------------------------------------------------------- Responsive */
@media (max-width: 960px) {
  .layout-listing { grid-template-columns: 1fr; gap: 0; }
  .sidebar { padding-top: 48px; }
  .sidebar-sticky { position: static; }
  .menu-toggle { display: inline-grid; }
  .header-inner { flex-wrap: wrap; }
  .primary-navigation { display: none; order: 3; width: 100%; padding: 4px 0 14px; }
  .primary-navigation.is-open { display: block; }
  .primary-navigation ul { flex-direction: column; align-items: stretch; }
  .primary-navigation .sub-menu { display: flex; position: static; box-shadow: none; border: 0; padding: 0 0 0 14px; background: none; }
  .article-content .alignwide { margin-left: 0; margin-right: 0; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .site-main { padding: 28px 0 56px; }
  .brand img { height: 21px; }
  .intro { padding-bottom: 28px; }
  .post-feature { grid-template-columns: 1fr; gap: 18px; padding: 28px 0; }
  .post-row { grid-template-columns: minmax(0, 1fr) 92px; gap: 16px; padding: 20px 0; }
  .post-row-thumb { aspect-ratio: 1; margin-top: 4px; }
  .post-row-title { font-size: 1.08rem; }
  .post-row-excerpt { display: none; }
  .post-row .meta-line > :last-child { display: none; }
  .intro-title { font-size: 1.75rem; }
  .article-content { font-size: 1.02rem; }
  .article-content pre { margin-left: calc(var(--gutter) * -1); margin-right: calc(var(--gutter) * -1); border-radius: 0; border-left: 0; border-right: 0; }
  .ad-slot--inline { min-height: 250px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-next { grid-column: auto; }
  .footer-inner { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
@media print {
  .site-header, .site-footer, .ad-slot, .article-rail, .post-nav, .related, .copy-btn { display: none !important; }
  body { background: #fff; color: #000; }
}
