/* =============================================
   JADEN LINKS - Full-Frame Image Gallery
   ============================================= */

@font-face {
    font-family: 'Ancient';
    src: url('../assets/images/Ancient.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* CSS Custom Properties */
:root {
    --black: #000000;
    --white: #ffffff;
    --red: #ff0000;
    --gray-dark: #111111;
    --gray-medium: #1a1a1a;
    --gray-light: #222222;
    --gray-muted: #333333;
    --gray-text: #999999;

    --font-primary: 'Ancient', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    --font-body: 'Helvetica Neue', Helvetica, Arial, sans-serif;

    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 15px;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 150ms;
    --duration-normal: 300ms;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    font-weight: 700;
    background: var(--black);
    color: var(--white);
    line-height: 1.5;
    overflow: hidden;
}

/* Grain overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('../assets/images/noise.png') repeat;
    background-size: 128px 128px;
    opacity: 0.04;
    pointer-events: none;
    z-index: 9998;
}

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

img {
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

/* =============================================
   LOADER
   ============================================= */
.loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--black);
    overflow: hidden;
}

.loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.loader-text {
    font-family: var(--font-primary);
    font-size: clamp(60px, 15vw, 140px);
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--red);
    display: flex;
    justify-content: center;
    perspective: 1500px;
    text-shadow: 0 0 60px rgba(255, 0, 0, 0.8);
}

.loader-text .char {
    display: inline-block;
    transform-origin: center bottom;
    text-shadow: 0 0 40px rgba(255, 0, 0, 0.6);
}

.loader-line {
    width: 120px;
    height: 3px;
    background: var(--gray-muted);
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.loader-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: var(--red);
    border-radius: 2px;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
}

/* =============================================
   GALLERY - Full-frame vertical scroll
   ============================================= */
.gallery {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    touch-action: pan-x;
}

.frame {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.frame picture {
    display: block;
    width: 100%;
    height: 100%;
}

.frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Gradient at bottom for label legibility */
.frame::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
    pointer-events: none;
}

.frame-label {
    position: absolute;
    bottom: 32px;
    left: 24px;
    z-index: 1;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
}

/* =============================================
   HEART TOGGLE
   ============================================= */
.heart-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9997;
    width: 28px;
    height: 28px;
    color: var(--red);
    cursor: pointer;
    transition: transform 150ms ease;
}

.heart-toggle svg {
    width: 100%;
    height: 100%;
}

.heart-toggle:hover {
    transform: scale(1.2);
}

/* =============================================
   INVERTED THEME
   ============================================= */
[data-theme="inverted"] {
    --white: #ff0000;
    --red: #ffffff;
    --black: #ffffff;
    --gray-dark: #cc0000;
    --gray-medium: #b30000;
    --gray-light: #990000;
    --gray-muted: #cc3333;
    --gray-text: #ffcccc;
}

[data-theme="inverted"] body {
    background: #ff0000;
}

[data-theme="inverted"] .loader {
    background: #ff0000;
}

[data-theme="inverted"] .heart-toggle {
    color: #ffffff;
}

[data-theme="inverted"] .frame-label {
    color: rgba(255, 255, 255, 0.9);
}

/* Glitch overlay */
.glitch-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    overflow: hidden;
    background: transparent;
}

.glitch-line {
    position: absolute;
    left: -10%;
    width: 120%;
    mix-blend-mode: exclusion;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 0, 0, 0.6) 15%,
        rgba(0, 255, 255, 0.4) 30%,
        transparent 50%,
        rgba(255, 0, 255, 0.5) 70%,
        rgba(0, 255, 0, 0.3) 85%,
        transparent 100%
    );
}

[data-theme="inverted"] .glitch-line {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.6) 20%,
        rgba(0, 255, 255, 0.4) 40%,
        transparent 50%,
        rgba(255, 0, 255, 0.5) 70%,
        rgba(255, 255, 255, 0.4) 90%,
        transparent 100%
    );
}

/* =============================================
   ACCESSIBILITY & MOTION
   ============================================= */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--red);
}

::selection {
    background: var(--red);
    color: var(--white);
}


/* Skip link */
.skip-link {
    position: fixed;
    top: -100%;
    left: 16px;
    right: 16px;
    padding: 8px 16px;
    background: var(--red);
    color: var(--white);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
    z-index: 10000;
    transition: top var(--duration-fast);
}

.skip-link:focus {
    top: 8px;
}

/* Scroll hint on first frame */
.scroll-hint {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.5);
    animation: scrollBounce 2s ease-in-out infinite;
}

.scroll-hint svg {
    width: 100%;
    height: 100%;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.5; }
    50% { transform: translateX(-50%) translateY(8px); opacity: 1; }
}

/* Safe areas for notched devices */
.frame-label {
    bottom: max(32px, env(safe-area-inset-bottom, 0px) + 16px);
    left: max(24px, env(safe-area-inset-left, 0px) + 16px);
}

.heart-toggle {
    bottom: max(24px, env(safe-area-inset-bottom, 0px) + 12px);
    right: max(24px, env(safe-area-inset-right, 0px) + 12px);
}
