/* ============================================================
   Linkyne Global Options v5.1.3
   ============================================================ */

/* ─── 1. GALLERY WRAPPER — flex row: thumbs left + main right ─ */
#linkyne-standalone-gallery {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: flex-start;
    width: 100%;
    background: #fff;
    border-radius: 4px;
}

/* Thumbnail strip (hidden until JS adds images) — 5.1.3
   As tall as the main image: ↑ button, scrolling list, ↓ button. */
.linkyne-thumb-strip {
    display: none;              /* hidden when empty */
    flex-direction: column;
    gap: 8px;
    width: 92px;
    flex-shrink: 0;
    align-self: stretch;        /* same height as the main image */
    min-height: 0;
}

#linkyne-standalone-gallery.has-thumbs .linkyne-thumb-strip {
    display: flex;
}

/* The list is positioned inside the viewport, so a long list can't make the strip taller than the image */
.linkyne-thumb-viewport {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}
.linkyne-thumb-list {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;      /* no scrollbar — arrows + wheel/touch scroll */
    -ms-overflow-style: none;
    overscroll-behavior: contain;
}
.linkyne-thumb-list::-webkit-scrollbar { display: none; }

.linkyne-thumb-item {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    flex-shrink: 0;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid #e6e6e6;
    background: #fff;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.linkyne-thumb-item:hover {
    border-color: #b5b5b5;
}

.linkyne-thumb-item.active {
    border-color: #111;
    box-shadow: inset 0 0 0 1px #111;
}

.linkyne-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
    user-select: none;
}

/* ↑ / ↓ buttons — only shown when the thumbnails don't all fit */
.linkyne-thumb-nav {
    display: none;
    flex: 0 0 auto;
    width: 100%;
    height: 30px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #f1f1f1;
    color: #111;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.15s ease, opacity 0.15s ease;
}
.linkyne-thumb-strip.is-scrollable .linkyne-thumb-nav { display: flex; }
.linkyne-thumb-nav:hover:not(:disabled) { background: #e2e2e2; }
.linkyne-thumb-nav:disabled { opacity: 0.35; cursor: default; }
.linkyne-thumb-nav svg { display: block; pointer-events: none; }

/* Main square gallery (right side) */
.linkyne-gallery-main {
    position: relative;
    flex: 1;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #fff;
    border-radius: 4px;
    min-width: 0;               /* prevents flex overflow */
}

#linkyne-gallery-inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

/* ─── 2. DEFAULT ART (before any option is selected) ──────── */
.linkyne-sandwich-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.linkyne-base-art {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ─── 3. SINGLE IMAGE VIEW (template composites) ──────────── */
.linkyne-single-image-view {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.linkyne-single-image-view img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ─── 4. SLIDER ────────────────────────────────────────────── */
.linkyne-slider-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
    background: #fff;
}

.linkyne-slider-container:active { cursor: grabbing; }

.linkyne-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.linkyne-slide.active-slide {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

.linkyne-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    -webkit-user-drag: none;
    user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

/* ─── 5. SLIDER ARROWS ─────────────────────────────────────── */
.linkyne-slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.85);
    color: #000;
    border: 1px solid #ddd;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0 !important;
}

.linkyne-slider-btn:hover { background: #000; color: #fff; border-color: #000; }
.linkyne-slider-btn.prev-btn { left: 10px; }
.linkyne-slider-btn.next-btn { right: 10px; }

/* ─── 6. SLIDER DOTS ───────────────────────────────────────── */
.linkyne-slider-dots {
    position: absolute;
    bottom: 12px;
    width: 100%;
    text-align: center;
    z-index: 10;
}

.linkyne-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 50%;
    margin: 0 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.linkyne-dot.active-dot { background: #000; }

/* ─── 7. ZOOM ICON (top-right) ─────────────────────────────── */
.linkyne-zoom-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 60;
    color: #333;
    transition: all 0.2s ease;
}

.linkyne-zoom-icon:hover {
    background: #333;
    color: #fff;
    transform: scale(1.05);
}

/* ─── 8. GALLERY LOADER (glassmorphism overlay) ────────────── */
.linkyne-gallery-loader {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease-in-out;
}

.linkyne-gallery-loader.active {
    opacity: 1;
    visibility: visible;
}

/* ─── 9. OPTIONS LOADER (over the options section) ─────────── */
.linkyne-options-loader {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out;
    border-radius: 4px;
}

.linkyne-options-loader.active {
    opacity: 1;
    visibility: visible;
}

/* ─── 9b. INITIAL LOAD — full-height opaque preloader ──────── */
/* Applied on page open; removed by JS after auto-select runs   */
.linkyne-global-options-wrapper.initial-loading {
    min-height: 500px;
}

.linkyne-global-options-wrapper.initial-loading .linkyne-options-loader {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background: #fff;               /* fully opaque — hides raw options flash */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Hide option content visually during preload (loader sits on top anyway) */
.linkyne-global-options-wrapper.initial-loading .linkyne-option-group,
.linkyne-global-options-wrapper.initial-loading .linkyne-action-row {
    visibility: hidden;
}

/* Shared spinner */
.linkyne-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: linkyne-spin 0.75s linear infinite;
}

@keyframes linkyne-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ─── 10. OPTION GROUPS & HEADINGS ─────────────────────────── */
.linkyne-global-options-wrapper {
    position: relative;  /* needed for options-loader absolute positioning */
}

.linkyne-option-group {
    margin-bottom: 25px;
}

.linkyne-option-group h4 {
    font-family: lato, sans-serif !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    text-transform: capitalize !important;
    margin-bottom: 10px;
}

.linkyne-dynamic-title-append {
    font-weight: 400;
    color: #666;
    margin-left: 4px;
    font-size: 16px;
    text-transform: none;
}

.linkyne-global-options-wrapper,
.linkyne-option-group,
.linkyne-swatches-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* ─── 11. IMAGE SWATCHES ────────────────────────────────────── */
.linkyne-swatches-wrapper.type-image {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(calc((100% - 60px) / 6), 1fr));
    gap: 12px;
}

.linkyne-swatch.swatch-image {
    cursor: pointer;
    text-align: center;
    border: 2px solid transparent;
    padding: 4px;
    transition: all 0.2s ease;
}

.linkyne-swatch.swatch-image img {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 10px;
    padding: 5px;
}

.linkyne-swatch.swatch-image .swatch-label {
    display: block;
    font-size: 16px;
    line-height: 1.3;
    color: #000;
    font-family: lato, sans-serif;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}

.linkyne-swatch.swatch-image.selected {
    background-color: #eeeeee;
    border: 2px solid #000;
    font-weight: 500;
}

.linkyne-swatches-wrapper.type-image.hide-labels-mode {
    grid-template-columns: repeat(auto-fit, minmax(calc((100% - 48px) / 5), 1fr));
}

.linkyne-swatches-wrapper.hide-labels-mode .swatch-label { display: none !important; }
.linkyne-swatches-wrapper.hide-labels-mode .linkyne-swatch.swatch-image img { margin-bottom: 0; }

/* ─── 12. BUTTON SWATCHES ───────────────────────────────────── */
.linkyne-swatches-wrapper.type-button {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.linkyne-swatch.swatch-button {
    cursor: pointer;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    background: #fff;
    text-align: center;
    font-size: 16px;
    font-family: lato, sans-serif;
    font-weight: 400;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}

.linkyne-swatch.swatch-button:hover { background: #eeeeee; }

.linkyne-swatch.swatch-button.selected {
    background: #eeeeee;
    color: #000;
    border: 2px solid #000;
    font-weight: 500;
    padding: 9px 14px;
}

/* ─── 13. OUT OF STOCK STYLING ──────────────────────────────── */
.linkyne-swatch.out-of-stock {
    position: relative;
    opacity: 0.5;
    cursor: not-allowed !important;
}

.linkyne-swatch.out-of-stock:hover { background: transparent !important; }

.linkyne-swatch.out-of-stock::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom right,
        transparent calc(50% - 1px),
        #999 calc(50% - 1px),
        #999 calc(50% + 1px),
        transparent calc(50% + 1px)
    );
    pointer-events: none;
    z-index: 5;
}

/* ─── 14. ACTION ROW (PRICE + ADD TO CART) ──────────────────── */
.linkyne-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 15px;
    gap: 20px;
}

.linkyne-live-price-wrapper {
    font-size: 30px;
    font-weight: 700;
    font-family: lato, sans-serif;
    color: #000;
    line-height: 1;
}

.linkyne-live-total .woocommerce-Price-amount {
    color: inherit;
    font-weight: inherit;
}

.linkyne-cart-btn {
    flex: 1;
    max-width: 250px;
    padding: 16px 20px;
    background: #333;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 400;
    border-radius: 2px;
    transition: background 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.linkyne-cart-btn:hover:not(:disabled) { background: #000; }

/* Summary line above the price (6.1.2): "24″ × 16″ 0.75 Inches (Canvas Print)" */
.linkyne-selection-summary {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    font-family: lato, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    color: #000;
}
.linkyne-selection-summary strong { font-weight: 700; }
.linkyne-selection-summary:empty { display: none; }
.linkyne-selection-summary + .linkyne-action-row { margin-top: 15px; padding-top: 0; }

/* ─── 15. MISC ──────────────────────────────────────────────── */
html { overflow-y: scroll !important; }

/* ─── 16. RESPONSIVE ────────────────────────────────────────── */
/* Tablet & mobile: thumbnails move UNDER the gallery as a horizontal strip */
@media (max-width: 1024px) {
    #linkyne-standalone-gallery {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .linkyne-gallery-main {
        order: 1;
        flex: none;
        width: 100%;
    }
    .linkyne-thumb-strip {
        order: 2;
        flex-direction: row;
        align-items: center;
        width: 100%;
        align-self: auto;
    }
    .linkyne-thumb-viewport {
        position: static;
        flex: 1 1 auto;
        min-width: 0;
    }
    .linkyne-thumb-list {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }
    .linkyne-thumb-item {
        width: 72px;
        height: 72px;
    }
    /* arrows become ‹ › at the sides */
    .linkyne-thumb-nav {
        width: 28px;
        height: 72px;
    }
    .linkyne-thumb-nav svg { transform: rotate(-90deg); }
}

@media (max-width: 768px) {
    .linkyne-swatches-wrapper.type-image {
        grid-template-columns: repeat(auto-fit, minmax(30%, 1fr)) !important;
        gap: 10px;
    }
    .linkyne-swatch.swatch-image .swatch-label,
    .linkyne-swatch.swatch-button {
        font-size: 14px;
    }
    .linkyne-slider-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .linkyne-action-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .linkyne-cart-btn {
        max-width: 100%;
        width: 100%;
    }
}

/* ─── 17. SPECS TABLE [linkyne_specs_table] ─────────────────── */
.linkyne-specs {
    margin: 20px 0;
    font-family: lato, sans-serif;
}
.linkyne-specs .linkyne-specs-title {
    font-family: lato, sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #000;
    margin: 0 0 12px;
}
.linkyne-specs table.linkyne-specs-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e0e0e0;
    margin: 0;
    font-size: 15px;
    background: #fff;
}
.linkyne-specs table.linkyne-specs-table th,
.linkyne-specs table.linkyne-specs-table td {
    padding: 12px 16px;
    border: 0;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
    vertical-align: top;
    line-height: 1.6;
}
.linkyne-specs table.linkyne-specs-table tr:last-child th,
.linkyne-specs table.linkyne-specs-table tr:last-child td {
    border-bottom: 0;
}
/* Wrap between whole words only — overrides themes that break table text mid-word */
.linkyne-specs table.linkyne-specs-table th,
.linkyne-specs table.linkyne-specs-table td,
.linkyne-specs table.linkyne-specs-table td span {
    word-break: normal !important;
    overflow-wrap: normal !important;
    word-wrap: normal !important;
    -webkit-hyphens: manual !important;
    hyphens: manual !important;
}
.linkyne-specs table.linkyne-specs-table th {
    width: 32%;
    background: #f7f7f7;
    color: #000;
    font-weight: 700;
}
.linkyne-specs table.linkyne-specs-table td {
    color: #444;
}
.linkyne-spec-parent {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: #888;
}
.linkyne-spec-price { font-size: 13px; color: #888; }
.linkyne-spec-oos   { color: #999; text-decoration: line-through; }
.linkyne-spec-oos-note { font-size: 13px; color: #999; }

@media (max-width: 600px) {
    .linkyne-specs table.linkyne-specs-table th,
    .linkyne-specs table.linkyne-specs-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    .linkyne-specs table.linkyne-specs-table th {
        border-bottom: 0;
        padding: 10px 12px 4px;
    }
    .linkyne-specs table.linkyne-specs-table td {
        padding: 0 12px 10px;
        background: #f7f7f7;
    }
    .linkyne-specs table.linkyne-specs-table tr:last-child th { border-bottom: 0; }
    .linkyne-specs table.linkyne-specs-table tr { display: block; border-bottom: 1px solid #e0e0e0; }
    .linkyne-specs table.linkyne-specs-table tr:last-child { border-bottom: 0; }
}
