/* ==========================================================
   SP Image Slider — assets/css/image-slider.css
   CSS Scroll Snap nativo · sem JS para animação
   ========================================================== */

/* --- Figura raiz --- */
.sp-isl {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 100%;
}

/* --- Cabeçalho opcional --- */
.sp-isl-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #9ca3af;
}

/* -------------------------------------------------------------------
   OUTER: container "TV" — aspect-ratio fixo via CSS custom prop
   A altura NUNCA muda entre slides → zero CLS
   ------------------------------------------------------------------- */
.sp-isl-outer {
    position: relative;
    background: #111;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    aspect-ratio: var(--sp-isl-aspect, 16/9);
}

/* -------------------------------------------------------------------
   TRACK: CSS Scroll Snap — o browser controla a animação
   Nenhum JS toca neste elemento além de scrollTo()
   ------------------------------------------------------------------- */
.sp-isl-track {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-behavior: smooth;
    outline: none;
}
.sp-isl-track::-webkit-scrollbar { display: none; }

/* --- Slide individual --- */
.sp-isl-slide {
    flex: 0 0 100%;
    min-width: 100%;
    height: 100%;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* -------------------------------------------------------------------
   IMAGEM: contain + fundo escuro = "TV mode"
   A imagem nunca é cortada. Barras pretas nas sobras (letterbox).
   ------------------------------------------------------------------- */
.sp-isl-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    margin: 0 !important;
    padding: 0 !important;
}

/* -------------------------------------------------------------------
   SETAS DE NAVEGAÇÃO
   Aparecem no hover desktop, sempre visíveis no touch
   ------------------------------------------------------------------- */
.sp-isl-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    border: 1px solid rgba(255, 255, 255, .15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s, background .15s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 0;
    line-height: 0;
}
.sp-isl-outer:hover .sp-isl-btn,
.sp-isl-outer:focus-within .sp-isl-btn { opacity: 1; }
.sp-isl-btn:hover                        { background: rgba(0, 0, 0, .82); }
.sp-isl-btn:focus-visible                { outline: 2px solid #fff; outline-offset: 2px; opacity: 1; }
.sp-isl-prev { left:  10px; }
.sp-isl-next { right: 10px; }

@media (hover: none) {
    .sp-isl-btn { opacity: .85; }
}

/* --- Botão fullscreen (canto sup. direito) --- */
.sp-isl-fullscreen {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .55);
    border: 1px solid rgba(255, 255, 255, .15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s, background .15s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 0;
    line-height: 0;
}
.sp-isl-outer:hover .sp-isl-fullscreen,
.sp-isl-outer:focus-within .sp-isl-fullscreen { opacity: 1; }
.sp-isl-fullscreen:hover { background: rgba(0, 0, 0, .82); }
@media (hover: none) { .sp-isl-fullscreen { opacity: .85; } }

/* --- Contador (canto inf. direito da imagem) --- */
.sp-isl-counter {
    position: absolute;
    bottom: 8px;
    right: 10px;
    z-index: 10;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, .55);
    border-radius: 20px;
    padding: 2px 8px;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* -------------------------------------------------------------------
   BARRA DE METADATA / EXIF
   Fica entre o track e o filmstrip
   ------------------------------------------------------------------- */
.sp-isl-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-top: none;
    font-size: 12px;
    line-height: 1.4;
    color: #374151;
    min-height: 40px;
}
.dark .sp-isl-meta,
[data-theme="dark"] .sp-isl-meta {
    background: #1f2937;
    border-color: #374151;
    color: #d1d5db;
}

.sp-isl-meta-left    { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sp-isl-device       { font-weight: 700; font-size: 13px; color: #111827; }
.dark .sp-isl-device,
[data-theme="dark"] .sp-isl-device { color: #f9fafb; }

.sp-isl-brand {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    background: #111827;
    color: #f9fafb;
    letter-spacing: .06em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.sp-isl-exif {
    flex: 1;
    color: #6b7280;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    letter-spacing: .03em;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dark .sp-isl-exif,
[data-theme="dark"] .sp-isl-exif { color: #9ca3af; }

.sp-isl-meta-right { flex-shrink: 0; margin-left: auto; }
.sp-isl-original {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: #2563eb;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid currentColor;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.sp-isl-original:hover { background: #2563eb; color: #fff; }

/* -------------------------------------------------------------------
   FILMSTRIP — tira de thumbnails clicáveis
   ------------------------------------------------------------------- */
.sp-isl-filmstrip {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 12px 12px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}
.sp-isl-filmstrip::-webkit-scrollbar        { height: 3px; }
.sp-isl-filmstrip::-webkit-scrollbar-track  { background: transparent; }
.sp-isl-filmstrip::-webkit-scrollbar-thumb  { background: #d1d5db; border-radius: 2px; }

.dark .sp-isl-filmstrip,
[data-theme="dark"] .sp-isl-filmstrip {
    background: #111827;
    border-color: #374151;
}

/* Sem meta bar: filmstrip fica direto abaixo do outer */
.sp-isl-outer + .sp-isl-filmstrip {
    border-radius: 0 0 12px 12px;
}

.sp-isl-thumb {
    flex: 0 0 auto;
    width: 76px;
    height: 54px;
    border-radius: 5px;
    overflow: hidden;
    border: 3px solid transparent;
    cursor: pointer;
    padding: 0;
    background: #e5e7eb;
    transition: border-color .15s, opacity .15s;
    opacity: .65;
    display: block;
}
.sp-isl-thumb:hover     { opacity: .9; }
.sp-isl-thumb.is-active { border-color: #0ea5e9; opacity: 1; }

.sp-isl-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0 !important;
    padding: 0 !important;
}
.sp-isl-thumb-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
}

/* -------------------------------------------------------------------
   DIALOG FULLSCREEN — nativo HTML5 <dialog>
   ------------------------------------------------------------------- */
.sp-isl-dialog {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    background: rgba(0, 0, 0, .96);
    border: none;
    padding: 0;
    margin: 0;
    display: none;
}
.sp-isl-dialog[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-isl-dialog::backdrop { background: rgba(0, 0, 0, .96); }

.sp-isl-dialog-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 24px;
    box-sizing: border-box;
}
.sp-isl-dialog-inner img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 4px;
    box-shadow: 0 0 60px rgba(0,0,0,.8);
}
.sp-isl-dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    padding: 0;
    line-height: 0;
}
.sp-isl-dialog-close:hover { background: rgba(255, 255, 255, .25); }
.sp-isl-dialog-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* -------------------------------------------------------------------
   RESPONSIVO
   ------------------------------------------------------------------- */
@media (max-width: 640px) {
    .sp-isl-btn      { width: 34px; height: 34px; }
    .sp-isl-prev     { left:  6px; }
    .sp-isl-next     { right: 6px; }
    .sp-isl-thumb    { width: 60px; height: 42px; }
    .sp-isl-meta     { flex-wrap: wrap; row-gap: 4px; padding: 7px 10px; }
    .sp-isl-exif     { width: 100%; order: 3; }
}

/* -------------------------------------------------------------------
   ACESSIBILIDADE: sem animação
   ------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .sp-isl-track   { scroll-behavior: auto; }
    .sp-isl-btn,
    .sp-isl-fullscreen,
    .sp-isl-thumb,
    .sp-isl-original { transition: none; }
}
