/* ==========================================================================
   Manch — Charcha, the forum.

   Layout and structure are the reference's (manch-charcha.html); the palette
   and the type are ours. Everything is scoped under .cha and every class
   carries the `cha` prefix, because app.css and shell.css own the short
   generic names and reach every page.
   ========================================================================== */

.cha { max-width: 1300px; margin-inline: auto; }

.cha__mono {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--ink-4);
}
.cha .nums { font-variant-numeric: tabular-nums; }

/* --- search ---------------------------------------------------------------- */

.cha__search { position: relative; max-width: 360px; margin-bottom: 1.375rem; }

.cha__searchic {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8125rem;
    color: var(--ink-4);
}

.cha__searchin {
    width: 100%;
    padding: 0.5625rem 0.875rem 0.5625rem 2.25rem;
    border: 1px solid var(--line);
    border-radius: 100px;
    background: var(--card);
    font: inherit;
    font-size: 0.84375rem;
    color: var(--ink);
}
.cha__searchin:focus { border-color: var(--accent); outline: none; background: var(--raised); }
.cha__searchin::placeholder { color: var(--ink-4); }

/* --- shell ------------------------------------------------------------------
   minmax(0, 1fr), not 1fr: a plain 1fr track has min-width auto, and the
   horizontal topic strip on a phone would stretch the column past the
   viewport. */

.cha__shell {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    gap: clamp(1rem, 2vw, 1.625rem);
    align-items: start;
}
.cha__shell--one { grid-template-columns: minmax(0, 1fr); max-width: 860px; }

.cha__main { min-width: 0; }

/* --- the rail ---------------------------------------------------------------- */

.cha__side { position: sticky; top: calc(var(--bar, 57px) + 16px); }

.cha__snav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 1.375rem;
}

.cha__snavlink {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 10px;
    font-size: 0.875rem;
    color: var(--ink-3);
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.cha__snavlink:hover { background: var(--raised); color: var(--ink); }
.cha__snavlink.is-on { background: var(--raised); color: var(--ink); font-weight: 600; }

.cha__snavic {
    flex: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid currentColor;
    border-radius: 5px;
    opacity: 0.65;
}
.cha__snavlink.is-on .cha__snavic { opacity: 1; border-color: var(--accent); }

.cha__ct { margin-left: auto; font-size: 0.625rem; color: var(--ink-4); }

.cha__sec { margin-bottom: 1.125rem; }

.cha__sechead {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    margin-bottom: 0.625rem;
    cursor: pointer;
    list-style: none;
}
.cha__sechead::-webkit-details-marker { display: none; }
.cha__sect { font-size: 0.8125rem; font-weight: 600; color: var(--ink-3); }
/* The arrow is the marker, drawn so it can turn with the open state. */
.cha__sechead::after {
    content: "⌄";
    margin-left: auto;
    font-size: 0.6875rem;
    color: var(--ink-4);
    transition: transform 0.2s var(--ease);
}
.cha__sec:not([open]) .cha__sechead::after { transform: rotate(-90deg); }

.cha__topics { display: flex; flex-direction: column; gap: 3px; }

.cha__tp {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6875rem;
    padding: 0.5625rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 11px;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
a.cha__tp:hover { background: var(--raised); }
.cha__tp.is-on { background: var(--raised); border-color: var(--line); }
.cha__tp.is-on::after {
    content: "";
    position: absolute;
    right: -1px;
    top: 9px;
    bottom: 9px;
    width: 2px;
    border-radius: 2px;
    background: var(--accent);
}
.cha__tp--dead { opacity: 0.55; }

.cha__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }

.cha__tpnm { flex: 1; min-width: 0; }
.cha__tpa {
    display: block;
    overflow: hidden;
    font-size: 0.84375rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--ink);
}
.cha__tpb {
    display: block;
    margin-top: 2px;
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-4);
}

.cha__tpct {
    flex: none;
    padding: 3px 8px;
    border-radius: 100px;
    background: var(--field);
    font-size: 0.625rem;
    color: var(--ink);
}
.cha__tp.is-on .cha__tpct { background: var(--accent); color: #140702; font-weight: 700; }

.cha__newbtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5625rem;
    width: 100%;
    margin-bottom: 1.25rem;
    padding: 0.8125rem;
    border-radius: 12px;
    background: var(--accent);
    font-size: 0.875rem;
    font-weight: 700;
    color: #140702;
}
.cha__newbtn:hover { filter: brightness(1.08); }

.cha__plus {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: rgba(20, 7, 2, 0.18);
    font-size: 0.9375rem;
    line-height: 1;
}

/* --- the new-thread bar --------------------------------------------------------- */

.cha__newbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.5rem 0.5rem 0.5rem 1.125rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    font: inherit;
    text-align: left;
    cursor: text;
    transition: border-color 0.16s var(--ease);
}
/* Signed out it is a link rather than a button, so it needs an anchor's
   defaults turned off to match. */
.cha__newbar { color: inherit; text-decoration: none; }
.cha__newbar:hover { border-color: var(--line-2); }
.cha__newbar.is-open { border-color: var(--accent); }

.cha__ph { flex: 1; font-size: 0.90625rem; color: var(--ink-4); }

.cha__go {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--accent);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    color: #140702;
}

/* --- the composer ---------------------------------------------------------------- */

.cha__composer {
    margin-bottom: 1rem;
    padding: 1.125rem;
    border: 1px solid var(--accent);
    border-radius: 14px;
    background: var(--card);
}
.cha__composer[hidden] { display: none; }

.cha__chead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.625rem;
    margin-bottom: 0.9375rem;
}
.cha__cheadt { font-size: 1.0625rem; font-weight: 800; letter-spacing: -0.01em; }
.cha__cmode {
    font-size: 0.53125rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}

.cha__field { margin-bottom: 0.8125rem; }

.cha__label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.78125rem;
    font-weight: 600;
}
.cha__hint {
    margin-left: 0.375rem;
    font-size: 0.5625rem;
    font-weight: 400;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--ink-4);
}

.cha__input {
    width: 100%;
    padding: 0.6875rem 0.8125rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--page);
    font: inherit;
    font-size: 0.875rem;
    color: var(--ink);
    resize: vertical;
}
.cha__input:focus { border-color: var(--accent); outline: none; background: var(--raised); }
.cha__input::placeholder { color: var(--ink-4); }
.cha__select { appearance: none; }
.cha__area { line-height: 1.6; }

.cha__two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.cha__drop {
    display: block;
    padding: 1.125rem;
    border: 1px dashed var(--line);
    border-radius: 11px;
    font-size: 0.8125rem;
    text-align: center;
    color: var(--ink-3);
    cursor: pointer;
    transition: border-color 0.16s var(--ease), color 0.16s var(--ease), background 0.16s var(--ease);
}
.cha__drop:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

.cha__dropk {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.53125rem;
    font-weight: 600;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--ink-4);
}

/* The real input stays reachable by keyboard, just out of the way. */
.cha__file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}


.cha__crow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5625rem;
}
.cha__count { margin-left: auto; }

.cha__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6875rem 1.125rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--accent);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    color: #140702;
    cursor: pointer;
}
.cha__btn:hover { filter: brightness(1.08); }
.cha__btn--ghost {
    border-color: var(--line-2);
    background: none;
    font-weight: 500;
    color: var(--ink);
}
.cha__btn--ghost:hover { border-color: var(--line-hard); filter: none; }

/* --- the contact scan preview -------------------------------------------------- */

.cha__scan {
    margin-top: 0.5625rem;
    padding: 0.6875rem;
    border: 1px solid #e2685c;
    border-radius: 10px;
    background: rgba(226, 104, 92, 0.07);
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--ink-3);
    word-break: break-word;
}
.cha__scan b { color: var(--ink); }
.cha__redact {
    padding: 0 2px;
    border-radius: 3px;
    background: var(--ink);
    color: var(--ink);
    user-select: none;
}

/* --- a thread, as a card -------------------------------------------------------- */

.cha__th {
    margin-bottom: 0.875rem;
    padding: 1.375rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card);
    transition: border-color 0.16s var(--ease), transform 0.16s var(--ease),
                box-shadow 0.16s var(--ease);
}
.cha__th:hover {
    border-color: var(--line-2);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.cha__thh {
    margin: 0 0 0.875rem;
    font-size: clamp(1.1875rem, 2.4vw, 1.5rem);
    font-weight: 800;
    letter-spacing: -0.022em;
    line-height: 1.15;
}
.cha__thh a { color: inherit; }
.cha__thh a:hover { color: var(--accent); }

.cha__byline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6875rem;
    margin-bottom: 0.9375rem;
}

.cha__av {
    flex: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 11px;
}
.cha__av--sm { width: 34px; height: 34px; border-radius: 10px; }
.cha__av--xs {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--card);
}

.cha__who { flex: 1; min-width: 0; }
.cha__whon { display: block; font-size: 0.84375rem; font-weight: 600; }
.cha__whot {
    display: block;
    margin-top: 2px;
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-4);
}

.cha__tags { display: flex; flex-wrap: wrap; gap: 0.375rem; }

.cha__tag {
    padding: 5px 10px;
    border: 1px solid;
    border-radius: 100px;
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.cha__body {
    margin: 0 0 1.125rem;
    font-size: 0.90625rem;
    line-height: 1.7;
    color: var(--ink-3);
}
.cha__body--full { white-space: pre-wrap; margin-bottom: 1.25rem; }

/* --- attachments ------------------------------------------------------------------ */

.cha__atts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

.cha__att {
    position: relative;
    flex: none;
    width: 92px;
    height: 68px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--field);
}
.cha__att:hover { border-color: var(--accent); }
.cha__att img,
.cha__att video { width: 100%; height: 100%; object-fit: cover; display: block; }

.cha__badge {
    position: absolute;
    top: 5px;
    left: 5px;
    padding: 2px 6px;
    border: 1px solid rgba(248, 249, 249, 0.2);
    border-radius: 4px;
    background: rgba(3, 6, 10, 0.78);
    font-size: 0.46875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
}

.cha__play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    color: rgba(248, 249, 249, 0.92);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.cha__gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 0.625rem;
    margin-bottom: 1.25rem;
}

/* Cap the tile so one tall attachment cannot push the replies off the page. */
.cha__gatt {
    position: relative;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--field);
}
.cha__gatt img,
.cha__gatt video { width: 100%; max-height: 380px; object-fit: cover; display: block; }

/* --- the card footer --------------------------------------------------------------- */

.cha__thfoot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5625rem;
}

.cha__ib {
    display: grid;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--field);
    font: inherit;
    font-size: 0.9375rem;
    color: var(--ink-3);
    cursor: pointer;
    transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.cha__ib:hover { color: var(--ink); border-color: var(--line); }
.cha__ib.is-on {
    color: var(--accent);
    border-color: rgba(244, 104, 15, 0.45);
    background: var(--accent-soft);
}

.cha__resp {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5625rem 1rem 0.5625rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--field);
    font-size: 0.84375rem;
    font-weight: 500;
    color: var(--ink-3);
    transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.cha__resp:hover { color: var(--ink); border-color: var(--line); }

.cha__bub {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--page);
    font-size: 0.625rem;
    color: var(--ink-4);
}

.cha__stack { margin-left: auto; display: flex; align-items: center; }
.cha__stack .cha__av--xs { margin-left: -7px; }
.cha__stack .cha__av--xs:first-child { margin-left: 0; }

.cha__more {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-left: -7px;
    border: 2px solid var(--card);
    border-radius: 50%;
    background: var(--field);
    font-size: 0.53125rem;
    color: var(--ink-3);
}

/* --- the thread page ----------------------------------------------------------------- */

.cha__back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: var(--ink-3);
}
.cha__back:hover { color: var(--ink); border-color: var(--line-2); }

.cha__full {
    margin-bottom: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card);
}

.cha__fullh {
    margin: 0 0 1rem;
    font-size: clamp(1.375rem, 3vw, 1.875rem);
    font-weight: 800;
    letter-spacing: -0.022em;
    line-height: 1.15;
}

.cha__acts {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.cha__act {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5625rem 0.9375rem;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--field);
    font: inherit;
    font-size: 0.84375rem;
    color: var(--ink-3);
    cursor: pointer;
    transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.cha__act:hover { color: var(--ink); border-color: var(--line); }
.cha__act.is-on {
    color: var(--accent-2);
    border-color: rgba(239, 78, 19, 0.4);
    background: rgba(239, 78, 19, 0.08);
}

.cha__rhead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.625rem 0 0.75rem;
}
.cha__rheadh { margin: 0; font-size: 1.125rem; font-weight: 800; letter-spacing: -0.02em; }

/* --- replies ---------------------------------------------------------------------- */

.cha__rep {
    display: flex;
    gap: 0.875rem;
    padding: 1.125rem 0;
    border-bottom: 1px solid var(--line);
}
.cha__rep:last-of-type { border-bottom: 0; }

.cha__rc { flex: 1; min-width: 0; }

.cha__rn {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5625rem;
    margin-bottom: 0.375rem;
}
.cha__rn .cha__whot { display: inline; margin: 0; }

.cha__op {
    padding: 2px 7px;
    border: 1px solid rgba(244, 104, 15, 0.4);
    border-radius: 100px;
    font-size: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.cha__rb {
    font-size: 0.875rem;
    line-height: 1.65;
    white-space: pre-wrap;
    color: var(--ink-3);
}

.cha__ra { margin-top: 0.5625rem; }

.cha__up {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 5px 11px;
    border: 1px solid var(--line);
    border-radius: 100px;
    background: none;
    font: inherit;
    font-size: 0.53125rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-3);
    cursor: pointer;
    transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.cha__up:hover { color: var(--ink); border-color: var(--line-2); }
.cha__up.is-on {
    color: #5fbf87;
    border-color: rgba(95, 191, 135, 0.45);
    background: rgba(95, 191, 135, 0.08);
}

.cha__replybox {
    margin-top: 1.125rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
}
.cha__replybox:focus-within { border-color: var(--accent); }
.cha__replybox .cha__crow { margin-top: 0.6875rem; }

/* --- empty states -------------------------------------------------------------------- */

.cha__empty {
    padding: 2.75rem 1.375rem;
    border: 1px dashed var(--line);
    border-radius: 16px;
    text-align: center;
    color: var(--ink-3);
}
.cha__empty--thin { padding: 1.75rem 1.25rem; margin: 0; font-size: 0.875rem; }
.cha__emptyh { margin: 0 0 0.5rem; font-size: 1rem; font-weight: 700; color: var(--ink); }
.cha__emptyp { margin: 0 0 1.125rem; font-size: 0.84375rem; }

/* --- the phone floating button --------------------------------------------------------- */

.cha__fab {
    display: none;
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 40;
    padding: 0.6875rem 1.125rem;
    border: 0;
    border-radius: 14px;
    background: var(--accent);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    color: #140702;
    box-shadow: 0 10px 30px rgba(239, 78, 19, 0.32);
    cursor: pointer;
}

/* --- narrower ---------------------------------------------------------------------------
   The rail becomes a horizontal strip. A stacked sidebar pushed the threads a
   full screen down, which is the wrong thing to see first on a forum. */

@media (max-width: 900px) {
    .cha__shell { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .cha__side { position: static; display: flex; flex-direction: column; gap: 0.625rem; }

    .cha__snav {
        flex-direction: row;
        gap: 0.375rem;
        margin-bottom: 0;
        padding-bottom: 2px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .cha__snav::-webkit-scrollbar { display: none; }
    .cha__snavlink {
        flex: none;
        border: 1px solid var(--line);
        border-radius: 100px;
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }
    .cha__snavic { display: none; }
    .cha__ct { margin-left: 0.25rem; }

    .cha__sechead { display: none; }
    .cha__sec { margin-bottom: 0; }
    .cha__topics {
        flex-direction: row;
        gap: 0.375rem;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }
    .cha__topics::-webkit-scrollbar { display: none; }
    .cha__tp { flex: none; border: 1px solid var(--line); border-radius: 100px; padding: 0.5rem 0.8125rem; }
    .cha__tp.is-on::after { display: none; }
    .cha__tpb { display: none; }
    .cha__tpa { font-size: 0.8125rem; }

    /* The archive and the rail's own button have no room; the bar at the top
       of the list and the floating button both still start a thread. */
    .cha__sec:not([open]),
    .cha__newbtn { display: none; }

    .cha__fab { display: block; }
}

@media (max-width: 560px) {
    .cha__two { grid-template-columns: minmax(0, 1fr); }
    .cha__stack { margin-left: 0; width: 100%; margin-top: 0.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    .cha__th, .cha__sechead::after { transition: none; }
}

/* --- draft attachments, and the lightbox ------------------------------------
   Both are the reference's: what you picked is previewed with a ✕ before you
   post, and a posted attachment opens over the page. */

.cha__att--draft { cursor: default; }

.cha__rm {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(3, 6, 10, 0.82);
    font: inherit;
    font-size: 0.6875rem;
    line-height: 1;
    color: var(--ink);
    cursor: pointer;
}
.cha__rm:hover { border-color: #e2685c; color: #e2685c; }

.cha__drop.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

.cha__gatt { cursor: zoom-in; }
.cha__gatt:hover { border-color: var(--accent); }

/* The `hidden` attribute only works because this selector is more specific
   than the rule below it: `display: flex` on a class would otherwise beat the
   browser's own `[hidden] { display: none }`, leaving a full-screen invisible
   sheet over the page that swallows every click. */
.cha__lb[hidden] { display: none; }

.cha__lb {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.75rem;
    background: rgba(3, 6, 10, 0.94);
    opacity: 0;
    transition: opacity 0.2s var(--ease);
}
.cha__lb.is-on { opacity: 1; }
.cha__lb img,
.cha__lb video {
    max-width: 100%;
    max-height: 86vh;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.cha__lbx {
    position: absolute;
    top: 20px;
    right: 22px;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--card);
    font: inherit;
    font-size: 0.9375rem;
    color: var(--ink);
    cursor: pointer;
}
.cha__lbx:hover { border-color: var(--line-2); }

@media (prefers-reduced-motion: reduce) { .cha__lb { transition: none; } }
