/*
Theme Name: Автопілот
Theme URI: https://avtopilot.com.ua
Author: Avtopilot Editorial
Author URI: https://avtopilot.com.ua
Description: Сучасний редакційний шаблон для автомобільного журналу Автопілот. Мінімалістичний дизайн, оптимізований для Core Web Vitals.
Version: 1.0.0
Requires at least: 6.3
Tested up to: 6.7
Requires PHP: 8.1
License: Proprietary
License URI: https://avtopilot.com.ua
Text Domain: avtopilot
Tags: news, magazine, blog, editorial, responsive, custom-colors, custom-menu, featured-images, post-thumbnails, translation-ready
*/

/* ============================================================
   Avtopilot Theme — Main Stylesheet
   Fonts: Manrope (sans), IBM Plex Serif (serif), IBM Plex Mono (mono)
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f5;
  --bg-tinted: #f1efe9;
  --ink: #0f0f0e;
  --ink-2: #2a2a28;
  --ink-3: #5a5a55;
  --ink-4: #767672;
  --rule: #e6e3dc;
  --rule-strong: #c8c4ba;
  --accent: #0a84ff;
  --accent-text: #0060c7;
  --accent-soft: #e7f1ff;

  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --serif: "IBM Plex Serif", "Georgia", "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --container: 1200px;
  --container-narrow: 720px;
  --gap: 24px;
  --gap-lg: 40px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }

/* Global overflow guard — block elements only */
div, section, article, aside, nav, header, footer, main,
figure, p, ul, ol, li, table, form, fieldset {
  max-width: 100%;
}

html { scroll-behavior: smooth; overflow-x: clip; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: clip;
  max-width: 100vw;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Remove WP default margins */
.site, #page { margin: 0; padding: 0; }
.site-main { margin: 0; padding: 0; }

img, svg, video, iframe, embed { max-width: 100%; display: block; height: auto; }
.site, #page, .site-main { overflow-x: hidden; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }
input, textarea, select { font: inherit; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 800; line-height: 1.1; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

/* Layout */
/* ============================================================
   AD OVERFLOW CONTAINMENT — prevent ad banners from breaking layout
   ============================================================ */
ins.adsbygoogle,
div[id^="div-gpt-ad"],
div[id^="yandex_rtb"],
.banner-wrap,
iframe:not(.wp-embedded-content) {
  max-width: 100% !important;
  width: 100% !important;
  overflow: hidden !important;
  display: block !important;
}

/* AdSense auto-ads spacing */
.latest-list ins.adsbygoogle,
ins.adsbygoogle {
  display: block;
  max-width: 100% !important;
  margin: 12px auto !important;
  border-radius: 6px;
  overflow: hidden;
}

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; box-sizing: border-box; }
.container-narrow { width: 100%; max-width: var(--container-narrow); margin: 0 auto; padding: 0 24px; box-sizing: border-box; }

/* Hard width lock — nothing may exceed viewport */
.site-header,
.site-main,
.site-footer,
.site-main > *,
.site-main section,
.related-posts { max-width: 100vw; overflow-x: hidden; }

/* Accessibility */
.screen-reader-text {
  border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%);
  height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute;
  width: 1px; word-wrap: normal;
}
.screen-reader-text:focus {
  background-color: #f1f1f1; border-radius: 3px; box-shadow: 0 0 2px 2px rgba(0,0,0,.6);
  clip: auto; clip-path: none; color: #21759b; display: block;
  font-size: 14px; font-weight: 700; height: auto; left: 5px; line-height: normal;
  padding: 15px 23px 14px; text-decoration: none; top: 5px; width: auto; z-index: 100000;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--rule);
}

.site-header__inner {
  display: flex; align-items: center;
  padding: 14px 0; gap: 16px;
}

.site-branding { flex-shrink: 0; }
.site-title {
  font-family: var(--sans);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 26px;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
}
.site-title:hover { color: var(--ink); }

/* Primary Navigation */
.primary-navigation {
  display: flex; gap: 1px; align-items: center;
  flex-wrap: nowrap; overflow-x: auto;
  scrollbar-width: none; flex-shrink: 1; min-width: 0;
}
.primary-navigation::-webkit-scrollbar { display: none; }
.primary-navigation ul { list-style: none; display: flex; gap: 1px; }

.site-nav a,
.primary-navigation a {
  white-space: nowrap; padding: 8px 11px; border-radius: 7px;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  transition: background 120ms var(--ease), color 120ms var(--ease);
}
@media (max-width: 1200px) {
  .primary-navigation a { padding: 7px 9px; font-size: 13.5px; }
}
@media (max-width: 1050px) {
  .primary-navigation a { padding: 6px 7px; font-size: 13px; }
}
.primary-navigation a:hover { background: var(--bg-soft); color: var(--ink); }
.primary-navigation .current-menu-item > a,
.primary-navigation .current-menu-ancestor > a { color: var(--accent); background: var(--accent-soft); }

/* Header Actions */
.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); transition: background 120ms var(--ease);
}
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

/* Mobile menu toggle */
.menu-toggle { display: none; }

/* ============================================================
   EYEBROW / BADGES
   ============================================================ */
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent-text);
}
.eyebrow::before { content: ""; width: 16px; height: 1px; background: currentColor; display: inline-block; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink);
  background: #fff; padding: 5px 8px; border: 1px solid var(--rule-strong); border-radius: 4px;
}
.badge--solid { background: var(--ink); color: #fff; border-color: var(--ink); }
.badge--accent { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ============================================================
   HOMEPAGE — HERO
   ============================================================ */
.home-hero {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: var(--gap-lg); align-items: stretch;
  padding: 28px 0 32px; border-bottom: 1px solid var(--rule);
  overflow: hidden;
}

.hero-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; overflow: hidden; }
.hero-main__cover {
  aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden;
  background: var(--bg-tinted); display: block; position: relative;
  width: 100%; max-width: 100%;
}
.hero-main__cover img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 600ms var(--ease);
}
.hero-main:hover .hero-main__cover img { transform: scale(1.03); }
.hero-main__title {
  font-size: clamp(28px, 3.6vw, 52px); line-height: 1.05;
  letter-spacing: -0.02em; font-weight: 800;
  text-wrap: balance; transition: color 160ms var(--ease);
}
.hero-main:hover .hero-main__title { color: var(--accent); }
.hero-main__dek { font-size: 18px; line-height: 1.5; color: var(--ink-3); max-width: 60ch; text-wrap: pretty; }
.hero-main__meta { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; }
.hero-main__meta .author { color: var(--ink-2); font-weight: 600; }

.hero-side {
  display: flex; flex-direction: column;
  border-left: 1px solid var(--rule); padding-left: var(--gap-lg); gap: 16px;
  min-width: 0; overflow: hidden;
}
.hero-side__label { display: block; margin-bottom: 4px; }

/* Side Item */
.side-item {
  display: grid; grid-template-columns: 96px 1fr;
  gap: 14px; padding-bottom: 14px; border-bottom: 1px dashed var(--rule);
}
.side-item:last-child { border-bottom: 0; padding-bottom: 0; }
.side-item__cover { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--bg-tinted); display: block; }
.side-item__cover img { width: 100%; height: 100%; object-fit: cover; }
.side-item__cat { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-text); }
.side-item__title {
  font-size: 15px; line-height: 1.3; font-weight: 700;
  letter-spacing: -0.01em; margin: 4px 0 6px; text-wrap: balance;
  transition: color 120ms;
}
.side-item:hover .side-item__title { color: var(--accent); }
.side-item__date { font-size: 11px; color: var(--ink-4); }

/* ============================================================
   SECTIONS
   ============================================================ */
.section { padding: 36px 0; border-bottom: 1px solid var(--rule); }
.section--soft { background: var(--bg-soft); }

.section__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 22px;
}
.section__title {
  font-size: clamp(22px, 2.4vw, 32px); line-height: 1;
  letter-spacing: -0.02em; font-weight: 800;
}
.section__title em {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  color: var(--ink-3); letter-spacing: -0.015em;
}
.section__see-all {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.section__see-all:hover { color: var(--accent); }

/* ============================================================
   CARD GRID
   ============================================================ */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px var(--gap); overflow: hidden; }

.post-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; overflow: hidden; }

.post-card__cover {
  position: relative; aspect-ratio: 4 / 3; border-radius: 10px;
  overflow: hidden; background: var(--bg-tinted); display: block;
}
.post-card__cover img {
  width: 100%; height: 100%; object-fit: cover;
}
}
.post-card__kicker {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-3); min-height: 44px;
}
.post-card__kicker .cat { color: var(--accent-text); }
.post-card__kicker .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.post-card__title {
  font-size: 19px; line-height: 1.25; font-weight: 700;
  letter-spacing: -0.01em; color: var(--ink);
  text-wrap: balance;
}
.post-card__excerpt { font-size: 14px; line-height: 1.5; color: var(--ink-3); }
.post-card__meta { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; min-height: 44px; align-items: center; }
.post-card__kicker .cat a { color: var(--accent-text); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; padding: 4px 0; }

/* ============================================================
   LATEST LIST
   ============================================================ */
.latest-layout { display: grid; grid-template-columns: 1fr 320px; gap: var(--gap-lg); overflow: hidden; }
.latest-list { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.post-row {
  display: grid; grid-template-columns: 120px 1fr auto;
  align-items: center; gap: 16px; padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none; color: inherit;
  transition: padding-left 200ms var(--ease);
}
.post-row:last-child { border-bottom: 0; }
.post-row:hover { padding-left: 8px; }
.post-row:hover .post-row__title { color: var(--accent); }

.post-row__cover { width: 120px; min-width: 120px; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: var(--bg-tinted); display: block; }
.post-row__cover img { width: 100%; height: 100%; object-fit: cover; }
.post-row__cat { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-text); }
.post-row__title { font-size: 18px; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); margin: 4px 0; text-wrap: balance; transition: color 120ms var(--ease); }
.post-row__meta { font-size: 12px; color: var(--ink-3); }
.post-row__date { font-family: var(--mono); font-size: 12px; color: var(--ink-3); text-align: right; white-space: nowrap; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.aside-block { border: 1px solid var(--rule); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.aside-block:last-child { margin-bottom: 0; }
.aside-block__title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; margin: 0 0 14px; color: var(--ink-3); font-weight: 600; }

.trending-list { display: flex; flex-direction: column; gap: 14px; }
.trending-item { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; }
.trending-item__num { font-family: var(--serif); font-style: italic; font-size: 22px; font-weight: 600; line-height: 1; color: var(--accent); }
.trending-item__title { font-size: 14px; line-height: 1.35; font-weight: 600; transition: color 120ms; }
.trending-item:hover .trending-item__title { color: var(--accent); }

/* ============================================================
   CATEGORY TILES
   ============================================================ */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cat-tile {
  position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden;
  background: var(--ink); color: #fff; display: flex; align-items: flex-end;
  padding: 16px; text-decoration: none;
  transition: transform 200ms var(--ease);
}
.cat-tile:hover { transform: translateY(-2px); }
.cat-tile__bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.cat-tile__bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,0.85) 100%);
}
.cat-tile__name { position: relative; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }

/* ============================================================
   ARTICLE HERO
   ============================================================ */
.article-hero {
  position: relative; min-height: 56vh; min-height: min(56vh, 560px);
  background: #111; overflow: hidden; color: #fff;
  display: flex; align-items: flex-end;
}
.article-hero__bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: brightness(0.55);
}
.article-hero__bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,0.7) 100%);
}
.article-hero__inner { position: relative; width: 100%; padding: 0 0 48px; }
.article-hero .eyebrow { color: #ffd166; }

.entry-title {
  font-size: clamp(32px, 5vw, 64px); line-height: 1.05;
  letter-spacing: -0.025em; font-weight: 800;
  margin: 14px 0 16px; max-width: 22ch; text-wrap: balance;
}
.entry-subtitle {
  font-size: clamp(16px, 1.6vw, 20px); line-height: 1.45;
  max-width: 60ch; color: rgba(255,255,255,0.85); margin: 0 0 24px;
}
.entry-meta { display: flex; align-items: center; gap: 16px; font-size: 14px; color: rgba(255,255,255,0.7); flex-wrap: wrap; }
.entry-meta .author-name { color: #fff !important; font-weight: 600 !important; font-size: 14px !important; }
.entry-meta time { font-size: 14px; }.article-hero .badge { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.18); color: #fff; backdrop-filter: blur(10px); }

/* Reading progress */
#reading-progress {
  position: fixed; top: 0; left: 0; height: 3px;
  background: var(--accent); width: 0; z-index: 100;
  transition: width 80ms linear;
}

/* Article layout */
.article-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 280px;
  gap: 48px; padding: 36px 0 24px; align-items: start;
}

/* Table of Contents */
.toc { position: sticky; top: 130px; }
.toc__title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; margin: 0 0 14px; color: var(--ink-3); }
.toc__list { list-style: none; border-left: 1px solid var(--rule); }
.toc__item a {
  display: block; padding: 6px 0 6px 14px; margin-left: -1px;
  border-left: 2px solid transparent; font-size: 13px;
  color: var(--ink-3); line-height: 1.4;
  transition: color 120ms, border-color 120ms;
}
.toc__item a.is-active { color: var(--ink); border-left-color: var(--accent); font-weight: 600; }
.toc__item a:hover { color: var(--ink); }

/* Prose */
.entry-content {
  font-size: 18px; line-height: 1.75; color: var(--ink-2);
  font-family: var(--sans); max-width: 65ch;
}
.entry-content > * + * { margin-top: 1.2em; }
.entry-content h2 {
  font-size: clamp(24px, 3vw, 34px); line-height: 1.15;
  letter-spacing: -0.02em; margin: 2em 0 0.5em;
  font-weight: 800; color: var(--ink);
  scroll-margin-top: 130px;
}
.entry-content h3 { font-size: 22px; line-height: 1.25; margin: 1.6em 0 0.4em; font-weight: 700; color: var(--ink); }
.entry-content .dropcap::first-letter {
  font-family: var(--serif); float: left;
  font-size: 5.4em; line-height: 0.85;
  padding: 6px 12px 0 0; font-weight: 600; color: var(--ink);
}
.entry-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 24px; margin: 2em 0;
  font-family: var(--serif); font-style: italic;
  font-size: 24px; line-height: 1.4; color: var(--ink); text-wrap: balance;
}
.entry-content figure { margin: 2em 0; }
.entry-content figure img { width: 100%; border-radius: 10px; }
.entry-content figcaption { font-size: 13px; color: var(--ink-4); margin-top: 8px; font-family: var(--serif); font-style: italic; }
.entry-content hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content li + li { margin-top: 0.5em; }
.entry-content a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.entry-content a:hover { text-decoration: none; }
.entry-content strong { color: var(--ink); font-weight: 700; }
.entry-content p:first-child::first-letter {
  font-family: var(--serif); float: left;
  font-size: 5.4em; line-height: 0.85;
  padding: 6px 12px 0 0; font-weight: 600; color: var(--ink);
}

/* Article sidebar */
.article-aside { position: sticky; top: 130px; display: flex; flex-direction: column; gap: 18px; }

.share-block { margin-bottom: 4px; }
.share-block__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); display: block; margin-bottom: 10px; }
.share-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.share-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--rule);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3); transition: all 160ms; cursor: pointer; text-decoration: none;
}
.share-btn:hover { color: var(--accent); border-color: var(--accent); }
.share-btn svg { width: 16px; height: 16px; }

.author-card { padding: 20px; border: 1px solid var(--rule); border-radius: 12px; }
.author-card__avatar { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #ffd166, var(--accent)); margin-bottom: 12px; }
.author-card__avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-card__name { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.author-card__role { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 10px; }
.author-card__bio { font-size: 13px; line-height: 1.5; color: var(--ink-3); }

.tags-block { display: flex; flex-wrap: wrap; gap: 6px; }

/* Related posts */
.related-posts { padding: 40px 0; background: var(--bg-soft); border-top: 1px solid var(--rule); }

/* ============================================================
   CATEGORY / ARCHIVE PAGE
   ============================================================ */
.archive-hero { padding: 44px 0 28px; border-bottom: 1px solid var(--rule); }
.archive-title {
  font-size: clamp(40px, 6vw, 80px); line-height: 1;
  letter-spacing: -0.03em; margin: 0 0 16px; font-weight: 800;
}
.archive-description { font-size: 19px; line-height: 1.5; color: var(--ink-3); max-width: 65ch; }

/* ============================================================
   AUTHOR PAGE
   ============================================================ */
.author-hero { padding: 44px 0 32px; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 200px 1fr; gap: 48px; align-items: center; }
.author-avatar { width: 200px; height: 200px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #ffd166, var(--accent)); }
.author-avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-name { font-size: clamp(32px, 4vw, 48px); margin: 0 0 8px; letter-spacing: -0.02em; font-weight: 800; }
.author-role { color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 14px; }
.author-bio { font-size: 17px; line-height: 1.6; color: var(--ink-3); max-width: 60ch; margin: 0 0 16px; }
.author-stats { display: flex; gap: 32px; padding-top: 16px; border-top: 1px solid var(--rule); }
.author-stats__item strong { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; display: block; }
.author-stats__item span { font-size: 12px; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.08em; }

/* ============================================================
   SEARCH PAGE
   ============================================================ */
.search-hero { padding: 40px 0 28px; border-bottom: 1px solid var(--rule); }
.search-title { font-size: clamp(32px, 5vw, 56px); letter-spacing: -0.02em; margin: 0 0 8px; font-weight: 800; }
.search-count { color: var(--ink-3); margin: 0 0 24px; font-size: 18px; }
.search-count strong { color: var(--ink); }

.search-form-wrap { position: relative; max-width: 640px; }
.search-form-wrap .search-field {
  width: 100%; padding: 18px 18px 18px 56px;
  border: 1px solid var(--rule-strong); border-radius: 12px;
  font-size: 18px; background: #fff;
}
.search-form-wrap .search-field:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.search-form-wrap .search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--ink-4); pointer-events: none; }
.search-submit { display: none; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex; justify-content: center; align-items: center;
  gap: 6px; padding: 32px 0; flex-wrap: wrap;
}
.pagination .page-numbers,
.pagination a.page-numbers,
.pagination span.page-numbers {
  min-width: 40px; height: 40px; border-radius: 8px;
  border: 1px solid var(--rule); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color 120ms; font-size: 14px; padding: 0 10px;
  text-decoration: none; color: var(--ink);
}
.pagination a.page-numbers:hover { border-color: var(--ink); }
.pagination span.page-numbers.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination .page-numbers.dots { border: 0; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { background: var(--ink); color: #c8c4ba; padding: 40px 0 24px; }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 40px; padding-bottom: 32px; border-bottom: 1px solid #2a2a28; }
.footer-brand .site-title { color: #fff !important; }
.footer-about { font-size: 14px; line-height: 1.6; color: #8a8a82; margin-top: 14px; max-width: 32ch; }
.footer-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: #fff; margin: 0 0 16px; }
.footer-col ul, .footer-col .menu { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.footer-col li { list-style: none; }
.footer-col a:hover { color: #fff; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 20px; font-size: 12px; color: #8a8a82; flex-wrap: wrap; gap: 12px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 20px; border-radius: 10px; background: var(--ink); color: #fff;
  font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background 120ms var(--ease), transform 120ms var(--ease);
}
.btn:hover { background: var(--accent); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn--accent { background: var(--accent); }
.btn--accent:hover { background: var(--ink); }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule-strong); }
.btn--ghost:hover { background: var(--bg-soft); }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-balance { text-wrap: balance; }
.text-pretty { text-wrap: pretty; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .primary-navigation a { padding: 7px 8px; font-size: 12.5px; }
}

@media (max-width: 960px) {
  /* Mobile nav */
  .primary-navigation { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--rule); padding: 8px 16px 12px; z-index: 40; box-shadow: 0 8px 24px rgba(0,0,0,0.08); flex-direction: column; }
  .primary-navigation.is-open { display: flex; }
  .primary-navigation ul { flex-direction: column; }
  .primary-navigation a { padding: 10px 8px; border-radius: 6px; display: block; }
  .menu-toggle { display: inline-flex; }
  .site-header { position: relative; }

  /* Layout */
  .home-hero { grid-template-columns: 1fr; gap: 24px; }
  .hero-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 20px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .latest-layout { grid-template-columns: 1fr; }
  .post-row { grid-template-columns: 90px 1fr; gap: 12px; }
  .post-row__cover { width: 90px; min-width: 90px; }
  .post-row__date { display: none; }
  .post-row__title { font-size: 15px; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .article-layout { grid-template-columns: 1fr; gap: 28px; padding-top: 28px; }
  .article-aside, .toc { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .author-hero { grid-template-columns: 1fr; gap: 24px; }
  .author-avatar { width: 120px; height: 120px; }
}

@media (max-width: 600px) {
  .card-grid { grid-template-columns: 1fr; gap: 24px; }
  .cat-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; }

  /* Article hero — make sure title sits ON the image */
  .article-hero { min-height: 380px; padding-top: 60px; }
  .article-hero__inner { padding: 0 0 28px; }
  .entry-title { font-size: 28px; line-height: 1.1; margin: 10px 0 12px; }
  .entry-subtitle { font-size: 15px; line-height: 1.45; margin: 0 0 16px; }
  .entry-meta { font-size: 13px; gap: 10px; }

  /* Article layout — single column on mobile */
  .article-layout { grid-template-columns: 1fr; gap: 24px; padding: 24px 0; }
  .toc, .article-aside { position: static; }
  .article-aside { order: 2; }
  .article-content { order: 1; }

  /* Related posts — full-width cards stay reasonable */
  .related-posts { padding: 28px 0; }
  .post-card__cover { aspect-ratio: 16/10; }
  .post-card__title { font-size: 18px; }

  .latest-layout { gap: 24px; }
  .section { padding: 28px 0; }
  .section__title { font-size: 22px; }

  /* Hero side label spacing */
  .hero-side { gap: 12px; }
}

/* ============================================================
   WORDPRESS ALIGNMENT CLASSES
   ============================================================ */
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.5em; }
.aligncenter { display: block; margin: 0 auto 1em; }
.alignfull { width: 100vw; margin-left: calc(50% - 50vw); }
.alignwide { width: calc(100% + 80px); margin-left: -40px; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: 13px; color: var(--ink-4); font-family: var(--serif); font-style: italic; margin-top: 8px; }
