/*
 * Coding180 Design System — Components
 * -------------------------------------
 * Reusable class-based components consumed by the PHP partials in
 * includes/components/*.php. Every visual pattern used more than once
 * lives here instead of as inline styles, so a design change is a
 * one-file edit, not a find-and-replace across pages.
 *
 * Depends on design-tokens.css being loaded first.
 */

/* ============ Base / reset ============ */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { font: inherit; cursor: pointer; border: none; background: none; }
img, svg { display: block; }

/* Lucide icons (icon() helper) render as <i data-lucide> before assets/site.js
   hydrates them into inline SVGs. Without this, an icon sitting next to text
   (badges, chips, byline rows) sits on the text baseline instead of centering
   with it — misaligned icon+label pairs, most visible in tightly packed rows. */
[data-lucide] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
}

.font-display { font-family: var(--font-display); }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.rise-in { animation: riseIn var(--duration-base) var(--ease-standard) both; }

.scrollbar-none { scrollbar-width: none; }
.scrollbar-none::-webkit-scrollbar { display: none; }

/* ============ Tone system ============
 * Every component that takes a $tone prop (primary|coral|teal|amber)
 * gets its background/foreground from these four pairs. */

.tone-primary-bg { background: var(--c-primary-soft); color: var(--c-primary); }
.tone-primary-fg { color: var(--c-primary); }
.tone-coral-bg   { background: var(--c-coral-soft); color: var(--c-coral); }
.tone-coral-fg   { color: var(--c-coral); }
.tone-teal-bg    { background: var(--c-teal-soft); color: var(--c-teal); }
.tone-teal-fg    { color: var(--c-teal); }
.tone-amber-bg   { background: var(--c-amber-soft); color: var(--c-amber); }
.tone-amber-fg   { color: var(--c-amber); }

/* ============ Layout shell ============ */

.shell {
  max-width: var(--shell-max);
  margin-inline: auto;
}

.shell--narrow { max-width: var(--shell-max-narrow); }

.content-shell {
  /* offset for the fixed desktop sidebar; collapses on mobile + tablet.
     Kept in lockstep with the .sidebar breakpoint below — below 1024px
     the sidebar is hidden and tablets get the same compact top-bar +
     bottom tab-bar chrome as phones. */
}

@media (min-width: 1024px) {
  .content-shell { margin-left: var(--sidebar-width); }
}

/* ============ App bar (top nav) ============ */

.app-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 246, 239, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--c-border);
}

.app-bar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem var(--space-5);
}

.app-bar__actions {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

@media (min-width: 768px) {
  .app-bar__row { padding: 0.875rem var(--space-8); }
}

/* The sidebar (see .sidebar / .content-shell) is the sole primary nav at
   desktop widths — the app bar never shows its own nav links, so there's
   no duplicate menu. Below 1024px the sidebar is hidden and the app bar's
   hamburger + bottom tab bar take over instead.
   .app-bar__actions keeps flex: 1 1 auto (set above) at every width so it
   fills the row and its own justify-content: flex-end pins its contents to
   the right — it's the only visible child of .app-bar__row once .brand
   hides at lg:, and a shrink-to-content box would land at the *start* of
   a space-between row with no sibling to push against. */

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  color: var(--c-ink);
}

/* Bell-menu notifications (Phase 11, PORTING-PLAN.md) — badge reuses
   .sidebar-link__badge's visual language, positioned over the icon-btn. */
.notif-bell { position: relative; }
.notif-bell__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--c-coral);
  color: #fff;
  font-size: 0.65rem;
  font-weight: var(--weight-bold);
  line-height: 1;
  border: 2px solid var(--c-bg);
}
.notif-bell-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 2rem);
  max-height: 420px;
  overflow-y: auto;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
}
.notif-bell-dropdown.is-open { display: block; }
/* Mobile: fixed + centred under the app bar (bar is ~4.25rem tall and always at the top, so a fixed
   offset is correct whether or not its backdrop-filter acts as the containing block). */
@media (max-width: 639px) {
  .notif-bell-dropdown {
    position: fixed;
    top: 4.75rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: 22rem;
    margin-inline: auto;
    max-height: calc(100vh - 6rem);
  }
}
.notif-bell-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3);
  border-bottom: 1px solid var(--c-border);
}
.notif-bell-dropdown__item {
  display: block;
  padding: var(--space-3);
  border-bottom: 1px solid var(--c-border);
  color: var(--c-ink);
}
.notif-bell-dropdown__item:last-child { border-bottom: none; }
.notif-bell-dropdown__item.is-unread { background: var(--c-primary-soft); }
.notif-bell-dropdown__enable {
  display: flex; align-items: center; gap: 0.4rem; width: 100%;
  padding: var(--space-3) var(--space-4); border: none; border-bottom: 1px solid var(--c-border);
  background: var(--c-bg-alt); color: var(--c-primary); cursor: pointer; text-align: left;
}
.notif-bell-dropdown__empty { padding: var(--space-4); text-align: center; color: var(--c-ink-faint); font-size: var(--text-sm); }

.mobile-menu {
  display: none;
  border-top: 1px solid var(--c-border);
  padding: var(--space-3) var(--space-5) var(--space-5);
  background: var(--c-bg);
}

.mobile-menu.is-open { display: block; }

.mobile-menu__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: var(--radius-sm);
  padding: 0.625rem var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--c-ink-soft);
}

.mobile-menu__link.active { color: var(--c-primary); }

/* ============ Buttons ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  border-radius: var(--radius-full);
  padding: 0.625rem var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  transition: transform var(--duration-fast) var(--ease-standard);
}

.btn:hover { transform: translateY(-2px); }

.btn--dark { background: var(--c-ink); color: #fff; }
.btn--light { background: #fff; color: var(--c-primary); }
.btn--outline { background: transparent; color: var(--c-ink); box-shadow: inset 0 0 0 1.5px var(--c-border); }
.btn--outline:hover { box-shadow: inset 0 0 0 1.5px var(--c-ink); }
.btn--ghost { background: transparent; color: var(--c-ink-soft); }
.btn--ghost:hover { background: var(--c-bg-alt); transform: none; }
.btn--block { width: 100%; justify-content: center; padding: 0.75rem var(--space-4); }
.btn--sm { padding: 0.5rem var(--space-3); font-size: var(--text-xs); }
.btn--lg { padding: 0.875rem var(--space-6); font-size: var(--text-base); }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============ Post meta row (blog/post.php hero) ============ */
/* Author / date / read-time: must stay on one row even on narrow phones —
   shrinks text/gaps/icon size to fit rather than scrolling or wrapping. */

.post-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--space-3);
  font-size: var(--text-xs);
}

.post-meta-row i[data-lucide] { width: 12px !important; height: 12px !important; }
.post-meta-row .avatar { width: 18px !important; height: 18px !important; font-size: 8px !important; }

@media (min-width: 768px) {
  .post-meta-row {
    gap: var(--space-5);
    font-size: var(--text-sm);
  }

  .post-meta-row i[data-lucide] { width: 14px !important; height: 14px !important; }
  .post-meta-row .avatar { width: 22px !important; height: 22px !important; font-size: 9.5px !important; }
}

/* ============ Share buttons (blog/post.php hero) ============ */

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background: var(--c-bg-alt);
  color: var(--c-ink-soft);
  box-shadow: inset 0 0 0 1px var(--c-border);
  transition: transform var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}

.share-btn:hover { color: var(--c-primary); transform: translateY(-2px); }

.share-btn.is-copied { color: var(--c-primary); box-shadow: inset 0 0 0 1.5px var(--c-primary); }
.share-btn.is-copy-failed { color: #dc2626; box-shadow: inset 0 0 0 1.5px #dc2626; }

/* ============ Forms ============
 * One shared visual language for every input type. All fields share
 * `.field-control` for the box (border/radius/padding/focus ring);
 * type-specific classes add only what differs (textarea resize, select
 * caret, checkbox/radio sizing). Every field must be wrapped in
 * `.field` and paired with a `.field-label` — see includes/components/form-field.php. */

.field { display: flex; flex-direction: column; gap: 0.375rem; }

.field-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--c-ink);
}

.field-label__optional {
  font-weight: var(--weight-medium);
  color: var(--c-ink-faint);
}

.field-hint {
  font-size: var(--text-xs);
  color: var(--c-ink-faint);
}

.field-error {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--c-coral);
}

.field-control {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--c-border);
  background: var(--c-card);
  padding: 0.625rem var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--c-ink);
  transition: border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}

.field-control::placeholder { color: var(--c-ink-faint); }

.field-control:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}

.field-control:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--c-bg-alt);
}

.field--invalid .field-control {
  border-color: var(--c-coral);
}

.field--invalid .field-control:focus {
  box-shadow: 0 0 0 3px var(--c-coral-soft);
}

.field-textarea { resize: vertical; min-height: 7rem; line-height: 1.5; }

.field-select {
  appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235B5468' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
}

.field-choice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--c-ink);
  cursor: pointer;
}

.field-choice input[type="checkbox"],
.field-choice input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--c-primary);
  cursor: pointer;
}

/* ============ Custom select ============
 * Replaces the browser-native <select> everywhere a styled dropdown menu
 * is needed — a native <select>'s OPEN menu can't be styled with CSS at
 * all (it renders as the OS's own dark system menu), which breaks the
 * design system the moment a viewer opens it. Progressive enhancement:
 * a real <select> still sits in the DOM (visually hidden, not display:none,
 * so it keeps posting in a <form> with no JS and stays screen-reader
 * accessible); assets/site.js drives an ARIA listbox on top of it and
 * keeps both in sync. See includes/components/select-field.php. */

.select { position: relative; }

.select__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  /* Never the click target — assets/site.js drives .select__trigger/.select__menu
     and only programmatically syncs this element's .value. Without this, a stray
     click/tap can still hit the 1px native control and pop the browser's own
     unstyled OS picker on top of our menu (the exact bug this component exists
     to prevent — see the section comment above). */
  pointer-events: none;
}

.select__trigger {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
}

.select__trigger[data-toolbar] {
  width: auto;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  border: 1px solid var(--c-border);
  background: var(--c-bg-alt);
  padding: 0.5rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: var(--weight-semibold);
  color: var(--c-ink);
  white-space: nowrap;
}

.select__trigger-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--c-ink-faint);
  transition: transform var(--duration-fast) var(--ease-standard);
}

.select.is-open .select__trigger-icon { transform: rotate(180deg); }
.select.is-open .field-control,
.select.is-open .select__trigger[data-toolbar] {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}

.select__menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.375rem);
  left: 0;
  margin: 0;
  min-width: 100%;
  max-height: 16rem;
  overflow-y: auto;
  list-style: none;
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border);
  background: var(--c-card);
  box-shadow: var(--shadow-lg);
  padding: 0.375rem;
  display: none;
  flex-direction: column;
  gap: 0.125rem;
}

.select.is-open .select__menu { display: flex; }

.select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.3;
  color: var(--c-ink);
  white-space: nowrap;
  cursor: pointer;
}

.select__option:hover,
.select__option.is-active { background: var(--c-bg-alt); }

.select__option.is-selected { font-weight: var(--weight-bold); color: var(--c-primary); }

.select__option-check { flex-shrink: 0; color: var(--c-primary); visibility: hidden; }
.select__option.is-selected .select__option-check { visibility: visible; }

/* ============ Brand lockup ============ */

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.brand__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--c-primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  box-shadow: var(--shadow-sm);
}

.brand__name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
}

/* ============ Sidebar (desktop) ============ */

.sidebar {
  position: fixed;
  inset-block: 0;
  left: 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: none;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  padding: var(--space-6) var(--space-5);
  background: var(--c-card);
  border-right: 1px solid var(--c-border);
}

@media (min-width: 1024px) {
  .sidebar { display: flex; }
}

.sidebar__nav {
  margin-top: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-radius: var(--radius-sm);
  padding: 0.625rem var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--c-ink-soft);
  transition: background-color var(--duration-fast) ease, color var(--duration-fast) ease;
}

.sidebar-link.active { background: var(--c-primary-soft); color: var(--c-primary); }
.sidebar-link[data-tone="coral"].active { background: var(--c-coral-soft); color: var(--c-coral); }
.sidebar-link[data-tone="teal"].active { background: var(--c-teal-soft); color: var(--c-teal); }
.sidebar-link[data-tone="amber"].active { background: var(--c-amber-soft); color: var(--c-amber); }

.sidebar-link__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--c-coral);
  color: #fff;
  font-size: 0.65rem;
  font-weight: var(--weight-bold);
  line-height: 1;
  margin-left: auto;
}

.sidebar__footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.founder-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--c-bg-alt);
}

.founder-card__avatar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  background: var(--c-primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: var(--weight-bold);
}

.founder-card__name { font-size: var(--text-xs); font-weight: var(--weight-bold); }
.founder-card__role { font-size: 0.68rem; color: var(--c-ink-faint); }

/* ============ Bottom tab bar (mobile) ============ */

.tab-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding: 0.375rem 0.5rem calc(env(safe-area-inset-bottom) + 0.25rem);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--c-border);
}

@media (min-width: 1024px) {
  .tab-bar { display: none; }
}

/* The bar is position:fixed, so reserve its height at the end of every page that renders it —
   otherwise the last section (and the footer/ad slot) sits underneath it on mobile. */
@media (max-width: 1023.98px) {
  body:has(.tab-bar) { padding-bottom: calc(3.25rem + env(safe-area-inset-bottom)); }
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) 0;
  color: var(--c-ink-faint);
}

.tab-item__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 2rem;
  border-radius: var(--radius-full);
  transition: background-color var(--duration-fast) ease, color var(--duration-fast) ease;
}

.tab-item.active .tab-item__icon { background: var(--c-primary-soft); color: var(--c-primary); }
.tab-item.active .tab-item__label { color: var(--c-primary); }

.tab-item__label { font-size: 0.62rem; font-weight: var(--weight-bold); }

/* ============ Section header ============ */

.section-header {
  margin-bottom: var(--space-5);
}

@media (min-width: 768px) {
  .section-header { margin-bottom: var(--space-6); }
}

.section-header__eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-header__row {
  margin-top: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.section-header__title {
  min-width: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
  font-family: var(--font-display);
}

/* Mobile: keep the title on one line and ellipsise it so the CTA never pushes it onto a second line. */
@media (max-width: 767.98px) {
  .section-header__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (min-width: 640px) { .section-header__title { font-size: var(--text-xl); } }
@media (min-width: 768px) { .section-header__title { font-size: var(--text-2xl); } }

.section-header__cta {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

/* ============ Card (generic surface) ============ */

.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
}

.card--lift { transition: transform var(--duration-fast) ease; }
.card--lift:hover { transform: translateY(-4px); }

/* ============ Icon tile (rounded square/circle icon holder) ============ */

.icon-tile {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.icon-tile--sm { width: 2.25rem; height: 2.25rem; border-radius: var(--radius-sm); }
.icon-tile--md { width: 2.75rem; height: 2.75rem; }
.icon-tile--lg { width: 3.5rem; height: 3.5rem; }

/* ============ Avatar ============ */

.avatar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
}

/* ============ Badge / chip ============ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: var(--radius-full);
  padding: 0.25rem 0.625rem;
  font-size: 0.68rem;
  font-weight: var(--weight-extrabold);
}

.badge--eyebrow {
  padding: 0.375rem 0.75rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: var(--radius-full);
  padding: 0.125rem 0.5rem;
  font-size: 0.65rem;
  font-weight: var(--weight-semibold);
  background: var(--c-bg-alt);
  color: var(--c-ink-soft);
}

/* ============ Pillar card (guide teaser) ============ */

.pillar-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.pillar-card__title { font-size: var(--text-sm); font-weight: var(--weight-bold); font-family: var(--font-display); }
.pillar-card__tagline { margin-top: 0.25rem; font-size: 0.75rem; line-height: 1.5; color: var(--c-ink-soft); }

/* ============ Product / tool / post cards ============ */

.stack-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  height: 100%;
}

.stack-card__top { display: flex; align-items: flex-start; justify-content: space-between; }
.stack-card__title { font-size: 0.98rem; font-weight: var(--weight-bold); font-family: var(--font-display); }
.stack-card__desc { margin-top: 0.375rem; font-size: var(--text-sm); line-height: 1.5; color: var(--c-ink-soft); }
.stack-card__footer { margin-top: auto; display: flex; align-items: center; gap: 0.375rem; font-size: var(--text-sm); font-weight: var(--weight-bold); }

/* ============ CTA banner ============ */

.cta-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  background: var(--c-primary);
  color: #fff;
}

@media (min-width: 768px) {
  .cta-banner { border-radius: var(--radius-lg); padding: var(--space-14) 0; }
}

/* ============ Footer ============ */

.site-footer {
  display: block;
  padding: var(--space-8) var(--space-5);
  border-top: 1px solid var(--c-border);
}

@media (min-width: 768px) {
  .site-footer { padding: var(--space-8); }
}

.site-footer__row {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  justify-content: space-between;
}

/* Stacked (mobile) layout: centre the tagline and the link row. */
@media (max-width: 767.98px) {
  .site-footer__row { align-items: center; text-align: center; }
  .site-footer__brand { align-items: center; }
  .site-footer__links { justify-content: center; }
}

@media (min-width: 768px) {
  .site-footer__row { flex-direction: row; align-items: center; }
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 1.5rem;
  font-size: var(--text-sm);
  color: var(--c-ink-soft);
}

.site-footer__links a,
.site-footer__tagline a { color: var(--c-primary); font-weight: var(--weight-medium, 500); }
.site-footer__links a:hover { opacity: 0.7; }

/* ============ Toolbar (marketplace search + type/category filters) ============
 * Two rows: the search field alone on its own full-width row, then a second
 * row with the dark segmented control (small closed type set) and the
 * category select. That second row never wraps — its controls shrink and
 * the row scrolls horizontally on narrow viewports instead of stacking. */

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.toolbar__row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.toolbar__row::-webkit-scrollbar { display: none; }

/* Modifier for a toolbar with more than marketplace's original 2-row (search +
 * one segmented/select row) shape — e.g. resources.php's 3-row search/segmented/
 * selects layout. flex: 1 1 100% forces the row onto its own line at the desktop
 * breakpoint below (where .toolbar becomes flex-direction: row), instead of riding
 * up next to the search row like the :first-child/:last-child-only rule would allow
 * for a row that's neither. Row content still never wraps — always one line, scrolling
 * horizontally on overflow (inherited from .toolbar__row) exactly like marketplace's
 * original segmented+select row already does, just applied to more than one row. */
.toolbar__row--full {
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
}

.toolbar__search {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.4rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--c-border);
  background: var(--c-bg-alt);
  padding: 0.2rem 0.2rem 0.2rem 0.85rem;
}

.toolbar__search input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--c-ink);
  min-width: 0;
}

.toolbar__search input::placeholder { color: var(--c-ink-faint); }
.toolbar__search input:focus { outline: none; }

.toolbar__search-submit {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: var(--radius-full);
  background: var(--c-ink);
  color: #fff;
  transition: opacity var(--duration-fast) ease;
}

.toolbar__search-submit:hover { opacity: 0.85; }

.segmented {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.125rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--c-border);
  background: var(--c-bg-alt);
  padding: 0.2rem;
  white-space: nowrap;
}

.segmented__item {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: var(--weight-bold);
  color: var(--c-ink-soft);
  white-space: nowrap;
  transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
}

.segmented__item:hover { color: var(--c-ink); }

.segmented__item--active {
  background: var(--c-ink);
  color: #fff;
}

.segmented__item--active:hover { color: #fff; }

.toolbar__select {
  flex-shrink: 0;
  appearance: none;
  border-radius: var(--radius-full);
  border: 1px solid var(--c-border);
  background-color: var(--c-bg-alt);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235B5468' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding: 0.5rem 2rem 0.5rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: var(--weight-semibold);
  color: var(--c-ink);
  cursor: pointer;
  white-space: nowrap;
}

.toolbar__select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}

@media (min-width: 640px) {
  .toolbar { flex-direction: row; flex-wrap: wrap; }
  .toolbar__row:first-child { flex: 1 1 260px; }
  .toolbar__row:last-child:not(:first-child) { flex: 0 0 auto; }
  .toolbar__search { padding-left: 1rem; }
  .toolbar__search-submit { width: 2.25rem; height: 2.25rem; }
  .segmented__item { padding: 0.5rem 0.9rem; font-size: var(--text-sm); }
  .toolbar__select { padding: 0.625rem 2.25rem 0.625rem 1.1rem; font-size: var(--text-sm); }
}

/* ============ Forum: layout shell ============
 * Board/group pages use a two-column layout — main feed + a right sidebar of
 * widget cards. Thread pages reuse .forum-main alone (no sidebar). */

.forum-layout {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 1024px) {
  .forum-layout { grid-template-columns: 1fr 320px; }
}

.forum-groups--sidebar { display: none; }

@media (min-width: 1024px) {
  .forum-groups--mobile { display: none; }
  .forum-groups--sidebar { display: block; }
  /* 320px column: name row on top, join button on its own row */
  .forum-groups--sidebar .group-card { flex-wrap: wrap; padding: var(--space-3); box-shadow: none; }
  .forum-groups--sidebar .group-card > a { flex: 1 1 100%; }
  .forum-groups--sidebar .group-card .group-btn { padding: 0.35rem 0.8rem; }
}

.forum-main { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.forum-sidebar { display: flex; flex-direction: column; gap: var(--space-4); }

/* ============ Forum: hero stats ============ */

.forum-hero__stats {
  margin: 0;
  margin-top: var(--space-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.forum-hero__stats dt { font-size: 0.68rem; font-weight: var(--weight-semibold); color: var(--c-ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.forum-hero__stats dd { margin: 0.2rem 0 0; font-size: var(--text-xl); font-weight: var(--weight-extrabold); font-family: var(--font-display); }

/* ============ Forum: sidebar widget ============ */

.sidebar-widget {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.sidebar-widget__title {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  font-family: var(--font-display);
}

.sidebar-widget__row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding-block: 0.5rem;
}

.sidebar-widget__row + .sidebar-widget__row { border-top: 1px solid var(--c-border); }

.sidebar-widget__rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-extrabold);
  color: var(--c-ink-faint);
}

/* ============ Forum: group card + join button ============ */

.group-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
}

.group-card__body { min-width: 0; flex: 1; }
.group-card__name { font-size: var(--text-sm); font-weight: var(--weight-bold); font-family: var(--font-display); }
.group-card__meta { margin-top: 0.15rem; font-size: 0.72rem; color: var(--c-ink-faint); }

.group-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: var(--radius-full);
  padding: 0.45rem 0.95rem;
  font-size: 0.78rem;
  font-weight: var(--weight-bold);
  white-space: nowrap;
  transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
}

.group-btn--join { background: var(--c-ink); color: #fff; }
.group-btn--join:hover { opacity: 0.85; }

.group-btn--joined { background: var(--c-teal-soft); color: var(--c-teal); }
.group-btn--joined:hover { background: #FBE2DD; color: var(--c-coral); }

.group-btn__joined-label { display: inline; }
.group-btn__leave-label { display: none; }
.group-btn--joined:hover .group-btn__joined-label { display: none; }
.group-btn--joined:hover .group-btn__leave-label { display: inline; }

/* ============ Forum: thread card ============ */

.forum-thread {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
}

.forum-thread__avatar { flex-shrink: 0; }

.forum-thread__body { min-width: 0; flex: 1; }

.forum-thread__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.forum-thread__title {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  font-family: var(--font-display);
  line-height: 1.35;
}

.forum-thread__excerpt {
  margin-top: 0.3rem;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--c-ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.forum-thread__footer {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  font-size: 0.72rem;
  color: var(--c-ink-faint);
}

.forum-thread__footer-item { display: flex; align-items: center; gap: 0.3rem; }

/* ============ Forum: spotlight card (group page featured thread) ============ */

.forum-spotlight {
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  background: var(--c-ink);
  color: #fff;
}

.forum-spotlight__tag { color: #B9AEFF; }
.forum-spotlight__title { margin-top: 0.5rem; font-size: var(--text-xl); font-family: var(--font-display); font-weight: var(--weight-bold); line-height: 1.3; }
.forum-spotlight__excerpt { margin-top: 0.6rem; font-size: var(--text-sm); line-height: 1.55; color: rgba(255,255,255,0.75); }

/* ============ Forum: thread detail ============ */

.forum-op {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
}

.forum-op__byline { display: flex; align-items: center; gap: 0.75rem; }
.forum-op__body { font-size: var(--text-base); line-height: 1.7; color: var(--c-ink-soft); }

.forum-replies { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.forum-replies--nested { margin-top: var(--space-4); padding-left: calc(var(--space-5) + 2.25rem); }

.forum-reply { display: flex; gap: var(--space-3); }
.forum-reply__body { flex: 1; min-width: 0; background: var(--c-card); border: 1px solid var(--c-border); border-radius: var(--radius-md); padding: var(--space-4); }
.forum-reply--op .forum-reply__body { background: var(--c-primary-soft); border-color: transparent; }
.forum-reply__actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.forum-reply__admin-btn { background: none; border: 1px solid var(--c-border); border-radius: var(--radius-sm); color: var(--c-ink-faint); font: inherit; font-size: var(--text-xs); font-weight: 700; padding: 0.2rem 0.65rem; cursor: pointer; }
.forum-reply__admin-btn:hover { color: var(--c-ink); border-color: var(--c-ink-faint); }
.forum-reply__nested-form { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.forum-reply__nested-form[hidden] { display: none; }
.forum-reply__nested-form textarea.forum-field { min-height: 4.5rem; }
.forum-reply__edit-actions { display: flex; gap: var(--space-2); align-items: center; }
.forum-reply__text { margin-top: 0.4rem; font-size: var(--text-sm); line-height: 1.6; color: var(--c-ink-soft); }

/* ============ Forum: course hero, progress bar, recap grid (forum/thread.php) ============ */
.forum-course-progress-bar {
  height: 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.forum-course-progress-bar > span {
  display: block;
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--c-ink);
}

.forum-course-recap__tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border);
  padding: var(--space-3);
  text-decoration: none;
  background: var(--c-bg-alt);
}
.forum-course-recap__tile.is-current { background: var(--c-primary-soft); border-color: transparent; }
.forum-course-recap__tile-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-full);
  background: var(--c-card);
  color: var(--c-ink-faint);
  font-size: 0.65rem;
  font-weight: 800;
}
.forum-course-recap__tile-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--c-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============ Forum: composer (new thread / reply / chat input) ============ */

.forum-field {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: var(--c-bg-alt);
  padding: 0.75rem 0.95rem;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--c-ink);
}

.forum-field:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); background: var(--c-card); }
textarea.forum-field { resize: vertical; min-height: 9rem; line-height: 1.55; }

.forum-field-label { display: block; margin-bottom: 0.4rem; font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--c-ink-soft); }

/* ============ Forum: chat ============ */

.forum-chat {
  display: flex;
  flex-direction: column;
  height: min(34rem, 70vh);
}

.forum-chat__messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
}

.forum-chat__msg { display: flex; gap: 0.65rem; max-width: 85%; }
.forum-chat__msg--me { align-self: flex-end; flex-direction: row-reverse; }

.forum-chat__bubble { background: var(--c-bg-alt); border-radius: var(--radius-md); padding: 0.6rem 0.9rem; font-size: var(--text-sm); line-height: 1.5; }
.forum-chat__msg--me .forum-chat__bubble { background: var(--c-primary); color: #fff; }

.forum-chat__composer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--c-border);
}

.forum-chat__composer .forum-field { border-radius: var(--radius-full); }

.forum-online-dot { width: 0.45rem; height: 0.45rem; border-radius: var(--radius-full); background: var(--c-teal); flex-shrink: 0; }

/* ============ Forum: General Chat widget (embedded on the board) ============ */
/* Same .forum-chat card as the standalone /forum/chat page, but shorter and
 * with its own padding (the standalone page's header/messages/composer each
 * carry their own padding instead — this embedded version is a single
 * padded card, not that three-part layout). */

.forum-general-chat-widget {
  height: auto;
  max-height: 26rem;
  padding: var(--space-5);
}

.forum-general-chat-widget .forum-chat__messages {
  max-height: 16rem;
  padding: 0;
}

/* ============ Pagination ============
 * Used by includes/components/pagination.php on every listing page
 * (marketplace, resources, ai-tools, forum board/group). */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--space-8);
}

.pagination__pages {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pagination__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding-inline: 0.65rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--c-ink-soft);
  justify-content: center;
  transition: background var(--duration-fast) ease, color var(--duration-fast) ease;
}

.pagination__item--page { min-width: 2.25rem; padding-inline: 0; }

a.pagination__item:hover { background: var(--c-bg-alt); color: var(--c-ink); }

.pagination__item--active {
  background: var(--c-ink);
  color: #fff;
}

.pagination__item--disabled {
  color: var(--c-ink-faint);
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination__ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 2.25rem;
  color: var(--c-ink-faint);
  font-weight: var(--weight-bold);
}

@media (min-width: 768px) {
  .forum-hero__stats { gap: var(--space-8); }
  .forum-hero__stats dd { font-size: var(--text-2xl); }
}

/* ============ Article (long-form prose) ============ */
/* Used by about.php, contact.php, privacy.php, terms.php — any page that's
   mostly headings + paragraphs + lists rather than cards. */

.article h2 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
}

.article h2:first-child { margin-top: 0; }

.article h3 {
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
}

.article p {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--c-ink-soft);
}

.article ul,
.article ol {
  margin: 0 0 var(--space-4);
  padding-left: 1.5rem;
}

.article ul { list-style: disc; }
.article ol { list-style: decimal; }
.article li + li { margin-top: var(--space-2); }
.article li::marker { color: var(--c-ink-faint); }
.article li > ul,
.article li > ol { margin: var(--space-2) 0 0; }

.article li {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--c-ink-soft);
}

.article a:not(.btn) { color: var(--c-primary); font-weight: var(--weight-bold); text-decoration: underline; }

.article strong { color: var(--c-ink); }

.article blockquote {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--c-border);
  color: var(--c-ink-faint);
  font-size: var(--text-sm);
  font-style: italic;
}

.article blockquote p { margin-bottom: 0; }

.article img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: var(--space-4) 0;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md, 0.5rem);
}

.article .code-block-wrap {
  position: relative;
  margin: 0 0 var(--space-4);
}

.article pre {
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md, 0.5rem);
  background: var(--c-bg-alt);
  max-width: 100%;
  box-sizing: border-box;
  /* Wrap long lines (prompts are prose, not code) instead of hiding them behind a horizontal scrollbar. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--text-xs);
  line-height: 1.65;
}

.article pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  white-space: inherit;
}

.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: var(--weight-bold);
  line-height: 1.2;
  color: var(--c-ink-soft);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  cursor: pointer;
}
.copy-code-btn:hover { color: var(--c-ink); }
.copy-code-btn.is-copied { color: var(--c-teal); border-color: var(--c-teal); }
.copy-code-btn svg { width: 13px; height: 13px; }
.code-block-wrap pre { padding-right: 5.5rem; }

.article code {
  font-family: var(--font-mono, monospace);
}

.article :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
  background: var(--c-bg-alt);
  font-size: 0.9em;
}

/* GFM tables — md_to_html() wraps each <table> in .md-table-wrap for horizontal scroll. */
.md-table-wrap {
  overflow-x: auto;
  margin: 0 0 var(--space-5);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
}

.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.article thead { background: var(--c-bg-alt); }

.article th {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  font-weight: var(--weight-bold);
  color: var(--c-ink);
  white-space: nowrap;
}

.article td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
  line-height: 1.5;
  color: var(--c-ink-soft);
}

.article tbody tr:last-child td { border-bottom: 0; }

.article hr {
  margin: var(--space-6) 0;
  border: 0;
  border-top: 1px solid var(--c-border);
}

.article del { opacity: 0.6; }

/* Tighter spacing for Markdown rendered inside a forum post/reply — matches
   Instagram Hub's own .article-content rhythm (28px/12px h2, 14px p, 16px
   list), since the default .article spacing (built for standalone pages
   like about/contact/blog) is too loose for a compact thread/reply card. */
.forum-op__body.article h2,
.forum-reply__text.article h2 {
  margin: 28px 0 12px;
  font-size: var(--text-lg);
}

.forum-op__body.article h2:first-child,
.forum-reply__text.article h2:first-child { margin-top: 0; }

.forum-op__body.article h3,
.forum-reply__text.article h3 {
  margin: 20px 0 8px;
}

.forum-op__body.article p {
  margin: 0 0 14px;
}

.forum-reply__text.article p {
  margin: 0 0 10px;
}

.forum-op__body.article ul,
.forum-op__body.article ol,
.forum-reply__text.article ul,
.forum-reply__text.article ol {
  margin: 0 0 14px;
  gap: 0.4rem;
}

.forum-op__body.article > *:last-child,
.forum-reply__text.article > *:last-child {
  margin-bottom: 0;
}

/* ============ Resource box (free download) ============ */
/* Used by blog/post.php — same role as the live Instagram Hub's
   .resource-box: a highlighted callout under the article body offering
   the post's attached download. */

.resource-box {
  margin-top: var(--space-8);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--c-primary-soft);
  border: 1px solid var(--c-primary);
}

.resource-box__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--c-primary);
}

.resource-box__note {
  margin: var(--space-2) 0 var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--c-ink-soft);
}

.resource-box--unavailable {
  background: var(--c-bg-alt);
  border-color: var(--c-border);
}

.resource-box--unavailable .resource-box__title { color: var(--c-ink-faint); }

/* ============ Video embed (Phase 5, PORTING-PLAN.md) ============ */
/* Used by blog/post.php for a post's video_url. YouTube is 16:9, TikTok is
   portrait 9:16 — same distinction the live Instagram Hub app's posts/
   detail.php makes via an --tiktok modifier class. */

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-6);
  background: var(--c-ink);
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-embed--tiktok {
  aspect-ratio: 9 / 16;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* ============ Live chat widget (Phase 8, PORTING-PLAN.md) ============ */
/* Fixed bottom-right bubble + expandable panel, port of the live Instagram
   Hub app's chat widget. Rendered by includes/chat-widget.php (required from
   includes/footer.php — public pages only, dashboard pages never load it). */

#chat-widget {
  position: fixed;
  right: 2rem;
  bottom: 6rem;
  z-index: 60;
}

.chat-widget__bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 999px;
  background: var(--c-ink);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  position: relative;
}

.chat-widget__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--c-coral);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-widget__preview {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: max-content;
  max-width: min(280px, calc(100vw - 56px));
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  animation: chat-preview-in 0.2s ease-out;
}
.chat-widget__preview[hidden] { display: none; }
.chat-widget__preview:hover { border-color: var(--c-ink-faint); }

@keyframes chat-preview-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-widget__preview-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--c-border);
  background: var(--c-bg-alt);
  color: var(--c-ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.chat-widget__preview-close:hover { color: var(--c-ink); }

.chat-widget__preview-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.chat-widget__preview-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--c-ink);
}
.chat-widget__preview-text {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--c-ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-widget__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + var(--space-3));
  width: min(360px, calc(100vw - 2 * var(--space-5)));
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.chat-widget__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--c-ink);
  color: #fff;
}

.chat-widget__title { font-weight: 700; }

.chat-widget__avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-coral);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.chat-widget__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-widget__close {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
}

.chat-widget__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.chat-widget__intro {
  color: var(--c-ink-soft);
  margin-bottom: var(--space-3);
}

.chat-widget__start form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chat-widget__start input,
.chat-widget__start textarea,
.chat-widget__composer textarea {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font: inherit;
  resize: none;
  width: 100%;
}

.chat-widget__thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chat-widget__msg {
  max-width: 85%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-widget__msg-body {
  display: block;
}
.chat-widget__msg-body a,
.chat-widget__msg-quote a {
  text-decoration: underline;
}

.chat-widget__msg--visitor {
  align-self: flex-end;
  background: var(--c-ink);
  color: #fff;
}

.chat-widget__msg--admin {
  align-self: flex-start;
  background: var(--c-bg-alt);
  color: var(--c-ink);
}

.chat-widget__msg--system {
  align-self: center;
  background: none;
  color: var(--c-ink-faint);
  font-size: 0.8rem;
  font-style: italic;
}

.chat-widget__msg-quote {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 0.8rem;
  opacity: 0.75;
  border-left: 2px solid currentColor;
  padding-left: var(--space-2);
  margin-bottom: var(--space-1);
}
.chat-widget__msg-quote-sender { font-weight: 700; }
.chat-widget__msg-quote-body {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-widget__msg-meta {
  display: flex;
  align-items: center;
  margin-top: 3px;
}
.chat-widget__msg-reply-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 0.12s ease;
}
.chat-widget__msg-reply-btn:hover { opacity: 1; text-decoration: underline; }

.chat-widget__composer {
  border-top: 1px solid var(--c-border);
  padding: var(--space-3);
}

.chat-widget__reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  background: var(--c-bg-alt);
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-2);
  margin-bottom: var(--space-2);
  font-size: 0.8rem;
  color: var(--c-ink-soft);
}

.chat-widget__reply-preview button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-ink-soft);
  display: flex;
}

.chat-widget__composer-row {
  display: flex;
  gap: var(--space-2);
  align-items: flex-end;
}

.chat-widget__send {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: var(--c-ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (max-width: 480px) {
  .chat-widget__panel {
    width: calc(100vw - 2 * var(--space-4));
    right: calc(-1 * var(--space-1));
  }
}

/* Member name links (forum authors) inherit surrounding colour; underline on hover/focus. */
.author-link { color: inherit; text-decoration: none; cursor: pointer; }
.author-link:hover, .author-link:focus-visible { text-decoration: underline; }

/* Visually hidden but available to assistive tech (form labels for icon-only/search inputs). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============ Forum: live chat panel (Parity Phase C1/C2) ============ */
.fc-panel .fc-body { min-width: 0; }
.fc-panel .fc-meta { margin: 0 0 0.25rem; font-size: 0.68rem; font-weight: var(--weight-semibold); color: var(--c-ink-faint); }
.fc-panel .fc-edited, .fc-panel .fc-muted { color: var(--c-ink-faint); font-weight: normal; }
.fc-panel .fc-pin-tag { color: var(--c-primary); font-weight: var(--weight-bold); }
.fc-panel .fc-text { white-space: pre-wrap; word-break: break-word; }
.fc-panel .fc-text a, .fc-panel .fc-file { text-decoration: underline; }
.fc-panel .fc-quoted { font-size: var(--text-xs); opacity: .75; border-left: 2px solid currentColor; padding-left: var(--space-2); margin-bottom: var(--space-1); word-break: break-word; }
.fc-panel .fc-img { display: block; max-width: 100%; max-height: 14rem; border-radius: var(--radius-sm); margin-top: var(--space-1); }
.fc-panel .fc-file { display: inline-block; margin-top: var(--space-1); font-weight: var(--weight-bold); }
.fc-panel .fc-actions { display: flex; gap: var(--space-3); margin-top: 2px; }
.fc-panel .fc-link { background: none; border: none; padding: 0; cursor: pointer; font: inherit; font-size: 0.68rem; color: var(--c-ink-faint); text-decoration: underline; }
.fc-panel .fc-pinned { padding: var(--space-2) var(--space-5); background: var(--c-bg-alt); border-bottom: 1px solid var(--c-border); font-size: var(--text-xs); color: var(--c-ink-soft); }
.fc-panel .fc-pinned[hidden], .fc-panel .fc-quote[hidden], .fc-panel .fc-error[hidden] { display: none; }
.fc-panel .fc-quote { margin: 0 var(--space-5); padding: var(--space-2) var(--space-3); background: var(--c-bg-alt); border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--c-ink-soft); display: flex; justify-content: space-between; gap: var(--space-2); }
.fc-panel .fc-quote button { background: none; border: none; cursor: pointer; color: var(--c-ink-soft); }
.fc-panel .fc-attach { cursor: pointer; }
.fc-panel .fc-file-name { margin: 0; padding: 0 var(--space-5); font-size: var(--text-xs); color: var(--c-ink-faint); }
.fc-panel .fc-file-name:empty { display: none; }
.fc-panel .fc-error { padding: var(--space-2) var(--space-5); color: var(--c-coral); font-size: var(--text-sm); margin: 0; }
.fc-panel .fc-readonly { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--c-border); margin: 0; }
.fc-panel .forum-chat__msg { max-width: 92%; }
.fc-panel--compact { height: auto; max-height: 28rem; }
.fc-panel--compact .forum-chat__messages { max-height: 16rem; }

/* ---- Ad slot (AdSense; components/ad-slot.php) ---- */
.ad-slot { margin: var(--space-6) 0; border-radius: var(--radius-md); background: var(--c-bg-alt); border: 1px dashed var(--c-border); overflow: hidden; }
.ad-slot--banner { min-height: 90px; }
.ad-slot--rectangle { min-height: 250px; }
@media (min-width: 768px) {
  .ad-slot-wrap--mobile-only { display: none; }
}

/* ---- Blog post: reading column + sticky right sidebar ----
   Reading width is capped (46rem) so lines stay comfortable. The sidebar shows wherever there is room:
   from 960px when the fixed left nav is hidden (<1024px), and from 1200px beside it (the nav takes 16rem
   from 1024px, so 1024–1199px stays single-column). */
.post-shell { max-width: 46rem; }
.post-layout__side { display: none; }
@media (min-width: 960px) and (max-width: 1023.98px), (min-width: 1200px) {
  .post-shell { max-width: 70rem; }
  .post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 18rem; gap: var(--space-8); align-items: start; }
  .post-layout__main { max-width: 44rem; }
  .post-layout__side { display: flex; flex-direction: column; gap: var(--space-5); position: sticky; top: 5.5rem; }
  .post-layout__side .ad-slot { margin: 0; }
  .post-side-hide { display: none; }
}
.post-layout__related { display: flex; flex-direction: column; gap: 2px; padding-block: 0.6rem; }
.post-layout__related + .post-layout__related { border-top: 1px solid var(--c-border); }
.post-layout__related-title { font-size: var(--text-sm); font-weight: var(--weight-bold); line-height: 1.35; }
.post-layout__related:hover .post-layout__related-title { color: var(--c-primary); }
.post-layout__related-meta { font-size: var(--text-xs); color: var(--c-ink-faint); }

/* ── Promo popup (includes/promo-popup.php) ─────────────────────────────── */
.promo-popup {
  position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center;
  padding: var(--space-4); background: rgba(27, 21, 35, 0.55);
}
.promo-popup.is-open { display: flex; }
.promo-popup__box {
  position: relative; width: 100%; max-width: 26rem; max-height: calc(100vh - 2rem); overflow-y: auto;
  padding: var(--space-6); background: var(--c-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.promo-popup__close {
  position: absolute; top: var(--space-3); right: var(--space-3); display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border: none; border-radius: var(--radius-full); background: var(--c-bg-alt); color: var(--c-ink-soft); cursor: pointer;
}
.promo-popup__close:hover { color: var(--c-ink); }
.promo-popup__headline { margin: 0 var(--space-8) var(--space-2) 0; font-size: var(--text-xl); font-weight: 800; color: var(--c-ink); line-height: 1.25; }
.promo-popup__body { margin: 0 0 var(--space-4); color: var(--c-ink-soft); font-size: var(--text-sm); }
.promo-popup__links { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-4); }
.promo-popup__link {
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4);
  border: 1px solid var(--c-border); border-radius: var(--radius-md); color: var(--c-ink); text-decoration: none;
}
.promo-popup__link:hover { border-color: var(--c-primary); background: var(--c-primary-soft); }
.promo-popup__link--primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.promo-popup__link--primary:hover { background: var(--c-primary); filter: brightness(1.08); }
.promo-popup__link-icon { flex: none; display: inline-flex; }
.promo-popup__link-copy { display: flex; flex-direction: column; min-width: 0; }
.promo-popup__link-text { font-weight: 700; font-size: var(--text-sm); }
.promo-popup__link-desc { font-size: var(--text-xs); opacity: 0.8; }

/* ============ Site notice (admin-edited banner under the app bar) ============ */

.site-notice { background: var(--c-primary); color: #fff; }
.site-notice__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--space-2) var(--space-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-1) var(--space-3);
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.4;
}
.site-notice__text { font-weight: 500; }
.site-notice__link { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.site-notice__link:hover { opacity: 0.85; }

.site-footer__brand { display: flex; flex-direction: column; gap: var(--space-2); }
.site-footer__tagline { font-size: var(--text-sm); color: var(--c-ink-soft); margin: 0; }
.site-footer__tagline a { text-decoration: underline; text-underline-offset: 2px; }
.sidebar__social { display: flex; align-items: center; gap: var(--space-2); }
.sidebar__social .icon-btn { width: 2.25rem; height: 2.25rem; color: var(--c-ink-soft); flex: none; }
.sidebar__social .icon-btn:hover { color: var(--c-ink); }
.sidebar__social .icon-btn > * { display: block; flex: none; }

/* ============ Small shared UI: gate dialogs, emoji picker, toast ============ */

.gate-dialog {
  position: relative;
  padding: var(--space-6);
  max-width: 26rem;
  width: calc(100% - 2rem);
  border: 1px solid var(--c-border);
}
.gate-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.gate-dialog__close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--c-ink-faint);
}

.emoji-picker { position: relative; display: inline-flex; }
.emoji-picker__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border);
  background: var(--c-bg-alt);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.emoji-picker__toggle:hover,
.emoji-picker__toggle[aria-expanded="true"] { border-color: var(--c-ink-faint); }
.emoji-picker__popover {
  position: absolute;
  z-index: 30;
  bottom: calc(100% + 6px);
  left: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: var(--space-2);
  background: var(--c-card, #fff);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.emoji-picker__popover[hidden] { display: none; }
.emoji-picker__option {
  width: 1.9rem;
  height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm, 6px);
  font-size: 1.1rem;
  cursor: pointer;
}
.emoji-picker__option:hover,
.emoji-picker__option:focus-visible { background: var(--c-bg-alt); }
.forum-chat__composer .emoji-picker { flex-shrink: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 100;
  transform: translate(-50%, 0.75rem);
  opacity: 0;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-full);
  background: var(--c-ink);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ============ Forum: General Chat — live-site layout, devv palette (.fc-panel--live) ============
 * Same data/JS contract as every other chat room. Layout follows the live site
 * (header + "Open chat" pill, avatar + white message card with the time on the
 * right, attach buttons, send) built from devv tokens and components only. */

.fc-panel--live { padding: 0; max-height: none; overflow: hidden; border-radius: var(--radius-lg); }
.fc-panel--live.fc-panel--compact { height: 28rem; }
@media (max-width: 640px) { .fc-panel--live.fc-panel--compact { height: 26rem; } }

.fc-panel--live .fc-live-head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--c-bg-alt); border-bottom: 1px solid var(--c-border); flex-shrink: 0;
}
.fc-panel--live .fc-live-head__icon { display: flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: var(--radius-sm); background: var(--c-primary-soft); color: var(--c-primary); flex-shrink: 0; }
.fc-panel--live .fc-live-head__text { min-width: 0; flex: 1; }
.fc-panel--live .fc-live-head h2 { margin: 0; font-family: var(--font-display); font-size: var(--text-base); font-weight: var(--weight-bold); color: var(--c-ink); line-height: 1.25; }
.fc-panel--live .fc-live-head p { margin: 0; font-size: var(--text-xs); color: var(--c-ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-panel--live .fc-live-head__open {
  margin-left: auto; flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.75rem; border: 1px solid var(--c-border); border-radius: var(--radius-full); background: var(--c-card);
  font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: 1; color: var(--c-ink-soft); white-space: nowrap;
}
.fc-panel--live .fc-live-head__open:hover { color: var(--c-primary); }
@media (max-width: 460px) {
  .fc-panel--live .fc-live-head p, .fc-panel--live .fc-live-head__open span:not(.fc-fs-icon) { display: none; }
  .fc-panel--live .fc-live-head__open { padding: 0; width: 2.5rem; height: 2.5rem; justify-content: center; }
}

.fc-panel--live .forum-chat__messages { flex: 1; min-height: 0; max-height: none; padding: var(--space-3) var(--space-4); gap: var(--space-3); background: var(--c-bg); }
.fc-panel--live .forum-chat__msg,
.fc-panel--live .forum-chat__msg--me { max-width: none; width: 100%; align-self: stretch; flex-direction: row; align-items: flex-start; gap: var(--space-2); }
.fc-panel--live .avatar { width: 1.75rem !important; height: 1.75rem !important; font-size: 0.65rem !important; }
.fc-panel--live .fc-body { flex: 1; min-width: 0; background: var(--c-card); border: 1px solid var(--c-border); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); }
.fc-panel--live .fc-meta { display: flex; align-items: baseline; gap: var(--space-2); margin: 0 0 2px; font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--c-ink); }
.fc-panel--live .fc-meta .author-link { color: inherit; text-decoration: none; }
.fc-panel--live .fc-time { margin-left: auto; font-size: 0.68rem; font-weight: var(--weight-medium); color: var(--c-ink-faint); }
.fc-panel--live .fc-edited { font-size: 0.68rem; font-style: italic; }
.fc-panel--live .forum-chat__bubble,
.fc-panel--live .forum-chat__msg--me .forum-chat__bubble { background: none; color: var(--c-ink); padding: 0; border-radius: 0; font-size: var(--text-sm); line-height: 1.5; }
.fc-panel--live .fc-text a, .fc-panel--live .fc-file { color: var(--c-primary); }
.fc-panel--live .fc-actions { gap: var(--space-3); margin-top: var(--space-1); }
.fc-panel--live .fc-link { font-family: inherit; font-size: 0.72rem; font-weight: var(--weight-semibold); color: var(--c-ink-faint); text-decoration: none; }
.fc-panel--live .fc-link:hover { color: var(--c-ink); }
.fc-panel--live .fc-quote { margin: 0 var(--space-4) var(--space-2); }

.fc-panel--live .fc-composer { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; padding: var(--space-3) var(--space-4); background: var(--c-bg-alt); border-top: 1px solid var(--c-border); }
.fc-panel--live .fc-pick { display: flex; align-items: center; justify-content: center; flex: none; width: 2.25rem; height: 2.25rem; border-radius: var(--radius-full); cursor: pointer; background: var(--c-card); border: 1px solid var(--c-border); color: var(--c-ink); }
.fc-panel--live .fc-pick:hover { color: var(--c-primary); }
.fc-panel--live .fc-composer .forum-field { flex: 1; min-width: 0; height: 2.25rem; border-radius: var(--radius-full); padding: 0 var(--space-4); font-size: var(--text-sm); }
.fc-panel--live .fc-send { display: flex; align-items: center; justify-content: center; flex: none; width: 2.25rem; height: 2.25rem; border: none; border-radius: var(--radius-full); cursor: pointer; background: var(--c-ink); color: #fff; }
.fc-panel--live .fc-send:hover { opacity: 0.88; }
.fc-panel--live .fc-send:disabled { cursor: not-allowed; opacity: 0.45; }
.fc-panel--live .fc-file-name, .fc-panel--live .fc-error, .fc-panel--live .fc-readonly { padding-inline: var(--space-4); }

/* Full-screen mode (standalone General Chat page): the panel becomes a fixed
 * viewport overlay, toggled by assets/forum-chat.js. dvh keeps the composer on
 * the true bottom edge as mobile browser chrome shows/hides. */
.fc-panel--live .fc-live-head__open .fc-fs-icon { display: inline-flex; }
.fc-panel--live .fc-live-head__open .fc-fs-icon--exit { display: none; }
.fc-panel--fs .fc-live-head__open .fc-fs-icon--enter { display: none; }
.fc-panel--fs .fc-live-head__open .fc-fs-icon--exit { display: inline-flex; }
.fc-panel--live .fc-live-head button.fc-live-head__open { cursor: pointer; font-family: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.fc-panel--live.fc-panel--fs {
  position: fixed; inset: 0; z-index: 200;
  width: 100%; height: 100dvh; max-height: 100dvh; margin: 0;
  border: none; border-radius: 0; box-shadow: none; background: var(--c-card);
}
.fc-panel--fs .fc-composer { padding-bottom: max(var(--space-3), env(safe-area-inset-bottom)); }
body.fc-fs-lock { overflow: hidden; }

/* Inline edit (all chat rooms): replaces the message text in place. */
.fc-panel .fc-edit-form { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 4px; }
.fc-panel .fc-edit-textarea { width: 100%; min-height: 44px; max-height: 200px; resize: vertical; padding: 8px 10px; border: 1px solid var(--c-primary); border-radius: var(--radius-sm); background: var(--c-card); color: inherit; font: inherit; line-height: 1.5; }
.fc-panel .fc-edit-textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--c-primary-soft); }
.fc-panel .fc-edit-actions { display: flex; gap: 14px; }
.fc-panel .fc-edit-actions .fc-link:first-child { color: var(--c-primary); font-weight: 700; }

/* ============ Shared chat skin (.cx-*) — member/admin messages, visitor chat widget, admin visitor inbox ============
 * Same layout as the General Chat (.fc-panel--live): header, avatar + white message card
 * (name left, time right, text, Reply link), round composer. devv tokens only. */

.cx-panel { padding: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius-lg); }
.cx-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--c-bg-alt); border-bottom: 1px solid var(--c-border); flex-shrink: 0; }
.cx-head__icon { display: flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: var(--radius-sm); background: var(--c-primary-soft); color: var(--c-primary); flex-shrink: 0; }
.cx-head__text { min-width: 0; flex: 1; }
.cx-head__title { margin: 0; font-family: var(--font-display); font-size: var(--text-base); font-weight: var(--weight-bold); color: var(--c-ink); line-height: 1.25; }
.cx-head__sub { margin: 0; font-size: var(--text-xs); color: var(--c-ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cx-thread { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); background: var(--c-bg); }
.cx-day { align-self: center; font-size: var(--text-xs); color: var(--c-ink-faint); }
.cx-empty { margin: auto; text-align: center; font-size: var(--text-sm); color: var(--c-ink-faint); }
.cx-row { display: flex; align-items: flex-start; gap: var(--space-2); width: 100%; }
.cx-row .avatar { width: 1.75rem; height: 1.75rem; font-size: 0.65rem; }
.cx-card { flex: 1; min-width: 0; background: var(--c-card); border: 1px solid var(--c-border); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); font-size: var(--text-sm); line-height: 1.5; color: var(--c-ink); }
.cx-row--system .cx-card { background: none; border-style: dashed; color: var(--c-ink-faint); font-style: italic; }
.cx-meta { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: 2px; }
.cx-name { font-weight: var(--weight-bold); }
.cx-time { margin-left: auto; font-size: 0.68rem; font-weight: var(--weight-medium); color: var(--c-ink-faint); }
.cx-text { white-space: pre-wrap; word-break: break-word; }
.cx-text a, .cx-card a { color: var(--c-primary); text-decoration: underline; }
.cx-quote { display: flex; flex-direction: column; gap: 1px; margin-bottom: var(--space-1); padding-left: var(--space-2); border-left: 2px solid var(--c-border); font-size: var(--text-xs); color: var(--c-ink-soft); }
.cx-quote__name { font-weight: var(--weight-bold); }
.cx-quote__body { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-actions { display: flex; gap: var(--space-3); margin-top: var(--space-1); }
.cx-link { background: none; border: none; padding: 0; cursor: pointer; font: inherit; font-size: 0.72rem; font-weight: var(--weight-semibold); color: var(--c-ink-faint); }
.cx-link:hover { color: var(--c-ink); }

.cx-replying { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin: 0 var(--space-4) var(--space-2); padding: var(--space-1) var(--space-3); background: var(--c-bg-alt); border-radius: var(--radius-md); font-size: var(--text-xs); color: var(--c-ink-soft); }
.cx-replying[hidden] { display: none; }
.cx-replying button { background: none; border: none; cursor: pointer; color: var(--c-ink-soft); }
.cx-composer { display: flex; align-items: flex-end; gap: var(--space-2); flex-shrink: 0; padding: var(--space-3) var(--space-4); background: var(--c-bg-alt); border-top: 1px solid var(--c-border); }
.cx-input { flex: 1; min-width: 0; resize: none; border: 1px solid var(--c-border); border-radius: var(--radius-md); background: var(--c-card); padding: 0.5rem var(--space-4); font: inherit; font-size: var(--text-sm); line-height: 1.4; color: var(--c-ink); }
.cx-input:focus { outline: none; border-color: var(--c-primary); }
.cx-send { display: flex; align-items: center; justify-content: center; flex: none; width: 2.25rem; height: 2.25rem; border: none; border-radius: var(--radius-full); cursor: pointer; background: var(--c-ink); color: #fff; }
.cx-send:hover { opacity: 0.88; }
.cx-send:disabled { cursor: not-allowed; opacity: 0.45; }
.cx-error { margin: 0; padding: 0 var(--space-4) var(--space-3); color: var(--c-coral); font-size: var(--text-sm); }

/* Visitor chat widget: reuse the card look on the existing .chat-widget__msg elements (JS keeps those classes). */
.chat-widget__thread { gap: var(--space-2); }
.chat-widget__msg { max-width: 100%; align-self: stretch; background: var(--c-card); color: var(--c-ink); border: 1px solid var(--c-border); white-space: normal; }
.chat-widget__msg--visitor, .chat-widget__msg--admin { background: var(--c-card); color: var(--c-ink); align-self: stretch; }
.chat-widget__msg--system { background: none; border: 1px dashed var(--c-border); color: var(--c-ink-faint); }
.chat-widget__msg .cx-meta { font-size: var(--text-xs); }
.chat-widget__msg-reply-btn { color: var(--c-ink-faint); opacity: 1; }
.chat-widget__header { background: var(--c-bg-alt); color: var(--c-ink); border-bottom: 1px solid var(--c-border); }
.chat-widget__close { color: var(--c-ink-soft); }
.chat-widget__composer { background: var(--c-bg-alt); }
.chat-widget__composer textarea { border-radius: var(--radius-md); background: var(--c-card); }

/* Chat list/thread split — two columns on desktop, one pane at a time on mobile */
.cx-split { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: var(--space-4); align-items: start; }
.cx-split--wide { grid-template-columns: 320px 1fr; }
.cx-split__main, .cx-split__list { min-width: 0; }
.cx-conv {
  display: flex; flex-direction: column; gap: 0.125rem; min-width: 0;
  padding: var(--space-2) var(--space-3); border: 1px solid var(--c-line, #eee);
  border-radius: var(--radius-md, 0.75rem); background: #fff; color: var(--c-ink);
  text-align: left; font: inherit; cursor: pointer; text-decoration: none; width: 100%;
}
.cx-conv strong { font-size: var(--text-sm); }
.cx-conv span { font-size: var(--text-xs, 0.75rem); color: var(--c-ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-conv:hover { background: var(--c-surface, #faf8f3); }
.cx-conv.is-active { background: var(--c-ink); border-color: var(--c-ink); }
.cx-conv.is-active strong, .cx-conv.is-active span { color: #fff; }
.cx-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cx-pane[hidden] { display: none; }
.cx-back, .cx-back-link { display: none; }
.cx-back { background: none; border: 0; padding: 0.25rem; margin-left: -0.25rem; color: var(--c-ink); cursor: pointer; }
.cx-back-link { align-items: center; gap: 0.25rem; margin-bottom: var(--space-3); font-size: var(--text-sm); font-weight: 600; color: var(--c-ink); text-decoration: none; }

@media (max-width: 768px) {
  .cx-split, .cx-split--wide { grid-template-columns: 1fr; }
  .cx-split--open .cx-split__list { display: none; }
  .cx-split:not(.cx-split--open) .cx-split__main { display: none; }
  .cx-back { display: inline-flex; }
  .cx-back-link { display: inline-flex; }
  .cx-panel { min-height: 0 !important; }
  .cx-thread, .msg-app .msg-thread { max-height: 55vh !important; min-height: 240px; }
  .cx-head { flex-wrap: wrap; }
  .cx-head__action { margin-left: auto; }
  .cx-head__icon { display: none; }
  .cx-input { font-size: 16px; }
}

/* ============ Public profile: activity lists ============ */
.profile-list, .profile-groups { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.profile-item, .profile-group {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0.75rem 0.85rem; border: 1px solid var(--c-border); border-radius: var(--radius-md);
  background: var(--c-card); transition: border-color var(--duration-fast) ease, transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.profile-item:hover, .profile-group:hover { border-color: var(--c-primary); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.05); }
.profile-item__body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.25rem; }
.profile-item__title { font-weight: var(--weight-bold); font-family: var(--font-display); font-size: var(--text-sm); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.profile-item__excerpt { font-size: 0.78rem; color: var(--c-ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.profile-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; font-size: 0.7rem; color: var(--c-ink-faint); }
.profile-item__meta > span { display: inline-flex; align-items: center; gap: 0.25rem; }
.profile-group { padding: 0.5rem 0.65rem; }

/* ============ No underlines on any site link ============ */
a, a:hover, a:focus, a.underline, .underline { text-decoration: none !important; }

/* ============ Profile edit: avatar uploader ============ */
.avatar-upload { display: grid; grid-template-columns: auto 1fr; gap: var(--space-4); align-items: center; }
.avatar-upload__preview { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 3px solid var(--c-card); box-shadow: 0 0 0 1px var(--c-border); display: flex; }
.avatar-upload__preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-upload__preview .avatar { width: 100%; height: 100%; font-size: 1.8rem; }
.avatar-upload__main { min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.avatar-upload__input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.avatar-upload__drop {
  display: flex; align-items: center; gap: var(--space-3); cursor: pointer;
  padding: 0.85rem 1rem; border: 1.5px dashed var(--c-border); border-radius: var(--radius-md);
  color: var(--c-ink-soft); transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease;
}
.avatar-upload__drop:hover, .avatar-upload__drop.is-drag, .avatar-upload__input:focus-visible + .avatar-upload__drop { border-color: var(--c-primary); background: var(--c-primary-soft, rgba(99,70,230,.06)); color: var(--c-ink); }
.avatar-upload__drop span { display: flex; flex-direction: column; min-width: 0; }
.avatar-upload__drop strong { font-size: var(--text-sm); color: var(--c-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-upload__drop small { font-size: 0.72rem; color: var(--c-ink-faint); }
.avatar-upload__submit { grid-column: 1 / -1; justify-self: start; }
.avatar-upload__submit:disabled { opacity: .45; cursor: not-allowed; }
@media (min-width: 640px) {
  .avatar-upload { grid-template-columns: auto 1fr auto; }
  .avatar-upload__submit { grid-column: auto; }
}
.avatar-upload { position: relative; }
.avatar-upload [hidden] { display: none !important; }

.profile-chip { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.85rem 0.35rem 0.4rem; border: 1px solid var(--c-border); border-radius: var(--radius-full); background: var(--c-card); font-size: var(--text-sm); font-weight: var(--weight-bold); transition: border-color var(--duration-fast) ease; }
.profile-chip:hover { border-color: var(--c-primary); }
.profile-progress { display: block; height: 6px; border-radius: 3px; background: var(--c-border); overflow: hidden; }
.profile-progress > span { display: block; height: 100%; background: var(--c-primary); border-radius: 3px; }


/* Live search suggestions (assets/site.js initLiveSearch). Injected by JS and
   absolutely positioned, so it never shifts layout (CLS) and is absent from the
   server-rendered HTML crawlers index. */
.live-search { position: relative; }
.live-search__panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 24rem;
  overflow-y: auto;
  padding: 0.375rem;
  text-align: left;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.live-search__panel[hidden] { display: none; }
.live-search__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  color: var(--c-ink);
  text-decoration: none;
}
.live-search__item:hover,
.live-search__item.is-active { background: var(--c-bg-alt); }
.live-search__body { min-width: 0; flex: 1; }
.live-search__title { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; font-weight: 700; }
.live-search__title span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-search__desc { margin-top: 0.125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; color: var(--c-ink-faint); }
.live-search__note { padding: 0.75rem; font-size: 0.8125rem; color: var(--c-ink-faint); }
.live-search__all { justify-content: center; font-size: 0.8125rem; font-weight: 700; color: var(--c-primary); }

.notif-bell__badge[hidden] { display: none; }

/* Live filter swap (assets/site.js initLiveFilters): dim the results while the next page of them loads. */
[data-live-region].is-loading { opacity: 0.55; transition: opacity 0.15s ease; }

.mobile-menu__link i { flex-shrink: 0; color: var(--c-ink-faint); }
.mobile-menu__link.active i { color: var(--c-primary); }
.mobile-menu .btn--block { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }

/* Mobile form fields: iOS Safari zooms the whole page in when a focused field's font-size is under
   16px (and leaves it zoomed), which is what made some pages "expand" while typing. Keep every
   text-entry field at 16px on small screens (the chat boxes already inherit 16px, so they never did it). */
@media (max-width: 767px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="color"]):not([type="image"]),
  textarea,
  select {
    font-size: 16px !important;
    max-width: 100%;
  }
  body { overflow-x: clip; }
}

/* ============ Newsletter card (includes/components/newsletter-card.php) ============ */
.newsletter-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* when the button wraps under the input on mobile, centre it */
  gap: var(--space-2);
  max-width: 30rem;
  margin: 1.75rem auto 0;
  position: relative;
}
.newsletter-form__input {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 0.875rem 1.25rem;
  border-radius: 999px;
  border: 2px solid transparent;
  background: #fff;
  color: var(--c-ink);
  font: inherit;
}
.newsletter-form__input:focus { outline: none; border-color: rgba(255, 255, 255, 0.55); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25); }
.newsletter-form .btn { flex: 0 0 auto; padding: 0.875rem 1.5rem; }
.newsletter-form .btn:disabled { opacity: 0.7; cursor: progress; }
.newsletter__msg {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: var(--space-6) auto 0;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
}
.newsletter__msg--error { background: rgba(0, 0, 0, 0.28); }
.newsletter__fine { margin-top: var(--space-3); font-size: var(--text-xs); color: rgba(255, 255, 255, 0.65); }

/* Site dialog (assets/site.js → window.siteDialog): replaces native alert()/confirm(). */
.site-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(27, 21, 35, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: site-dialog-fade 0.15s ease-out;
}
.site-dialog__box {
  width: 100%;
  max-width: 24rem;
  padding: var(--space-6);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: site-dialog-pop 0.18s ease-out;
}
.site-dialog__box.is-danger { border-top: 4px solid var(--c-coral); }
.site-dialog__title { margin: 0 0 var(--space-2); font-size: 1.125rem; font-weight: var(--weight-bold); color: var(--c-ink); }
.site-dialog__message { margin: 0; font-size: 0.9rem; line-height: 1.5; color: var(--c-ink-soft); }
.site-dialog__actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-5); }
.btn--danger { background: var(--c-coral); color: #fff; }
body.site-dialog-open { overflow: hidden; }
@keyframes site-dialog-fade { from { opacity: 0; } }
@keyframes site-dialog-pop { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
@media (prefers-reduced-motion: reduce) { .site-dialog, .site-dialog__box { animation: none; } }

/* ============ Live classes page (ai-automation-live-classes.php) ============
 * Editorial layout: split hero with a "what you'll learn" panel, a tinted
 * audience band, a stepped tier ladder (featured tier inverted + raised), and
 * a dark closing CTA band. Tokens only; no new tones. */

.live-hero { display: grid; gap: var(--space-8); align-items: center; }
@media (min-width: 900px) { .live-hero { grid-template-columns: 1.15fr 1fr; gap: var(--space-14); } }

.live-topics {
  background: var(--c-primary-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}
.live-topics__title { font-size: var(--text-xs); font-weight: var(--weight-extrabold); letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-primary); }
.live-topics__list { margin: var(--space-4) 0 0; padding: 0; list-style: none; display: grid; gap: var(--space-2); }
@media (min-width: 560px) and (max-width: 899px), (min-width: 1200px) { .live-topics__list { grid-template-columns: 1fr 1fr; } }
.live-topics__list li {
  display: flex; align-items: center; gap: var(--space-2);
  background: var(--c-card); border-radius: var(--radius-sm);
  padding: 0.55rem var(--space-3); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--c-ink);
}
.live-topics__list [data-lucide] { color: var(--c-primary); }
.live-topics__list li:last-child { grid-column: 1 / -1; color: var(--c-ink-soft); font-weight: var(--weight-medium); }

.live-audience { background: var(--c-bg-alt); border-radius: var(--radius-xl); padding: var(--space-8) var(--space-6); display: grid; gap: var(--space-4); }
@media (min-width: 900px) { .live-audience { grid-template-columns: 1fr 2fr; padding: var(--space-10); gap: var(--space-10); } }
.live-audience__text { font-size: var(--text-lg); line-height: 1.65; color: var(--c-ink); border-left: 3px solid var(--c-primary); padding-left: var(--space-5); margin: 0; }

.live-ladder { display: grid; gap: var(--space-4); align-items: stretch; }
@media (min-width: 900px) { .live-ladder { grid-template-columns: repeat(3, 1fr); gap: var(--space-5); } }
.live-tier {
  position: relative; display: flex; flex-direction: column;
  background: var(--c-card); border: 1px solid var(--c-border); border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.live-tier__step { font-family: var(--font-display); font-size: var(--text-xs); font-weight: var(--weight-extrabold); letter-spacing: 0.1em; color: var(--c-ink-faint); }
.live-tier__name { margin-top: var(--space-2); font-family: var(--font-display); font-size: var(--text-2xl); font-weight: var(--weight-bold); }
.live-tier__price { margin-top: var(--space-3); font-family: var(--font-display); font-size: var(--text-4xl); font-weight: var(--weight-extrabold); line-height: 1; letter-spacing: -0.02em; }
.live-tier__tagline { margin-top: var(--space-3); font-weight: var(--weight-bold); font-size: var(--text-sm); }
.live-tier__desc { margin-top: var(--space-2); font-size: var(--text-sm); line-height: 1.6; color: var(--c-ink-soft); flex: 1; }
.live-tier__count { margin-top: var(--space-4); font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--c-ink-soft); }
.live-tier .btn { margin-top: var(--space-4); }
.live-tier__flag { position: absolute; top: var(--space-4); right: var(--space-4); }
.live-tier--featured { background: var(--c-ink); border-color: var(--c-ink); color: #fff; }
.live-tier--featured .live-tier__step, .live-tier--featured .live-tier__count, .live-tier--featured .live-tier__desc { color: rgba(255, 255, 255, 0.7); }
.live-tier--featured .btn { background: #fff; color: var(--c-ink); box-shadow: none; }
@media (min-width: 900px) { .live-tier--featured { transform: translateY(-14px); padding-block: calc(var(--space-6) + 14px); box-shadow: 0 18px 40px -18px rgba(27, 21, 35, 0.55); } }

.live-cta {
  background: var(--c-ink); color: #fff; border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6); display: grid; gap: var(--space-5); align-items: center;
}
@media (min-width: 900px) { .live-cta { grid-template-columns: 1fr auto; padding: var(--space-10); } }
.live-cta__text { margin: 0; max-width: 38rem; font-size: var(--text-lg); line-height: 1.6; color: rgba(255, 255, 255, 0.85); }
.live-cta .btn { background: #fff; color: var(--c-ink); }

/* Live classes: testimonials (admin-managed; section renders only when published rows exist). */
.live-quotes { display: grid; gap: var(--space-4); }
@media (min-width: 700px) { .live-quotes { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--space-5); } }
.live-quote { margin: 0; display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-5); background: var(--c-card); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: var(--space-6); }
.live-quote__text { margin: 0; font-size: var(--text-base); line-height: 1.65; color: var(--c-ink); }
.live-quote__text::before { content: "\201C"; display: block; font-family: var(--font-display); font-size: 2.5rem; line-height: 0.8; color: var(--c-primary); }
.live-quote__who { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-sm); color: var(--c-ink); }
.live-quote__avatar { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: var(--radius-full); background: var(--c-primary-soft); color: var(--c-primary); font-family: var(--font-display); font-weight: var(--weight-bold); flex: none; }
.live-quote__role { color: var(--c-ink-soft); font-size: var(--text-xs); }

/* ============ Community activity chip ============
 * One recent forum/community event at a time, bottom-left; slides in, then out (assets/site.js
 * initActivityChip). Sits above the mobile tab bar and clear of the chat bubble on the right. */
.activity-chip {
  position: fixed; z-index: 45; left: 0.75rem; right: 5rem; max-width: 22rem;
  bottom: calc(3.25rem + env(safe-area-inset-bottom) + 0.75rem);
  display: flex; align-items: center; gap: 0.25rem;
  padding: 0.5rem 0.5rem 0.5rem 0.625rem; background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--radius-full); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(0.75rem); pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.activity-chip.is-open { opacity: 1; transform: none; pointer-events: auto; }
@media (min-width: 1024px) { .activity-chip { bottom: 1.25rem; left: 1.25rem; right: auto; } }
@media (prefers-reduced-motion: reduce) { .activity-chip { transition: none; } }
.activity-chip__link { display: flex; align-items: center; gap: 0.5rem; min-width: 0; flex: 1; color: inherit; text-decoration: none; }
.activity-chip__avatar { width: 28px; height: 28px; font-size: 10.5px; flex-shrink: 0; }
.activity-chip__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.activity-chip__line { font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-chip__line strong { font-weight: var(--weight-bold); }
.activity-chip__time { font-size: 0.68rem; color: var(--c-ink-faint); }
.activity-chip__close {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 1.5rem; height: 1.5rem;
  border: none; border-radius: var(--radius-full); background: transparent; color: var(--c-ink-faint); cursor: pointer;
}
