/* ============================================================
   STARISE COMMUNITY — The Permanent Lighting Forum (Phase 1 UI)
   ------------------------------------------------------------
   THE shared design system for every /forum page: tokens, layout,
   header / footer / mobile bar, buttons, cards, post cards, forms,
   tabs, dialogs, toasts, lightbox, empty and loading states.
   Page-specific styles live in css/forum-auth.css and
   css/forum-profile.css and use only these tokens.
   Class prefix: sf- (Starise Forum). Black, white and emerald.
   Rules: body text 16px minimum, touch targets 44px minimum,
   one restrained shadow, no gradients or decorative motion.
   ============================================================ */

:root {
    --sf-bg: #f4f5f4;
    --sf-surface: #ffffff;
    --sf-surface-2: #f1f3f2;
    --sf-surface-3: #e8ebe9;
    --sf-ink: #0b0d0c;
    --sf-ink-2: #303733;
    --sf-ink-3: #56605b;
    --sf-line: #e1e5e3;
    --sf-line-strong: #c4ccc8;
    --sf-field-line: #8a938e;
    --sf-black: #0a0a0a;
    --sf-black-2: #1a1c1b;
    --sf-emerald: #047857;
    --sf-emerald-hover: #065f46;
    --sf-emerald-ink: #065f46;
    --sf-emerald-soft: #e3f4ec;
    --sf-emerald-bright: #34d399;
    --sf-danger: #b42318;
    --sf-danger-soft: #fdeceb;
    --sf-warn-ink: #7a4b00;
    --sf-warn-soft: #fff3d6;
    --sf-info-soft: #eef1f0;

    --sf-font-head: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --sf-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --sf-radius-sm: 10px;
    --sf-radius: 16px;
    --sf-radius-lg: 22px;
    --sf-pill: 999px;
    --sf-shadow: 0 1px 2px rgba(11, 13, 12, 0.05), 0 6px 20px rgba(11, 13, 12, 0.05);
    --sf-shadow-lift: 0 2px 4px rgba(11, 13, 12, 0.06), 0 18px 48px rgba(11, 13, 12, 0.14);
    --sf-focus: 0 0 0 3px #ffffff, 0 0 0 6px var(--sf-emerald);

    --sf-tap: 44px;
    --sf-tap-lg: 52px;
    --sf-header-h: 68px;
    --sf-bottom-h: 64px;
    --sf-gutter: max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
    --sf-max: 1240px;
    --sf-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Base ---------- */
.sf-page *, .sf-page *::before, .sf-page *::after { box-sizing: border-box; }
html.sf-root { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--sf-header-h) + 12px); }
/* keyboard focus never lands behind the fixed bottom bar */
@media (max-width: 899px) { html.sf-root { scroll-padding-bottom: calc(var(--sf-bottom-h) + var(--sf-safe-bottom) + 12px); } }
body.sf-page {
    margin: 0;
    min-height: 100vh;
    background: var(--sf-bg);
    color: var(--sf-ink);
    font-family: var(--sf-font-body);
    font-size: 1rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
.sf-page h1, .sf-page h2, .sf-page h3, .sf-page h4 {
    margin: 0;
    font-family: var(--sf-font-head);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--sf-ink);
}
.sf-page h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.sf-page h2 { font-size: clamp(1.35rem, 2.6vw, 1.6rem); }
.sf-page h3 { font-size: 1.2rem; }
.sf-page p { margin: 0; }
.sf-page a { color: var(--sf-emerald); text-underline-offset: 3px; }
.sf-page img { max-width: 100%; display: block; }
/* :where() keeps this reset at zero specificity so component classes (.sf-btn, .sf-input…) win */
:where(.sf-page) button, :where(.sf-page) input, :where(.sf-page) select, :where(.sf-page) textarea { font: inherit; color: inherit; }
.sf-page :focus { outline: none; }
.sf-page :focus-visible { outline: none; box-shadow: var(--sf-focus); }
.sf-page [hidden] { display: none !important; }
.sf-vh {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.sf-skip {
    position: absolute; left: 12px; top: -80px; z-index: 1000;
    padding: 12px 18px; border-radius: var(--sf-pill);
    background: var(--sf-surface); color: var(--sf-ink); font-weight: 700; text-decoration: none;
}
.sf-skip:focus { top: 12px; }
.sf-icon { width: 20px; height: 20px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.sf-icon--lg { width: 24px; height: 24px; }

/* ---------- Preview bar (preview hosts only; never production) ---------- */
.sf-preview-bar {
    position: relative; z-index: 60;
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 14px;
    padding: 8px var(--sf-gutter);
    background: var(--sf-warn-soft); color: var(--sf-warn-ink);
    border-bottom: 1px solid #f0d9a8;
    font-size: 0.95rem; font-weight: 600; text-align: center;
}
.sf-preview-bar strong { font-weight: 800; }
.sf-preview-bar .sf-seg { background: rgba(255, 255, 255, 0.7); }

/* ---------- Header ---------- */
.sf-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--sf-black); color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sf-header-inner {
    max-width: var(--sf-max); margin: 0 auto; height: var(--sf-header-h);
    padding: 0 var(--sf-gutter);
    display: flex; align-items: center; gap: 18px;
}
.sf-brand { display: inline-flex; align-items: center; gap: 10px; color: #ffffff !important; text-decoration: none; flex: 0 0 auto; min-height: var(--sf-tap); }
.sf-brand-logo, .sf-brand-text { display: inline-flex; align-items: center; min-height: var(--sf-tap); color: #ffffff !important; text-decoration: none; border-radius: 10px; }
.sf-brand img { width: auto; height: 40px; }
.sf-header .sf-brand { gap: 0; }
.sf-brand-logo { min-width: var(--sf-tap); justify-content: center; margin-left: -12px; }   /* a 44 px tap target; the logo stays where it was */
.sf-brand-text { display: flex; flex-direction: column; justify-content: center; line-height: 1; font-family: var(--sf-font-head); text-transform: uppercase; }
.sf-brand-text b { font-size: 1.05rem; font-weight: 800; letter-spacing: 0.12em; }
.sf-brand-text span { margin-top: 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.22em; color: var(--sf-emerald-bright); }
.sf-nav { display: flex; align-items: center; gap: 4px; }
.sf-nav a {
    display: inline-flex; align-items: center; gap: 8px; min-height: var(--sf-tap);
    padding: 0 16px; border-radius: var(--sf-pill);
    color: rgba(255, 255, 255, 0.78) !important; text-decoration: none;
    font-weight: 650; font-size: 1rem; white-space: nowrap;
}
.sf-nav a:hover { color: #ffffff !important; background: rgba(255, 255, 255, 0.08); }
.sf-nav a[aria-current="page"] { color: #ffffff !important; background: rgba(255, 255, 255, 0.12); }
.sf-header-search { flex: 1 1 auto; min-width: 180px; max-width: 440px; margin-left: auto; position: relative; }
@media (min-width: 900px) and (max-width: 1099px) {
    .sf-header-inner { gap: 12px; }
    .sf-nav a { padding: 0 12px; }
    .sf-hide-narrow { display: none !important; }
    .sf-header-new { width: var(--sf-tap); padding: 0; }
    .sf-member-btn { padding: 3px; }
}
.sf-header-search .sf-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: rgba(255, 255, 255, 0.6); pointer-events: none; }
.sf-header-search input {
    width: 100%; height: var(--sf-tap); padding: 0 18px 0 46px;
    border-radius: var(--sf-pill); border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.07); color: #ffffff; font-size: 1rem;
}
.sf-header-search input::placeholder { color: rgba(255, 255, 255, 0.6); }
.sf-header-search input:focus-visible { border-color: var(--sf-emerald-bright); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.35); }
.sf-header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.sf-header .sf-btn--quote { background: #ffffff; border-color: #ffffff; color: var(--sf-black) !important; }
.sf-header .sf-btn--quote:hover { background: #e7ebe9; border-color: #e7ebe9; }
.sf-quote-short { display: none; }
@media (min-width: 900px) {
    .sf-header-search { min-width: 140px; }
    /* staff headers carry the Moderation link too: the short label keeps the bar on one line */
    .sf-header-actions:has(.sf-header-mod) .sf-quote-long { display: none; }
    .sf-header-actions:has(.sf-header-mod) .sf-quote-short { display: inline; }
}
.sf-header .sf-btn--ghost { color: #ffffff !important; border-color: rgba(255, 255, 255, 0.28); background: transparent; }
.sf-header .sf-btn--ghost:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.45); }
.sf-header :focus-visible { box-shadow: 0 0 0 3px var(--sf-black), 0 0 0 6px var(--sf-emerald-bright); }
.sf-header .sf-btn--primary { background: var(--sf-emerald-bright); color: var(--sf-black) !important; }
.sf-header .sf-btn--primary:hover { background: #6ee7b7; }
.sf-header-icon {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: var(--sf-tap); height: var(--sf-tap); border-radius: 50%;
    color: #ffffff !important; background: transparent; border: 0; cursor: pointer; text-decoration: none;
}
.sf-header-icon:hover { background: rgba(255, 255, 255, 0.1); }
.sf-header-dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--sf-emerald-bright); box-shadow: 0 0 0 2px var(--sf-black); }
.sf-member-btn {
    display: inline-flex; align-items: center; gap: 10px; min-height: var(--sf-tap);
    padding: 0 14px 0 4px; border-radius: var(--sf-pill); border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent; color: #ffffff !important; text-decoration: none; font-weight: 650;
}
.sf-member-btn:hover { background: rgba(255, 255, 255, 0.08); }
.sf-member-btn .sf-avatar { width: 36px; height: 36px; font-size: 0.9rem; }

/* ---------- Mobile bottom bar ---------- */
.sf-bottom-nav { display: none; }
@media (max-width: 899px) {
    :root { --sf-header-h: 60px; }
    .sf-nav, .sf-header-search, .sf-header-actions .sf-hide-mobile { display: none !important; }
    .sf-header-inner { gap: 10px; }
    .sf-header-actions { margin-left: auto; }
    .sf-brand img { height: 34px; }
    .sf-brand-text b { font-size: 0.95rem; }
    .sf-brand-text span { font-size: 0.66rem; }
    .sf-header .sf-header-quote { padding-left: 14px; padding-right: 14px; }
    .sf-member-btn { padding: 3px; }
    .sf-preview-bar { font-size: 0.9rem; padding: 6px var(--sf-gutter); }
    body.sf-page { padding-bottom: calc(var(--sf-bottom-h) + var(--sf-safe-bottom)); }
    .sf-bottom-nav {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
        display: grid; grid-template-columns: repeat(5, 1fr);
        height: calc(var(--sf-bottom-h) + var(--sf-safe-bottom)); padding-bottom: var(--sf-safe-bottom);
        background: var(--sf-surface); border-top: 1px solid var(--sf-line);
    }
    .sf-bottom-nav a {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        min-width: 0; min-height: var(--sf-tap); color: var(--sf-ink-3); text-decoration: none;
        font-size: 0.75rem; font-weight: 700; letter-spacing: 0; white-space: nowrap;
    }
    .sf-bottom-nav a .sf-icon { width: 24px; height: 24px; }
    .sf-bottom-nav a[aria-current="page"] { color: var(--sf-emerald); }
    .sf-bottom-nav a.sf-bottom-post .sf-bottom-plus {
        display: inline-flex; align-items: center; justify-content: center;
        width: 40px; height: 32px; border-radius: var(--sf-pill); background: var(--sf-black); color: #ffffff;
    }
    .sf-bottom-nav a.sf-bottom-post .sf-bottom-plus .sf-icon { width: 22px; height: 22px; }
}

/* ---------- Buttons ---------- */
.sf-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--sf-tap); padding: 0 20px;
    border-radius: var(--sf-pill); border: 1.5px solid transparent;
    font-family: var(--sf-font-body); font-size: 1rem; font-weight: 700; line-height: 1;
    text-decoration: none !important; white-space: nowrap; cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.sf-btn[disabled], .sf-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.sf-btn[data-sf-join][aria-busy="true"] { opacity: 0.7; cursor: progress; }
.sf-btn--primary { background: var(--sf-emerald); color: #ffffff !important; }
.sf-btn--primary:hover { background: var(--sf-emerald-hover); }
.sf-btn--dark { background: var(--sf-black); color: #ffffff !important; }
.sf-btn--dark:hover { background: var(--sf-black-2); }
.sf-btn--ghost { background: var(--sf-surface); color: var(--sf-ink) !important; border-color: var(--sf-line-strong); }
.sf-btn--ghost:hover { border-color: var(--sf-ink-3); background: var(--sf-surface-2); }
.sf-btn--quiet { background: transparent; color: var(--sf-ink-2) !important; padding: 0 14px; }
.sf-btn--quiet:hover { background: var(--sf-surface-2); color: var(--sf-ink) !important; }
.sf-btn--danger { background: var(--sf-danger); color: #ffffff !important; }
.sf-btn--joined { background: var(--sf-emerald-soft); color: var(--sf-emerald-ink) !important; border-color: #b7e2cf; }
.sf-btn--lg { min-height: var(--sf-tap-lg); padding: 0 26px; font-size: 1.05rem; }
.sf-btn--sm { min-height: var(--sf-tap); padding: 0 16px; font-size: 1rem; }
.sf-btn--block { width: 100%; }
/* the smallest phones (320px): long button labels wrap instead of pushing the page sideways */
@media (max-width: 359px) { .sf-btn { white-space: normal; text-align: center; line-height: 1.2; } }
/* Get Quote: the full label where the header has room; "Quote" on narrow desktops (beside the search field) and small phones. */
@media (min-width: 900px) and (max-width: 1279px) {
    .sf-quote-long { display: none; } .sf-quote-short { display: inline; }
}
@media (min-width: 1100px) and (max-width: 1279px) {
    .sf-header-inner { gap: 12px; }
    .sf-nav a { padding: 0 12px; }
}
@media (max-width: 419px) { .sf-quote-long { display: none; } .sf-quote-short { display: inline; } }
@media (max-width: 419px) {
    .sf-header .sf-header-quote { padding-left: 10px; padding-right: 10px; }
    .sf-header-actions { gap: 6px; }
}
.sf-btn--icon { width: var(--sf-tap); padding: 0; }
.sf-btn .sf-spinner { width: 18px; height: 18px; }
.sf-spinner {
    display: inline-block; width: 20px; height: 20px; border-radius: 50%;
    border: 2.5px solid currentColor; border-right-color: transparent;
    animation: sf-spin 0.8s linear infinite;
}
@keyframes sf-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sf-spinner { animation-duration: 2.4s; } }

/* ---------- Layout ---------- */
.sf-main-wrap { max-width: var(--sf-max); margin: 0 auto; padding: 28px var(--sf-gutter) 56px; }
.sf-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.sf-layout--two { grid-template-columns: minmax(0, 1fr) 320px; }
.sf-layout--narrow { display: block; max-width: 760px; margin: 0 auto; }
.sf-rail { position: sticky; top: calc(var(--sf-header-h) + 20px); display: grid; gap: 18px; }
.sf-rail-left { max-height: calc(100vh - var(--sf-header-h) - 40px); overflow-y: auto; padding: 2px 4px 2px 2px; }
.sf-main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; }
@media (max-width: 1179px) {
    .sf-layout { grid-template-columns: minmax(0, 1fr) 300px; }
    .sf-rail-left { display: none; }
}
@media (max-width: 899px) {
    .sf-main-wrap { padding: 18px var(--sf-gutter) 32px; }
    .sf-layout, .sf-layout--two { display: block; }
    .sf-rail { position: static; margin-top: 24px; }
    .sf-rail-left { display: none; }
}

/* Page heading row */
.sf-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sf-page-head .sf-kicker {
    display: block; margin-bottom: 8px; color: var(--sf-emerald);
    font-size: 0.85rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
}
/* /forum: what the forum is about, under its heading */
.sf-page-intro { margin-top: 10px; max-width: 68ch; color: var(--sf-ink-2); font-size: 1.05rem; line-height: 1.55; }
@media (max-width: 599px) { .sf-page-intro { margin-top: 8px; font-size: 1rem; line-height: 1.5; } }
.sf-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.95rem; color: var(--sf-ink-3); }
.sf-crumbs a { display: inline-flex; align-items: center; min-height: var(--sf-tap); margin: -6px 0; color: var(--sf-ink-2); font-weight: 650; text-decoration: none; }
.sf-crumbs a:hover { color: var(--sf-emerald); text-decoration: underline; }

/* ---------- Surfaces ---------- */
.sf-card {
    background: var(--sf-surface); border: 1px solid var(--sf-line);
    border-radius: var(--sf-radius-lg); box-shadow: var(--sf-shadow);
}
.sf-card-pad { padding: 22px; }
.sf-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sf-card-head h2, .sf-card-head h3 { font-size: 1.1rem; }
.sf-card-link { font-weight: 700; text-decoration: none; min-height: var(--sf-tap); display: inline-flex; align-items: center; }
.sf-card-link:hover { text-decoration: underline; }
.sf-divider { height: 1px; background: var(--sf-line); border: 0; margin: 18px 0; }
@media (max-width: 599px) {
    .sf-card-pad { padding: 18px; }
    .sf-card { border-radius: var(--sf-radius); }
}

/* Left rail navigation */
.sf-railnav h2 { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sf-ink-3); margin: 18px 12px 6px; }
.sf-railnav h2:first-child { margin-top: 0; }
.sf-railnav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sf-railnav a {
    display: flex; align-items: center; gap: 12px; min-height: var(--sf-tap);
    padding: 0 12px; border-radius: 12px; color: var(--sf-ink-2); text-decoration: none; font-weight: 650;
}
.sf-railnav a:hover { background: var(--sf-surface-3); color: var(--sf-ink); }
.sf-railnav a[aria-current="page"], .sf-railnav a.is-active { background: var(--sf-surface); color: var(--sf-ink); box-shadow: inset 3px 0 0 var(--sf-emerald), var(--sf-shadow); }
.sf-railnav a:focus-visible, .sf-railnav a[aria-current="page"]:focus-visible { box-shadow: inset 0 0 0 3px var(--sf-emerald); }
.sf-chiprow a:focus-visible { box-shadow: inset 0 0 0 3px var(--sf-emerald); }
.sf-railnav a .sf-count { margin-left: auto; font-size: 0.85rem; color: var(--sf-ink-3); font-weight: 600; }

/* ---------- Avatars ---------- */
.sf-avatar {
    position: relative; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--sf-black); color: #ffffff;
    font-family: var(--sf-font-head); font-weight: 700; font-size: 1rem; text-transform: uppercase;
}
.sf-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sf-avatar[data-tone="1"] { background: #065f46; }
.sf-avatar[data-tone="2"] { background: #303733; }
.sf-avatar[data-tone="3"] { background: #0f766e; }
.sf-avatar[data-tone="4"] { background: #3f4a45; }
.sf-avatar[data-tone="5"] { background: #14532d; }
.sf-avatar--sm { width: 32px; height: 32px; font-size: 0.82rem; }
.sf-avatar--lg { width: 56px; height: 56px; font-size: 1.3rem; }
.sf-avatar--xl { width: 112px; height: 112px; font-size: 2.4rem; }

/* Community icon tile */
.sf-cicon {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--sf-black); color: var(--sf-emerald-bright);
}
.sf-cicon .sf-icon { width: 22px; height: 22px; }
.sf-cicon--sm { width: 28px; height: 28px; border-radius: 8px; }
.sf-cicon--sm .sf-icon { width: 16px; height: 16px; }
.sf-cicon--lg { width: 72px; height: 72px; border-radius: 20px; }
.sf-cicon--lg .sf-icon { width: 36px; height: 36px; }

/* ---------- Badges & chips ---------- */
.sf-badge {
    display: inline-flex; align-items: center; gap: 6px; min-height: 28px;
    padding: 0 12px; border-radius: var(--sf-pill);
    font-size: 0.9375rem; font-weight: 750; line-height: 1; white-space: nowrap;
    background: var(--sf-surface-2); color: var(--sf-ink-2); border: 1px solid var(--sf-line);
}
.sf-badge .sf-icon { width: 16px; height: 16px; }
.sf-badge--answered { background: var(--sf-emerald-soft); color: var(--sf-emerald-ink); border-color: #b7e2cf; }
.sf-badge--open { background: var(--sf-surface); color: var(--sf-ink-2); border-color: var(--sf-line-strong); }
.sf-badge--pending { background: var(--sf-warn-soft); color: var(--sf-warn-ink); border-color: #f0d9a8; }
.sf-badge--rejected { background: var(--sf-surface); color: var(--sf-ink-2); border-color: var(--sf-line-strong); }
.sf-badge--dark { background: var(--sf-black); color: #ffffff; border-color: var(--sf-black); }
.sf-badge--op { background: var(--sf-black); color: #ffffff; border-color: var(--sf-black); min-height: 26px; padding: 0 10px; font-size: 0.875rem; }
.sf-badge--verified { background: var(--sf-emerald-soft); color: var(--sf-emerald-ink); border-color: #b7e2cf; }
.sf-chip {
    display: inline-flex; align-items: center; gap: 8px; min-height: var(--sf-tap); margin: -6px 0; max-width: 100%;
    color: var(--sf-ink) !important; text-decoration: none; font-weight: 750; font-size: 0.95rem;
}
.sf-chip:hover span { text-decoration: underline; }
.sf-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Segmented tabs ---------- */
.sf-seg {
    display: inline-flex; gap: 4px; padding: 4px; max-width: 100%; min-width: 0;
    border-radius: var(--sf-pill); background: var(--sf-surface-3);
    overflow-x: auto; scrollbar-width: none;
}
.sf-seg::-webkit-scrollbar { display: none; }
.sf-seg button, .sf-seg a {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
    min-height: var(--sf-tap); padding: 0 18px; border: 0; border-radius: var(--sf-pill);
    background: transparent; color: var(--sf-ink-2) !important; text-decoration: none;
    font-weight: 700; font-size: 0.98rem; cursor: pointer; white-space: nowrap;
}
.sf-seg button:hover, .sf-seg a:hover { color: var(--sf-ink) !important; }
.sf-seg [aria-selected="true"], .sf-seg [aria-current="page"], .sf-seg [aria-pressed="true"] {
    background: var(--sf-black); color: #ffffff !important;
}
.sf-seg [aria-selected="true"]:hover, .sf-seg [aria-current="page"]:hover, .sf-seg [aria-pressed="true"]:hover { color: #ffffff !important; }
/* focus drawn inside the pill: the scrolling track clips anything outside */
.sf-seg button:focus-visible, .sf-seg a:focus-visible { box-shadow: inset 0 0 0 3px var(--sf-emerald); }
.sf-seg [aria-selected="true"]:focus-visible, .sf-seg [aria-current="page"]:focus-visible, .sf-seg [aria-pressed="true"]:focus-visible { box-shadow: inset 0 0 0 3px var(--sf-emerald-bright); }
.sf-seg .sf-icon { width: 18px; height: 18px; }
.sf-tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Search field (in-page) ---------- */
.sf-search { position: relative; }
.sf-search .sf-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--sf-ink-3); pointer-events: none; }
.sf-search input {
    width: 100%; height: var(--sf-tap-lg); padding: 0 20px 0 52px;
    border-radius: var(--sf-pill); border: 1.5px solid var(--sf-field-line);
    background: var(--sf-surface); font-size: 1.05rem;
}
.sf-search input:focus-visible { border-color: var(--sf-emerald); box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.2); border-radius: var(--sf-pill); }
.sf-search input::placeholder { color: var(--sf-ink-3); }
.sf-search-clear {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: var(--sf-tap); height: var(--sf-tap); border: 0; border-radius: 50%; background: transparent; color: var(--sf-ink-3); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.sf-search-clear:hover { background: var(--sf-surface-2); color: var(--sf-ink); }
.sf-search-clear .sf-icon { position: static; transform: none; }

/* Start-a-discussion prompt */
.sf-prompt {
    display: flex; align-items: center; gap: 14px; width: 100%;
    padding: 12px 12px 12px 14px; border: 1px solid var(--sf-line); border-radius: var(--sf-radius-lg);
    background: var(--sf-surface); box-shadow: var(--sf-shadow); text-align: left; cursor: pointer; text-decoration: none !important;
}
.sf-prompt-field {
    flex: 1 1 auto; min-height: var(--sf-tap); display: flex; align-items: center; padding: 0 18px;
    border-radius: var(--sf-pill); background: var(--sf-surface-2); color: var(--sf-ink-3); font-size: 1.02rem;
}
.sf-prompt:hover .sf-prompt-field { background: var(--sf-surface-3); color: var(--sf-ink-2); }

/* ---------- Post card ---------- */
.sf-feed { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
/* "Show more" under a paged list (feeds, profile replies) */
.sf-more-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 14px; }
.sf-pageback { display: flex; margin: 0 0 14px; }
.sf-post {
    position: relative; padding: 20px 22px 14px;
    background: var(--sf-surface); border: 1px solid var(--sf-line); border-radius: var(--sf-radius-lg);
    box-shadow: var(--sf-shadow);
}
.sf-post:hover { border-color: var(--sf-line-strong); }
.sf-post-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; color: var(--sf-ink-3); font-size: 0.95rem; }
.sf-post-top .sf-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--sf-line-strong); }
.sf-post-top .sf-badge { margin-left: auto; }
.sf-post-title { overflow-wrap: anywhere; margin: 10px 0 6px; font-size: clamp(1.15rem, 2.2vw, 1.32rem) !important; line-height: 1.25 !important; }
.sf-post-title a { color: var(--sf-ink) !important; text-decoration: none; }
.sf-post-title a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
/* the whole card opens the thread; inner controls stay clickable above it */
.sf-post-title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--sf-radius-lg); }
.sf-post-title a:focus-visible { box-shadow: none; }
.sf-post-title a:focus-visible::after { box-shadow: var(--sf-focus); }
.sf-post-excerpt {
    color: var(--sf-ink-2); font-size: 1rem; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sf-post-author { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--sf-ink) !important; text-decoration: none; font-weight: 700; min-height: var(--sf-tap); margin-bottom: -6px; }
.sf-post-author:hover span { text-decoration: underline; }
.sf-post-top .sf-chip { min-width: 0; }
.sf-post-top .sf-chip, .sf-post-top time, .sf-post .sf-actions, .sf-post .sf-thumbs { position: relative; z-index: 1; }
.sf-thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; max-width: 520px; }
.sf-thumbs button {
    position: relative; padding: 0; border: 0; border-radius: 12px; overflow: hidden; cursor: zoom-in;
    aspect-ratio: 4 / 3; background: var(--sf-surface-3);
}
.sf-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.sf-thumbs .sf-thumbs-more {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(10, 10, 10, 0.6); color: #ffffff; font-weight: 800; font-size: 1.2rem;
}

/* action row: like / replies / views / save / more */
.sf-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 12px -10px 0; }
.sf-act {
    display: inline-flex; align-items: center; gap: 8px; min-height: var(--sf-tap); padding: 0 12px;
    border: 0; border-radius: var(--sf-pill); background: transparent; color: var(--sf-ink-2) !important;
    font-weight: 700; font-size: 0.98rem; text-decoration: none; cursor: pointer; white-space: nowrap;
}
button.sf-act:hover, a.sf-act:hover { background: var(--sf-surface-2); color: var(--sf-ink) !important; }
.sf-act[aria-pressed="true"] { color: var(--sf-emerald) !important; }
.sf-act[aria-pressed="true"] .sf-icon { fill: currentColor; }
.sf-act--static { cursor: default; color: var(--sf-ink-3) !important; }
.sf-actions .sf-act--end { margin-left: auto; }
@media (max-width: 599px) {
    .sf-post { padding: 16px 16px 10px; }
    .sf-act { min-width: var(--sf-tap); justify-content: center; padding: 0 10px; gap: 6px; }
    /* icon-only on phones, but the label stays the accessible name (visually hidden, not display: none) */
    .sf-act .sf-act-label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
    .sf-post-top .sf-badge { margin-left: 0; }
}

/* ---------- Community card ---------- */
.sf-cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.sf-ccard { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.sf-ccard-top { display: flex; align-items: center; gap: 14px; }
.sf-ccard h3 { font-size: 1.15rem; }
.sf-ccard h3 a { color: var(--sf-ink) !important; text-decoration: none; }
.sf-ccard h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.sf-ccard h3 a:focus-visible { box-shadow: none; }
.sf-ccard h3 a:focus-visible::after { box-shadow: var(--sf-focus); }
.sf-ccard .sf-btn { position: relative; z-index: 1; }
.sf-ccard h3 a:hover { text-decoration: underline; }
.sf-ccard-meta { color: var(--sf-ink-3); font-size: 1rem; font-weight: 600; }
.sf-ccard-desc { color: var(--sf-ink-2); }
.sf-ccard .sf-btn { margin-top: auto; align-self: flex-start; }
.sf-clist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sf-clist li { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.sf-clist a.sf-clist-name { flex: 1 1 auto; min-width: 0; color: var(--sf-ink) !important; text-decoration: none; font-weight: 700; display: flex; flex-direction: column; justify-content: center; min-height: var(--sf-tap); }
.sf-clist a.sf-clist-name small { color: var(--sf-ink-3); font-weight: 600; font-size: 0.88rem; }
.sf-clist a.sf-clist-name:hover > span { text-decoration: underline; }

/* ---------- Forms ---------- */
.sf-form { display: grid; gap: 20px; }
.sf-field { display: grid; gap: 8px; }
.sf-label { font-weight: 750; font-size: 1rem; color: var(--sf-ink); }
.sf-label .sf-optional { font-weight: 600; color: var(--sf-ink-3); }
.sf-input, .sf-select, .sf-textarea {
    width: 100%; min-height: var(--sf-tap-lg); padding: 12px 16px;
    border-radius: 14px; border: 1.5px solid var(--sf-field-line);
    background: var(--sf-surface); font-size: 1.05rem; color: var(--sf-ink);
    -webkit-appearance: none; appearance: none;
}
.sf-textarea { min-height: 160px; resize: vertical; line-height: 1.55; }
.sf-select {
    padding-right: 48px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2356605b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 16px center; background-size: 20px;
}
.sf-input:hover, .sf-select:hover, .sf-textarea:hover { border-color: var(--sf-ink-3); }
.sf-input:focus-visible, .sf-select:focus-visible, .sf-textarea:focus-visible {
    border-color: var(--sf-emerald); box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.2); border-radius: 14px;
}
.sf-input[aria-invalid="true"], .sf-select[aria-invalid="true"], .sf-textarea[aria-invalid="true"] { border-color: var(--sf-danger); background: #fffafa; }
.sf-input::placeholder, .sf-textarea::placeholder { color: #7a847f; }
.sf-help { color: var(--sf-ink-3); font-size: 1rem; }
.sf-error { display: flex; align-items: flex-start; gap: 8px; color: var(--sf-danger); font-size: 0.98rem; font-weight: 650; }
.sf-error .sf-icon { width: 18px; height: 18px; margin-top: 2px; }
.sf-field-foot { display: flex; justify-content: space-between; gap: 12px; }
.sf-counter { margin-left: auto; color: var(--sf-ink-3); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.sf-counter.is-over { color: var(--sf-danger); font-weight: 700; }
.sf-check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-size: 1rem; line-height: 1.45; }
.sf-check input {
    flex: 0 0 auto; width: 24px; height: 24px; margin: 0; border-radius: 7px; cursor: pointer;
    accent-color: var(--sf-emerald);
}
.sf-check-wrap { padding: 4px 0; min-height: var(--sf-tap); display: flex; align-items: center; }
.sf-switch { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; cursor: pointer; }
.sf-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sf-switch-track {
    flex: 0 0 auto; position: relative; width: 52px; height: 32px; border-radius: var(--sf-pill);
    background: var(--sf-field-line); transition: background-color 0.15s ease;
}
.sf-switch-track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
    background: #ffffff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s ease;
}
.sf-switch input:checked + .sf-switch-track { background: var(--sf-emerald); }
.sf-switch input:checked + .sf-switch-track::after { transform: translateX(20px); }
.sf-switch input:focus-visible + .sf-switch-track { box-shadow: var(--sf-focus); }
.sf-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
@media (max-width: 599px) {
    .sf-form-actions { flex-direction: column-reverse; align-items: stretch; }
    .sf-form-actions .sf-btn { width: 100%; }
}

/* Image picker (preview hosts: local previews; members on the live site: uploads, Phase 2B-3) */
.sf-imgpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.sf-imgpick-item { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--sf-surface-3); }
.sf-imgpick-item img { width: 100%; height: 100%; object-fit: cover; }
.sf-imgpick-remove {
    position: absolute; top: 6px; right: 6px; width: var(--sf-tap); height: var(--sf-tap); border: 0; border-radius: 50%;
    background: rgba(10, 10, 10, 0.72); color: #ffffff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.sf-imgpick-add {
    aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    border: 2px dashed var(--sf-field-line); border-radius: 14px; background: var(--sf-surface);
    color: var(--sf-ink-2); font-weight: 700; cursor: pointer; text-align: center; padding: 8px;
}
.sf-imgpick-add:hover { border-color: var(--sf-emerald); color: var(--sf-emerald); }
.sf-imgpick-add:focus-within { box-shadow: var(--sf-focus); }
.sf-imgpick-add input { position: absolute; opacity: 0; width: 1px; height: 1px; }
/* Photo uploads: the photo with its state on top, Retry or Move earlier / later underneath */
.sf-imgpick-item--up { aspect-ratio: auto; overflow: visible; background: none; border-radius: 0; display: grid; gap: 6px; align-content: start; }
.sf-imgpick-frame { position: relative; display: block; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--sf-surface-3); }
.sf-imgpick-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sf-imgpick-state {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 8px; background: rgba(10, 10, 10, 0.6); color: #ffffff; font-weight: 700; font-size: 1rem; line-height: 1.2; text-align: center;
}
.sf-imgpick-state--progress { justify-content: flex-end; }
.sf-imgpick-state--failed { background: rgba(122, 22, 14, 0.82); }
.sf-progress { display: block; width: 100%; height: 8px; border-radius: var(--sf-pill); background: rgba(255, 255, 255, 0.35); overflow: hidden; }
.sf-progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--sf-emerald-bright); transition: width 0.2s linear; }
.sf-imgpick-move { display: flex; gap: 6px; }
.sf-imgpick-mv {
    flex: 1 1 0; min-width: var(--sf-tap); height: var(--sf-tap); padding: 0; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--sf-line-strong); border-radius: var(--sf-pill); background: var(--sf-surface); color: var(--sf-ink);
}
.sf-imgpick-mv:hover:not(:disabled) { border-color: var(--sf-ink-3); background: var(--sf-surface-2); }
.sf-imgpick-mv:disabled { opacity: 0.4; cursor: default; }
.sf-imgpick-retry { width: 100%; padding: 0 8px; }
.sf-imgpick--upload .sf-imgpick-add { align-self: start; }
.sf-imgpick-msg { grid-column: 1 / -1; flex: 1 1 100%; display: grid; gap: 6px; }
.sf-imgpick-msg p { margin: 0; display: flex; align-items: flex-start; gap: 8px; color: var(--sf-danger); font-weight: 600; overflow-wrap: anywhere; }
.sf-imgpick-msg .sf-icon { flex: 0 0 auto; margin-top: 2px; }
@media (prefers-reduced-motion: reduce) { .sf-progress > span { transition: none; } }

/* ---------- Notices ---------- */
.sf-notice {
    display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
    border-radius: var(--sf-radius); background: var(--sf-info-soft); color: var(--sf-ink-2); border: 1px solid var(--sf-line);
    font-size: 1rem;
}
.sf-notice .sf-icon { margin-top: 2px; }
.sf-notice strong { color: var(--sf-ink); }
.sf-notice--pending { background: var(--sf-warn-soft); color: var(--sf-warn-ink); border-color: #f0d9a8; }
.sf-notice--pending strong { color: var(--sf-warn-ink); }
.sf-notice--error { background: var(--sf-danger-soft); color: var(--sf-danger); border-color: #f5c2bd; }
.sf-notice--error strong { color: var(--sf-danger); }
.sf-notice--success { background: var(--sf-emerald-soft); color: var(--sf-emerald-ink); border-color: #b7e2cf; }
.sf-notice--success strong { color: var(--sf-emerald-ink); }

/* ---------- Empty / loading ---------- */
.sf-empty { padding: 44px 24px; text-align: center; display: grid; justify-items: center; gap: 12px; }
.sf-empty .sf-empty-icon {
    width: 64px; height: 64px; border-radius: 20px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--sf-surface-2); color: var(--sf-ink-3);
}
.sf-empty .sf-empty-icon .sf-icon { width: 30px; height: 30px; }
.sf-empty h2, .sf-empty h3 { font-size: 1.25rem; }
.sf-empty p { color: var(--sf-ink-3); max-width: 36ch; }
.sf-skel { display: block; border-radius: 10px; background: var(--sf-surface-3); }
.sf-skel-card { padding: 22px; display: grid; gap: 12px; }
.sf-skel-card .sf-skel:nth-child(1) { width: 40%; height: 16px; }
.sf-skel-card .sf-skel:nth-child(2) { width: 85%; height: 22px; }
.sf-skel-card .sf-skel:nth-child(3) { width: 60%; height: 16px; }

/* ---------- Dialog ---------- */
.sf-dialog {
    width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
    border: 0; border-radius: var(--sf-radius-lg); background: var(--sf-surface); color: var(--sf-ink);
    box-shadow: var(--sf-shadow-lift);
}
.sf-dialog::backdrop { background: rgba(10, 10, 10, 0.55); }
html.sf-root:has(dialog[open]) { overflow: hidden; }
.sf-dialog, .sf-lightbox { overscroll-behavior: contain; }
.sf-dialog-body { padding: 26px; display: grid; gap: 18px; }
.sf-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sf-dialog-head h2 { font-size: 1.45rem; }
.sf-dialog-close {
    flex: 0 0 auto; width: var(--sf-tap); height: var(--sf-tap); margin: -8px -8px 0 0; border: 0; border-radius: 50%;
    background: transparent; color: var(--sf-ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.sf-dialog-close:hover { background: var(--sf-surface-2); }
.sf-options { display: grid; gap: 8px; }
.sf-option {
    display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px;
    border: 1.5px solid var(--sf-line); border-radius: 14px; cursor: pointer; font-weight: 650;
}
.sf-option:hover { border-color: var(--sf-line-strong); }
.sf-option:has(input:checked) { border-color: var(--sf-emerald); background: var(--sf-emerald-soft); }
.sf-option input { width: 22px; height: 22px; margin: 0; accent-color: var(--sf-emerald); }
@media (max-width: 599px) {
    .sf-dialog { width: 100vw; max-width: 100vw; max-height: 92vh; max-height: 92dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
    .sf-dialog .sf-form-actions { position: sticky; bottom: 0; margin: 0 -18px calc(-22px - var(--sf-safe-bottom)); padding: 12px 18px calc(12px + var(--sf-safe-bottom)); background: var(--sf-surface); border-top: 1px solid var(--sf-line); }
    .sf-dialog-body { padding: 22px 18px calc(22px + var(--sf-safe-bottom)); }
}

/* ---------- Toast ---------- */
.sf-toast-host {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200;
    display: grid; gap: 8px; width: min(480px, calc(100vw - 32px)); pointer-events: none;
}
.sf-toast {
    display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 16px;
    background: var(--sf-black); color: #ffffff; font-weight: 650; box-shadow: var(--sf-shadow-lift); pointer-events: auto;
}
.sf-toast .sf-icon { color: var(--sf-emerald-bright); }
.sf-toast--pending .sf-icon { color: #fbbf24; }
.sf-toast--error .sf-icon { color: #f87171; }
@media (max-width: 899px) { .sf-toast-host { bottom: calc(var(--sf-bottom-h) + var(--sf-safe-bottom) + 12px); } }

/* ---------- Lightbox ---------- */
.sf-lightbox {
    width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0;
    background: rgba(5, 6, 6, 0.96); color: #ffffff;
}
.sf-lightbox::backdrop { background: rgba(5, 6, 6, 0.96); }
.sf-lightbox-inner { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 72px 72px 88px; }
.sf-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; }
.sf-lightbox-btn {
    position: absolute; width: 52px; height: 52px; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, 0.12); color: #ffffff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.sf-lightbox-btn:hover { background: rgba(255, 255, 255, 0.22); }
.sf-lightbox-btn:focus-visible { box-shadow: 0 0 0 3px #0a0a0a, 0 0 0 6px var(--sf-emerald-bright); }
.sf-lightbox-close { top: 16px; right: 16px; }
.sf-lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.sf-lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); }
.sf-lightbox-count { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); font-weight: 700; font-size: 1rem; }
@media (max-width: 599px) {
    .sf-lightbox-inner { padding: 72px 12px 96px; }
    .sf-lightbox-prev, .sf-lightbox-next { top: auto; bottom: 16px; transform: none; }
    .sf-lightbox-prev { left: 16px; }
    .sf-lightbox-next { right: 16px; }
}

/* ---------- Thread detail ---------- */
.sf-thread { padding: 26px 28px; }
.sf-thread h1 { overflow-wrap: anywhere; margin: 14px 0 16px; font-size: clamp(1.7rem, 3.6vw, 2.3rem); }
.sf-byline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sf-byline-name { display: flex; flex-direction: column; line-height: 1.3; }
.sf-byline-name a { color: var(--sf-ink) !important; font-weight: 750; text-decoration: none; }
.sf-byline-name a:hover { text-decoration: underline; }
.sf-byline-name time, .sf-byline-name small { color: var(--sf-ink-3); font-size: 0.92rem; }
.sf-prose { margin-top: 20px; font-size: 1.0625rem; line-height: 1.7; color: var(--sf-ink); overflow-wrap: anywhere; }
.sf-prose p + p { margin-top: 1em; }
.sf-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.sf-gallery button { padding: 0; border: 0; border-radius: 14px; overflow: hidden; cursor: zoom-in; aspect-ratio: 4 / 3; background: var(--sf-surface-3); }
.sf-gallery button:only-child { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.sf-gallery img { width: 100%; height: 100%; object-fit: cover; }
.sf-thread-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 18px; color: var(--sf-ink-3); font-size: 0.95rem; font-weight: 650; }
.sf-thread-stats span { display: inline-flex; align-items: center; gap: 6px; }
.sf-thread-stats .sf-icon { width: 18px; height: 18px; }
.sf-thread .sf-actions { border-top: 1px solid var(--sf-line); padding-top: 8px; margin: 18px -10px 0; }
@media (max-width: 599px) { .sf-thread { padding: 20px 18px; } }

.sf-replies-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.sf-replies { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.sf-reply { padding: 20px 22px 10px; }
.sf-reply.is-answer { border-color: #9fd7bf; box-shadow: inset 4px 0 0 var(--sf-emerald), var(--sf-shadow); }
.sf-reply-answer-tag { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--sf-emerald-ink); font-weight: 800; font-size: 0.95rem; }
.sf-reply .sf-prose { margin-top: 12px; font-size: 1.03rem; }
.sf-reply .sf-actions { margin-top: 6px; }
.sf-reply-children { list-style: none; margin: 8px 0 6px 18px; padding: 0 0 0 18px; border-left: 2px solid var(--sf-line); display: grid; gap: 4px; }
.sf-reply-children .sf-reply { padding: 14px 0 4px; border: 0; box-shadow: none; background: transparent; }
.sf-reply-child-to { color: var(--sf-ink-3); font-size: 0.92rem; }
.sf-reply.is-new { border-color: var(--sf-emerald); }
@media (max-width: 599px) {
    .sf-reply { padding: 16px 16px 8px; }
    .sf-reply-children { margin-left: 4px; padding-left: 14px; }
}

.sf-composer { padding: 22px; display: grid; gap: 14px; }
.sf-composer-head { display: flex; align-items: center; gap: 12px; }
.sf-composer .sf-textarea { min-height: 130px; }
.sf-composer-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sf-composer-tools .sf-btn[type="submit"] { margin-left: auto; }
.sf-attach { position: relative; }
.sf-attach input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sf-attach:focus-within { box-shadow: var(--sf-focus); border-radius: var(--sf-pill); }
.sf-gate { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px; }
.sf-gate h2, .sf-gate h3 { font-size: 1.2rem; }
.sf-gate-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 599px) { .sf-gate-actions { width: 100%; } .sf-gate-actions .sf-btn { flex: 1 1 0; } }

/* Community hero */
.sf-chero { padding: 26px 28px; display: grid; gap: 18px; }
.sf-chero-top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.sf-chero-title { flex: 1 1 260px; min-width: 0; }
.sf-chero-title h1 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); }
.sf-chero-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; color: var(--sf-ink-3); font-weight: 650; }
.sf-chero-desc { color: var(--sf-ink-2); font-size: 1.05rem; max-width: 60ch; }
.sf-chero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 599px) {
    .sf-chero { padding: 20px 18px; }
    .sf-chero-actions .sf-btn { flex: 1 1 0; }
    .sf-chero .sf-cicon--lg { width: 56px; height: 56px; border-radius: 16px; }
}

/* Rules list */
.sf-rules { list-style: none; margin: 0; padding: 0; counter-reset: sf-rule; display: grid; gap: 4px; }
.sf-rules li { counter-increment: sf-rule; display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; font-weight: 650; color: var(--sf-ink); }
.sf-rules li::before {
    content: counter(sf-rule); flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--sf-surface-2); color: var(--sf-ink-2); font-size: 0.88rem; font-weight: 800;
}

/* Welcome card (right rail) */
.sf-welcome { padding: 22px; display: grid; gap: 14px; background: var(--sf-black); color: #ffffff; border-color: var(--sf-black); }
.sf-welcome h2 { color: #ffffff; font-size: 1.35rem; }
.sf-welcome p { color: rgba(255, 255, 255, 0.78); }
.sf-welcome .sf-btn--primary { background: var(--sf-emerald-bright); color: var(--sf-black) !important; }
.sf-welcome .sf-btn--primary:hover { background: #6ee7b7; }
.sf-welcome .sf-btn--ghost { background: transparent; color: #ffffff !important; border-color: rgba(255, 255, 255, 0.3); }
.sf-welcome :focus-visible { box-shadow: 0 0 0 3px var(--sf-black), 0 0 0 6px var(--sf-emerald-bright); }

/* Mobile community chips (replaces the left rail below 1180px) */
.sf-chiprow { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--sf-gutter) * -1); padding: 2px var(--sf-gutter); }
.sf-chiprow::-webkit-scrollbar { display: none; }
.sf-chiprow a {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; min-height: var(--sf-tap); padding: 0 16px 0 8px;
    border-radius: var(--sf-pill); background: var(--sf-surface); border: 1px solid var(--sf-line);
    color: var(--sf-ink) !important; text-decoration: none; font-weight: 700; white-space: nowrap;
}
.sf-chiprow a:hover { border-color: var(--sf-line-strong); }
@media (min-width: 1180px) { .sf-chiprow { display: none; } }

/* Similar-discussion suggestions (create flows) */
.sf-suggest { display: grid; gap: 6px; }
.sf-suggest h3 { font-size: 1rem; }
.sf-suggest ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sf-suggest a {
    display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px;
    border-radius: 14px; background: var(--sf-surface-2); color: var(--sf-ink) !important; text-decoration: none; font-weight: 650;
}
.sf-suggest a:hover { background: var(--sf-surface-3); }
.sf-suggest a small { margin-left: auto; color: var(--sf-ink-3); font-weight: 600; white-space: nowrap; }

/* ---------- Footer ---------- */
.sf-footer { border-top: 1px solid var(--sf-line); background: var(--sf-surface); }
.sf-footer-inner {
    max-width: var(--sf-max); margin: 0 auto; padding: 26px var(--sf-gutter);
    display: flex; align-items: center; justify-content: space-between; gap: 14px 24px; flex-wrap: wrap;
    color: var(--sf-ink-3); font-size: 0.95rem;
}
.sf-footer nav { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.sf-footer a { display: inline-flex; align-items: center; min-height: var(--sf-tap); padding: 0 8px; color: var(--sf-ink-2) !important; text-decoration: none; font-weight: 650; }
.sf-footer a:hover { text-decoration: underline; color: var(--sf-ink) !important; }
