/* ========== GRIDFOLIO MAIN STYLESHEET ========== */
/* Extracted from index.html during refactoring */
/* Date: 2026-01-12 */

/* ========== CSS VARIABLES (Design Tokens) ========== */
:root {
    /* Color System - Museum Palette */
    --background-dark: #0a0a0b;
    --background-elevated: #12121a;
    --surface-01: rgba(255, 255, 255, 0.04);
    --surface-02: rgba(255, 255, 255, 0.08);
    --surface-03: rgba(255, 255, 255, 0.12);
    
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-default: rgba(255, 255, 255, 0.14);
    --border-strong: rgba(255, 255, 255, 0.24);
    
    --text-primary: #ffffff;
    --text-secondary: #b8b8ba;
    --text-tertiary: #6e6e73;
    --text-disabled: #48484d;
    
    --accent-primary: #ffffff;
    --accent-secondary: #ffffff;
    --accent-glow: rgba(255, 255, 255, 0.15);
    
    --grid-major: #1a1a1d;
    --grid-minor: #141417;
    --grid-axis: #22222a;
    
    /* Spacing Scale (8px base) */
    --space-px: 1px;
    --space-0-5: 2px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-base: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Elevation Shadows */
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-3: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-4: 0 8px 32px rgba(0, 0, 0, 0.6);
    
    /* Typography */
    --font-size-xs: 10px;
    --font-size-sm: 12px;
    --font-size-base: 14px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 28px;
    --font-size-4xl: 32px;
    
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    --line-height-tight: 1.2;
    --line-height-snug: 1.4;
    --line-height-normal: 1.6;
    --line-height-relaxed: 1.8;
    
    --letter-spacing-tight: -0.02em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.025em;
    --letter-spacing-wider: 0.05em;
    --letter-spacing-widest: 0.1em;
}

/* ========== BASE STYLES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Force no cursor on desktop - use transparent 1x1 cursor as fallback */
body, body * {
    cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=='), none !important;
}

body {
    background: var(--background-dark);
    overflow: hidden;
    touch-action: none;
}

/* Mobile: allow touch interactions */
@media (max-width: 768px) {
    body {
        touch-action: manipulation;
        background: #000;
    }
}

#canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

/* Show default cursor on mobile only */
@media (hover: none) and (pointer: coarse) {
    body, body * {
        cursor: auto !important;
    }
}

/* ========== UI OVERLAY ========== */
.ui-overlay {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
}

.ui-overlay > * {
    pointer-events: auto;
    cursor: none;
}

/* ========== CATEGORY FILTER ========== */
#category-filter {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 400px;
}

.category-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: #9ca3af;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: none;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateX(20px);
    animation: fadeInFromRight 0.4s ease-out forwards;
}

@keyframes fadeInFromRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Stagger animation delays */
.category-btn:nth-child(1) { animation-delay: 0.1s; }
.category-btn:nth-child(2) { animation-delay: 0.2s; }
.category-btn:nth-child(3) { animation-delay: 0.3s; }
.category-btn:nth-child(4) { animation-delay: 0.4s; }
.category-btn:nth-child(5) { animation-delay: 0.5s; }

.category-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.category-btn.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.category-btn:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

/* ========== ZOOM INDICATOR ========== */
#zoom-indicator {
    position: fixed;
    bottom: var(--space-5);
    left: var(--space-5);
    padding: var(--space-2) var(--space-4);
    background: var(--surface-02);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--font-size-sm);
    backdrop-filter: blur(12px);
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: var(--shadow-1);
}

#zoom-indicator.visible {
    opacity: 1;
}

/* ========== MINIMAP ========== */
#minimap {
    position: fixed;
    bottom: var(--space-5);
    right: var(--space-5);
    width: 200px;
    height: 200px;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid var(--border-default);
    border-radius: 50%;
    backdrop-filter: blur(16px);
    cursor: none;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#minimap:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-4), inset 0 1px 0 var(--accent-glow);
}

#minimap:focus-visible {
    outline: 3px solid var(--accent-primary);
    outline-offset: 3px;
    border-color: var(--accent-primary);
}

/* ========== SHARE MENU ========== */
#share-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--background-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    backdrop-filter: blur(20px);
    display: none;
    z-index: 2000;
    min-width: 320px;
    box-shadow: var(--shadow-4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#share-menu.visible {
    display: block;
}

.share-title {
    font-family: 'Inter', sans-serif;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.share-btn {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
    background: var(--surface-02);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-base);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: var(--font-size-base);
    cursor: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.share-btn:hover {
    background: var(--surface-03);
    border-color: var(--accent-primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.share-btn:active {
    transform: translateX(4px) scale(0.98);
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.share-btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    background: var(--accent-glow);
}

/* ========== DEV PANEL ========== */
#dev-panel {
    position: fixed;
    top: 80px;
    right: var(--space-5);
    background: var(--background-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    backdrop-filter: blur(20px);
    display: none;
    max-height: 80vh;
    overflow-y: auto;
    min-width: 280px;
    z-index: 1500;
    box-shadow: var(--shadow-3);
}

#dev-panel.visible {
    display: block;
}

.dev-control {
    margin-bottom: var(--space-3);
}

.dev-label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--space-1);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wider);
    font-weight: var(--font-weight-medium);
}

.dev-input {
    width: 100%;
    padding: 6px 10px;
    background: var(--surface-02);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--font-size-sm);
}

/* ========== KEYBOARD HINTS ========== */
#keyboard-hints {
    position: fixed;
    bottom: 60px;
    left: var(--space-5);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-02);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: var(--font-size-xs);
    line-height: var(--line-height-normal);
    backdrop-filter: blur(12px);
    max-width: 200px;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: var(--shadow-1);
}

#keyboard-hints.visible {
    opacity: 1;
}

.hint-key {
    display: inline-block;
    padding: 2px 6px;
    background: var(--surface-03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--font-size-xs);
    color: var(--text-primary);
    margin: 0 2px;
}

/* ========== ACCESSIBILITY ========== */
.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;
}

/* ========== SCROLLER FONTS ========== */
@font-face {
    font-family: 'Cardinal Fruit';
    src: url('../Scroller/CardinalFruit.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Antarctican Mono';
    src: url('../Scroller/AntarcticanMono.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ========== SCROLLER CONTAINER ========== */
#scroller-container {
    position: fixed;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: translate(-50%, -50%);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    overflow: visible;
}

#scroller-container.visible {
    pointer-events: auto;
}

/* Disable text selection on all scroller elements */
#scroller-container *,
#scroller-container *::before,
#scroller-container *::after {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* ========== SCROLLER MACHINE ========== */
.scroller-machine {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    position: relative;
    overflow: visible;
}

.scroller-reel {
    height: 180px;
    overflow-y: scroll;
    scroll-snap-type: y proximity;
    scrollbar-width: none;
    scroll-behavior: smooth;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-overflow-scrolling: touch;
    will-change: scroll-position;
    touch-action: pan-y; /* Enable vertical scrolling on touch */
    overscroll-behavior: contain; /* Prevent scroll chaining */
}

.scroller-reel::-webkit-scrollbar { 
    display: none; 
}

.scroller-year-reel { width: 70px; }
.scroller-month-reel { width: 60px; }
.scroller-content-reel { width: 450px; }

.scroller-reel-padding {
    height: 60px;
}

/* ========== SCROLLER ITEMS ========== */
.scroller-item {
    min-height: 60px;
    display: block;
    padding: 10px 5px;
    scroll-snap-align: center;
    opacity: 0.4;
    transition: opacity 0.2s ease-out;
}

.scroller-item.active {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

.scroller-item:not(.active):hover {
    opacity: 0.6;
}

/* Hide native cursor on all scroller elements on desktop - must be very aggressive */
#scroller-container {
    cursor: none !important;
}

#scroller-container *,
#scroller-container *::before,
#scroller-container *::after,
#scroller-container a,
#scroller-container a:link,
#scroller-container a:visited,
#scroller-container a:hover,
#scroller-container a:active,
#scroller-container .scroller-item,
#scroller-container .scroller-item:hover,
#scroller-container .scroller-reel,
#scroller-container .scroller-text,
#scroller-container .scroller-content-text,
#scroller-container .scroller-content-text a,
#scroller-container .scroller-content-text a:hover {
    cursor: none !important;
}

/* Show default cursor on mobile for scroller */
@media (hover: none) and (pointer: coarse) {
    #scroller-container {
        opacity: 0;
        transition: opacity 1s ease;
    }
    
    #scroller-container.mobile-visible {
        opacity: 1;
    }
    
    #scroller-container,
    #scroller-container *,
    #scroller-container a,
    #scroller-container a:hover {
        cursor: auto !important;
    }
}

.scroller-year-reel .scroller-item { text-align: right; }
.scroller-month-reel .scroller-item { text-align: center; }
.scroller-content-reel .scroller-item { text-align: left; }

/* ========== SCROLLER TEXT ========== */
.scroller-text {
    font-family: 'JetBrains Mono', 'Antarctican Mono', monospace;
    font-size: 13px;
    color: #808080;
}

.scroller-item.active .scroller-text { 
    color: #FFFFFF;
}

.scroller-month-text { 
    text-transform: uppercase; 
}

.scroller-content-text {
    line-height: 1.5;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.scroller-content-text a {
    color: #ffffff;
    text-decoration: none;
    border-bottom: 1.5px solid #666666;
    cursor: none !important;
}

.scroller-content-text a:hover { 
    border-bottom-color: #ffffff;
    cursor: none !important; 
}

/* ========== SCROLLER LIVE DOT ========== */
.scroller-live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #00FF00;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    animation: scrollerPulse 2s ease-in-out infinite;
}

@keyframes scrollerPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ========== SCROLLER METRICS ========== */
.scroller-metric {
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
}

.scroller-metric.visible {
    opacity: 1;
}

/* ========== SCROLLER SCROLL TOP BUTTON ========== */
.scroller-scroll-top-btn {
    position: absolute;
    left: -35px;
    top: 70px;
    width: 20px;
    height: 20px;
    background: #0d0d0d;
    border: 1px solid #808080;
    color: #808080;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    cursor: none !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroller-scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroller-scroll-top-btn:hover {
    color: #ffffff;
    border-color: #ffffff;
}

/* ========== SCROLLER HEADER ========== */
.scroller-header-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    max-width: 635px;
    margin-bottom: 30px;
    margin-left: 17.5px;
    position: relative;
    overflow: visible;
}

.scroller-name {
    font-family: 'Mitashi-Classic', serif;
    font-size: 36px;
    font-weight: normal;
    color: #FFFFFF;
    margin-left: -52.5px;
}

.scroller-copyright {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    vertical-align: super;
    margin-left: 2px;
}

.scroller-footer {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #808080;
    flex-shrink: 0;
}

.scroller-email {
    color: #808080;
    text-decoration: none;
    transition: color 0.2s ease;
}

.scroller-email:hover {
    color: #ffffff;
}

.scroller-footer-links {
    margin-top: 2px;
}

.scroller-footer a {
    color: #808080;
    text-decoration: none;
    margin-left: 8px;
    transition: color 0.2s ease;
}

.scroller-footer a:hover {
    color: #ffffff;
}

/* ========== MOBILE OPTIMIZATIONS ========== */
@media (max-width: 768px) {
    /* Canvas visible on mobile with horizontal photo layout */
    #canvas {
        opacity: 1;
        pointer-events: auto;
    }
    
    /* Hide cursor canvas on mobile */
    #cursor-canvas {
        display: none !important;
    }
    
    /* Mobile-optimized scroller - FORCE visible and centered */
    #scroller-container {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        opacity: 0;
        pointer-events: none;
        z-index: 200 !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition: opacity 1s ease;
        overflow: visible !important;
        clip-path: inset(0 0 3px 0);
    }
    
    #scroller-container.mobile-visible {
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    .scroller-reel {
        touch-action: pan-y;
        scroll-snap-type: y mandatory; /* Stricter snap on mobile */
    }
    
    .scroller-item {
        min-height: 60px; /* Must match ITEM_H in JavaScript */
        padding: 12px 8px;
    }
    
    /* Category Filter */
    #category-filter {
        display: flex !important;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding: var(--space-3) var(--space-4);
        gap: var(--space-2);
        max-width: 100vw;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    #category-filter::-webkit-scrollbar {
        display: none;
    }
    
    .category-btn {
        flex-shrink: 0;
        scroll-snap-align: start;
        white-space: nowrap;
    }
    
    #keyboard-hints,
    #dev-panel {
        display: none !important;
    }
    
    /* Hide minimap on mobile - scroller is main focus */
    #minimap {
        display: none;
    }
    
    /* Hide zoom indicator on mobile */
    #zoom-indicator {
        display: none;
    }

    /* Scroller adjustments - larger and responsive */
    .scroller-machine {
        gap: 15px;
        transform: scale(1);
        max-width: 95vw;
        overflow: visible;
    }
    .scroller-year-reel { width: 15vw; min-width: 55px; max-width: 80px; }
    .scroller-month-reel { width: 12vw; min-width: 45px; max-width: 65px; }
    .scroller-content-reel { width: 55vw; min-width: 200px; max-width: 350px; }
    .scroller-reel { height: 200px; overflow-y: scroll; }
    .scroller-text { font-size: 12px; }
    
    .scroller-header-container {
        padding: 0;
        margin-bottom: 25px;
        margin-left: 0;
        max-width: 100%;
    }
    .scroller-name {
        font-size: 30px;
        margin-left: 0;
    }
    .scroller-copyright {
        font-size: 14px;
    }
    .scroller-footer {
        font-size: 10px;
    }
    .scroller-scroll-top-btn {
        left: 50%;
        transform: translateX(-50%);
        top: auto;
        bottom: -35px;
    }
}

@media (max-width: 480px) {
    /* Mobile photo bar adjustments */
    #mobile-photo-bar {
        height: 85px;
    }
    
    #mobile-photo-track {
        padding: 10px 15px;
        gap: 10px;
    }
    
    .mobile-photo-item {
        width: 60px;
        height: 60px;
        border-radius: 6px;
    }
    
    /* Category filter - hide on very small screens */
    #category-filter {
        display: none !important;
    }
    
    /* Scroller - responsive for small phones */
    .scroller-machine {
        gap: 10px;
        transform: scale(1);
        max-width: 98vw;
    }
    .scroller-year-reel { width: 14vw; min-width: 45px; }
    .scroller-month-reel { width: 12vw; min-width: 38px; }
    .scroller-content-reel { width: 60vw; min-width: 180px; }
    .scroller-text { font-size: 11px; }
    .scroller-reel {
        height: 180px;
    }
    .scroller-reel-padding {
        height: 60px;
    }
    .scroller-item {
        min-height: 60px;
    }
    
    .scroller-header-container {
        margin-bottom: 20px;
    }
    .scroller-name {
        font-size: 26px;
    }
    .scroller-copyright {
        font-size: 13px;
    }
    .scroller-footer {
        font-size: 9px;
    }
    .scroller-scroll-top-btn {
        left: 50%;
        transform: translateX(-50%);
        top: auto;
        bottom: -30px;
        width: 18px;
        height: 18px;
        font-size: 9px;
    }
}

/* ========== REDUCED MOTION SUPPORT ========== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .scroller-reel {
        scroll-behavior: auto !important;
    }
    
    .scroller-live-dot {
        animation: none !important;
    }
}
