/* =========================================================
   CinemaEdge Theme — Main Stylesheet
   System fonts, mobile-first, premium editorial design
   ========================================================= */

/* ---- Custom Properties — Dark Mode ---- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;

  /* Accent */
  --color-accent: #e05252;
  --color-accent-dark: #c73c3c;
  --color-accent-glow: rgba(224, 82, 82, 0.15);

  /* Dark palette — not pure black, layered depth */
  --color-bg: #141414;         /* page background */
  --color-surface: #1d1d1d;    /* cards, panels, inputs */
  --color-surface-2: #252525;  /* hover states, elevated elements */
  --color-border: #2f2f2f;     /* borders and dividers */
  --color-border-subtle: #222222; /* very subtle separators */

  /* Text — warm soft whites, not glaring pure white */
  --color-text: #dedad4;
  --color-text-muted: #938d86;
  --color-text-light: #5a5550;

  /* Fixed-dark surfaces (header + footer — already dark, kept consistent) */
  --color-header-dark: #0d0d0d;
  --color-footer-bg: #0a0a0a;
  --color-footer-text: #5a5550;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;

  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 12px;

  --container-max: 1260px;
  --container-narrow: 780px;
  --sidebar-width: 300px;

  --transition: 200ms ease;
}

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden; /* prevent any element from creating horizontal scroll */
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
}

/* ---- Accessibility ---- */
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  background: var(--color-accent);
  color: #fff;
  padding: var(--space-sm) var(--space-md);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 9999;
  transition: top var(--transition);
}

.skip-link:focus {
  top: 0;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* ---- Container ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--color-text);
}

h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }
h4 { font-size: 1.1rem; }

p { margin-bottom: var(--space-md); }

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  background: var(--color-header-dark);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  height: 64px;
}

/* Branding */
.site-branding {
  flex-shrink: 0;
}

.site-name-link {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.site-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1;
}

.site-name span {
  color: var(--color-accent);
}

.site-tagline {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.45);
  line-height: 1;
}

.site-logo img {
  max-height: 36px;
  width: auto;
}

/* Primary Nav */
.primary-nav {
  flex: 1;
  display: flex;
  align-items: center;
}

.nav-menu {
  display: flex;
  gap: 0;
  list-style: none;
}

.nav-menu a {
  display: block;
  padding: 0 var(--space-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  letter-spacing: 0.02em;
  transition: color var(--transition);
  line-height: 64px;
}

.nav-menu a:hover,
.nav-menu .current-menu-item > a,
.nav-menu .current-menu-ancestor > a {
  color: #fff;
}

.nav-menu .current-menu-item > a {
  border-bottom: 2px solid var(--color-accent);
}

/* Dropdown */
.nav-menu li {
  position: relative;
}

.nav-menu .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #1a1a1a;
  min-width: 200px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  padding: var(--space-xs) 0;
  opacity: 0;
  visibility: hidden;   /* hides from hit-testing AND layout overflow */
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
  z-index: 200;
}

.nav-menu li:hover > .sub-menu,
.nav-menu li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-menu .sub-menu a {
  line-height: 1;
  padding: 10px var(--space-md);
  font-size: 0.8125rem;
  border-bottom: none;
  color: rgba(255,255,255,0.75);
}

.nav-menu .sub-menu a:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  margin-right: var(--space-sm);
}

.nav-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle[aria-expanded="true"] .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}

.search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.75);
  transition: color var(--transition), background var(--transition);
}

.search-toggle:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

/* Search Overlay */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.search-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.search-overlay-inner {
  width: 100%;
  max-width: 640px;
  padding: var(--space-xl);
  position: relative;
}

.search-overlay .search-form-inner {
  display: flex;
  background: #fff;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.search-overlay .search-field {
  flex: 1;
  padding: var(--space-md) var(--space-lg);
  font-size: 1.125rem;
  border: none;
  outline: none;
  color: var(--color-text);
}

.search-overlay .search-submit {
  padding: var(--space-md) var(--space-lg);
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  transition: background var(--transition);
}

.search-overlay .search-submit:hover {
  background: var(--color-accent-dark);
}

.search-close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-xl);
  color: rgba(255,255,255,0.6);
  padding: 6px;
  transition: color var(--transition);
}

.search-close:hover {
  color: #fff;
}

/* =========================================================
     SPOTLIGHT — Featured Story (below fold, lazy image)
     ========================================================= */

  .spotlight-section {
    padding: var(--space-3xl) 0;
    background: var(--color-surface);
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .spotlight-card {
    display: flex;
    gap: var(--space-2xl);
    align-items: center;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.07);
    transition: border-color 200ms ease;
  }

  .spotlight-card:hover {
    border-color: rgba(255,255,255,0.14);
  }

  .spotlight-image {
    flex: 0 0 55%;
    max-width: 55%;
    aspect-ratio: 16/9;
    overflow: hidden;
    display: block;
  }

  .spotlight-image a { display: block; height: 100%; }

  .spotlight-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 400ms ease, opacity 300ms ease;
  }

  .spotlight-card:hover .spotlight-image img {
    transform: scale(1.03);
    opacity: 0.88;
  }

  .spotlight-content {
    flex: 1;
    padding: var(--space-2xl);
    min-width: 0;
  }

  .spotlight-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
  }

  .spotlight-meta .hero-date {
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.38);
  }

  .spotlight-title {
    font-size: clamp(1.35rem, 2.8vw, 1.9rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    color: var(--color-text);
    margin: 0 0 var(--space-md);
  }

  .spotlight-title a {
    color: inherit;
    text-decoration: none;
    transition: color 150ms ease;
  }

  .spotlight-title a:hover { color: #fff; }

  .spotlight-excerpt {
    font-size: 0.9375rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.65;
    margin: 0 0 var(--space-xl);
  }

  /* Reuse .btn-read-more styles from below */

  /* =========================================================
   CATEGORY STRIP
   ========================================================= */
.category-strip {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: var(--space-md) 0;
}

.category-pills {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.cat-pill {
  display: inline-block;
  padding: 0.3rem 0.875rem;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: all var(--transition);
}

.cat-pill:hover,
.cat-pill.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

/* =========================================================
   CAT BADGE
   ========================================================= */
.cat-badge {
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.cat-badge:hover {
  background: var(--color-accent-dark);
}

/* =========================================================
   SECTION HEADING
   ========================================================= */
.section-heading {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-border);
  position: relative;
}

.section-heading::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--color-accent);
}

/* =========================================================
   HOMEPAGE GRID
   ========================================================= */
.homepage-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-3xl);
}

/* When spotlight-section and featured-strip live inside .homepage-grid they
   are in a grid column, not a standalone full-width band.  Strip the surface
   background and horizontal borders that were designed for the full-width
   context — they look jarring as a rectangular block inside a column. */
.homepage-grid .spotlight-section,
.homepage-grid .featured-strip {
  background: transparent;
  border-top: none;
  border-bottom: none;
}

/* =========================================================
   POST CARD GRID
   ========================================================= */
.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Card */
.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transform: translateY(-2px);
  border-color: var(--color-surface-2);
}

.card-image {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--color-border);
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.post-card:hover .card-image img {
  transform: scale(1.03);
}

.card-body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}

.card-date {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
}

.card-title a {
  color: var(--color-text);
  transition: color var(--transition);
}

.card-title a:hover {
  color: var(--color-accent);
}

.card-excerpt {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  flex: 1;
  margin-bottom: var(--space-md);
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.card-read-time {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

/* Post list (horizontal layout for archive/search) */
.post-list .post-card {
  flex-direction: row;
  border-radius: var(--radius-md);
}

.post-list .card-image {
  width: 200px;
  min-width: 200px;
  aspect-ratio: unset;
  border-radius: 0;
}

.post-list .card-title {
  font-size: 1rem;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
  /* inherits from archive-layout grid */
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.widget {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.widget-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.widget ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  list-style: none;
}

.widget ul li {
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.widget ul li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.widget ul a {
  font-size: 0.9rem;
  color: var(--color-text);
  transition: color var(--transition);
  line-height: 1.4;
}

.widget ul a:hover {
  color: var(--color-accent);
}

/* Sidebar search */
.widget_search .search-form-inner {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.widget_search .search-field {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  border: none;
  outline: none;
  color: var(--color-text);
  background: var(--color-bg);
}

.widget_search .search-submit {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  transition: background var(--transition);
}

.widget_search .search-submit:hover {
  background: var(--color-accent-dark);
}

/* =========================================================
   ARCHIVE LAYOUT
   ========================================================= */
.archive-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-3xl);
}

.archive-header {
  margin-bottom: var(--space-2xl);
}

.archive-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}

.archive-title {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.archive-description {
  margin-top: var(--space-md);
  color: var(--color-text-muted);
  font-size: 1rem;
  max-width: 560px;
}

/* =========================================================
   CATEGORY BANNER
   ========================================================= */
.category-banner {
  background: var(--color-header-dark);
  color: #fff;
  padding: var(--space-2xl) 0;
}

.category-banner--tag {
  background: #12121f;
}

.category-banner .archive-title {
  color: #fff;
}

.category-banner .archive-label {
  color: rgba(255,255,255,0.5);
}

.category-banner .archive-description {
  color: rgba(255,255,255,0.65);
}

/* =========================================================
   SINGLE POST
   ========================================================= */
.single-article {
  padding-bottom: var(--space-3xl);
}

.single-header {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-sm);
}

.single-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}

.post-date {
  font-size: 0.8125rem;
  color: var(--color-text-light);
}

.reading-time {
  font-size: 0.8125rem;
  color: var(--color-text-light);
}

.reading-time::before {
  content: '·';
  margin-right: var(--space-sm);
}

.single-title {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: var(--space-sm);
}

.single-excerpt {
  font-size: clamp(0.9rem, 2vw, 1rem);
  color: var(--color-text-muted);
  line-height: 1.6;
  font-family: var(--font-serif);
  border-left: 3px solid var(--color-accent);
  padding-left: var(--space-md);
  margin-top: var(--space-sm);
}

/* Featured image is not shown on single posts — kept for schema/OG use only */
.single-featured-image {
  display: none;
}

/* Article body */
.single-content {
  padding-bottom: var(--space-2xl);
}

.single-content .entry-content,
.single-content p,
.page-article-body p {
  font-size: 1rem;
  line-height: 1.72;
  color: var(--color-text);
  margin-bottom: 1.25em;
}

.single-content h2,
.page-article-body h2 {
  font-size: 1.25rem;
  margin-top: 2em;
  margin-bottom: 0.6em;
  letter-spacing: -0.01em;
}

.single-content h3,
.page-article-body h3 {
  font-size: 1.1rem;
  margin-top: 1.75em;
  margin-bottom: 0.5em;
}

.single-content img,
.page-article-body img {
  border-radius: var(--radius-md);
  margin: 2em 0;
  max-width: 100%;
}

.single-content blockquote,
.page-article-body blockquote {
  border-left: 4px solid var(--color-accent);
  margin: 2em 0;
  padding: var(--space-md) var(--space-xl);
  background: var(--color-surface);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-family: var(--font-serif);
  font-size: 1.125rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.single-content a,
.page-article-body a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.single-content a:hover,
.page-article-body a:hover {
  color: var(--color-accent-dark);
}

.single-content ul,
.single-content ol,
.page-article-body ul,
.page-article-body ol {
  padding-left: 1.5em;
  margin-bottom: 1.5em;
  list-style: revert;
}

.single-content li,
.page-article-body li {
  margin-bottom: 0.5em;
  line-height: 1.7;
  font-size: 1.0625rem;
}

.single-content pre,
.page-article-body pre {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  margin-bottom: 1.5em;
}

.single-content code,
.page-article-body code {
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.07);
  color: #c9b8ff;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.875em;
}

/* Post footer — tags + nav */
.single-footer {
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-border);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-xl);
}

.tag-link {
  display: inline-block;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  padding: 4px 10px;
  border-radius: 100px;
  transition: all var(--transition);
}

.tag-link:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Post navigation */
.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.nav-previous,
.nav-next {
  display: flex;
  flex-direction: column;
}

.nav-next {
  text-align: right;
}

.post-navigation a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--color-text);
  transition: color var(--transition);
}

.post-navigation a:hover {
  color: var(--color-accent);
}

.nav-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-light);
  font-weight: 600;
}

.nav-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

/* Related posts */
.related-posts {
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: var(--space-3xl) 0;
}

.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.related-card {
  display: flex;
  gap: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.related-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.related-image {
  width: 120px;
  min-width: 120px;
  overflow: hidden;
  background: var(--color-border);
}

.related-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-body {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-xs);
}

.related-category {
  display: block;
  margin-bottom: 4px;
}

.related-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
}

.related-title a {
  color: var(--color-text);
  transition: color var(--transition);
}

.related-title a:hover {
  color: var(--color-accent);
}

.related-date {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

/* =========================================================
   PAGE TEMPLATE
   ========================================================= */
.page-layout {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-3xl);
}

.page-content {
  max-width: var(--container-narrow);
}

.page-article-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.page-article-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.02em;
}

.page-article-body {
  font-size: 1.0625rem;
  line-height: 1.78;
}

/* =========================================================
   SEARCH RESULTS
   ========================================================= */
.search-results-layout {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-3xl);
}

.search-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.search-title {
  font-size: clamp(1.35rem, 3vw, 2rem);
  margin-bottom: var(--space-sm);
}

.search-query {
  color: var(--color-accent);
}

.search-count {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.search-form-wrapper {
  max-width: 480px;
}

.search-form-wrapper .search-form-inner {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.search-form-wrapper .search-field {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.9375rem;
  border: none;
  outline: none;
  color: var(--color-text);
  background: var(--color-surface);
}

.search-form-wrapper .search-submit {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  transition: background var(--transition);
}

.search-form-wrapper .search-submit:hover {
  background: var(--color-accent-dark);
}

.search-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
}

/* =========================================================
   PAGINATION
   ========================================================= */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-2xl);
  flex-wrap: wrap;
}

.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  transition: all var(--transition);
}

.pagination .page-numbers:hover,
.pagination .page-numbers.current {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.pagination .page-numbers.dots {
  border: none;
  background: transparent;
}

/* =========================================================
   404 PAGE
   ========================================================= */
.error-page {
  padding: var(--space-3xl) 0;
  text-align: center;
}

.error-inner {
  max-width: 520px;
  margin: 0 auto;
}

.error-code {
  display: block;
  font-size: clamp(5rem, 15vw, 9rem);
  font-weight: 900;
  color: var(--color-border);
  line-height: 1;
  margin-bottom: var(--space-lg);
  letter-spacing: -0.05em;
}

.error-title {
  font-size: 1.75rem;
  margin-bottom: var(--space-md);
}

.error-message {
  color: var(--color-text-muted);
  margin-bottom: var(--space-2xl);
}

.error-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--color-accent);
  color: #fff;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background var(--transition);
}

.btn-primary:hover {
  background: var(--color-accent-dark);
}

.error-actions .search-form-inner {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: 100%;
  max-width: 380px;
}

.error-actions .search-field {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  border: none;
  outline: none;
}

.error-actions .search-submit {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  transition: background var(--transition);
}

.error-actions .search-submit:hover {
  background: var(--color-accent-dark);
}

/* =========================================================
   NO RESULTS
   ========================================================= */
.no-results {
  padding: var(--space-3xl) 0;
  text-align: center;
}

.no-results h2 {
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
}

.no-results p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
}

/* =========================================================
   PAGE HEADER (Blog page title)
   ========================================================= */
.page-header {
  padding: var(--space-2xl) 0 var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-xl);
}

/* =========================================================
   COMMENTS
   ========================================================= */
.comments-area {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
}

.comments-title {
  font-size: 1.25rem;
  margin-bottom: var(--space-xl);
}

.comment-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.comment {
  padding: var(--space-lg);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.comment-author .fn {
  font-weight: 600;
  font-size: 0.9375rem;
}

.comment-metadata time {
  font-size: 0.8125rem;
  color: var(--color-text-light);
}

.comment-content p {
  font-size: 0.9375rem;
  line-height: 1.65;
}

.comment-reply-link {
  font-size: 0.8125rem;
  color: var(--color-accent);
  font-weight: 600;
}

.comment-form {
  margin-top: var(--space-2xl);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color var(--transition);
}

.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--color-accent);
}

.comment-form textarea {
  min-height: 140px;
  resize: vertical;
}

.comment-form .submit {
  background: var(--color-accent);
  color: #fff;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition);
}

.comment-form .submit:hover {
  background: var(--color-accent-dark);
}

/* =========================================================
     FOOTER — 4-column auto-populated layout
     ========================================================= */

  /* ── Root shell */
  .ft-root {
    background: var(--color-footer-bg);
    color: var(--color-footer-text);
    margin-top: auto;
    padding-top: var(--space-3xl);
  }

  /* ── 4-column grid (stacks to 1 on mobile) */
  .ft-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }

  /* ── Brand column */
  .ft-col--brand { max-width: 280px; }

  .ft-site-name {
    display: inline-block;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff;
    line-height: 1;
    margin-bottom: var(--space-sm);
    text-decoration: none;
  }

  .ft-site-name:hover { color: var(--color-accent); }
  .ft-logo img { max-height: 44px; width: auto; }

  .ft-tagline {
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.35);
    line-height: 1.5;
    margin: 0 0 var(--space-md);
  }

  .ft-about {
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.4);
    line-height: 1.65;
    margin: 0 0 var(--space-lg);
  }

  /* Animated "live" badge */
  .ft-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    padding: 4px 10px 4px 8px;
    margin-top: var(--space-sm);
  }

  .ft-badge__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-accent);
    flex-shrink: 0;
  }

  /* ── Column headings */
  .ft-col__heading {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    margin: 0 0 var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }

  /* ── Pages + Categories link lists */
  .ft-link-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .ft-link {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.5);
    padding: 6px 0;
    text-decoration: none;
    transition: color 150ms ease;
  }

  .ft-link:hover { color: #fff; }

  .ft-link__arrow {
    color: var(--color-accent);
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 150ms ease;
  }

  .ft-link:hover .ft-link__arrow { transform: translateX(3px); }

  .ft-link__count {
    margin-left: auto;
    font-size: 0.6875rem;
    color: rgba(255,255,255,0.18);
    font-variant-numeric: tabular-nums;
  }

  /* ── Recent posts list */
  .ft-recent-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
  }

  .ft-recent-item {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
  }

  .ft-recent-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: block;
    background: var(--color-surface);
  }

  .ft-recent-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 200ms ease;
  }

  .ft-recent-thumb:hover img { opacity: 0.7; }

  .ft-recent-body { flex: 1; min-width: 0; }

  .ft-recent-title {
    display: block;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255,255,255,0.65);
    line-height: 1.45;
    text-decoration: none;
    transition: color 150ms ease;
    margin-bottom: 4px;
  }

  .ft-recent-title:hover { color: #fff; }

  .ft-recent-date {
    display: block;
    font-size: 0.6875rem;
    color: rgba(255,255,255,0.22);
  }

  /* ── Horizontal divider */
  .ft-divider {
    height: 1px;
    background: rgba(255,255,255,0.07);
  }

  /* ── Bottom bar */
  .ft-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-lg);
    padding: var(--space-lg) 0;
  }

  .ft-copy,
  .ft-credit {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.22);
    margin: 0;
  }

  .ft-copy a,
  .ft-credit a {
    color: rgba(255,255,255,0.38);
    transition: color 150ms ease;
  }

  .ft-copy a:hover,
  .ft-credit a:hover { color: #fff; }

  .ft-bottom-nav .ft-bottom-menu {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-md);
    list-style: none;
  }

  .ft-bottom-nav .ft-bottom-menu a {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.32);
    transition: color 150ms ease;
  }

  .ft-bottom-nav .ft-bottom-menu a:hover { color: #fff; }

  /* =========================================================
   RESPONSIVE — TABLET (640px+)
   ========================================================= */
@media (min-width: 640px) {
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ft-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .spotlight-image {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .hero-inner {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   RESPONSIVE — DESKTOP (1024px+)
   ========================================================= */
@media (min-width: 1024px) {
  /*
   * Desktop homepage grid layout:
   *   Col 1 (1fr)          | Col 2 (sidebar-width)
   *   ─────────────────────┼──────────────────────
   *   Latest Stories (main)│ Sidebar  ↕ spans all 3 rows
   *   Featured Story       │
   *   Must Read            │
   *
   * Sidebar spans every row so it never bleeds over adjacent sections.
   * Mobile HTML order is: main → spotlight → featured → sidebar
   * so no CSS order tricks needed on small screens.
   */
  .homepage-grid {
    grid-template-columns: 1fr var(--sidebar-width);
    grid-template-areas:
      "main     sidebar"
      "spotlight sidebar"
      "featured  sidebar";
    align-items: start;
  }
  .homepage-grid .main-feed         { grid-area: main; }
  .homepage-grid .sidebar           { grid-area: sidebar; }

  /* The grid gap already separates rows; strip the large top padding that was
     designed for standalone full-width bands so there is no dead grey space. */
  .homepage-grid .spotlight-section {
    grid-area: spotlight;
    padding-top: 0;
  }
  .homepage-grid .featured-strip {
    grid-area: featured;
    padding-top: 0;
  }

  .archive-layout {
    grid-template-columns: 1fr var(--sidebar-width);
  }

  .search-body {
    grid-template-columns: 1fr var(--sidebar-width);
  }

  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-inner {
    grid-template-columns: 55fr 45fr;
    min-height: 560px;
    align-items: center;
  }

  .hero-image {
    aspect-ratio: unset;
    height: 100%;
    min-height: 480px;
    order: 2;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  }

  .hero-image img {
    height: 100%;
  }

  .hero-content {
    padding: var(--space-3xl) var(--space-2xl);
    order: 1;
  }

  .hero-title {
    font-size: clamp(2rem, 3.5vw, 3rem);
  }

  .related-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .ft-grid {
    grid-template-columns: 220px 1fr 1fr 1fr;
    gap: var(--space-xl);
  }
}


  /* Spotlight — mobile: stack image above content */
  @media (max-width: 639px) {
    .spotlight-card {
      flex-direction: column;
      gap: 0;
    }
    .spotlight-image {
      flex: none;
      max-width: 100%;
      width: 100%;
      aspect-ratio: 16/9;
    }
    .spotlight-content {
      padding: var(--space-lg);
    }
  }

  /* =========================================================
   RESPONSIVE — MOBILE NAV (max 768px)
   ========================================================= */
@media (max-width: 767px) {
  .nav-toggle {
    display: flex;
  }

  /* Do NOT set position:relative on .primary-nav — that limits the dropdown
     to the nav's own width. Leave .site-header (sticky) as the containing
     block so left:0 / right:0 span the full viewport width. */

  .nav-menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #111;
    flex-direction: column;
    padding: var(--space-md) 0;
    border-top: 1px solid rgba(255,255,255,0.08);
  }

  .nav-menu.is-open {
    display: flex;
  }

  .nav-menu a {
    line-height: 1;
    padding: 12px var(--space-lg);
    display: block;
    border-bottom: none;
  }

  .nav-menu .current-menu-item > a {
    border-bottom: none;
    color: var(--color-accent);
  }

  .nav-menu .sub-menu {
    position: static;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    border: none;
    background: rgba(255,255,255,0.04);
    padding-left: var(--space-lg);
    border-radius: 0;
    display: none;
  }

  .nav-menu li.menu-open > .sub-menu {
    display: block;
  }

  .post-list .post-card {
    flex-direction: column;
  }

  .post-list .card-image {
    width: 100%;
    min-width: unset;
    aspect-ratio: 16/9;
  }

  .post-navigation {
    grid-template-columns: 1fr;
  }

  .nav-next {
    text-align: left;
  }
}

/* =========================================================
   MOBILE — Wider post cards in Latest Stories grid
   Reduces the homepage grid's side padding so each card
   fills more of the screen width. Desktop is unaffected.
   ========================================================= */
@media (max-width: 1023px) {
  .homepage-grid {
    padding-inline: var(--space-sm); /* 8px each side instead of 24px */
  }
}

/* =========================================================
   LINE CLAMP UTILITY
   ========================================================= */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Apply to all card titles for consistency */
.card-title a,
.featured-main-title a,
.featured-small-title a,
.trending-title a,
.related-title a {
  display: block;
}

.card-title,
.featured-main-title,
.featured-small-title,
.trending-title,
.related-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* =========================================================
   FEATURED STRIP ("Must Read")
   ========================================================= */
.featured-strip {
  padding: var(--space-2xl) 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.featured-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

/* Featured main card */
.featured-main {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.featured-main-image {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--color-border);
}

.featured-main-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.featured-main:hover .featured-main-image img {
  transform: scale(1.03);
}

.featured-main-body {
  padding: var(--space-lg);
}

.featured-main-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin: var(--space-sm) 0;
  letter-spacing: -0.01em;
}

.featured-main-title a {
  color: var(--color-text);
  transition: color var(--transition);
}

.featured-main-title a:hover {
  color: var(--color-accent);
}

.featured-main-excerpt {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-top: var(--space-sm);
}

/* Featured small cards */
.featured-small {
  display: flex;
  flex-direction: row;        /* always horizontal: image-left, text-right */
  align-self: start;          /* don't stretch to match the tall main-card row */
  gap: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.featured-small:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.featured-small-image {
  position: relative;   /* contain the absolute badge overlay */
  width: 110px;
  min-width: 110px;
  height: 90px;
  overflow: hidden;
  background: var(--color-border);
  flex-shrink: 0;
}

.featured-small-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Category badge as a deliberate thumbnail overlay (bottom-left) */
.featured-small-image .card-category {
  position: absolute;
  bottom: 6px;
  left: 6px;
  z-index: 1;
  line-height: 1;
}

.featured-small-body {
  flex: 1;          /* fill remaining card width */
  min-width: 0;     /* allow shrink below content minimum */
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.featured-small-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 4px 0;
}

.featured-small-title a {
  color: var(--color-text);
  transition: color var(--transition);
}

.featured-small-title a:hover {
  color: var(--color-accent);
}

/* =========================================================
   TRENDING SECTION
   ========================================================= */
.trending-section {
  padding: var(--space-2xl) 0;
  background: var(--color-bg);
}

.trending-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  counter-reset: none;
  list-style: none;
}

.trending-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition);
}

.trending-item:first-child {
  padding-top: 0;
}

.trending-item:last-child {
  border-bottom: none;
}

.trending-rank {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--color-border);
  line-height: 1;
  min-width: 40px;
  letter-spacing: -0.04em;
}

.trending-body {
  flex: 1;
  min-width: 0;
}

.trending-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 4px;
}

.trending-title a {
  color: var(--color-text);
  transition: color var(--transition);
}

.trending-title a:hover {
  color: var(--color-accent);
}

.trending-thumb {
  width: 80px;
  min-width: 80px;
  height: 56px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--color-border);
  flex-shrink: 0;
}

.trending-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =========================================================
   RELATED GRID — 2×3 WIDE LAYOUT
   ========================================================= */
.related-grid--wide {
  grid-template-columns: 1fr;
}

/* =========================================================
   POST IMAGE SPACING (inside article body)
   ========================================================= */
.single-content .wp-block-image,
.single-content figure,
.page-article-body .wp-block-image,
.page-article-body figure {
  margin: 2em 0;
}

.single-content .wp-block-image img,
.single-content figure img,
.page-article-body .wp-block-image img,
.page-article-body figure img {
  border-radius: var(--radius-md);
  display: block;
  max-width: 100%;
  height: auto;
}

.single-content figcaption,
.page-article-body figcaption {
  font-size: 0.8125rem;
  color: var(--color-text-light);
  text-align: center;
  margin-top: var(--space-sm);
}

/* Prevent duplicate thumbnail: hide .wp-post-image inside .single-content
   since the featured image is already rendered above the content */
.single-content .wp-post-image {
  display: none;
}

/* =========================================================
   COMPACT MOBILE POST GRID (≤ 479px)
   ========================================================= */
@media (max-width: 479px) {
  .post-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
  }

  .post-grid .card-body {
    padding: var(--space-sm);
  }

  .post-grid .card-excerpt {
    display: none;
  }

  .post-grid .card-title {
    font-size: 0.875rem;
  }

  .post-grid .card-footer {
    display: none;
  }

  .post-grid .card-meta {
    gap: 4px;
    margin-bottom: 4px;
  }

  .trending-thumb {
    display: none;
  }
}

/* =========================================================
   RESPONSIVE — FEATURED & TRENDING (640px+)
   ========================================================= */
@media (min-width: 640px) {
  .featured-grid {
    grid-template-columns: 1fr 1fr;
  }

  .featured-main {
    grid-column: 1 / -1;
    flex-direction: row;
    max-height: 280px;
  }

  .featured-main-image {
    width: 380px;
    min-width: 380px;
    aspect-ratio: unset;
    flex-shrink: 0;
  }

  .featured-main-body {
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .related-grid--wide {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .featured-grid {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto;
  }

  .featured-main {
    grid-column: 1;
    grid-row: 1 / 3;
    flex-direction: column;
    max-height: none;
  }

  .featured-main-image {
    width: 100%;
    min-width: unset;
    aspect-ratio: 16/9;
  }

  .featured-small {
    grid-column: 2;
  }

  .trending-section .container {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-xl);
    align-items: start;
  }

  .trending-section .section-heading {
    writing-mode: vertical-lr;
    text-orientation: mixed;
    transform: rotate(180deg);
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    border-right: 2px solid var(--color-border);
    padding-right: var(--space-sm);
    align-self: stretch;
    display: flex;
    align-items: center;
  }

  .trending-section .section-heading::after {
    display: none;
  }

  .related-grid--wide {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* =========================================================
   PRINT
   ========================================================= */
@media print {
  .site-header,
  .sidebar,
  .site-footer,
  .post-navigation,
  .related-posts,
  .comments-area {
    display: none;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  a {
    text-decoration: underline;
  }

  img {
    max-width: 100%;
  }
}

/* =========================================================
   INFINITE SCROLL — Loader + Sentinel
   ========================================================= */

/* Invisible positioning anchor for IntersectionObserver */
.is-sentinel {
  height: 1px;
  width: 100%;
  display: block;
  visibility: hidden;
}

/* Three-dot pulse loader */
.is-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: var(--space-lg) 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.is-loader--active {
  opacity: 1;
}

.is-loader-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
  animation: is-dot-pulse 1.1s ease-in-out infinite both;
}

.is-loader-dot:nth-child(2) { animation-delay: 0.18s; }
.is-loader-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes is-dot-pulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.75); }
  40%           { opacity: 1;    transform: scale(1);    }
}

/* =========================================================
   SINGLE-POST INFINITE SCROLL
   ========================================================= */

/* Stream wrapper — no visual effect, just a layout root */
#sa-stream {
  display: block;
}

/* Invisible sentinel at the bottom of each article */
.sa-sentinel {
  height: 1px;
  width: 100%;
  display: block;
  visibility: hidden;
  pointer-events: none;
}

/* Divider shown between streamed articles */
.sa-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  max-width: var(--container-narrow);
  margin: calc(var(--space-xl) * 1.5) auto var(--space-xl);
  padding: 0 var(--space-md);
}

.sa-divider__line {
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.sa-divider__label {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* Injected articles fade in smoothly */
.sa-injected {
  opacity: 0;
  animation: sa-fadein 500ms ease forwards;
}

@keyframes sa-fadein {
  to { opacity: 1; }
}

/* =========================================================
   LOAD MORE BUTTON
   ========================================================= */

.load-more-btn {
  display: block;
  position: relative;
  width: 100%;
  max-width: 260px;
  margin: var(--space-xl) auto var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  background: transparent;
  border: 2px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
}

.load-more-btn:hover:not(.lm-loading) {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-glow, rgba(224, 82, 82, 0.08));
}

.load-more-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* Loading state — text goes transparent, spinner appears */
.load-more-btn.lm-loading {
  color: transparent;
  pointer-events: none;
  border-color: var(--color-border);
}

.load-more-btn.lm-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: lm-spin 0.65s linear infinite;
}

@keyframes lm-spin {
  to { transform: rotate(360deg); }
}

/* =========================================================
   CINECRIT — Author Byline Card
   ========================================================= */

.ccb-wrap {
  margin: var(--space-2xl) auto;
}

/* Card shell */
.ccb-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

/* Top accent stripe */
.ccb-stripe {
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent) 0%, transparent 100%);
  flex-shrink: 0;
}

/* Primary body: avatar + content side by side */
.ccb-body {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xl);
  padding: var(--space-xl);
}

/* Avatar ring */
.ccb-avatar-ring {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-border) 100%);
}

.ccb-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid var(--color-surface);
}

/* Content column */
.ccb-content {
  flex: 1;
  min-width: 0;
}

/* Header row: name + badge on left, link on right */
.ccb-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}

.ccb-name {
  display: block;
  font-size: 1.0625rem;
  font-weight: 800;
  color: var(--color-text);
  text-decoration: none;
  line-height: 1.2;
  margin-bottom: 0.3em;
}

.ccb-name:hover {
  color: var(--color-accent);
}

.ccb-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: rgba(224, 82, 82, 0.1);
  border: 1px solid rgba(224, 82, 82, 0.25);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}

.ccb-articles-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-light);
  text-decoration: none;
  white-space: nowrap;
  padding-top: 2px;
  transition: color var(--transition);
  flex-shrink: 0;
}

.ccb-articles-link:hover {
  color: var(--color-accent);
}

.ccb-bio {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--color-text-muted);
  margin: 0;
}

.ccb-bio--placeholder {
  font-style: italic;
  opacity: 0.8;
}

/* Reviewer strip */
.ccb-reviewer {
  border-top: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.02);
  padding: var(--space-md) var(--space-xl);
}

.ccb-reviewer-eyebrow {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-light);
  margin-bottom: var(--space-sm);
}

.ccb-reviewer-inner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.ccb-reviewer-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.ccb-reviewer-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ccb-reviewer-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-text-muted);
  line-height: 1;
}

.ccb-reviewer-title {
  font-size: 0.7rem;
  color: var(--color-text-light);
  line-height: 1;
}

.ccb-reviewer-note {
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin: 0;
  line-height: 1.5;
  flex: 1;
  min-width: 160px;
}

/* ── Mobile: stack avatar above content */
@media (max-width: 540px) {
  .ccb-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-lg);
  }

  .ccb-header {
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
  }

  .ccb-articles-link {
    justify-content: center;
  }

  .ccb-reviewer-inner {
    justify-content: center;
    text-align: center;
  }

  .ccb-reviewer-meta {
    align-items: center;
  }
}

/* =========================================================
   HOME INTRO — Subtle H1 + SEO intro paragraph
   Styled as an editorial label; high DOM priority for
   search engines, low visual weight for readers.
   ========================================================= */

.home-intro {
  padding-top: var(--space-md);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-xl);
}

/* H1: styled as a compact site descriptor, not a hero heading */
.home-intro__heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.45em;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-light);
  line-height: 1.4;
  margin: 0 0 0.6em;
}

.home-intro__sep {
  color: var(--color-border);
  font-weight: 400;
}

.home-intro__tagline {
  color: var(--color-text-light);
  font-weight: 400;
  letter-spacing: 0.06em;
}

/* Intro paragraph: natural keyword copy, readable but unobtrusive */
.home-intro__text {
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--color-text-light);
  max-width: 68ch;
  margin: 0;
}
