/* ============================================
   martiallaw.quest - Glitch-Corrupted Archive
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.05vw, 1rem);
    line-height: 1.8;
    color: #1A1A2E;
    background-color: #FAFBFD;
    overflow-x: hidden;
}

/* --- Sidebar --- */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background-color: #F0F2F5;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 3rem 1.5rem 2rem;
    border-right: 1px solid #D0D4DC;
}

#sidebar-border-glitch {
    position: absolute;
    top: 0;
    right: -1px;
    width: 1px;
    height: 100%;
    background-color: #D0D4DC;
    z-index: 101;
}

#sidebar-border-glitch.glitching {
    width: 3px;
    right: -3px;
    background-color: #6B5ACD;
    transition: none;
}

/* --- Sidebar Brand --- */
#sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 3rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    align-self: center;
}

#brand-martial {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: #1A1A2E;
    letter-spacing: 0.05em;
    text-transform: lowercase;
}

#brand-quest {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: #6B5ACD;
    letter-spacing: 0.05em;
}

/* --- Sidebar Navigation --- */
#sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 2rem;
    writing-mode: horizontal-tb;
}

.nav-link {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    color: #555577;
    text-decoration: none;
    letter-spacing: 0.08em;
    padding: 0.3rem 0;
    transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #6B5ACD;
}

/* --- Sidebar Meta --- */
#sidebar-meta {
    margin-top: auto;
    writing-mode: horizontal-tb;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.meta-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    color: #D0D4DC;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.meta-value {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: #6B5ACD;
    letter-spacing: 0.1em;
}

/* --- Main Content --- */
#main-content {
    margin-left: 280px;
    min-height: 100vh;
}

/* --- Corrupted Hero --- */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: #FAFBFD;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.scan-lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#hero-text {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 2rem;
}

.glitch-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 8vw, 7rem);
    color: #1A1A2E;
    text-shadow: 2px 1px 0 rgba(107, 90, 205, 0.5);
    letter-spacing: 0.04em;
    line-height: 1;
}

/* Shake-error animation - triggers once on load */
@keyframes shakeError {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-2px, 1px); }
    20% { transform: translate(2px, -1px); }
    30% { transform: translate(-1px, 2px); }
    40% { transform: translate(1px, -2px); }
    50% { transform: translate(-2px, 0); }
    60% { transform: translate(2px, 1px); }
    70% { transform: translate(-1px, -1px); }
    80% { transform: translate(2px, 0); }
    90% { transform: translate(-1px, 1px); }
    100% { transform: translate(0, 0); }
}

.glitch-title.shake {
    animation: shakeError 0.2s ease-in-out 1;
}

#hero-subtitle {
    margin-top: 1.5rem;
    color: #555577;
    letter-spacing: 0.2em;
    font-size: 0.8rem;
}

.mono-text {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
}

/* --- Opening sequence scan-lines animation --- */
@keyframes scanDraw {
    0% { opacity: 0; transform: scaleX(0); }
    100% { opacity: 1; transform: scaleX(1); }
}

.scan-lines-svg rect.animating {
    animation: scanDraw 0.4s ease-out forwards;
    transform-origin: left center;
}

/* --- Archive Entries --- */
#archive-entries {
    padding: 4rem 6rem 4rem 5rem;
    max-width: 960px;
}

.archive-entry {
    position: relative;
    border-top: 1px solid #D0D4DC;
    padding: 3rem 0 4rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.archive-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Clip-path corruption on select entries */
.archive-entry:nth-child(3) {
    clip-path: inset(0 0 8% 0);
}

.archive-entry:nth-child(5) {
    clip-path: inset(0 0 5% 0);
}

/* --- Entry Header --- */
.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.5rem;
}

.entry-date {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: #1A1A2E;
    letter-spacing: 0.02em;
}

.entry-id {
    font-size: 0.8rem;
    color: #555577;
    letter-spacing: 0.1em;
}

/* --- Entry Content --- */
.entry-content {
    position: relative;
}

.entry-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: #1A1A2E;
    margin-bottom: 1.2rem;
    letter-spacing: 0.01em;
}

.entry-content p {
    margin-bottom: 1rem;
    color: #1A1A2E;
}

/* --- Redaction Blocks --- */
.redacted-line {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: #1A1A2E;
    letter-spacing: 0.02em;
    user-select: none;
    line-height: 1.4;
}

/* --- Accent Stripe --- */
.entry-accent-stripe {
    position: absolute;
    width: 3px;
    height: 40%;
    background-color: #6B5ACD;
    opacity: 0.3;
    top: 30%;
    left: -1.5rem;
    transition: opacity 0.2s ease;
}

.archive-entry.visible .entry-accent-stripe {
    animation: stripeFlash 0.2s ease-out 1;
}

@keyframes stripeFlash {
    0% { opacity: 0.8; }
    100% { opacity: 0.3; }
}

/* --- Static Footer --- */
#static-footer {
    position: relative;
    width: 100%;
    height: 40vh;
    background-color: #FAFBFD;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.static-noise-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#footer-text {
    position: relative;
    z-index: 2;
    font-size: 0.8rem;
    color: #555577;
    letter-spacing: 0.25em;
}

/* --- Angular Generative Art Container --- */
#angular-art-container {
    position: fixed;
    top: 0;
    left: 280px;
    width: calc(100% - 280px);
    height: 100%;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

/* --- Responsive adjustments --- */
@media (max-width: 900px) {
    #sidebar {
        width: 200px;
        padding: 2rem 1rem 1.5rem;
    }

    #main-content {
        margin-left: 200px;
    }

    #angular-art-container {
        left: 200px;
        width: calc(100% - 200px);
    }

    #archive-entries {
        padding: 3rem 3rem 3rem 2.5rem;
    }
}

@media (max-width: 640px) {
    #sidebar {
        width: 60px;
        padding: 1.5rem 0.5rem 1rem;
    }

    #sidebar-brand {
        writing-mode: vertical-rl;
        font-size: 0.9rem;
    }

    #brand-martial {
        font-size: 0.9rem;
    }

    #brand-quest {
        font-size: 0.9rem;
    }

    #sidebar-nav {
        display: none;
    }

    #sidebar-meta {
        display: none;
    }

    #main-content {
        margin-left: 60px;
    }

    #angular-art-container {
        left: 60px;
        width: calc(100% - 60px);
    }

    #archive-entries {
        padding: 2rem 1.5rem;
    }

    .entry-header {
        flex-direction: column;
        gap: 0.3rem;
    }
}
