/* Visually hidden but still announced by screen readers — for labels that
   would be visually redundant next to an already-obvious control. */
.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; }

:root {
  --font: sofia-pro, SofiaProWeb, 'DM Sans', Helvetica, Arial, sans-serif;

  /* ── Theme tokens (light) ─────────────────────────────────────────────
     Dark overrides live in :root[data-theme="dark"] below. Default (no
     data-theme, e.g. JS disabled) = light = the site's original look. */
  --brand: #217373;
  --brand-tint: #e6f1f1;
  --brand-tint-border: #c5dede;

  /* surfaces */
  --bg: #fff;
  --surface: #fafafa;
  --surface-alt: #f7f7f7;
  --surface-hover: #f5f5f5;
  --btn-secondary-bg: #f0f0f0;

  /* borders */
  --border: #ebebeb;
  --border-strong: #e2e2e2;
  --border-subtle: #f0f0f0;

  /* text */
  --text-strong: rgba(0,0,0,0.85);
  --text: #1a1a1a;
  --text-body: rgba(0,0,0,0.65);
  --text-muted: #666;
  --text-faint: #999;
  --text-fainter: #bbb;

  /* inverted surfaces (dark chips in light mode) */
  --btn-primary-bg: #1a1a1a;
  --pill-active-bg: #1a1a1a;
  --inverse-surface: #1a1a1a;
  --on-inverse: #fff;

  /* status */
  --success-bg: #f0fff4; --success-border: #9ae6b4; --success-text: #276749;
  --danger-bg: #fff5f5; --danger-border: #feb2b2; --danger-text: #c53030;
  --danger-solid: #c53030;
  --warning-bg: #fffaf0; --warning-border: #fbd38d; --warning-text: #9c4221;
  --editorial-bg: #fef3c7; --editorial-border: #f59e0b; --editorial-text: #92400e;

  /* shadow / overlay */
  --shadow-color: rgba(0,0,0,0.1);
  --overlay: rgba(0,0,0,0.4);
}

:root[data-theme="dark"] {
  --brand: #2f9e9e;
  --brand-tint: #14302f;
  --brand-tint-border: #245b59;

  --bg: #14171a;
  --surface: #1b1f24;
  --surface-alt: #1f242b;
  --surface-hover: #262b31;
  --btn-secondary-bg: #2a2f36;

  --border: #2a3037;
  --border-strong: #343b43;
  --border-subtle: #21262c;

  --text-strong: #f2f4f6;
  --text: #e6e8ea;
  --text-body: #c4c9ce;
  --text-muted: #9aa1a9;
  --text-faint: #7b828b;
  --text-fainter: #5e656d;

  --btn-primary-bg: var(--brand);
  --pill-active-bg: var(--brand);
  --inverse-surface: #23282e;
  --on-inverse: #fff;

  --success-bg: #10241a; --success-border: #2f6b45; --success-text: #7fd9a3;
  --danger-bg: #2c1618; --danger-border: #7a3b3b; --danger-text: #f0a0a0;
  --danger-solid: #c53030;
  --warning-bg: #2a2212; --warning-border: #6b5524; --warning-text: #e0a878;
  --editorial-bg: #2a2412; --editorial-border: #b5810f; --editorial-text: #f0c078;

  --shadow-color: rgba(0,0,0,0.5);
  --overlay: rgba(0,0,0,0.65);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; scroll-padding-top: 70px; max-width: 100%; overflow-x: hidden; }
body { font-family: var(--font); font-weight: 400; background: var(--bg); color: var(--text-body); line-height: 130%; letter-spacing: -0.0315rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; max-width: 100%; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

.container { max-width: 1920px; margin: 0 auto; padding: 0 40px; }

/* Header */
.site-header { background: var(--bg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 92px; max-width: 1920px; margin: 0 auto; padding: 0 40px; position: relative; }
.site-logo { font-family: var(--font); font-size: 1.15rem; font-weight: 700; color: #1a1a1a; }
.site-logo-text { font-family: var(--font); font-size: 1.15rem; font-weight: 700; color: #1a1a1a; letter-spacing: -.01em; }
.site-logo-img { height: 68px; width: auto; display: block; }
.site-nav { display: flex; align-items: center; gap: 40px; position: absolute; left: 50%; transform: translateX(-50%); }
.site-nav a { position: relative; color: var(--text-muted); font-family: var(--font); font-size: .95rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding-bottom: 6px; transition: color .15s; }
.site-nav a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--text); transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
.site-nav a:hover { color: var(--text); }
.site-nav a:hover::after { transform: scaleX(1); }
.site-nav a.nav-active { color: var(--text); }
.site-nav a.nav-active::after { transform: scaleX(1); }

.site-auth { display: flex; align-items: center; gap: 18px; }
.site-auth a { color: var(--text-muted); font-family: var(--font); font-size: .82rem; font-weight: 600; transition: color .15s; }
.site-auth a:hover { color: var(--text); }
.site-auth-desktop { display: flex; align-items: center; gap: 18px; }

/* Mobile nav toggle (hamburger) — hidden on desktop, shown under the
   .site-header responsive breakpoint below. .site-nav is centered via
   position:absolute (independent of the logo/auth flex items, so it never
   reflows away from them) — real-Chrome width testing (headless screenshots
   at 20px increments) found it starting to touch the logo at ~900px wide and
   visibly overlapping by 880px, pre-existing regardless of the Phase 6/Paket
   3 <picture> logo markup (confirmed pixel-identical at every width against
   a pre-<picture> backup). The breakpoint below (960px) keeps a safety
   margin above that measured collision range. */
.mobile-menu-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 8px; background: none; border: none; border-radius: 6px; cursor: pointer; flex-shrink: 0; }
.mobile-menu-toggle:hover { background: var(--surface); }
.mobile-menu-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.mobile-menu-icon, .mobile-menu-icon::before, .mobile-menu-icon::after { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 1px; transition: transform .2s ease, background .2s ease; }
.mobile-menu-icon { position: relative; }
.mobile-menu-icon::before { content: ''; position: absolute; top: -7px; left: 0; }
.mobile-menu-icon::after { content: ''; position: absolute; top: 7px; left: 0; }
.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon { background: transparent; }
.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon::before { transform: translateY(7px) rotate(45deg); }
.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon::after { transform: translateY(-7px) rotate(-45deg); }
/* Logged-in mobile trigger: same button/tap-target, avatar instead of the
   hamburger glyph. Same #mobile-menu-panel, same JS toggle — only the
   visual changes for authenticated users; logged-out users keep the icon. */
.mobile-menu-toggle-avatar { padding: 0; }
.mobile-menu-avatar-img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; display: block; }
.mobile-menu-avatar-fallback { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--on-inverse); display: flex; align-items: center; justify-content: center; font-family: var(--font); font-weight: 700; font-size: .85rem; }

.mobile-menu-panel[hidden] { display: none; }
.mobile-menu-panel { display: flex; flex-direction: column; padding: 4px 20px 16px; border-top: 1px solid var(--border); background: var(--bg); }
.mobile-menu-nav { display: flex; flex-direction: column; }
.mobile-menu-nav a { padding: 14px 4px; font-family: var(--font); font-size: 1rem; font-weight: 600; color: var(--text); border-bottom: 1px solid var(--border); }
.mobile-menu-nav a:focus-visible, .mobile-menu-auth a:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.mobile-menu-nav a.nav-active { color: var(--brand); }
.mobile-menu-auth { display: flex; flex-direction: column; padding-top: 4px; }
.mobile-menu-auth a { padding: 14px 4px; font-family: var(--font); font-size: .95rem; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.mobile-menu-auth a:last-child { border-bottom: none; }

@media (max-width: 960px) {
  .header-inner { padding: 0 16px; height: 68px; }
  .site-nav, .site-auth-desktop { display: none; }
  .mobile-menu-toggle { display: flex; }
  .site-logo-img { height: 44px; }
}
.notif-wrap { position: relative; }
.notif-bell { position: relative; font-size: 1.05rem; line-height: 1; background: none; border: none; cursor: pointer; padding: 4px; color: var(--text-muted); }
.notif-bell:hover { color: var(--text); }
.notif-badge { position: absolute; top: -6px; right: -8px; background: var(--danger-solid, #c53030); color: var(--on-inverse); font-size: .62rem; font-weight: 700; padding: 1px 5px; border-radius: 999px; min-width: 15px; text-align: center; line-height: 1.4; }
.notif-badge[hidden] { display: none; }
.site-body { min-height: calc(100vh - 92px - 64px); padding: 52px 0 72px; }

/* Header search (icon toggles a floating panel — identical behavior on
   desktop and mobile since the site nav has no hamburger/collapse system
   to integrate with). */
.header-search { position: relative; }
.header-search-btn { background: none; border: none; cursor: pointer; padding: 4px; font-size: 1.05rem; line-height: 1; color: var(--text-muted); }
.header-search-btn:hover { color: var(--text); }
.header-search-panel { position: absolute; top: calc(100% + 14px); right: -10px; width: 320px; max-width: calc(100vw - 32px); background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px var(--shadow-color); padding: 12px; z-index: 60; }
.header-search-panel[hidden] { display: none; }
.header-search-form { display: flex; gap: 8px; }
.header-search-input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font-family: var(--font); font-size: .88rem; }
.header-search-submit { flex-shrink: 0; background: var(--brand); color: #fff; border: none; border-radius: 8px; padding: 0 12px; cursor: pointer; font-size: .95rem; }
.header-search-submit:hover { opacity: .9; }

/* Notification dropdown (header bell) */
.notif-dropdown { position: absolute; top: calc(100% + 14px); right: -10px; width: 360px; max-width: calc(100vw - 32px); background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px var(--shadow-color); overflow: hidden; z-index: 60; }
.notif-dropdown[hidden] { display: none; }
.notif-dropdown-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); font-family: var(--font); font-weight: 700; font-size: .92rem; color: var(--text); }
.notif-mark-all { background: none; border: none; color: var(--brand); font-family: var(--font); font-size: .78rem; font-weight: 600; cursor: pointer; padding: 0; }
.notif-mark-all:hover { text-decoration: underline; }
.notif-dropdown-list { max-height: 380px; overflow-y: auto; }
.notif-dropdown-loading, .notif-dropdown-empty { padding: 28px 18px; text-align: center; font-family: var(--font); font-size: .85rem; color: var(--text-faint); }
.notif-skeleton-row { display: flex; align-items: center; gap: 10px; padding: 14px 18px; }
.notif-skeleton-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.notif-skeleton-line { flex: 1; height: 10px; border-radius: 5px; background: var(--border-strong); }
.notif-skeleton-row:nth-child(2) .notif-skeleton-line { width: 80%; }
.notif-skeleton-row:nth-child(3) .notif-skeleton-line { width: 60%; }
@media (prefers-reduced-motion: no-preference) {
  .notif-skeleton-dot, .notif-skeleton-line { animation: notifSkeletonPulse 1.2s ease-in-out infinite; }
}
@keyframes notifSkeletonPulse { 0%, 100% { opacity: .4; } 50% { opacity: .9; } }
.notif-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border-subtle); }
.notif-item:last-child { border-bottom: none; }
.notif-item.is-unread { background: var(--brand-tint); }
.notif-item-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: transparent; }
.notif-item.is-unread .notif-item-dot { background: var(--brand); }
.notif-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.notif-item-msg { color: var(--text); font-family: var(--font); font-size: .84rem; line-height: 1.4; }
a.notif-item-msg:hover { color: var(--brand); }
.notif-item-time { font-size: .72rem; color: var(--text-faint); }
.notif-item-toggle { flex-shrink: 0; background: none; border: none; color: var(--text-fainter); font-family: var(--font); font-size: .7rem; font-weight: 600; cursor: pointer; padding: 2px 0; white-space: nowrap; }
.notif-item-toggle:hover { color: var(--brand); }
.notif-dropdown-viewall { display: block; text-align: center; padding: 12px; border-top: 1px solid var(--border); font-family: var(--font); font-size: .82rem; font-weight: 600; color: var(--brand); background: var(--surface-alt); }
.notif-dropdown-viewall:hover { background: var(--surface-hover); }

/* Notifications page */
.notif-page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 8px; }
.notif-page-title { display: flex; align-items: center; gap: 12px; }
.notif-page-title h1 { margin-bottom: 0; }
.notif-unread-pill { font-family: var(--font); font-size: .72rem; font-weight: 700; color: var(--on-inverse); background: var(--brand); padding: 3px 11px; border-radius: 999px; }
.notif-page-actions { display: flex; gap: 10px; }
.notif-page-sub { font-family: var(--font); font-size: .85rem; color: var(--text-faint); margin-bottom: 26px; }
.notif-page-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg); }
.notif-page-row { display: flex; align-items: flex-start; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--border-subtle); transition: background .15s; }
.notif-page-row:last-child { border-bottom: none; }
.notif-page-row.is-unread { background: var(--brand-tint); }
.notif-page-icon { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.notif-page-icon.type-approved { background: var(--success-bg); color: var(--success-text); }
.notif-page-icon.type-rejected { background: var(--danger-bg); color: var(--danger-text); }
.notif-page-icon.type-reply { background: var(--brand-tint); color: var(--brand); }
.notif-page-icon.type-default { background: var(--surface-alt); color: var(--text-faint); }
.notif-page-body { flex: 1; min-width: 0; }
.notif-page-message { font-family: var(--font); font-size: .92rem; color: var(--text); line-height: 1.5; }
a.notif-page-message:hover { color: var(--brand); }
.notif-page-date { display: block; margin-top: 5px; font-size: .76rem; color: var(--text-faint); }
.notif-page-toggle { flex-shrink: 0; background: none; border: 1px solid var(--border-strong); color: var(--text-muted); font-family: var(--font); font-size: .74rem; font-weight: 600; cursor: pointer; padding: 6px 14px; border-radius: 999px; white-space: nowrap; transition: all .15s; }
.notif-page-toggle:hover { border-color: var(--brand); color: var(--brand); }
.notif-page-empty { text-align: center; padding: 64px 20px; font-family: var(--font); color: var(--text-faint); }
.notif-page-empty-icon { font-size: 2.4rem; margin-bottom: 14px; opacity: .5; }

/* Hero */
.home-hero { margin-bottom: 20px; }
.home-hero-title { font-family: var(--font); font-size: clamp(42px, 5.5vw, 64px); font-weight: 700; line-height: 110%; letter-spacing: -0.05rem; color: var(--text-strong); margin-bottom: 14px; }
.home-hero-sub { font-family: var(--font); font-size: 1.125rem; color: var(--text-body); max-width: 480px; line-height: 130%; letter-spacing: -0.0315rem; }

/* Category pills */
.category-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 40px; }
.pill { display: inline-block; padding: 8px 20px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font-family: var(--font); font-size: .8rem; font-weight: 500; transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.pill:hover { transform: translateY(-2px); background: var(--brand-tint); border-color: var(--brand); color: var(--brand); box-shadow: 0 6px 14px var(--shadow-color); }
.pill-active, .pill-active:hover { background: var(--brand); border-color: var(--brand); color: #fff; transform: none; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .pill { transition: none; } .pill:hover { transform: none; } }

/* Home grid */
.home-grid { display: grid; grid-template-columns: 1fr 340px; gap: 40px; margin-bottom: 60px; align-items: start; }

/* Featured post */
.featured-post { display: flex; flex-direction: column; }
.featured-post--cat { margin-bottom: 48px; }
.featured-img { width: 100%; aspect-ratio: 4/3; max-height: 460px; object-fit: cover; border-radius: 4px; display: block; }
.featured-body { padding: 20px 0 0; display: flex; flex-direction: column; gap: 10px; }
.featured-title { font-family: var(--font); font-size: 1.65rem; font-weight: 700; line-height: 1.2; color: var(--text); }
.featured-title a { color: inherit; }
.featured-excerpt { font-family: var(--font); font-size: .9rem; color: var(--text-muted); line-height: 1.6; }

/* Card meta */
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-family: var(--font); font-size: .75rem; color: var(--text-faint); margin-top: 2px; }

/* Posts grid */
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 32px; margin-bottom: 48px; }
/* Framed post cards with hover lift + image zoom (blog, category, series,
   landing, related-posts — all share this class). */
.post-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.post-card > a { display: block; overflow: hidden; }
.post-card-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; transition: transform .35s ease; }
.post-card-body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 16px 20px 22px; }
.post-card-title { font-family: var(--font); font-size: 1.05rem; font-weight: 700; line-height: 1.3; color: var(--text); }
.post-card-title a { color: inherit; transition: color .2s ease; }
.post-card-excerpt { font-family: var(--font); font-size: .85rem; color: var(--text-muted); line-height: 1.55; }
.post-card:hover { transform: translateY(-5px) scale(1.015); box-shadow: 0 16px 36px var(--shadow-color); border-color: var(--border-strong); }
.post-card:hover .post-card-img { transform: scale(1.06); }
.post-card:hover .post-card-title a { color: var(--brand); }

/* Breadcrumb */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-family: var(--font); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-fainter); margin-bottom: 20px; }
.breadcrumb a { color: var(--text-fainter); }
.breadcrumb-sep { color: var(--text-fainter); }
.breadcrumb-current { color: var(--text-fainter); }

/* Category hero */
.cat-hero { margin-bottom: 24px; }
.cat-hero-title { font-family: var(--font); font-size: clamp(32px, 4vw, 52px); font-weight: 700; letter-spacing: -.03em; color: var(--text); margin-bottom: 10px; }
.cat-hero-desc { font-family: var(--font); font-size: .95rem; color: var(--text-muted); max-width: 520px; line-height: 1.6; }
.series-hero-stats { display: flex; flex-wrap: wrap; gap: 18px; font-family: var(--font); font-size: .8rem; color: var(--text-faint); margin-top: 10px; }
.series-connection-box { margin-top: 40px; padding: 28px; background: var(--surface-alt); border-radius: 12px; }
.series-connection-box h2 { font-family: var(--font); font-size: 1.1rem; margin-bottom: 8px; }
.series-connection-box > p { font-family: var(--font); font-size: .9rem; color: var(--text-muted); margin-bottom: 20px; }

.related-articles-box { margin-top: 40px; padding: 28px; background: var(--surface-alt); border-radius: 12px; }
.related-articles-box h2 { font-family: var(--font); font-size: 1.1rem; margin-bottom: 20px; }

.series-prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 24px; }
.series-prev-next-link { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border: 1.5px solid var(--border-strong); border-radius: 10px; text-decoration: none; background: var(--bg); transition: border-color .15s ease; }
.series-prev-next-link:hover { border-color: var(--brand); }
.series-prev-next-next { text-align: right; }
.series-prev-next-label { font-size: .72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.series-prev-next-title { font-size: .88rem; font-weight: 600; color: var(--text); }
@media (max-width: 640px) { .series-prev-next { grid-template-columns: 1fr; } .series-prev-next-next { text-align: left; } }

/* Section hero band (category + series pages) — compact always-dark teal
   gradient, same family as .tw-hero but static (no typewriter/strands). */
.section-hero { position: relative; overflow: hidden; border-radius: 16px; margin-bottom: 28px; background: linear-gradient(135deg, #0b2b2b 0%, #14494a 55%, #1d5f5f 100%); }
.section-hero::before { content: ""; position: absolute; top: -60%; right: -8%; width: 50%; height: 170%; background: radial-gradient(closest-side, rgba(94, 209, 198, .22), transparent 70%); pointer-events: none; animation: twGlowA 14s ease-in-out infinite alternate; }
.section-hero-inner { position: relative; padding: 30px 40px 32px; }
.section-hero-title { font-family: var(--font); font-size: clamp(26px, 3.2vw, 38px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; color: #fff; margin: 0 0 8px; }
.section-hero-desc { font-family: var(--font); font-size: .92rem; color: rgba(255, 255, 255, .82); line-height: 1.6; max-width: 640px; margin: 0; }
.section-hero-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.section-hero-stat { display: inline-flex; align-items: center; padding: 5px 14px; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); color: #fff; font-family: var(--font); font-size: .75rem; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .section-hero::before { animation: none; } }
@media (max-width: 640px) { .section-hero-inner { padding: 22px 20px 24px; } }

/* Community Discussion CTA under posts (blog <-> forum bridge) — always-dark
   brand-teal gradient, same deliberate convention as .tw-hero. */
.discussion-cta { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; margin-top: 40px; padding: 26px 30px; background: linear-gradient(135deg, #0b2b2b 0%, #14494a 55%, #1d5f5f 100%); border-radius: 16px; }
.discussion-cta::before { content: ""; position: absolute; top: -70%; right: -6%; width: 45%; height: 180%; background: radial-gradient(closest-side, rgba(94, 209, 198, .22), transparent 70%); pointer-events: none; }
.discussion-cta-info { position: relative; min-width: 0; }
.discussion-cta-title { display: flex; align-items: center; gap: 10px; font-family: var(--font); font-size: 1.15rem; font-weight: 700; color: #fff; margin-bottom: 6px; }
.discussion-cta-title svg { width: 20px; height: 20px; color: #6fd6cb; flex-shrink: 0; }
.discussion-cta-info p { font-family: var(--font); font-size: .88rem; color: rgba(255, 255, 255, .8); margin: 0; }
.discussion-cta-btn { position: relative; background: #fff; color: #14494a; flex-shrink: 0; transition: transform .15s ease, opacity .15s ease; }
.discussion-cta-btn:hover { transform: translateY(-2px); opacity: .9; }
@media (prefers-reduced-motion: reduce) { .discussion-cta-btn { transition: none; } .discussion-cta-btn:hover { transform: none; } }

/* "NEW" badge on forum topics published within the last 24h (computed in SQL,
   immune to PHP/MySQL clock skew). Blinks gently; solid under reduced motion. */
.topic-new-badge { display: inline-flex; align-items: center; flex-shrink: 0; padding: 4px 11px; border-radius: 999px; background: var(--brand); color: #fff; font-family: var(--font); font-size: .72rem; font-weight: 800; letter-spacing: .08em; line-height: 1.4; animation: newBadgeBlink 1.3s ease-in-out infinite; }
@keyframes newBadgeBlink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .topic-new-badge { animation: none; } }

/* Forum welcome notice (onboarding CTA to Start Here) */
.forum-welcome-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; padding: 16px 20px; background: var(--brand-tint); border: 1px solid var(--brand-tint-border); border-radius: 10px; }
.forum-welcome-notice p { font-family: var(--font); font-size: .88rem; color: var(--brand); }
.forum-welcome-notice .btn { flex-shrink: 0; }
@media (max-width: 600px) { .forum-welcome-notice { flex-direction: column; align-items: flex-start; } }

/* Forum community stats — premium card treatment: soft shadow + lift on
   hover, divider lines between list rows instead of raw gaps, small line
   icons per card (matches the existing discussion-cta icon style), a
   numbered rank chip for Top Contributors. Same data/functionality as
   before, presentation only. */
.forum-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 32px; }
.forum-stat-card { border: 1px solid var(--border-strong); border-radius: 12px; padding: 18px 18px 16px; background: var(--surface); box-shadow: 0 1px 3px var(--shadow-color); transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease; }
.forum-stat-card:hover { box-shadow: 0 8px 22px var(--shadow-color); border-color: var(--border); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .forum-stat-card { transition: none; } .forum-stat-card:hover { transform: none; } }
.forum-stat-title { display: flex; align-items: center; gap: 8px; font-family: var(--font); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--brand); margin-bottom: 14px; }
.forum-stat-title svg { width: 15px; height: 15px; flex-shrink: 0; }
.forum-stat-list { list-style: none; display: flex; flex-direction: column; }
.forum-stat-list li { display: flex; flex-direction: column; gap: 3px; font-family: var(--font); padding: 9px 0; border-bottom: 1px solid var(--border-subtle); }
.forum-stat-list li:first-child { padding-top: 0; }
.forum-stat-list li:last-child { border-bottom: none; padding-bottom: 0; }
.forum-stat-list a { font-size: .85rem; color: var(--text); font-weight: 500; line-height: 1.35; }
.forum-stat-list a:hover { color: var(--brand); }
.forum-stat-num { font-size: .72rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.forum-stat-member { flex-direction: row !important; align-items: center; gap: 9px !important; }
.forum-stat-rank { flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-alt); color: var(--text-faint); display: flex; align-items: center; justify-content: center; font-family: var(--font); font-size: .68rem; font-weight: 700; }
.forum-stat-member-name { flex: 1; font-size: .85rem; color: var(--text); font-weight: 500; }
@media (max-width: 720px) { .forum-stats { grid-template-columns: 1fr; } }

/* Medical disclaimer (shared across Blog / Forum / Q&A) */
.medical-disclaimer { display: flex; gap: 14px; align-items: flex-start; margin-top: 40px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.medical-disclaimer-icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; color: var(--brand); }
.medical-disclaimer-body { min-width: 0; }
.medical-disclaimer-title { font-family: var(--font); font-size: .85rem; font-weight: 700; color: var(--text); margin: 0 0 8px; }
.medical-disclaimer-body p { font-family: var(--font); font-size: .8rem; line-height: 1.6; color: var(--text-muted); margin-bottom: 8px; }
.medical-disclaimer-body p:last-child { margin-bottom: 0; }
@media (max-width: 600px) { .medical-disclaimer { padding: 16px; gap: 10px; } }

/* Single post */
/* Article column: wide, anchored next to the TOC (not centered) — the page
   wrapper .post-container is uncapped so the TOC pins to the screen's left
   edge on every monitor width. */
.single-post { max-width: 1240px; margin: 0; }
/* Forum question/reply page only (question.php) — unlike blog posts, this
   .single-post has no .toc-sidebar next to it in .post-layout, so the base
   rule's margin:0 leaves it flush against the left edge of the wide
   .container on large screens instead of centered. Scoped to this modifier
   class specifically so blog's intentional left-anchored layout (comment
   above) is untouched. Centering here also leaves clean, ready-made side
   margins for a future left/right ad rail without another layout change. */
.single-post.single-post-centered { margin: 0 auto; }
.single-title { font-family: var(--font); font-size: clamp(28px, 3.8vw, 44px); font-weight: 700; line-height: 1.15; letter-spacing: -.028em; color: var(--text); margin-bottom: 22px; }
.single-title::before { content: ""; display: block; width: 56px; height: 4px; background: var(--brand); border-radius: 2px; margin-bottom: 16px; }
.post-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 32px; }
.byline-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 15px; border: 1px solid var(--brand-tint-border); background: var(--brand-tint); color: var(--brand); border-radius: 999px; font-family: var(--font); font-size: .8rem; font-weight: 600; text-decoration: none; }
.byline-pill svg { width: 14px; height: 14px; flex-shrink: 0; }
.byline-pill-link { transition: background .15s ease, color .15s ease, border-color .15s ease; }
.byline-pill-link:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
/* Featured image with an offset teal "mat" frame behind it. */
.single-featured-wrap { position: relative; margin: 0 0 40px; padding: 0 14px 14px 0; }
.single-featured-wrap::before { content: ""; position: absolute; top: 14px; left: 14px; right: 0; bottom: 0; background: var(--brand-tint); border: 2px solid var(--brand-tint-border); border-radius: 16px; }
.single-featured-image { position: relative; width: 100%; aspect-ratio: 16/9; max-height: 460px; object-fit: cover; display: block; box-shadow: 0 12px 32px var(--shadow-color); }

/* Post content */
.post-content { font-family: var(--font); font-size: 1.125rem; font-weight: 400; line-height: 130%; letter-spacing: -0.0315rem; color: var(--text-body); }
.post-content p { margin: 0 auto 1em; color: var(--text-body); font-size: 1.125rem; line-height: 130%; letter-spacing: -0.0315rem; }
.post-content h2 { font-size: 1.4rem; font-weight: 700; margin: 36px 0 12px; color: var(--text-strong); letter-spacing: -0.02em; line-height: 120%; }
.post-content h3 { font-size: 1.15rem; font-weight: 700; margin: 28px 0 10px; color: var(--text-strong); letter-spacing: -0.015em; line-height: 120%; }
.post-content ul, .post-content ol { margin: 0 0 1em 22px; }
.post-content li { margin-bottom: 6px; color: var(--text-body); font-size: 1.125rem; line-height: 130%; letter-spacing: -0.0315rem; }
.post-content blockquote { border-left: 3px solid var(--border-strong); padding: 12px 20px; background: var(--surface); margin: 24px 0; border-radius: 0 6px 6px 0; font-style: italic; color: var(--text-faint); }
.post-content img { display: block; border-radius: 6px; margin: 24px auto; max-width: 100%; height: auto; box-shadow: 0 2px 12px var(--shadow-color); }

/* Post content image classes */
.post-content .img-responsive { max-width: 100%; height: auto; display: block; }
.post-content .img-rounded { border-radius: 12px; }
.post-content .img-circle { border-radius: 50%; max-width: 200px; margin: 24px auto; }

/* Sources */
.post-sources { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); }
.post-sources h2 { font-family: var(--font); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-fainter); margin-bottom: 10px; }
.post-sources ol { margin-left: 18px; font-size: .82rem; color: var(--text-faint); }
.post-sources a { color: var(--text-faint); text-decoration: underline; }

/* Contact */
.contact-wrap { max-width: 580px; margin: 0 auto; }
.contact-wrap h1 { font-family: var(--font); font-size: 2rem; font-weight: 700; margin-bottom: 28px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-family: var(--font); font-size: .82rem; font-weight: 600; color: var(--text-body); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: .95rem; font-family: inherit; outline: none; transition: border .2s; background: var(--surface); }
input:focus, textarea:focus { border-color: var(--text); background: var(--bg); }
textarea { resize: vertical; }

.form-check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.form-check input[type=checkbox] { margin-top: 3px; }
.form-check label { font-size: .85rem; color: var(--text-muted); font-weight: 400; }
.form-check a { color: var(--text); text-decoration: underline; }
.field-hint { font-size: .78rem; color: var(--text-faint); margin-top: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; padding: 10px 26px; border-radius: 999px; font-family: var(--font); font-size: .9rem; font-weight: 600; cursor: pointer; border: none; transition: opacity .15s; }
.btn-primary { background: var(--btn-primary-bg); color: var(--on-inverse); }
.btn-primary:hover { opacity: .75; }
.btn-secondary { background: var(--btn-secondary-bg); color: var(--text); }
.btn-secondary:hover { opacity: .75; }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.btn-sm { padding: 6px 16px; font-size: .78rem; }

/* Google sign-in — sits above the existing email form on /login and /register */
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 11px 16px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--bg); color: var(--text); font-family: var(--font); font-size: .92rem; font-weight: 600; text-decoration: none; transition: background .15s, border-color .15s; }
.btn-google:hover { background: var(--surface-hover); border-color: var(--text-faint); }
.btn-google-logo { flex-shrink: 0; }
.auth-divider { display: flex; align-items: center; gap: 14px; margin: 20px 0; color: var(--text-faint); font-size: .8rem; text-transform: lowercase; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.google-onboarding-note { margin: -8px 0 22px; font-size: .88rem; line-height: 1.55; color: var(--text-muted); }

/* Editorial Workspace — admin-only preview toolbar shown above a draft's real preview page */
.editorial-preview-bar { background: var(--editorial-bg); border-bottom: 1px solid var(--editorial-border); padding: 7px 24px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-family: var(--font); font-size: .8rem; }
.editorial-preview-bar strong { color: var(--editorial-text); font-weight: 600; }
.editorial-preview-bar .btn-sm { padding: 5px 14px; }
.btn-danger:hover { background: var(--danger-border); opacity: 1; }

/* Alerts */
.alert { padding: 13px 16px; border-radius: 6px; margin-bottom: 18px; font-size: .9rem; }
.alert-success { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success-text); }
.alert-error { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger-text); }
.alert-warning { background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning-text); }
.alert-info { background: var(--brand-tint); border: 1px solid var(--brand-tint-border); color: var(--brand); }

/* Account page */
.account-section { padding: 24px 0; border-top: 1px solid var(--border); }
.account-section:first-of-type { border-top: none; padding-top: 0; }
.account-section h2 { font-family: var(--font); font-size: 1.05rem; font-weight: 700; margin-bottom: 12px; }

/* Account tabs — hidden by default (no-JS fallback: every panel below stays
   plain-visible, stacked exactly like the pre-tab page) and revealed by JS
   once it confirms it can actually drive the panel switching. Horizontal
   scroll (rather than wrapping) keeps 6 tabs from ever overlapping at any
   width, including 320px, without a separate mobile-only layout. */
.account-tabs { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; margin-bottom: 24px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.account-tabs::-webkit-scrollbar { height: 5px; }
.account-tab-btn { flex-shrink: 0; border: none; background: none; cursor: pointer; font-family: var(--font); font-size: .82rem; font-weight: 600; color: var(--text-muted); padding: 9px 14px; border-radius: 7px; white-space: nowrap; transition: background .15s, color .15s; }
.account-tab-btn:hover { background: var(--surface-hover); color: var(--text); }
.account-tab-btn.is-active { background: var(--brand); color: var(--on-inverse); }
.account-tab-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.account-tab-panel[hidden] { display: none; }
.account-panel-heading { font-family: var(--font); font-size: 1.3rem; font-weight: 700; margin: 0 0 20px; }
@media (max-width: 480px) {
  .account-tab-btn { font-size: .78rem; padding: 8px 12px; }
}
/* Desktop-only widening — scoped to .account-wrap alone (an extra class on
   account.php's existing .contact-wrap, not a change to .contact-wrap
   itself) so every other page still using .contact-wrap (login, register,
   contact, notifications, ...) keeps its original 580px width. At 580px the
   six account tabs ("Account & Privacy" alone needs ~155px) don't fit on
   one line and fall back to horizontal scroll even on wide screens; widening
   just this page's content column lets them sit on one row with room to
   spare. Below 769px this rule doesn't apply at all, so the existing mobile
   horizontal-scroll tab bar is untouched. */
@media (min-width: 769px) {
  .account-wrap { max-width: 1080px; }
}

/* Pagination */
.pagination { display: flex; gap: 6px; margin-top: 40px; flex-wrap: wrap; }
.page-link { padding: 7px 16px; border: 1px solid var(--border-strong); border-radius: 999px; font-family: var(--font); font-size: .82rem; color: var(--text-muted); font-weight: 500; transition: background .15s; }
.page-link.active { background: var(--pill-active-bg); color: var(--on-inverse); border-color: var(--pill-active-bg); }
.page-link:hover { background: var(--surface-hover); }

.no-content { font-family: var(--font); color: var(--text-fainter); text-align: center; padding: 60px 0; font-size: .95rem; }

/* Forum */
.forum-board { border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; margin-bottom: 28px; }
.forum-topics { background: var(--bg); }

/* Forum home — category + board-row layout */
.forum-category { margin-bottom: 32px; }
.forum-category-header { font-family: var(--font); font-size: 1.05rem; font-weight: 700; color: var(--on-inverse); background: var(--brand); padding: 12px 22px; border-radius: 8px 8px 0 0; margin: 0; }
.forum-board-row { display: flex; border: 1px solid var(--border-strong); border-top: none; }
.forum-category .forum-board-row:first-of-type { border-top: none; }
.forum-board-row + .forum-board-row { border-top: 1px solid var(--border-strong); }
.forum-board-info { display: flex; flex-direction: column; width: 320px; flex-shrink: 0; border-right: 1px solid var(--border); background: var(--surface); }
.forum-board-thumb { flex-shrink: 0; display: block; width: calc(100% - 28px); height: 120px; margin: 14px 14px 0; border-radius: 10px; overflow: hidden; }
.forum-board-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.forum-board-thumb-fallback { width: 100%; height: 100%; background: #3a4a63; color: var(--on-inverse); display: flex; align-items: center; justify-content: center; font-family: var(--font); font-weight: 700; font-size: 1.6rem; }
.forum-board-meta { padding: 16px 20px; }
.forum-board-meta h3 { font-family: var(--font); font-size: .98rem; font-weight: 700; margin: 0 0 4px; }
.forum-board-meta h3 a { color: var(--text); }
/* Clamped to exactly 2 lines (and reserves that height even when the
   description is short or empty — public.php always renders this element
   now) so every board row in a category is the same height regardless of
   description length. */
.forum-board-desc { font-family: var(--font); font-size: .8rem; color: var(--text-muted); line-height: 1.5; margin: 0 0 8px; min-height: 3em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.forum-board-count { font-family: var(--font); font-size: .72rem; font-weight: 600; color: var(--text-faint); }
.forum-board-recent { flex: 1; min-width: 0; background: var(--bg); }
.forum-recent-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border-subtle); }
.forum-recent-row:last-child { border-bottom: none; }
.forum-recent-row:hover { background: var(--surface); }
.forum-mini-avatar, .forum-mini-avatar-img { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.forum-mini-avatar { background: var(--brand); color: var(--on-inverse); display: flex; align-items: center; justify-content: center; font-family: var(--font); font-weight: 700; font-size: .8rem; }
.forum-mini-avatar-img { object-fit: cover; }
.forum-recent-body { flex: 1; min-width: 0; }
.forum-recent-title { display: block; font-family: var(--font); font-size: .88rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.forum-recent-meta { font-family: var(--font); font-size: .74rem; color: var(--text-faint); margin-top: 2px; }
.forum-recent-replies { font-family: var(--font); font-size: .74rem; color: var(--text-faint); white-space: nowrap; flex-shrink: 0; }
.forum-topic-row { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--border-subtle); }
.forum-topic-row:last-child { border-bottom: none; }
.forum-topic-row:hover { background: var(--surface); }
.forum-topic-row a { font-family: var(--font); font-size: .95rem; font-weight: 600; color: var(--text); flex: 1; }
.forum-topic-date { font-family: var(--font); font-size: .78rem; color: var(--text-faint); white-space: nowrap; }
.forum-topic-empty { padding: 16px 22px; font-family: var(--font); font-size: .85rem; color: var(--text-fainter); }
.forum-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.forum-ask-btn { flex-shrink: 0; }

/* Forum board (single board's topic list) — kept visually distinct from the blog's cat-hero/pills */
.board-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.board-hero-title { font-family: var(--font); font-size: clamp(28px, 3.6vw, 44px); font-weight: 700; letter-spacing: -.03em; color: var(--text); margin-bottom: 8px; }
.board-hero-desc { font-family: var(--font); font-size: .92rem; color: var(--text-muted); max-width: 560px; line-height: 1.6; }
.board-topic-list { border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: var(--bg); }
.board-topic-row { display: flex; align-items: center; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--border-subtle); }
.board-topic-row:last-child { border-bottom: none; }
.board-topic-row:hover { background: var(--surface); }
/* Pinned rows: a faint tint + left rail, never a loud color — pinned topics
   already sort first (ORDER BY is_pinned DESC in forum-board.php's query),
   this is just a quiet visual cue on top of that. */
.board-topic-row.is-pinned { background: var(--surface-alt); border-left: 3px solid var(--border-strong); padding-left: 19px; }
.board-topic-row.is-pinned:hover { background: var(--surface); }
.topic-pinned-badge { display: inline-flex; align-items: center; font-family: var(--font); font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); background: var(--surface); border: 1px solid var(--border-strong); padding: 2px 8px; border-radius: 999px; margin-right: 7px; vertical-align: middle; }
.board-topic-main { flex: 1; min-width: 0; }
.board-topic-title { font-family: var(--font); font-size: .95rem; font-weight: 700; }
.board-topic-title a { color: var(--text); }
.board-topic-title a:hover { color: var(--brand); }
.board-topic-meta { font-family: var(--font); font-size: .78rem; color: var(--text-faint); margin-top: 3px; }
.board-topic-stats { flex-shrink: 0; text-align: right; }
.board-topic-counts { display: flex; gap: 8px; justify-content: flex-end; }
.board-topic-replies, .board-topic-views { font-family: var(--font); font-size: .85rem; font-weight: 700; color: var(--text); }
.board-topic-views { color: var(--text-faint); font-weight: 600; }
.board-topic-last { font-family: var(--font); font-size: .74rem; color: var(--text-faint); margin-top: 3px; white-space: nowrap; }
.board-topic-last-empty { color: var(--text-fainter); }
.board-topic-activity { font-family: var(--font); font-size: .7rem; color: var(--text-fainter); margin-top: 1px; white-space: nowrap; }
@media (max-width: 640px) {
  .board-topic-stats { text-align: left; }
  .board-topic-counts { justify-content: flex-start; }
  .board-topic-last, .board-topic-activity { white-space: normal; }
  .board-topic-row.is-pinned { padding-left: 19px; }
}

/* Small verified checkmark for the official team account — appears inline
   next to "Hairloss Authority Team" wherever that name is shown. Never
   applied to real member avatars/names. */
.team-badge { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; background: var(--brand); color: var(--on-inverse); font-size: .6rem; line-height: 1; margin-left: 5px; vertical-align: middle; flex-shrink: 0; }

/* My Questions (account page) */
.my-questions-list { list-style: none; }
.my-questions-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); font-family: var(--font); font-size: .9rem; }
.my-questions-row:last-child { border-bottom: none; }
.my-questions-badge { font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.my-questions-badge.alert-success { background: var(--success-bg); color: var(--success-text); }
.my-questions-badge.alert-warning { background: var(--warning-bg); color: var(--warning-text); }
.my-questions-badge.alert-error { background: var(--danger-bg); color: var(--danger-text); }

/* Forum topic (question detail) — light post card, phpBB/XenForo-style layout */
.topic-title { font-family: var(--font); font-size: 1.9rem; font-weight: 700; line-height: 1.25; color: var(--text); margin-bottom: 20px; }
.topic-post { display: flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.topic-post-side { width: 170px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); padding: 26px 16px; text-align: center; }
.topic-post-avatar { width: 88px; height: 88px; border-radius: 50%; background: var(--brand); color: var(--on-inverse); display: flex; align-items: center; justify-content: center; font-family: var(--font); font-weight: 700; font-size: 1.8rem; margin: 0 auto 12px; }
.topic-post-author { font-family: var(--font); font-weight: 700; font-size: .85rem; color: var(--text); line-height: 1.35; }
.topic-post-rank { font-family: var(--font); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); margin-top: 4px; }
.topic-post-main { flex: 1; background: var(--bg); min-width: 0; }
.topic-post-topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 14px 22px; border-bottom: 1px solid var(--border); }
/* Long unbroken strings (usernames, emails) inside title/meta rows must be
   able to break instead of forcing their flex row wider than the viewport —
   this was the root cause behind titles/meta overlapping or the page
   gaining horizontal scroll on narrow iOS/Android screens. */
.topic-title, .topic-post-author, .board-topic-title, .board-topic-meta,
.forum-recent-title, .forum-recent-meta { overflow-wrap: anywhere; }
.topic-post-top-date { font-family: var(--font); font-size: .78rem; color: var(--text-faint); }
.topic-post-badge { font-family: var(--font); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--on-inverse); background: var(--brand); padding: 4px 12px; border-radius: 999px; }
.topic-post-body { padding: 24px 26px; }
.topic-post-signature { margin: 0 26px 20px; padding-top: 14px; border-top: 1px solid var(--border-subtle); font-family: var(--font); font-size: .78rem; font-style: italic; color: var(--text-faint); line-height: 1.5; }
.topic-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.topic-reply-count { font-family: var(--font); font-size: .85rem; font-weight: 600; color: var(--text-faint); margin: 0; }
.topic-reply { margin-top: 20px; }
.reply-form-wrap { margin-top: 28px; }
.forum-topic-reply-count { font-family: var(--font); font-size: .78rem; color: var(--text-faint); white-space: nowrap; }

/* Mobile composer (New Topic / Reply / edit forms — question.php +
   forum-ask.php share this markup: #ask_title/#edit-question-title for the
   title field, textarea.wysiwyg-member for the TinyMCE-backed body). Goal:
   read as a real mobile composer, not a shrunk desktop form — full-width
   breathing room, a bigger title field, and safe-area padding at the bottom
   so the submit button/toolbar never sit under an iPhone's home indicator.
   The editor's own height/toolbar layout is handled by tinymce.init()
   (computed off viewport height, toolbar_sticky, mobile toolbar order) —
   this block only touches the surrounding page chrome. */
@media (max-width: 640px) {
  #ask_title, #edit-question-title {
    font-size: 1.05rem;
    padding: 13px 14px;
  }
  .contact-wrap form .form-group:last-of-type,
  .reply-form-wrap form .form-group:last-of-type {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  /* TinyMCE's own container already goes full-width of its parent; this
     just removes the page gutter that would otherwise make the editor look
     inset/boxed-in like a desktop form field instead of the dominant
     element on screen. */
  .contact-wrap, .reply-form-wrap { padding: 0 2px; }
}

.topic-post-avatar-img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; margin: 0 auto 12px; display: block; cursor: zoom-in; }
/* Inline images pasted into a question/reply body (.post-content img already
   sets max-width:100%/height:auto/etc. for blog posts too — this rule is
   scoped to .topic-post-body specifically so it never touches blog article
   images). Both max-width and max-height are capped so a wide image and a
   tall image are each bounded on their long side, aspect ratio preserved,
   never upscaled (width/height stay auto). Applies uniformly regardless of
   when the image was uploaded — old large inline images get the same cap
   without needing the stored file itself touched. */
/* !important: this is a hard display ceiling, not a default — it must win
   over any stored width/height HTML attribute (already loses to any CSS
   rule regardless) and, more importantly, over a free-drag-resized image
   that saved a larger width/height attribute via the editor's
   object_resizing. Verified in production: no stored question/reply body
   currently has an inline style="" on img (HtmlSanitizer's allowlist has
   never included style on img), so this is defense-in-depth, not a fix for
   an observed bypass. */
.topic-post-body.post-content img,
.topic-post-body .post-content img { max-width: min(600px, 100%) !important; max-height: 600px !important; cursor: zoom-in; }
/* Shared image lightbox (native <dialog>, mirrors .likers-dialog) */
/* Explicit fixed+transform centering instead of relying on the browser's
   default <dialog> auto-centering — that default failed to center (and let
   a large-resolution photo overflow with scrollbars) for real photos in
   testing, so position is pinned here rather than left to the UA. */
.image-lightbox { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; border: none; padding: 0; background: transparent; max-width: 95vw; max-height: 90vh; overflow: visible; }
.image-lightbox::backdrop { background: var(--overlay); }
.image-lightbox img { display: block; width: auto; height: auto; max-width: 95vw; max-height: 90vh; object-fit: contain; border-radius: 6px; }
.image-lightbox-close { position: absolute; top: -14px; right: -14px; width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--surface); color: var(--text); font-size: 1.3rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px var(--shadow-color); }
.image-lightbox-close:hover { color: var(--brand); }
/* At 95vw the -14px offset above pushes the button past the screen edge on a
   phone; tuck it inside the image corner instead. */
@media (max-width: 640px) {
  .image-lightbox-close { top: 8px; right: 8px; }
}
.topic-attachment-img { max-width: 100%; border-radius: 8px; margin: 0 26px 18px; display: block; max-height: 480px; object-fit: contain; }
.topic-attachment-gallery { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 26px 18px; }
.topic-attachment-thumb { width: 160px; height: 160px; object-fit: cover; border-radius: 8px; display: block; }
.topic-post-actions { display: flex; align-items: center; gap: 16px; padding: 0 26px 20px; }
.like-btn { display: inline-flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; width: 32px; height: 32px; font-family: var(--font); font-size: .85rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all .15s; }
.like-btn:hover { border-color: var(--brand); color: var(--brand); }
.like-btn-active { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); }
.like-count-link { background: none; border: none; padding: 0; font-family: var(--font); font-size: .82rem; font-weight: 600; color: var(--brand); cursor: pointer; text-decoration: underline; }
.like-count-static { color: var(--text-faint); text-decoration: none; cursor: default; }
.topic-post-reaction { font-family: var(--font); font-size: .72rem; color: var(--text-faint); margin-top: 6px; }

/* Who-liked modal (native <dialog>) */
.likers-dialog { border: none; border-radius: 10px; padding: 0; width: 340px; max-width: 90vw; box-shadow: 0 12px 40px var(--shadow-color); }
.likers-dialog::backdrop { background: var(--overlay); }
.likers-dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); font-family: var(--font); font-weight: 700; font-size: .95rem; color: var(--text); }
.likers-dialog-close { background: none; border: none; font-size: 1.3rem; line-height: 1; color: var(--text-faint); cursor: pointer; }
.likers-dialog-close:hover { color: var(--text); }
.likers-list { list-style: none; max-height: 320px; overflow-y: auto; }
.likers-list li { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid #f5f5f5; font-family: var(--font); font-size: .85rem; color: var(--text); }
.likers-list li:last-child { border-bottom: none; }
.likers-list-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--on-inverse); display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex-shrink: 0; }
.likers-list-date { margin-left: auto; font-size: .72rem; color: var(--text-fainter); }
.topic-edit-link { font-family: var(--font); font-size: .8rem; font-weight: 600; color: var(--text-faint); }
.topic-edit-link:hover { color: var(--text); text-decoration: underline; }
.quote-block { margin: 0 26px 12px; padding: 10px 14px; background: var(--surface); border-left: 3px solid var(--border-strong); border-radius: 0 6px 6px 0; font-family: var(--font); font-size: .82rem; color: var(--text-muted); font-style: italic; }
.edit-form { padding: 20px 26px; }
.edit-form textarea { width: 100%; }

.avatar-row { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.avatar-preview { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.avatar-preview-fallback { background: var(--brand); color: var(--on-inverse); display: flex; align-items: center; justify-content: center; font-family: var(--font); font-weight: 700; font-size: 1.3rem; }
.avatar-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.avatar-form input[type=file] { font-size: .78rem; max-width: 220px; }
@media (max-width: 640px) {
  .topic-post { flex-direction: column; }
  .topic-post-side { width: auto; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 18px; border-right: none; border-bottom: 1px solid var(--border); }
  .topic-post-side .topic-post-author-link,
  .topic-post-side > div { min-width: 0; }
  .topic-post-avatar, .topic-post-avatar-img { width: 64px; height: 64px; margin: 0 0 6px; }
  .topic-post-avatar { font-size: 1.4rem; }
  /* The link column may shrink with the row but never below the avatar, or the
     global img max-width:100% squeezes a photo avatar into an oval. */
  .topic-post-side .topic-post-author-link { min-width: 64px; }
}

/* Self-declared clinic/industry affiliation — reuses .member-badge-pill's
   shape everywhere (profile, topic/reply author) but a slightly muted tone
   so it reads as a disclosure label, not another merit badge. */
.member-badge-pill-affiliation { background: var(--surface-alt); border-color: var(--border-strong); color: var(--text-muted); }

/* Patient Treatment Journey — a plain fact card + a horizontal staged photo
   strip, styled like the rest of the forum (.topic-post/.forum-stat-card
   tokens), not a generic dashboard widget. */
.journey-card { border: 1px solid var(--border-strong); border-radius: 10px; padding: 20px 22px; margin-top: 18px; background: var(--bg); }
.journey-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.journey-card-title { font-family: var(--font); font-size: 1.05rem; font-weight: 700; color: var(--text); margin: 0; }
.journey-source-tag { font-family: var(--font); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); background: var(--surface); border: 1px solid var(--border-strong); padding: 3px 9px; border-radius: 999px; }
.journey-facts { display: flex; flex-wrap: wrap; gap: 14px 22px; font-family: var(--font); font-size: .84rem; color: var(--text-muted); padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border-subtle); }
.journey-facts strong { display: block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); margin-bottom: 2px; }
.journey-timeline { display: flex; gap: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; padding-bottom: 4px; }
.journey-stage { flex-shrink: 0; width: 110px; display: flex; flex-direction: column; gap: 6px; }
.journey-stage-label { font-family: var(--font); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); text-align: center; }
.journey-stage-photo-wrap { position: relative; width: 100%; aspect-ratio: 3/4; border-radius: 8px; overflow: hidden; background: var(--surface); }
.journey-stage-photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.journey-stage-photo-wrap + .journey-stage-photo-wrap { margin-top: 6px; }
.journey-stage-placeholder { width: 100%; aspect-ratio: 3/4; border-radius: 8px; border: 1px dashed var(--border-strong); background: var(--surface-alt); }
.journey-stage-empty .journey-stage-label { opacity: .55; }
.journey-photo-delete-form { position: absolute; top: 4px; right: 4px; }
.journey-photo-delete-btn { width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; font-size: .85rem; line-height: 1; cursor: pointer; }
.journey-edit-details { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
.journey-edit-details summary { font-family: var(--font); font-size: .85rem; font-weight: 600; color: var(--brand); cursor: pointer; }
.journey-edit-details form { margin-top: 14px; }
.journey-update-form { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
@media (max-width: 640px) {
  .journey-card { padding: 16px; }
  .journey-card-header { flex-wrap: wrap; }
  .journey-stage { width: 92px; }
}

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 44px 0 0; margin-top: 60px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; font-family: var(--font); padding-bottom: 32px; }
.footer-col { display: flex; flex-direction: column; gap: 9px; }
.footer-col-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--text); margin-bottom: 3px; }
.footer-col > a { font-size: .85rem; color: var(--text-muted); font-weight: 500; transition: color .15s; }
.footer-col > a:hover { color: var(--text); }
.footer-brand { padding-right: 20px; }
.footer-brand-name { font-size: 1.05rem; font-weight: 700; color: var(--text); letter-spacing: -.01em; margin-bottom: 8px; }
.footer-brand-desc { font-size: .84rem; color: var(--text-faint); line-height: 1.6; max-width: 320px; }
.social-links { display: flex; gap: 16px; margin-top: 12px; }
.social-links a { color: var(--text-faint); font-weight: 500; font-size: .82rem; }
.social-links a:hover { color: var(--text); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--border); padding: 16px 0 20px; font-family: var(--font); font-size: .78rem; color: var(--text-fainter); }
.footer-disclaimer { color: var(--text-fainter); }
@media (max-width: 760px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 26px; }
  .footer-brand { grid-column: 1 / -1; padding-right: 0; }
}
@media (max-width: 460px) {
  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* Cookie consent banner */
.cookie-consent-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 999;
  background: var(--inverse-surface); color: var(--on-inverse); padding: 18px 24px;
  display: flex; align-items: center; justify-content: center; gap: 24px; flex-wrap: wrap;
  font-family: var(--font); box-shadow: 0 -2px 12px var(--shadow-color);
}
.cookie-consent-banner[hidden] { display: none; }
.cookie-consent-banner p { font-size: .85rem; color: rgba(255,255,255,.85); max-width: 640px; margin: 0; line-height: 1.5; }
.cookie-consent-banner a { color: var(--on-inverse); text-decoration: underline; }
.cookie-consent-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-consent-actions .btn { padding: 8px 18px; font-size: .85rem; }
.cookie-consent-actions .btn:not(.btn-primary) { border: 1.5px solid rgba(255,255,255,.4); color: var(--on-inverse); }

/* Responsive */
@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
  .featured-img { aspect-ratio: 16/9; max-height: 320px; }
  .forum-board-row { flex-direction: column; }
  .forum-board-info { width: auto; border-right: none; border-bottom: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .single-title { font-size: 1.6rem; }
  .home-hero-title { font-size: 2.4rem; }
  .cat-hero-title { font-size: 1.8rem; }
  .post-byline { gap: 8px; }
  .posts-grid { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
}

/* ── Table of Contents ──────────────────────────────────────── */
h2[id^="toc-"], h3[id^="toc-"] { scroll-margin-top: 112px; }
/* Full-bleed article layout: no width cap and no centering, so the TOC sits
   at the screen's left edge regardless of monitor width (a 1920px cap made
   it drift toward the middle on wider screens). */
.post-container { max-width: none; }
.post-layout {
  display: flex;
  align-items: flex-start;
  gap: 48px;
}
.toc-sidebar {
  width: 360px;
  flex-shrink: 0;
  position: sticky;
  top: 100px;
}
.toc-box {
  background: var(--surface-alt);
  border-left: 3px solid var(--text);
  border-radius: 0 8px 8px 0;
  padding: 20px 22px;
}
.toc-title {
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  margin-bottom: 12px;
}
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.toc-item.toc-h3 {
  padding-left: 14px;
}
.toc-link {
  font-size: 1.15rem;
  color: var(--text-body);
  text-decoration: none;
  line-height: 1.4;
  display: block;
  transition: color .15s;
}
.toc-link:hover,
.toc-link.toc-active {
  color: var(--text);
  font-weight: 600;
}
.single-post {
  flex: 1;
  min-width: 0;
}
@media (max-width: 900px) {
  .toc-sidebar {
    display: none;
  }
  .post-layout {
    display: block;
  }
}

/* ── Dark-mode logo ──────────────────────────────────────────────────
   When a dedicated dark logo variant exists (navy wordmark recolored to
   white), swap to it via CSS so it reacts to the instant theme toggle.
   The second <img>.logo-dark is hidden in light; shown in dark. */
.logo-dark { display: none; }
:root[data-theme="dark"] .has-dark-logo .logo-light { display: none; }
:root[data-theme="dark"] .has-dark-logo .logo-dark  { display: block; }
/* Fallback white chip ONLY when no dark logo variant is available. */
:root[data-theme="dark"] .site-logo:not(.has-dark-logo) {
  display: inline-flex; align-items: center;
  background: #fff; padding: 6px 12px; border-radius: 10px;
}

/* ── Theme toggle (footer) ───────────────────────────────────────────── */
.theme-toggle { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.theme-toggle[hidden] { display: none; }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: none; background: none; border-radius: 999px; color: var(--text-faint); cursor: pointer; transition: color .15s, background .15s; }
.theme-btn:hover { color: var(--text); }
.theme-btn svg { width: 15px; height: 15px; }
.theme-btn.is-active { background: var(--brand-tint); color: var(--brand); }

/* ── Typewriter hero (blog + forum) ──────────────────────────────────────
   Deliberately always-dark in both themes (same convention as the old blog
   hero): deep brand-teal gradient, literal colors on purpose. */
.tw-hero { position: relative; width: 100%; border-radius: 16px; overflow: hidden; margin-bottom: 36px; background: linear-gradient(135deg, #0b2b2b 0%, #14494a 55%, #1d5f5f 100%); }
.tw-hero::before { content: ""; position: absolute; top: -60%; right: -8%; width: 55%; height: 170%; background: radial-gradient(closest-side, rgba(94, 209, 198, .25), transparent 70%); pointer-events: none; animation: twGlowA 14s ease-in-out infinite alternate; }
.tw-hero::after { content: ""; position: absolute; bottom: -70%; left: -6%; width: 45%; height: 160%; background: radial-gradient(closest-side, rgba(94, 209, 198, .16), transparent 70%); pointer-events: none; animation: twGlowB 18s ease-in-out infinite alternate; }
@keyframes twGlowA { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-48px, 22px, 0) scale(1.18); } }
@keyframes twGlowB { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(56px, -18px, 0) scale(1.12); } }
.tw-hero-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tw-hero-bgimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; opacity: .25; display: block; }
.tw-hero-inner { position: relative; min-height: 180px; display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: 28px 40px; }
.tw-hero-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: rgba(255, 255, 255, .72); margin-bottom: 8px; }
.tw-hero-title { font-family: var(--font); font-size: clamp(22px, 3vw, 34px); font-weight: 700; color: #fff; line-height: 1.25; letter-spacing: -.02em; margin: 0; }
.tw-word { color: #6fd6cb; }
.tw-cursor { display: inline-block; width: 2px; height: 1em; margin-left: 3px; background: #6fd6cb; vertical-align: -.12em; animation: twBlink 1.05s step-end infinite; }
@keyframes twBlink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.tw-hero-desc { font-size: .88rem; color: rgba(255, 255, 255, .82); max-width: 340px; line-height: 1.6; text-align: right; margin: 0; }
.tw-hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; flex-shrink: 0; }
.tw-hero .tw-hero-btn { background: #fff; color: #14494a; }
.tw-hero .tw-hero-btn:hover { opacity: .85; }
@media (prefers-reduced-motion: reduce) {
  .tw-cursor { animation: none; opacity: 0; }
  .tw-hero::before, .tw-hero::after { animation: none; }
  .tw-hero-fx { display: none; }
}

/* ── Category cards (blog, under the hero) ───────────────────────────── */
.category-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 48px; justify-content: center; }
.section-subheading { text-align: center; margin: 0 0 20px; }
.section-subheading h2 { font-family: var(--font); font-size: 1.3rem; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.section-subheading p { font-family: var(--font); font-size: .88rem; color: var(--text-muted); margin: 0; }
/* Always-dark mini-banner cards (same deliberate convention as .tw-hero) —
   lighter "scrubs teal" gradient, a step brighter than the hero. */
.category-box { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-width: 160px; padding: 22px 28px; background: linear-gradient(135deg, #128074 0%, #23a294 55%, #37c0af 100%); border: 1px solid rgba(255, 255, 255, .32); border-radius: 12px; text-decoration: none; text-align: center; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.category-box::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: #aef7ec; z-index: 1; }
/* Periodic light sweep across the card, staggered per card. */
.category-box::after { content: ""; position: absolute; top: 0; bottom: 0; left: -80%; width: 55%; background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .35), transparent); transform: skewX(-20deg); animation: catSheen 7s ease-in-out infinite; pointer-events: none; z-index: 1; }
.category-box:nth-child(2)::after { animation-delay: .9s; }
.category-box:nth-child(3)::after { animation-delay: 1.8s; }
.category-box:nth-child(4)::after { animation-delay: 2.7s; }
.category-box:nth-child(5)::after { animation-delay: 3.6s; }
.category-box:nth-child(6)::after { animation-delay: 4.5s; }
@keyframes catSheen { 0% { left: -80%; } 22% { left: 130%; } 100% { left: 130%; } }
.category-box-name { position: relative; font-size: .9rem; font-weight: 600; color: #fff; display: inline-flex; align-items: center; gap: 6px; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.category-box-count { position: relative; font-size: .74rem; color: rgba(255, 255, 255, .92); text-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.category-box-arrow { color: #eafffb; font-size: .85rem; opacity: 0; transform: translateX(-6px); transition: opacity .18s ease, transform .18s ease; }
.category-box:hover { transform: translateY(-4px); border-color: #eafffb; box-shadow: 0 12px 28px rgba(18, 128, 116, .45); }
.category-box:hover .category-box-arrow { opacity: 1; transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
  .category-box, .category-box-arrow { transition: none; }
  .category-box::after { animation: none; display: none; }
  .category-box:hover { transform: none; }
}

/* ── Featured post + side-list cards (blog home) ─────────────────────── */
.feat-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.feat-card-imglink { display: block; position: relative; overflow: hidden; }
.feat-card-img { width: 100%; height: 280px; object-fit: cover; display: block; transition: transform .4s ease; }
.feat-card:hover { transform: translateY(-5px) scale(1.012); box-shadow: 0 18px 40px var(--shadow-color); border-color: var(--border-strong); }
.feat-card:hover .feat-card-img { transform: scale(1.05); }
/* Wide variant (category page's big featured post) + generic padded body. */
.feat-card-img--wide { height: auto; aspect-ratio: 16/9; max-height: 460px; }
.feat-card-body { padding: 22px 28px 26px; display: flex; flex-direction: column; gap: 10px; }

.side-post-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.side-post-row:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 10px 26px var(--shadow-color); border-color: var(--border-strong); }
.side-post-thumb { flex-shrink: 0; width: 80px; height: 80px; border-radius: 10px; overflow: hidden; display: block; background: var(--surface-alt); }
.side-post-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.side-post-row:hover .side-post-thumb img { transform: scale(1.1); }

/* Shared: card titles shift to the brand accent while their card is hovered. */
.card-titlelink { color: inherit; text-decoration: none; transition: color .2s ease; }
.feat-card:hover .card-titlelink, .side-post-row:hover .card-titlelink { color: var(--brand); }

@media (prefers-reduced-motion: reduce) {
  .post-card, .post-card-img, .feat-card, .feat-card-img,
  .side-post-row, .side-post-thumb img, .card-titlelink { transition: none; }
  .post-card:hover, .feat-card:hover, .side-post-row:hover { transform: none; }
  .post-card:hover .post-card-img, .feat-card:hover .feat-card-img,
  .side-post-row:hover .side-post-thumb img { transform: none; }
}
@media (max-width: 640px) {
  .tw-hero-inner { flex-direction: column; align-items: flex-start; justify-content: center; gap: 14px; }
  .tw-hero-desc { text-align: left; max-width: none; }
  .tw-hero-side { align-items: flex-start; }
}

/* Search results page */
.search-page-form { display: flex; gap: 10px; max-width: 640px; margin-bottom: 32px; }
.search-page-input { flex: 1; min-width: 0; padding: 12px 16px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font-family: var(--font); font-size: .95rem; }
.search-result-count { font-family: var(--font); font-size: .85rem; color: var(--text-faint); margin-bottom: 24px; }
.search-group { margin-bottom: 40px; }
.search-group-heading { font-family: var(--font); font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: 16px; }
.search-group-count { font-weight: 400; color: var(--text-faint); font-size: .85rem; }
.search-result-list { display: flex; flex-direction: column; gap: 14px; }
.search-result-card { padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; transition: border-color .15s ease, box-shadow .15s ease; }
.search-result-card:hover { border-color: var(--border-strong); box-shadow: 0 8px 22px var(--shadow-color); }
.search-result-badge { display: inline-block; font-family: var(--font); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); background: var(--brand-tint); padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; }
.search-result-title { font-family: var(--font); font-size: 1.05rem; font-weight: 700; line-height: 1.35; color: var(--text); margin: 0 0 6px; }
.search-result-title a { color: inherit; }
.search-result-title a:hover { color: var(--brand); }
.search-result-excerpt { font-family: var(--font); font-size: .87rem; color: var(--text-muted); line-height: 1.55; margin: 0 0 10px; }
.search-result-excerpt mark { background: var(--brand-tint); color: var(--text); font-weight: 700; padding: 0 2px; border-radius: 2px; }
.search-result-meta { display: flex; flex-wrap: wrap; gap: 10px; }
.search-result-tag { font-family: var(--font); font-size: .76rem; color: var(--text-faint); }
a.search-result-tag:hover { color: var(--brand); }
.search-empty { padding: 40px 0; text-align: center; }
.search-empty p { font-family: var(--font); color: var(--text); font-size: 1rem; margin-bottom: 6px; }
.search-empty-sub { color: var(--text-faint) !important; font-size: .88rem !important; }
.search-ask-cta { text-align: center; padding: 32px 0 8px; }
.search-ask-cta p { font-family: var(--font); color: var(--text-muted); margin-bottom: 14px; }
@media (max-width: 640px) {
  .header-search-panel { right: -16px; width: calc(100vw - 32px); }
  .search-page-form { flex-direction: column; }
}

/* ── Small text utilities (Phase 5 — public-side equivalents of admin.css's) */
.text-muted { color: var(--text-faint); }
.text-sm { font-size: .82rem; }

/* ── Member Profile (Phase 5) ─────────────────────────────────────────── */
.member-profile-header { display: flex; align-items: flex-start; gap: 22px; padding-bottom: 26px; margin-bottom: 26px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.member-profile-avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.member-profile-avatar-fallback { background: var(--brand); color: var(--on-inverse); display: flex; align-items: center; justify-content: center; font-family: var(--font); font-weight: 700; font-size: 2rem; }
.member-profile-identity { flex: 1; min-width: 220px; }
.member-profile-name { font-family: var(--font); font-size: 1.5rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.member-profile-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.member-badge-pill { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font); font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--brand-tint); border: 1px solid var(--brand-tint-border); color: var(--brand); cursor: default; }
.member-badge-pill:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.member-profile-rank { font-family: var(--font); font-size: .85rem; color: var(--text-muted); margin-bottom: 4px; }
.member-profile-meta { font-family: var(--font); font-size: .78rem; color: var(--text-faint); margin-bottom: 10px; }
.member-profile-stats { display: flex; flex-wrap: wrap; gap: 18px; font-family: var(--font); font-size: .82rem; color: var(--text-muted); }
.member-profile-stats strong { color: var(--text); }
.member-profile-follow { flex-shrink: 0; }
.member-profile-section { margin-bottom: 32px; }
.member-profile-section h2 { font-family: var(--font); font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.member-profile-about { font-family: var(--font); font-size: .92rem; color: var(--text-body); line-height: 1.6; margin-bottom: 10px; }
.member-profile-facts { display: flex; flex-wrap: wrap; gap: 16px; font-family: var(--font); font-size: .82rem; color: var(--text-muted); }
.member-profile-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.member-mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.member-mini-list-link { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 6px; font-family: var(--font); font-size: .88rem; color: var(--text); text-decoration: none; }
.member-mini-list-link:hover { background: var(--surface-hover); }
.member-mini-avatar-img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.member-mini-avatar-fallback { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex-shrink: 0; }
@media (max-width: 700px) {
  .member-profile-header { flex-direction: column; }
  .member-profile-columns { grid-template-columns: 1fr; gap: 0; }
}

/* ── Rich user card additions (Phase 5) ──────────────────────────────── */
.topic-post-side a.topic-post-author-link { color: inherit; text-decoration: none; }
.topic-post-side a.topic-post-author-link:hover .topic-post-author { text-decoration: underline; }
.topic-post-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; margin-top: 4px; }
.topic-post-badges .member-badge-pill { font-size: .62rem; padding: 1px 7px; }
.topic-post-extra-meta { font-family: var(--font); font-size: .68rem; color: var(--text-fainter); margin-top: 4px; line-height: 1.5; }

/* ── Member Directory (Phase 5) ──────────────────────────────────────── */
.member-directory-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 24px; }
.member-directory-toolbar select, .member-directory-toolbar input[type=text] { width: auto; }
.member-directory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.member-directory-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease; }
.member-directory-card:hover { border-color: var(--border-strong); box-shadow: 0 8px 22px var(--shadow-color); }
.member-directory-card img, .member-directory-card .member-directory-avatar-fallback { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.member-directory-avatar-fallback { background: var(--brand); color: var(--on-inverse); display: flex; align-items: center; justify-content: center; font-family: var(--font); font-weight: 700; }
.member-directory-name { font-family: var(--font); font-size: .9rem; font-weight: 600; color: var(--text); }
.member-directory-sub { font-family: var(--font); font-size: .74rem; color: var(--text-faint); margin-top: 2px; }

/* ── Save/Follow toggle buttons (Phase 5) ────────────────────────────── */
.save-topic-btn { display: inline-flex; align-items: center; gap: 5px; background: none; border: none; padding: 0; font-family: var(--font); font-size: .82rem; font-weight: 600; color: var(--text-faint); cursor: pointer; }
.save-topic-btn:hover { color: var(--brand); }
.save-topic-btn.is-saved { color: var(--brand); }

/* ── Draft restore banner (Phase 5) ──────────────────────────────────── */
.draft-restore-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; margin-bottom: 12px; background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: 8px; font-family: var(--font); font-size: .82rem; color: var(--warning-text); }
.draft-restore-banner .btn-sm { padding: 5px 14px; }

/* ── Toasts (Phase 5 — enhances existing .alert flash messages) ──────── */
.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 999; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast-stack .alert { box-shadow: 0 10px 30px var(--shadow-color); margin-bottom: 0; animation: toastIn .25s ease; position: relative; padding-right: 34px; }
.toast-close { position: absolute; top: 6px; right: 8px; background: none; border: none; font-size: 1.1rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; padding: 4px; }
.toast-close:hover { opacity: 1; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .toast-stack .alert { animation: none; } }

/* ── Focus-visible pass (Phase 5) ────────────────────────────────────── */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── Reduced-motion-respecting page fade (Phase 5) ───────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .site-body { animation: pageFadeIn .2s ease; }
}
@keyframes pageFadeIn { from { opacity: 0; } to { opacity: 1; } }
