/* ─── CSS Variables & Design Tokens ────────────────────────────────── */
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --text-color: #1e293b;
  --text-muted: #64748b;
  --heading-color: #0f172a;
  --bg-color: #ffffff;
  --surface-color: #f8fafc;
  --border-color: #e2e8f0;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.07), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 14px 30px -4px rgba(15, 23, 42, 0.14), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ─── Admin Toolbar (public site, logged in) ──────────────────────── */
#public-admin-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 42px;
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 9999;
  font-size: 13px;
  font-family: var(--font-sans);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.admin-bar-left { display: flex; align-items: center; gap: 10px; }
.admin-bar-center { display: flex; gap: 8px; }
.admin-bar-right { display: flex; align-items: center; gap: 10px; }
.admin-bar-mode {
  color: #94a3b8;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 999px;
}
.admin-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: #1e293b;
  color: #e2e8f0;
  text-decoration: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.15s ease;
}
.admin-bar-btn:hover {
  background: #334155;
  color: #fff;
  text-decoration: none;
}

/* ─── Admin Bar Layout Dropdown ───────────────────────────────────── */
.admin-bar-dd {
  position: relative;
}
.admin-bar-dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 300px;
  max-height: 80vh;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  z-index: 10000;
  padding: 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: #e2e8f0;
}
.abdd-section {
  border-bottom: 1px solid #334155;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.abdd-section:last-of-type {
  border-bottom: none;
}
.abdd-section h4 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}
.abdd-row {
  display: flex;
  gap: 4px;
  align-items: center;
}
.abdd-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #cbd5e1;
  margin-bottom: 4px;
}
.abdd-label input[type="text"],
.abdd-label select,
.abdd-row input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 5px;
  font-size: 12px;
  box-sizing: border-box;
}
.abdd-btn {
  padding: 4px 10px;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.abdd-btn:hover {
  background: #334155;
  color: #fff;
}
.abdd-btn.abdd-primary {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}
.abdd-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
#ab-layout-status,
#ab-settings-status {
  font-size: 11px;
  color: #94a3b8;
}

body.logged-in header {
  margin-top: 42px;
}

/* ─── Public Theme Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-color);
  background: var(--bg-color);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Base Polish ─────────────────────────────────────────────────── */
::selection { background: rgba(37, 99, 235, 0.18); }
html { scroll-behavior: smooth; }
:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4, h5, h6, section, article { scroll-margin-top: 90px; }

/* ─── Header ───────────────────────────────────────────────────────── */
header {
  border-bottom: 1px solid var(--border-color);
  padding: 18px 24px;
  background: #ffffff;
  position: relative;
  z-index: 50;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.header-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.header-block {
  padding: 4px 0;
}
.sidebar-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.sidebar-block {
  padding: 4px 0;
}
.sidebar-block.align-left { margin-right: auto; }
.sidebar-block.align-right { margin-left: auto; }
.sidebar-block.align-center { margin: 0 auto; text-align: center; }
.header-block.align-left { margin-right: auto; }
.header-block.align-right { margin-left: auto; }
.header-block.align-center { margin: 0 auto; text-align: center; }
.header-text { font-size: 15px; color: var(--text-muted); }
.header-text-sm { font-size: 13px; }
.header-text-lg { font-size: 20px; font-weight: 600; color: var(--heading-color); }
.site-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--heading-color);
  text-decoration: none;
  transition: color 0.15s ease;
}
.site-title:hover {
  color: var(--primary-color);
  text-decoration: none;
}
.site-logo img {
  display: block;
  height: auto;
}

/* ─── Navigation ───────────────────────────────────────────────────── */
.main-nav .nav-list,
.footer-nav .nav-list {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}
.main-nav .nav-item,
.footer-nav .nav-item {
  position: relative;
}
.main-nav a,
.footer-nav a {
  color: #475569;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  display: block;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.main-nav .nav-item,
.footer-nav .nav-item {
  white-space: nowrap;
}

/* ─── Hamburger toggle (hidden on desktop) ────────────────────────── */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
  color: var(--heading-color);
}
.nav-toggle:hover {
  background: var(--surface-color);
}
.main-nav a:hover {
  color: var(--primary-color);
  background: rgba(37, 99, 235, 0.06);
  text-decoration: none;
}
.footer-nav a:hover {
  color: var(--heading-color);
  text-decoration: none;
}

/* Submenu dropdown */
.main-nav .sub-menu,
.footer-nav .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 6px;
  z-index: 100;
}
.main-nav .nav-item:hover > .sub-menu,
.footer-nav .nav-item:hover > .sub-menu {
  display: block;
}
.main-nav .sub-menu .nav-item,
.footer-nav .sub-menu .nav-item {
  padding: 0;
}
.main-nav .sub-menu a,
.footer-nav .sub-menu a {
  padding: 8px 14px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.main-nav .sub-menu a:hover,
.footer-nav .sub-menu a:hover {
  background: var(--surface-color);
  color: var(--primary-color);
  text-decoration: none;
}
/* Nested sub-menus (flyout) */
.main-nav .sub-menu .sub-menu,
.footer-nav .sub-menu .sub-menu {
  top: 0;
  left: 100%;
}
/* Arrow indicator for items with children */
.main-nav .has-children > a::after,
.footer-nav .has-children > a::after {
  content: ' ▾';
  font-size: 11px;
  opacity: 0.7;
}
.main-nav .sub-menu .has-children > a::after,
.footer-nav .sub-menu .has-children > a::after {
  content: ' ▸';
}
.header-extras {
  max-width: 1100px;
  margin: 10px auto 0;
  font-size: 14px;
  color: var(--text-muted);
}
.sidebar-extras { margin-top: 12px; }

/* ─── Content Wrapper ──────────────────────────────────────────────── */
.content-wrapper {
  max-width: 1100px;
  margin: 44px auto;
  padding: 0 24px;
  min-height: 320px;
  display: flex;
  gap: 36px;
}
.content-wrapper.full-width {
  display: block;
}
.content-wrapper.sidebar-left {
  display: flex;
  flex-direction: row;
}
.content-wrapper.sidebar-right {
  display: flex;
  flex-direction: row;
}

.content-main {
  flex: 1;
  min-width: 0;
}
.content-full {
  max-width: 800px;
  margin: 0 auto;
}

/* ─── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  padding: 24px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  color: var(--text-color);
  align-self: flex-start;
}
.sidebar h3 {
  margin-top: 0;
  font-size: 16px;
  color: var(--heading-color);
}

/* ─── Typography ───────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  color: var(--heading-color);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-top: 0;
}
h1 { font-size: 2.25rem; font-weight: 800; margin-bottom: 20px; text-wrap: balance; }
h2 { font-size: 1.65rem; font-weight: 700; margin-top: 28px; margin-bottom: 14px; text-wrap: balance; }
h3 { font-size: 1.3rem; font-weight: 600; margin-top: 22px; margin-bottom: 10px; text-wrap: balance; }
a { color: var(--primary-color); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 32px 0;
}
blockquote {
  margin: 24px 0;
  padding: 16px 24px;
  border-left: 4px solid var(--primary-color);
  background: var(--surface-color);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: #334155;
  font-style: italic;
}

/* ─── Page List & Blog Cards ───────────────────────────────────────── */
.page-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.page-listing {
  padding: 24px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.page-listing:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #dbe4f0;
}
.page-listing h2 {
  margin: 0 0 10px;
  font-size: 1.4rem;
}
.page-listing h2 a {
  color: var(--heading-color);
}
.page-listing h2 a:hover {
  color: var(--primary-color);
  text-decoration: none;
}
.listing-image { margin-bottom: 16px; }
.listing-with-sidebar { display: flex; gap: 24px; align-items: flex-start; }
.listing-image-side { width: 220px; flex-shrink: 0; }
.listing-text { flex: 1; }
.featured-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  display: block;
}
.featured-image-full {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.page-featured-image { margin-bottom: 24px; text-align: center; }
.excerpt { color: #475569; font-size: 15px; margin: 0 0 12px; }
.meta { color: var(--text-muted); font-size: 13px; margin: 0; }

/* ─── Page Content ─────────────────────────────────────────────────── */
.content-body { line-height: 1.8; }
.content-body p { margin-top: 0; margin-bottom: 18px; }
.content-body img { border-radius: var(--radius-sm); max-width: 100%; height: auto; }
.content-body table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.content-body th, .content-body td { border: 1px solid var(--border-color); padding: 8px 12px; text-align: left; }
.content-body th { background: var(--surface-color); font-weight: 600; }
.content-body code { background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 4px; padding: 1px 6px; font-size: 0.875em; }
.content-body pre { background: #0f172a; color: #e2e8f0; border-radius: var(--radius-md); padding: 16px 20px; overflow-x: auto; }
.content-body pre code { background: transparent; border: none; color: inherit; }
.page-excerpt {
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 32px;
  padding: 8px 16px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-color);
  font-size: 14px;
  font-weight: 500;
}
.back-link:hover {
  background: #f1f5f9;
  color: var(--primary-color);
  text-decoration: none;
}

/* ─── Category Grid ───────────────────────────────────────────────── */
.category-grid {
  display: grid;
  gap: 24px;
  margin-bottom: 32px;
}
.category-grid.grid-2 { grid-template-columns: repeat(2, 1fr); }
.category-grid.grid-3 { grid-template-columns: repeat(3, 1fr); }
.category-grid.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.grid-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #dbe4f0;
}
.grid-item h3 {
  margin: 12px 0 8px;
  font-size: 1.15rem;
}
.grid-item h3 a { color: var(--heading-color); }
.grid-item h3 a:hover { color: var(--primary-color); text-decoration: none; }
.grid-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  display: block;
}
.grid-excerpt { font-size: 14px; color: var(--text-muted); margin: 0; }
.category-description { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 24px; }

/* ─── Column Grid System & Blocks ─────────────────────────────────── */
/* A .cms-grid is a single block containing one or more stacked .row
   flex rows (rows × columns chosen in the editor). */
.cms-grid {
  margin-bottom: 24px;
}
.cms-grid .row {
  margin-bottom: 20px;
}
.cms-grid .row:last-child {
  margin-bottom: 0;
}
/* Header/footer grid cells spread evenly across the row, exactly like
   page columns — content aligns INSIDE each cell. Cells with an
   explicit width keep it (inline style flex:0 0 <width> wins). */
.cms-grid .header-row,
.cms-grid .footer-row,
.cms-grid .sidebar-row {
  margin-bottom: 12px;
}
.cms-grid .header-row:last-child,
.cms-grid .footer-row:last-child,
.cms-grid .sidebar-row:last-child {
  margin-bottom: 0;
}
.cms-grid .sidebar-block {
  width: 100%;
  flex: 1;
  min-width: 0;
  margin: 0;
  display: flex;
  align-items: center;
}
.cms-grid .header-block,
.cms-grid .footer-block {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: flex;
  align-items: center;
}
.cms-grid .header-block.align-left,
.cms-grid .footer-block.align-left,
.cms-grid .sidebar-block.align-left { margin: 0; justify-content: flex-start; text-align: left; }
.cms-grid .header-block.align-center,
.cms-grid .footer-block.align-center,
.cms-grid .sidebar-block.align-center { margin: 0; justify-content: center; text-align: center; }
.cms-grid .header-block.align-right,
.cms-grid .footer-block.align-right,
.cms-grid .sidebar-block.align-right { margin: 0; justify-content: flex-end; text-align: right; }
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 0 0 24px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, border-radius 0.2s ease;
}
.row .col {
  flex: 1;
  min-width: 0;
  padding: 12px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, border-radius 0.2s ease;
}
/* 12-column flex sizing accounting for gap */
.row .col-1  { flex: 1 1 calc(8.333% - 20px);  max-width: 100%; }
.row .col-2  { flex: 1 1 calc(16.666% - 20px); max-width: 100%; }
.row .col-3  { flex: 1 1 calc(25% - 20px);     max-width: 100%; }
.row .col-4  { flex: 1 1 calc(33.333% - 20px); max-width: 100%; }
.row .col-5  { flex: 1 1 calc(41.666% - 20px); max-width: 100%; }
.row .col-6  { flex: 1 1 calc(50% - 20px);     max-width: 100%; }
.row .col-7  { flex: 1 1 calc(58.333% - 20px); max-width: 100%; }
.row .col-8  { flex: 1 1 calc(66.666% - 20px); max-width: 100%; }
.row .col-9  { flex: 1 1 calc(75% - 20px);     max-width: 100%; }
.row .col-10 { flex: 1 1 calc(83.333% - 20px); max-width: 100%; }
.row .col-11 { flex: 1 1 calc(91.666% - 20px); max-width: 100%; }
.row .col-12 { flex: 0 0 100%;                 max-width: 100%; }

/* ─── Full-Bleed & Width Span Utilities ───────────────────────────── */
/* 1. Full-Bleed Background, Contained Content:
      Stretches background 100vw across the screen while inner content
      remains aligned with the parent content column. */
.row.full-bleed,
.cms-block.full-bleed,
.full-bleed,
[data-block-span="full-bleed"] {
  width: 100vw;
  position: relative;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: max(24px, calc(50vw - 50%)) !important;
  padding-right: max(24px, calc(50vw - 50%)) !important;
  box-sizing: border-box;
}

/* 2. Wide Bleed:
      Expands wider than the text column up to 1100px container width. */
.row.full-bleed-wide,
.cms-block.full-bleed-wide,
.full-bleed-wide,
[data-block-span="wide"] {
  width: min(1100px, calc(100vw - 48px));
  position: relative;
  margin-left: calc(50% - min(550px, calc(50vw - 24px)));
  margin-right: calc(50% - min(550px, calc(50vw - 24px)));
  box-sizing: border-box;
}

/* 3. Full Screen (Background + Content both edge-to-edge): */
.row.full-screen,
.cms-block.full-screen,
.full-screen,
[data-block-span="full-screen"] {
  width: 100vw;
  position: relative;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: 40px !important;
  padding-right: 40px !important;
  box-sizing: border-box;
}

/* ─── Block Appearance Preset Utilities ───────────────────────────── */
/* Rounded Corners */
.block-radius-none { border-radius: 0 !important; }
.block-radius-sm   { border-radius: var(--radius-sm) !important; }
.block-radius-md   { border-radius: var(--radius-md) !important; }
.block-radius-lg   { border-radius: var(--radius-lg) !important; }
.block-radius-xl   { border-radius: var(--radius-xl) !important; }
.block-radius-pill { border-radius: 9999px !important; }

/* Padding / Spacing */
.block-pad-none { padding: 0; }
.block-pad-sm   { padding: 14px 18px; }
.block-pad-md   { padding: 28px 28px; }
.block-pad-lg   { padding: 48px 36px; }
.block-pad-xl   { padding: 72px 48px; }

/*Shadows / Elevation */
.block-shadow-none { box-shadow: none !important; }
.block-shadow-sm   { box-shadow: var(--shadow-sm) !important; }
.block-shadow-md   { box-shadow: var(--shadow-md) !important; }
.block-shadow-lg   { box-shadow: var(--shadow-lg) !important; }

/* Borders */
.block-border-none        { border: none !important; }
.block-border-subtle      { border: 1px solid var(--border-color) !important; }
.block-border-strong      { border: 2px solid #cbd5e1 !important; }
.block-border-accent      { border: 2px solid var(--primary-color) !important; }
.block-border-left-accent { border-left: 4px solid var(--primary-color) !important; }

/* Vertical Alignment for Rows */
.row.align-top     { align-items: flex-start; }
.row.align-middle  { align-items: center; }
.row.align-bottom  { align-items: flex-end; }
.row.align-stretch { align-items: stretch; }

/* ─── Starter Visual Blocks (Hero, Callout, Buttons) ──────────────── */
.cms-block {
  margin-bottom: 24px;
  transition: all 0.2s ease;
}
.cms-hero {
  padding: 72px 32px;
  text-align: center;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(255,255,255,0.14) 0%, transparent 55%),
    linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
}
.cms-hero h1,
.cms-hero h2,
.cms-hero h3 {
  color: inherit;
  margin-top: 0;
  margin-bottom: 14px;
}
.cms-hero p {
  font-size: 1.15rem;
  opacity: 0.92;
  max-width: 640px;
  margin: 0 auto 24px;
}
.cms-callout {
  padding: 24px 28px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}
.cms-callout.info    { background: #eef6ff; border-color: #bfdbfe; }
.cms-callout.success { background: #ecfdf5; border-color: #a7f3d0; }
.cms-callout.warning { background: #fffbeb; border-color: #fde68a; }
.cms-callout.danger  { background: #fef2f2; border-color: #fecaca; }
.cms-callout h3,
.cms-callout h4 {
  margin-top: 0;
  margin-bottom: 8px;
}
.cms-links {
  padding: 20px 24px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}
.cms-links h4 { margin-top: 0; margin-bottom: 8px; }
.cms-links ul { list-style: none; margin: 0; padding: 0; }
.cms-links li { margin-bottom: 6px; }
.cms-links a { color: var(--primary-color); text-decoration: none; }
.cms-links a:hover { text-decoration: underline; }
.cms-about {
  padding: 20px 24px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}
.cms-about h4 { margin-top: 0; margin-bottom: 8px; }
.cms-btn {
  display: inline-block;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none !important;
  background: var(--primary-color);
  color: #ffffff !important;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, filter 0.15s ease;
}
.cms-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  filter: brightness(1.05);
}
.cms-btn:active {
  transform: translateY(0);
}
.cms-btn.btn-light {
  background: #ffffff;
  color: #0f172a !important;
}
.cms-btn.btn-outline {
  background: transparent;
  border-color: currentColor;
  color: inherit !important;
}
.cms-btn.btn-pill {
  border-radius: 9999px;
}

/* ─── Footer ───────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border-color);
  padding: 32px 24px;
  font-size: 14px;
  color: var(--text-muted);
  background: var(--surface-color);
  margin-top: 64px;
}
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.footer-block {
  padding: 4px 0;
}
.footer-block.align-left { margin-right: auto; }
.footer-block.align-right { margin-left: auto; }
.footer-block.align-center { margin: 0 auto; text-align: center; }
.footer-nav .nav-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-nav a { color: var(--text-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--heading-color); text-decoration: none; }
.footer-nav .sub-menu a { color: var(--text-color); }
.footer-nav .sub-menu a:hover { color: var(--primary-color); }
.footer-extras { margin-bottom: 12px; }
.footer-credit { text-align: center; margin-top: 16px; font-size: 13px; color: #94a3b8; }
footer a { color: var(--text-muted); }
footer a:hover { color: var(--heading-color); }

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Main nav collapses into a hamburger dropdown */
  .main-nav {
    position: relative;
  }
  .main-nav .nav-toggle {
    display: block;
  }
  .main-nav .nav-list {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    z-index: 300;
  }
  .main-nav.nav-open .nav-list {
    display: flex;
  }
  .main-nav .nav-item,
  .main-nav .nav-list a {
    width: 100%;
  }
  .main-nav .nav-list a {
    padding: 10px 14px;
  }
  /* Submenus become static indented groups on mobile (no flyouts) */
  .main-nav .sub-menu {
    position: static;
    display: block;
    border: none;
    box-shadow: none;
    padding: 0 0 0 16px;
    min-width: 0;
  }
  .main-nav .has-children > a::after {
    content: '';
  }
  .content-wrapper,
  .content-wrapper.sidebar-left,
  .content-wrapper.sidebar-right {
    flex-direction: column;
    margin: 24px auto;
    padding: 0 16px;
  }
  .sidebar {
    width: 100% !important;
  }
  .row .col,
  .row [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }
  .category-grid.grid-2,
  .category-grid.grid-3,
  .category-grid.grid-4 {
    grid-template-columns: 1fr;
  }
  .listing-with-sidebar {
    flex-direction: column;
  }
  .listing-image-side {
    width: 100%;
  }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.4rem; }
}

/* ─── Reduced Motion ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ═══ Shop & Cart ══════════════════════════════════════════════════ */

/* Cart icon in header */
.header-cart { display: flex; align-items: center; margin-left: auto; }
.cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  padding: 6px 10px;
  text-decoration: none;
}
.cart-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary-color, #2563eb);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Shop header */
.shop-header { text-align: center; margin-bottom: 2rem; }
.shop-header h1 { margin-bottom: 0.25rem; }
.shop-header p { color: var(--text-muted); }

/* Product grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}
.product-card {
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  background: var(--bg-color, #fff);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.product-image-link { display: block; aspect-ratio: 1; overflow: hidden; background: var(--surface-color); }
.product-image { width: 100%; height: 100%; object-fit: cover; }
.product-info { padding: 1rem; display: flex; flex-direction: column; flex: 1; }
.product-info h3 { font-size: 1rem; margin: 0 0 0.5rem; }
.product-info h3 a { color: inherit; text-decoration: none; }
.product-info h3 a:hover { color: var(--primary-color); }
.product-price { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.product-excerpt { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.75rem; flex: 1; }
.price-current { color: var(--primary-color, #2563eb); }
.price-compare { color: var(--text-muted); text-decoration: line-through; font-weight: 400; font-size: 0.9rem; margin-left: 0.4rem; }
.add-to-cart-form { display: flex; gap: 0.5rem; align-items: center; margin-top: auto; }
.add-to-cart-form .qty-input { width: 60px; }
.qty-input {
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  width: 60px;
}

/* Product detail */
.product-detail-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}
.product-detail-image img { width: 100%; border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.product-detail-info h1 { margin-bottom: 0.75rem; }
.product-price-lg { font-size: 1.6rem; font-weight: 800; margin-bottom: 1rem; }
.product-description { color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.65; }
.qty-selector { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1.05rem; }
.out-of-stock { color: #dc2626; font-weight: 600; }
.back-link { display: inline-block; margin-top: 1.25rem; color: var(--text-muted); text-decoration: none; }
.back-link:hover { color: var(--primary-color); }

/* Cart page */
.cart-table-wrapper { overflow-x: auto; }
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td { padding: 0.85rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.cart-table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.cart-product-cell { display: flex; align-items: center; gap: 0.85rem; }
.cart-product-cell a { color: inherit; text-decoration: none; font-weight: 500; }
.cart-product-cell a:hover { color: var(--primary-color); }
.cart-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: var(--radius-sm); }
.cart-price, .cart-subtotal { font-weight: 600; }
.qty-form { margin: 0; }
.cart-remove .btn-remove {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}
.cart-remove .btn-remove:hover { color: #dc2626; }
.cart-summary { margin-top: 1.5rem; max-width: 420px; margin-left: auto; }
.cart-total-row { display: flex; justify-content: space-between; padding: 0.5rem 0; font-weight: 600; border-bottom: 1px solid var(--border-color); }
.cart-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; flex-wrap: wrap; }
.empty-cart { text-align: center; padding: 3rem 1rem; }

/* Checkout */
.checkout-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; align-items: start; }
.checkout-form h2 { font-size: 1.15rem; margin: 1.75rem 0 1rem; }
.checkout-form .form-row { display: flex; gap: 1rem; }
.checkout-form .form-row .form-field { flex: 1; }
.form-field label { display: block; font-weight: 500; font-size: 0.88rem; margin-bottom: 0.35rem; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  box-sizing: border-box;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.payment-options { display: flex; flex-direction: column; gap: 0.6rem; margin: 0.75rem 0; }
.payment-option {
  display: flex; align-items: center; gap: 0.6rem;
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.payment-option:hover { border-color: var(--primary-color); }
.checkout-summary {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  background: var(--surface-color);
  position: sticky;
  top: 1rem;
}
.checkout-items { margin: 0.75rem 0; }
.checkout-item { display: flex; justify-content: space-between; padding: 0.4rem 0; font-size: 0.92rem; }
.checkout-totals { border-top: 1px solid var(--border-color); padding-top: 0.75rem; margin-top: 0.75rem; }
.checkout-total-row { display: flex; justify-content: space-between; padding: 0.35rem 0; font-size: 0.92rem; }
.checkout-grand-total { font-weight: 800; font-size: 1.1rem; border-top: 1px solid var(--border-color); margin-top: 0.5rem; padding-top: 0.75rem; }

/* Order confirmation */
.confirmation-header { text-align: center; padding: 2rem 0; }
.confirmation-header h1 { color: #16a34a; }
.confirmation-number { font-size: 1.15rem; font-weight: 600; margin: 0.4rem 0; }
.confirmation-paid { color: #16a34a; font-weight: 500; }
.confirmation-pending { color: #d97706; font-weight: 500; }
.confirmation-details { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; max-width: 900px; margin: 0 auto; }
.confirmation-section { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.25rem; }
.confirmation-section h2 { font-size: 1.05rem; margin: 0 0 0.85rem; }
.order-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.order-table th, .order-table td { padding: 0.5rem 0.4rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.order-total-row { display: flex; justify-content: space-between; padding: 0.3rem 0; }
.order-grand-total { font-weight: 800; border-top: 1px solid var(--border-color); margin-top: 0.5rem; padding-top: 0.6rem; }
.confirmation-actions { text-align: center; margin: 2.5rem 0 1rem; }

/* Responsive shop */
@media (max-width: 768px) {
  .product-detail-inner, .checkout-layout, .confirmation-details { grid-template-columns: 1fr; }
  .checkout-form .form-row { flex-direction: column; gap: 0.5rem; }
  .cart-table th { display: none; }
  .cart-table td { display: block; text-align: right; border-bottom: none; padding: 0.4rem 0.75rem; }
  .cart-table td::before { content: attr(data-label); float: left; font-weight: 600; color: var(--text-muted); }
  .cart-product-cell { display: flex; justify-content: flex-end; text-align: right; }
}

/* ─── Product page (block-based) ─────────────────────────────────── */
.product-page .product-title { margin: 0 0 1.25rem; }
.product-image-gallery img { max-width: 100%; height: auto; display: block; border-radius: var(--radius-md, 8px); }
.product-image-empty { display: flex; align-items: center; justify-content: center; min-height: 260px; background: #f1f5f9; border: 1px dashed #cbd5e1; border-radius: 8px; }
.product-image-placeholder { text-align: center; color: #94a3b8; font-size: 2rem; }
.product-image-placeholder span { display: block; font-size: 0.85rem; margin-top: 0.5rem; }

.buybox { display: flex; flex-direction: column; gap: 1rem; }
.buybox-price { font-size: 1.75rem; font-weight: 800; color: var(--text-color, #1e293b); }
.buybox-price .price-compare { font-size: 1.1rem; font-weight: 500; color: var(--text-muted, #64748b); text-decoration: line-through; margin-left: 0.4rem; }
.buybox-options { display: flex; flex-direction: column; gap: 0.75rem; }
.buybox-option label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.3rem; color: var(--text-muted, #64748b); }
.buybox-option select { width: 100%; max-width: 320px; padding: 0.55rem 0.65rem; border: 1px solid var(--border-color, #e2e8f0); border-radius: 6px; font-size: 0.95rem; background: #fff; }
.buybox-stock { font-size: 0.9rem; font-weight: 600; }
.buybox-stock.in-stock { color: #16a34a; }
.buybox-stock.out-of-stock { color: #dc2626; }
.buybox-actions { display: flex; gap: 0.75rem; align-items: center; }
.buybox-actions .qty-input { width: 76px; padding: 0.55rem; border: 1px solid var(--border-color, #e2e8f0); border-radius: 6px; font-size: 0.95rem; }
.buybox-actions button:disabled { opacity: 0.55; cursor: not-allowed; }

.cart-variant, .checkout-variant { font-size: 0.82rem; color: var(--text-muted, #64748b); }
.cart-variant { margin-top: 0.2rem; }

@media (max-width: 768px) {
  .buybox-option select { max-width: 100%; }
}
