/* Shore Pass — CrewChat screens (index · thread · new post)
   Translated from the prototype:
     screens-discussions.jsx  › CrewChatIndex + CrewChatCard + CrewChatThread
     screens-crewchat-hk.jsx  › CrewChatCommunity (reply cards, composer bar)
     screens-settings.jsx     › NewPostScreen
   Every rule is scoped under .scr-crewchat so it cannot collide with another screen. */

.scr-crewchat {
    --cc-fg: var(--sp-slate);
    --cc-soft: var(--sp-bg-2);
}
.scr-crewchat .cc-tone--blue  { --cc-fg: var(--sp-blue);  --cc-soft: var(--sp-blue-soft); }
.scr-crewchat .cc-tone--green { --cc-fg: var(--sp-green); --cc-soft: var(--sp-green-soft); }
.scr-crewchat .cc-tone--red   { --cc-fg: var(--sp-red);   --cc-soft: var(--sp-red-soft); }
.scr-crewchat .cc-tone--amber { --cc-fg: var(--sp-amber); --cc-soft: var(--sp-amber-soft); }
.scr-crewchat .cc-tone--slate { --cc-fg: var(--sp-slate); --cc-soft: var(--sp-bg-2); }

/* The layout classes below set display, so [hidden] needs to win. */
.scr-crewchat [hidden] { display: none !important; }

.scr-crewchat .cc-sr {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ──────────────── Feed header (search + counts) ──────────────── */
.scr-crewchat.cc-head { padding: 16px 16px 14px; }
.scr-crewchat .cc-head__h1 {
    margin: 0 0 6px; font-family: var(--sp-font-display); font-size: 26px; font-weight: 600;
    color: var(--sp-ink); letter-spacing: .01em; line-height: 1.1;
}
.scr-crewchat .cc-head__sub { margin: 0 0 14px; font-size: 13px; color: var(--sp-slate); line-height: 1.4; }
/* Only shown when the board has more threads than this page renders. */
.scr-crewchat .cc-head__note { color: var(--sp-slate-2); }

.scr-crewchat .cc-search {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border-radius: 14px; background: var(--sp-bg-2); border: 1px solid var(--sp-line);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.scr-crewchat .cc-search.is-focus { border-color: var(--sp-blue); box-shadow: inset 0 0 0 1px var(--sp-blue); }
.scr-crewchat .cc-search__ico { width: 20px; height: 20px; flex: 0 0 auto; color: var(--sp-slate); }
.scr-crewchat .cc-search.is-focus .cc-search__ico { color: var(--sp-blue); }
.scr-crewchat .cc-search__in {
    flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
    font: inherit; font-size: 15px; color: var(--sp-ink);
}
.scr-crewchat .cc-search__x {
    flex: 0 0 auto; display: inline-flex; border: 0; background: transparent;
    line-height: 1; padding: 4px;
}
.scr-crewchat .cc-search__xico { width: 18px; height: 18px; color: var(--sp-slate); }

/* ──────────────── Screen body ──────────────── */
.scr-crewchat.cc-body { padding: 14px 0 30px; }
.scr-crewchat.cc-body--thread,
.scr-crewchat.cc-body--form { padding: 16px 16px 30px; }
.scr-crewchat .cc-flash { margin: 0 16px 14px; }
/* Thread + form bodies already carry the 16px gutter, so the flash sits flush. */
.scr-crewchat .cc-flash--flush { margin-left: 0; margin-right: 0; }

/* ──────────────── Category filter pills ──────────────── */
.scr-crewchat .cc-pills { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 14px; }
.scr-crewchat .cc-pill {
    flex: 0 0 auto; padding: 8px 16px; border-radius: 999px; white-space: nowrap;
    background: var(--sp-surface); border: 1px solid var(--sp-line);
    color: var(--sp-ink-2); font-size: 13px; font-weight: 700;
}
.scr-crewchat .cc-pill.is-on { background: var(--sp-blue); border-color: var(--sp-blue); color: #fff; }

/* ──────────────── Sort row + Post button ──────────────── */
.scr-crewchat .cc-sortrow { display: flex; align-items: center; gap: 10px; padding: 0 16px 14px; }
.scr-crewchat .cc-sorts { flex: 1; display: flex; gap: 6px; min-width: 0; }
.scr-crewchat .cc-sort {
    padding: 6px 12px; border-radius: 8px; background: transparent; border: 1px solid transparent;
    font-size: 12px; font-weight: 600; color: var(--sp-slate); white-space: nowrap;
}
.scr-crewchat .cc-sort.is-on { background: var(--sp-bg-2); border-color: var(--sp-line); color: var(--sp-ink); }

.scr-crewchat .cc-newbtn {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 999px; background: var(--sp-blue); border: 0;
    color: #fff; font-size: 13px; font-weight: 700; text-decoration: none;
}
.scr-crewchat .cc-newbtn:hover { background: #1a5fc4; }
.scr-crewchat .cc-newbtn__ico { width: 16px; height: 16px; color: #fff; }
.scr-crewchat .cc-newbtn--lg { margin-top: 14px; padding: 12px 22px; font-size: 14px; }

.scr-crewchat .cc-results { margin: 0; padding: 0 16px 12px; font-size: 13px; color: var(--sp-slate); }

/* ──────────────── Post card ──────────────── */
.scr-crewchat .cc-list { display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }
.scr-crewchat .cc-card {
    display: flex; flex-direction: column; padding: 14px; text-decoration: none; color: inherit;
    background: var(--sp-surface); border: 1px solid var(--sp-line);
    border-radius: var(--sp-r-lg); box-shadow: var(--sp-shadow-1);
    transition: transform 140ms ease, box-shadow 140ms ease;
}
.scr-crewchat .cc-card:hover { transform: translateY(-1px); box-shadow: var(--sp-shadow-2); }

.scr-crewchat .cc-card__top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.scr-crewchat .cc-card__who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.scr-crewchat .cc-card__name {
    font-size: 12px; font-weight: 600; color: var(--sp-ink); line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.scr-crewchat .cc-card__when {
    font-size: 11px; color: var(--sp-slate-2); line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.scr-crewchat .cc-card__marks { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.scr-crewchat .cc-fire, .scr-crewchat .cc-emo { font-size: 16px; line-height: 1; }
.scr-crewchat .cc-emo--lg { font-size: 20px; }

.scr-crewchat .cc-card__title {
    font-family: var(--sp-font-display); font-size: 16px; font-weight: 600;
    color: var(--sp-ink); line-height: 1.3; margin-bottom: 8px;
}
.scr-crewchat .cc-card__prev { font-size: 13px; color: var(--sp-slate); line-height: 1.45; margin-bottom: 10px; }
.scr-crewchat .cc-card__foot { display: flex; align-items: center; gap: 12px; font-size: 12px; }

.scr-crewchat .cc-stat {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
    border-radius: 8px; background: var(--sp-bg-2); font-weight: 600; color: var(--sp-ink);
}
.scr-crewchat .cc-stat--up { color: var(--sp-blue); }
.scr-crewchat .cc-stat__ico { width: 14px; height: 14px; color: var(--sp-slate); }
.scr-crewchat .cc-stat--up .cc-stat__ico { color: var(--sp-blue); }

/* Avatars — shared by feed, thread and composer. */
.scr-crewchat .cc-av {
    flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
    background: var(--sp-blue); color: #fff; display: grid; place-items: center;
    font-family: var(--sp-font-display); font-weight: 700; font-size: 12px; letter-spacing: .02em;
}
.scr-crewchat .cc-av--sm { width: 32px; height: 32px; font-size: 11px; }
.scr-crewchat .cc-av--lg { width: 40px; height: 40px; font-size: 14px; }
.scr-crewchat .cc-av--red { background: var(--sp-red); }
.scr-crewchat .cc-av__ico { width: 16px; height: 16px; color: #fff; }

/* ──────────────── Empty state ──────────────── */
.scr-crewchat .cc-empty {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    margin: 0 16px; padding: 40px 16px; text-align: center; color: var(--sp-slate);
}
.scr-crewchat .cc-empty__ico { width: 48px; height: 48px; color: var(--sp-slate-2); opacity: .5; }
.scr-crewchat .cc-empty b { margin-top: 10px; font-size: 15px; font-weight: 600; color: var(--sp-ink-2); }
.scr-crewchat .cc-empty span { font-size: 13px; }

/* ──────────────── Top bar (thread + new post) ──────────────── */
.scr-crewchat.cc-top .mtopbar__title span {
    display: block; margin-bottom: 2px; font-family: var(--sp-font-display);
    font-size: 10px; font-weight: 600; letter-spacing: .18em;
    text-transform: uppercase; color: var(--sp-blue);
}
.scr-crewchat.cc-top .mtopbar__title strong {
    font-size: 21px; text-transform: uppercase; letter-spacing: .01em; line-height: 1.1;
}
/* CrewChatThread passes accent="blue" (above); NewPostScreen takes the default red. */
.scr-crewchat.cc-top--red .mtopbar__title span { color: var(--sp-red); }

/* ──────────────── Thread — original post ──────────────── */
.scr-crewchat .cc-post {
    padding: 16px; background: var(--sp-surface); border: 1px solid var(--sp-line);
    border-radius: var(--sp-r-lg); box-shadow: var(--sp-shadow-1);
}
.scr-crewchat .cc-post__top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.scr-crewchat .cc-post__who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.scr-crewchat .cc-post__name { font-size: 13px; font-weight: 700; color: var(--sp-ink); }
.scr-crewchat .cc-post__when { font-size: 11px; color: var(--sp-slate-2); }
.scr-crewchat .cc-post__title {
    font-family: var(--sp-font-display); font-size: 20px; font-weight: 600;
    color: var(--sp-ink); line-height: 1.3; margin: 0 0 12px;
}
.scr-crewchat .cc-post__body { font-size: 14px; color: var(--sp-ink-2); line-height: 1.6; margin: 0 0 16px; }
.scr-crewchat .cc-post__actions { display: flex; gap: 12px; padding-top: 12px; border-top: 1px solid var(--sp-line-2); }

.scr-crewchat .cc-act {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
    background: var(--sp-bg-2); border: 1px solid var(--sp-line);
    font: inherit; font-size: 13px; font-weight: 600; color: var(--sp-ink); text-decoration: none;
}
.scr-crewchat .cc-act__ico { width: 16px; height: 16px; color: var(--sp-slate); }
.scr-crewchat .cc-act--up { background: var(--sp-blue-soft); border-color: transparent; color: var(--sp-blue); }
.scr-crewchat .cc-act--up .cc-act__ico { color: var(--sp-blue); }
/* Beats the legacy .cchat-like:hover in home.css, which would paint the button red. */
.scr-crewchat .cc-act:hover { background: var(--sp-bg); border-color: var(--sp-line); color: var(--sp-ink); }
.scr-crewchat .cc-act--up:hover { background: var(--sp-blue); border-color: transparent; color: #fff; }
.scr-crewchat .cc-act--up:hover .cc-act__ico { color: #fff; }
.scr-crewchat .cchat-like.on { background: var(--sp-blue); color: #fff; border-color: var(--sp-blue); }
.scr-crewchat .cchat-like.on .cc-act__ico { color: #fff; }
.scr-crewchat .cchat-like[disabled] { opacity: .75; cursor: default; }

/* ──────────────── Thread — replies ──────────────── */
.scr-crewchat .cc-replies { margin-top: 20px; }
.scr-crewchat .cc-replies__h {
    font-family: var(--sp-font-body); font-size: 14px; font-weight: 700;
    color: var(--sp-ink); margin: 0 0 14px; letter-spacing: 0;
}
.scr-crewchat .cc-replies__list { display: flex; flex-direction: column; gap: 12px; }
.scr-crewchat .cc-reply {
    display: flex; gap: 12px; padding: 14px; background: var(--sp-surface);
    border: 1px solid var(--sp-line); border-radius: 14px; box-shadow: var(--sp-shadow-1);
}
.scr-crewchat .cc-reply__main { flex: 1; min-width: 0; }
.scr-crewchat .cc-reply__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.scr-crewchat .cc-reply__meta strong { font-size: 12px; font-weight: 700; color: var(--sp-ink); }
.scr-crewchat .cc-reply__time { font-size: 11px; color: var(--sp-slate-2); }
.scr-crewchat .cc-rank {
    display: inline-block; padding: 1px 7px; border-radius: 999px;
    background: var(--sp-line-2); color: var(--sp-slate); font-size: 10.5px; font-weight: 700;
}
.scr-crewchat .cc-reply__body { font-size: 13px; color: var(--sp-ink-2); line-height: 1.5; margin: 0; }
.scr-crewchat .cc-replies__empty {
    margin: 0; padding: 22px 16px; text-align: center; font-size: 12.5px; color: var(--sp-slate);
    background: var(--sp-surface); border: 1px dashed var(--sp-line); border-radius: 14px;
}
.scr-crewchat .cc-loadmore {
    display: block; width: 100%; margin: 0 0 12px; padding: 9px; border-radius: 10px;
    border: 1px solid var(--sp-line); background: var(--sp-surface);
    color: var(--sp-slate); font: inherit; font-size: 13px; font-weight: 600;
}
.scr-crewchat .cc-loadmore:hover { background: var(--sp-bg-2); }
.scr-crewchat .cc-loadmore[disabled] { opacity: .6; cursor: default; }

/* ──────────────── Thread — reply composer ──────────────── */
.scr-crewchat .cc-composer {
    margin-top: 18px; padding: 12px; background: var(--sp-surface);
    border: 1px solid var(--sp-line); border-radius: var(--sp-r-lg); box-shadow: var(--sp-shadow-1);
}
.scr-crewchat .cc-composer__row { display: flex; align-items: flex-end; gap: 10px; }
.scr-crewchat .cc-composer__in {
    flex: 1; min-width: 0; min-height: 44px; max-height: 180px; padding: 12px 16px;
    border-radius: 22px; border: 1px solid var(--sp-line); background: var(--sp-bg-2);
    font: inherit; font-size: 14px; line-height: 1.4; color: var(--sp-ink);
    outline: none; resize: vertical;
}
.scr-crewchat .cc-composer__in:focus { border-color: var(--sp-blue); background: var(--sp-surface); }
.scr-crewchat .cc-composer__send {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
    background: var(--sp-blue); border: 0; display: grid; place-items: center;
}
.scr-crewchat .cc-composer__send:hover { background: #1a5fc4; }
.scr-crewchat .cc-composer__send[disabled] { opacity: .6; cursor: default; }
.scr-crewchat .cc-composer__sendico { width: 20px; height: 20px; color: #fff; }
.scr-crewchat .cc-composer__err { display: block; margin-top: 8px; }
.scr-crewchat .cc-composer__id { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.scr-crewchat .cc-anon {
    display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
    font-size: 13px; font-weight: 600; color: var(--sp-slate);
}

/* ──────────────── New post form ──────────────── */
.scr-crewchat .cc-form { display: flex; flex-direction: column; gap: 18px; }
.scr-crewchat .cc-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.scr-crewchat .cc-field__lab {
    display: block; margin-bottom: 10px; padding: 0; font-size: 12px; font-weight: 700;
    color: var(--sp-slate); letter-spacing: .06em; text-transform: uppercase;
}
.scr-crewchat .cc-opt { text-transform: none; letter-spacing: 0; color: var(--sp-slate-2); }

.scr-crewchat .cc-types { display: flex; gap: 8px; flex-wrap: wrap; }
.scr-crewchat .cc-type { position: relative; display: inline-flex; }
.scr-crewchat .cc-type__in { position: absolute; width: 1px; height: 1px; opacity: 0; }
.scr-crewchat .cc-type__lbl {
    display: inline-block; padding: 9px 16px; border-radius: 999px; cursor: pointer;
    font-size: 13px; font-weight: 700; color: var(--cc-fg);
    background: var(--sp-surface); border: 1.5px solid var(--sp-line);
}
.scr-crewchat .cc-type__in:checked + .cc-type__lbl { background: var(--cc-soft); border-color: var(--cc-fg); }
.scr-crewchat .cc-type__in:focus-visible + .cc-type__lbl { outline: 2px solid var(--sp-blue); outline-offset: 2px; }

.scr-crewchat .cc-in {
    width: 100%; padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--sp-line);
    background: var(--sp-surface); font: inherit; font-size: 14px; color: var(--sp-ink); outline: none;
}
.scr-crewchat .cc-in:focus { border-color: var(--sp-blue); }
.scr-crewchat .cc-in--ta { min-height: 120px; line-height: 1.55; resize: vertical; }
.scr-crewchat .cc-in--sm { flex: 1 1 170px; width: auto; padding: 11px 13px; font-size: 13.5px; border-radius: 12px; }
.scr-crewchat .cc-count { margin: 4px 0 0; text-align: right; font-size: 11px; color: var(--sp-slate-2); }
.scr-crewchat .cc-err { display: block; margin-top: 6px; }

.scr-crewchat .cc-submit {
    width: 100%; padding: 16px; border-radius: 14px; border: 0; background: var(--sp-blue);
    color: #fff; font: inherit; font-size: 15px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.scr-crewchat .cc-submit:hover { background: #1a5fc4; }
.scr-crewchat .cc-submit__ico { width: 17px; height: 17px; color: #fff; }
/* Prototype's greyed "can't post yet" state — mirrors the server's title rule. */
.scr-crewchat .cc-submit[disabled] { background: var(--sp-line); color: var(--sp-slate); cursor: default; }
.scr-crewchat .cc-submit[disabled] .cc-submit__ico { color: var(--sp-slate); }

/* ──────────────── Desktop (sidebar layout supplies the gutters) ──────────────── */
@media (min-width: 1024px) {
    .scr-crewchat.cc-head { padding: 26px 0 4px; }
    .scr-crewchat .cc-head__sub { margin-bottom: 16px; }
    .scr-crewchat.cc-body { padding: 18px 0 40px; }
    .scr-crewchat.cc-body--thread,
    .scr-crewchat.cc-body--form { padding: 18px 0 40px; }
    .scr-crewchat .cc-pills,
    .scr-crewchat .cc-sortrow,
    .scr-crewchat .cc-results,
    .scr-crewchat .cc-list,
    .scr-crewchat .cc-empty,
    .scr-crewchat .cc-flash { padding-left: 0; padding-right: 0; margin-left: 0; margin-right: 0; }
    .scr-crewchat .cc-search { max-width: 560px; }
}

/* ──────────────── PORT SCOPE — the board follows the chosen port ──────────────── */
.cc-head__scope {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--sp-red-soft);
    color: var(--sp-red);
    font-family: var(--sp-font);
    font-size: 12.5px;
    font-weight: 700;
    vertical-align: middle;
}
.cc-head__all {
    margin-left: 6px;
    color: var(--sp-red);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
