/**
 * Naqash Studio — Custom CSS
 * Minimal overrides for elements not easily handled by Tailwind.
 */

/* ==========================================================================
   Self-Hosted Typography: Playfair Display & Inter (WOFF2)
   ========================================================================== */

/* Playfair Display - Regular / SemiBold / Bold (Variable 400-700) */
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/playfair-display/playfair-display-variable.woff2') format('woff2');
}

/* Playfair Display - Italic 400 */
@font-face {
    font-family: 'Playfair Display';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/playfair-display/playfair-display-400-italic.woff2') format('woff2');
}

/* Inter - Light 300 */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('../fonts/inter/inter-300.woff2') format('woff2');
}

/* Inter - Regular / Medium / SemiBold / Bold (Variable 400-700) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/inter/inter-variable.woff2') format('woff2');
}

/* ========== Base ========== */
::selection {
    background-color: #B08A57;
    color: #ffffff;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #F7F3EE;
}

::-webkit-scrollbar-thumb {
    background: #d6d3d1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #B08A57;
}

/* ========== Animations ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 1s ease-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Staggered animation delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* ========== Focus Styles ========== */
input:focus,
textarea:focus,
select:focus {
    outline: none;
}

/* ========== Loading Spinner ========== */
.spinner {
    border: 2px solid #F7F3EE;
    border-top: 2px solid #B08A57;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Gallery Hover ========== */
.gallery-item {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover {
    transform: scale(1.02);
}

/* ========== Gallery Image Grid (Step 7d.3) ========== */
.gallery-image-grid {
    break-inside: avoid;
}

.gallery-image-grid .gallery-image-card {
    display: inline-block;
    width: 100%;
}

.gallery-image-grid .gallery-image-card img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

.gallery-image-grid .gallery-image-card a:focus-visible {
    outline: 2px solid #B08A57;
    outline-offset: 2px;
    border-radius: 0.5rem;
}

/* ========== Gallery Lightbox (Step 7d.4) ========== */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox[hidden] {
    display: none !important;
}

.gallery-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.gallery-lightbox__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 95vw;
    max-height: 95vh;
    width: 100%;
    outline: none;
}

.gallery-lightbox__close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    transform: translate(50%, -50%);
}

.gallery-lightbox__close:hover,
.gallery-lightbox__close:focus-visible {
    background: rgba(0, 0, 0, 0.9);
    outline: 2px solid #B08A57;
    outline-offset: 2px;
}

.gallery-lightbox__nav {
    position: absolute;
    top: 50%;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    transition: background 0.2s;
    min-width: 56px;
    min-height: 56px;
}

.gallery-lightbox__prev { left: 16px; }
.gallery-lightbox__next { right: 16px; }

.gallery-lightbox__nav:hover,
.gallery-lightbox__nav:focus-visible {
    background: rgba(0, 0, 0, 0.9);
    outline: 2px solid #B08A57;
    outline-offset: 2px;
}

.gallery-lightbox__image-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    border-radius: 4px;
}

.gallery-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 4px;
}

.gallery-lightbox__img--loaded {
    opacity: 1;
}

.gallery-lightbox__loading {
    position: absolute;
    color: #fff;
    font-size: 14px;
    display: none;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

.gallery-lightbox__loading--visible {
    display: block;
}

.gallery-lightbox__error {
    position: absolute;
    color: #fff;
    font-size: 14px;
    display: none;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    text-align: center;
}

.gallery-lightbox__error--visible {
    display: block;
}

.gallery-lightbox__meta {
    text-align: center;
    color: #fff;
    padding: 12px 16px;
    max-width: 100%;
    box-sizing: border-box;
}

.gallery-lightbox__counter {
    font-size: 13px;
    opacity: 0.8;
    display: block;
    margin-bottom: 4px;
}

.gallery-lightbox__title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    word-wrap: break-word;
}

.gallery-lightbox__caption {
    font-size: 14px;
    opacity: 0.85;
    line-height: 1.5;
    margin-top: 4px;
    word-wrap: break-word;
}

body.gallery-lightbox--open {
    overflow: hidden;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .gallery-lightbox__img {
        transition: none;
    }
    .gallery-lightbox__nav,
    .gallery-lightbox__close {
        transition: none;
    }
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .gallery-lightbox__nav {
        padding: 12px;
        min-width: 44px;
        min-height: 44px;
    }
    .gallery-lightbox__prev { left: 8px; }
    .gallery-lightbox__next { right: 8px; }
    .gallery-lightbox__close {
        transform: none;
        top: 8px;
        right: 8px;
    }
    .gallery-lightbox__meta {
        padding: 8px 12px;
    }
    .gallery-lightbox__title {
        font-size: 14px;
    }
    .gallery-lightbox__caption {
        font-size: 13px;
    }
    .gallery-lightbox__image-wrap {
        max-height: 70vh;
    }
    .gallery-lightbox__img {
        max-height: 70vh;
    }
}

/* ========== Video Gallery (Step 8e) ========== */
.video-card a:focus-visible,
.video-card-link:focus-visible {
    outline: 2px solid #B08A57;
    outline-offset: 2px;
    border-radius: 0.75rem;
}

.video-card-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Ensure long titles wrap safely */
.video-card-title {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

/* ========== Video Player Overlay (Step 8f) ========== */

.video-card-play-link {
    cursor: pointer;
    text-decoration: none;
}

.video-card-play-icon {
    pointer-events: none;
}

.video-card-play-link:focus-visible .video-card-play-icon,
.video-card-play-link:hover .video-card-play-icon {
    opacity: 1;
}

/* On fine-pointer devices with hover, hide play icon until hover/focus */
@media (hover: hover) and (pointer: fine) {
    .video-card-play-icon {
        opacity: 0;
        transition: opacity 0.3s;
    }
    .video-card-play-link:hover .video-card-play-icon,
    .video-card-play-link:focus-visible .video-card-play-icon {
        opacity: 1;
    }
}

/* Active player card */
.video-card.is-active {
    border-color: #B08A57;
}

/* Loading state */
.video-card.is-loading .video-card-play-link {
    display: none;
}

/* Player container */
.video-player-container {
    background: #000;
}

.video-card.is-active .video-player-container {
    display: block;
}

.video-player-iframe {
    display: block;
}

/* Close button */
.video-player-close-btn {
    cursor: pointer;
    line-height: 1;
}

.video-player-close-btn:focus-visible {
    outline: 2px solid #B08A57;
    outline-offset: 2px;
}

/* Loading indicator */
.video-player-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-player-loading span {
    pointer-events: none;
}

/* Error state link */
.video-player-error a:focus-visible {
    outline: 2px solid #B08A57;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .video-card-play-link,
    .video-player-close-btn,
    .video-player-iframe {
        transition: none;
    }
    .video-card-play-icon {
        transition: none;
    }
    @media (hover: hover) and (pointer: fine) {
        .video-card-play-icon,
        .video-card-play-link:hover .video-card-play-icon,
        .video-card-play-link:focus-visible .video-card-play-icon {
            transition: none;
        }
    }
    .video-card.is-active,
    .video-card.is-loading,
    .video-card.is-error {
        transition: none;
    }
}

/* SR-only for live region */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
