/* ==========================================================================
   SocialHub — Community surfaces
   Groups, Pages, Events, Marketplace and Premium. These five pages share
   one shape: coloured hero, category rail, filter tabs, card grid.

   Mobile-first. Every value comes from a token in sh-tokens.css.
   Loaded only by the views in groups/, pages/, events/, marketplace/ and
   premium/, so nothing here can leak into the feed or admin surfaces.
   ========================================================================== */

/* ==========================================================================
   Page column
   The same markup renders inside the signed-in shell (which already has a
   gutter) and inside the public layout (which does not).
   ========================================================================== */

.sh-community {
    display: flex;
    flex-direction: column;
    gap: var(--sh-sp-4);
    min-width: 0;
}

.sh-public .sh-community-surface {
    background: var(--sh-page-bg);
}

.sh-community .sh-page-head-row .sh-search {
    flex: 0 1 320px;
}

.sh-public .sh-community {
    max-width: var(--sh-shell-max);
    margin-inline: auto;
    padding: var(--sh-sp-4) var(--sh-gutter) var(--sh-sp-10);
}

/* Sign-up prompt shown to guests where members get the right rail. */
.sh-cjoin {
    display: flex;
    flex-direction: column;
    gap: var(--sh-sp-3);
    padding: var(--sh-sp-5);
    border-radius: var(--sh-radius-lg);
    background: var(--sh-brand-gradient-soft);
    border: 1px solid var(--sh-border);
    text-align: center;
}

.sh-cjoin-title {
    margin: 0;
    font-size: var(--sh-fs-xl);
    font-weight: var(--sh-fw-bold);
    color: var(--sh-text-strong);
}

.sh-cjoin-text {
    margin: 0;
    font-size: var(--sh-fs-base);
    color: var(--sh-text-muted);
}

.sh-cjoin-actions {
    display: flex;
    justify-content: center;
    gap: var(--sh-sp-2);
    flex-wrap: wrap;
}

/* ==========================================================================
   Hero banner
   ========================================================================== */

.sh-chero {
    position: relative;
    overflow: hidden;
    padding: var(--sh-sp-6) var(--sh-sp-4);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-lg);
    background: var(--sh-brand-gradient-soft);
}

.sh-chero-violet {
    background: linear-gradient(135deg, #ede9fe 0%, #f5ecfd 45%, #fce7f3 100%);
    border-color: var(--sh-violet-200);
}

.sh-chero-dark {
    background: linear-gradient(135deg, #1e1b4b 0%, #4c1d95 55%, #9d174d 100%);
    border-color: transparent;
}

.sh-chero-inner {
    display: flex;
    flex-direction: column;
    gap: var(--sh-sp-3);
    max-width: 640px;
}

.sh-chero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--sh-fs-sm);
    font-weight: var(--sh-fw-bold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sh-violet-700);
}

.sh-chero-eyebrow svg {
    width: 18px;
    height: 18px;
}

.sh-chero-title {
    margin: 0;
    font-size: var(--sh-fs-3xl);
    font-weight: var(--sh-fw-extrabold);
    line-height: var(--sh-lh-tight);
    letter-spacing: -0.025em;
    color: var(--sh-text-strong);
}

.sh-chero-accent {
    color: var(--sh-violet-600);
}

.sh-chero-text {
    margin: 0;
    font-size: var(--sh-fs-md);
    color: var(--sh-text-muted);
}

.sh-chero-dark .sh-chero-title,
.sh-chero-dark .sh-chero-text,
.sh-chero-dark .sh-chero-eyebrow {
    color: var(--sh-text-inverse);
}

.sh-chero-dark .sh-chero-accent {
    color: var(--sh-violet-300);
}

.sh-chero-dark .sh-chero-point {
    color: var(--sh-text-inverse);
    background: rgba(255, 255, 255, 0.14);
}

/* Search row inside the hero */
.sh-chero-search {
    display: flex;
    flex-direction: column;
    gap: var(--sh-sp-2);
}

.sh-chero-search .sh-search {
    flex: 1 1 auto;
}

.sh-chero-points {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sh-sp-2);
}

.sh-chero-point {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: var(--sh-radius-pill);
    background: var(--sh-surface-frost);
    font-size: var(--sh-fs-xs);
    font-weight: var(--sh-fw-semibold);
    color: var(--sh-text);
}

.sh-chero-point svg {
    width: 15px;
    height: 15px;
    color: var(--sh-success-600);
}

/* ==========================================================================
   Category icon rail
   ========================================================================== */

.sh-cat-rail {
    display: flex;
    gap: var(--sh-sp-2);
    overflow-x: auto;
    scrollbar-width: none;
    padding: var(--sh-sp-2);
}

.sh-cat-rail::-webkit-scrollbar {
    display: none;
}

.sh-cat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    width: 82px;
    padding: var(--sh-sp-2);
    border-radius: var(--sh-radius);
    text-align: center;
}

.sh-cat:hover {
    background: var(--sh-surface-sunken);
}

.sh-cat.is-active {
    background: var(--sh-primary-50);
}

.sh-cat-label {
    font-size: var(--sh-fs-xs);
    font-weight: var(--sh-fw-semibold);
    color: var(--sh-text-muted);
    line-height: var(--sh-lh-snug);
}

.sh-cat.is-active .sh-cat-label {
    color: var(--sh-primary-700);
}

/* ==========================================================================
   Filter bar — tabs on the left, selects on the right
   ========================================================================== */

.sh-cbar {
    display: flex;
    flex-direction: column;
    gap: var(--sh-sp-3);
    padding: var(--sh-sp-3) var(--sh-sp-4);
}

.sh-cbar-tools {
    display: flex;
    gap: var(--sh-sp-2);
    align-items: center;
}

.sh-cbar-tools .sh-select {
    flex: 1 1 auto;
}

/* Chip row that scrolls sideways on a phone */
.sh-cchips {
    display: flex;
    gap: var(--sh-sp-2);
    overflow-x: auto;
    scrollbar-width: none;
}

.sh-cchips::-webkit-scrollbar {
    display: none;
}

/* ==========================================================================
   Card grid and horizontal card rail
   ========================================================================== */

.sh-cgrid {
    display: grid;
    gap: var(--sh-sp-3);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sh-cgrid > * {
    min-width: 0;
}

.sh-crail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 78%;
    gap: var(--sh-sp-3);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding-bottom: var(--sh-sp-1);
}

.sh-crail::-webkit-scrollbar {
    display: none;
}

.sh-crail > * {
    scroll-snap-align: start;
    min-width: 0;
}

/* ==========================================================================
   Entity card — one frame for groups, pages, events and products
   ========================================================================== */

.sh-ccard {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--sh-surface);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-lg);
    box-shadow: var(--sh-shadow-sm);
    overflow: hidden;
}

.sh-ccard-cover {
    position: relative;
    display: block;
}

.sh-ccard-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1 1 auto;
    padding: var(--sh-sp-3);
}

.sh-ccard-title {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--sh-fs-md);
    font-weight: var(--sh-fw-bold);
    color: var(--sh-text-strong);
    line-height: var(--sh-lh-snug);
}

.sh-ccard-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    font-size: var(--sh-fs-xs);
    color: var(--sh-text-muted);
}

.sh-ccard-meta svg {
    width: 14px;
    height: 14px;
}

.sh-ccard-text {
    font-size: var(--sh-fs-sm);
    color: var(--sh-text-muted);
    line-height: var(--sh-lh-snug);
}

.sh-ccard-foot {
    display: flex;
    flex-direction: column;
    gap: var(--sh-sp-2);
    padding: 0 var(--sh-sp-3) var(--sh-sp-3);
}

/* The RSVP form wraps a block button, so it has to flex like one. */
.sh-crsvp {
    flex: 1 1 auto;
    min-width: 0;
}

.sh-ccard-seller {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: var(--sh-sp-2);
    border-top: 1px solid var(--sh-border);
    font-size: var(--sh-fs-xs);
    color: var(--sh-text-muted);
}

/* Avatar lifted over the cover on group and page cards */
.sh-ccard-avatar {
    margin-top: calc(var(--sh-sp-6) * -1);
    margin-bottom: 2px;
    box-shadow: 0 0 0 3px var(--sh-surface);
}

/* Corner furniture */
.sh-ccard-flag {
    position: absolute;
    top: var(--sh-sp-2);
    left: var(--sh-sp-2);
}

.sh-ccard-pin {
    position: absolute;
    top: var(--sh-sp-2);
    right: var(--sh-sp-2);
    background: var(--sh-surface);
    box-shadow: var(--sh-shadow-sm);
}

.sh-ccard-pin.is-active {
    color: var(--sh-danger-500);
}

/* Calendar chip on event covers */
.sh-cdate {
    position: absolute;
    top: var(--sh-sp-2);
    left: var(--sh-sp-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 44px;
    padding: 4px 6px;
    border-radius: var(--sh-radius-sm);
    background: var(--sh-surface);
    box-shadow: var(--sh-shadow-sm);
    line-height: 1.1;
}

.sh-cdate-month {
    font-size: var(--sh-fs-2xs);
    font-weight: var(--sh-fw-bold);
    text-transform: uppercase;
    color: var(--sh-danger-600);
}

.sh-cdate-day {
    font-size: var(--sh-fs-lg);
    font-weight: var(--sh-fw-extrabold);
    color: var(--sh-text-strong);
}

.sh-cdate-weekday {
    font-size: var(--sh-fs-2xs);
    font-weight: var(--sh-fw-semibold);
    color: var(--sh-text-muted);
    text-transform: uppercase;
}

/* Money and rating */
.sh-cprice {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.sh-cprice-now {
    font-size: var(--sh-fs-xl);
    font-weight: var(--sh-fw-extrabold);
    color: var(--sh-success-600);
}

.sh-cprice-was {
    font-size: var(--sh-fs-xs);
    color: var(--sh-text-subtle);
    text-decoration: line-through;
}

.sh-crating {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: var(--sh-fs-xs);
    font-weight: var(--sh-fw-semibold);
    color: var(--sh-text-muted);
}

.sh-crating svg {
    width: 14px;
    height: 14px;
    color: var(--sh-warning-500);
}

/* ==========================================================================
   Detail pages
   ========================================================================== */

.sh-cdetail {
    display: grid;
    gap: var(--sh-sp-4);
}

.sh-cdetail > * {
    min-width: 0;
}

.sh-cdetail-main,
.sh-cdetail-side {
    display: flex;
    flex-direction: column;
    gap: var(--sh-sp-4);
    min-width: 0;
}

.sh-chead-cover {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: var(--sh-surface-sunken);
}

.sh-chead-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sh-chead {
    display: flex;
    flex-direction: column;
    gap: var(--sh-sp-3);
    padding: var(--sh-sp-4);
}

/* The lift belongs to the avatar, not the row — the same rule as the
   profile header. On the row it hoisted the title up over the cover too,
   so on a phone "Tech Geeks" was drawn behind the group's own avatar. */
.sh-chead-top {
    display: flex;
    align-items: flex-end;
    gap: var(--sh-sp-3);
    flex-wrap: wrap;
}

.sh-chead-avatar {
    box-shadow: 0 0 0 3px var(--sh-surface);
    margin-top: calc(var(--sh-sp-10) * -1);
    flex-shrink: 0;
}

/* Long group names shorten instead of wrapping under the avatar. */
.sh-chead-top > .sh-grow {
    min-width: 0;
}

.sh-chead-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: var(--sh-fs-2xl);
    font-weight: var(--sh-fw-extrabold);
    letter-spacing: -0.02em;
    color: var(--sh-text-strong);
}

.sh-chead-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: var(--sh-fs-sm);
    color: var(--sh-text-muted);
}

.sh-chead-meta svg {
    width: 15px;
    height: 15px;
}

.sh-chead-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sh-sp-2);
}

.sh-chead-actions .sh-btn,
.sh-chead-actions .sh-crsvp {
    flex: 1 1 auto;
}

/* Controls inside a card footer always fill the card. */
.sh-ccard-foot .sh-crsvp .sh-btn,
.sh-ccard-foot > .sh-btn {
    width: 100%;
}

.sh-crsvp .sh-btn {
    width: 100%;
}

/* Key/value block (condition, brand, stock, format…) */
.sh-cspecs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sh-sp-3);
}

.sh-cspec-label {
    display: block;
    font-size: var(--sh-fs-xs);
    color: var(--sh-text-muted);
}

.sh-cspec-value {
    display: block;
    font-size: var(--sh-fs-base);
    font-weight: var(--sh-fw-semibold);
    color: var(--sh-text);
}

/* Product gallery */
.sh-cgallery {
    display: flex;
    flex-direction: column;
    gap: var(--sh-sp-2);
}

.sh-cgallery-main {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: var(--sh-surface-sunken);
}

.sh-cgallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sh-cgallery-thumbs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 72px;
    gap: var(--sh-sp-2);
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 var(--sh-sp-3) var(--sh-sp-3);
}

.sh-cgallery-thumbs::-webkit-scrollbar {
    display: none;
}

.sh-cgallery-thumb {
    border-radius: var(--sh-radius-sm);
    overflow: hidden;
    border: 1px solid var(--sh-border);
}

.sh-cgallery-thumb img {
    display: block;
    width: 100%;
    height: 72px;
    object-fit: cover;
}

/* Rules / bullet list on a group page */
.sh-crules {
    display: flex;
    flex-direction: column;
    gap: var(--sh-sp-3);
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: sh-rule;
}

.sh-crule {
    display: flex;
    gap: var(--sh-sp-3);
    font-size: var(--sh-fs-base);
    color: var(--sh-text);
}

.sh-crule::before {
    counter-increment: sh-rule;
    content: counter(sh-rule);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--sh-primary-50);
    color: var(--sh-primary-700);
    font-size: var(--sh-fs-xs);
    font-weight: var(--sh-fw-bold);
}

/* ==========================================================================
   Premium
   ========================================================================== */

.sh-chighlights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sh-sp-3);
}

.sh-chighlight {
    display: flex;
    gap: var(--sh-sp-2);
    padding: var(--sh-sp-3);
    border-radius: var(--sh-radius);
    background: var(--sh-surface-frost);
}

.sh-chighlight-title {
    display: block;
    font-size: var(--sh-fs-base);
    font-weight: var(--sh-fw-bold);
    color: var(--sh-text-strong);
}

.sh-chighlight-text {
    display: block;
    font-size: var(--sh-fs-xs);
    color: var(--sh-text-muted);
}

.sh-cswitch {
    display: flex;
    justify-content: center;
}

.sh-cplans {
    display: grid;
    gap: var(--sh-sp-4);
    grid-template-columns: minmax(0, 1fr);
    /* stretch, not start: otherwise every card collapses to its own content
       height and the row looks ragged. */
    align-items: stretch;
}

.sh-cplan {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--sh-sp-4);
    /* Every card reserves the ribbon band, so a highlighted one does not sit
       lower than its neighbours. Only the popular card paints it. */
    padding: var(--sh-sp-8) var(--sh-sp-5) var(--sh-sp-5);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-lg);
    background: var(--sh-surface);
    box-shadow: var(--sh-shadow-sm);
    height: 100%;
}

.sh-cplan-popular {
    border-color: var(--sh-violet-400);
    box-shadow: var(--sh-shadow-md);
}

.sh-cplan-flag {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    border-top-left-radius: var(--sh-radius-lg);
    border-top-right-radius: var(--sh-radius-lg);
    padding: 6px;
    background: var(--sh-violet-600);
    color: var(--sh-text-inverse);
    font-size: var(--sh-fs-xs);
    font-weight: var(--sh-fw-bold);
    text-align: center;
}

.sh-cplan-head {
    display: flex;
    align-items: center;
    gap: var(--sh-sp-3);
}

.sh-cplan-name {
    display: block;
    font-size: var(--sh-fs-xl);
    font-weight: var(--sh-fw-bold);
    color: var(--sh-text-strong);
}

.sh-cplan-tagline {
    display: block;
    font-size: var(--sh-fs-xs);
    color: var(--sh-text-muted);
}

.sh-cplan-price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
}

.sh-cplan-amount {
    font-size: var(--sh-fs-4xl);
    font-weight: var(--sh-fw-extrabold);
    letter-spacing: -0.03em;
    color: var(--sh-text-strong);
}

.sh-cplan-interval {
    font-size: var(--sh-fs-md);
    color: var(--sh-text-muted);
}

.sh-cplan-features {
    display: flex;
    flex-direction: column;
    gap: var(--sh-sp-3);
    margin: 0;
    padding: 0;
    list-style: none;
    flex: 1 1 auto;
}

.sh-cplan-feature {
    display: flex;
    align-items: flex-start;
    gap: var(--sh-sp-2);
    font-size: var(--sh-fs-base);
    color: var(--sh-text);
}

.sh-cplan-feature svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--sh-primary-600);
}

.sh-cplan-popular .sh-cplan-feature svg {
    color: var(--sh-violet-600);
}

/* ==========================================================================
   Tablet
   ========================================================================== */

@media (min-width: 768px) {
    .sh-community {
        gap: var(--sh-sp-5);
    }

    .sh-chero {
        padding: var(--sh-sp-10) var(--sh-sp-8);
    }

    .sh-chero-title {
        font-size: var(--sh-fs-4xl);
    }

    .sh-chero-search {
        flex-direction: row;
        align-items: center;
    }

    /* The search field takes the slack; the select and button stay natural. */
    .sh-chero-search .sh-select,
    .sh-chero-search .sh-btn {
        flex: 0 0 auto;
        width: auto;
    }

    .sh-cat-rail {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
        overflow: visible;
    }

    .sh-cat {
        width: auto;
    }

    .sh-cbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .sh-cbar-tools .sh-select {
        flex: 0 0 auto;
    }

    .sh-cgrid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--sh-sp-4);
    }

    .sh-crail {
        grid-auto-columns: calc(33.333% - var(--sh-sp-3));
    }

    .sh-chighlights {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    /* Two up, then four up — auto-fit left a single orphan card on its own
       row and a wide gap beside it. */
    .sh-cplans {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sh-cspecs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sh-chead-actions .sh-btn,
    .sh-chead-actions .sh-crsvp {
        flex: 0 0 auto;
    }

    .sh-chead-actions .sh-crsvp .sh-btn {
        width: auto;
    }

    .sh-chead-cover {
        height: 220px;
    }

    .sh-cgallery-main {
        height: 380px;
    }
}

/* ==========================================================================
   Desktop
   ========================================================================== */

@media (min-width: 1024px) {
    .sh-cdetail {
        grid-template-columns: minmax(0, 1fr) 320px;
        align-items: start;
    }

    .sh-crail {
        grid-auto-columns: calc(25% - var(--sh-sp-3));
    }

    .sh-chead {
        padding: var(--sh-sp-5);
    }

    .sh-chead-cover {
        height: 280px;
    }

    .sh-cgallery-main {
        height: 460px;
    }
}

@media (min-width: 1280px) {
    .sh-cgrid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}


/* Four across only once the main column is genuinely wide. This page keeps a
   rail, so at 1280 four cards come out ~209px and every label wraps; two-up
   reads far better until there is real room. */
@media (min-width: 1600px) {
    .sh-cplans {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
