/**
 * CoreMindVision — layout.css
 *
 * Covers:
 *  1. Layout system (full-width / left-sidebar / right-sidebar / default)
 *  2. Sidebar styles
 *  3. Responsive grid fixes (mobile ≤768px, tablet 769–1024px, desktop ≥1025px)
 *  4. Typography responsive scaling (clamp-based fluid type)
 *  5. Image & embed responsiveness
 *  6. List styles (bullets, numbered, definition)
 *  7. Entry content rich-text styles
 *  8. Overflow protection
 *
 * @package CoreMindVision
 * @version 1.2.0
 */

/* =====================================================
   1. LAYOUT SYSTEM
   ===================================================== */

/* Wrapper used in page/single/archive templates */
.cmv-layout {
  display: grid;
  gap: var(--space-12);
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
  box-sizing: border-box;
}

/* Default & right-sidebar: content left, sidebar right */
.cmv-layout--default,
.cmv-layout--right-sidebar {
  grid-template-columns: 1fr 320px;
  grid-template-areas: "main sidebar";
}

/* Left-sidebar: sidebar left, content right */
.cmv-layout--left-sidebar {
  grid-template-columns: 280px 1fr;
  grid-template-areas: "sidebar main";
}

/* Full width: single column, wider max-width */
.cmv-layout--full-width {
  grid-template-columns: 1fr;
  grid-template-areas: "main";
  max-width: var(--container-max);
}

/* Grid area assignments */
.cmv-layout__main    { grid-area: main; min-width: 0; /* prevent overflow */ }
.cmv-layout__sidebar { grid-area: sidebar; min-width: 0; }

/* Content wrapper (inside templates that don't use layout system) */
.content-wrap {
  padding-block: var(--space-16);
  overflow-x: hidden;
}

/* =====================================================
   2. SIDEBAR
   ===================================================== */

.widget-area {
  position: sticky;
  top: calc(var(--header-height) + var(--space-6));
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.widget {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

/* Accent top-bar */
.widget::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-brand-h);
}

.widget-title {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  letter-spacing: 0.02em;
}

/* Widget list items */
.widget ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  margin: 0;
}

.widget ul li {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

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

.widget ul li::before {
  content: '›';
  color: var(--color-primary);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.widget ul li a {
  color: var(--color-text-light);
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
  flex: 1;
}

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

/* Search widget */
.widget_search .search-form {
  display: flex;
  gap: var(--space-2);
}

.widget_search .search-form input[type="search"] {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-white);
  transition: border-color var(--transition-fast);
}

.widget_search .search-form input[type="search"]:focus {
  outline: none;
  border-color: var(--color-primary);
}

.widget_search .search-form button {
  padding: var(--space-2) var(--space-4);
  background: var(--gradient-brand);
  color: white;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

/* Recent posts widget */
.widget_recent_entries ul li {
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
}

.widget_recent_entries ul li::before { display: none; }

.widget_recent_entries .post-date {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Categories / Archives widget */
.widget_categories ul li,
.widget_archive ul li {
  justify-content: space-between;
}

/* Tag cloud widget */
.widget_tag_cloud .tagcloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.widget_tag_cloud .tagcloud a {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: var(--color-light-gray);
  border-radius: var(--radius-full);
  font-size: var(--text-xs) !important;
  color: var(--color-text-light);
  transition: all var(--transition-fast);
  border: 1px solid var(--color-border);
}

.widget_tag_cloud .tagcloud a:hover {
  background: var(--gradient-brand);
  color: white;
  border-color: transparent;
}

/* =====================================================
   3. ENTRY CONTENT — Rich Text / WordPress Editor
   ===================================================== */

.entry-content,
.post-content {
  line-height: 1.8;
  font-size: 1.0625rem; /* 17px */
  color: var(--color-text);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Paragraphs */
.entry-content p,
.post-content p {
  margin-bottom: 1.5em;
}

/* Links */
.entry-content a,
.post-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

.entry-content a:hover,
.post-content a:hover {
  color: var(--color-accent);
}

/* ── LISTS ─────────────────────────────────────────── */

/* Unordered list (bullet) */
.entry-content ul,
.post-content ul,
.cmv-list-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5em 0;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.entry-content ul li,
.post-content ul li,
.cmv-list-bullets li {
  position: relative;
  padding-left: 1.6em;
  color: var(--color-text-light);
  line-height: 1.7;
}

.entry-content ul li::before,
.post-content ul li::before,
.cmv-list-bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gradient-brand);
  flex-shrink: 0;
}

/* Nested unordered list */
.entry-content ul ul,
.post-content ul ul {
  margin-top: 0.5em;
  margin-bottom: 0;
  padding-left: 0.5em;
}

.entry-content ul ul li::before,
.post-content ul ul li::before {
  width: 6px;
  height: 6px;
  background: var(--color-primary-xlight);
  top: 0.6em;
}

/* Ordered list (numbered) */
.entry-content ol,
.post-content ol,
.cmv-list-numbered {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5em 0;
  counter-reset: cmv-counter;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.entry-content ol li,
.post-content ol li,
.cmv-list-numbered li {
  position: relative;
  padding-left: 2.2em;
  color: var(--color-text-light);
  line-height: 1.7;
  counter-increment: cmv-counter;
}

.entry-content ol li::before,
.post-content ol li::before,
.cmv-list-numbered li::before {
  content: counter(cmv-counter);
  position: absolute;
  left: 0;
  top: 0.1em;
  width: 1.5em;
  height: 1.5em;
  background: var(--gradient-brand);
  color: white;
  font-size: 0.75em;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: var(--font-body);
}

/* Definition list */
.entry-content dl,
.post-content dl { margin-bottom: 1.5em; }

.entry-content dt,
.post-content dt {
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.25em;
}

.entry-content dd,
.post-content dd {
  padding-left: 1.5em;
  color: var(--color-text-light);
  margin-bottom: 0.75em;
  border-left: 2px solid var(--color-primary);
}

/* ── HEADINGS inside content ─── */
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6,
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin-top: 2em;
  margin-bottom: 0.75em;
}

.entry-content h2,
.post-content h2 {
  padding-bottom: 0.4em;
  border-bottom: 2px solid var(--color-border);
}

/* ── BLOCKQUOTE ─────────────── */
.entry-content blockquote,
.post-content blockquote {
  margin: 2em 0;
  padding: var(--space-6) var(--space-8);
  background: linear-gradient(135deg, var(--color-bg-alt) 0%, rgba(26,110,216,0.04) 100%);
  border-left: 4px solid;
  border-image: var(--gradient-brand-h) 1;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  font-size: 1.1em;
  font-style: italic;
  color: var(--color-text-light);
  position: relative;
}

.entry-content blockquote::before,
.post-content blockquote::before {
  content: '"';
  font-family: var(--font-heading);
  font-size: 4em;
  line-height: 1;
  color: var(--color-primary);
  opacity: 0.15;
  position: absolute;
  top: 0;
  left: var(--space-4);
}

.entry-content blockquote cite,
.post-content blockquote cite {
  display: block;
  margin-top: var(--space-3);
  font-size: 0.85em;
  font-style: normal;
  font-weight: 600;
  color: var(--color-primary);
}

/* ── TABLES ─────────────────── */
.entry-content table,
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5em;
  font-size: var(--text-sm);
  overflow-x: auto;
  display: block;
}

.entry-content thead,
.post-content thead {
  background: var(--gradient-brand);
  color: white;
}

.entry-content th,
.post-content th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 600;
  color: white;
  white-space: nowrap;
}

.entry-content td,
.post-content td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-light);
  vertical-align: top;
}

.entry-content tr:nth-child(even) td,
.post-content tr:nth-child(even) td {
  background: var(--color-bg-alt);
}

.entry-content tr:hover td,
.post-content tr:hover td {
  background: rgba(26,110,216,0.04);
}

/* ── CODE ───────────────────── */
.entry-content code,
.post-content code {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.15em 0.45em;
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--color-primary);
}

.entry-content pre,
.post-content pre {
  background: var(--color-bg-dark3);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  overflow-x: auto;
  margin-bottom: 1.5em;
  border: 1px solid rgba(26,110,216,0.15);
}

.entry-content pre code,
.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: #a9b1d6;
  font-size: 0.9em;
}

/* ── IMAGES inside content ───── */
.entry-content img,
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  display: block;
}

.entry-content figure,
.post-content figure {
  margin: 2em 0;
}

.entry-content figcaption,
.post-content figcaption {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-align: center;
  margin-top: var(--space-2);
  font-style: italic;
}

/* WordPress image alignment */
.entry-content .alignleft  { float: left; margin: 0.5em 1.5em 1em 0; }
.entry-content .alignright { float: right; margin: 0.5em 0 1em 1.5em; }
.entry-content .aligncenter { display: block; margin-inline: auto; }
.entry-content .alignwide  { max-width: var(--container-wide); margin-inline: auto; }
.entry-content .alignfull  { max-width: 100vw; margin-inline: calc(-1 * var(--space-6)); }

/* Clearfix after floated images */
.entry-content::after { content: ''; display: table; clear: both; }

/* ── HR ─────────────────────── */
.entry-content hr,
.post-content hr {
  border: none;
  height: 2px;
  background: var(--gradient-brand-h);
  border-radius: 2px;
  margin: 2.5em 0;
  opacity: 0.3;
}

/* ── EMBED / IFRAME (responsive) ── */
.entry-content iframe,
.entry-content embed,
.entry-content object,
.post-content iframe {
  max-width: 100%;
  border-radius: var(--radius-lg);
}

.wp-block-embed,
.wp-video,
.wp-audio {
  max-width: 100%;
}

.wp-block-embed__wrapper {
  position: relative;
  padding-top: 56.25%; /* 16:9 */
}

.wp-block-embed__wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* ── BUTTONS inside content ─── */
.entry-content .wp-block-button__link,
.post-content .wp-block-button__link {
  background: var(--gradient-brand);
  color: white;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: all var(--transition-smooth);
  border: none;
}

.entry-content .wp-block-button__link:hover,
.post-content .wp-block-button__link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-blue);
}

/* =====================================================
   4. RESPONSIVE — GLOBAL OVERFLOW PROTECTION
   ===================================================== */

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

*,
*::before,
*::after {
  max-width: 100%;
  box-sizing: border-box;
}

img,
video,
iframe,
embed,
object,
svg {
  max-width: 100%;
  height: auto;
}

/* Tables: allow horizontal scroll on small screens */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* =====================================================
   5. RESPONSIVE — FLUID TYPOGRAPHY
   ===================================================== */

/* These clamp values work ALONGSIDE any customizer overrides */

/* Scale hero title smoothly */
.hero-title {
  font-size: clamp(1.8rem, 5vw + 0.5rem, 4.2rem);
  line-height: clamp(1.1, 1.1, 1.15);
}

/* Scale section titles */
.section__title,
h2 {
  font-size: clamp(1.5rem, 3vw + 0.5rem, 3rem);
}

h3 { font-size: clamp(1.2rem, 2.5vw + 0.3rem, 2.25rem); }
h4 { font-size: clamp(1.1rem, 1.5vw + 0.3rem, 1.5rem); }

/* Body text minimum readability */
body {
  font-size: clamp(14px, 1vw + 12px, 17px);
}

/* =====================================================
   6. RESPONSIVE — DESKTOP (≥1025px)
   ===================================================== */

@media (min-width: 1025px) {
  .cmv-layout--default,
  .cmv-layout--right-sidebar {
    grid-template-columns: 1fr 320px;
  }

  .cmv-layout--left-sidebar {
    grid-template-columns: 280px 1fr;
  }

  /* Show sidebar sticky positioning */
  .widget-area {
    position: sticky;
    top: calc(var(--header-height) + var(--space-6));
    max-height: calc(100vh - var(--header-height) - var(--space-12));
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
  }

  .widget-area::-webkit-scrollbar { width: 4px; }
  .widget-area::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }
}

/* =====================================================
   7. RESPONSIVE — TABLET (769px–1024px)
   ===================================================== */

@media (min-width: 769px) and (max-width: 1024px) {

  /* Layout: collapse to single column on tablet */
  .cmv-layout--default,
  .cmv-layout--right-sidebar,
  .cmv-layout--left-sidebar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "main"
      "sidebar";
  }

  /* Left sidebar: reorder so main comes first on tablet */
  .cmv-layout--left-sidebar {
    grid-template-areas:
      "main"
      "sidebar";
  }

  .widget-area {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
  }

  /* Hero */
  .hero-inner {
    grid-template-columns: 1fr;
    gap: var(--space-10);
  }

  .hero {
    min-height: auto;
    padding-bottom: var(--space-16);
  }

  .hero-subtitle { max-width: 100%; }

  .hero-stats {
    display: flex;
    gap: var(--space-6);
    flex-wrap: wrap;
  }

  /* Service grid */
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }

  /* Industry grid */
  .industry-grid { grid-template-columns: repeat(3, 1fr); }

  /* CoreMindLab + Why sections */
  .coremindlab-inner,
  .why-grid {
    grid-template-columns: 1fr;
    gap: var(--space-10);
  }

  /* Footer */
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }

  /* Posts archive */
  .posts-grid { grid-template-columns: repeat(2, 1fr); }

  /* Navigation: ensure wrapping */
  .header-inner { flex-wrap: nowrap; }

  /* Images */
  .entry-content .alignleft,
  .entry-content .alignright {
    float: none;
    margin: 1em auto;
    display: block;
  }
}

/* =====================================================
   8. RESPONSIVE — MOBILE (≤768px)
   ===================================================== */

@media (max-width: 768px) {

  :root {
    --header-height: 64px;
    --space-section: var(--space-12);
  }

  /* ── LAYOUT SYSTEM ── */
  .cmv-layout--default,
  .cmv-layout--right-sidebar,
  .cmv-layout--left-sidebar,
  .cmv-layout--full-width {
    grid-template-columns: 1fr;
    grid-template-areas:
      "main"
      "sidebar";
    padding-inline: var(--space-4);
    gap: var(--space-8);
  }

  .widget-area {
    position: static;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .widget {
    padding: var(--space-5);
  }

  /* ── SECTIONS ── */
  .section,
  .section--lg {
    padding-block: var(--space-12);
  }

  .section__header {
    margin-bottom: var(--space-10);
    text-align: left;
  }

  .section__header:has(+ .text-center),
  .section__header.text-center {
    text-align: center;
  }

  /* ── CONTAINER ── */
  .container,
  .container--narrow,
  .container--wide {
    padding-inline: var(--space-4);
  }

  /* ── HERO ── */
  .hero {
    min-height: auto;
    padding-top: calc(var(--header-height) + var(--space-10));
    padding-bottom: var(--space-12);
    align-items: flex-start;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: var(--space-10);
  }

  .hero-title {
    font-size: clamp(1.8rem, 8vw, 2.8rem);
    line-height: 1.1;
  }

  .hero-subtitle {
    font-size: var(--text-base);
    max-width: 100%;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    margin-top: var(--space-8);
    padding-top: var(--space-6);
  }

  .hero-stat__num { font-size: var(--text-xl); }
  .hero-stat__label { font-size: 0.7rem; }

  /* ── GRIDS ── */
  .grid--2,
  .grid--3,
  .grid--4,
  .grid--auto-fit {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  /* Keep 2-col for small cards */
  .industry-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  /* ── HEADER / NAV ── */
  .primary-nav { display: none; }
  .header-toolkit-link { display: none; }
  .menu-toggle { display: flex; }

  .header-inner {
    padding-inline: var(--space-4);
    gap: var(--space-3);
  }

  /* Full-screen mobile nav */
  .primary-nav.open {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: var(--header-height);
    left: 0; right: 0; bottom: 0;
    background: var(--color-bg-hero);
    padding: var(--space-6) var(--space-5);
    overflow-y: auto;
    z-index: 999;
    border-top: 1px solid rgba(26,110,216,0.20);
    gap: 0;
  }

  .primary-nav.open ul {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .primary-nav.open li { width: 100%; }

  .primary-nav.open > ul > li > a {
    font-size: var(--text-lg);
    padding: var(--space-4) var(--space-3);
    color: rgba(255,255,255,0.85);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    border-radius: 0;
    display: block;
  }

  .primary-nav.open > ul > li > a:hover {
    background: rgba(26,110,216,0.12);
    color: white;
    padding-left: var(--space-5);
  }

  /* Submenu on mobile */
  .primary-nav.open .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    background: rgba(26,110,216,0.06);
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding-left: var(--space-4);
  }

  /* ── SERVICE CARDS ── */
  .service-card {
    padding: var(--space-6);
  }

  /* ── COREMINDLAB ── */
  .coremindlab-inner {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  /* ── WHY SECTION ── */
  .why-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .why-metric-row {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .why-graphic { padding: var(--space-6); }

  /* ── FOOTER ── */
  .footer-top {
    grid-template-columns: 1fr;
    gap: var(--space-8);
    text-align: left;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
    text-align: center;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: var(--space-3);
    justify-content: center;
  }

  /* ── CTA BANNER ── */
  .cta-banner { padding-block: var(--space-12); }
  .cta-banner h2 { font-size: clamp(1.5rem, 6vw, 2.25rem); }
  .cta-banner__actions {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }
  .cta-banner__actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* ── POSTS GRID ── */
  .posts-grid { grid-template-columns: 1fr; }

  /* ── PAGE HEADER ── */
  .page-header {
    padding-top: calc(var(--header-height) + var(--space-8));
    padding-bottom: var(--space-10);
    text-align: left;
  }

  /* ── ENTRY CONTENT ── */
  .entry-content,
  .post-content {
    font-size: var(--text-base);
  }

  .entry-content .alignleft,
  .entry-content .alignright {
    float: none;
    margin: 1em auto;
    display: block;
    width: 100%;
  }

  .entry-content .alignfull {
    margin-inline: calc(-1 * var(--space-4));
  }

  /* ── CONTACT PAGE ── */
  .page-contact-grid,
  [style*="grid-template-columns: 1fr 1.4fr"] {
    display: flex !important;
    flex-direction: column !important;
  }

  /* ── SERVICE SINGLE ── */
  [style*="grid-template-columns: 1fr 360px"] {
    display: flex !important;
    flex-direction: column !important;
  }

  /* ── BUTTONS ── */
  .btn--lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
  }

  /* ── VIDEO WRAPPER ── */
  .video-wrapper { border-radius: var(--radius-xl); }

  .video-badge {
    bottom: var(--space-3);
    left: var(--space-3);
    padding: var(--space-2) var(--space-3);
  }

  .video-badge__text strong { font-size: 0.75rem; }
  .video-badge__text span   { display: none; }

  /* ── 404 PAGE ── */
  .site-404 { min-height: 60vh; }

  /* Hide complex decorative particles on small screens */
  .hero-particles span:nth-child(n+7) { display: none; }
}

/* =====================================================
   9. RESPONSIVE — VERY SMALL (≤420px)
   ===================================================== */

@media (max-width: 420px) {
  .industry-grid {
    grid-template-columns: 1fr;
  }

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

  .hero-stat__num { font-size: var(--text-lg); }

  .service-card__icon {
    width: 48px; height: 48px;
  }

  .footer-social a {
    width: 32px; height: 32px;
  }

  .why-metric { padding: var(--space-4); }
  .why-metric__val { font-size: var(--text-2xl); }
}

/* =====================================================
   10. PRINT
   ===================================================== */

@media print {
  .cmv-layout { display: block; }
  .widget-area { display: none; }
  .cmv-layout__main { width: 100%; }

  .entry-content .alignleft,
  .entry-content .alignright {
    float: none;
    display: block;
    margin: 1em auto;
  }
}

/* =====================================================
   CONTACT PAGE
   ===================================================== */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: var(--space-16);
  align-items: start;
}

.contact-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.contact-item {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.contact-item:hover {
  border-color: rgba(26,110,216,0.25);
  box-shadow: var(--shadow-sm);
}

.contact-item__icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, rgba(26,110,216,0.12), rgba(123,47,247,0.06));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
  transition: background var(--transition-smooth);
}

.contact-item:hover .contact-item__icon {
  background: var(--gradient-brand);
  color: white;
}

.contact-item__label {
  font-weight: 600;
  color: var(--color-text);
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
}

.contact-item__value {
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

a.contact-item__value {
  color: var(--color-primary);
  transition: color var(--transition-fast);
}

a.contact-item__value:hover { color: var(--color-accent); }

/* CoreMindLab promo in contact */
.contact-lab-promo {
  background: linear-gradient(135deg, var(--color-bg-dark3), var(--color-bg-dark));
  border: 1px solid rgba(26,110,216,0.20);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-7);
  color: white;
}

.contact-lab-promo__badge {
  font-size: 2rem;
  margin-bottom: var(--space-3);
  line-height: 1;
}

.contact-lab-promo__title {
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: white;
}

.contact-lab-promo__desc {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.65);
  line-height: 1.7;
  margin-bottom: var(--space-5);
}

/* Form row (2 columns) */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

/* Contact form wrap */
.contact-form-wrap {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
}

/* ── Responsive contact ── */
@media (max-width: 900px) {
  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--space-10);
  }
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .contact-form-wrap {
    padding: var(--space-6);
    border-radius: var(--radius-xl);
  }
}

/* =====================================================
   COMMENTS
   ===================================================== */

.comments-area {
  margin-top: var(--space-12);
  padding-top: var(--space-10);
  border-top: 1px solid var(--color-border);
}

.comments-title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-8);
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-10) 0;
}

.comment-list li { list-style: none; }

.comment-body {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--color-bg-alt);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
}

.comment-body img.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
}

.comment-meta { margin-bottom: var(--space-3); }

.comment-author .fn {
  font-weight: 700;
  font-style: normal;
  color: var(--color-text);
}

.comment-metadata a {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.comment-content p {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  line-height: 1.7;
  margin: 0;
}

/* Nested replies */
.children {
  margin-top: var(--space-4);
  margin-left: var(--space-10);
  padding-left: var(--space-6);
  border-left: 2px solid var(--color-border);
  list-style: none;
  padding-top: 0;
}

.comment-respond {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  margin-top: var(--space-8);
}

.comment-reply-title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-6);
}

.comment-form label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-white);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  margin-bottom: var(--space-5);
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,110,216,0.12);
}

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

.comment-form-comment { display: flex; flex-direction: column; }

.comment-form input[type="submit"],
.submit {
  background: var(--gradient-brand);
  color: white;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  width: fit-content;
}

.comment-form input[type="submit"]:hover,
.submit:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-blue);
}

/* =====================================================
   PAGINATION (global)
   ===================================================== */

.cmv-pagination {
  margin-top: var(--space-12);
}

.cmv-pagination .nav-links {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

.cmv-pagination a,
.cmv-pagination span.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-light);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.cmv-pagination a:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(26,110,216,0.06);
}

.cmv-pagination .current {
  background: var(--gradient-brand);
  border-color: transparent;
  color: white;
  box-shadow: var(--shadow-blue);
}

.cmv-pagination .dots {
  border: none;
  background: none;
  color: var(--color-text-muted);
}

/* =====================================================
   PAGE LINKS (multi-page posts)
   ===================================================== */

.page-links {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}

.page-links-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-right: var(--space-2);
}

.page-links a,
.page-links > span:not(.page-links-title) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-light);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.page-links > span:not(.page-links-title) {
  background: var(--gradient-brand);
  border-color: transparent;
  color: white;
}

.page-links a:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* =====================================================
   ACCESSIBILITY — FOCUS STYLES
   ===================================================== */

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* Skip link */
.visually-hidden:focus {
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  width: auto;
  height: auto;
  padding: var(--space-3) var(--space-6);
  clip: auto;
  white-space: normal;
  background: var(--gradient-brand);
  color: white;
  font-weight: 600;
  border-radius: var(--radius-md);
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}

/* =====================================================
   BREADCRUMBS
   ===================================================== */

.cmv-breadcrumbs {
  margin-bottom: var(--space-5);
}

.cmv-breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: var(--text-sm);
}

.cmv-breadcrumbs__item {
  display: flex;
  align-items: center;
  color: rgba(255,255,255,0.50);
}

/* Separator arrow between items */
.cmv-breadcrumbs__item:not(:last-child)::after {
  content: '›';
  margin: 0 var(--space-2);
  color: rgba(255,255,255,0.30);
  font-size: 1.1em;
  line-height: 1;
}

.cmv-breadcrumbs__link {
  color: rgba(255,255,255,0.60);
  text-decoration: none;
  transition: color var(--transition-fast);
  font-weight: 500;
}

.cmv-breadcrumbs__link:hover {
  color: var(--color-primary-xlight);
}

.cmv-breadcrumbs__current {
  color: rgba(255,255,255,0.85);
  font-weight: 500;
}

/* Breadcrumbs on light backgrounds (inner pages without dark header) */
.light-breadcrumbs .cmv-breadcrumbs__item        { color: var(--color-text-muted); }
.light-breadcrumbs .cmv-breadcrumbs__item::after { color: var(--color-mid-gray); }
.light-breadcrumbs .cmv-breadcrumbs__link        { color: var(--color-text-light); }
.light-breadcrumbs .cmv-breadcrumbs__link:hover  { color: var(--color-primary); }
.light-breadcrumbs .cmv-breadcrumbs__current     { color: var(--color-text); }

@media (max-width: 480px) {
  .cmv-breadcrumbs__list { font-size: var(--text-xs); }
  /* Hide all but last two items on very small screens */
  .cmv-breadcrumbs__item:not(:nth-last-child(-n+2)) {
    display: none;
  }
}
