/* ===== Detail View =====
   Project detail page: hero, back button, sound toggle, credits, BTS grid
*/

.detail-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    background: var(--bg-darker);
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y proximity;
    scroll-padding-top: 16vh;
    overscroll-behavior-y: contain;
    opacity: 0;
    visibility: hidden;
}

.detail-view.active {
    visibility: visible;
}

/* Fade-through-black overlay */
.detail-fade-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-darker);
    z-index: 2500;
    pointer-events: none;
    opacity: 0;
}

/* Back button */
.detail-back {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 2100;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    color: var(--text-light);
    font-family: 'NB International Pro', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: background-color 0.3s ease;
}

.detail-back:hover {
    background: rgba(255, 255, 255, 0.15);
}

.detail-back svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Hero video area */
.detail-hero {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.detail-hero video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-hero-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 9%;
    background: linear-gradient(
        0deg,
        var(--bg-darker) 0%,
        rgba(8, 8, 8, 0.87) 12%,
        rgba(8, 8, 8, 0.72) 25%,
        rgba(8, 8, 8, 0.53) 38%,
        rgba(8, 8, 8, 0.32) 52%,
        rgba(8, 8, 8, 0.14) 66%,
        rgba(8, 8, 8, 0.04) 80%,
        transparent 100%
    );
    pointer-events: none;
}

/* Scroll indicator */
.detail-scroll-indicator {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 10;
    cursor: pointer;
    animation: indicatorBreathe 2s ease-in-out infinite;
}

.detail-scroll-indicator:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 3px;
}

.detail-scroll-indicator svg {
    fill: none;
    stroke: var(--text-light);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@keyframes indicatorBreathe {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(5px); }
}

/* Sound toggle */
.detail-sound-btn {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.detail-sound-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.detail-sound-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Detail content below hero */
.detail-content {
    padding: 4rem 8vw 6rem;
    max-width: 1300px;
    margin: 0 auto;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.detail-header {
    margin-bottom: 3rem;
}

.detail-title-row {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 0.75rem;
}

.detail-title {
    font-family: 'NB International Pro', sans-serif;
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1.06;
    color: var(--text-light);
}

.detail-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* Credits grid */
.detail-credits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
    padding: 2.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-credit {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.detail-credit--wide {
    grid-column: span 2;
}

.detail-credit-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-credit-value {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 400;
}

/* Description */
.detail-description {
    font-size: 1.15rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 300;
    margin-bottom: 4rem;
}

/* YouTube link (inline with title) */
.detail-video-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: var(--text-light);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.detail-video-link:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
}

.detail-video-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.detail-video-link svg {
    fill: currentColor;
    stroke: none;
}

/* Tooltip */
.detail-video-tooltip {
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: 'NB International Pro', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    color: var(--text-light);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.detail-video-link:hover .detail-video-tooltip,
.detail-video-link:focus .detail-video-tooltip {
    opacity: 1;
}

/* Gallery strip */
.detail-gallery {
    position: relative;
    margin-bottom: 4rem;
    width: min(calc(100vw - 4rem), 1500px);
    margin-left: calc(50% - min(50vw - 2rem, 750px));
}

.detail-gallery-controls {
    position: absolute;
    inset: 50% 0 auto 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transform: translateY(-50%);
    pointer-events: none;
}

.detail-gallery-arrow {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-light);
    cursor: pointer;
    pointer-events: auto;
    transition: background-color 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}

.detail-gallery-arrow:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.24);
}

.detail-gallery-arrow:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.detail-gallery-arrow[disabled] {
    opacity: 0.35;
    cursor: default;
}

.detail-gallery-arrow svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.detail-gallery-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(260px, 33vw);
    gap: 0.85rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
    padding: 0 3.25rem 0.5rem;
}

.detail-gallery-strip::-webkit-scrollbar {
    height: 8px;
}

.detail-gallery-strip::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.detail-gallery-item {
    position: relative;
    display: block;
    color: inherit;
}

.detail-gallery-preview-trigger {
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    margin: 0;
    border-radius: 10px;
    background: none;
    cursor: pointer;
}

.detail-gallery-preview-trigger img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
    border-radius: 10px;
    opacity: 0.94;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.detail-gallery-preview-trigger:hover img {
    opacity: 1;
    transform: translateY(-2px);
}

.detail-gallery-item:hover .detail-gallery-action {
    transform: translate(-50%, calc(-50% - 2px));
}

.detail-gallery-item:hover .detail-gallery-action:hover {
    transform: translate(-50%, calc(-50% - 2px)) scale(1.08);
}

.detail-gallery-preview-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.detail-gallery-action {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    text-decoration: none;
    color: var(--text-light);
    transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.detail-gallery-action:hover {
    background: rgba(0, 0, 0, 0.72);
    border-color: rgba(255, 255, 255, 0.24);
    transform: translate(-50%, -50%) scale(1.08);
}

.detail-gallery-action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.detail-gallery-action svg {
    fill: currentColor;
    stroke: none;
}

.detail-gallery-preview {
    position: fixed;
    inset: 0;
    z-index: 2605;
    display: grid;
    place-items: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(14px);
}

.detail-gallery-preview[hidden] {
    display: none;
}

.detail-view--preview-open {
    overflow: hidden;
}

.detail-gallery-preview-dialog {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.25rem;
    width: min(96vw, 1500px);
}

.detail-gallery-preview-media {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: default;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.detail-gallery-preview-media:focus,
.detail-gallery-preview-media:focus-visible {
    outline: none;
    border-radius: 18px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.detail-gallery-preview-media--linked {
    cursor: pointer;
}

.detail-gallery-preview-media--linked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
    transform: translate(-50%, -50%);
    transition: background-color 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.detail-gallery-preview-media--linked::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    border-style: solid;
    border-width: 12px 0 12px 18px;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.95);
    transform: translate(-35%, -50%);
    transition: transform 0.25s ease;
}

.detail-gallery-preview-media--linked:hover::after {
    background: rgba(0, 0, 0, 0.52);
    border-color: rgba(255, 255, 255, 0.28);
    transform: translate(-50%, -50%) scale(1.04);
}

.detail-gallery-preview-media--linked:hover::before {
    transform: translate(-35%, -50%) scale(1.04);
}

.detail-gallery-preview-media img {
    width: 100%;
    max-height: calc(100vh - 8rem);
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    opacity: 1;
    transition: opacity 0.18s ease;
}

.detail-gallery-preview-media--loading img {
    opacity: 0;
}

.detail-gallery-preview-tooltip {
    position: absolute;
    left: 50%;
    bottom: 1.5rem;
    z-index: 2;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0.45rem 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
    pointer-events: none;
}

.detail-gallery-preview-tooltip[hidden] {
    display: none;
}

.detail-gallery-preview-nav {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-light);
    cursor: pointer;
    transition: background-color 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}

.detail-gallery-preview-nav:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.26);
}

.detail-gallery-preview-nav:focus-visible {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.detail-gallery-preview-nav[disabled] {
    opacity: 0.35;
    cursor: default;
}

.detail-gallery-preview-nav svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.detail-gallery-preview-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 1;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-light);
    cursor: pointer;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.detail-gallery-preview-close:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.26);
}

.detail-gallery-preview-close:focus-visible {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.detail-gallery-preview-close svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* BTS photo grid */
.detail-bts-title {
    font-family: 'NB International Pro', sans-serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.detail-bts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 4rem;
}

.detail-bts-grid img {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    border-radius: 6px;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.detail-bts-grid img:hover {
    opacity: 1;
}
