/*
Theme Name: MATANZICK
Theme URI: https://matanzick.com
Author: MATANZICK
Description: Minimalist one-page theme for the Norwegian metal band MATANZICK.
Version: 1.0.0
Text Domain: matanzick
*/

/* ========================================
   CSS RESET & BASE
   ======================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 300;
    line-height: 1.7;
    color: #d4d4d4;
    background-color: #0d0d0d;
    background-image: url('assets/bg-grunge-hires.webp');
    background-repeat: repeat;
    background-size: 1200px auto;
    background-attachment: fixed;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Skip-to-content link (visible on focus only) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 9999;
    padding: 12px 24px;
    background: #fff;
    color: #0d0d0d;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 0 0 4px 4px;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only — visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus-visible outlines for keyboard navigation */
a:focus-visible,
button:focus-visible,
.cta-button:focus-visible {
    outline: 2px solid #e0e0e0;
    outline-offset: 3px;
    border-radius: 2px;
}

.social-icons a:focus-visible {
    outline: 2px solid #e0e0e0;
    outline-offset: 2px;
}

/* ========================================
   LAYOUT UTILITIES
   ======================================== */

.site-wrapper {
    min-height: 100vh;
    position: relative;
}

/* Dark vignette — fades to black at the sides on wide screens */
.site-wrapper::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(
        ellipse 70% 100% at 50% 50%,
        transparent 0%,
        transparent 40%,
        rgba(0, 0, 0, 0.35) 65%,
        rgba(0, 0, 0, 0.7) 85%,
        rgba(0, 0, 0, 0.92) 100%
    );
}

/* Subtle top/bottom fade for extra depth */
.site-wrapper::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background:
        linear-gradient(to bottom,
            rgba(0, 0, 0, 0.5) 0%,
            transparent 12%,
            transparent 90%,
            rgba(0, 0, 0, 0.6) 100%
        );
}

/* Ensure content sits above the vignette overlays */
.hero,
.section,
.cta-section,
.site-footer {
    position: relative;
    z-index: 2;
}

.section {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 64px 24px;
}

.section-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: #eee;
    text-align: center;
    margin-bottom: 40px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85), 0 4px 16px rgba(0, 0, 0, 0.95);
}

/* Custom Section Dividers */
.section + .section {
    border-top: none;
}

.section + .section:not(.cta-section) {
    position: relative;
}

/* Beautiful tapered line that is thicker in the middle and fades at the edges */
.section + .section:not(.cta-section)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 800px;
    height: 6px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 6' preserveAspectRatio='none'%3E%3Cpath d='M0 3 Q 500 0, 1000 3 Q 500 6, 0 3' fill='url(%23g)'/%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0%25' y1='0%25' x2='100%25' y2='0%25'%3E%3Cstop offset='0%25' stop-color='%23ffffff' stop-opacity='0'/%3E%3Cstop offset='20%25' stop-color='%23ffffff' stop-opacity='0.02'/%3E%3Cstop offset='50%25' stop-color='%23ffffff' stop-opacity='0.22'/%3E%3Cstop offset='80%25' stop-color='%23ffffff' stop-opacity='0.02'/%3E%3Cstop offset='100%25' stop-color='%23ffffff' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 100% 100%;
    pointer-events: none;
    z-index: 3;
}


/* ========================================
   HERO SECTION
   ======================================== */

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: auto;
    padding: 96px 24px 80px;
    text-align: center;
}

.hero__title {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    width: 100%;
}

.hero__logo {
    width: 100%;
    max-width: 680px;
    margin-bottom: -46px;
    filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.85)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.7));
}

.hero__est {
    font-family: 'Cinzel', 'Georgia', serif;
    font-weight: 900;
    font-size: 1.25rem;
    letter-spacing: 0.45em;
    color: #fff;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 14px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.95);
}

.hero__est::before,
.hero__est::after {
    content: '';
    display: block;
    width: 44px;
    height: 3px;
    background: #aaa;
}

/* ========================================
   SPOTIFY SECTION
   ======================================== */

.spotify {
    padding-top: 0;
}

.spotify__embed {
    width: 100%;
    max-width: 660px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.spotify__embed iframe {
    display: block;
    width: 100%;
    border: none;
}

/* ========================================
   VIDEOS SECTION
   ======================================== */

.videos__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.video-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    aspect-ratio: 16 / 9;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

.video-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.video-card iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    filter: brightness(0.85);
    transition: filter 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.video-card:hover img {
    filter: brightness(1);
    transform: scale(1.03);
}

.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 52px;
    height: 52px;
    background: rgba(0, 0, 0, 0.75);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 10;
}

.video-play-btn::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 9px 0 9px 15px;
    border-color: transparent transparent transparent #fff;
    margin-left: 3px;
}

.video-card:hover .video-play-btn {
    background: #ff0055;
    border-color: #ff0055;
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.6);
}

.video-card--playing img,
.video-card--playing .video-play-btn {
    display: none;
}

/* ========================================
   GALLERY SECTION
   ======================================== */

.gallery__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.gallery__item {
    display: block;
    width: 100%;
    padding: 0;
    cursor: pointer;
    outline: none;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

.gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
    filter: brightness(0.8);
}

.gallery__item:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.gallery__item:hover img {
    transform: scale(1.06);
    filter: brightness(1.05);
}

.gallery__item:focus-visible {
    outline: 2px solid #ff0055;
    outline-offset: 3px;
    border-radius: 6px;
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
    transform: translateY(-3px);
}

/* ========================================
   LIGHTBOX DIALOG (MODAL OVERLAY)
   ======================================== */

.lightbox-dialog {
    border: none;
    background: transparent;
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

/* Backdrop overlay with blur & active analog scanline grid */
.lightbox-dialog::backdrop {
    background-color: rgba(6, 6, 6, 0.94);
    backdrop-filter: blur(12px) contrast(1.15);
    background-image: 
        radial-gradient(circle at center, transparent 30%, #000000 95%),
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.35) 50%);
    background-size: 100% 100%, 100% 4px;
    animation: lightbox-backdrop-fade 0.3s ease-out;
}

@keyframes lightbox-backdrop-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox__container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
}

/* Close button - absolute positioning prevents iOS Safari bugs with native dialogs */
.lightbox__close {
    position: absolute;
    top: max(24px, env(safe-area-inset-top));
    right: max(24px, env(safe-area-inset-right));
    background: rgba(13, 13, 13, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 1.8rem;
    font-weight: 200;
    cursor: pointer;
    line-height: 1;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 120;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.lightbox__close:hover {
    color: #ff0055;
    background: rgba(255, 0, 85, 0.1);
    border-color: #ff0055;
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.5);
    transform: scale(1.1) rotate(90deg);
}

.lightbox__close:focus-visible {
    outline: 2px solid #ff0055;
    outline-offset: 2px;
}

/* Navigation buttons (Prev/Next circles - overlayed with glassmorphic blur) */
.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(13, 13, 13, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 50%;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.lightbox__nav--prev {
    left: max(24px, env(safe-area-inset-left));
}

.lightbox__nav--next {
    right: max(24px, env(safe-area-inset-right));
}

.lightbox__nav:hover {
    background: #ff0055;
    border-color: #ff0055;
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.65);
    transform: translateY(-50%) scale(1.12);
}

.lightbox__nav:focus-visible {
    outline: 2px solid #ff0055;
    outline-offset: 2px;
}

.lightbox__nav svg {
    display: block;
    transition: transform 0.3s ease;
}

.lightbox__nav--prev:hover svg {
    transform: translateX(-2px);
}

.lightbox__nav--next:hover svg {
    transform: translateX(2px);
}

/* Content Container & double-stroke heavy metal frame */
.lightbox__content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: calc(100% - 160px);
    max-height: calc(100% - 120px);
}

.lightbox__image-wrapper {
    position: relative;
    border: 3px double rgba(255, 255, 255, 0.85);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(255, 0, 85, 0.12);
    border-radius: 4px;
    overflow: hidden;
    background: #000;
}

.lightbox__image {
    max-width: 100%;
    max-height: 70vh;
    height: auto;
    object-fit: contain;
    display: block;
}

.lightbox__caption {
    margin-top: 20px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #eee;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
    text-align: center;
    padding: 0 16px;
}

/* Glitch overlay layout inside wrapper */
.lightbox__glitch-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: transparent;
    z-index: 5;
    opacity: 0;
}

/* Active Glitch Switching Animations */
.lightbox__image-wrapper.is-switching .lightbox__image {
    animation: lightbox-img-glitch 0.28s steps(1) forwards;
}

.lightbox__image-wrapper.is-switching .lightbox__glitch-overlay {
    background: rgba(255, 0, 85, 0.15);
    opacity: 1;
    animation: lightbox-overlay-glitch 0.28s steps(1) forwards;
}

@keyframes lightbox-img-glitch {
    0% {
        transform: translate(6px, -3px) skewX(8deg) scale(1.04);
        filter: contrast(1.4) saturate(1.3) hue-rotate(20deg);
    }
    25% {
        transform: translate(-5px, 4px) skewX(-6deg) scale(0.96);
        filter: contrast(1.7) hue-rotate(-20deg) invert(0.04);
    }
    50% {
        transform: translate(8px, 2px) skewY(3deg) scaleY(1.08);
        filter: contrast(1.1) saturate(1.9) brightness(1.25);
    }
    75% {
        transform: translate(-4px, -5px) skewX(10deg) scaleX(1.04);
        filter: contrast(1.5) hue-rotate(45deg);
    }
    100% {
        transform: translate(0, 0) skew(0) scale(1);
        filter: none;
    }
}

@keyframes lightbox-overlay-glitch {
    0%, 100% {
        opacity: 0;
        box-shadow: none;
    }
    20% {
        opacity: 0.75;
        box-shadow: inset 0 0 30px rgba(0, 255, 255, 0.45), inset 15px 0 20px rgba(255, 0, 85, 0.55);
    }
    60% {
        opacity: 0.85;
        box-shadow: inset 0 0 40px rgba(255, 0, 85, 0.7), inset -15px 0 20px rgba(0, 255, 255, 0.45);
    }
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .lightbox__content {
        max-width: 100%;
        max-height: 100%;
        padding: 0 16px;
    }

    .lightbox__nav {
        width: 42px;
        height: 42px;
        background: rgba(13, 13, 13, 0.75);
        /* Move to bottom to prevent overlapping image */
        top: auto;
        bottom: max(24px, env(safe-area-inset-bottom));
        transform: none;
    }

    .lightbox__nav--prev {
        left: calc(50% - 56px);
    }

    .lightbox__nav--next {
        right: calc(50% - 56px);
    }

    .lightbox__close {
        top: max(16px, env(safe-area-inset-top));
        right: max(16px, env(safe-area-inset-right));
        width: 42px;
        height: 42px;
        font-size: 1.5rem;
    }

    .lightbox__image {
        max-height: 65dvh;
    }

    .lightbox__caption {
        font-size: 0.8rem;
        margin-top: 14px;
        margin-bottom: 72px; /* Make room for the arrows below */
        letter-spacing: 0.16em;
    }
}

@media (max-width: 480px) {
    .lightbox__nav {
        width: 40px;
        height: 40px;
        bottom: max(16px, env(safe-area-inset-bottom));
    }

    .lightbox__nav--prev {
        left: calc(50% - 52px);
    }

    .lightbox__nav--next {
        right: calc(50% - 52px);
    }

    .lightbox__close {
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
    }

    .lightbox__image {
        max-height: 60dvh;
    }
    
    .lightbox__caption {
        margin-bottom: 64px;
    }
}


/* ========================================
   BIO SECTION
   ======================================== */

.bio__text {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.9;
    color: #d8d8d8; /* Brightened slightly from #bbb for improved contrast */
    
    /* Soft dark radial background gradient that dims the grunge noise behind text and blends seamlessly */
    background: radial-gradient(
        ellipse at center,
        rgba(13, 13, 13, 0.9) 0%,
        rgba(13, 13, 13, 0.65) 45%,
        rgba(13, 13, 13, 0) 80%
    );
    padding: 32px 48px;
    border-radius: 24px;
}

.bio__text p {
    margin-bottom: 24px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); /* Subtle dark drop shadow on letters */
}

.bio__text p:first-of-type {
    font-size: 1.08rem;
    color: #fff; /* Crisp white for the lead paragraph */
    line-height: 1.85;
}

.bio__text p:last-child {
    margin-bottom: 0;
}

.bio__text strong {
    font-weight: 600;
    color: #fff;
}

/* ========================================
   CTA BUTTON (Buy LP / Vinyl)
   ======================================== */

.cta-section {
    text-align: center;
    padding-top: 8px;
    padding-bottom: 64px;
}

.cta-button {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 16px 44px;
    border-radius: 3px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(255, 255, 255, 0.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cta-button:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.8);
    color: #fff;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

/* ========================================
   SHOWS SECTION
   ======================================== */

.shows__list {
    max-width: 500px;
    margin: 0 auto;
    list-style: none;
    text-align: center;
}

.shows__item {
    font-size: 0.95rem;
    color: #bbb;
    letter-spacing: 0.03em;
    transition: all 0.3s ease;
}

.shows__item:not(.shows__item--has-link) {
    padding: 14px 0;
}

.shows__item + .shows__item {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.shows__link {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 18px 24px;
    width: 100%;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 4px;
}

.shows__link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.shows__link:hover .shows__date {
    color: #fff;
}

.shows__link:hover .shows__venue {
    color: #fff;
}

.shows__link:hover .shows__icon {
    transform: translate(3px, -3px) scale(1.15);
    color: #fff;
}

.shows__date {
    font-weight: 500;
    color: #ddd;
    margin-right: 8px;
    transition: color 0.3s ease;
}

.shows__venue {
    color: #a0a0a0;
    transition: color 0.3s ease;
}

.shows__dash {
    color: #777;
    margin: 0 6px;
}

.shows__icon {
    font-size: 0.75rem;
    margin-left: 10px;
    color: #666;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s ease;
}

/* ========================================
   FOOTER / SOCIAL MEDIA
   ======================================== */

.site-footer {
    padding: 40px 24px 48px;
    text-align: center;
}

.social-icons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 28px;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #a0a0a0;
    font-size: 1.15rem;
    transition: color 0.3s ease, transform 0.3s ease, filter 0.3s ease;
    filter: grayscale(100%);
}

.social-icons a:hover {
    color: #fff;
    transform: translateY(-2px);
    filter: grayscale(100%);
}

.site-contact {
    margin-top: 24px;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.site-contact a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #a0a0a0;
    font-weight: 500;
    transition: color 0.3s ease, transform 0.3s ease;
}

.site-contact a:hover {
    color: #fff;
    transform: translateY(-2px);
}

.site-contact svg {
    flex-shrink: 0;
}

.site-credit {
    margin-top: 32px;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #555;
    transition: color 0.3s ease;
}

.site-credit a {
    color: inherit;
    transition: color 0.3s ease;
}

.site-credit a:hover {
    color: #999;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Tablet */
@media (max-width: 768px) {
    .hero {
        padding: 72px 20px 60px;
    }

    .hero__logo {
        max-width: 660px;
        margin-bottom: -32px;
    }

    .hero__est {
        font-size: 1.05rem;
        letter-spacing: 0.35em;
    }

    .section {
        padding: 48px 20px;
    }

    .videos__grid {
        grid-template-columns: 1fr;
        gap: 12px;
        max-width: 560px;
        margin: 0 auto;
    }

    .gallery__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .section-title {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .bio__text {
        padding: 24px 24px;
    }

    .cta-section {
        padding-bottom: 48px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .hero {
        padding: 48px 16px 40px;
    }

    .hero__logo {
        max-width: 100%;
        margin-bottom: -28px;
    }

    .hero__est {
        font-size: 0.9rem;
        letter-spacing: 0.3em;
        gap: 8px;
    }

    .hero__est::before,
    .hero__est::after {
        width: 24px;
    }

    .section {
        padding: 36px 16px;
    }

    .bio__text {
        font-size: 0.88rem;
        text-align: left;
        padding: 16px 12px;
    }

    .cta-button {
        font-size: 0.8rem;
        padding: 12px 32px;
    }

    .social-icons {
        gap: 20px;
    }

    .cta-section {
        padding-bottom: 36px;
    }

}

/* ========================================
   GLITCH INTRO & SPORADIC EFFECTS
   ======================================== */

/* Prevent scrollbars during intro transition */
body.glitch-intro-active {
    overflow: hidden !important;
}

/* Base site wrapper boot-up transition */
.site-wrapper {
    min-height: 100vh;
    position: relative;
    transition: filter 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Constant high-intensity background glitching during intro */
body.glitch-intro-active .site-wrapper {
    animation: bg-glitch-anim 0.15s steps(1) infinite;
}

/* Constant high-intensity logo glitching during intro */
body.glitch-intro-active .hero__logo {
    animation: logo-glitch-anim 0.18s steps(1) infinite;
}

/* Premium Dynamic Film Grain Overlay */
.film-grain {
    position: fixed;
    inset: -5%; /* Outsets the container to avoid white borders during glitch displacement translation */
    width: 110vw;
    height: 110vh;
    z-index: 99998; /* Under the CRT scanlines but above all website content */
    pointer-events: none;
    opacity: 0.07; /* Subtle but clearly visible on dark backgrounds */
    mix-blend-mode: screen;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    animation: grain-anim 0.7s steps(6) infinite;
    will-change: transform;
}

/* Film grain behaviour during intro glitch (intense analog distortion) */
body.glitch-intro-active .film-grain {
    opacity: 0.22;
    mix-blend-mode: difference;
    animation: grain-glitch-anim 0.12s steps(1) infinite;
}

/* Film grain behaviour during sporadic background glitches (digital feedback noise spikes) */
body.glitch-bg-active .film-grain {
    opacity: 0.16;
    mix-blend-mode: color-dodge;
    animation: grain-glitch-anim 0.08s steps(1) infinite;
}

/* 1. Intro Glitch Overlay Container (Transparent scanlines and sweeps) */
.glitch-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    pointer-events: none;
    background-color: transparent;
    opacity: 0;
    display: none;
}

/* Active State for Intro */
body.glitch-intro-active .glitch-overlay {
    display: block;
    opacity: 1;
    animation: 
        intro-overlay-flicker 1.2s steps(2) infinite, 
        intro-fade-out 1.2s cubic-bezier(0.7, 0, 0.3, 1) forwards;
}

/* Scanlines overlay */
.glitch-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 50%,
        rgba(0, 0, 0, 0.45) 50%
    );
    background-size: 100% 4px;
    z-index: 100000;
}

/* High frequency red/blue color bar sweeping down */
.glitch-overlay::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 120px;
    background: rgba(255, 0, 85, 0.14);
    box-shadow: 0 0 30px rgba(255, 0, 85, 0.35), 0 0 60px rgba(0, 200, 255, 0.3);
    mix-blend-mode: color-dodge;
    animation: noise-bar-anim 1.2s linear infinite;
    z-index: 100001;
}

/* 2. Hero Logo Glitch State */
.glitch-logo-active {
    animation: logo-glitch-anim 0.25s steps(1) infinite;
}

/* 3. Background/System Glitch State */
.glitch-bg-active .site-wrapper {
    animation: bg-glitch-anim 0.22s steps(1) infinite;
}

/* ========================================
   GLITCH ANIMATIONS (GPU ACCELERATED)
   ======================================== */

@keyframes grain-anim {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-1%, -1%); }
    20% { transform: translate(1%, 2%); }
    30% { transform: translate(-2%, -2%); }
    40% { transform: translate(1%, 3%); }
    50% { transform: translate(-1%, 2%); }
    60% { transform: translate(-2.5%, -1%); }
    70% { transform: translate(2%, 1%); }
    80% { transform: translate(-1%, -2%); }
    90% { transform: translate(2.5%, 2%); }
}

@keyframes grain-glitch-anim {
    0% {
        transform: translate(2%, -1%) scale(3.5) skewX(20deg);
        filter: contrast(4) invert(0.2) saturate(2);
    }
    50% {
        transform: translate(-3%, 3%) scale(4) skewX(-15deg);
        filter: contrast(3) invert(0.85) hue-rotate(90deg);
    }
    100% {
        transform: translate(0, 0) scale(1) skew(0);
        filter: none;
    }
}

@keyframes noise-bar-anim {
    0% { top: -150px; }
    100% { top: 120%; }
}

@keyframes intro-overlay-flicker {
    0%, 100% { opacity: 0.85; }
    15% { opacity: 0.4; }
    30% { opacity: 0.95; }
    45% { opacity: 0.2; }
    60% { opacity: 0.9; }
    75% { opacity: 0.5; }
    90% { opacity: 0.95; }
}

/* CRT style digital collapse/sweep sweep effect */
@keyframes intro-fade-out {
    0% { 
        opacity: 1; 
    }
    78% { 
        opacity: 1; 
        transform: scale(1) skew(0deg); 
    }
    85% { 
        opacity: 0.95; 
        transform: scale(1.02) skewX(4deg); 
    }
    93% { 
        opacity: 0.55; 
        transform: scale(1.06) skewX(-6deg) scaleY(0.08); 
    }
    100% { 
        opacity: 0; 
        transform: scale(1.1) scaleY(0); 
        display: none; 
    }
}

/* Hero logo sporadic glitch */
@keyframes logo-glitch-anim {
    0% {
        transform: translate(4px, 1px) skewX(8deg) scale(1.03);
        filter: drop-shadow(-4px 0 #ff0055) drop-shadow(4px 0 #00ffff) contrast(1.4);
    }
    20% {
        transform: translate(-5px, -2px) skewX(-12deg) scale(0.97);
        filter: drop-shadow(4px 0 #ff0055) drop-shadow(-4px 0 #00ffff) brightness(1.3);
    }
    40% {
        transform: translate(2px, 3px) skewX(4deg) scaleY(1.06);
        filter: drop-shadow(-3px -2px #ff00ff) drop-shadow(3px 2px #00ff00) contrast(1.2);
    }
    60% {
        transform: translate(-6px, -1px) skewX(10deg) scaleX(1.05);
        filter: contrast(1.6) saturate(1.5) hue-rotate(45deg);
    }
    80% {
        transform: translate(5px, -3px) skewY(2deg) scale(0.98);
        filter: drop-shadow(-5px 0 #ff0055) drop-shadow(5px 0 #00ffff) invert(0.08);
    }
    100% {
        transform: translate(0, 0) skew(0) scale(1);
        filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.85)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.7));
    }
}

/* Background sporadic glitch */
@keyframes bg-glitch-anim {
    0% {
        transform: translate(-2px, 1px) skewX(-0.5deg);
        filter: hue-rotate(-12deg) contrast(1.2) saturate(1.15);
    }
    50% {
        transform: translate(3px, -1px) skewX(0.5deg);
        filter: hue-rotate(12deg) contrast(0.85) saturate(1.25) brightness(1.08);
    }
    100% {
        transform: translate(0, 0) skew(0);
        filter: none;
    }
}

/* ========================================
   MOBILE HIGH-COMPOSITED GLITCH OVERRIDES
   ======================================== */

@media (max-width: 768px) {
    /* Eliminate mobile layout shifts by swapping translation-based motion with composite-only filters */
    body.glitch-intro-active .site-wrapper,
    body.glitch-intro-active .hero__logo,
    .glitch-logo-active {
        animation: mobile-glitch-flicker 0.15s steps(1) infinite !important;
        transform: none !important;
    }

    /* Disable sporadic background glitches on the entire page content on mobile to keep text stable */
    body.glitch-bg-active .site-wrapper {
        animation: none !important;
        transform: none !important;
        filter: none !important;
    }

    .film-grain {
        animation: mobile-grain-anim 0.8s steps(6) infinite !important;
        opacity: 0.07 !important;
        inset: -10px !important;
        width: calc(100% + 20px) !important;
        height: calc(100% + 20px) !important;
        transform: translate(0, 0);
    }

    body.glitch-intro-active .film-grain,
    body.glitch-bg-active .film-grain {
        animation: mobile-grain-glitch-flicker 0.1s steps(1) infinite !important;
    }
}

@keyframes mobile-glitch-flicker {
    0%, 100% { filter: none; }
    30% { filter: hue-rotate(30deg) contrast(1.2) brightness(1.1); }
    60% { filter: contrast(0.8) brightness(0.9); }
    90% { filter: hue-rotate(-20deg) saturate(1.3); }
}

@keyframes mobile-grain-anim {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-2px, -2px); }
    20% { transform: translate(2px, 3px); }
    30% { transform: translate(-3px, -1px); }
    40% { transform: translate(1px, 2px); }
    50% { transform: translate(-2px, 3px); }
    60% { transform: translate(-4px, -2px); }
    70% { transform: translate(3px, 1px); }
    80% { transform: translate(-2px, -3px); }
    90% { transform: translate(4px, 2px); }
}

@keyframes mobile-grain-glitch-flicker {
    0%, 100% { opacity: 0.15; filter: contrast(2) invert(0.1); transform: translate(-3px, 2px); }
    50% { opacity: 0.22; filter: contrast(1.5) invert(0.8); transform: translate(4px, -3px); }
}

/* ========================================
   REDUCED MOTION (WCAG 2.3.3)
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
