/* ============================================================
   MasqproT.com - The Masquerade Protocol
   Brutalist Digital Fortress
   ============================================================ */

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

html {
    scroll-behavior: auto;
    font-size: 16px;
}

body {
    background-color: #F5F0E8;
    color: #1A0A0F;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.1vw, 1.05rem);
    line-height: 1.85;
    overflow-x: hidden;
    border-radius: 0;
}

/* === BACKGROUND CROSS-PATTERN TEXTURE === */
#bg-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cline x1='7' y1='6' x2='9' y2='6' stroke='%231A0A0F' stroke-width='1'/%3E%3Cline x1='8' y1='5' x2='8' y2='7' stroke='%231A0A0F' stroke-width='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* === PROTOCOL INITIALIZATION OVERLAY === */
#protocol-init {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #F5F0E8;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    padding: 60px;
    transition: opacity 0.3s linear;
}

#protocol-init.fade-out {
    opacity: 0;
    pointer-events: none;
}

#protocol-init.hidden {
    display: none;
}

.init-row {
    height: 28px;
    background: linear-gradient(90deg, #F5F0E8 25%, #E8DFD1 50%, #F5F0E8 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border: 1px solid #6B1D2A;
    opacity: 0;
    animation: shimmer 1.5s infinite, initFadeIn 0.3s forwards;
}

.init-row:nth-child(1) { animation-delay: 0s, 0s; }
.init-row:nth-child(2) { animation-delay: 0.1s, 0.15s; }
.init-row:nth-child(3) { animation-delay: 0.2s, 0.3s; }
.init-row:nth-child(4) { animation-delay: 0.3s, 0.45s; }
.init-row:nth-child(5) { animation-delay: 0.4s, 0.6s; }
.init-row:nth-child(6) { animation-delay: 0.5s, 0.75s; }
.init-row:nth-child(7) { animation-delay: 0.6s, 0.9s; }
.init-row:nth-child(8) { animation-delay: 0.7s, 1.05s; }

@keyframes initFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* === SKELETON SHIMMER === */
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === LEFT NAV STRIP === */
#nav-strip {
    position: fixed;
    left: 0;
    top: 0;
    width: 48px;
    height: 100vh;
    background-color: #6B1D2A;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    overflow: hidden;
}

.nav-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 20%;
    text-decoration: none;
    color: #F5F0E8;
    position: relative;
    overflow: hidden;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transition: width 0.2s linear, background-color 0.15s linear;
    cursor: pointer;
}

.nav-label:hover {
    width: 160px;
    background-color: #0D0508;
    writing-mode: horizontal-tb;
    text-orientation: initial;
}

.nav-code {
    display: none;
    font-size: 0.6rem;
    color: #C7923E;
    margin-right: 8px;
    writing-mode: horizontal-tb;
}

.nav-label:hover .nav-code {
    display: inline-block;
    animation: shimmer 1.5s 1;
    background: linear-gradient(90deg, #F5F0E8 25%, #C7923E 50%, #F5F0E8 75%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-text {
    writing-mode: vertical-rl;
}

.nav-label:hover .nav-text {
    writing-mode: horizontal-tb;
}

/* === MAIN CONTENT === */
#main-content {
    position: relative;
    z-index: 1;
    margin-left: 48px;
    padding: 0 40px 0 60px;
}

/* === HERO === */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 80px;
    padding-left: 20px;
}

#site-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(2.5rem, 7vw, 8rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #1A0A0F;
    line-height: 1;
    margin-bottom: 16px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s linear, transform 0.6s linear;
}

#site-title.revealed {
    opacity: 1;
    transform: translateY(0);
}

.subtitle {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(1rem, 2.5vw, 2rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #6B1D2A;
    margin-bottom: 32px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s linear 0.2s, transform 0.6s linear 0.2s;
}

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

#hero .data-channel {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.5625rem;
    color: #8A7E75;
    opacity: 0.4;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
}

/* === DATA CHANNEL BANDS === */
.data-channel-band {
    height: 24px;
    display: flex;
    align-items: center;
    overflow: hidden;
    margin: 20px 0;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s linear, transform 0.6s linear;
}

.data-channel-band.revealed {
    opacity: 1;
    transform: translateX(0);
}

.data-channel-band span {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.5625rem;
    color: #8A7E75;
    opacity: 0.4;
    white-space: nowrap;
    letter-spacing: 0.05em;
}

/* === PROTOCOL BLOCKS === */
.protocol-block {
    position: relative;
    margin-bottom: 80px;
    padding-right: 120px;
}

.protocol-block[data-offset="0"] {
    margin-left: 0;
}

.protocol-block[data-offset="1"] {
    margin-left: 60px;
}

.protocol-block[data-offset="2"] {
    margin-left: 120px;
}

.protocol-block[data-offset="3"] {
    margin-left: 80px;
}

.protocol-block[data-offset="4"] {
    margin-left: 40px;
}

.block-inner {
    position: relative;
    border: 2px solid #4A0E1B;
    padding: 48px;
    background-color: #F5F0E8;
}

/* === CORNER BRACKETS === */
.corner-bracket {
    position: absolute;
    width: 24px;
    height: 24px;
}

.corner-tl {
    top: -2px;
    left: -2px;
    border-top: 2px solid #1A0A0F;
    border-left: 2px solid #1A0A0F;
    opacity: 0;
    transition: opacity 0.1s linear;
}

.corner-br {
    bottom: -2px;
    right: -2px;
    border-bottom: 2px solid #1A0A0F;
    border-right: 2px solid #1A0A0F;
    opacity: 0;
    transition: opacity 0.1s linear;
}

.protocol-block.revealed .corner-tl,
.protocol-block.revealed .corner-br {
    opacity: 1;
}

/* === SKELETON LAYER === */
.skeleton-layer {
    position: absolute;
    top: 48px;
    left: 48px;
    right: 48px;
    bottom: 48px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 2;
    transition: clip-path 0.4s linear;
    clip-path: inset(0 0 0 0);
}

.protocol-block.content-revealed .skeleton-layer {
    clip-path: inset(0 0 0 100%);
}

.skeleton-bar {
    height: 18px;
    background: linear-gradient(90deg, #F5F0E8 25%, #E8DFD1 50%, #F5F0E8 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border: 1px solid #6B1D2A;
}

/* === BLOCK CONTENT === */
.block-content {
    position: relative;
    z-index: 1;
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transition: opacity 0.4s linear, clip-path 0.6s linear;
}

.protocol-block.content-revealed .block-content {
    opacity: 1;
    clip-path: inset(0 0 0 0);
}

.section-header {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1.5rem, 4vw, 3rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #1A0A0F;
    margin-bottom: 24px;
    line-height: 1.2;
}

.protocol-designation {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(0.7rem, 1.5vw, 1rem);
    color: #C7923E;
    letter-spacing: 0.2em;
    display: block;
    margin-bottom: 8px;
}

.block-content p {
    margin-bottom: 20px;
    max-width: 720px;
    color: #1A0A0F;
}

.emphasis-text {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #6B1D2A;
}

/* === MORSE RULE === */
.morse-rule {
    width: 100%;
    max-width: 400px;
    height: 2px;
    margin: 24px 0;
    background-image: repeating-linear-gradient(
        90deg,
        #4A0E1B 0px,
        #4A0E1B 4px,
        transparent 4px,
        transparent 16px
    );
    position: relative;
}

.morse-rule::before,
.morse-rule::after {
    content: '';
    position: absolute;
    top: -1px;
    width: 4px;
    height: 4px;
    background-color: #4A0E1B;
    border-radius: 0;
}

.morse-rule::before {
    left: 80px;
}

.morse-rule::after {
    left: 240px;
}

/* === LENS FLARE === */
.lens-flare {
    position: absolute;
    width: 160px;
    height: 160px;
    top: -40px;
    right: -40px;
    background: radial-gradient(circle, #FFFDF8 0%, transparent 70%);
    opacity: 0;
    z-index: 3;
    pointer-events: none;
    animation: flarePulse 3s ease-in-out infinite alternate;
    animation-play-state: paused;
}

.protocol-block.revealed .lens-flare {
    animation-play-state: running;
}

.lens-flare.burst {
    opacity: 0.6;
    transition: opacity 0.4s linear;
}

@keyframes flarePulse {
    0% { opacity: 0; }
    100% { opacity: 0.15; }
}

/* === WIREFRAME MASK SVG === */
.wireframe-mask {
    position: absolute;
    top: 40px;
    right: -80px;
    width: 180px;
    height: auto;
    z-index: 4;
    pointer-events: none;
}

.wireframe-mask polyline,
.wireframe-mask line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s linear;
}

.protocol-block.revealed .wireframe-mask polyline,
.protocol-block.revealed .wireframe-mask line {
    stroke-dashoffset: 0;
}

/* === REDACTED ZONE (permanently in skeleton state) === */
.redacted-zone {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px dashed #8A7E75;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.redacted-zone .skeleton-bar {
    height: 14px;
    opacity: 0.7;
}

/* === FOOTER === */
#site-footer {
    width: 100%;
    background-color: #0D0508;
    padding: 24px 48px 24px 108px;
    margin-top: 80px;
}

.footer-protocol {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.5625rem;
    color: #8A7E75;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* === SESSION TIMER === */
#session-timer {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1000;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: #8A7E75;
    letter-spacing: 0.05em;
    opacity: 0.6;
}

/* === RESPONSIVE ADJUSTMENTS === */
@media (max-width: 900px) {
    #main-content {
        padding: 0 20px 0 30px;
    }

    .protocol-block {
        padding-right: 20px;
    }

    .protocol-block[data-offset="1"],
    .protocol-block[data-offset="2"],
    .protocol-block[data-offset="3"],
    .protocol-block[data-offset="4"] {
        margin-left: 0;
    }

    .block-inner {
        padding: 24px;
    }

    .skeleton-layer {
        top: 24px;
        left: 24px;
        right: 24px;
        bottom: 24px;
    }

    .wireframe-mask {
        right: -40px;
        width: 120px;
        opacity: 0.5;
    }

    #nav-strip {
        width: 36px;
    }

    .nav-label {
        width: 36px;
        font-size: 0.55rem;
    }
}

@media (max-width: 600px) {
    #nav-strip {
        display: none;
    }

    #main-content {
        margin-left: 0;
        padding: 0 16px;
    }

    .wireframe-mask {
        display: none;
    }

    #hero {
        min-height: 80vh;
    }

    .block-inner {
        padding: 20px;
    }

    .skeleton-layer {
        top: 20px;
        left: 20px;
        right: 20px;
        bottom: 20px;
    }

    #site-footer {
        padding-left: 16px;
    }
}
