/* ======================================================
FEATURED MODS
Component-only rules. Generic properties live in utility.css.
Spec: wp-content/docs/featured-mods-spec.md
====================================================== */

/* ------------------------------------------------------
SECTION SHELL
------------------------------------------------------ */
.sc-featured-mods {
    background-image: linear-gradient(180deg, #1e1e1e, rgb(0 0 0 / 0%) 100%);
    background-color: #121212;
    border-radius: 10px;
    padding: 14px 0 16px;
    margin-bottom: 14px;
}

.sc-featured-mods--mobile {
    background: none;
    border: 0;
    border-radius: 0;
    padding: 20px 0 20px;
    margin: 0;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sc-featured-mods:not(.sc-featured-mods--mobile) .sc-featured-mods__head {
    padding: 0 12px;
}

.sc-featured-mods__t {
    position: relative;
    padding-left: 11px;
}

.sc-featured-mods__t::before {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 3px;
    background: #ff3b3b;
    border-radius: 2px;
}

.sc-featured-mods--mobile .sc-featured-mods__t {
    padding-left: 0;
}

.sc-featured-mods--mobile .sc-featured-mods__t::before {
    display: none;
}

.sc-featured-mods--mobile .sc-featured-mods__sub {
    margin-left: 0;
}

.sc-featured-mods__sub {
    margin-left: 11px;
}

.sc-featured-mods__edit:hover {
    background: rgba(255,255,255,.16);
}

/* ------------------------------------------------------
EMBEDDED — compact strip inside Mods & Specs
------------------------------------------------------ */
.sc-featured-mods--embedded {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 14px;
    margin-bottom: 14px;
}

.sc-featured-mods--embedded .sc-featured-mods__rail {
    display: block;
    padding: 0;
}

@media (max-width: 991.98px) {
    .sc-featured-mods--embedded .sc-featured-mods__rail {
        overflow: visible;
    }
}

@media (min-width: 992px) {
    .sc-featured-mods--embedded .sc-featured-mods__rail {
        overflow: hidden;
    }

    /* Edge fades — desktop embedded (same affordance as build snapshot / mod chips) */
    .sc-featured-mods--embedded .sc-featured-mods__rail::before,
    .sc-featured-mods--embedded .sc-featured-mods__rail::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 4rem;
        pointer-events: none;
        z-index: 1;
        transition: opacity 180ms ease;
    }

    .sc-featured-mods--embedded .sc-featured-mods__rail::before {
        left: 0;
        background: linear-gradient(to left, transparent, #1e1e1e);
        opacity: 0;
    }

    .sc-featured-mods--embedded .sc-featured-mods__rail::after {
        right: 0;
        background: linear-gradient(to right, transparent, #1e1e1e);
        opacity: 1;
    }

    .sc-featured-mods--embedded .sc-featured-mods__rail.has-left-overflow::before {
        opacity: 1;
    }

    .sc-featured-mods--embedded .sc-featured-mods__rail:not(.has-right-overflow)::after {
        opacity: 0;
    }
}

.sc-featured-mods--embedded .sc-featured-mods__hint {
    margin-left: 0;
    margin-right: 0;
}

/* ------------------------------------------------------
OWNER EMPTY PROMPT
------------------------------------------------------ */
.sc-featured-mods__prompt {
    background: rgba(255,255,255,.03);
    border: 1px dashed rgba(255,255,255,.18);
    border-radius: 10px;
    padding: 14px;
}

.sc-featured-mods:not(.sc-featured-mods--mobile) .sc-featured-mods__prompt {
    margin: 0 12px;
}

.sc-featured-mods__prompt-ic {
    width: 38px;
    height: 38px;
    background: rgba(255,59,59,.12);
    color: #ff3b3b;
}

.sc-featured-mods__cta {
    background: #ff3b3b;
    margin-left: auto;
}

.sc-featured-mods__cta:hover {
    background: #e63333;
}

/* ------------------------------------------------------
RAIL — mobile + tablet
------------------------------------------------------ */
.sc-featured-mods__rail {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 12px 2px;
}

.sc-featured-mods--mobile .sc-featured-mods__rail {
    overflow: visible;
    display: block;
    padding: 0;
}

.sc-featured-mods__track {
    flex-wrap: nowrap;
    cursor: grab;
    scroll-behavior: auto !important;
    -webkit-overflow-scrolling: auto;
    scroll-snap-type: none !important;
    overscroll-behavior-x: contain;
    user-select: none;
    align-items: stretch;
}

.sc-featured-mods__track > * {
    scroll-snap-align: none;
}

.sc-featured-mods__track.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
}

.sc-featured-mods__track .sc-featured-mod {
    flex: 0 0 220px;
    min-width: 220px;
    max-width: 220px;
    align-self: stretch;
}

.sc-featured-mods__rail::-webkit-scrollbar {
    display: none;
}

/* ------------------------------------------------------
OWNER ADD CARD — dashed image slot only (no title row)
------------------------------------------------------ */
.sc-featured-mod--add {
    border: 0;
    background: transparent;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    color: rgba(255,255,255,0.66);
    text-align: left;
}

.sc-featured-mod--add__ph {
    border: 1px dashed rgba(255,255,255,0.16);
}

.sc-featured-mod--add:hover {
    color: #fff;
    transform: none;
}

.sc-featured-mod--add:hover .sc-featured-mod--add__ph {
    border-color: rgba(255,255,255,0.28);
}

.sc-featured-mod--add__ic {
    background: rgba(213,32,32,0.12);
    color: var(--primary);
}

/* ------------------------------------------------------
OWNER FULL TILE + HINT
------------------------------------------------------ */
.sc-featured-mod--full {
    background: transparent;
    cursor: default;
}

.sc-featured-mod--full .sc-featured-mod__ph {
    border: 1px solid rgba(255,255,255,.10);
    border-bottom: 0;
}

/* ------------------------------------------------------
COVER IMAGE — always fill the 5:4 photo slot. The owner-picked crop
focal point still comes through inline background-position; only
background-size is forced so a frame whose aspect ratio doesn't
exactly match the slot never leaves letterboxed gaps. */
.sc-featured-mod__cover-img {
    background-size: cover !important;
}

.sc-featured-mods__hint {
    margin: 10px 12px 0;
    font-variant-numeric: tabular-nums;
}

.sc-featured-mods--mobile .sc-featured-mods__hint {
    margin-left: 0;
    margin-right: 0;
}

@media (min-width: 992px) {
    .sc-featured-mods:not(.sc-featured-mods--mobile) .sc-featured-mods__hint {
        margin-left: 20px;
        margin-right: 20px;
    }
}

/* ------------------------------------------------------
TABLET — keep the swipeable rail, no wrap
------------------------------------------------------ */

/* ------------------------------------------------------
DESKTOP — grid, no swipe affordance needed
------------------------------------------------------ */
@media (min-width: 992px) {
    .sc-featured-mods {
        padding: 18px 0 20px;
    }

    .sc-featured-mods__head,
    .sc-featured-mods__prompt {
        padding-left: 20px;
        padding-right: 20px;
    }

    .sc-featured-mods__prompt {
        margin: 0 20px;
        padding: 14px;
    }

    .sc-featured-mods__rail {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        overflow: visible;
        padding: 0 20px;
    }

    .sc-featured-mod {
        flex: none;
        min-width: 0;
        max-width: none;
    }

    .sc-featured-mod .sc-fm-cat-pill {
        top: 6px;
        left: 6px;
    }
}

/* ======================================================
MODAL
====================================================== */
/* Lock wrapper opacity so the sc-modal system's opacity transition
   cannot fade the sheet — only the slide-down transition runs. */
@media (max-width: 991px) {
    .sc-modal.sc-fm-modal {
        opacity: 1 !important;
        --sc-modal-transition-duration: 360ms;
    }

    .sc-modal.sc-fm-modal.show {
        align-items: flex-end;
    }
}

.sc-modal.sc-fm-modal .sc-modal-overlay {
    transition: opacity 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Mobile sheet — pinned to viewport bottom. */
@media (max-width: 991px) {
    /* (0,3,0) to beat sc-modal.css's .sc-modal .sc-modal-dialog at (0,2,0). */
    .sc-modal.sc-fm-modal .sc-fm-dialog {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 2;
        width: 100%;
        max-width: 100%;
        margin: 0;
        max-height: 94vh;
        max-height: 94dvh;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: none;
        background: #181818;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, .5);
        opacity: 1;
        transform: translateY(100%);
        transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
        touch-action: pan-y;
    }

    .sc-modal.sc-fm-modal .sc-modal-dialog.sc-fm-dialog {
        animation: none !important;
        opacity: 1 !important;
        transform: translateY(100%) !important;
        transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1) !important;
    }

    .sc-modal.sc-fm-modal.show .sc-fm-dialog {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        width: 100%;
        max-width: 100%;
        background: #181818;
        border-radius: 16px 16px 0 0;
        transform: translateY(0);
    }

    .sc-modal.sc-fm-modal.show:not(.sc-is-closing) .sc-modal-dialog.sc-fm-dialog {
        transform: translateY(0) !important;
        animation: none !important;
    }

    .sc-modal.sc-fm-modal.sc-is-closing .sc-fm-dialog,
    .sc-modal.sc-fm-modal.sc-is-closing .sc-modal-dialog.sc-fm-dialog {
        opacity: 1;
        transform: translateY(100%) !important;
        animation: none !important;
        transition: transform 360ms cubic-bezier(0.4, 0, 1, 1) !important;
    }
}

@media (max-width: 991px) and (prefers-reduced-motion: reduce) {
    .sc-modal.sc-fm-modal .sc-modal-dialog.sc-fm-dialog,
    .sc-modal.sc-fm-modal.sc-is-closing .sc-modal-dialog.sc-fm-dialog {
        transition: none !important;
    }
}

/* ------------------------------------------------------
/* ------------------------------------------------------
SPECIFICITY OVERRIDES — desktop shell only.

Desktop uses a centred card, not the mobile bottom sheet.
sc-featured-mods.css loads after sc-modal.css.
------------------------------------------------------ */

.sc-fm-modal .sc-fm-dialog::-webkit-scrollbar {
    display: none;
}

.sc-modal.sc-fm-modal.sc-is-closing {
    --sc-modal-transition-duration: 360ms;
}

.sc-modal.sc-fm-modal.sc-is-closing .sc-modal-overlay {
    transition: opacity 360ms cubic-bezier(0.4, 0, 1, 1);
}

/* while the user drags the handle down */
.sc-fm-modal .sc-fm-dialog.is-dragging {
    transition: none;
}

/* Bigger tap area around the grab handle, and it owns the drag gesture. */
.sc-fm-handle {
    position: relative;
    z-index: 5;
    flex-shrink: 0;
    height: 22px;
    cursor: grab;
    touch-action: none;
}

.sc-fm-handle:active {
    cursor: grabbing;
}

.sc-fm-grab {
    position: absolute;
    top: 9px;
    left: 0;
    right: 0;
    z-index: 4;
    width: 40px;
    height: 4px;
    margin: 0 auto;
    border-radius: 2px;
    background: rgba(255,255,255,.32);
}

@media (min-width: 992px) {
    /* Keep the wrapper opaque — only the dialog + overlay animate on close. */
    .sc-modal.sc-fm-modal {
        opacity: 1 !important;
    }

    .sc-modal.sc-fm-modal.show {
        align-items: center;
        padding: 48px 16px 24px;
        box-sizing: border-box;
    }

    .sc-modal.sc-fm-modal.sc-is-closing {
        --sc-modal-transition-duration: 200ms;
    }

    /* Centred dialog — unpin from the mobile bottom sheet.
       (0,3,0) so it holds without .show too — otherwise the mobile
       full-width/bottom-pinned rule wins the moment .show is dropped. */
    .sc-modal.sc-fm-modal .sc-fm-dialog,
    .sc-modal.sc-fm-modal .sc-modal-dialog.sc-fm-dialog {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        width: 460px;
        max-width: 460px;
        max-height: calc(100vh - 72px);
        max-height: calc(100dvh - 72px);
        margin: 0 auto;
        overflow: visible;
        background: #1e1e1e;
        border-radius: 14px;
        box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
        transform: scale(1) !important;
        opacity: 1;
        transition: none;
        animation: none !important;
    }

    .sc-modal.sc-fm-modal.show:not(.sc-is-closing) .sc-modal-dialog.sc-fm-dialog {
        animation: sc-fm-dialog-in 200ms ease forwards !important;
        transition: none !important;
    }

    .sc-fm-modal .sc-fm-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        top: -44px;
        right: 0;
        width: 36px;
        height: 36px;
        color: rgba(255, 255, 255, 0.78);
        background: none;
        border: 0;
        cursor: pointer;
        padding: 0;
        z-index: 3;
    }

    .sc-fm-modal .sc-fm-close-btn:hover,
    .sc-fm-modal .sc-fm-close-btn:focus-visible {
        color: #fff;
    }

    .sc-fm-modal .sc-fm-dialog__inner {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        max-height: calc(100vh - 72px);
        max-height: calc(100dvh - 72px);
        border-radius: 14px;
        scrollbar-width: none;
    }

    .sc-fm-modal .sc-fm-dialog__inner::-webkit-scrollbar {
        display: none;
    }

    @keyframes sc-fm-dialog-in {
        from { opacity: 0; transform: scale(.97); }
        to   { opacity: 1; transform: scale(1); }
    }

    /* Close as a scale-down + fade (reverse of sc-fm-dialog-in),
       not the mobile sheet's slide-down. */
    .sc-modal.sc-fm-modal.sc-is-closing .sc-modal-dialog.sc-fm-dialog {
        transform: scale(.97) !important;
        opacity: 0 !important;
        transition: transform 200ms ease, opacity 200ms ease !important;
        animation: none !important;
    }

    .sc-fm-grab,
    .sc-fm-handle {
        display: none;
    }
}

/* ------------------------------------------------------
GALLERY
------------------------------------------------------ */
.sc-fm-gal {
    width: 94vw;
    max-width: 94vw;
    aspect-ratio: 10 / 7.5;
    max-height: 54vh;
    max-height: 54dvh;
    overflow: hidden;
}

@media (orientation: landscape) and (max-height: 560px) {
    .sc-fm-gal {
        max-height: 46vh;
        max-height: 46dvh;
    }
}

.sc-fm-modal .sc-fm-body {
    width: 94vw;
    max-width: 94vw;
    align-self: center;
    flex-shrink: 0;
}

.sc-fm-gal__proof-text {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}

.sc-fm-gal:active {
    cursor: grabbing;
}

.sc-fm-gal::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 110px;
    background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
    pointer-events: none;
    z-index: 1;
}

.sc-fm-gal__track {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.sc-fm-gal__track::-webkit-scrollbar {
    display: none;
}

.sc-fm-gal__slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.sc-fm-gal__frame {
    display: block;
    background-color: #111;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.sc-fm-gal__counter {
    pointer-events: none;
}

/* Shared category pill — used on featured-mod cards and the modal gallery */
.sc-fm-cat-pill {
    background: rgba(0, 0, 0, 0.7) !important;
    border: 1px solid color-mix(in srgb, currentColor 45%, transparent);
}

/* ------------------------------------------------------
ACTION ORBS
------------------------------------------------------ */
/* sc-fm-orbs — utilities on element */

.sc-fm-orb {
    transition: background-color 160ms ease, border-color 160ms ease;
}

.sc-fm-orb:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.28);
}

.sc-fm-orb.is-saved {
    background: rgba(113,66,9,.72);
    border-color: rgba(255,140,0,.55);
}

.sc-fm-orb.is-saved svg {
    fill: #ff8c00;
    stroke: #ff8c00;
}

/* ------------------------------------------------------
OVERFLOW MENU — popover in both layouts. Deliberate
exception to the mobile-sheet rule: this opens inside a
sheet, and stacking two means two dismiss gestures.
------------------------------------------------------ */
.sc-fm-menu {
    position: absolute;
    right: 14px;
    z-index: 6;
    min-width: 200px;
    padding: 5px;
    background: #242424;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    box-shadow: 0 14px 36px rgba(0,0,0,.55);
}

.sc-fm-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 11px;
    font-size: 1.3rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    color: #e8e8ea;
    background: transparent;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
}

.sc-fm-menu button:hover {
    background: rgba(255,255,255,.07);
}

.sc-fm-menu button svg {
    flex-shrink: 0;
    color: #8d8d93;
}

.sc-fm-menu button.is-danger {
    color: #ff6b6b;
}

.sc-fm-menu button.is-danger svg {
    color: #ff6b6b;
}

.sc-fm-menu hr {
    margin: 4px 6px;
    border: 0;
    border-top: 1px solid rgba(255,255,255,.09);
}

/* ------------------------------------------------------
SOCIAL PROOF (inside gallery overlay)
------------------------------------------------------ */
.sc-fm-faces > img,
.sc-fm-faces > span {
    width: 26px;
    height: 26px;
    display: block;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.55);
    margin-left: -8px;
    object-fit: cover;
}

.sc-fm-faces > img:first-child,
.sc-fm-faces > span:first-child {
    margin-left: 0;
}

@media (min-width: 576px) {
    .sc-fm-faces > img,
    .sc-fm-faces > span {
        width: 30px;
        height: 30px;
    }
}

.sc-fm-faces .sc-fm-faces__more {
    background: #2a2a2c;
    border: 0 !important;
    color: #fff;
    font-size: .9rem;
    font-weight: 700;
    line-height: 1;
}

/* ------------------------------------------------------
MODAL BODY
------------------------------------------------------ */
.sc-fm-modal .sc-fm-body {
    padding: 20px 0 calc(2.2rem + env(safe-area-inset-bottom, 0px));
}

/* sc-fm-caption — utilities on element */

.sc-fm-meta {
    flex-direction: column;
}

@media (min-width: 575px) {
    .sc-fm-meta {
        flex-direction: row;
    }
    .sc-fm-row {
        flex: 1 1 0;
        min-width: 0;
    }
}

/* sc-fm-row__ic — utilities on element */

/* sc-fm-row__k — utilities on element */

.sc-fm-row__v--link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #ca6767;
}

.sc-fm-row__ext {
    flex-shrink: 0;
}

.sc-fm-row__v--link:hover {
    color: #db8f8f;
    text-decoration: underline;
}

.sc-fm-out {
    margin-top: 15px;
    padding: 13px 14px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.09);
    text-decoration: none;
}

.sc-fm-out:hover {
    background: rgba(255,255,255,.07);
}

.sc-fm-out__ar {
    color: #ff3b3b;
    font-size: 1.5rem;
}

/* Mobile — sheet dismiss only; close sits above dialog on desktop */
@media (max-width: 991.98px) {
    .sc-fm-modal .sc-fm-close-btn {
        display: none;
    }
}

.sc-fm-modal .sc-fm-dialog__inner {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Desktop modal layout — must come after mobile width/padding rules above */
@media (min-width: 992px) {
    .sc-fm-modal .sc-fm-gal,
    .sc-fm-modal .sc-fm-body {
        width: calc(100% - 32px);
        max-width: calc(100% - 32px);
        margin-inline: auto;
        box-sizing: border-box;
    }

    .sc-fm-modal .sc-fm-gal {
        margin-top: 16px;
        max-height: min(300px, 46vh);
    }

    .sc-fm-modal .sc-fm-body {
        padding: 18px 0 28px;
    }

    .sc-fm-modal .sc-fm-close-btn {
        display: inline-flex;
    }
}
