/*
Theme Name: Malcolm Gibb Blog
Theme URI: https://www.malcolmgibb.co.uk/blog
Author: Malcolm Gibb
Author URI: https://www.malcolmgibb.co.uk
Description: A fast, editorial-style blog theme for malcolmgibb.co.uk. Optimised for long-form reading with sticky TOC, reading progress bar, and category colour-coding.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: malcolmgibb
Tags: blog, one-column, custom-menu, featured-images, translation-ready
*/

/* ═══════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════ */
:root {
  --bg:             #faf9f7;
  --bg-warm:        #f4f2ee;
  --bg-card:        #ffffff;
  --bg-dark:        #131517;
  --border:         #e4e0db;
  --border-light:   #eae7e2;
  --text-primary:   #1a1c1f;
  --text-body:      #2e2b28;
  --text-secondary: #5c5752;
  --text-muted:     #9a958e;
  --accent:         #4a9c00;
  --accent-lime:    #c4ff4e;
  --accent-warm:    #d96a1c;
  --accent-blue:    #2a7de1;
  --accent-purple:  #9333ea;
  --link:           #2a7de1;
  --serif:          'Instrument Serif', Georgia, serif;
  --sans:           'DM Sans', system-ui, -apple-system, sans-serif;
  --mono:           'JetBrains Mono', 'Fira Code', monospace;
  --max-w:          1200px;
  --content-w:      760px;
  --gutter:         clamp(1.25rem, 4vw, 3rem);
  --radius:         12px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg:      0 12px 40px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
}


/* ═══════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Subtle grain texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.018'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

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


/* ═══════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════ */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-lime));
  width: 0%;
  z-index: 200;
  transition: width 0.1s linear;
  pointer-events: none;
}


/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-dark);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.92rem;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent-lime), #8bdb00);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--bg-dark);
}

/* Navigation */
.header-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.header-nav a {
  font-size: 0.8rem;
  font-weight: 400;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

.header-nav a:hover { color: #fff; }
.header-nav .nav-cta,
.header-nav li .nav-cta {
  background: var(--accent);
  color: #fff !important;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  transition: background 0.2s;
}
.header-nav .nav-cta:hover { background: #1d4ed8; color: #fff; }
.header-nav .current-menu-item a,
.header-nav .current_page_item a,
.header-nav a[aria-current="page"] { color: var(--accent-lime); }

/* Mobile hamburger */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0.5rem;
}

.menu-toggle svg { width: 22px; height: 22px; }


/* ═══════════════════════════════════════════
   BLOG LISTING — HERO
   ═══════════════════════════════════════════ */
.blog-hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5.5rem) var(--gutter) clamp(1.5rem, 4vw, 2.5rem);
}

.blog-hero__eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
  opacity: 0;
  animation: mgFadeUp 0.6s 0.1s ease-out forwards;
}

.blog-hero__title {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 5.5vw, 4.4rem);
  font-weight: 400;
  line-height: 1.08;
  color: var(--text-primary);
  max-width: 16ch;
  opacity: 0;
  animation: mgFadeUp 0.6s 0.2s ease-out forwards;
}

.blog-hero__title em {
  font-style: italic;
  color: var(--accent);
}

.blog-hero__sub {
  margin-top: 1.25rem;
  font-size: 1.05rem;
  font-weight: 350;
  color: var(--text-secondary);
  max-width: 52ch;
  line-height: 1.7;
  opacity: 0;
  animation: mgFadeUp 0.6s 0.35s ease-out forwards;
}

.blog-hero__divider {
  margin-top: clamp(2rem, 4vw, 3rem);
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--border) 35%, transparent 100%);
  opacity: 0;
  animation: mgFadeIn 0.8s 0.5s ease-out forwards;
}


/* ═══════════════════════════════════════════
   FILTER BAR (categories)
   ═══════════════════════════════════════════ */
.filter-bar {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.filter-bar__label {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 0.4rem;
}

.filter-bar a {
  font-size: 0.74rem;
  font-weight: 450;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.32rem 0.8rem;
  border-radius: 100px;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.filter-bar a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-bar a.current,
.filter-bar .current-cat a {
  color: #fff;
  background: var(--bg-dark);
  border-color: var(--bg-dark);
}


/* ═══════════════════════════════════════════
   FEATURED POST (first/sticky)
   ═══════════════════════════════════════════ */
.featured-post {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3rem) var(--gutter) 0;
}

.featured-card {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.35s, transform 0.35s;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
}

.featured-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.featured-card__img {
  position: relative;
  background: var(--bg-warm);
  min-height: 340px;
  overflow: hidden;
}

.featured-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.featured-card:hover .featured-card__img img {
  transform: scale(1.03);
}

.featured-card__badge {
  position: absolute;
  top: 1.1rem;
  left: 1.1rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg-dark);
  background: var(--accent-lime);
  padding: 0.28rem 0.7rem;
  border-radius: 4px;
}

.featured-card__body {
  padding: clamp(1.75rem, 3.5vw, 2.75rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-card__meta {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.featured-card__meta .cat { color: var(--accent); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 500; }

.featured-card__body h2 {
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.8vw, 1.9rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 0.9rem;
}

.featured-card__body .excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-card__tags {
  display: flex;
  gap: 0.4rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.featured-card__tags span {
  font-size: 0.66rem;
  font-weight: 450;
  color: var(--text-muted);
  background: var(--bg-warm);
  border: 1px solid var(--border-light);
  padding: 0.22rem 0.55rem;
  border-radius: 4px;
}

.read-indicator {
  margin-top: auto;
  padding-top: 1.35rem;
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: gap 0.2s;
}

.featured-card:hover .read-indicator { gap: 0.85rem; }
.read-indicator svg { width: 16px; height: 16px; }


/* ═══════════════════════════════════════════
   POST GRID (listing)
   ═══════════════════════════════════════════ */
.posts-section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(2.5rem, 5vw, 3.5rem) var(--gutter);
}

.posts-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.posts-section__title {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.posts-section__count {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--text-muted);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.35rem;
}

/* Individual post card */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.3s, transform 0.3s;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.post-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.post-card__img {
  position: relative;
  height: 195px;
  overflow: hidden;
  background: var(--bg-warm);
}

.post-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.post-card:hover .post-card__img img { transform: scale(1.04); }

.post-card__body {
  padding: 1.4rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card__meta {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.post-card__meta .cat {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

/* Category colour coding */
.cat--google-ads  { color: var(--accent) !important; }
.cat--analytics   { color: var(--accent-blue) !important; }
.cat--paid-social { color: var(--accent-purple) !important; }
.cat--ai          { color: var(--accent-warm) !important; }
.cat--attribution { color: var(--accent) !important; }

.post-card h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 0.65rem;
  transition: color 0.2s;
}

.post-card:hover h3 { color: var(--accent); }

.post-card .excerpt {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.post-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.1rem;
  margin-top: auto;
  border-top: 1px solid var(--border-light);
}

.post-card__tags {
  display: flex;
  gap: 0.3rem;
}

.post-card__tags span {
  font-size: 0.6rem;
  color: var(--text-muted);
  background: var(--bg-warm);
  padding: 0.18rem 0.45rem;
  border-radius: 3px;
}

.post-card__read-time {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--text-muted);
}


/* ═══════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════ */
.pagination {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter) 3rem;
  display: flex;
  justify-content: center;
  gap: 0.4rem;
}

.pagination a,
.pagination span {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-decoration: none;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination .current {
  background: var(--bg-dark);
  border-color: var(--bg-dark);
  color: #fff;
}


/* ═══════════════════════════════════════════
   SINGLE POST — HERO
   ═══════════════════════════════════════════ */
.post-hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4rem) var(--gutter) 0;
}

.post-hero__breadcrumb {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-hero__breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.post-hero__breadcrumb a:hover { color: var(--accent); }
.post-hero__breadcrumb .sep { opacity: 0.4; }

.post-hero__meta-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.post-hero__category {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg-dark);
  background: var(--accent-lime);
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
}

.post-hero__date {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.post-hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 400;
  line-height: 1.1;
  color: var(--text-primary);
  max-width: 22ch;
  margin-bottom: 1.25rem;
}

.post-hero__sub {
  font-size: 1.18rem;
  font-weight: 350;
  color: var(--text-secondary);
  max-width: 60ch;
  line-height: 1.7;
  margin-bottom: 1.75rem;
}

.post-hero__details {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.author-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-lime), #8bdb00);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--bg-dark);
  flex-shrink: 0;
}

.author-info { display: flex; flex-direction: column; }
.author-name { font-size: 0.85rem; font-weight: 550; color: var(--text-primary); }
.author-role { font-size: 0.72rem; color: var(--text-muted); }

.detail-sep { width: 1px; height: 28px; background: var(--border); }
.detail-item { display: flex; flex-direction: column; gap: 0.15rem; }
.detail-label { font-family: var(--mono); font-size: 0.58rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.detail-value { font-size: 0.82rem; font-weight: 450; color: var(--text-primary); }

.post-hero__tags {
  display: flex;
  gap: 0.4rem;
}

.post-hero__tags span {
  font-size: 0.66rem;
  font-weight: 450;
  color: var(--text-muted);
  background: var(--bg-warm);
  border: 1px solid var(--border-light);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}


/* ═══════════════════════════════════════════
   SINGLE POST — FEATURED IMAGE
   ═══════════════════════════════════════════ */
.post-featured-image {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.post-featured-image img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}


/* ═══════════════════════════════════════════
   SINGLE POST — CONTENT LAYOUT
   ═══════════════════════════════════════════ */
.post-layout {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3rem) var(--gutter);
  display: grid;
  grid-template-columns: 1fr minmax(0, var(--content-w)) 240px;
  gap: 3rem;
}

.post-layout > .spacer { display: block; }


/* ── TABLE OF CONTENTS ── */
.toc {
  position: sticky;
  top: 84px;
  align-self: start;
  padding-top: 0.5rem;
}

.toc__label {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.toc__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.toc__list a {
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0 0.35rem 0.85rem;
  border-left: 2px solid var(--border);
  display: block;
  transition: all 0.2s;
  line-height: 1.35;
}

.toc__list a:hover,
.toc__list a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
}


/* ── ARTICLE BODY ── */
.post-content {
  max-width: var(--content-w);
  min-width: 0; /* prevent grid blowout */
  overflow-wrap: break-word;
  word-break: break-word;
}

.post-content p {
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--text-body);
  margin-bottom: 1.65rem;
}

.post-content h2 {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 400;
  color: var(--text-primary);
  margin: 2.75rem 0 1.15rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 80px;
}

.post-content h3 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-primary);
  margin: 2.25rem 0 0.85rem;
  scroll-margin-top: 80px;
}

.post-content h4 {
  font-family: var(--sans);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.75rem 0 0.65rem;
}

.post-content a {
  color: var(--link);
  text-decoration-color: rgba(42,125,225,0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s;
}

.post-content a:hover { text-decoration-color: var(--link); }

.post-content strong { font-weight: 600; color: var(--text-primary); }

.post-content em { font-style: italic; }

.post-content img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 1.75rem 0;
  box-shadow: var(--shadow-sm);
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.65rem 1.5rem;
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--text-body);
}

.post-content li { margin-bottom: 0.5rem; }

.post-content blockquote {
  margin: 2rem 0;
  padding: 1.5rem 1.75rem;
  background: var(--bg-warm);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

.post-content blockquote p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.post-content pre {
  background: var(--bg-dark);
  color: #e0ddd8;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.75rem 0;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.6;
}

.post-content pre code {
  font-family: inherit;
  color: var(--accent-lime);
  background: none;
  padding: 0;
}

.post-content code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-warm);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent-warm);
}

.post-content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2.5rem 0;
}

.post-content table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  margin: 1.75rem 0;
  font-size: 0.95rem;
}

.post-content th,
.post-content td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
}

.post-content th {
  background: var(--bg-warm);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* WordPress-generated alignment classes */
.aligncenter { margin: 1.75rem auto; display: block; max-width: 100%; }
.alignleft { float: left; margin: 0.5rem 1.5rem 1rem 0; max-width: 50%; }
.alignright { float: right; margin: 0.5rem 0 1rem 1.5rem; max-width: 50%; }
.wp-caption { max-width: 100%; }
.wp-caption-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5rem;
}

/* ── GUTENBERG BLOCK STYLES (wp-block-library is dequeued, so defined here) ── */

/* Images */
figure.wp-block-image {
  max-width: 100%;
  margin: 1.75rem 0;
}
figure.wp-block-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
figure.wp-block-image figcaption {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

/* alignwide / alignfull — prevent breaking out of container */
.wp-block-image.alignwide,
.wp-block-image.alignfull {
  max-width: 100%;
  width: 100%;
}

/* Responsive video embeds — replaces block-library's aspect-ratio wrapper */
.wp-block-embed__wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
}
.wp-block-embed__wrapper iframe,
.wp-block-embed__wrapper video,
.wp-block-embed__wrapper object,
.wp-block-embed__wrapper embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.wp-block-embed.wp-embed-aspect-4-3 .wp-block-embed__wrapper { padding-bottom: 75%; }
.wp-block-embed.wp-embed-aspect-1-1 .wp-block-embed__wrapper { padding-bottom: 100%; }

/* Videos */
.wp-block-video video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Galleries */
.wp-block-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.75rem 0;
  padding: 0;
  list-style: none;
}
.wp-block-gallery .blocks-gallery-item {
  flex: 1 1 calc(50% - 0.25rem);
  min-width: 0;
  margin: 0;
}
.wp-block-gallery .blocks-gallery-item figure,
.wp-block-gallery .blocks-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  margin: 0;
}

/* Tables — scrollable on mobile */
.wp-block-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.75rem 0;
}
.wp-block-table table {
  margin: 0;
  min-width: 100%;
}

/* Pullquote / quote blocks */
.wp-block-pullquote {
  padding: 2rem;
  border-top: 3px solid var(--accent);
  border-bottom: 3px solid var(--accent);
  margin: 2rem 0;
  text-align: center;
}
.wp-block-pullquote blockquote p {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.wp-block-pullquote cite {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: normal;
}

/* Separator */
.wp-block-separator {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2.5rem 0;
}

/* Columns block */
.wp-block-columns {
  display: flex;
  gap: 1.5rem;
  margin: 1.75rem 0;
  flex-wrap: wrap;
}
.wp-block-column {
  flex: 1 1 300px;
  min-width: 0;
}


/* ═══════════════════════════════════════════
   SHARE BAR
   ═══════════════════════════════════════════ */
.share-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 0;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}

.share-bar__label {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 0.3rem;
}

.share-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-warm);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
}

.share-btn:hover {
  background: var(--bg-dark);
  color: #fff;
  border-color: var(--bg-dark);
}

.share-btn svg { width: 16px; height: 16px; }


/* ═══════════════════════════════════════════
   IN-ARTICLE CTA
   ═══════════════════════════════════════════ */
.article-cta {
  background: var(--bg-dark);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
  margin: 2.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
}

.article-cta::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(196,255,78,0.12), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.article-cta__text h4 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 400;
  color: #fff;
  margin-bottom: 0.3rem;
}

.article-cta__text p {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
}

.article-cta__btn {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--bg-dark);
  background: var(--accent-lime);
  padding: 0.6rem 1.3rem;
  border-radius: 7px;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.article-cta__btn:hover { opacity: 0.85; }


/* ═══════════════════════════════════════════
   RELATED POSTS
   ═══════════════════════════════════════════ */
.related-posts {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(3rem, 6vw, 4.5rem);
}

.related-posts__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.related-posts__title {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.related-posts__link {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.related-posts__link:hover { opacity: 0.7; }

.related-posts__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.3s, transform 0.3s;
  box-shadow: var(--shadow-sm);
}

.related-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.related-card__img {
  height: 150px;
  overflow: hidden;
  background: var(--bg-warm);
}

.related-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.related-card:hover .related-card__img img { transform: scale(1.04); }

.related-card__body { padding: 1.15rem; }

.related-card__meta {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  gap: 0.6rem;
}

.related-card__meta .cat {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.related-card h4 {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.25;
  transition: color 0.2s;
}

.related-card:hover h4 { color: var(--accent); }


/* ═══════════════════════════════════════════
   NEWSLETTER CTA
   ═══════════════════════════════════════════ */
.newsletter {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(3rem, 6vw, 5rem);
}

.newsletter__inner {
  position: relative;
  background: var(--bg-dark);
  border-radius: 16px;
  padding: clamp(2.5rem, 5vw, 3.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  overflow: hidden;
}

.newsletter__inner::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(196,255,78,0.15), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.newsletter__text h3 {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.8vw, 1.7rem);
  font-weight: 400;
  color: #fff;
  margin-bottom: 0.45rem;
}

.newsletter__text p {
  font-size: 0.86rem;
  color: rgba(255,255,255,0.55);
  max-width: 42ch;
}

.newsletter__form {
  display: flex;
  gap: 0.65rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.newsletter__form input[type="email"] {
  font-family: var(--sans);
  font-size: 0.84rem;
  color: #fff;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.65rem 1rem;
  border-radius: 8px;
  width: 250px;
  outline: none;
  transition: border-color 0.2s;
}

.newsletter__form input[type="email"]::placeholder { color: rgba(255,255,255,0.35); }
.newsletter__form input[type="email"]:focus { border-color: var(--accent-lime); }

.newsletter__form button {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--bg-dark);
  background: var(--accent-lime);
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.newsletter__form button:hover { opacity: 0.85; }


/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  background: var(--bg-warm);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

.footer-heading {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}

.footer-heading a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-heading a:hover { color: var(--accent); }

.footer-nav { display: flex; gap: 1.5rem; list-style: none; }
.footer-nav a { font-size: 0.78rem; color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.footer-nav a:hover { color: var(--text-secondary); }

.footer-copy { font-size: 0.76rem; color: var(--text-muted); }
.footer-copy a { color: var(--text-muted); text-decoration: none; }
.footer-copy a:hover { color: var(--text-secondary); }


/* ═══════════════════════════════════════════
   404 PAGE
   ═══════════════════════════════════════════ */
.error-404 {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(4rem, 10vw, 8rem) var(--gutter);
  text-align: center;
}

.error-404 h1 {
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 6rem);
  color: var(--border);
  margin-bottom: 1rem;
}

.error-404 p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.error-404 a {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bg-dark);
  background: var(--accent-lime);
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  transition: opacity 0.2s;
}

.error-404 a:hover { opacity: 0.85; }


/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */
@keyframes mgFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes mgFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .post-layout {
    grid-template-columns: 1fr;
    max-width: var(--content-w);
    gap: 0;
  }
  .post-layout > .spacer,
  .toc { display: none; }
  .related-posts__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .featured-card { grid-template-columns: 1fr; }
  .featured-card__img { min-height: 220px; }
  .header-nav .hide-mobile { display: none; }
  .menu-toggle { display: block; }
}

@media (max-width: 640px) {
  .post-grid { grid-template-columns: 1fr; }
  /* Remove floats on mobile — floated images break narrow layouts */
  .alignleft,
  .alignright {
    float: none;
    max-width: 100%;
    margin: 1.75rem 0;
  }
  /* Columns block — stack vertically on mobile */
  .wp-block-columns { flex-direction: column; }
  .wp-block-column { flex: 1 1 100%; }
  /* Gallery — single column on small screens */
  .wp-block-gallery .blocks-gallery-item { flex: 1 1 100%; }
  .post-hero__details { flex-wrap: wrap; gap: 1rem; }
  .detail-sep { display: none; }
  .related-posts__grid { grid-template-columns: 1fr; }
  .article-cta { flex-direction: column; text-align: center; }
  .newsletter__inner { flex-direction: column; text-align: center; }
  .newsletter__text p { max-width: 100%; }
  .newsletter__form { width: 100%; flex-direction: column; }
  .newsletter__form input[type="email"] { width: 100%; }
  .footer-nav { flex-wrap: wrap; justify-content: center; }
  .header-nav { 
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-dark);
    flex-direction: column;
    padding: 1rem var(--gutter);
    gap: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .header-nav.is-open { display: flex; }
  .header-nav li { width: 100%; }
  .header-nav a { display: block; padding: 0.5rem 0; font-size: 0.9rem; }
}
