/**
 * STW Split Showcase – Front-end Stylesheet
 * All values driven by CSS custom properties scoped per instance.
 * Prefix: .stw-ss-
 */

/* ═══ RESET — scoped to plugin structural elements ONLY ═══ */
.stw-ss-container,
.stw-ss-container [class^="stw-ss-"],
.stw-ss-container [class^="stw-ss-"]::before,
.stw-ss-container [class^="stw-ss-"]::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ═══ CONTAINER ═══ */
.stw-ss-container {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    max-width: var(--stw-ss-c-mw, 1200px);
    margin-left: auto;
    margin-right: auto;
    margin-bottom: var(--stw-ss-c-mb, 20px);
    background: var(--stw-ss-c-bg, #fff);
    border: var(--stw-ss-c-bw, 1px) var(--stw-ss-c-bs, solid) var(--stw-ss-c-bc, #e2e8f0);
    border-radius: var(--stw-ss-c-br, 12px);
    box-shadow: var(--stw-ss-c-shadow, 0 4px 24px rgba(0,0,0,0.08));
    overflow: var(--stw-ss-c-of, hidden);
    gap: var(--stw-ss-c-gap, 0px);
    padding: var(--stw-ss-c-pad, 0px);
    position: relative;
}

.stw-ss-container.stw-ss-layout--center {
    flex-direction: column;
}
.stw-ss-container.stw-ss-layout--center .stw-ss-panel {
    width: 100%;
    flex: none;
}

/* ═══ PANELS – 50/50 ═══ */
.stw-ss-panel {
    flex: 1 1 50%;
    min-width: 0;
    position: relative;
}

/* ═══ TEXT PANEL ═══ */
.stw-ss-panel--text {
    background: var(--stw-ss-t-bg, #fff);
    color: var(--stw-ss-t-color, #1e293b);
    font-family: var(--stw-ss-t-ff, inherit);
    font-size: var(--stw-ss-t-fs, 16px);
    line-height: var(--stw-ss-t-lh, 1.7);
    letter-spacing: var(--stw-ss-t-ls, 0px);
    padding: var(--stw-ss-t-pad, 32px);
    text-align: var(--stw-ss-t-align, left);
    display: flex;
    flex-direction: column;
    position: relative;
}

.stw-ss-heading {
    display: block;
    width: 100%;
    color: var(--stw-ss-h-color, #0f172a);
    font-family: var(--stw-ss-h-ff, inherit);
    font-size: var(--stw-ss-h-fs, 28px);
    font-weight: var(--stw-ss-h-fw, 700);
    margin-bottom: var(--stw-ss-h-mb, 16px);
    letter-spacing: var(--stw-ss-h-ls, -0.5px);
    text-transform: var(--stw-ss-h-tt, none);
    line-height: 1.25;
}

/* ═══ TEXT BODY — full typography restoration ═══
 * wp_editor content can contain any HTML element.
 * We restore natural formatting for everything so
 * paragraphs, headings, lists, quotes, tables, code
 * blocks etc. all display as the author intended.
 * ════════════════════════════════════════════════ */
.stw-ss-text-body {
    /* Ensure all children use border-box but
       inherit normal margin/padding behavior */
    line-height: inherit;
    color: inherit;
}
.stw-ss-text-body * {
    box-sizing: border-box;
}

/* Paragraphs */
.stw-ss-text-body p {
    margin: 0 0 1em 0;
    padding: 0;
}
.stw-ss-text-body p:last-child {
    margin-bottom: 0;
}

/* Headings */
.stw-ss-text-body h1,
.stw-ss-text-body h2,
.stw-ss-text-body h3,
.stw-ss-text-body h4,
.stw-ss-text-body h5,
.stw-ss-text-body h6 {
    margin: 1.25em 0 0.5em 0;
    padding: 0;
    line-height: 1.3;
    font-weight: 700;
    color: var(--stw-ss-h-color, #0f172a);
}
.stw-ss-text-body h1:first-child,
.stw-ss-text-body h2:first-child,
.stw-ss-text-body h3:first-child,
.stw-ss-text-body h4:first-child,
.stw-ss-text-body h5:first-child,
.stw-ss-text-body h6:first-child {
    margin-top: 0;
}
.stw-ss-text-body h1 { font-size: 1.75em; }
.stw-ss-text-body h2 { font-size: 1.5em; }
.stw-ss-text-body h3 { font-size: 1.25em; }
.stw-ss-text-body h4 { font-size: 1.1em; }
.stw-ss-text-body h5 { font-size: 1em; }
.stw-ss-text-body h6 { font-size: 0.9em; }

/* Links */
.stw-ss-text-body a {
    color: var(--stw-ss-link, #2563eb);
    text-decoration: var(--stw-ss-link-deco, underline);
    transition: color 0.2s;
}
.stw-ss-text-body a:hover {
    color: var(--stw-ss-link-hover, #1d4ed8);
}

/* Unordered & ordered lists */
.stw-ss-text-body ul,
.stw-ss-text-body ol {
    margin: 0 0 1em 0;
    padding: 0 0 0 1.75em;
}
.stw-ss-text-body li {
    margin: 0 0 0.35em 0;
    padding: 0;
    line-height: inherit;
}
.stw-ss-text-body ul ul,
.stw-ss-text-body ol ol,
.stw-ss-text-body ul ol,
.stw-ss-text-body ol ul {
    margin-top: 0.35em;
    margin-bottom: 0;
}
.stw-ss-text-body ul { list-style-type: disc; }
.stw-ss-text-body ol { list-style-type: decimal; }
.stw-ss-text-body ul ul { list-style-type: circle; }
.stw-ss-text-body ol ol { list-style-type: lower-alpha; }

/* Blockquote */
.stw-ss-text-body blockquote {
    margin: 1em 0;
    padding: 0.75em 1.25em;
    border-left: 4px solid #cbd5e1;
    background: #f8fafc;
    font-style: italic;
    color: #475569;
}
.stw-ss-text-body blockquote p:last-child {
    margin-bottom: 0;
}

/* Preformatted / code */
.stw-ss-text-body pre {
    margin: 1em 0;
    padding: 1em;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.stw-ss-text-body code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    background: #f1f5f9;
    padding: 0.15em 0.4em;
    border-radius: 3px;
}
.stw-ss-text-body pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: inherit;
}

/* Horizontal rule */
.stw-ss-text-body hr {
    margin: 1.5em 0;
    border: none;
    border-top: 1px solid #e2e8f0;
    padding: 0;
}

/* Table */
.stw-ss-text-body table {
    margin: 1em 0;
    border-collapse: collapse;
    width: 100%;
}
.stw-ss-text-body th,
.stw-ss-text-body td {
    padding: 0.5em 0.75em;
    border: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
}
.stw-ss-text-body th {
    background: #f8fafc;
    font-weight: 600;
}

/* Images inside text body */
.stw-ss-text-body img {
    max-width: 100%;
    height: auto;
    margin: 0.5em 0;
    border-radius: 4px;
}

/* WordPress alignment classes */
.stw-ss-text-body .alignleft {
    float: left;
    margin: 0.25em 1em 0.5em 0;
}
.stw-ss-text-body .alignright {
    float: right;
    margin: 0.25em 0 0.5em 1em;
}
.stw-ss-text-body .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* WordPress captions */
.stw-ss-text-body .wp-caption {
    max-width: 100%;
    margin: 0.5em 0;
    padding: 0;
}
.stw-ss-text-body .wp-caption-text {
    font-size: 0.85em;
    color: #64748b;
    margin-top: 0.35em;
}

/* Strong, em, small, mark */
.stw-ss-text-body strong,
.stw-ss-text-body b { font-weight: 700; }
.stw-ss-text-body em,
.stw-ss-text-body i { font-style: italic; }
.stw-ss-text-body small { font-size: 0.85em; }
.stw-ss-text-body mark {
    background: #fef08a;
    padding: 0.1em 0.3em;
    border-radius: 2px;
}
.stw-ss-text-body sup { vertical-align: super; font-size: 0.75em; }
.stw-ss-text-body sub { vertical-align: sub; font-size: 0.75em; }

/* Definition list */
.stw-ss-text-body dl {
    margin: 1em 0;
    padding: 0;
}
.stw-ss-text-body dt {
    font-weight: 700;
    margin: 0.5em 0 0.15em 0;
}
.stw-ss-text-body dd {
    margin: 0 0 0.5em 1.5em;
    padding: 0;
}

/* Clear floats after text body */
.stw-ss-text-body::after {
    content: '';
    display: table;
    clear: both;
}

/* ═══ ACCORDION COLLAPSE WRAPPER ═══ */
.stw-ss-text-collapse {
    position: relative;
}

/* ═══ ACCORDION GRADIENT FADE ═══ */
.stw-ss-accordion-fade {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -1px; /* overlap seam */
    pointer-events: none;
}

/* The gradient itself — sits above the text bottom */
.stw-ss-accordion-fade::before {
    content: '';
    display: block;
    width: 100%;
    height: var(--stw-ss-grad-h, 120px);
    margin-top: calc( var(--stw-ss-grad-h, 120px) * -1 );
    position: relative;
    z-index: 2;
    background: linear-gradient(
        to bottom,
        var(--stw-ss-grad-start, rgba(255,255,255,0)),
        var(--stw-ss-grad-end, rgba(255,255,255,1))
    );
    pointer-events: none;
    transition: opacity 0.4s ease;
    border: none;
}

/* Arrow row — no border, just the centered button */
.stw-ss-accordion-arrow {
    position: relative;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--stw-ss-arr-sz, 36px);
    height: var(--stw-ss-arr-sz, 36px);
    background: var(--stw-ss-arr-bg, rgba(255,255,255,0.85));
    color: var(--stw-ss-arr-color, #64748b);
    border: none;
    border-radius: var(--stw-ss-arr-br, 50px);
    box-shadow: var(--stw-ss-arr-shadow, 0 2px 12px rgba(0,0,0,0.12));
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s ease;
    padding: 0;
    margin-top: calc( var(--stw-ss-arr-bottom, 16px) * -1 );
    line-height: 1;
}

.stw-ss-accordion-arrow svg {
    width: 60%;
    height: 60%;
    display: block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.stw-ss-accordion-arrow:hover {
    background: var(--stw-ss-arr-hbg, rgba(255,255,255,1));
    color: var(--stw-ss-arr-hcolor, #2563eb);
    transform: translateY(2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.16);
}

/* Flipped state (expanded) — arrow points up */
.stw-ss-accordion-arrow--flipped svg {
    transform: rotate(180deg);
}

/* When expanded, fade out the gradient */
.stw-ss-accordion-fade--hidden::before {
    opacity: 0;
}

/* ═══ SHORTCODE OUTPUT ═══ */
.stw-ss-shortcode-output {
    margin-top: var(--stw-ss-sc-mt, 24px);
    padding: var(--stw-ss-sc-pad, 16px);
    background: var(--stw-ss-sc-bg, #f8fafc);
    border-radius: var(--stw-ss-sc-br, 8px);
    border: 1px solid var(--stw-ss-sc-bc, #e2e8f0);
}

/* ═══ CONTENT ROWS ═══ */
.stw-ss-content-rows {
    margin-top: 20px;
}

.stw-ss-content-row {
    margin-bottom: var(--stw-ss-row-spacing, 8px);
    transition: all var(--stw-ss-row-transition, 0.2s ease);
}

.stw-ss-content-row--hidden {
    display: none;
}

.stw-ss-row-link {
    display: flex;
    align-items: center;
    gap: var(--stw-ss-row-gap, 12px);
    padding: var(--stw-ss-row-pad, 12px);
    background: var(--stw-ss-row-bg, #ffffff);
    border: var(--stw-ss-row-bw, 1px) solid var(--stw-ss-row-border, #e2e8f0);
    border-radius: var(--stw-ss-row-br, 8px);
    box-shadow: var(--stw-ss-row-shadow, 0 1px 3px rgba(0,0,0,0.04));
    text-decoration: none;
    color: inherit;
    transition: all var(--stw-ss-row-transition, 0.2s ease);
}

a.stw-ss-row-link:hover {
    background: var(--stw-ss-row-hover-bg, #f8fafc);
    text-decoration: none;
    color: inherit;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

a.stw-ss-row-link:hover .stw-ss-row-title {
    color: var(--stw-ss-row-link-color, #2563eb);
}

.stw-ss-row-thumb {
    flex-shrink: 0;
    height: 55px;
    width: auto;
    border-radius: var(--stw-ss-row-thumb-br, 6px);
    object-fit: cover;
    display: block;
}

.stw-ss-row-text {
    flex: 1;
    min-width: 0;
}

.stw-ss-row-title {
    font-size: var(--stw-ss-row-title-fs, 16px);
    font-weight: var(--stw-ss-row-title-fw, 700);
    color: var(--stw-ss-row-title-color, #0f172a);
    margin: 0 0 2px 0;
    padding: 0;
    line-height: 1.3;
    transition: color var(--stw-ss-row-transition, 0.2s ease);
}

.stw-ss-row-desc {
    font-size: var(--stw-ss-row-desc-fs, 14px);
    color: var(--stw-ss-row-desc-color, #64748b);
    margin: 0;
    padding: 0;
    line-height: 1.45;
}

/* ═══ MINI-GALLERY (floats inside text body) ═══ */
.stw-ss-mini-gallery {
    display: block;
    float: var(--stw-ss-mg-float, none);
    margin: var(--stw-ss-mg-margin, 20px auto);
    width: var(--stw-ss-mg-width, 100%);
    max-width: 100%;
}

.stw-ss-mini-gallery-track {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #f1f5f9;
    width: 100%;
    height: var(--stw-ss-mg-height, 220px);
}

.stw-ss-mini-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stw-ss-mini-slide.stw-ss-mini-slide--active {
    opacity: 1;
    position: relative;
}

.stw-ss-mini-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

.stw-ss-mini-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.85);
    color: #334155;
    border: none;
    border-radius: 50%;
    box-shadow: 0 1px 6px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    opacity: 0;
}
.stw-ss-mini-gallery-track:hover .stw-ss-mini-nav {
    opacity: 1;
}
.stw-ss-mini-nav:hover {
    background: #fff;
    color: #0f172a;
    transform: translateY(-50%) scale(1.15);
}
.stw-ss-mini-nav--prev { left: 6px; }
.stw-ss-mini-nav--next { right: 6px; }
.stw-ss-mini-nav svg { display: block; }

/* ═══ GALLERY PANEL ═══ */
.stw-ss-panel--gallery {
    background: var(--stw-ss-g-bg, #f8fafc);
    padding: var(--stw-ss-g-pad, 0px);
    border-radius: var(--stw-ss-g-br, 0px);
    position: relative;
    overflow: hidden;
    min-height: var(--stw-ss-g-minh, 400px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stw-ss-gallery-track {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: inherit;
}

.stw-ss-gallery-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.stw-ss-gallery-slide.stw-ss-slide--active {
    opacity: 1;
    pointer-events: auto;
    position: relative;
}

/* Slide transition */
.stw-ss-container[data-stw-ss-transition="slide"] .stw-ss-gallery-slide { transform: translateX(60px); opacity: 0; }
.stw-ss-container[data-stw-ss-transition="slide"] .stw-ss-gallery-slide.stw-ss-slide--active { transform: translateX(0); opacity: 1; }
.stw-ss-container[data-stw-ss-transition="slide"] .stw-ss-gallery-slide.stw-ss-slide--exiting { transform: translateX(-60px); opacity: 0; }

/* Zoom transition */
.stw-ss-container[data-stw-ss-transition="zoom"] .stw-ss-gallery-slide { transform: scale(1.08); opacity: 0; }
.stw-ss-container[data-stw-ss-transition="zoom"] .stw-ss-gallery-slide.stw-ss-slide--active { transform: scale(1); opacity: 1; }

.stw-ss-gallery-img {
    width: 100%;
    height: 100%;
    object-fit: var(--stw-ss-g-fit, cover);
    border-radius: var(--stw-ss-g-ibr, 0px);
    display: block;
}

.stw-ss-gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: #fff;
    font-size: 14px;
    text-align: center;
}

.stw-ss-gallery--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-style: italic;
}

/* ═══ NAV ARROWS ═══ */
.stw-ss-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: var(--stw-ss-nav-sz, 44px);
    height: var(--stw-ss-nav-sz, 44px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--stw-ss-nav-bg, rgba(255,255,255,0.9));
    color: var(--stw-ss-nav-ic, #334155);
    border: none;
    border-radius: var(--stw-ss-nav-br, 50px);
    box-shadow: var(--stw-ss-nav-shadow, 0 2px 8px rgba(0,0,0,0.15));
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 0;
    line-height: 1;
    opacity: 0;
}
.stw-ss-panel--gallery:hover .stw-ss-nav { opacity: 1; }
.stw-ss-nav:hover {
    background: var(--stw-ss-nav-hbg, #fff);
    color: var(--stw-ss-nav-hic, #0f172a);
    transform: translateY(-50%) scale(1.1);
}
.stw-ss-nav svg { display: block; }
.stw-ss-nav--prev { left: 12px; }
.stw-ss-nav--next { right: 12px; }

/* ═══ DOTS ═══ */
.stw-ss-gallery-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--stw-ss-dot-gap, 8px);
    z-index: 10;
}
.stw-ss-dot {
    width: var(--stw-ss-dot-sz, 10px);
    height: var(--stw-ss-dot-sz, 10px);
    border-radius: 50%;
    background: var(--stw-ss-dot-c, rgba(255,255,255,0.5));
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}
.stw-ss-dot.stw-ss-dot--active {
    background: var(--stw-ss-dot-ac, #fff);
    transform: scale(1.3);
}
.stw-ss-dot:hover { background: var(--stw-ss-dot-ac, #fff); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .stw-ss-container { flex-direction: column !important; }
    .stw-ss-panel { flex: none !important; width: 100% !important; }
    .stw-ss-nav { opacity: 0.85; }

    /* Mini-gallery: full width on mobile, no float */
    .stw-ss-mini-gallery {
        float: none !important;
        width: 100% !important;
        margin: 0 0 20px 0 !important;
    }
}

/* ═══ ACCESSIBILITY ═══ */
@media (prefers-reduced-motion: reduce) {
    .stw-ss-gallery-slide { transition: opacity 0.15s ease !important; }
    .stw-ss-nav, .stw-ss-dot, .stw-ss-accordion-arrow, .stw-ss-accordion-arrow svg { transition: none !important; }
    .stw-ss-text-collapse { transition: none !important; }
}

.stw-ss-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
