/* ============================================================
   parallel.day :: terminal-glass-marble
   Palette:
     #1A1614 obsidian marble (deep bg)
     #2A2420 smoked glass (panel surface)
     #4A3D33 warm luminance (border)
     #E8DDD0 cream parchment (primary text)
     #C4956A amber phosphor (heading accent)
     #A8B89A sage phosphor (terminal text)
     #C87D6A copper rose (error/warning)
     #8B7355 veined gold (marble vein highlight)
     #B8A99A warm dust (secondary)
     #6B6158 deep ash (dim metadata)
   ============================================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
    background: #1A1614;
}

body {
    font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
    background-color: #1A1614;
    background-image:
        radial-gradient(ellipse 1100px 700px at 12% 8%, rgba(139, 115, 85, 0.10), transparent 60%),
        radial-gradient(ellipse 900px 600px at 88% 22%, rgba(196, 149, 106, 0.06), transparent 60%),
        radial-gradient(ellipse 1200px 800px at 30% 68%, rgba(74, 61, 51, 0.30), transparent 70%),
        radial-gradient(ellipse 700px 500px at 80% 92%, rgba(139, 115, 85, 0.08), transparent 65%),
        linear-gradient(180deg, #1A1614 0%, #1F1A17 50%, #1A1614 100%);
    background-attachment: fixed;
    color: #E8DDD0;
    line-height: 1.75;
    font-size: 18px;
    letter-spacing: 0.015em;
    min-height: 100vh;
    position: relative;
}

/* ---------- Marble veining underlay -------------------------- */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        repeating-linear-gradient(
            107deg,
            transparent 0px,
            transparent 80px,
            rgba(139, 115, 85, 0.04) 81px,
            rgba(139, 115, 85, 0.06) 82px,
            transparent 84px,
            transparent 220px
        ),
        repeating-linear-gradient(
            73deg,
            transparent 0px,
            transparent 140px,
            rgba(74, 61, 51, 0.05) 142px,
            transparent 146px,
            transparent 320px
        ),
        radial-gradient(circle at 20% 30%, rgba(139, 115, 85, 0.04), transparent 30%),
        radial-gradient(circle at 70% 60%, rgba(196, 149, 106, 0.03), transparent 28%);
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: screen;
}

/* ---------- CRT scan lines ---------------------------------- */
.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 1px,
        rgba(26, 22, 20, 0.6) 1px,
        rgba(26, 22, 20, 0.6) 2px
    );
    opacity: 0.32;
    z-index: 100;
    mix-blend-mode: multiply;
}

/* ---------- Cursor trail container -------------------------- */
.cursor-trail {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 90;
}

.trail-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(232, 221, 208, 0.9), rgba(139, 115, 85, 0.6) 50%, rgba(74, 61, 51, 0.2) 100%);
    box-shadow: 0 0 6px rgba(196, 149, 106, 0.35);
    opacity: 0.85;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    pointer-events: none;
}

/* ---------- Right-side thread indicator --------------------- */
.thread-indicator {
    position: fixed;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 80;
}

.thread-led {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6B6158;
    box-shadow: 0 0 4px rgba(107, 97, 88, 0.4);
    transition: background 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
}

.thread-led.active {
    background: #A8B89A;
    box-shadow: 0 0 10px rgba(168, 184, 154, 0.6), 0 0 18px rgba(168, 184, 154, 0.25);
    transform: scale(1.15);
}

.thread-led.flash {
    background: #C87D6A !important;
    box-shadow: 0 0 12px rgba(200, 125, 106, 0.8) !important;
}

/* ---------- Persistent viewport cursor ---------------------- */
.viewport-cursor {
    position: fixed;
    bottom: 18px;
    left: 24px;
    z-index: 95;
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 12px;
    color: #C4956A;
    letter-spacing: 0.06em;
    text-shadow: 0 0 8px rgba(196, 149, 106, 0.4);
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0.9;
}

.cursor-prefix {
    opacity: 0.7;
}

.cursor-block {
    display: inline-block;
    width: 9px;
    height: 14px;
    background: #C4956A;
    box-shadow: 0 0 8px rgba(196, 149, 106, 0.45);
    animation: cursor-step 1.2s step-end infinite;
    vertical-align: middle;
}

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

/* ---------- Thread stack (main) ----------------------------- */
.thread-stack {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

/* ---------- Marble divider ---------------------------------- */
.marble-divider {
    position: relative;
    height: 8px;
    width: 100%;
    background:
        linear-gradient(90deg,
            transparent 0%,
            rgba(139, 115, 85, 0.5) 8%,
            rgba(74, 61, 51, 0.7) 22%,
            rgba(196, 149, 106, 0.4) 38%,
            rgba(74, 61, 51, 0.6) 52%,
            rgba(139, 115, 85, 0.5) 68%,
            rgba(74, 61, 51, 0.7) 82%,
            rgba(139, 115, 85, 0.4) 92%,
            transparent 100%),
        radial-gradient(ellipse 30% 100% at 20% 50%, rgba(139, 115, 85, 0.3), transparent),
        radial-gradient(ellipse 25% 100% at 60% 50%, rgba(196, 149, 106, 0.25), transparent),
        radial-gradient(ellipse 25% 100% at 85% 50%, rgba(139, 115, 85, 0.25), transparent),
        #2A2420;
    box-shadow:
        0 0 14px rgba(139, 115, 85, 0.15),
        inset 0 1px 0 rgba(196, 149, 106, 0.18),
        inset 0 -1px 0 rgba(26, 22, 20, 0.6);
    z-index: 11;
}

.marble-divider::before,
.marble-divider::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.marble-divider::before {
    background: repeating-linear-gradient(
        87deg,
        transparent 0px,
        transparent 18px,
        rgba(232, 221, 208, 0.06) 19px,
        transparent 21px,
        transparent 80px
    );
}

.marble-divider::after {
    background: repeating-linear-gradient(
        93deg,
        transparent 0px,
        transparent 40px,
        rgba(139, 115, 85, 0.1) 41px,
        transparent 44px,
        transparent 130px
    );
}

/* ---------- Shared thread panel ----------------------------- */
.thread {
    position: relative;
    min-height: 100vh;
    padding: 88px 96px 96px;
    display: flex;
    flex-direction: column;
    transition: transform 800ms cubic-bezier(0.22, 0.61, 0.36, 1), opacity 800ms ease;
}

.thread.offset-left {
    transform: translateX(-20px);
    opacity: 0;
}
.thread.offset-right {
    transform: translateX(20px);
    opacity: 0;
}
.thread.in-view {
    transform: translateX(0);
    opacity: 1;
}

/* Thread bar (top of each panel) */
.thread-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    font-family: "IBM Plex Mono", monospace;
    font-weight: 300;
    font-size: 11px;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6B6158;
    opacity: 0.85;
    margin-bottom: 36px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(74, 61, 51, 0.35);
}

.thread-bar .pid {
    color: #C4956A;
    text-shadow: 0 0 6px rgba(196, 149, 106, 0.3);
    opacity: 0.95;
}

.thread-bar .thread-label {
    color: #A8B89A;
    flex: 1;
}

.thread-bar .domain-mark {
    color: #B8A99A;
    opacity: 0.75;
}

/* Timestamp watermark */
.timestamp-watermark {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: "IBM Plex Mono", monospace;
    font-weight: 300;
    font-size: clamp(64px, 9vw, 120px);
    color: #2A2420;
    letter-spacing: 0.04em;
    opacity: 0.65;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    z-index: 1;
    text-shadow: 0 0 1px rgba(74, 61, 51, 0.5);
}

/* ---------- Two-column asymmetric grid ---------------------- */
.thread-grid {
    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: 58fr 38fr;
    gap: 0 4%;
    align-items: start;
    flex: 1;
}

.thread-grid.right-lead {
    grid-template-columns: 58fr 38fr;
}

/* ---------- Glass cards ------------------------------------- */
.glass-card {
    position: relative;
    background: rgba(42, 36, 32, 0.72);
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
    border: 1px solid rgba(196, 149, 106, 0.12);
    border-radius: 2px;
    padding: 44px 48px;
    box-shadow:
        inset 0 1px 0 rgba(232, 221, 208, 0.04),
        inset 0 0 0 1px rgba(74, 61, 51, 0.18),
        0 12px 40px rgba(10, 8, 6, 0.45),
        0 2px 6px rgba(196, 149, 106, 0.05);
    overflow: hidden;
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 700ms ease, transform 700ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.glass-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.primary-card {
    background: rgba(42, 36, 32, 0.78);
    backdrop-filter: blur(26px) saturate(125%);
    -webkit-backdrop-filter: blur(26px) saturate(125%);
}

.annotation-card {
    background: rgba(42, 36, 32, 0.45);
    backdrop-filter: blur(16px) saturate(115%);
    -webkit-backdrop-filter: blur(16px) saturate(115%);
    border: 1px solid rgba(168, 184, 154, 0.08);
    border-left: 2px solid #A8B89A;
    padding: 32px 30px;
    box-shadow:
        inset 0 1px 0 rgba(168, 184, 154, 0.05),
        0 6px 24px rgba(10, 8, 6, 0.38);
}

.error-card {
    border-left: 3px solid #C87D6A;
    background: rgba(42, 36, 32, 0.66);
}

/* Heading text */
.thread-title {
    font-family: "Libre Caslon Text", "Libre Caslon", Georgia, serif;
    font-weight: 400;
    font-size: clamp(30px, 3vw, 42px);
    line-height: 1.18;
    color: #C4956A;
    margin-bottom: 28px;
    letter-spacing: 0.005em;
    text-shadow: 0 0 12px rgba(196, 149, 106, 0.3);
    animation: amber-pulse 4s ease-in-out infinite;
}

@keyframes amber-pulse {
    0%, 100% {
        text-shadow: 0 0 10px rgba(196, 149, 106, 0.20);
    }
    50% {
        text-shadow: 0 0 14px rgba(196, 149, 106, 0.40), 0 0 22px rgba(196, 149, 106, 0.18);
    }
}

/* Body text */
.thread-body {
    font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.75;
    color: #E8DDD0;
    letter-spacing: 0.015em;
    margin-bottom: 18px;
    max-width: 60ch;
}

.thread-body.secondary {
    color: #B8A99A;
}

.thread-body:last-child {
    margin-bottom: 0;
}

/* Annotation lines */
.annotation-line {
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.65;
    color: #A8B89A;
    display: flex;
    gap: 14px;
    padding: 4px 0;
    border-bottom: 1px dashed rgba(168, 184, 154, 0.08);
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 500ms ease, transform 500ms ease;
}

.annotation-card.revealed .annotation-line {
    opacity: 1;
    transform: translateX(0);
}

.annotation-card.revealed .annotation-line:nth-child(1) { transition-delay: 0ms; }
.annotation-card.revealed .annotation-line:nth-child(2) { transition-delay: 90ms; }
.annotation-card.revealed .annotation-line:nth-child(3) { transition-delay: 180ms; }
.annotation-card.revealed .annotation-line:nth-child(4) { transition-delay: 270ms; }
.annotation-card.revealed .annotation-line:nth-child(5) { transition-delay: 360ms; }
.annotation-card.revealed .annotation-line:nth-child(6) { transition-delay: 450ms; }
.annotation-card.revealed .annotation-line:nth-child(7) { transition-delay: 540ms; }
.annotation-card.revealed .annotation-line:nth-child(8) { transition-delay: 630ms; }

.annotation-line:last-child {
    border-bottom: none;
}

.annotation-line .ts {
    flex-shrink: 0;
    color: #6B6158;
    font-weight: 300;
    letter-spacing: 0.04em;
}

.annotation-line .msg {
    color: #A8B89A;
}

.annotation-line.warn .msg {
    color: #C4956A;
    text-shadow: 0 0 4px rgba(196, 149, 106, 0.25);
}

.annotation-line.err {
    background: linear-gradient(90deg, rgba(200, 125, 106, 0.06), transparent 80%);
}

.annotation-line.err .msg {
    color: #C87D6A;
    text-shadow: 0 0 5px rgba(200, 125, 106, 0.3);
}

/* Reveal class baseline for all cards */
.reveal {
    opacity: 0;
    transform: translateY(18px);
}

/* Shake error animation -- triggered once per element */
@keyframes shake-error {
    0%   { transform: translateX(0); }
    14%  { transform: translateX(-3px); }
    28%  { transform: translateX(3px); }
    42%  { transform: translateX(-2.4px); }
    56%  { transform: translateX(2.2px); }
    70%  { transform: translateX(-1.6px); }
    84%  { transform: translateX(1px); }
    100% { transform: translateX(0); }
}

.shake-target.shaken {
    animation: shake-error 420ms cubic-bezier(0.22, 0.61, 0.36, 1) 1;
}

/* ---------- Marble vein corner decorations ------------------ */
.vein {
    position: absolute;
    width: 92px;
    height: 92px;
    pointer-events: none;
    overflow: visible;
    opacity: 0.7;
    z-index: 4;
}

.vein path {
    fill: none;
    stroke: #8B7355;
    stroke-width: 0.7;
    opacity: 0.55;
    stroke-linecap: round;
    stroke-dasharray: 240;
    stroke-dashoffset: 240;
    transition: stroke-dashoffset 800ms cubic-bezier(0.42, 0, 0.58, 1);
}

.glass-card.revealed .vein path,
.boot-glass.revealed .vein path,
.convergence.in-view .vein path {
    stroke-dashoffset: 0;
}

.vein-tl {
    top: -8px;
    left: -8px;
}

.vein-br {
    bottom: -8px;
    right: -8px;
}

/* ---------- Boot sequence section --------------------------- */
.boot-sequence {
    align-items: center;
    justify-content: center;
}

.boot-glass {
    position: relative;
    z-index: 5;
    width: min(880px, 100%);
    background: rgba(42, 36, 32, 0.62);
    backdrop-filter: blur(22px) saturate(120%);
    -webkit-backdrop-filter: blur(22px) saturate(120%);
    border: 1px solid rgba(196, 149, 106, 0.15);
    border-radius: 2px;
    padding: 52px 56px;
    box-shadow:
        inset 0 1px 0 rgba(232, 221, 208, 0.05),
        0 14px 50px rgba(10, 8, 6, 0.5);
    margin-top: 32px;
}

.boot-log {
    font-family: "IBM Plex Mono", monospace;
    font-size: 14px;
    line-height: 1.85;
    color: #A8B89A;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 360px;
    text-shadow: 0 0 4px rgba(168, 184, 154, 0.15);
}

.boot-log .l-amber { color: #C4956A; text-shadow: 0 0 6px rgba(196, 149, 106, 0.3); }
.boot-log .l-rose  { color: #C87D6A; text-shadow: 0 0 6px rgba(200, 125, 106, 0.3); }
.boot-log .l-dim   { color: #6B6158; }
.boot-log .l-cream { color: #E8DDD0; }

.boot-prompt {
    margin-top: 24px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 16px;
    color: #C4956A;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 8px rgba(196, 149, 106, 0.45);
}

.prompt-caret {
    font-weight: 500;
}

.prompt-blink {
    display: inline-block;
    width: 9px;
    height: 16px;
    background: #C4956A;
    animation: cursor-step 1.2s step-end infinite;
}

/* ---------- Convergence section ----------------------------- */
.convergence {
    align-items: center;
    justify-content: center;
    min-height: 110vh;
    padding-top: 120px;
    padding-bottom: 140px;
    overflow: hidden;
}

.convergence-stack {
    position: relative;
    width: min(900px, 100%);
    margin: 32px auto 0;
    height: 380px;
}

.conv-card {
    position: absolute;
    inset: 0;
    background: rgba(42, 36, 32, 0.55);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(196, 149, 106, 0.10);
    border-radius: 2px;
    padding: 48px 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: backdrop-filter 600ms ease, opacity 600ms ease, transform 600ms ease;
    will-change: backdrop-filter, opacity, transform;
}

.conv-card p {
    font-family: "Libre Caslon Text", Georgia, serif;
    font-size: clamp(22px, 2.4vw, 30px);
    line-height: 1.4;
    color: #E8DDD0;
    text-align: center;
    text-shadow: 0 0 10px rgba(196, 149, 106, 0.18);
}

.conv-c1 { transform: translate(-26px, -22px) rotate(-1.4deg); border-left: 2px solid #C4956A; }
.conv-c2 { transform: translate(18px, -10px) rotate(0.8deg); border-left: 2px solid #A8B89A; }
.conv-c3 { transform: translate(-14px, 16px) rotate(-0.6deg); border-left: 2px solid #C87D6A; }
.conv-c4 { transform: translate(22px, 26px) rotate(1deg); border-left: 2px solid #8B7355; }

.convergence-resolve {
    margin-top: 64px;
    text-align: center;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 800ms ease, transform 800ms ease;
}

.convergence.resolved .convergence-resolve {
    opacity: 1;
    transform: translateY(0);
}

.convergence.resolved .conv-card {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    background: rgba(42, 36, 32, 0.18);
}

.resolve-line {
    font-family: "IBM Plex Mono", monospace;
    font-size: 16px;
    color: #C4956A;
    letter-spacing: 0.06em;
    text-shadow: 0 0 10px rgba(196, 149, 106, 0.45);
    margin-bottom: 14px;
}

.resolve-sub {
    font-family: "Source Serif 4", Georgia, serif;
    font-style: italic;
    font-size: 17px;
    color: #B8A99A;
    letter-spacing: 0.02em;
}

/* ---------- Responsive -------------------------------------- */
@media (max-width: 1024px) {
    .thread {
        padding: 72px 56px 84px;
    }
    .glass-card {
        padding: 36px 36px;
    }
    .annotation-card {
        padding: 26px 24px;
    }
    .timestamp-watermark {
        font-size: clamp(54px, 11vw, 96px);
    }
}

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }
    .thread {
        padding: 64px 24px 80px;
        min-height: auto;
    }
    .thread-grid,
    .thread-grid.right-lead {
        grid-template-columns: 1fr;
        gap: 22px;
    }
    .thread-grid.right-lead .primary-card {
        order: 1;
    }
    .thread-grid.right-lead .annotation-card {
        order: 2;
    }
    .glass-card {
        padding: 30px 26px;
    }
    .primary-card {
        background: rgba(42, 36, 32, 0.85);
    }
    .annotation-card {
        background: rgba(42, 36, 32, 0.60);
        padding: 22px 20px;
    }
    .thread-title {
        font-size: clamp(26px, 6vw, 32px);
    }
    .thread-body {
        font-size: 16px;
    }
    .thread-bar {
        font-size: 10px;
        gap: 10px;
        flex-wrap: wrap;
        margin-bottom: 22px;
    }
    .thread-bar .domain-mark {
        display: none;
    }
    .thread.offset-left,
    .thread.offset-right {
        transform: translateX(0);
        opacity: 0;
    }
    .thread.in-view {
        opacity: 1;
    }
    .timestamp-watermark {
        font-size: clamp(40px, 12vw, 64px);
        top: 30%;
    }
    .boot-glass {
        padding: 32px 24px;
    }
    .boot-log {
        font-size: 12px;
        min-height: 280px;
    }
    .convergence-stack {
        height: 300px;
    }
    .conv-card {
        padding: 28px 26px;
    }
    .thread-indicator {
        right: 8px;
        gap: 10px;
    }
    .thread-led {
        width: 5px;
        height: 5px;
    }
    .viewport-cursor {
        font-size: 10px;
        left: 12px;
        bottom: 10px;
    }
}

@media (max-width: 480px) {
    .thread {
        padding: 52px 16px 64px;
    }
    .glass-card {
        padding: 24px 20px;
    }
    .thread-title {
        font-size: 24px;
    }
}

/* ---------- Reduced motion ---------------------------------- */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: opacity 200ms ease, transform 200ms ease !important;
    }
    .thread.offset-left,
    .thread.offset-right {
        transform: translateX(0);
    }
}
