/* ============================================
   martiallaw.wiki — Styles
   Declassified Government Archive
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --archival-cream: #F2EDE4;
    --deep-olive: #2D3B2D;
    --gunmetal: #3A3A3A;
    --broadcast-black: #0A0A0A;
    --charcoal: #2C2C2C;
    --sage: #6B7B5E;
    --classification-red: #8B3A3A;
    --military-olive: #4A5D3A;
    --redaction-black: #1A1A1A;
    --alert-amber: #C4913A;

    --font-display: 'Archivo Black', sans-serif;
    --font-body: 'Special Elite', cursive;
    --font-mono: 'IBM Plex Mono', monospace;

    --masonry-gap: 12px;
    --masonry-columns: 4;
    --transition-standard: 0.4s ease-out;
    --transition-fast: 0.2s ease-out;
    --spotlight-size: 140px;
}

@media (max-width: 1024px) {
    :root {
        --masonry-columns: 3;
    }
}

@media (max-width: 640px) {
    :root {
        --masonry-columns: 1;
    }
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    color: var(--charcoal);
    background-color: var(--archival-cream);
    overflow-x: hidden;
    position: relative;
}

/* Carbon copy dot texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.05;
    background-image: radial-gradient(circle at 1px 1px, var(--charcoal) 1px, transparent 1px);
    background-size: 4px 4px;
}

/* --- Government Seal Watermark (fixed background) --- */
.seal-watermark-bg {
    position: fixed;
    top: 50%;
    right: 5%;
    width: 300px;
    height: 300px;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 0;
    opacity: 0.06;
    color: var(--sage);
}

/* --- Access Point Screen --- */
.access-point {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--broadcast-black);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    flex-direction: column;
    gap: 3rem;
    transition: opacity 0.8s ease-out;
}

/* Scanline overlay on access point */
.access-point::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.08) 0px,
        rgba(255, 255, 255, 0.08) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 1;
    animation: scanline-drift 0.2s linear infinite;
}

@keyframes scanline-drift {
    from { background-position-y: 0; }
    to { background-position-y: 3px; }
}

.seal-watermark {
    width: 200px;
    height: 200px;
    color: var(--sage);
    animation: seal-pulse 3s ease-in-out infinite;
    z-index: 2;
}

@keyframes seal-pulse {
    0%, 100% { opacity: 0.04; }
    50% { opacity: 0.08; }
}

.access-point-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.domain-title {
    font-family: var(--font-display);
    font-size: clamp(60px, 12vw, 120px);
    letter-spacing: 0.12em;
    color: var(--archival-cream);
    line-height: 0.95;
    font-weight: 400;
    text-transform: uppercase;
    margin-bottom: 2rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.access-prompt {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.06em;
    color: var(--archival-cream);
    animation: prompt-pulse 2s ease-in-out infinite;
}

@keyframes prompt-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* --- Filing Cabinet Navigation --- */
.filing-cabinet {
    position: fixed;
    left: 0;
    top: 0;
    width: 48px;
    height: 100%;
    background: linear-gradient(90deg, var(--gunmetal) 0%, #4A4A4A 100%);
    box-shadow: inset -2px 0 5px rgba(0, 0, 0, 0.3);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    gap: 8px;
    transition: width 0.3s ease-out, opacity 0.4s ease-out, transform 0.4s ease-out;
    overflow: hidden;
}

.filing-cabinet:hover {
    width: 240px;
}

.filing-tab {
    position: relative;
    padding: 12px 8px;
    background-color: rgba(0, 0, 0, 0.2);
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease-out;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-right: -8px;
}

.filing-tab::before {
    content: '';
    position: absolute;
    right: -8px;
    top: 0;
    width: 8px;
    height: 100%;
    background-color: var(--military-olive);
    clip-path: polygon(0 0, 100% 5%, 100% 95%, 0 100%);
}

.filing-tab:hover {
    background-color: rgba(0, 0, 0, 0.4);
    transform: translateX(8px);
}

.filing-tab-active {
    border-left-color: var(--classification-red);
    background-color: rgba(139, 58, 58, 0.15);
}

.tab-label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--archival-cream);
    text-transform: uppercase;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.filing-cabinet:hover .tab-label {
    writing-mode: horizontal-tb;
    transform: none;
    font-size: 13px;
}

.tab-description {
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--sage);
    display: none;
    line-height: 1.3;
}

.filing-cabinet:hover .tab-description {
    display: block;
}

/* --- Masonry Wall Container --- */
.masonry-wall {
    position: relative;
    margin-left: 48px;
    padding: 40px;
    display: grid;
    grid-template-columns: repeat(var(--masonry-columns), 1fr);
    gap: var(--masonry-gap);
    background: linear-gradient(135deg, var(--archival-cream) 0%, #FAF8F3 100%);
    transition: opacity 0.8s ease;
    --mouse-x: 50%;
    --mouse-y: 50%;
}

/* Cursor-follow spotlight effect */
.masonry-wall::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 8900;
    background: radial-gradient(
        circle var(--spotlight-size) at var(--mouse-x) var(--mouse-y),
        transparent 0%,
        rgba(0, 0, 0, 0.35) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.spotlight-active .masonry-wall::before {
    opacity: 1;
}

/* --- Tile Base Styles --- */
.tile {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--transition-standard), transform var(--transition-standard);
}

.tile.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Broadcast sections also animate in */
.broadcast-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--transition-standard), transform var(--transition-standard);
}

.broadcast-section.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Dossier Tile --- */
.dossier-tile {
    grid-column: span 1;
    background-color: var(--archival-cream);
    border: 1px solid #E5DDD0;
    padding: 24px;
    position: relative;
    min-height: 300px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background-image: radial-gradient(circle at 2px 2px, var(--charcoal) 0.5px, transparent 0.5px);
    background-size: 4px 4px;
}

/* Fold line */
.fold-line {
    position: absolute;
    top: 35%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #D9D0C0 50%, transparent 100%);
    opacity: 0.6;
    pointer-events: none;
}

/* Classification stamps */
.classified-stamp {
    position: absolute;
    top: 20px;
    left: 20px;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--classification-red);
    opacity: 0.5;
    text-transform: uppercase;
    z-index: 10;
    pointer-events: none;
}

/* File reference numbers */
.file-ref {
    position: absolute;
    bottom: 12px;
    left: 20px;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--sage);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.dossier-content {
    position: relative;
    z-index: 5;
}

.dossier-content h3 {
    font-family: var(--font-display);
    font-size: 18px;
    letter-spacing: 0.08em;
    color: var(--deep-olive);
    margin-bottom: 12px;
    text-transform: uppercase;
    line-height: 1;
}

.dossier-content p {
    text-align: justify;
    margin-bottom: 12px;
    font-size: 16px;
    line-height: 1.7;
    letter-spacing: 0.02em;
}

.indent {
    text-indent: 2em;
}

.indent-note {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--sage);
    text-align: center;
    margin-top: 1em;
    font-style: italic;
}

/* --- Evidence Tile --- */
.evidence-tile {
    background-color: var(--deep-olive);
    border: none;
    padding: 0;
    overflow: hidden;
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.evidence-wide {
    grid-column: 1 / -1;
}

.evidence-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.evidence-perforated {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 12px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 8px,
        var(--deep-olive) 8px,
        var(--deep-olive) 10px,
        transparent 10px,
        transparent 12px
    );
    background-position: 0 -6px;
    border-top: 1px dashed var(--military-olive);
    opacity: 0.6;
}

.evidence-label {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--sage);
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    text-align: center;
}

/* --- Broadcast Section --- */
.broadcast-section {
    grid-column: 1 / -1;
    background-color: var(--broadcast-black);
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    position: relative;
    padding: 60px 40px;
    animation: broadcast-brightness 4s ease-in-out infinite;
}

/* Scanline on broadcasts */
.broadcast-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.08) 0px,
        rgba(255, 255, 255, 0.08) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 1;
    animation: scanline-drift 0.2s linear infinite;
}

@keyframes broadcast-brightness {
    0%, 100% { filter: brightness(0.95); }
    50% { filter: brightness(1.05); }
}

.broadcast-text {
    font-family: var(--font-display);
    font-size: clamp(48px, 8vw, 96px);
    letter-spacing: 0.12em;
    color: var(--archival-cream);
    text-transform: uppercase;
    line-height: 0.95;
    text-align: center;
    position: relative;
    z-index: 2;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.broadcast-subtext {
    font-family: var(--font-mono);
    font-size: 16px;
    letter-spacing: 0.08em;
    color: var(--archival-cream);
    text-transform: uppercase;
    position: relative;
    z-index: 2;
}

.broadcast-subtext-small {
    font-size: 12px;
    opacity: 0.6;
    margin-top: -0.5rem;
}

/* Typewriter cursor */
.typewriter-cursor::after {
    content: '';
    display: inline-block;
    width: 0.6em;
    height: 1.05em;
    background-color: var(--alert-amber);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursor-blink 0.6s step-end infinite;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Redacted Tile --- */
.redacted-tile {
    grid-column: span 1;
    background-color: var(--archival-cream);
    border: 1px solid #E5DDD0;
    padding: 24px;
    position: relative;
    min-height: 250px;
}

.redacted-tile h3 {
    font-family: var(--font-display);
    font-size: 18px;
    letter-spacing: 0.08em;
    color: var(--deep-olive);
    margin-bottom: 16px;
    text-transform: uppercase;
}

.redacted-line {
    position: relative;
    margin-bottom: 12px;
    line-height: 1.8;
    min-height: 1.8em;
}

.redaction-bar {
    position: absolute;
    top: 0.1em;
    left: 0;
    height: 1.2em;
    background-color: var(--redaction-black);
    display: inline-block;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 2;
}

.hidden-text {
    opacity: 0;
    transition: opacity 0.8s ease 0.2s;
    position: relative;
    z-index: 1;
}

.redacted-tile.declassified .redaction-bar {
    transform: translateX(110%);
}

.redacted-tile.declassified .hidden-text {
    opacity: 1;
}

/* Staggered bar removal */
.redacted-tile.declassified .redacted-line:nth-child(2) .redaction-bar { transition-delay: 0ms; }
.redacted-tile.declassified .redacted-line:nth-child(3) .redaction-bar { transition-delay: 100ms; }
.redacted-tile.declassified .redacted-line:nth-child(4) .redaction-bar { transition-delay: 200ms; }
.redacted-tile.declassified .redacted-line:nth-child(5) .redaction-bar { transition-delay: 300ms; }
.redacted-tile.declassified .redacted-line:nth-child(6) .redaction-bar { transition-delay: 400ms; }
.redacted-tile.declassified .redacted-line:nth-child(7) .redaction-bar { transition-delay: 500ms; }

.redacted-tile.declassified .redacted-line:nth-child(2) .hidden-text { transition-delay: 200ms; }
.redacted-tile.declassified .redacted-line:nth-child(3) .hidden-text { transition-delay: 300ms; }
.redacted-tile.declassified .redacted-line:nth-child(4) .hidden-text { transition-delay: 400ms; }
.redacted-tile.declassified .redacted-line:nth-child(5) .hidden-text { transition-delay: 500ms; }
.redacted-tile.declassified .redacted-line:nth-child(6) .hidden-text { transition-delay: 600ms; }
.redacted-tile.declassified .redacted-line:nth-child(7) .hidden-text { transition-delay: 700ms; }

/* --- Filing Tab Tile --- */
.filing-tab-tile {
    grid-column: 1 / -1;
    background-color: var(--military-olive);
    padding: 16px 24px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(107, 123, 94, 0.12) 2px,
        rgba(107, 123, 94, 0.12) 4px
    );
}

.filing-tab-tile::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 40px;
    width: 120px;
    height: 8px;
    background-color: var(--military-olive);
    clip-path: polygon(0 0, 100% 20%, 100% 100%, 0 80%);
}

.filing-tab-label {
    font-family: var(--font-display);
    font-size: 14px;
    letter-spacing: 0.08em;
    color: var(--archival-cream);
    text-transform: uppercase;
    font-weight: 400;
}

.filing-tab-date {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--archival-cream);
    text-transform: uppercase;
    opacity: 0.8;
}

/* --- Scroll Progress Bar --- */
.scroll-progress {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 2px;
    background-color: var(--classification-red);
    z-index: 9999;
    opacity: 0.5;
    width: 0;
    transition: none;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .masonry-wall {
        padding: 30px;
    }

    .filing-cabinet {
        width: 40px;
    }

    .filing-cabinet:hover {
        width: 180px;
    }

    .tab-label {
        font-size: 10px;
    }

    .filing-cabinet:hover .tab-label {
        font-size: 12px;
    }

    .dossier-tile,
    .evidence-tile {
        min-height: 250px;
    }

    .broadcast-section {
        min-height: 40vh;
    }
}

@media (max-width: 640px) {
    .masonry-wall {
        margin-left: 0;
        padding: 20px;
        gap: 10px;
    }

    .filing-cabinet {
        width: 44px;
    }

    .filing-cabinet:hover {
        width: 44px;
        padding-right: 0;
    }

    .filing-tab::before {
        display: none;
    }

    .filing-tab {
        margin-right: 0;
    }

    .filing-cabinet:hover .tab-description {
        display: none;
    }

    .filing-cabinet:hover .tab-label {
        font-size: 11px;
        writing-mode: vertical-lr;
        transform: rotate(180deg);
    }

    .access-point {
        gap: 1.5rem;
    }

    .domain-title {
        font-size: 48px;
    }

    .dossier-tile,
    .evidence-tile {
        min-height: 200px;
        padding: 16px;
    }

    .dossier-content h3 {
        font-size: 16px;
    }

    .dossier-content p {
        font-size: 14px;
    }

    .broadcast-section {
        min-height: 30vh;
        padding: 40px 20px;
        gap: 1rem;
    }

    .broadcast-text {
        font-size: 36px;
    }

    .broadcast-subtext {
        font-size: 13px;
    }

    .filing-tab-tile {
        flex-direction: column;
        gap: 8px;
        padding: 12px 16px;
    }

    .filing-tab-label {
        font-size: 12px;
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Print --- */
@media print {
    .filing-cabinet,
    .masonry-wall::before,
    body::before,
    .seal-watermark-bg,
    .access-point,
    .scroll-progress {
        display: none !important;
    }

    .masonry-wall {
        margin-left: 0;
    }

    .tile {
        opacity: 1 !important;
        transform: none !important;
    }
}
