/* RestlessLimbs — base stylesheet */

:root {
    --bg: #ffffff;
    --bg-soft: #f6f8f8;
    --bg-panel: #ffffff;
    --ink: #1f3a41;
    --ink-soft: #3a4c52;
    --ink-mute: #7a8a8e;
    --line: #dde5e6;
    --line-soft: #eef3f4;
    --navy: #2b5a66;
    --navy-dark: #1f3a41;
    --navy-deep: #16303a;
    --gold: #e8b04b;
    --gold-soft: #edc06f;
    --gold-bright: #f0c987;
    --gold-deep: #b8862f;
    --teal: #3a7d8c;
    --mist: #8bb8bf;
    --cream: #f2ede3;
    --paper: #f6f8f8;
    --accent-bg: #f2ede3;
    --accent-glow: #f7e6c0;
    --success: #2e7d52;
    --success-bg: #e8f3ec;
    --error: #b3261e;
    --error-bg: #fbe9e8;
    --info: #2b5a66;
    --info-bg: #e3eef0;
    --shadow: 0 1px 2px rgba(20, 30, 50, .04), 0 4px 12px rgba(20, 30, 50, .04);
    /* Measured live by app.js; this is just a sane fallback. */
    --header-h: 70px;
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 12px;
    /* Density: multiplies card padding and the gaps between stacked blocks. */
    --density: 1;
    --pad-card: calc(18px * var(--density));
    --pad-card-x: calc(20px * var(--density));
    --gap-stack: calc(20px * var(--density));
    --grip-w: 26px; /* drag-grip overlay width; resize line meets its inner edge */
    /* Semantic tints (alerts, badges, input focus) */
    --success-line: #b8d8c4;
    --error-line: #e6b8b3;
    --info-line: #b8c7dc;
    --tint-cool: #fbfcfc;
    --tint-blue: #f7f9fd;
    --badge-open-bg: #e8f3ec;
    --badge-pending-bg: #fff3cd;
    --badge-pending-fg: #b8862f;
    --badge-admin-bg: #e3eef0;
    --badge-time-bg: #f2e9f6;
    --badge-time-fg: #6a3f8a;
    /* Share Your Story warm sub-palette */
    --story-bg: #fbf9f3;
    --story-line: #e3ddd0;
    --story-accent: #c49a63;
    --story-text: #5a554c;
    --story-muted: #a8a196;
    --story-ink: #1c1a17;
    --story-cream: #f4f0e6;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
    color: var(--ink);
    background: var(--bg-soft);
    line-height: 1.55;
    font-size: 16px;
}
h1, h2, h3, h4 {
    font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
    color: var(--navy-dark);
    line-height: 1.2;
    margin: 0 0 .5em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--site-w, 1400px); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header ---------- */
.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: .9rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    text-decoration: none;
}
.brand-logo { display: block; width: 34px; height: 34px; flex: none; }
.brand-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -.01em;
}
.brand-name .brand-limbs { font-weight: 300; color: var(--navy); }
.brand:hover { text-decoration: none; }
/* Logo outer-ring ripple — the site's one animation. Honors reduced-motion. */
.r-out { transform-box: fill-box; transform-origin: center; animation: rl-pulse 3.4s ease-in-out infinite; }
@keyframes rl-pulse {
    0%,100% { opacity:.55; transform: scale(1) translate(0,0); }
    50%     { opacity:.15; transform: scale(1.12) translate(var(--rdx,0), var(--rdy,0)); }
}
@media (prefers-reduced-motion: reduce) { .r-out { animation: none; } }

/* Nav: scope text styles to non-button anchors so .btn keeps its own colors */
.site-nav { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.site-nav a { font-size: .95rem; }
.site-nav a:not(.btn) { color: var(--ink-soft); }
.site-nav a:not(.btn):hover { color: var(--navy); text-decoration: none; }
.site-nav a.nav-admin { color: var(--gold); font-weight: 600; }
.site-nav a.nav-secondary { color: var(--ink-mute); }

/* ---------- Main ---------- */
.site-main { padding: 2rem 0 4rem; min-height: calc(100vh - 200px); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: .55rem 1.1rem;
    font-size: .95rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    line-height: 1.4;
    transition: all .12s ease;
}
.btn:hover { border-color: var(--navy); text-decoration: none; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); border-color: var(--navy-dark); color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff; }
.btn-danger { background: var(--bg); border-color: var(--error-line); color: var(--error); }
.btn-danger:hover { background: var(--error-bg); border-color: var(--error); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--line-soft); border-color: var(--line-soft); }
.btn-sm { padding: .35rem .85rem; font-size: .85rem; }
.btn-lg { padding: .8rem 1.6rem; font-size: 1.05rem; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: .35rem;
    color: var(--ink-soft);
    font-size: .9rem;
}
input[type=text], input[type=email], input[type=password],
input[type=date], input[type=time], input[type=url], input[type=number],
select, textarea {
    width: 100%;
    padding: .6rem .8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    font-family: inherit;
    font-size: .95rem;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, .12);
}
textarea { min-height: 110px; resize: vertical; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row > .form-group { flex: 1 1 200px; }
.form-help { font-size: .85rem; color: var(--ink-mute); margin-top: .25rem; }
.checkbox-row { display: flex; gap: .5rem; align-items: center; }
.checkbox-row input { width: auto; }

/* ---------- Cards / panels ---------- */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: calc(1.5rem * var(--density));
    box-shadow: var(--shadow);
    margin-bottom: calc(1.5rem * var(--density));
}
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }

/* ---------- Alerts ---------- */
.alert {
    padding: .8rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.2rem;
    border: 1px solid;
}
.alert-success { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.alert-error   { background: var(--error-bg);   border-color: var(--error-line);   color: var(--error); }
.alert-info    { background: var(--info-bg);    border-color: var(--info-line);     color: var(--info); }

/* ============================================================
   LANDING PAGE — split hero, proof strip, features, CTA band
   ============================================================ */

/* Deep-navy hero echoing the book cover. Subtle paper-grain noise + warm
   light radiating from where the cover sits. The gradient is anchored to
   the same near-black navy as the cover itself. */
.hero {
    background:
        radial-gradient(ellipse at 78% 50%, rgba(232, 200, 122, .14) 0%, rgba(232, 200, 122, 0) 55%),
        radial-gradient(ellipse at 25% 30%, rgba(15, 38, 71, .55) 0%, rgba(3, 10, 31, 0) 70%),
        linear-gradient(135deg, var(--navy-deep) 0%, var(--navy-dark) 65%, var(--navy-dark) 100%);
    color: #fff;
    border-bottom: none;
    margin: -2rem -1.25rem 0;
    padding: 5rem 1.25rem 4.5rem;
    position: relative;
    overflow: hidden;
}
.hero::before {
    /* paper-grain noise layered over the navy, very subtle */
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    opacity: .55;
    mix-blend-mode: overlay;
    pointer-events: none;
}
.hero::after {
    /* gold spotlight where the cover sits */
    content: "";
    position: absolute;
    top: 50%; right: 6%;
    transform: translateY(-50%);
    width: 720px; height: 720px;
    background: radial-gradient(circle, rgba(232, 200, 122, .22) 0%, rgba(232, 200, 122, .06) 35%, rgba(232, 200, 122, 0) 65%);
    pointer-events: none;
}
.hero-inner {
    display: flex;
    align-items: center;
    gap: 4rem;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}
.hero-text { flex: 1 1 540px; }
.hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: .25em;
    font-size: .78rem;
    color: var(--gold-bright);
    margin: 0 0 1.4rem;
    font-weight: 500;
    opacity: .92;
}
.hero h1 {
    font-family: var(--font-head, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif);
    font-size: 4.4rem;
    line-height: 1.0;
    letter-spacing: .005em;
    margin-bottom: 1.4rem;
    color: #fff;
    font-weight: 600;
}
.hero h1 .hero-the {
    display: block;
    font-family: var(--font-head, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif);
    font-size: .22em;
    font-style: italic;
    color: var(--gold-bright);
    letter-spacing: .35em;
    text-transform: uppercase;
    font-weight: 400;
    margin-bottom: .7em;
    margin-left: .25em;
    opacity: .85;
}
.hero h1 .hero-one {
    background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold-bright) 30%, var(--gold) 60%, var(--gold-bright) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: var(--gold-bright); /* fallback */
    text-shadow: 0 2px 30px rgba(232, 200, 122, .25);
    letter-spacing: .01em;
}
.hero h1 .hero-for {
    display: block;
    font-family: var(--font-head, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif);
    font-style: italic;
    color: rgba(255, 255, 255, .7);
    font-size: .32em;
    font-weight: 400;
    letter-spacing: .04em;
    margin-top: .5em;
    margin-left: .15em;
    -webkit-text-fill-color: rgba(255, 255, 255, .7);
}
.hero .lede {
    font-size: 1.18rem;
    line-height: 1.55;
    margin-bottom: 2rem;
    color: rgba(255, 255, 255, .82);
    max-width: 540px;
}
.hero .cta { display: flex; gap: .7rem; flex-wrap: wrap; }
.hero .btn-primary {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--navy-deep);
    font-weight: 600;
}
.hero .btn-primary:hover {
    background: var(--gold-bright);
    border-color: var(--gold-bright);
    color: var(--navy-deep);
}
.hero .btn:not(.btn-primary) {
    background: transparent;
    border-color: rgba(255, 255, 255, .35);
    color: #fff;
}
.hero .btn:not(.btn-primary):hover {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .6);
    color: #fff;
}

.hero-cover {
    flex: 0 0 auto;
    width: 310px;
    aspect-ratio: 5 / 8;
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: transform .6s cubic-bezier(.2,.8,.2,1);
    box-shadow:
        0 1px 1px rgba(0, 0, 0, .15),
        0 2px 8px rgba(0, 0, 0, .25),
        0 18px 50px rgba(194, 151, 74, .35),
        0 40px 90px rgba(0, 0, 0, .5);
    position: relative;
}
.hero-cover::before {
    /* soft gold ring behind the cover */
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(232, 200, 122, .4), rgba(194, 151, 74, .15));
    z-index: -1;
    filter: blur(8px);
    pointer-events: none;
}
.hero-cover::after {
    /* subtle gloss on the cover, top-left */
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,0) 35%);
    pointer-events: none;
}
.hero-cover:hover { transform: translateY(-6px) scale(1.02); }
.hero-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.proof-strip {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 2.5rem 1.25rem;
    margin: 0 -1.25rem;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}
.proof-item { text-align: center; }
.proof-number {
    font-family: var(--font-head, "Iowan Old Style", Georgia, serif);
    font-size: 2.6rem;
    color: var(--navy-dark);
    line-height: 1;
    margin-bottom: .25rem;
}
.proof-label {
    font-size: .85rem;
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    padding: 4rem 0 2rem;
}
.feature {
    text-align: left;
}
.feature-icon {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--accent-bg);
    color: var(--gold-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.feature h3 {
    font-size: 1.25rem;
    margin-bottom: .4rem;
}
.feature p {
    color: var(--ink-soft);
    margin: 0;
    font-size: .98rem;
}

.cta-band {
    background: var(--navy-deep);
    color: #fff;
    margin: 3rem -1.25rem;
    padding: 3.5rem 1.25rem;
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(232, 200, 122, .12) 0%, rgba(232, 200, 122, 0) 50%),
        linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 100%);
    position: relative;
}
.cta-band::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='9'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    opacity: .5;
    mix-blend-mode: overlay;
    pointer-events: none;
}
.cta-band-inner { max-width: 1100px; margin: 0 auto; position: relative; z-index: 1; }
.cta-band h2 {
    color: #fff;
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: 1.9rem;
    font-family: var(--font-head, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif);
    font-weight: 600;
}
.cta-band-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2.5rem;
}
.cta-band-grid h4 {
    color: var(--gold-bright);
    font-family: var(--font-head, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif);
    font-size: 1.2rem;
    font-style: italic;
    margin-bottom: .5rem;
    font-weight: 500;
}
.cta-band-grid p {
    color: rgba(255,255,255,.78);
    margin: 0;
    font-size: .95rem;
}

.closing {
    text-align: center;
    padding: 3rem 0 1rem;
    max-width: 720px;
    margin: 0 auto;
}
.closing h2 { margin-bottom: 1rem; }
.closing p { font-size: 1.05rem; color: var(--ink-soft); }

/* ============================================================
   GROUP / DASHBOARD shared (unchanged from earlier)
   ============================================================ */

.group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
}
.group-card {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}
.group-card h3 { margin: 0 0 .35rem; font-size: 1.1rem; }
.group-card .meta { font-size: .85rem; color: var(--ink-mute); margin-bottom: .6rem; }
.group-card .desc { color: var(--ink-soft); font-size: .92rem; flex: 1; margin-bottom: 1rem; }
.group-card .actions { display: flex; gap: .5rem; }

.badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: var(--line-soft);
    color: var(--ink-soft);
}
.badge-open { background: var(--badge-open-bg); color: var(--success); }
.badge-private { background: var(--accent-bg); color: var(--gold-deep); }
.badge-pending { background: var(--badge-pending-bg); color: var(--badge-pending-fg); }
.badge-archived { background: var(--line-soft); color: var(--ink-mute); }
.badge-admin { background: var(--badge-admin-bg); color: var(--navy); }
.badge-time { background: var(--badge-time-bg); color: var(--badge-time-fg); }
.report-link { color: var(--ink-mute); }
.pin-toggle { color: var(--teal); font: inherit; }
.pinned-badge { display: inline-block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--gold-deep); background: var(--accent-glow); padding: .1rem .45rem; border-radius: 999px; vertical-align: middle; }

/* Share Your Story teaser list: show 3 posts, scroll for the rest. Titles are
   clamped to one line so every row is the same height and exactly 3 fit. */
/* Share Your Story rows keep uniform single-line titles; the surrounding
   .disc-scroll box now provides the (admin-configurable) height + scrolling. */
.story-scroll > li { min-height: 4rem; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; }
.story-scroll > li:last-child { border-bottom: 0 !important; }
.story-scroll .story-list-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Scrollable discussion lists (homepage Recent + group pages). Admin sets the
   height and paging mode (infinite vs Newer/Older) on the Settings page. */
.disc-scroll { overflow-y: auto; }
.disc-scroll::-webkit-scrollbar { width: 9px; }
.disc-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
/* Admin-only resize handle — same treatment as the homepage box: a hover outline
   around the box + a grab pill centered on its bottom edge, both kept visible while
   actively resizing. */
.disc-scroll-wrap { position: relative; --grip-radius: 6px; }
/* Outline only for admins (their wrap contains the .disc-resize handle). */
.disc-scroll-wrap:has(.disc-resize)::after {
    content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
    border: 1px solid transparent; border-radius: var(--grip-radius, 0);
    transition: border-color .12s;
}
.disc-scroll-wrap:has(.disc-resize):hover::after,
.disc-scroll-wrap.is-resizing::after { border-color: var(--line); }
.disc-resize {
    position: absolute; left: 0; right: 0; bottom: 0; height: 12px; z-index: 6;
    cursor: ns-resize; user-select: none;
}
.disc-resize::before {
    content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%);
    width: 40px; height: 10px; box-sizing: border-box;
    border: 1px solid var(--line); border-radius: 999px; background-color: var(--bg-panel);
    opacity: 0; transition: opacity .12s, border-color .12s;
}
.disc-scroll-wrap:hover .disc-resize::before,
.disc-scroll-wrap.is-resizing .disc-resize::before { opacity: 1; }
.disc-resize:hover::before,
.disc-resize:active::before,
.disc-scroll-wrap.is-resizing .disc-resize::before { border-color: var(--ink-mute); }
/* Handle marks the box's true bottom — drop the panel's bottom padding below it so
   there's no dead space under the handle (infinite mode: the box is the last child). */
.panel:has(> .disc-scroll-wrap:last-child) { padding-bottom: 0; }
body.is-resizing-disc { cursor: ns-resize; user-select: none; }
body.is-resizing-disc .disc-scroll { scroll-behavior: auto; }

/* Admin-only homepage section editor. No permanent chrome — the reorder+label
   chip and the hide × float in the top corners and appear only on hover, so they
   add zero page height and sizes stay pixel-accurate. */
.home-section { position: relative; }
/* Consistent gap between sections so resizing one never collapses the spacing to
   the next (the flex gap sits outside each section, off the resize/drag handles). */
.home-sections { display: flex; flex-direction: column; gap: calc(24px * var(--density)); }
.home-sections > .home-section { min-height: 20px; } /* keep an empty section grabbable */
/* Shared drag grip (SortableJS handle) — a ⠿ that appears on hover as an overlay
   inside the item's left edge. Grabbing is limited to this; SortableJS drives the
   reorder (cliopanion-style: real ghost that tracks the cursor, live shuffle, touch). */
.drag-grip {
    position: absolute; left: 0; top: 0; bottom: 0; width: var(--grip-w); z-index: 5;
    display: flex; align-items: center; justify-content: center;
    cursor: grab; color: var(--ink-mute); font-size: 1.05rem; line-height: 1;
    user-select: none; -webkit-user-select: none; touch-action: none;
    background: rgba(0, 0, 0, .04); border-right: 1px solid var(--line-soft);
    /* left corners follow the object's own radius (set per host via --grip-radius) */
    border-top-left-radius: var(--grip-radius, 0);
    border-bottom-left-radius: var(--grip-radius, 0);
    opacity: 0; transition: opacity .12s, color .12s, background .12s;
}
.drag-grip:hover { color: var(--teal); background: rgba(0, 0, 0, .07); }
.drag-grip:active { cursor: grabbing; }
.home-section:hover > .drag-grip { opacity: 1; }
/* On hover, trace the object's full outline — closing the loop with the grip (left)
   and the resize line (bottom), which sit above it and cap the corners. Matches the
   object's corner radius. */
.home-section::after {
    content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
    border: 1px solid transparent; border-radius: var(--grip-radius, 0);
    transition: border-color .12s;
}
.home-section:hover::after { border-color: var(--line); }
/* Match the grip's rounded left edge to each section object's radius. */
.home-section:has(.help-band)    { --grip-radius: 16px; }
.home-section:has(.board)        { --grip-radius: 12px; }
.home-section:has(.welcome-card) { --grip-radius: 10px; }
/* SortableJS drag visuals (shared across every reorder surface) */
.sortable-ghost { opacity: .4; }
.sortable-drag { opacity: .9; }
/* Hide × — small, top-right, hover-only; titles are left-aligned so it clears them. */
.home-section-remove {
    position: absolute; top: 3px; right: 3px; z-index: 4;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
    width: 22px; height: 20px; padding: 0; cursor: pointer;
    font-size: 1rem; line-height: 1; color: var(--ink-mute);
    opacity: 0; transition: opacity .12s;
}
.home-section:hover > .home-section-remove { opacity: 1; }
.home-section-remove:hover { color: var(--error); border-color: var(--error); }
/* Per-section reset (↺) — sits just left of the hide ×, same hover-reveal. */
.home-section-reset {
    position: absolute; top: 3px; right: 29px; z-index: 4;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
    width: 22px; height: 20px; padding: 0; cursor: pointer;
    font-size: .9rem; line-height: 1; color: var(--ink-mute);
    opacity: 0; transition: opacity .12s;
}
.home-section:hover > .home-section-reset { opacity: 1; }
.home-section-reset:hover { color: var(--teal); border-color: var(--teal); }
/* Page-level "Reset layout" button, beside "+ Add section". */
.home-reset-page {
    background: none; border: 1px dashed var(--line); border-radius: var(--radius);
    padding: 6px 12px; margin-left: 8px; cursor: pointer;
    color: var(--ink-mute); font-size: .85rem;
}
.home-reset-page:hover { border-color: var(--teal); color: var(--teal); }
.home-section.dragging { opacity: .5; }
.home-section-add { margin: 10px 0 4px; }
.home-add-btn { background: none; border: 1px dashed var(--line); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; color: var(--ink-mute); font-size: .85rem; }
.home-add-btn:hover { border-color: var(--teal); color: var(--teal); }
.home-add-menu { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-width: 280px; }
.home-add-item { text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; cursor: pointer; font-size: .85rem; }
.home-add-item:hover { background: var(--cream); }
/* Per-section resize handle — a thin grab strip sitting exactly ON the section's
   bottom border, adding zero page height so sizes are pixel-accurate. */
/* Resized section: the fixed-height box clips the content's own bottom margin, so
   carry the section gap on the box itself to keep spacing when resized. In the
   admin editor the flex-container gap handles it, so zero it there to avoid double. */
/* content-box so a top-space padding ADDS height (grows the box upward) instead of
   eating into the fixed height — keeps the top handle independent of the bottom. */
.home-fit { overflow: hidden; margin-bottom: 24px; box-sizing: content-box; }
.home-section .home-fit { margin-bottom: 0; }
.home-section-resize {
    position: absolute; left: 0; right: 0; bottom: 0; height: 12px; z-index: 6;
    cursor: ns-resize; font-size: 0; user-select: none;
}
/* Resize affordance: a plain grab pill centered vertically on the object's bottom
   outline (the line runs through it). Same colour as the outline; darkens on
   hover/drag. The uniform line all around is the object outline (::after). */
.home-section-resize::before {
    content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%);
    width: 40px; height: 10px; box-sizing: border-box;
    border: 1px solid var(--line); border-radius: 999px; background-color: var(--bg-panel);
    opacity: 0; transition: opacity .12s, border-color .12s;
}
.home-section:hover > .home-section-resize::before { opacity: 1; }
.home-section-resize:hover::before,
.home-section-resize:active::before { border-color: var(--ink-mute); }
/* Top handle: same pill, on the object's top edge — drag up to add space above. */
.home-section-resize.at-top { top: 0; bottom: auto; }
.home-section-resize.at-top::before { top: -5px; bottom: auto; }
/* While actively resizing, keep the outline + grip + pill shown even though the
   cursor has left the section (mirrors how the drag state stays visible). */
/* While resizing one section, don't let others reveal their handles as the cursor
   passes over them (the drag runs on document listeners, so this is safe). */
body.is-resizing-disc .home-section:not(.is-resizing) { pointer-events: none; }
.home-section.is-resizing::after { border-color: var(--line); }
.home-section.is-resizing > .drag-grip { opacity: 1; }
.home-section.is-resizing > .home-section-resize::before { opacity: 1; border-color: var(--ink-mute); }
/* On phones a nested scroll box can't hand a touch gesture off to the page at
   its top/bottom, so these sections flow with the page instead (the whole page
   scrolls as one). Overrides the inline max-height set from admin settings. */
@media (max-width: 640px) {
    .disc-scroll { max-height: none !important; height: auto !important; overflow: visible; }
    .disc-resize, .home-section-resize { display: none; }
    .home-fit { height: auto !important; overflow: visible; }
    .home-zoom { zoom: 1 !important; }
}
.disc-loader { text-align: center; padding: .75rem 0; color: var(--ink-mute); font-size: .9rem; }
.disc-pager { display: flex; justify-content: space-between; gap: .5rem; margin-top: .75rem; }
.disc-pager .btn { min-width: 5.5rem; text-align: center; }
.disc-filter-tabs { display: flex; gap: .3rem; margin: 0 0 .85rem; }
.disc-filter-tabs a { padding: .28rem .8rem; border-radius: 999px; font-size: .9rem; color: var(--ink-soft); text-decoration: none; border: 1px solid transparent; }
.disc-filter-tabs a:hover { background: var(--line-soft); }
.disc-filter-tabs a.is-active { background: var(--navy); color: #fff; }

/* Admin inline sidebar editor (drag to reorder, × to remove, + to add). */
.sidebar-cards { display: flex; flex-direction: column; gap: var(--gap-stack); }
.sidebar-cards .panel { margin-bottom: 0; } /* group sidebar: spacing comes from the flex gap, not panel margins */
.sidebar-card { position: relative; }
.sidebar-card.is-hidden { display: none; }
.sidebar-card.dragging { opacity: .5; }
/* Sidebar cards use the shared ⠿ drag-grip (left-edge hover overlay) + SortableJS. */
.sidebar-card:hover > .drag-grip { opacity: 1; }
.sidebar-card:has(.home-card) { --grip-radius: 12px; }
.sidebar-card:has(.panel)     { --grip-radius: 6px; }
.sidebar-remove { position: absolute; top: 6px; right: 8px; background: none; border: 0; padding: 0 2px; cursor: pointer; color: var(--ink-mute); font-size: 1.15rem; line-height: 1; z-index: 2; }
.sidebar-remove:hover { color: var(--error); }
.sidebar-add-btn { width: 100%; padding: .5rem; border: 1px dashed var(--line); border-radius: var(--radius); background: none; color: var(--ink-mute); cursor: pointer; font-size: .9rem; }
.sidebar-add-btn:hover { border-color: var(--teal); color: var(--teal); }
.sidebar-add-menu { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-add-item { text-align: left; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); cursor: pointer; font-size: .9rem; }
.sidebar-add-item:hover { border-color: var(--teal); color: var(--teal); }

/* Share Your Story panel — header mirrors the Recent-discussions board header. */
.share-story-panel { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin: 0 0 24px; }
.share-story-panel .story-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; background: var(--cream); border-bottom: 1px solid var(--line); font-weight: 600; font-size: .9rem; color: var(--navy); }
.share-story-panel .story-intro { margin: 0; padding: 12px 20px 0; color: var(--ink-soft); font-size: .9rem; }
.share-story-panel .story-box { margin: 0; padding: 2px 20px 8px; }
/* Admin nav tabs are draggable to reorder (see admin-nav.js). */
.admin-nav-tab { cursor: grab; }
.admin-nav-tab:active { cursor: grabbing; }
.admin-nav-dragging { opacity: .45; }
/* Account page: cap the "Your discussions/replies" lists so they don't run for
   pages; unwrap on phones so they don't become a nested scroll trap. */
.profile-post-scroll { max-height: 340px; overflow-y: auto; }
@media (max-width: 640px) { .profile-post-scroll { max-height: none; overflow: visible; } }
/* Homepage group cards: reorder via the shared ⠿ drag-grip + SortableJS (admins). */
.featured-card:hover > .drag-grip { opacity: 1; }
.featured-grid[data-home-groups] .featured-card { --grip-radius: 12px; }
.groups-intro { color: var(--ink-soft); font-size: .95rem; margin: -.15rem 0 1.2rem; }

/* ── Nav search box + type-ahead dropdown ──────────────────────────────── */
.nav-search { position: relative; display: flex; align-items: center; gap: .4rem;
    flex: 0 1 260px; margin: 0 .9rem 0 auto; background: var(--bg); border: 1px solid var(--line);
    border-radius: 999px; padding: .28rem .8rem; }
.nav-search:focus-within { border-color: var(--teal); }
.nav-search-icon { width: 16px; height: 16px; color: var(--ink-mute); flex: none; }
.nav-search input { border: 0; outline: 0; background: none; font: inherit; font-size: .9rem;
    width: 100%; color: var(--ink); }
.nav-search-results { position: fixed; top: 4rem; left: 50%; transform: translateX(-50%); z-index: 60;
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 12px 34px -12px rgba(0,0,0,.28);
    max-height: 68vh; overflow-y: auto; padding: 4px; width: 520px; max-width: 92vw; }
.ns-group { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    color: var(--ink-mute); padding: 8px 10px 3px; }
.ns-item { display: block; padding: 7px 10px; border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.ns-item:hover, .ns-item.is-active { background: var(--paper); text-decoration: none; }
.ns-label { display: block; font-size: .9rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ns-meta { display: block; font-size: .76rem; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) {
    /* .site-nav hides on mobile; search collapses to a right-aligned icon that
       expands to a full field when tapped, and collapses on tap-out (search.js). */
    .nav-search { flex: 0 0 auto; margin: 0 0 0 auto; padding: 6px; border: 0; background: none; gap: 0; }
    .nav-search input { width: 0; min-width: 0; padding: 0; opacity: 0; pointer-events: none; }
    .nav-search-icon { width: 22px; height: 22px; color: var(--navy); cursor: pointer; }
    .nav-search.is-open { flex: 1 1 auto; margin-left: .6rem; padding: .3rem .85rem;
        border: 1px solid var(--line); background: var(--bg); gap: .4rem; }
    .nav-search.is-open input { width: 100%; opacity: 1; pointer-events: auto; }
    /* Full-width dropdown on mobile (the open field spans the header). */
    .nav-search-results { top: 3.5rem; left: 8px; right: 8px; transform: none; width: auto; max-width: none; }
}

/* ── Search results page ───────────────────────────────────────────────── */
.search-page { max-width: 760px; margin: 0 auto; }
.search-page-form { display: flex; gap: .5rem; margin: .6rem 0 1rem; }
.search-page-form input { flex: 1; }
.search-group { margin-top: 1.6rem; }
.search-group h2 { font-size: 1.05rem; margin: 0 0 .5rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); }
.search-list { list-style: none; margin: 0; padding: 0; }
.search-list li { padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.search-list li:last-child { border-bottom: 0; }
.search-title { display: block; color: var(--ink); text-decoration: none; font-weight: 500; }
.search-title:hover { color: var(--teal); }
.search-meta { font-size: .82rem; color: var(--ink-mute); margin-top: 2px; }
.search-member { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); }

/* ── How you can help band ─────────────────────────────────────────────── */
.help-band { margin: 0 0 24px; padding: 2.6rem 1.5rem; border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--navy) 0%, var(--teal) 100%); color: #fff; }
.help-heading { text-align: center; color: #fff; margin: 0 0 1.9rem; font-size: 1.6rem; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.8rem; max-width: 1000px; margin: 0 auto; }
/* Scoped to .help-band: the Help PAGE also uses .help-card, on a white
   surface — unscoped white text made those paragraphs invisible. */
.help-band .help-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .55rem; }
.help-band .help-icon { width: 42px; height: 42px; color: var(--gold); }
.help-band .help-card h3 { margin: .15rem 0 0; color: #fff; font-size: 1.05rem; }
.help-band .help-card p { margin: 0; color: rgba(255,255,255,.9); font-size: .92rem; line-height: 1.5; flex: 1; }
.help-band .btn-primary { margin-top: .5rem; background: #fff; color: var(--navy); border-color: #fff; }
.help-band .btn-primary:hover { background: var(--cream); color: var(--navy); }

/* ── Share dialog ──────────────────────────────────────────────────────── */
.share-dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.2rem 1.5rem 1.5rem;
    max-width: 420px; width: 90%; color: var(--ink); background: var(--paper); }
.share-dialog::backdrop { background: rgba(0,0,0,.45); }
.share-dialog h3 { margin: 0 0 .25rem; }
.share-close-row { text-align: right; margin: -.4rem -.6rem 0 0; }
.share-close { background: none; border: 0; font-size: 1.7rem; line-height: 1; cursor: pointer; color: var(--ink-mute); }
.share-copy-btn { width: 100%; text-align: center; margin: 1rem 0 .2rem; }
.share-icons { display: flex; gap: .55rem; flex-wrap: wrap; justify-content: center; margin: .7rem 0 .3rem; }
.share-ico { width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center;
    justify-content: center; border: 1px solid var(--line); color: var(--navy); background: var(--bg);
    text-decoration: none; transition: background .12s ease; }
.share-ico:hover { background: var(--cream); }
.share-ico svg { width: 21px; height: 21px; fill: currentColor; }
.share-copied { color: var(--teal); font-weight: 600; font-size: .9rem; text-align: center; margin: .4rem 0 0; }

/* ── Donate form ───────────────────────────────────────────────────────── */
.donate-amounts { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.1rem 0 1.3rem; }
.donate-amount input[type=radio] { position: absolute; opacity: 0; width: 0; height: 0; }
.donate-amount span { display: inline-flex; align-items: center; padding: .55rem 1.1rem;
    border: 1.5px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 600; }
.donate-amount input:checked + span { border-color: var(--teal); background: var(--cream); color: var(--teal); }
.donate-amount input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.donate-amount-custom span input { border: 0; background: transparent; font-weight: 600; color: inherit; }

/* ── Donation popup (Stripe Embedded Checkout inside our own modal) ─────── */
.donate-modal-root { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.donate-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.donate-modal-card { position: relative; background: var(--bg); border-radius: var(--radius-lg); width: min(480px, 94vw);
    max-height: 92vh; overflow-y: auto; padding: 1.2rem 1.2rem 1.4rem; box-shadow: 0 20px 60px -20px rgba(0,0,0,.5); }
.donate-modal-close { position: absolute; top: .4rem; right: .6rem; background: none; border: 0; font-size: 1.7rem; line-height: 1; cursor: pointer; color: var(--ink-mute); }
.donate-modal-title { margin: .1rem 0 1rem; font-size: 1.2rem; }
.donate-modal-mount { min-height: 200px; }
.donate-modal-loading .donate-modal-mount::before { content: "Loading secure checkout…"; display: block; color: var(--ink-mute); font-size: .9rem; padding: 1.5rem 0; text-align: center; }
.donate-modal-error { color: #c0392b; margin-top: .6rem; font-size: .9rem; }
body.donate-modal-open { overflow: hidden; }
@media (max-width: 600px) {
    .donate-modal-root { padding: 0; }
    .donate-modal-card { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
}
.share-story-panel .story-cta-lead { margin: 10px 0 4px; padding: 0 20px; color: var(--ink); font-size: .9rem; font-weight: 600; }
.share-story-panel .story-cta-list { margin: 0; padding: 0 20px 0 40px; color: var(--ink-soft); font-size: .9rem; }
.share-story-panel .story-cta-list li { margin: 3px 0; }
.share-story-panel > .btn-primary { display: inline-block; margin: 14px 20px 18px; }
.story-list li { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.story-list-title { font-weight: 600; text-decoration: none; color: var(--ink); }
.story-meta { font-size: .85rem; color: var(--ink-mute); margin-top: 2px; }

/* Small line-icon in each sidebar card heading. */
.home-card > h4 { display: flex; align-items: center; gap: .45rem; }
.home-card > h4 .card-icon { width: 16px; height: 16px; flex: none; color: var(--teal); }

/* Founder note on the About page. */
.founder-note { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.founder-note h2 { font-size: 1.2rem; color: var(--ink); margin: 0 0 .75rem; }
.founder-note p { line-height: 1.6; }
.founder-note a { color: var(--teal); }
.founder-note .founder-sign { margin-top: 1rem; color: var(--ink-mute); }

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.table th, .table td {
    padding: .7rem .9rem;
    text-align: left;
    border-bottom: 1px solid var(--line-soft);
    font-size: .92rem;
}
.table th { background: var(--bg-soft); font-weight: 600; color: var(--ink-soft); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: none; }
.table-actions { white-space: nowrap; }

.discussion-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--line-soft);
}
.discussion-item:last-child { border-bottom: none; }
.discussion-item h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.discussion-item .meta { font-size: .85rem; color: var(--ink-mute); margin-bottom: .5rem; }
.discussion-item .preview {
    color: var(--ink-soft);
    font-size: .92rem;
    max-height: 22em;
    overflow: hidden;
    position: relative;
    -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
            mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
}
/* The whole post body is a tap target that opens the full discussion. The
   overlay sits above the (masked/clamped) preview so mobile users can tap it;
   real links inside the body ride above the overlay and stay clickable. */
.discussion-item .preview-wrap { position: relative; }
.discussion-item .preview-open { position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.discussion-item .preview-wrap .preview a { position: relative; z-index: 2; }
.discussion-item .preview > *:first-child { margin-top: 0; }
.discussion-item .preview > *:last-child { margin-bottom: 0; }

/* Mobile: keep discussion titles + previews compact.
   Desktop lets the text breathe (a couple paragraphs of preview). */
@media (max-width: 640px) {
    .discussion-item h3,
    .discussion-item h3 a,
    .board .t-title,
    .story-list-title {
        display: -webkit-box;
        -webkit-line-clamp: 1;
        line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .discussion-item .preview {
        max-height: 5em;
    }
}

.thread-post {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.thread-post .post-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: .8rem;
    flex-wrap: wrap;
    gap: .5rem;
}
.thread-post .author { font-weight: 600; color: var(--navy); }
.thread-post .timestamp { color: var(--ink-mute); font-size: .85rem; }
.thread-post .body { white-space: normal; }
.reply-list { margin-left: 2rem; padding-left: 1.5rem; border-left: 2px solid var(--line); }
.reply { padding: .8rem 0; border-bottom: 1px solid var(--line-soft); }
.reply:last-child { border-bottom: none; }

.row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
/* Group pages have no shared sidebar, so cap their width so the columns don't
   sprawl across the full page. */
.group-page { max-width: 1080px; margin: 0 auto; }
.col-main { flex: 1 1 600px; }
.col-side { flex: 0 1 300px; }
.muted { color: var(--ink-mute); font-size: .9rem; }
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}
.section-title h2 { margin: 0; }
.empty-state { text-align: center; padding: 2rem; color: var(--ink-mute); }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.2rem;
    text-align: center;
}
.stat-card .stat-value {
    font-family: var(--font-head, "Iowan Old Style", Georgia, serif);
    font-size: 2.2rem;
    color: var(--navy-dark);
    line-height: 1;
    margin-bottom: .25rem;
}
.stat-card .stat-label {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-mute);
}

/* Modal */
.modal-root {
    position: fixed; inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-root[hidden] { display: none; }
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(20, 30, 50, .4);
}
.modal-card {
    position: relative;
    background: var(--bg);
    border-radius: var(--radius);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
/* Wider variant used by editors that need more room (rich-text popup, etc.) */
.modal-card--wide { max-width: 960px; }
.modal-header { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--ink-mute); padding: 0 .3rem; }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 1.2rem; overflow-y: auto; }
.modal-footer { padding: .9rem 1.2rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; justify-content: flex-end; }

/* Footer */
.site-footer {
    background: var(--bg);
    border-top: 1px solid var(--line);
    padding: 1.5rem 0;
    color: var(--ink-mute);
    font-size: .9rem;
}
.site-footer p { margin: 0; }
.footer-disclaimer { margin-top: .5rem !important; font-size: .82rem; color: var(--ink-mute); max-width: 70ch; }

/* ---------- Mobile ---------- */
@media (max-width: 880px) {
    .hero { padding: 3rem 1.25rem 2.5rem; }
    .hero-inner { flex-direction: column-reverse; text-align: center; gap: 2.5rem; }
    .hero-text { flex: 1 1 100%; }
    .hero h1 { font-size: 2.4rem; }
    .hero .lede { margin-left: auto; margin-right: auto; }
    .hero .cta { justify-content: center; }
    .hero-cover { width: 220px; transform: rotate(0); }
    .hero-cover:hover { transform: translateY(-4px); }
    .hero::before { display: none; }
}

@media (max-width: 640px) {
    h1 { font-size: 1.6rem; }
    .hero h1 { font-size: 2rem; }
    .site-nav { gap: .8rem; }
    .site-nav a { font-size: .9rem; }
    .panel { padding: 1.1rem; }
    .feature-grid { padding: 2.5rem 0 1rem; gap: 1.5rem; }
    .cta-band { padding: 2.5rem 1.25rem; }
    .cta-band h2 { font-size: 1.4rem; }
    .proof-number { font-size: 2rem; }
}

/* ---------- Utility ---------- */
.text-right { text-align: right; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 1rem; }
.gap-sm { gap: .5rem; }
.inline-form { display: inline; }

/* ============================================================
   INSPIRATIONS — Bill's weekly broadcasts
   ============================================================ */

.inspiration-marker {
    color: var(--gold);
    font-size: 1.1em;
    margin-right: .15rem;
}

.discussion-item.is-inspiration {
    background: linear-gradient(90deg, rgba(184,146,63,.06) 0%, transparent 60%);
    border-left: 3px solid var(--gold);
    padding-left: 1rem;
    margin: .5rem -1rem .5rem 0;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.inspiration-badge {
    background: var(--accent-bg);
    color: var(--gold-deep);
    font-weight: 600;
    margin-left: .5rem;
}

.thread-post.is-inspiration {
    border-left: 4px solid var(--gold);
    background: linear-gradient(135deg, #fff 0%, var(--paper) 100%);
    box-shadow:
        0 1px 2px rgba(20, 30, 50, .04),
        0 4px 14px rgba(184, 146, 63, .12);
}

.thread-post .inspiration-header {
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--gold-deep);
    margin-bottom: .8rem;
    font-weight: 600;
}

.inspiration-card {
    border-left: 3px solid var(--gold);
}

/* ============================================================
   MOBILE BOTTOM NAVIGATION — fixed icon bar for phones/tablets
   ============================================================ */

.mobile-bottom-nav {
    display: none;
}

@media (max-width: 900px) {
    /* Hide the desktop top nav (brand stays visible) */
    .site-nav {
        display: none;
    }

    /* Show the bottom nav */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: var(--bg);
        border-top: 1px solid var(--line);
        box-shadow: 0 -2px 12px rgba(20, 30, 50, 0.06);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-bottom-nav a {
        position: relative;
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .2rem;
        padding: .55rem .25rem .5rem;
        color: var(--ink-mute, #888);
        text-decoration: none;
        font-size: .68rem;
        font-weight: 600;
        line-height: 1.1;
        text-align: center;
        min-width: 0;
        transition: color .15s;
    }

    .mobile-bottom-nav a span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .mobile-bottom-nav a:hover,
    .mobile-bottom-nav a:focus {
        color: var(--navy);
        outline: none;
    }

    .mobile-bottom-nav a.is-active {
        color: var(--navy);
    }

    .mobile-bottom-nav a.is-active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 28px;
        height: 3px;
        background: var(--gold);
        border-radius: 0 0 3px 3px;
    }

    .mobile-bottom-nav svg {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }

    /* Push site content above the fixed bottom nav so nothing gets hidden */
    .site-main,
    .site-footer {
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
    }
}

/* Tighter labels on very small phones */
@media (max-width: 360px) {
    .mobile-bottom-nav a {
        font-size: .62rem;
        gap: .15rem;
    }
    .mobile-bottom-nav svg {
        width: 20px;
        height: 20px;
    }
}

/* ====================================================================
   Help links — small "?" icon next to titles/labels for quick reference
   ==================================================================== */
.help-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: .35em;
    border-radius: 50%;
    background: var(--bg-soft, #f2ede3);
    color: var(--ink-mute, #888);
    font-size: .75rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1;
    transition: background .15s, color .15s;
    vertical-align: middle;
}
.help-link:hover,
.help-link:focus {
    background: var(--gold, #e8b04b);
    color: #fff;
    text-decoration: none;
}

/* ====================================================================
   Welcome banner — shown on dashboard for new users, dismissible
   ==================================================================== */
.welcome-banner {
    background: linear-gradient(135deg, var(--navy, #2b5a66) 0%, var(--navy-deep, #16303a) 100%);
    color: #fff;
    border-radius: var(--radius, 8px);
    padding: 1.5rem 1.75rem;
    margin-bottom: 2rem;
    position: relative;
    box-shadow: 0 4px 16px rgba(15, 38, 71, 0.15);
}
.welcome-banner h2 {
    color: var(--gold-bright, #f0c987);
    margin-top: 0;
    margin-bottom: .5rem;
    font-size: 1.35rem;
}
.welcome-banner p {
    margin: 0 0 1rem;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.5;
}
.welcome-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1rem;
}
.welcome-banner-actions .btn {
    background: var(--gold, #e8b04b);
    color: var(--navy-deep, #16303a);
    border: none;
    font-weight: 600;
}
.welcome-banner-actions .btn:hover {
    background: var(--gold-bright, #f0c987);
    color: var(--navy-deep, #16303a);
}
.welcome-banner-actions .btn-ghost {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.welcome-banner-actions .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.welcome-banner-dismiss {
    position: absolute;
    top: .75rem;
    right: 1rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    cursor: pointer;
    padding: .25rem .5rem;
    line-height: 1;
}
.welcome-banner-dismiss:hover {
    color: #fff;
}

/* ====================================================================
   Help page sections
   ==================================================================== */
.help-toc {
    background: var(--bg-soft, #f2ede3);
    border-radius: var(--radius, 8px);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
}
.help-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 2;
    column-gap: 2rem;
}
@media (max-width: 600px) {
    .help-toc ul { columns: 1; }
}
.help-toc li {
    padding: .25rem 0;
    break-inside: avoid;
}
.help-section {
    scroll-margin-top: 2rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line, #dde5e6);
}
.help-section:last-child { border-bottom: none; }
.help-section h2 {
    margin-bottom: .5rem;
    color: var(--navy, #2b5a66);
}
.help-section h3 {
    margin-top: 1.25rem;
    margin-bottom: .35rem;
    font-size: 1.05rem;
}
.help-section p { margin-top: 0; }
.help-section .help-tip {
    background: var(--bg-soft, #f2ede3);
    border-left: 3px solid var(--gold, #e8b04b);
    padding: .75rem 1rem;
    margin: 1rem 0;
    border-radius: 0 4px 4px 0;
}

/* ====================================================================
   Feedback form — category picker cards
   ==================================================================== */
.feedback-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .6rem;
    margin-top: .4rem;
}
.feedback-category input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.feedback-category-card {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: 1rem;
    border: 2px solid var(--line, #dde5e6);
    border-radius: var(--radius, 8px);
    background: var(--bg);
    cursor: pointer;
    transition: border-color .12s, background .12s, transform .08s;
    height: 100%;
    box-sizing: border-box;
}
.feedback-category-card:hover {
    border-color: var(--gold, #e8b04b);
    background: var(--tint-cool);
}
.feedback-category input[type="radio"]:checked + .feedback-category-card {
    border-color: var(--navy, #2b5a66);
    background: var(--tint-blue);
}
.feedback-category input[type="radio"]:focus-visible + .feedback-category-card {
    outline: 2px solid var(--gold, #e8b04b);
    outline-offset: 2px;
}
.feedback-category-emoji {
    font-size: 1.6rem;
    line-height: 1;
    margin-bottom: .15rem;
}
.feedback-category strong {
    color: var(--navy, #2b5a66);
    font-size: .98rem;
}
.feedback-category-help {
    font-size: .82rem;
    line-height: 1.35;
    margin-top: .1rem;
}

/* ====================================================================
   App download section + badges
   - .app-cta-section : full-width hero-style band (homepage, about page)
   - .app-panel       : compact sidebar variant (per-group page)
   - .app-badges      : the row of store badges (used in both contexts)
   - Welcome popup    : first-login onboarding modal content
   ==================================================================== */

.app-cta-section {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
    color: #fff;
    border-radius: var(--radius);
    margin: 2.5rem 0;
    padding: 2.25rem 1.75rem;
    box-shadow: 0 4px 16px rgba(15, 38, 71, 0.15);
}
.app-cta-inner {
    max-width: 760px;
    margin: 0 auto;
}
.app-cta-section h2 {
    color: var(--gold-bright);
    margin: 0 0 .6rem;
    font-size: 1.6rem;
}
.app-cta-lede {
    color: rgba(255, 255, 255, 0.92);
    font-size: 1.05rem;
    line-height: 1.55;
    margin: 0 0 1.25rem;
}
.app-cta-features {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    display: grid;
    gap: .65rem;
}
.app-cta-features li {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.45;
}
.app-cta-features li svg {
    flex-shrink: 0;
    color: var(--gold-bright);
    margin-top: .15rem;
}

.app-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
}
.app-badges-compact {
    margin-top: .6rem;
    gap: .5rem;
}
.app-badge {
    display: inline-block;
    line-height: 0;
    text-decoration: none;
    transition: transform .15s ease, opacity .15s ease;
}
.app-badge img { display: block; height: auto; max-width: 100%; }
a.app-badge:hover { transform: translateY(-2px); text-decoration: none; }
.app-badge-disabled {
    opacity: .85;
    cursor: not-allowed;
    filter: grayscale(.15);
}

/* Compact sidebar variant inside a group's right column */
.app-panel {
    border-left: 3px solid var(--gold);
}
.app-panel h3 { margin-top: 0; }
.app-panel-features {
    list-style: none;
    margin: 0 0 .9rem;
    padding: 0;
    font-size: .9rem;
    color: var(--ink-soft);
}
.app-panel-features li {
    padding: .25rem 0 .25rem 1.1rem;
    position: relative;
    line-height: 1.4;
}
.app-panel-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: .25rem;
    color: var(--gold);
    font-weight: 700;
}
/* On narrow sidebar, let badges shrink so they always fit two-up if the column is wide
   enough, or stack cleanly if not. */
.app-panel .app-badges img {
    max-width: 100%;
    width: 160px;
}

/* Welcome onboarding popup (rendered via the existing modal system) */
.welcome-popup {
    color: var(--ink);
}
.welcome-popup-lede {
    margin: 0 0 1rem;
    font-size: 1rem;
    line-height: 1.5;
}
.welcome-popup-steps {
    margin: 0 0 1.1rem;
    padding-left: 1.25rem;
    display: grid;
    gap: .65rem;
}
.welcome-popup-steps li {
    line-height: 1.5;
    color: var(--ink-soft);
}
.welcome-popup-steps li strong {
    color: var(--ink);
    display: inline;
}
.welcome-popup-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 0 0 1rem;
    padding: .9rem;
    background: var(--bg-soft);
    border-radius: var(--radius);
    justify-content: center;
}
.welcome-popup-badges img { display: block; height: auto; }
.welcome-popup-help-line {
    margin: 0;
    font-size: .9rem;
    color: var(--ink-mute);
    text-align: center;
}

/* Responsive: stack neatly on small screens */
@media (max-width: 640px) {
    .app-cta-section { padding: 1.75rem 1.25rem; margin: 2rem 0; }
    .app-cta-section h2 { font-size: 1.35rem; }
    .app-cta-lede { font-size: 1rem; }
    .app-badges { gap: .5rem; }
    .welcome-popup-badges { padding: .7rem; }
}

/* ====================================================================
   Get the book — print + Kindle CTA
   - .book-cta : large card on About page, with cover + heading + button
   - small inline book links inside the group sidebar panel + welcome popup
   ==================================================================== */

.book-cta {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow);
}
.book-cta-cover {
    flex-shrink: 0;
    line-height: 0;
}
.book-cta-cover img {
    display: block;
    width: 140px;
    height: auto;
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 20px rgba(15, 38, 71, 0.2);
}
.book-cta-text {
    flex: 1 1 auto;
    min-width: 0;
}
.book-cta-text h2 {
    margin-top: 0;
    margin-bottom: .5rem;
}
.book-cta-text p {
    color: var(--ink-soft);
    margin-bottom: 1rem;
}

/* Small "Need the book?" link inside the group sidebar app panel */
.app-panel-book-link {
    margin: .9rem 0 0;
    padding-top: .9rem;
    border-top: 1px dashed var(--line);
    font-size: .85rem;
    text-align: center;
}
.app-panel-book-link a {
    color: var(--ink-soft);
}
.app-panel-book-link a:hover {
    color: var(--navy);
}

/* Book line inside the welcome popup, between badges and the help footer */
.welcome-popup-book-line {
    margin: 0 0 .6rem;
    font-size: .9rem;
    color: var(--ink-soft);
    text-align: center;
}

/* Mobile: stack the book card on small screens */
@media (max-width: 640px) {
    .book-cta {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 1.5rem 1.25rem;
    }
    .book-cta-cover img { width: 120px; }
}

/* ====================================================================
   Reading header — full-width promoted "This week's reading" banner
   on group pages, with a recent-inspirations rail on the right.
   ==================================================================== */

.reading-header {
    border-left: 4px solid var(--gold);
    margin-bottom: 1.5rem;
}
.reading-header-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 1.75rem;
    align-items: start;
}
.reading-header-section-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    margin-bottom: .5rem;
}
.reading-header-section-title h2 {
    margin: 0;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--gold-deep);
}
.reading-header-manage {
    font-size: .85rem;
    color: var(--ink-mute);
}
.reading-header-title {
    margin: 0 0 .25rem;
    font-size: 1.4rem;
    line-height: 1.25;
}
.reading-header-byline {
    font-size: .85rem;
    color: var(--ink-mute);
    margin-bottom: .65rem;
}
.reading-header-excerpt {
    position: relative;
    max-height: 5.4em;
    overflow: hidden;
    font-size: .95rem;
    color: var(--ink-soft);
    line-height: 1.55;
    margin-bottom: .85rem;
}
.reading-header-excerpt > .reading-header-excerpt-body {
    white-space: pre-wrap;
}
.reading-header-fade {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1.8em;
    background: linear-gradient(to bottom, rgba(255,255,255,0), var(--bg-panel));
    pointer-events: none;
}
.reading-header-actions {
    margin: 0;
    display: flex;
    gap: .9rem;
    flex-wrap: wrap;
    align-items: center;
}
.reading-header-past-link {
    font-size: .9rem;
    color: var(--ink-soft);
}
.reading-header-empty {
    margin: 0 0 .5rem;
    color: var(--ink-mute);
    font-size: .95rem;
}

/* Inspirations rail */
.reading-header-inspirations {
    border-left: 1px solid var(--line-soft);
    padding-left: 1.5rem;
    align-self: stretch;
}
.reading-header-section-heading {
    margin: 0 0 .65rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--gold-deep);
    display: flex;
    align-items: center;
    gap: .4rem;
}
.reading-header-section-heading .inspiration-marker {
    color: var(--gold);
    font-size: 1rem;
}
.inspiration-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.inspiration-list li {
    padding: .55rem 0;
    border-bottom: 1px dashed var(--line-soft);
}
.inspiration-list li:first-child { padding-top: 0; }
.inspiration-list li:last-child { border-bottom: none; padding-bottom: 0; }
.inspiration-link {
    display: block;
    color: var(--ink);
    text-decoration: none;
    line-height: 1.35;
}
.inspiration-link:hover { text-decoration: none; }
.inspiration-link:hover .inspiration-link-title { color: var(--navy); text-decoration: underline; }
.inspiration-link-title {
    display: block;
    font-weight: 600;
    color: var(--ink);
    font-size: .95rem;
    margin-bottom: .15rem;
    /* Clip to two lines on narrow rail */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.inspiration-link-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--ink-soft);
    font-size: .87rem;
    line-height: 1.4;
    margin-bottom: .25rem;
    /* Preserve internal whitespace just enough that double-newlines don't all collapse,
       but the line-clamp keeps the box compact regardless of paragraph breaks. */
    white-space: normal;
}
.inspiration-link-meta {
    display: block;
    font-size: .8rem;
    color: var(--ink-mute);
}
.inspiration-link-more {
    color: var(--gold);
    font-weight: 600;
    white-space: nowrap;
}
.inspiration-link:hover .inspiration-link-more {
    text-decoration: underline;
}

/* Stack on narrow viewports */
@media (max-width: 880px) {
    .reading-header { padding: 1.2rem 1.25rem; }
    .reading-header-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    .reading-header-inspirations {
        border-left: none;
        border-top: 1px solid var(--line-soft);
        padding-left: 0;
        padding-top: 1rem;
    }
    .reading-header-title { font-size: 1.2rem; }
}

/* ====================================================================
   Inspirations admin
   ==================================================================== */

.inspiration-sent-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.inspiration-sent-item {
    display: flex;
    gap: .9rem;
    align-items: flex-start;
    padding: .9rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius);
    margin-bottom: .6rem;
}
.inspiration-sent-body {
    flex: 1 1 auto;
    min-width: 0;
}
.inspiration-sent-body h3 {
    margin: 0 0 .25rem;
    font-size: 1.05rem;
}
/* Body preview: clamp to 2 lines to keep cards uniform height */
.inspiration-queue-preview {
    color: var(--ink-soft);
    font-size: .9rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* Right-side action cluster (Edit / Delete) */
.inspiration-queue-actions {
    display: flex;
    gap: .35rem;
    flex-shrink: 0;
    align-self: center;
}
.inspiration-queue-actions .inline-form {
    display: inline;
    margin: 0;
}

@media (max-width: 640px) {
    .inspiration-sent-item { flex-wrap: wrap; }
    .inspiration-queue-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: .25rem;
    }
}

/* ====================================================================
   Weekly readings — page-break separator + admin upload row
   ==================================================================== */

/* Page-break separator inside a rendered reading body */
.reading-page-break {
    text-align: center;
    color: var(--gold);
    letter-spacing: .5em;
    font-size: 1rem;
    margin: 1.8rem 0;
    user-select: none;
}

/* Make sure the body text inside the pre-wrap container doesn't inherit
   weird margin from the inserted div. The pre-wrap surrounds raw text
   with a few inline page-break divs in the middle. */
.reading-body .reading-page-break {
    /* Already block-level by default; explicit for clarity */
    display: block;
}

/* Print-friendly study guide view.
   Hides site chrome and unfolds the sidebar into normal flow so the page
   prints as a clean document with the same section structure as the
   on-screen layout. */
@media print {
    .site-header, .site-footer, .mobile-bottom-nav, .no-print { display: none !important; }
    body, .site-main, .wrap { background: #fff !important; }
    .panel { box-shadow: none !important; border: none !important; padding: 0 !important;
        margin-bottom: 1rem !important; background: transparent !important; }
    .row { display: block !important; }
    .col-main, .col-side { width: 100% !important; max-width: none !important;
        flex: none !important; }
    .study-row-2col { display: grid !important;
        grid-template-columns: 1fr 1fr !important; gap: 1rem !important; }
    .study-section { border: none !important; padding: 0 !important;
        background: transparent !important; }
    .study-section-scroll { max-height: none !important; overflow: visible !important; }
    .study-section h2 { color: #000 !important; }
    /* Sidebar content moves below the body on print */
    .col-side .panel { border-top: 1px solid #ccc !important; padding-top: .75rem !important; }
    /* Avoid splitting a question across pages */
    .col-side ol > li { page-break-inside: avoid; }
    /* Attachments make no sense on paper — videos can't play, files can't
       be opened. Discussion questions stay. */
    .attachments-panel { display: none !important; }
    /* Hide controls that don't make sense on paper */
    .btn, [data-video-lightbox], #attachment-uploads, #attachment-picker { display: none !important; }
    video, audio { display: none !important; }
    a { color: #000 !important; text-decoration: none !important; }
    a[href]:after { content: ""; }
}

/* Structured study guide layout — 2 columns for Scripture/Commentary,
   full-width Reflection Question, then 2 columns for What It Means/Prayer.
   Collapses to a single column on narrow viewports. */
.study-structured {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.study-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: stretch;
}
.study-section {
    background: var(--bg);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
}
.study-section h2 {
    margin: 0 0 .5rem;
    font-size: 1.05rem;
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.study-section-body { font-size: 1rem; line-height: 1.55; }
/* Match Quill's editor: paragraphs sit tight against each other; visual
   spacing comes from line-height and any deliberate empty <p><br></p>
   blocks the author inserted. Without this the view feels double-spaced
   relative to the editor because browser defaults add ~1em margin per
   paragraph. */
.study-section-body p { margin: 0; }
.study-section-body p + p { margin-top: 0; }
.reading-body p { margin: 0; }
.study-row-2col .study-section-scroll {
    max-height: 24rem;
    overflow-y: auto;
}
.study-section-song-link {
    border: 1px solid var(--line-soft);
    transition: background .15s ease, border-color .15s ease;
    width: 100%;
}
.study-section-song-link:hover,
.study-section-song-link:focus-visible {
    background: var(--paper);
    border-color: var(--gold, #cf9a3e);
    outline: none;
}
@media (max-width: 720px) {
    .study-row-2col { grid-template-columns: 1fr; }
    .study-row-2col .study-section-scroll { max-height: none; }
}

/* Discussion questions in the study guide sidebar: subtle divider between
   questions so the eye can track each one separately. */
.study-questions-list {
    margin: 0;
    padding-left: 1.2rem;
    list-style: decimal;
}
.study-questions-list > li {
    padding: .75rem 0;
}
.study-questions-list > li:first-child { padding-top: 0; }
.study-questions-list > li:not(:last-child) {
    border-bottom: 1px solid var(--line-soft);
}
.study-questions-list > li p:first-child { margin-top: 0; }
.study-questions-list > li p:last-child { margin-bottom: 0; }

/* Page break inside rich-text (HTML) reading bodies — styled to match the
   legacy plain-text separator so the visual is consistent across both
   storage formats. */
.reading-body hr {
    border: none;
    text-align: center;
    margin: 1.8rem 0;
}
.reading-body hr::after {
    content: "•  •  •";
    color: var(--gold);
    font-size: 1rem;
    letter-spacing: .5em;
}

/* Admin upload row: file picker + helper text on one line on desktop,
   stacking gracefully on narrow screens. Sits above the textarea. */
.reading-upload-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin-bottom: .5rem;
    padding: .65rem .8rem;
    background: var(--bg-soft);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}
.reading-upload-row input[type="file"] {
    flex: 0 0 auto;
}
.reading-upload-help {
    flex: 1 1 240px;
    margin: 0;
    color: var(--ink-mute);
    font-size: .85rem;
    line-height: 1.4;
}

@media (max-width: 640px) {
    .reading-upload-row { padding: .65rem; }
}

/* ====================================================================
   Clickable group cards
   - .group-card-link : the whole card is an <a> (Browse — non-member members case)
   - .group-card-clickable : div with JS click handler (My groups)
   Both share the same hover treatment for a consistent feel.
   ==================================================================== */

.group-card-link {
    /* Strip default anchor styling so the card looks like the others */
    text-decoration: none;
    color: inherit;
    display: flex; /* match .group-card */
    flex-direction: column;
}
.group-card-link:hover { text-decoration: none; }
.group-card-link h3 { color: inherit; }

.group-card-link,
.group-card-clickable {
    cursor: pointer;
    transition: box-shadow .15s ease, transform .12s ease, border-color .15s ease;
}
.group-card-link:hover,
.group-card-clickable:hover {
    box-shadow: 0 4px 16px rgba(15, 38, 71, 0.1);
    border-color: var(--gold);
    transform: translateY(-1px);
}
.group-card-clickable:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* ====================================================================
   Group help panel — collapsed accordion in sidebar for group admins
   Uses native <details>/<summary>; no JavaScript required.
   ==================================================================== */

.group-help-panel {
    /* Override default summary marker; we'll provide our own chevron */
    padding: 0;
}
.group-help-panel > summary {
    list-style: none;
    cursor: pointer;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    user-select: none;
    color: var(--ink);
    transition: background .15s ease;
}
.group-help-panel > summary::-webkit-details-marker { display: none; }
.group-help-panel > summary:hover { background: var(--bg-soft); }
.group-help-panel[open] > summary { border-bottom: 1px solid var(--line-soft); }
.group-help-icon { font-size: 1.15rem; flex-shrink: 0; }
.group-help-title {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
    color: var(--ink);
}
.group-help-chevron {
    color: var(--ink-mute);
    font-size: 1.4rem;
    line-height: 1;
    transition: transform .2s ease;
}
.group-help-panel[open] > summary > .group-help-chevron {
    transform: rotate(90deg);
}
.group-help-body {
    padding: 0 1.5rem 1.25rem;
    font-size: .92rem;
    line-height: 1.5;
}
.group-help-body h4 {
    margin: 1rem 0 .35rem;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--gold-deep);
}
.group-help-body p {
    margin: .35rem 0;
    color: var(--ink-soft);
}
.group-help-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.group-help-list li {
    padding: .4rem 0;
    border-bottom: 1px dashed var(--line-soft);
    color: var(--ink-soft);
    font-size: .9rem;
}
.group-help-list li:last-child { border-bottom: none; }
.group-help-list a {
    font-weight: 600;
    color: var(--ink);
}

/* ====================================================================
   Weekly readings sidebar list — title-first stacked cards
   Title spans full width; week number + actions sit on a second row.
   ==================================================================== */

.weekly-readings-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.weekly-readings-item {
    padding: .75rem 0;
    border-bottom: 1px solid var(--line-soft);
}
.weekly-readings-item:first-child { padding-top: 0; }
.weekly-readings-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.weekly-readings-title {
    font-weight: 600;
    color: var(--ink);
    line-height: 1.35;
    margin-bottom: .35rem;
    /* Wrap normally — full panel width is now available */
    word-wrap: break-word;
}
.weekly-readings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.weekly-readings-week {
    font-size: .82rem;
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.weekly-readings-actions {
    display: flex;
    gap: .35rem;
    align-items: center;
}
.weekly-readings-actions .inline-form {
    display: inline;
    margin: 0;
}

/* ====================================================================
   Inline submit buttons styled to look like text links
   Used for inline delete actions in discussion bylines.
   ==================================================================== */

.link-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--gold);
    cursor: pointer;
    font: inherit;
    text-decoration: none;
}
.link-button:hover {
    text-decoration: underline;
}
.link-button:focus {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* ====================================================================
   Attachment row in edit forms
   File icon + filename + size + small × delete button, all in one line.
   Used by discussion-edit.php and admin/inspiration-edit.php.
   ==================================================================== */

.attachment-row {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .4rem .55rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.attachment-row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-row-size {
    font-size: .82rem;
    flex-shrink: 0;
}
.attachment-row-delete {
    display: inline;
    margin: 0;
    line-height: 1;
}
.attachment-delete-btn {
    background: transparent;
    border: none;
    color: var(--ink-mute);
    font-size: 1.3rem;
    line-height: 1;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease;
    flex-shrink: 0;
}
.attachment-delete-btn:hover {
    background: var(--danger, #c0382b);
    color: #fff;
}
.attachment-delete-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 1px;
}

/* ====================================================================
   Discussion card — attachment indicator + inline audio player
   ==================================================================== */

/* Small paperclip next to titles that have any attachment */
.attachment-indicator {
    display: inline-block;
    margin-left: .2rem;
    font-size: .9em;
    vertical-align: baseline;
    opacity: .7;
}

/* Inline audio player on discussion cards in the group's Discussions list */
.discussion-audio-inline {
    margin-top: .55rem;
}
.discussion-audio-inline audio {
    display: block;
    height: 36px;
}

/* ====================================================================
   Inspirations: compact list on narrow viewports
   Defined after the desktop rules above so the cascade applies correctly
   even though both target the same selectors.
   ==================================================================== */

@media (max-width: 880px) {
    .inspiration-link-preview { display: none; }
    .inspiration-link-meta { display: none; }
    .inspiration-link-title {
        -webkit-line-clamp: 1;
        font-size: .92rem;
        margin-bottom: 0;
    }
    .inspiration-list-item { padding: .5rem 0; }
    .inspiration-list-item + .inspiration-list-item {
        border-top: 1px solid var(--line-soft);
    }
    .inspiration-link::after {
        content: "›";
        float: right;
        color: var(--gold);
        font-size: 1.2rem;
        line-height: 1;
        margin-left: .5rem;
    }
}

/* ============================================================
   HERO-EMBEDDED SONG PLAYER
   Sits inside the navy .hero section, below the existing two-column
   hero-inner. Native <audio> controls render as a light pill on the
   dark background, which looks fine across browsers without custom
   skinning.
   ============================================================ */
.hero-song {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 3rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, .15);
    text-align: center;
}
.hero-song-meta {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin: 0 0 1rem;
    font-size: .9rem;
    color: rgba(255, 255, 255, .7);
}
.hero-song-eyebrow {
    font-family: var(--font-head, "Iowan Old Style", Georgia, serif);
    color: var(--gold-bright);
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: .72rem;
    font-style: italic;
}
.hero-song-title {
    font-family: var(--font-head, "Iowan Old Style", Georgia, serif);
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: .02em;
}
.hero-song-credit {
    font-style: italic;
    color: rgba(255, 255, 255, .6);
}
.hero-song-player {
    width: 100%;
    max-width: 480px;
    display: block;
    margin: 0 auto;
}
.hero-song-actions {
    margin: .9rem 0 0;
    font-size: .9rem;
    color: rgba(255, 255, 255, .55);
}
.hero-song-actions a {
    color: var(--gold-bright);
    text-decoration: none;
    padding: .25rem .5rem;
    border-radius: var(--radius-sm);
    transition: background .2s ease, color .2s ease;
}
.hero-song-actions a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .1);
    text-decoration: none;
}
.hero-song-sep { margin: 0 .35rem; opacity: .5; }

@media (max-width: 600px) {
    .hero-song { margin-top: 2rem; padding-top: 1.5rem; }
    .hero-song-meta { font-size: .85rem; gap: .35rem; }
    .hero-song-credit { width: 100%; }
}

/* ───── Threaded replies ──────────────────────────────────────────────── */
.reply-tree { margin-top: .9rem; display: flex; flex-direction: column; gap: .55rem; }
.reply-node { display: flex; flex-direction: column; gap: .4rem; }
.reply-node.depth-0 { margin-left: 0; }
.reply-node.depth-1 { margin-left: 1.4rem; }
.reply-node.depth-2 { margin-left: 2.8rem; }
.reply-node.depth-3 { margin-left: 4.2rem; }
.reply-children { display: flex; flex-direction: column; gap: .55rem; margin-top: .4rem; }

.reply-card {
    background: var(--paper);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: .55rem .75rem;
}
.reply-head { display: flex; align-items: center; gap: .5rem; }
.reply-meta { font-size: .85rem; }
.reply-meta .author { font-weight: 600; }
.reply-meta .timestamp { color: var(--ink-mute); }

.reply-body {
    margin: .35rem 0 .25rem;
    font-size: .95rem;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
}
.reply-body[data-clamp="2"] {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.reply-body.expanded {
    display: block;
    overflow: visible;
}

.reply-more-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent, #33646f);
    font-size: .82rem;
    cursor: pointer;
    text-align: left;
}

.reply-actions { display: flex; gap: .65rem; align-items: center; margin-top: .25rem; font-size: .76rem; }
.reply-action-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent, #33646f);
    cursor: pointer;
    font-size: .76rem;
    text-decoration: underline;
    font-family: inherit;
    line-height: 1;
}
.reply-action-btn:hover { opacity: .75; }
.reply-action-form { margin: 0; display: inline; }

.reply-inline-form {
    margin-top: .45rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
/* display:flex above overrides the [hidden] attribute, so per-reply composers
   would show by default. This keeps them hidden until "Reply" is clicked. */
.reply-inline-form[hidden] { display: none; }
.reply-inline-form textarea {
    width: 100%;
    font-family: inherit;
    font-size: .92rem;
    padding: .5rem;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    resize: vertical;
    min-height: 2.4rem;
}
.reply-inline-form-actions { display: flex; gap: .4rem; }
.reply-inline-form-root { margin-top: .9rem; }

.discussion-replies-wrap { margin-left: 2.5rem; margin-top: 1.5rem; }
.discussion-replies-header { font-size: 1.1rem; margin: 0 0 .65rem; }

@media (max-width: 600px) {
    .discussion-replies-wrap { margin-left: 1rem; }
}

@media (max-width: 600px) {
    .reply-node.depth-1 { margin-left: .9rem; }
    .reply-node.depth-2 { margin-left: 1.8rem; }
    .reply-node.depth-3 { margin-left: 2.4rem; }
}

/* ============================================================
   Home / landing — light, airy forum layout (per design mockup)
   ============================================================ */
.home-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 34px;
    align-items: start;
    padding-top: 12px;
}
.home-main { min-width: 0; }

/* Shared two-column frame used by header.php/footer.php on every non-admin
   page: main content column + 300px right sidebar. Mirrors .home-layout. */
.page-layout { display: grid; grid-template-columns: 1fr var(--side-r-w, 300px); gap: calc(34px * var(--density)); align-items: start; padding-top: 12px; }
.page-layout.layout-left { grid-template-columns: var(--side-l-w, 300px) minmax(0, 1fr); }
.page-layout.layout-both { grid-template-columns: var(--side-l-w, 300px) minmax(0, 1fr) var(--side-r-w, 300px); }
.page-main { min-width: 0; }
.page-side { display: flex; flex-direction: column; gap: var(--gap-stack); }

.home-intro { padding: 0; }
.home-intro .intro-line { margin: 0; font-size: 1.125rem; line-height: 1.5; color: var(--ink-soft); }

/* Recent-discussion board */
.board {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 8px;
}
.board-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px;
    background: var(--cream);
    border-bottom: 1px solid var(--line);
    font-weight: 600; font-size: .9rem; color: var(--navy);
}
.board-all { font-weight: 400; font-size: .82rem; color: var(--teal); text-decoration: none; }
.board-all:hover { color: var(--gold); text-decoration: none; }
.board .threads { list-style: none; margin: 0; padding: 0; }
.board .threads li { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.board .threads li:last-child { border-bottom: none; }
.board .t-title { display: block; font-size: .97rem; color: var(--ink); text-decoration: none; font-weight: 500; margin-bottom: 5px; }
.board .t-title:hover { color: var(--teal); text-decoration: none; }
.board .t-meta { font-size: .8rem; color: var(--ink-mute); }
.board .t-meta .tag {
    display: inline-block; background: var(--cream); color: var(--navy);
    border-radius: var(--radius-sm); padding: 1px 8px; font-size: .72rem; margin-right: 8px;
    text-decoration: none;
}
.board .t-meta .tag:hover { color: var(--teal); }
/* Meta line lays out its pieces on one baseline-aligned, wrapping row. */
.board .t-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.board .t-meta .tag { margin-right: 0; }
.board .t-time { color: var(--ink-mute); }
/* Reply-count chip — the count is now a legible pill, not muted grey text. */
.reply-chip {
    display: inline-flex; align-items: center; gap: 3px; vertical-align: middle;
    background: var(--teal); color: #fff; border-radius: 999px;
    padding: 1px 9px 1px 7px; font-size: .74rem; font-weight: 600;
    line-height: 1.5;
}
/* Overlapping avatars of the people who've replied. */
.replier-stack { display: inline-flex; align-items: center; vertical-align: middle; }
.replier-stack .avatar { box-shadow: 0 0 0 2px var(--paper); margin-left: -7px; }
.replier-stack .avatar:first-child { margin-left: 0; }
.replier-more { margin-left: 5px; font-size: .74rem; color: var(--ink-mute); font-weight: 600; }
/* Latest-reply preview line: a face, the author, a snippet, and when — the
   whole line opens that reply. This is what turns a bare title into a thread. */
.thread-lastreply {
    display: flex; align-items: center; gap: 7px;
    margin-top: 7px; padding: 6px 10px;
    background: var(--paper); border-radius: var(--radius);
    text-decoration: none; color: var(--ink-soft); font-size: .84rem;
    border: 1px solid var(--line-soft);
}
.thread-lastreply:hover { background: var(--cream); border-color: var(--line); }
.thread-lastreply .avatar { flex: none; }
.thread-lastreply .lr-text {
    flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thread-lastreply .lr-text strong { color: var(--ink); font-weight: 600; }
.thread-lastreply .lr-time { flex: none; color: var(--ink-mute); font-size: .78rem; }

/* Inline reply on a discussion row (homepage + group cards) */
.thread-reply { margin-top: 8px; }
.thread-reply-open {
    background: none; border: 0; padding: 4px 0; cursor: pointer;
    color: var(--teal); font-size: .85rem; font-weight: 600; font-family: inherit;
}
.thread-reply-open:hover { color: var(--navy); text-decoration: underline; }
.thread-reply-form { margin-top: 6px; }
.thread-reply-input {
    width: 100%; box-sizing: border-box; resize: vertical; min-height: 2.6em;
    padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius);
    font: inherit; background: var(--bg);
}
.thread-reply-input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.thread-reply-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.thread-reply-msg { color: var(--error); font-size: .82rem; }
.thread-reply-done { margin: 6px 0 0; color: var(--success); font-size: .88rem; }
.thread-reply-done a { color: var(--teal); }

.board-empty { padding: 28px 20px; color: var(--ink-mute); }
.board-empty p { margin: 0; }
.board-foot {
    display: flex; gap: 12px; flex-wrap: wrap;
    padding: 18px 20px; background: var(--tint-cool); border-top: 1px solid var(--line);
}

/* Sidebar */
.home-side { display: flex; flex-direction: column; gap: 20px; }
.home-side-logo { display: flex; justify-content: center; padding: 8px 0 4px; }
.home-side-logo svg { max-width: 100%; height: auto; }
.home-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--pad-card) var(--pad-card-x); }
.home-card h4 { font-size: .9rem; color: var(--navy); margin: 0 0 8px; }
.home-card p { font-size: .88rem; color: var(--ink-soft); margin: 0 0 14px; }
.home-groups { list-style: none; margin: 0; padding: 0; }
.home-groups li { border-bottom: 1px solid var(--line); }
/* Chevron marker before each sidebar link (Guides / All Groups / Resources),
   as a hanging indent so wrapped titles + Resources descriptions align. */
.home-groups li, .home-resources li { position: relative; padding-left: 15px; }
.home-groups li::before, .home-resources li::before {
    content: "\203a"; position: absolute; left: 1px; color: var(--teal); font-weight: 700;
}
.home-groups li::before { top: 9px; }
.home-resources li::before { top: 10px; }
.home-groups li:last-child { border-bottom: none; }
.home-groups a { display: block; padding: 9px 0; font-size: .9rem; color: var(--ink); text-decoration: none; }
.home-groups a:hover { color: var(--teal); text-decoration: none; }
.welcome-card {
    position: relative;
    background: var(--bg);
    border: 1px solid var(--story-line);
    border-left: 4px solid var(--teal);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin: 0 0 24px;
}
.welcome-card h2 { font-size: 1.2rem; margin: 0 0 8px; }
.welcome-card p { margin: 0 0 14px; color: var(--story-text); font-size: .95rem; line-height: 1.5; }
.welcome-dismiss-form { position: absolute; top: 8px; right: 10px; margin: 0; }
.welcome-dismiss {
    background: none; border: 0; color: var(--story-muted); font-size: 1.4rem; line-height: 1;
    padding: 4px 8px; cursor: pointer; border-radius: var(--radius-sm);
}
.welcome-dismiss:hover { color: var(--story-ink); background: var(--story-cream); }

.story-guest-cta {
    background: var(--story-bg);
    border: 1px solid var(--story-line);
    border-left: 4px solid var(--story-accent);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin: 20px 0;
    text-align: center;
}
.story-guest-cta h3 { margin: 0 0 6px; font-size: 1.1rem; }
.story-guest-cta p { margin: 0 0 12px; color: var(--story-text); }

/* Share Your Story guidance box (discussion-new). Same warm sub-palette. */
.story-guidance {
    background: var(--story-bg);
    border: 1px solid var(--story-line);
    border-left: 4px solid var(--story-accent);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin: 0 0 20px;
}
.story-guidance p { margin: 0 0 10px; }
.story-guidance ul { margin: 0 0 12px; padding-left: 20px; }
.story-guidance .story-guidance-title { font-weight: 600; }
.story-guidance .story-guidance-note { margin: 0; font-size: .92rem; color: var(--story-text); }

.home-resources { list-style: none; margin: 0; padding: 0; }
.home-resources li { padding: 10px 0 10px 15px; border-bottom: 1px solid var(--line); }
.home-resources li:last-child { border-bottom: none; }
.home-resources a { font-size: .9rem; font-weight: 500; color: var(--ink); text-decoration: none; }
.home-resources a:hover { color: var(--teal); text-decoration: none; }
.home-resources .res-desc { display: block; font-size: .8rem; color: var(--ink-mute); margin-top: 3px; line-height: 1.4; }

@media (max-width: 820px) {
    .home-layout { grid-template-columns: 1fr; }
    .page-layout, .page-layout.layout-left, .page-layout.layout-both { grid-template-columns: 1fr; }
    .home-side-logo { display: none; }
}

/* Featured groups (site-admin promoted) on the homepage */
.featured-groups { margin-bottom: 24px; }
.featured-heading { font-size: 1.05rem; color: var(--navy); margin: 0 0 12px; }
.featured-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.featured-card {
    position: relative;
    display: block;
    background: var(--bg);
    border: 1px solid var(--line);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius-lg);
    padding: 15px 18px;
    text-decoration: none;
    color: var(--ink);
    transition: box-shadow .15s, transform .12s;
}
.featured-card:hover { box-shadow: 0 4px 16px rgba(31,58,65,.08); transform: translateY(-1px); text-decoration: none; }
.featured-card h3 { margin: 0 0 6px; font-size: 1rem; color: var(--navy); }
.featured-card p { margin: 0 0 8px; font-size: .85rem; color: var(--ink-soft); line-height: 1.4; }
.featured-meta { font-size: .78rem; color: var(--ink-mute); }

/* Manage (group settings) — settings left, group-leader help right */
.manage-layout { display: grid; grid-template-columns: minmax(320px, 620px) minmax(0, 1fr); gap: 2rem; align-items: start; }
.manage-help h2 { font-size: 1.15rem; }
.manage-help h4 { margin: 1.1rem 0 .35rem; font-size: .95rem; color: var(--navy); }
@media (max-width: 900px) { .manage-layout { grid-template-columns: 1fr; } }

/* Drag-to-reorder (admin All Groups) */
.drag-handle { cursor: grab; color: var(--ink-mute); user-select: none; text-align: center; font-size: 1.15rem; width: 1.5rem; }
.drag-handle:active { cursor: grabbing; }
tr.dragging { opacity: .5; background: var(--cream); }

/* ── Rich-text editor (Quill) ─────────────────────────────────────────── */
.rl-editor-wrap { margin-bottom: .5rem; }
.rl-editor { min-height: 8.5rem; background: #fff; }
.rl-editor-sm .rl-editor { min-height: 5rem; }
.rl-editor-wrap .ql-toolbar.ql-snow,
.rl-editor-wrap .ql-container.ql-snow { border-color: var(--line); }
.rl-editor-wrap .ql-toolbar.ql-snow {
    background: var(--paper);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}
.rl-editor-wrap .ql-container.ql-snow {
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
}
.rl-editor-wrap .ql-editor { min-height: inherit; line-height: 1.55; }
.rl-editor-wrap .ql-editor.ql-blank::before { color: var(--ink-mute); font-style: normal; }
.ql-snow .ql-stroke { stroke: var(--ink-soft); }
.ql-snow .ql-fill { fill: var(--ink-soft); }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button.ql-active .ql-stroke,
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow .ql-toolbar button.ql-active .ql-fill { stroke: var(--navy); fill: var(--navy); }
.ql-snow a { color: var(--teal); }

/* ── Rendered rich body (discussions + replies) ───────────────────────── */
.rich-body, .reply-body { overflow-wrap: break-word; }
.rich-body > *:first-child, .reply-body > *:first-child { margin-top: 0; }
.rich-body > *:last-child, .reply-body > *:last-child { margin-bottom: 0; }
/* Match Quill's editor model: paragraphs have no margin, and a blank line is
   its own empty <p><br></p>. Adding margin here would stack on top of that empty
   paragraph and render every gap at ~double what the author typed. */
.rich-body p, .reply-body p { margin: 0; }
.rich-body ul, .rich-body ol,
.reply-body ul, .reply-body ol { margin: 0 0 .65em 1.35rem; padding: 0; }
.rich-body li, .reply-body li { margin: .15em 0; }
.rich-body blockquote, .reply-body blockquote {
    margin: 0 0 .65em;
    padding: .1rem 0 .1rem .9rem;
    border-left: 3px solid var(--line);
    color: var(--ink-soft);
}
.rich-body pre, .reply-body pre {
    margin: 0 0 .65em;
    padding: .6rem .8rem;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-x: auto;
    white-space: pre-wrap;
    font-size: .9em;
}
.rich-body code, .reply-body code {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .05em .35em;
    font-size: .9em;
}
.rich-body pre code, .reply-body pre code { background: none; border: 0; padding: 0; }
.rich-body a, .reply-body a { color: var(--teal); }
.rich-body h1, .reply-body h1 { font-size: 1.4rem; margin: .3em 0 .4em; }
.rich-body h2, .reply-body h2 { font-size: 1.2rem; margin: .3em 0 .4em; }
.rich-body h3, .reply-body h3 { font-size: 1.05rem; margin: .3em 0 .4em; }

/* --- Guides (background reading) ------------------------------------- */
.home-card-more { display: inline-block; margin-top: 4px; color: var(--teal); text-decoration: none; font-weight: 500; font-size: .9rem; }
.home-card-more:hover { text-decoration: underline; }

.guide-index { list-style: none; padding: 0; margin: 18px 0 24px; }
.guide-index li { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.guide-index li:last-child { border-bottom: 1px solid var(--line-soft); }
.guide-index-title { display: block; font-weight: 600; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.guide-index-title:hover { color: var(--teal); }
.guide-index-desc { display: block; margin-top: 3px; color: var(--ink-mute); font-size: .9rem; line-height: 1.45; }

.guide-crumb { margin: 0 0 .25rem; font-size: .85rem; }
.guide-crumb a { color: var(--teal); text-decoration: none; }
.guide-body { color: var(--ink-soft); line-height: 1.6; }
.guide-body h2 { font-size: 1.2rem; color: var(--ink); margin: 1.4em 0 .4em; }
.guide-body p { margin: 0 0 1em; }
.guide-body ul { margin: 0 0 1em; padding-left: 1.3em; }
.guide-body li { margin: .3em 0; }
.guide-body a { color: var(--teal); }

.guide-disclaimer { margin: 1.75em 0 0; padding: 12px 16px; background: var(--info-bg); border-left: 3px solid var(--info); border-radius: var(--radius); font-size: .9rem; color: var(--ink-soft); }
.guide-forum-link { margin-top: 1.5em; padding-top: 1.25em; border-top: 1px solid var(--line-soft); }
.guide-forum-link p { margin: 0 0 .6em; color: var(--ink-soft); }

/* Related guides (bottom of each guide) + Similar discussions (bottom of a
   discussion) — internal linking for SEO and discovery. */
.guide-related { margin-top: 1.75em; padding-top: 1.25em; border-top: 1px solid var(--line-soft); }
.guide-related h2 { font-size: 1.05rem; color: var(--ink); margin: 0 0 .5rem; }
.guide-related ul { list-style: none; padding: 0; margin: 0; }
.guide-related li { padding: .25rem 0; }
.guide-related a { color: var(--teal); }
.similar-discussions { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.similar-discussions h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.similar-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.similar-list li { padding: .6rem 0; border-bottom: 1px solid var(--line-soft); }
.similar-list li:last-child { border-bottom: 0; }
.similar-list > li > a { font-weight: 600; color: var(--ink); text-decoration: none; display: block; }
.similar-list > li > a:hover { color: var(--teal); }
.similar-meta { display: block; font-size: .85rem; color: var(--ink-mute); margin-top: 2px; }
.similar-reading { font-size: .9rem; color: var(--ink-soft); }
.similar-reading a { color: var(--teal); }

/* FAQ page */
.faq-list { margin-top: 1.5rem; }
.faq-item { padding: 1.1rem 0; border-top: 1px solid var(--line-soft); }
.faq-item:first-child { border-top: 0; }
.faq-q { font-size: 1.1rem; color: var(--ink); margin: 0 0 .4rem; }
.faq-a { margin: 0; color: var(--ink-soft); line-height: 1.6; }
.faq-more { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--ink-soft); }
.faq-more a { color: var(--teal); }

/* Emoji reactions on discussions and replies. Compact; the picker is inline
   (next to the +) so it never floats over other text. */
.reaction-bar { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-top: .4rem; }
.reaction-chips { display: flex; gap: .3rem; flex-wrap: wrap; }
.reaction-chip { display: inline-flex; align-items: center; gap: .2rem; padding: .05rem .4rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); font-size: .8rem; line-height: 1.5; }
button.reaction-chip { cursor: pointer; }
button.reaction-chip:hover { border-color: var(--teal); }
.reaction-chip.is-mine { background: var(--info-bg); border-color: var(--info); }
.reaction-chip .rc-count { font-size: .72rem; color: var(--ink-mute); }
.reaction-chip.is-mine .rc-count { color: var(--info); }
.reaction-add { display: inline-flex; align-items: center; gap: .25rem; }
.reaction-add-btn { width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink-mute); cursor: pointer; line-height: 1; font-size: .9rem; padding: 0; }
.reaction-add-btn:hover { border-color: var(--teal); color: var(--teal); }
.reaction-picker { display: inline-flex; gap: .05rem; align-items: center; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .25rem; }
.reaction-picker button { border: 0; background: none; cursor: pointer; font-size: .95rem; padding: .1rem .2rem; border-radius: var(--radius); line-height: 1; }
.reaction-picker button:hover { background: var(--line-soft); }

/* Member links, public profile, directory, and the account-page grid. */
.member-link { color: inherit; text-decoration: none; }
.member-link:hover { color: var(--teal); text-decoration: underline; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; align-items: start; }
.member-profile .member-head { display: flex; gap: 1.2rem; align-items: center; margin-bottom: 1.2rem; }
.member-head-info h1 { margin: 0 0 .2rem; font-size: 1.4rem; }
.member-since { margin: 0 0 .5rem; color: var(--ink-mute); font-size: .9rem; }
.member-bio { color: var(--ink-soft); line-height: 1.6; margin: 0 0 1.5rem; white-space: pre-wrap; }
.member-activity-h { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
.member-posts { list-style: none; padding: 0; margin: 0; }
.member-posts li { padding: .7rem 0; border-bottom: 1px solid var(--line-soft); }
.member-posts li:last-child { border-bottom: 0; }
.member-post-title { display: block; font-weight: 600; color: var(--ink); text-decoration: none; }
.member-post-title:hover { color: var(--teal); }
.member-post-meta { font-size: .82rem; color: var(--ink-mute); margin-top: 2px; }
.member-post-meta .tag { display: inline-block; background: var(--cream); color: var(--navy); border-radius: var(--radius-sm); padding: 1px 8px; font-size: .72rem; margin-right: 6px; text-decoration: none; }
.member-search { display: flex; gap: .5rem; margin: 0 0 1.25rem; flex-wrap: wrap; }
.member-search input[type="search"] { flex: 1; min-width: 200px; }
.member-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.member-card { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; color: var(--ink); }
.member-card:hover { border-color: var(--teal); }
.member-card-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Members / New members sidebar widgets */
.sidebar-member-search { margin: 0 0 .6rem; }
.sidebar-member-search input[type="search"] { width: 100%; }
.sidebar-member-list { list-style: none; padding: 0; margin: 0 0 .5rem; }
.sidebar-member-list li { padding: .25rem 0; }
.sidebar-member-list li a { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); font-size: .9rem; min-width: 0; }
.sidebar-member-list li a:hover { color: var(--teal); }
.sidebar-member-list li a > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-member-since { display: block; color: var(--ink-mute); font-size: .76rem; }

/* Link-styled button (inline admin actions on content pages). */
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--teal); font: inherit; }
.linkbtn:hover { text-decoration: underline; }
.content-admin-bar form { margin: 0; }

/* Configurable brand mark (default when no logo uploaded) + uploaded logo. */
.brand-mark { display:inline-flex; align-items:center; justify-content:center; width:40px; height:40px; border-radius: var(--radius-lg); background:var(--navy); color:#fff; font-weight:800; font-size:1.25rem; flex:none; }
.brand-logo-img { width:40px; height:40px; border-radius: var(--radius-lg); object-fit:contain; flex:none; }

/* ---------- Configuration: live color preview ---------- */
.cfg-color-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 900px) {
    .cfg-color-layout { grid-template-columns: minmax(0,1fr) minmax(340px,1fr); }
    .cfg-color-preview-col { position: sticky; top: 1rem; align-self: start; }
}
.cfg-preview {
    --pv-navy:#2b5a66; --pv-navy-deep:#16303a; --pv-gold:#e8b04b; --pv-teal:#3a7d8c;
    --pv-mist:#8bb8bf; --pv-ink:#1f3a41; --pv-ink-soft:#3a4c52; --pv-bg:#ffffff;
    --pv-bg-soft:#f6f8f8; --pv-line:#dde5e6;
    border:1px solid var(--pv-line); border-radius: var(--radius-lg); overflow:hidden;
    background:var(--pv-bg); box-shadow:0 1px 3px rgba(0,0,0,.08); font-size:14px;
}
.cfg-pv-head { display:flex; align-items:center; gap:.5rem; padding:.6rem .8rem; background:var(--pv-navy); }
.cfg-pv-brand { color:var(--pv-bg); font-weight:700; }
.cfg-pv-nav { display:flex; gap:.6rem; margin-left:auto; }
.cfg-pv-nav span { color:var(--pv-mist); font-size:.78em; }
.cfg-pv-btn { background:var(--pv-gold); color:var(--pv-navy-deep); font-weight:700; font-size:.75em; padding:.28em .7em; border-radius: var(--radius-sm); white-space:nowrap; }
.cfg-pv-head .cfg-pv-btn { margin-left:.3rem; }
.cfg-pv-body { display:flex; gap:.7rem; padding:.9rem; background:var(--pv-bg-soft); }
.cfg-pv-card { flex:1; min-width:0; background:var(--pv-bg); border:1px solid var(--pv-line); border-radius: var(--radius); padding:.8rem; }
.cfg-pv-h { color:var(--pv-ink); font-weight:700; font-size:.95em; }
.cfg-pv-p { color:var(--pv-ink-soft); font-size:.8em; line-height:1.45; margin-top:.35rem; }
.cfg-pv-row { display:flex; align-items:center; gap:.7rem; margin-top:.75rem; }
.cfg-pv-link { color:var(--pv-teal); font-weight:600; font-size:.8em; white-space:nowrap; }
.cfg-pv-aside { width:60px; display:flex; flex-direction:column; gap:.4rem; }
.cfg-pv-chip { height:38px; border-radius: var(--radius); background:var(--pv-teal); }
.cfg-pv-bar { height:8px; border-radius: var(--radius-sm); background:var(--pv-line); }
.cfg-pv-bar.short { width:60%; }

/* ---------- Custom content sections (admin-authored blocks) ---------- */
.home-custom > :first-child { margin-top: 0; }
.home-custom > :last-child  { margin-bottom: 0; }
.home-custom h2, .home-custom h3 { margin: 0 0 .5rem; }
.home-custom p, .home-custom ul, .home-custom ol { margin: 0 0 .75rem; }
.home-custom a { color: var(--gold); }

/* Images embedded in authored content (sections + pages) stay responsive. */
.home-custom img, .content-page img, .page-prose img { max-width: 100%; height: auto; }
.home-custom img { display: block; margin: .5rem 0; border-radius: var(--radius); }

/* ---------- Editor image toolbar (size / align / wrap) ---------- */
.img-size-picker {
    position: absolute; z-index: 1000; display: none; flex-direction: column; gap: 4px;
    padding: 4px; background: var(--bg, #fff); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: 0 6px 20px rgba(15,23,42,.16);
}
.img-size-picker .row { display: flex; gap: 4px; }
.img-size-picker button {
    font: inherit; font-size: 12px; padding: 4px 10px; background: var(--bg, #fff);
    color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.img-size-picker button:hover { border-color: var(--gold); color: var(--gold); }
.img-size-picker button.is-on { border-color: var(--gold); background: var(--gold); color: #fff; }
.img-size-picker button svg { display: block; }

/* Image alignment + wrap (width uses the HTML attribute). Editor preview + public render. */
.ql-editor img[data-align="left"],   .home-custom img[data-align="left"],   .content-page img[data-align="left"]   { display: block; margin-right: auto; }
.ql-editor img[data-align="center"], .home-custom img[data-align="center"], .content-page img[data-align="center"] { display: block; margin-left: auto; margin-right: auto; }
.ql-editor img[data-align="right"],  .home-custom img[data-align="right"],  .content-page img[data-align="right"]  { display: block; margin-left: auto; }
.ql-editor img[data-align="left"][data-wrap],   .home-custom img[data-align="left"][data-wrap],   .content-page img[data-align="left"][data-wrap]   { float: left;  display: inline; margin: .2em 1.2em .6em 0; clear: left; }
.ql-editor img[data-align="right"][data-wrap],  .home-custom img[data-align="right"][data-wrap],  .content-page img[data-align="right"][data-wrap]  { float: right; display: inline; margin: .2em 0 .6em 1.2em; clear: right; }

/* ---------- Sidebar custom-section resize (reuses the home-fit engine) ---------- */
.sidebar-card { position: relative; }
.sidebar-card .home-fit { margin-bottom: 0; }
.sidebar-card:hover > .home-section-resize::before,
.sidebar-card.is-resizing > .home-section-resize::before { opacity: 1; }
.sidebar-card.is-resizing > .drag-grip { opacity: 1; }
.sidebar-card:hover > .home-section-reset,
.sidebar-card.is-resizing > .home-section-reset { opacity: 1; }

/* Configuration live preview — typography */
.cfg-preview {
    --pv-font-head: "Iowan Old Style", Georgia, serif;
    --pv-font-body: -apple-system, "Segoe UI", Roboto, sans-serif;
    font-family: var(--pv-font-body);
}
.cfg-pv-h, .cfg-pv-brand { font-family: var(--pv-font-head); }

/* Configuration: two-column layout for identity + branding panels */
.cfg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; margin-bottom: 1.5rem; }
.cfg-grid > .cfg-col { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.cfg-grid > .cfg-col > .panel { margin: 0; max-width: none; }
@media (max-width: 860px) { .cfg-grid { grid-template-columns: 1fr; } }
.cfg-subhead { font-size: 1rem; font-weight: 700; margin: 0 0 .75rem; }

/* ---------- Light/dark theme support ---------- */
/* The editor keeps a light writing surface in both themes; pin its text dark. */
.rl-editor, .rl-editor .ql-editor { color: #1f2a30; }
/* Header theme toggle */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 1px solid var(--line); border-radius: var(--radius);
    width: 30px; height: 30px; padding: 0; cursor: pointer; color: var(--ink-soft); }
.theme-toggle:hover { color: var(--teal); border-color: var(--teal); }
.theme-toggle .tt-sun { display: none; }
:root[data-theme=dark] .theme-toggle .tt-sun { display: block; }
:root[data-theme=dark] .theme-toggle .tt-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root.theme-auto .theme-toggle .tt-sun { display: block; }
    :root.theme-auto .theme-toggle .tt-moon { display: none; }
}

/* Preview light/dark buttons */
.cfg-pv-mode { display: flex; gap: 6px; margin-bottom: .6rem; justify-content: center; }
.cfg-pv-mode button { font: inherit; font-size: .8rem; padding: .3rem .9rem; cursor: pointer;
    border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink-mute); }
.cfg-pv-mode button.is-on { border-color: var(--teal); color: var(--teal); font-weight: 600; }

/* Expanded preview mockup (hero / main+aside / footer) */
.cfg-pv-hero { background: var(--pv-navy-deep); padding: 18px 16px 20px; }
.cfg-pv-hero-t { font-family: var(--pv-font-head); color: #fff; font-weight: 700; font-size: 1.15rem; }
.cfg-pv-hero-s { color: var(--pv-mist); font-size: .8rem; margin-top: 4px; }
.cfg-pv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .7rem; }
.cfg-pv-aside { width: 104px; display: flex; flex-direction: column; gap: .5rem; }
.cfg-pv-side-card { background: var(--pv-bg); border: 1px solid var(--pv-line); border-radius: var(--radius);
    padding: .5rem; display: flex; flex-direction: column; gap: .4rem; }
.cfg-pv-h.sm { font-size: .72em; }
.cfg-pv-list { display: flex; flex-direction: column; gap: .45rem; margin-top: .5rem; }
.cfg-pv-chip { height: 52px; }
.cfg-pv-foot { padding: .6rem .9rem; background: var(--pv-navy-deep); color: var(--pv-mist);
    font-size: .68rem; text-align: center; }
.cfg-pv-aside[hidden] { display: none; }
.cfg-pv-aside { flex: none; }

/* Preview device toggle + mobile frame */
.cfg-pv-toolbar { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.cfg-preview { position: relative; }
.cfg-pv-phone { position: absolute; right: 112px; bottom: -100px; width: 300px;
    transform: scale(0.5); transform-origin: bottom right;
    border: 6px solid var(--ink); border-radius: var(--radius-lg); overflow: hidden;
    background: var(--pv-bg); box-shadow: 0 14px 40px rgba(0,0,0,.35); }
/* The phone hangs below the preview, so the preview can't clip overflow;
   round the head/foot bands to keep the card corners clean. */
.cfg-preview { overflow: visible; }
.cfg-pv-head { border-radius: var(--radius) 9px 0 0; }
.cfg-pv-foot { border-radius: 0 0 9px 9px; }
.cfg-color-preview-col { padding-bottom: 110px; }
.cfg-pv-phone[hidden] { display: none; }
.cfg-pv-phone .cfg-pv-nav { display: none; }
.cfg-pv-phone .cfg-pv-body { flex-direction: column; }
.cfg-pv-phone .cfg-pv-aside { width: 100% !important; flex-direction: row; }
.cfg-pv-phone .cfg-pv-aside .cfg-pv-side-card { flex: 1; }
.cfg-pv-phone .cfg-pv-chip { display: none; }
.cfg-pv-phone .cfg-pv-hero { padding: 12px 14px 14px; }

/* Site page sub-tabs */
.cfg-tabs { display: flex; gap: 8px; margin: 0 0 1.25rem; }
.cfg-tabs button { font: inherit; font-size: .9rem; padding: .45rem 1.1rem; cursor: pointer;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink-soft); }
.cfg-tabs button.is-on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Inline spinner (domain connect status) */
.cfg-spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%;
    vertical-align: -2px; margin-right: 6px;
    border: 2px solid color-mix(in srgb, var(--teal) 35%, transparent); border-top-color: var(--teal);
    animation: cfg-spin .8s linear infinite; }
@keyframes cfg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cfg-spin { animation: none; } }

/* Menu builder rows */
.menu-rows { display: flex; flex-direction: column; gap: .5rem; }
.menu-row { display: flex; align-items: center; gap: .5rem; }
.menu-row .drag-grip { position: static; opacity: .55; cursor: grab; width: auto; background: none; border: 0; }
.menu-row:hover .drag-grip { opacity: 1; }
.menu-row input[type=text] { padding: .4rem .5rem; }
.menu-row input[name="menu_label[]"] { flex: 0 0 130px; }
.menu-row input[name="menu_url[]"] { flex: 1 1 160px; min-width: 0; }
.menu-row select { flex: 0 0 110px; padding: .4rem; }
.menu-row-remove { background: none; border: 0; color: var(--ink-mute); font-size: 1.2rem;
    line-height: 1; cursor: pointer; padding: 0 .2rem; }
.menu-row-remove:hover { color: var(--error); }
.menu-row.sortable-ghost { opacity: .4; }

/* Media library grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.media-item { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg); }
.media-item img { display: block; width: 100%; height: 120px; object-fit: cover; background: var(--bg-soft); }
.media-meta { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem;
    font-size: .78rem; color: var(--ink-mute); border-top: 1px solid var(--line); }
.media-meta .sp { flex: 1; }
.media-meta form { margin: 0; }

/* Editor image picker (Upload new / reuse from library) */
.ed-pick-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60;
    display: flex; align-items: center; justify-content: center; padding: 20px; }
.ed-pick { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 18px; width: min(680px, 96vw); max-height: 80vh; overflow: auto; }
.ed-pick h3 { margin: 0 0 .75rem; font-size: 1rem; }
.ed-pick-actions { display: flex; gap: .6rem; margin-bottom: 1rem; }
.ed-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.ed-pick-grid img { display: block; width: 100%; height: 90px; object-fit: cover; cursor: pointer;
    border: 2px solid transparent; border-radius: var(--radius); background: var(--bg-soft); }
.ed-pick-grid img:hover { border-color: var(--teal); }
.ed-pick-empty { color: var(--ink-mute); font-size: .9rem; }

/* Payments pitch (donate page, site owner only) */
.pay-pitch { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem; background: var(--bg-soft); }
.pay-pitch h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.pay-pitch > p { margin: 0 0 1.1rem; color: var(--ink-soft); }
.pay-paths { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .pay-paths { grid-template-columns: 1fr; } }
.pay-path { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem; }
.pay-path h3 { margin: 0 0 .35rem; font-size: .95rem; }
.pay-path p { margin: 0 0 .8rem; font-size: .88rem; color: var(--ink-mute); }
.pay-lead { display: flex; flex-direction: column; gap: .5rem; }
.pay-lead input, .pay-lead textarea { width: 100%; padding: .45rem .55rem; }
.pay-lead button { align-self: flex-start; }

/* Preview reflects the chosen corner radius + density */
.cfg-preview { --pv-radius-sm: 4px; --pv-radius: 6px; --pv-radius-lg: 12px; --pv-density: 1;
    border-radius: var(--pv-radius-lg); }
.cfg-preview .cfg-pv-head { border-radius: var(--pv-radius-lg) var(--pv-radius-lg) 0 0; }
.cfg-preview .cfg-pv-foot { border-radius: 0 0 var(--pv-radius-lg) var(--pv-radius-lg); }
.cfg-preview .cfg-pv-bar { border-radius: var(--pv-radius-sm); }
.cfg-pv-phone { border-radius: calc(var(--pv-radius-lg) + 10px); }
.cfg-preview .cfg-pv-card, .cfg-preview .cfg-pv-side-card { border-radius: var(--pv-radius-lg); padding: calc(.8rem * var(--pv-density)); }
.cfg-preview .cfg-pv-btn { border-radius: var(--pv-radius-sm); }
.cfg-preview .cfg-pv-chip { border-radius: var(--pv-radius); }
.cfg-preview .cfg-pv-body { gap: calc(.7rem * var(--pv-density)); padding: calc(.9rem * var(--pv-density)); }
.cfg-preview .cfg-pv-main { gap: calc(.7rem * var(--pv-density)); }

/* ---------- Reading width ----------
   Caps long-form prose only. Lists, grids, tables and media keep the full
   column, so nothing gets narrower except the text you actually read. */
.content-page > p, .content-page > ul, .content-page > ol, .content-page > h2, .content-page > h3,
.guide-article > p, .guide-article > ul, .guide-article > ol, .guide-article > h2, .guide-article > h3,
.home-custom > p, .home-custom > ul, .home-custom > ol,
.rich-body > p, .rich-body > ul, .rich-body > ol,
.reply-body > p {
    max-width: var(--read-w, none);
}

/* ---------- Sticky side column ----------
   Only when it fits the viewport; taller columns scroll normally so nothing
   becomes unreachable. Disabled on stacked (mobile) layouts. */
@media (min-width: 861px) {
    .page-layout.side-sticky > .page-side {
        position: sticky;
        /* Clear the sticky site header, or the top of the column hides behind it. */
        top: calc(var(--header-h, 70px) + 1rem);
        align-self: start;
        max-height: calc(100vh - var(--header-h, 70px) - 2rem);
        overflow-y: auto;
        scrollbar-width: thin;
    }
    .page-layout.side-sticky > .page-side::-webkit-scrollbar { width: 6px; }
    .page-layout.side-sticky > .page-side::-webkit-scrollbar-thumb {
        background: var(--line); border-radius: 999px;
    }
}
/* Quiet norm-setting note under the composer */
.composer-note { margin-top: .5rem; }
.composer-note a { color: var(--teal); }
