/* ========================================
   recycle.auction — styles.css
   Glitch-as-renewal auction catalog
   ======================================== */

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

:root {
    --void-black: #0a0a0a;
    --panel-dark: #1a1a1a;
    --border-gray: #2e2e2e;
    --text-muted: #6b6b6b;
    --text-primary: #c8c8c8;
    --text-bright: #e8e8e8;
    --glitch-white: #f5f5f5;
    --glitch-cyan: #00f5f5;
    --glitch-magenta: #f500f5;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void-black);
    color: var(--text-primary);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* === CRT Scan Lines === */
#scanlines {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.08) 2px,
        rgba(0,0,0,0.08) 4px
    );
    opacity: 0;
    transition: opacity 0.4s ease;
}

#scanlines.active {
    opacity: 1;
}

/* === Glitch Strip === */
#glitch-strip {
    position: fixed;
    left: 0;
    right: 0;
    height: 30px;
    z-index: 9998;
    pointer-events: none;
    opacity: 0;
    background: var(--void-black);
    mix-blend-mode: difference;
}

/* === Opening Overlay === */
#opening-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--void-black);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease;
}

#opening-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#opening-text {
    text-align: center;
}

.opening-line {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-bright);
    clip-path: inset(0 100% 0 0);
    transition: none;
}

.opening-line.reveal {
    animation: lineReveal 0.6s ease-out forwards;
}

@keyframes lineReveal {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0 0% 0 0); }
}

/* === Dashboard Grid === */
#dashboard {
    display: grid;
    grid-template-columns: 1fr 2.4fr 0.8fr;
    min-height: 100vh;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#dashboard.visible {
    opacity: 1;
}

/* === Left Column: Index === */
#index-column {
    background: var(--panel-dark);
    padding: 2rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    /* Border animate */
    background-image: linear-gradient(var(--border-gray), var(--border-gray));
    background-position: right top;
    background-repeat: no-repeat;
    background-size: 0px 100%;
    transition: background-size 0.8s ease;
}

#index-column.border-drawn {
    background-size: 1px 100%;
}

.site-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--text-muted);
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    position: absolute;
    left: 0.5rem;
    top: 2rem;
    height: auto;
}

#lot-counter {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-left: 1.5rem;
}

.counter-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-transform: uppercase;
}

#current-lot-number {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.8rem;
    color: var(--text-bright);
    letter-spacing: 0.05em;
}

#index-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-left: 1.5rem;
    flex: 1;
}

.index-entry {
    display: flex;
    justify-content: space-between;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    padding: 0.2rem 0;
    border-bottom: 1px solid transparent;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.index-entry.active {
    color: var(--text-bright);
    border-bottom-color: var(--border-gray);
}

.lot-num, .lot-time {
    white-space: nowrap;
}

.lot-time {
    margin-left: 1rem;
}

#cycle-counter {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-left: 1.5rem;
}

#cycle-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* === Center Column: Stage === */
#stage {
    padding: 0 clamp(2rem, 4vw, 5rem);
}

/* === Lot Sections === */
.lot-section {
    min-height: 85vh;
    padding: 6rem 0;
    position: relative;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.lot-section.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Watermark recycling glyph */
.lot-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vmin;
    height: 60vmin;
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
}

.recycle-glyph {
    width: 100%;
    height: 100%;
    animation: glyphRotate 120s linear infinite;
}

@keyframes glyphRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes dashOffset {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: 24; }
}

.glyph-arrow {
    animation: dashOffset 3s linear infinite;
}

.glyph-arrow-2 { animation-delay: -1s; }
.glyph-arrow-3 { animation-delay: -2s; }

/* Lot header */
.lot-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.lot-number {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.8rem);
    font-variant: small-caps;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    white-space: nowrap;
}

.lot-rule {
    flex: 1;
    border: none;
    height: 1px;
    background: var(--border-gray);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 1.2s ease;
}

.lot-section.in-view .lot-rule {
    transform: scaleX(1);
}

/* Lot title */
.lot-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--text-bright);
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 1;
}

/* Lot image */
.lot-image {
    position: relative;
    margin-bottom: 2.5rem;
    z-index: 1;
    filter: grayscale(100%) contrast(1.2);
    overflow: hidden;
}

.lot-image::before,
.lot-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    background-size: cover;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.lot-image:hover::before {
    clip-path: polygon(0 15%, 100% 15%, 100% 25%, 0 25%);
    transform: translateX(8px);
    opacity: 0.7;
    mix-blend-mode: screen;
    background: var(--glitch-cyan);
}

.lot-image:hover::after {
    clip-path: polygon(0 60%, 100% 60%, 100% 72%, 0 72%);
    transform: translateX(-6px);
    opacity: 0.7;
    mix-blend-mode: multiply;
    background: var(--glitch-magenta);
}

.image-placeholder {
    width: 100%;
    max-width: 600px;
}

.image-placeholder svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Lot text */
.lot-description {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    max-width: 65ch;
    position: relative;
    z-index: 1;
}

.lot-condition {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.8rem);
    line-height: 1.5;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.lot-provenance {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(0.85rem, 1vw, 1rem);
    font-style: italic;
    font-weight: 300;
    line-height: 1.6;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

/* Section divider */
.section-divider {
    height: 40vh;
    display: flex;
    align-items: center;
}

.divider-rule {
    width: 100%;
    border: none;
    height: 1px;
    background: var(--border-gray);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 1.2s ease;
}

.divider-rule.drawn {
    transform: scaleX(1);
}

/* === Right Column: Log === */
#log-column {
    background: var(--panel-dark);
    padding: 2rem 1rem;
    overflow-y: auto;
    height: 100vh;
    position: sticky;
    top: 0;
    scrollbar-width: thin;
    scrollbar-color: #555 var(--panel-dark);
    /* Border animate */
    background-image: linear-gradient(var(--border-gray), var(--border-gray));
    background-position: left top;
    background-repeat: no-repeat;
    background-size: 0px 100%;
    transition: background-size 0.8s ease;
}

#log-column.border-drawn {
    background-size: 1px 100%;
}

.log-header {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-gray);
}

#log-entries {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.log-entry {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.6rem, 0.7vw, 0.72rem);
    line-height: 1.5;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.log-entry.visible {
    opacity: 1;
}

/* === Glitch text effect === */
.glitch-text {
    text-shadow: -2px 0 var(--glitch-cyan), 2px 0 var(--glitch-magenta);
}

/* === Global glitch shift === */
body.glitch-shift {
    transform: translateX(3px);
}

/* === Mobile Log Drawer === */
#mobile-log-drawer {
    display: none;
}

/* === Responsive === */
@media (max-width: 768px) {
    #dashboard {
        grid-template-columns: 1fr;
    }

    #index-column {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 40px;
        flex-direction: row;
        align-items: center;
        padding: 0 1rem;
        z-index: 100;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 1rem;
        background-size: 100% 0px;
        transition: background-size 0.8s ease;
    }

    #index-column.border-drawn {
        background-size: 100% 1px;
        background-position: left bottom;
    }

    .site-label {
        writing-mode: horizontal-tb;
        transform: none;
        position: static;
        font-size: 0.55rem;
    }

    #lot-counter {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        margin-left: 0;
    }

    #current-lot-number {
        font-size: 1rem;
    }

    #index-list {
        flex-direction: row;
        margin-left: 0;
        gap: 1rem;
    }

    .index-entry {
        flex-direction: column;
        gap: 0;
    }

    .lot-time { margin-left: 0; }

    #cycle-counter { display: none; }

    #stage {
        padding-top: 50px;
    }

    #log-column {
        display: none;
    }

    #mobile-log-drawer {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--panel-dark);
        z-index: 100;
        height: 32px;
        overflow: hidden;
        transition: height 0.3s ease;
        border-top: 1px solid var(--border-gray);
    }

    #mobile-log-drawer.expanded {
        height: 40vh;
    }

    #mobile-log-handle {
        font-family: 'IBM Plex Mono', monospace;
        font-size: 0.6rem;
        letter-spacing: 0.15em;
        color: var(--text-muted);
        text-transform: uppercase;
        padding: 0.5rem 1rem;
        cursor: pointer;
        text-align: center;
    }

    #mobile-log-content {
        padding: 0 1rem 1rem;
        overflow-y: auto;
        max-height: calc(40vh - 32px);
        font-family: 'IBM Plex Mono', monospace;
        font-size: 0.6rem;
        color: var(--text-muted);
        line-height: 1.5;
    }

    #scanlines {
        background: repeating-linear-gradient(
            0deg,
            transparent,
            transparent 1px,
            rgba(0,0,0,0.08) 1px,
            rgba(0,0,0,0.08) 2px
        );
    }

    .lot-section {
        min-height: auto;
        padding: 3rem 0;
    }

    .section-divider {
        height: 15vh;
    }

    .lot-watermark {
        width: 80vmin;
        height: 80vmin;
    }
}
