/* ═══════════════════════════════════════════════════════════════════════════
   PSM Showcase — Frontend
   All visual values driven by CSS custom properties set per instance.
   Heavy use of !important to survive aggressive theme resets.
═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset scope ─────────────────────────────────────────────────────────── */
.psm-showcase,
.psm-showcase * {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
}

/* ── Section wrapper ─────────────────────────────────────────────────────── */
.psm-showcase {
    background: var(--psm-bg, #1a1a1a) !important;
    color: #fff;
    padding: var(--psm-section-py, 48px) var(--psm-section-px, 36px) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
    width: 100%;
    position: relative;
    display: block !important;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.psm-showcase .psm-header {
    display: flex !important;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px !important;
    gap: 16px;
}
.psm-showcase .psm-header-left { flex: 1; min-width: 0; }

.psm-showcase .psm-heading {
    display: block !important;
    font-size:   var(--psm-heading-size,   36px)  !important;
    font-weight: var(--psm-heading-weight, 700)   !important;
    font-family: var(--psm-heading-family, inherit) !important;
    color:       var(--psm-heading-color,  #fff)  !important;
    line-height: 1.15 !important;
    letter-spacing: -0.5px;
    margin: 0 0 6px !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
}
.psm-showcase .psm-subtitle {
    font-size:   var(--psm-subtitle-size,   14px) !important;
    font-weight: var(--psm-subtitle-weight, 500)  !important;
    color:       var(--psm-subtitle-color,  #e8b84b) !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ── Outer nav ───────────────────────────────────────────────────────────── */
.psm-showcase .psm-outer-nav {
    display: flex !important;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}
.psm-showcase .psm-outer-prev,
.psm-showcase .psm-outer-next {
    all: unset;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width:  var(--psm-outer-arrow-size, 44px) !important;
    height: var(--psm-outer-arrow-size, 44px) !important;
    border-radius: 50% !important;
    border: 2px solid var(--psm-outer-arrow-border, #e8b84b) !important;
    background: var(--psm-outer-arrow-bg, transparent) !important;
    color: var(--psm-outer-arrow-color, #e8b84b) !important;
    font-size: var(--psm-outer-arrow-icon, 20px) !important;
    line-height: 1 !important;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    flex-shrink: 0;
}
.psm-showcase .psm-outer-prev:hover,
.psm-showcase .psm-outer-next:hover {
    background: var(--psm-outer-arrow-border, #e8b84b) !important;
    color: #1a1a1a !important;
    transform: scale(1.07);
}
.psm-showcase .psm-outer-prev:disabled,
.psm-showcase .psm-outer-next:disabled {
    opacity: 0.3 !important;
    cursor: default;
    transform: none !important;
}

/* ── Outer carousel ──────────────────────────────────────────────────────── */
.psm-showcase .psm-outer-carousel {
    overflow: hidden !important;
    width: 100% !important;
    display: block !important;
}
.psm-showcase .psm-outer-track {
    display: flex !important;
    gap: var(--psm-card-gap, 18px) !important;
    align-items: stretch;
    will-change: transform;
}

/* ── Project card ────────────────────────────────────────────────────────── */
.psm-showcase .psm-project-card {
    flex: 0 0 calc(33.333% - 12px) !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--psm-card-bg, #2a2a2a) !important;
    border-radius: var(--psm-radius, 12px) !important;
    border: var(--psm-card-border-width, 1px) solid var(--psm-card-border-color, rgba(255,255,255,0.07)) !important;
    overflow: hidden !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: default;
}
.psm-showcase .psm-project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 48px rgba(0,0,0,0.5) !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   IMAGE SLIDER — the most layout-critical section
══════════════════════════════════════════════════════════════════════════ */

/* Outer shell — fixed height, clips everything */
.psm-showcase .psm-inner-slider {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height:     var(--psm-img-h, 240px) !important;
    min-height: var(--psm-img-h, 240px) !important;
    max-height: var(--psm-img-h, 240px) !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    background: #111;
}

/* Sliding track — flex row, height 100% of shell */
.psm-showcase .psm-inner-track {
    display: flex !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    height: 100% !important;
    will-change: transform;
}

/* Each slide — exactly 100% of track width and shell height */
.psm-showcase .psm-slide {
    flex: 0 0 100% !important;
    width: 100% !important;
    height: var(--psm-img-h, 240px) !important;
    min-height: var(--psm-img-h, 240px) !important;
    max-height: var(--psm-img-h, 240px) !important;
    overflow: hidden !important;
    display: block !important;
    position: relative !important;
}

/* THE IMAGE — explicit height from CSS var, object-fit cover */
.psm-showcase .psm-slide img {
    display: block !important;
    width: 100% !important;
    height: var(--psm-img-h, 240px) !important;
    min-height: var(--psm-img-h, 240px) !important;
    max-height: var(--psm-img-h, 240px) !important;
    object-fit: cover !important;
    object-position: center center !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* Empty slide */
.psm-showcase .psm-slide--empty {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #1e1e1e;
    color: #555;
    font-size: 13px;
}

/* ── Inner arrow buttons ─────────────────────────────────────────────────── */
.psm-showcase .psm-inner-prev,
.psm-showcase .psm-inner-next {
    all: unset;
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 30 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width:  var(--psm-inner-arrow-size, 34px) !important;
    height: var(--psm-inner-arrow-size, 34px) !important;
    border-radius: 50% !important;
    background: var(--psm-inner-arrow-bg, rgba(0,0,0,0.5)) !important;
    border: 1.5px solid var(--psm-inner-arrow-border, rgba(255,255,255,0.35)) !important;
    color: var(--psm-inner-arrow-color, #fff) !important;
    font-size: var(--psm-inner-arrow-icon, 16px) !important;
    line-height: 1 !important;
    cursor: pointer;
    opacity: var(--psm-inner-arrow-opacity, 0.75);
    transition: opacity 0.2s, background 0.2s;
}
.psm-showcase .psm-inner-prev { left: 12px !important; right: auto !important; }
.psm-showcase .psm-inner-next { right: 12px !important; left: auto !important; }
.psm-showcase .psm-inner-prev:hover,
.psm-showcase .psm-inner-next:hover {
    opacity: 1 !important;
    background: rgba(0,0,0,0.85) !important;
}

/* Hover-only mode — set via JS class on the slider */
.psm-showcase .psm-inner-slider.psm-arrows-hover .psm-inner-prev,
.psm-showcase .psm-inner-slider.psm-arrows-hover .psm-inner-next {
    opacity: 0 !important;
}
.psm-showcase .psm-inner-slider.psm-arrows-hover:hover .psm-inner-prev,
.psm-showcase .psm-inner-slider.psm-arrows-hover:hover .psm-inner-next {
    opacity: 1 !important;
}

/* ── Inner dots ──────────────────────────────────────────────────────────── */
.psm-showcase .psm-inner-dots {
    position: absolute !important;
    bottom: 14px !important;
    left: var(--psm-dot-left, 16px) !important;
    right: var(--psm-dot-right, auto) !important;
    transform: var(--psm-dot-translate, translateX(0%));
    display: flex !important;
    gap: 6px !important;
    z-index: 30 !important;
    align-items: center !important;
}
.psm-showcase .psm-dot {
    all: unset;
    display: block !important;
    width:  var(--psm-dot-size, 9px) !important;
    height: var(--psm-dot-size, 9px) !important;
    border-radius: 50% !important;
    background: var(--psm-dot-color, rgba(255,255,255,0.38)) !important;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0 !important;
}
.psm-showcase .psm-dot.active {
    background: var(--psm-dot-active, #e8b84b) !important;
    transform: scale(1.3) !important;
}

/* ── Card body ───────────────────────────────────────────────────────────── */
.psm-showcase .psm-card-body {
    padding: var(--psm-card-padding, 20px) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    flex: 1 !important;
}
.psm-showcase .psm-card-title {
    font-size:   var(--psm-title-size,   20px) !important;
    font-weight: var(--psm-title-weight, 700)  !important;
    font-family: var(--psm-title-family, inherit) !important;
    color:       var(--psm-title-color,  #fff) !important;
    line-height: 1.25 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
}
.psm-showcase .psm-card-desc {
    font-size:   var(--psm-desc-size,  14px) !important;
    color:       var(--psm-desc-color, rgba(255,255,255,0.68)) !important;
    line-height: var(--psm-desc-lh,   1.58) !important;
    font-weight: 400 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ── Meta / custom fields ────────────────────────────────────────────────── */
.psm-showcase .psm-meta {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
    margin-top: 12px !important;
    padding-top: 12px !important;
    border-top: 1px solid rgba(255,255,255,0.09) !important;
    list-style: none !important;
}
.psm-showcase .psm-meta-row {
    display: flex !important;
    gap: 8px !important;
    font-size: var(--psm-meta-size, 13px) !important;
    line-height: 1.4 !important;
}
.psm-showcase .psm-meta-row dt {
    color: var(--psm-meta-label-color, #e8b84b) !important;
    font-weight: 600 !important;
    flex-shrink: 0 !important;
    min-width: 80px !important;
    margin: 0 !important;
}
.psm-showcase .psm-meta-row dd {
    color: var(--psm-meta-value-color, rgba(255,255,255,0.78)) !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ── No projects ─────────────────────────────────────────────────────────── */
.psm-no-projects {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — card width driven by JS via CSS var + per-page logic
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .psm-showcase .psm-project-card { flex: 0 0 calc(50% - 9px) !important; }
}
@media (max-width: 580px) {
    .psm-showcase { padding: 28px 16px 36px !important; }
    .psm-showcase .psm-project-card { flex: 0 0 100% !important; }
    .psm-showcase .psm-outer-track  { gap: 0 !important; }
    .psm-showcase .psm-header       { flex-direction: column !important; }
    .psm-showcase .psm-outer-nav    { align-self: flex-end; }
}
