/**
 * Sports Directory — Style 1 (directory1 preset)
 *
 * Variables --primary, --primary-light, --primary-50, --primary-100,
 * --primary-ring, --shadow-color, --columns are injected per-instance
 * via inline <style> on #<instance-id>.
 */

/* ================================================================== */
/* Toolbar                                                            */
/* ================================================================== */
.sd-container.sd-preset-style-1 .sd-toolbar {
    padding: 0 0 4px;
    margin-bottom: 6px;
}

.sd-container.sd-preset-style-1 .sd-toolbar-top {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.sd-container.sd-preset-style-1 .sd-search-container {
    position: relative;
    width: 100%;
}

.sd-container.sd-preset-style-1 .sd-search-container .sd-iconify {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 19px;
    color: var(--text-muted);
    pointer-events: none;
}

.sd-container.sd-preset-style-1 .sd-search-input {
    width: 100%;
    padding: 12px 18px 12px 48px;
    border: 1.5px solid var(--border);
    border-radius: 100px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--card);
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.sd-container.sd-preset-style-1 .sd-search-input::placeholder { color: var(--text-muted); }

.sd-container.sd-preset-style-1 .sd-search-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

/* ------------------------------------------------------------------ */
/* Filter tabs                                                        */
/* ------------------------------------------------------------------ */
.sd-container.sd-preset-style-1 .sd-filter-section {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.sd-container.sd-preset-style-1 .sd-filter-btn {
    padding: 8px 18px;
    border-radius: 100px;
    border: 1.5px solid var(--border);
    background: var(--card);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s ease;
}

.sd-container.sd-preset-style-1 .sd-filter-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: var(--primary-50);
}

.sd-container.sd-preset-style-1 .sd-filter-btn.is-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.sd-container.sd-preset-style-1 .sd-filter-btn:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Toolbar bottom (results info + per-page)                           */
/* ------------------------------------------------------------------ */
.sd-container.sd-preset-style-1 .sd-toolbar-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 0 4px;
}

.sd-container.sd-preset-style-1 .sd-results-info {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}
.sd-container.sd-preset-style-1 .sd-results-info strong {
    color: var(--text-primary);
    font-weight: 700;
}

.sd-container.sd-preset-style-1 .sd-per-page-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}
.sd-container.sd-preset-style-1 .sd-per-page-control label { white-space: nowrap; }

.sd-container.sd-preset-style-1 .sd-per-page-select {
    padding: 7px 32px 7px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--card);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2394A3B8' d='m12 15.4l-6-6L7.4 8l4.6 4.6L16.6 8L18 9.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.25s ease;
}
.sd-container.sd-preset-style-1 .sd-per-page-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

/* ================================================================== */
/* Grid + Card                                                        */
/* ================================================================== */
.sd-container.sd-preset-style-1 .sd-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 3), 1fr);
    gap: var(--gap);
    padding: 20px 0;
}

.sd-container.sd-preset-style-1 .sd-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.35s ease;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.sd-container.sd-preset-style-1 .sd-card:hover,
.sd-container.sd-preset-style-1 .sd-card:focus-visible {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
    outline: none;
}

.sd-container.sd-preset-style-1 .sd-card-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
}

.sd-container.sd-preset-style-1 .sd-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.sd-container.sd-preset-style-1 .sd-card:hover .sd-card-image img,
.sd-container.sd-preset-style-1 .sd-card:focus-visible .sd-card-image img {
    transform: scale(1.08);
}

.sd-container.sd-preset-style-1 .sd-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, transparent 60%);
}

/* Container for one or more category tags — flex so they wrap nicely. */
.sd-container.sd-preset-style-1 .sd-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.sd-container.sd-preset-style-1 .sd-card-tag {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    border: 0;
    color: inherit;
}
.sd-container.sd-preset-style-1 .sd-card-tag:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.sd-container.sd-preset-style-1 .sd-card-body {
    padding: 20px;
    flex: 1;
}
.sd-container.sd-preset-style-1 .sd-card-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    line-height: 1.3;
}
.sd-container.sd-preset-style-1 .sd-card-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sd-container.sd-preset-style-1 .sd-card-footer {
    padding: 0 20px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}
.sd-container.sd-preset-style-1 .sd-card-players {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.sd-container.sd-preset-style-1 .sd-card-players .sd-iconify {
    font-size: 15px;
    color: var(--primary-light);
}

.sd-container.sd-preset-style-1 .sd-card-arrow {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-50);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 0;
    cursor: pointer;
}
.sd-container.sd-preset-style-1 .sd-card-arrow .sd-iconify {
    font-size: 16px;
    color: var(--primary);
    transition: transform 0.3s ease;
}
.sd-container.sd-preset-style-1 .sd-card:hover .sd-card-arrow,
.sd-container.sd-preset-style-1 .sd-card:focus-visible .sd-card-arrow {
    background: var(--primary);
}
.sd-container.sd-preset-style-1 .sd-card:hover .sd-card-arrow .sd-iconify,
.sd-container.sd-preset-style-1 .sd-card:focus-visible .sd-card-arrow .sd-iconify {
    color: #fff;
    transform: translateX(2px);
}

/* ================================================================== */
/* Pagination                                                         */
/* ================================================================== */
.sd-container.sd-preset-style-1 .sd-pagination-wrapper {
    padding: 12px 0 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sd-container.sd-preset-style-1 .sd-pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.sd-container.sd-preset-style-1 .sd-page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 6px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--card);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}
.sd-container.sd-preset-style-1 .sd-page-btn:hover:not(:disabled):not(.is-active) {
    border-color: var(--primary-light);
    color: var(--primary);
    background: var(--primary-50);
}
.sd-container.sd-preset-style-1 .sd-page-btn.is-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--shadow-color);
}
.sd-container.sd-preset-style-1 .sd-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.sd-container.sd-preset-style-1 .sd-page-btn .sd-iconify { font-size: 18px; }

.sd-container.sd-preset-style-1 .sd-page-ellipsis {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 2px;
}

/* ================================================================== */
/* Detail panel                                                       */
/* ================================================================== */
/* Z-indexes are intentionally high (above theme sticky headers, mega
 * menus, etc. which typically use 999-99999). All sit just below the
 * WP admin bar (which is z-index 99999). If the user is logged in, the
 * admin bar will still show above our overlay — which is fine because
 * the detail panel can scroll independently. Override per-site if needed.
 *
 * NOTE: The overlay/panel/lightbox are moved to <body> at runtime by
 * frontend.js (see moveToBody) to escape any ancestor stacking context
 * (theme sticky headers with `transform`, page builder wrappers, etc.).
 * We match both selectors — in-container OR direct child of body — so the
 * styling works regardless of where the elements live. */
.sd-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}
.sd-detail-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.sd-detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 900px;
    height: 100vh;
    background: var(--card);
    z-index: 100001;
    transform: translateX(100%);
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}
.sd-detail-panel.is-active {
    transform: translateX(0);
}
.sd-detail-panel::-webkit-scrollbar { width: 5px; }
.sd-detail-panel::-webkit-scrollbar-track { background: transparent; }
.sd-detail-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.sd-detail-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.25s ease;
}
.sd-detail-close:hover {
    background: var(--primary);
    border-color: var(--primary);
}
.sd-detail-close:hover .sd-iconify { color: #fff; }
.sd-detail-close .sd-iconify {
    font-size: 20px;
    color: var(--text-secondary);
    transition: color 0.25s ease;
}

.sd-detail-hero {
    width: 100%;
    height: 320px;
    position: relative;
    overflow: hidden;
}
.sd-detail-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sd-detail-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--card) 0%, transparent 50%);
}

.sd-detail-content {
    padding: 0 36px 60px;
    position: relative;
    margin-top: -40px;
}

/* Container for one or more category tags in the detail panel. */
.sd-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.sd-detail-tag {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sd-detail-title {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0 0 8px;
    word-break: break-word;
    line-height: 1.2;
}

.sd-detail-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.sd-detail-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}
.sd-detail-meta-item .sd-iconify {
    font-size: 18px;
    color: var(--primary-light);
}

.sd-detail-description-wrap { margin-bottom: 36px; }
.sd-detail-description {
    font-size: 16px;
    line-height: 1.85;
    color: var(--text-secondary);
    max-width: 80ch;
    transition: max-height 0.3s ease;
}
/* When clamped (collapsed state), limit to 3 lines via -webkit-box.
   The child <p> tags are forced inline so the clamp spans the whole
   description text rather than only the first paragraph. */
.sd-detail-description.is-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sd-detail-description.is-clamped p,
.sd-detail-description.is-clamped br { display: inline; }
.sd-detail-description.is-clamped p::after { content: ' '; }
/* Paragraph spacing in expanded (un-clamped) state — respects the user's
   paragraph breaks from the block editor. */
.sd-detail-description p { margin: 0 0 1em; }
.sd-detail-description p:last-child { margin-bottom: 0; }
.sd-read-more {
    background: none;
    border: none;
    color: var(--primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    padding: 0;
    margin-top: 8px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color 0.25s ease;
}
.sd-read-more:hover { color: var(--primary-light); }

.sd-detail-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sd-detail-section-title .sd-iconify {
    font-size: 22px;
    color: var(--primary-light);
}

.sd-image-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 36px;
}
.sd-gallery-item {
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 4/3;
    cursor: pointer;
    position: relative;
    padding: 0;
    border: 0;
    background: none;
    display: block;
}
.sd-gallery-item.is-lead {
    grid-column: 1 / -1;
    aspect-ratio: 16/9;
}
.sd-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.sd-gallery-item:hover img { transform: scale(1.06); }

/* Dark overlay on hover (matches reference directory1). */
.sd-gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    border-radius: var(--radius-sm);
    pointer-events: none;
}
.sd-gallery-item:hover::after {
    background: rgba(0, 0, 0, 0.1);
}

.sd-detail-cta {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px var(--shadow-color);
}
.sd-detail-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-color);
}
.sd-detail-cta .sd-iconify { font-size: 20px; }

/* ================================================================== */
/* No results                                                         */
/* ================================================================== */
/* Note: .sd-no-results lives INSIDE the grid (inside .sd-container),
 * so the container prefix is intentional and correct here. */
.sd-container.sd-preset-style-1 .sd-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    /* Use flex for guaranteed horizontal + vertical centering of the icon,
     * even when the SVG has explicit width/height that fights text-align. */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.sd-container.sd-preset-style-1 .sd-no-results-icon {
    font-size: 64px;
    color: var(--border);
    margin-bottom: 16px;
    /* inline-block from core.css is enough — flex parent centers it. */
    text-align: center;
}
.sd-container.sd-preset-style-1 .sd-no-results-icon svg {
    /* Force SVG to inherit font-size (Iconify default is 1em, this is a safety net). */
    width: 1em;
    height: 1em;
    display: block;
}
.sd-container.sd-preset-style-1 .sd-no-results-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}
.sd-container.sd-preset-style-1 .sd-no-results-text {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

/* ================================================================== */
/* Lightbox                                                           */
/* ================================================================== */
.sd-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100002;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.sd-lightbox.is-active {
    opacity: 1;
    pointer-events: auto;
}
.sd-lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 12px;
    object-fit: contain;
    transform: scale(0.9);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.sd-lightbox.is-active .sd-lightbox-img { transform: scale(1); }

.sd-lightbox-close,
.sd-lightbox-nav {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.25s ease;
    color: #fff;
    padding: 0;
}
.sd-lightbox-close {
    top: 24px; right: 24px;
    width: 48px; height: 48px;
}
.sd-lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 52px; height: 52px;
}
.sd-lightbox-nav.sd-prev { left: 24px; }
.sd-lightbox-nav.sd-next { right: 24px; }

.sd-lightbox-close:hover,
.sd-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.22);
}
.sd-lightbox-close .sd-iconify,
.sd-lightbox-nav .sd-iconify { font-size: 24px; color: #fff; }

/* ================================================================== */
/* Responsive                                                         */
/* ================================================================== */
@media (max-width: 768px) {
    .sd-container.sd-preset-style-1 .sd-toolbar-top {
        flex-direction: column;
        align-items: stretch;
    }
    .sd-container.sd-preset-style-1 .sd-grid {
        grid-template-columns: repeat(min(var(--columns), 2), 1fr);
        gap: 14px;
    }
    .sd-detail-panel { max-width: 100%; }
    .sd-detail-hero { height: 240px; }
    .sd-detail-content { padding: 0 24px 50px; }
    .sd-detail-title { font-size: 26px; }
    .sd-image-gallery { gap: 8px; }
    .sd-container.sd-preset-style-1 .sd-toolbar-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .sd-container.sd-preset-style-1 .sd-grid {
        grid-template-columns: 1fr;
    }
    .sd-container.sd-preset-style-1 .sd-filter-section {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        justify-content: flex-start;
    }
    .sd-container.sd-preset-style-1 .sd-filter-btn { flex-shrink: 0; }
}
