/* ===========================================
   ASSEMBLY BAY 07 — Android Builder
   Westworld meets Blade Runner
   =========================================== */

:root {
    --bg: #030508;
    --bg-card: #080c18;
    --bg-panel: #0a0f1e;
    --text: #8a9bc0;
    --text-bright: #d0d8ee;
    --text-muted: #5a6a8e;
    --border: #0f1a30;
    --border-light: #182848;

    --cyan: #00e5ff;
    --cyan-glow: rgba(0, 229, 255, 0.25);
    --cyan-dim: rgba(0, 229, 255, 0.08);
    --magenta: #ff3cac;
    --magenta-glow: rgba(255, 60, 172, 0.25);
    --magenta-dim: rgba(255, 60, 172, 0.08);
    --green: #00ff88;
    --green-glow: rgba(0, 255, 136, 0.2);
    --orange: #ff8844;
    --orange-glow: rgba(255, 136, 68, 0.2);
    --purple: #a855f7;
    --purple-glow: rgba(168, 85, 247, 0.25);
    --pink: #ff6b9d;
    --pink-glow: rgba(255, 107, 157, 0.2);
    --yellow: #ffe066;

    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    background: var(--bg);
    color: var(--text);
}

body {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    cursor: crosshair;
}

::selection { background: var(--cyan); color: #000; }

/* ===========================================
   SCANLINES OVERLAY
   =========================================== */
.scanlines {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}

/* ===========================================
   HERO
   =========================================== */
.hero {
    position: relative;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background:
        radial-gradient(ellipse 60% 50% at 50% 40%, rgba(0, 229, 255, 0.04) 0%, transparent 70%),
        var(--bg);
}

#hero-particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
}

.hero-badge {
    font-size: 0.8rem;
    letter-spacing: 0.5em;
    color: var(--cyan);
    margin-bottom: 2rem;
    opacity: 0.85;
}

/* Glitch title */
.glitch-title {
    font-family: 'Inter', sans-serif;
    font-size: clamp(2.5rem, 8vw, 6rem);
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1;
    position: relative;
    text-shadow: 0 0 40px rgba(0, 229, 255, 0.15);
}

.glitch-title::before,
.glitch-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.glitch-title::before {
    color: var(--cyan);
    z-index: -1;
    animation: glitch-1 3s infinite linear alternate-reverse;
}

.glitch-title::after {
    color: var(--magenta);
    z-index: -2;
    animation: glitch-2 2s infinite linear alternate-reverse;
}

@keyframes glitch-1 {
    0%, 90%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
    92% { clip-path: inset(20% 0 40% 0); transform: translate(-3px, 1px); }
    94% { clip-path: inset(60% 0 10% 0); transform: translate(3px, -1px); }
    96% { clip-path: inset(40% 0 30% 0); transform: translate(-2px, 2px); }
    98% { clip-path: inset(10% 0 70% 0); transform: translate(2px, -2px); }
}

@keyframes glitch-2 {
    0%, 88%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
    90% { clip-path: inset(50% 0 20% 0); transform: translate(4px, -1px); }
    93% { clip-path: inset(15% 0 55% 0); transform: translate(-4px, 2px); }
    96% { clip-path: inset(70% 0 5% 0); transform: translate(2px, 1px); }
}

.hero-sub {
    font-size: 0.95rem;
    font-weight: 300;
    color: var(--text);
    margin-top: 1.5rem;
    font-family: 'Inter', sans-serif;
    line-height: 1.8;
}

.hl-cyan { color: var(--cyan); font-weight: 600; }
.hl-magenta { color: var(--magenta); font-weight: 600; }

.hero-cta {
    margin-top: 3rem;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.hero-cta:hover { transform: translateY(-3px); }

.cta-text {
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    color: var(--cyan);
    border: 1px solid var(--cyan);
    padding: 0.6rem 2rem;
    border-radius: 4px;
    transition: background 0.3s, color 0.3s, box-shadow 0.3s;
}

.hero-cta:hover .cta-text {
    background: var(--cyan);
    color: #000;
    box-shadow: 0 0 30px var(--cyan-glow);
}

.cta-arrow {
    color: var(--cyan);
    animation: float 2s ease-in-out infinite;
    font-size: 1.2rem;
}

@keyframes float {
    0%, 100% { transform: translateY(0); opacity: 0.3; }
    50% { transform: translateY(6px); opacity: 1; }
}

/* ===========================================
   BUILD SECTION
   =========================================== */
.build-section {
    min-height: 100vh;
    padding: 4rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    background:
        radial-gradient(ellipse 50% 40% at 50% 30%, rgba(0, 229, 255, 0.02) 0%, transparent 70%),
        linear-gradient(180deg, var(--bg) 0%, #040710 50%, var(--bg) 100%);
}

.build-header {
    text-align: center;
    margin-bottom: 3rem;
}

.build-badge {
    font-size: 0.8rem;
    letter-spacing: 0.4em;
    color: var(--green);
    border: 1px solid rgba(0, 255, 136, 0.3);
    padding: 0.2rem 0.8rem;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 1rem;
}

.build-title {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
}

.build-sub {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 300;
    margin-top: 0.5rem;
}

/* Layout */
.build-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    width: 100%;
    max-width: 1000px;
    margin-bottom: 2rem;
}

@media (max-width: 800px) {
    .build-layout {
        flex-direction: column;
        gap: 2rem;
    }
    .parts-rack {
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center;
    }
    .part-tile {
        width: 140px !important;
    }
}

/* Parts rack */
.parts-rack {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex-shrink: 0;
}

.part-tile {
    width: 170px;
    padding: 0.8rem 1rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.3s, box-shadow 0.3s;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    user-select: none;
}

.part-tile:hover {
    transform: translateY(-2px) scale(1.02);
}

.part-tile[data-color="cyan"] { border-left: 3px solid var(--cyan); }
.part-tile[data-color="cyan"]:hover { box-shadow: 0 4px 20px var(--cyan-glow); border-color: var(--cyan); }
.part-tile[data-color="magenta"] { border-left: 3px solid var(--magenta); }
.part-tile[data-color="magenta"]:hover { box-shadow: 0 4px 20px var(--magenta-glow); border-color: var(--magenta); }
.part-tile[data-color="green"] { border-left: 3px solid var(--green); }
.part-tile[data-color="green"]:hover { box-shadow: 0 4px 20px var(--green-glow); border-color: var(--green); }
.part-tile[data-color="orange"] { border-left: 3px solid var(--orange); }
.part-tile[data-color="orange"]:hover { box-shadow: 0 4px 20px var(--orange-glow); border-color: var(--orange); }
.part-tile[data-color="pink"] { border-left: 3px solid var(--pink); }
.part-tile[data-color="pink"]:hover { box-shadow: 0 4px 20px var(--pink-glow); border-color: var(--pink); }
.part-tile[data-color="purple"] { border-left: 3px solid var(--purple); }
.part-tile[data-color="purple"]:hover { box-shadow: 0 4px 20px var(--purple-glow); border-color: var(--purple); }

.part-tile.installed {
    opacity: 0.25;
    pointer-events: none;
    transform: scale(0.95);
    border-color: var(--border) !important;
    box-shadow: none !important;
}

.part-icon {
    font-size: 0.8rem;
    font-weight: 800;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.part-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.part-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-bright);
}

.part-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===========================================
   ANDROID FIGURE
   =========================================== */
.android-frame {
    position: relative;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.android-head {
    width: 200px;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 50% 50% 30% 30% / 40% 40% 20% 20%;
    padding: 20px 15px 10px;
    position: relative;
    transition: border-color 0.5s, box-shadow 0.5s;
}

.head-inner {
    display: flex;
    gap: 2px;
    position: relative;
    margin-bottom: 12px;
}

.brain-zone {
    flex: 1;
    height: 64px;
    border: 1px dashed var(--border-light);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.5s ease;
}

.zone-label {
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    text-align: center;
    transition: color 0.5s;
}

.brain-left-zone.filled {
    border-color: var(--cyan);
    background: var(--cyan-dim);
    box-shadow: inset 0 0 20px var(--cyan-glow), 0 0 15px var(--cyan-glow);
}
.brain-left-zone.filled .zone-label { color: var(--cyan); }

.brain-right-zone.filled {
    border-color: var(--magenta);
    background: var(--magenta-dim);
    box-shadow: inset 0 0 20px var(--magenta-glow), 0 0 15px var(--magenta-glow);
}
.brain-right-zone.filled .zone-label { color: var(--magenta); }

/* Brain divider */
.brain-divider {
    width: 2px;
    background: var(--border-light);
    transition: background 0.5s, box-shadow 0.5s;
}

/* Neural bridge — shown when both halves installed */
.neural-bridge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.neural-bridge.active {
    display: flex;
}

.bridge-pulse {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 10px var(--cyan), 0 0 20px var(--magenta);
    animation: bridge-travel 1.5s ease-in-out infinite;
}

.bridge-pulse.p2 { animation-delay: 0.5s; }
.bridge-pulse.p3 { animation-delay: 1.0s; }

@keyframes bridge-travel {
    0% { left: 0; opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { left: calc(100% - 6px); opacity: 0; }
}

/* Eyes */
.eyes-row {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 5px;
}

.eye-zone {
    width: 30px;
    height: 20px;
    border: 1px dashed var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s;
    position: relative;
    overflow: hidden;
}

.eye-pupil {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    transition: background 0.5s, transform 0.1s;
    position: relative;
}

.eye-zone.filled {
    border-style: solid;
    background: rgba(0, 0, 0, 0.3);
}

#eye-left.filled {
    border-color: var(--green);
    box-shadow: 0 0 12px var(--green-glow);
}
#eye-left.filled .eye-pupil { background: var(--green); box-shadow: 0 0 8px var(--green); }

#eye-right.filled {
    border-color: var(--orange);
    box-shadow: 0 0 12px var(--orange-glow);
}
#eye-right.filled .eye-pupil { background: var(--orange); box-shadow: 0 0 8px var(--orange); }

/* Eye tracking */
.android-complete .eye-pupil {
    transition: transform 0.08s linear;
}

/* Jaw */
.android-jaw {
    width: 60%;
    height: 10px;
    margin: 5px auto 0;
    border-bottom: 1px solid var(--border-light);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    border-radius: 0 0 40% 40%;
    transition: border-color 0.5s;
}

/* Neck */
.android-neck {
    width: 40px;
    height: 20px;
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    transition: border-color 0.5s;
}

/* Torso */
.android-torso {
    width: 160px;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 10px 10px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.5s;
}

.torso-zone {
    height: 40px;
    border: 1px dashed var(--border-light);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s;
}

.identity-zone.filled {
    border-color: var(--purple);
    background: rgba(168, 85, 247, 0.08);
    box-shadow: inset 0 0 15px var(--purple-glow), 0 0 10px var(--purple-glow);
}
.identity-zone.filled .zone-label { color: var(--purple); }

.emotion-zone.filled {
    border-color: var(--pink);
    background: rgba(255, 107, 157, 0.08);
    box-shadow: inset 0 0 15px var(--pink-glow), 0 0 10px var(--pink-glow);
}
.emotion-zone.filled .zone-label { color: var(--pink); }

/* Android complete state */
.android-frame.complete .android-head {
    border-color: var(--cyan);
    box-shadow: 0 0 30px var(--cyan-glow), 0 0 60px rgba(0, 229, 255, 0.08);
}

.android-frame.complete .android-torso {
    border-color: var(--purple);
    box-shadow: 0 0 20px var(--purple-glow);
}

.android-frame.complete .android-neck {
    border-color: var(--cyan);
}

.android-frame.complete .android-jaw {
    border-color: var(--cyan);
}

.android-frame.complete .brain-divider {
    background: linear-gradient(180deg, var(--cyan), var(--magenta));
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* Status */
.android-status {
    margin-top: 1rem;
    text-align: center;
}

.status-text {
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    color: var(--text-muted);
    transition: color 0.5s, text-shadow 0.5s;
}

.android-frame.complete .status-text {
    color: var(--green);
    text-shadow: 0 0 12px var(--green-glow);
    animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===========================================
   DIAGNOSTICS BAR
   =========================================== */
.diagnostics {
    width: 100%;
    max-width: 600px;
    margin-top: 1rem;
}

.diag-bar {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.diag-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--cyan), var(--magenta), var(--green));
    border-radius: 2px;
    transition: width 0.6s ease;
}

.diag-readout {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
}

.diag-count { color: var(--text); }
.diag-status { color: var(--text-muted); }

/* ===========================================
   FLYING COMPONENT ANIMATION
   =========================================== */
.flying-part {
    position: fixed;
    z-index: 9000;
    pointer-events: none;
    transition: all 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
    border-radius: var(--radius);
    opacity: 0.9;
}

/* ===========================================
   BOOT TERMINAL
   =========================================== */
.boot-section {
    padding: 6rem 1.5rem;
    display: flex;
    justify-content: center;
    background:
        radial-gradient(ellipse 40% 40% at 50% 50%, rgba(0, 255, 136, 0.02) 0%, transparent 70%),
        var(--bg);
}

.terminal {
    width: 100%;
    max-width: 640px;
    background: #0a0a0a;
    border: 1px solid #1a1a2a;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: #111118;
    border-bottom: 1px solid #1a1a2a;
}

.term-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-r { background: #ff5f57; }
.dot-y { background: #ffbd2e; }
.dot-g { background: #28c840; }

.term-title {
    font-size: 0.8rem;
    color: #667;
    margin-left: 8px;
}

.terminal-body {
    padding: 16px 18px;
    min-height: 300px;
    font-size: 0.85rem;
    line-height: 1.8;
}

.term-line {
    color: var(--green);
    white-space: pre-wrap;
    opacity: 0;
    animation: term-appear 0.1s forwards;
}

.term-prompt { opacity: 1; animation: none; color: var(--text-muted); }

.term-line.status-ok { color: var(--cyan); }
.term-line.status-warn { color: var(--orange); }
.term-line.status-special { color: var(--magenta); }
.term-line.status-final {
    color: #fff;
    font-weight: 700;
    text-shadow: 0 0 15px var(--cyan-glow);
}

@keyframes term-appear {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* User messages */
.term-user {
    color: var(--text-bright) !important;
    opacity: 0.85;
}

/* Interactive input */
.term-input-row {
    display: flex;
    align-items: center;
    margin-top: 4px;
}

.term-input-prompt {
    color: var(--cyan);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.term-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    caret-color: var(--green);
    padding: 0;
    line-height: 1.8;
}

.term-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* ===========================================
   SPECS SECTION
   =========================================== */
.specs-section {
    padding: 6rem 1.5rem;
    background:
        radial-gradient(ellipse 50% 40% at 50% 50%, rgba(168, 85, 247, 0.03) 0%, transparent 60%),
        var(--bg);
}

.specs-inner {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.spec-badge {
    font-size: 0.8rem;
    letter-spacing: 0.4em;
    color: var(--purple);
    margin-bottom: 0.8rem;
}

.specs-title {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    font-weight: 800;
    color: #fff;
    margin-bottom: 3rem;
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

@media (max-width: 700px) {
    .spec-grid { grid-template-columns: repeat(2, 1fr); }
}

.spec-card {
    background: var(--bg-card);
    padding: 1.2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-align: left;
    transition: background 0.3s;
}

.spec-card:hover {
    background: var(--bg-panel);
}

.spec-label {
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.spec-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--cyan);
}

.spec-detail {
    font-size: 0.8rem;
    color: var(--text);
    line-height: 1.5;
}

/* ===========================================
   FOOTER
   =========================================== */
.footer {
    border-top: 1px solid var(--border);
    padding: 3rem 1.5rem;
    text-align: center;
}

.footer-line {
    font-size: 0.8rem;
    letter-spacing: 0.4em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.footer-sub {
    font-size: 0.85rem;
    color: #3a4a6e;
    font-style: italic;
}

.firstlight-link {
    display: inline-block;
    margin-top: 1.2rem;
    padding: 0.5rem 1.5rem;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.15em;
    color: #4a6a9e;
    border: 1px solid #1a2a4e;
    border-radius: 4px;
    text-decoration: none;
    transition: color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.firstlight-link:hover {
    color: #00e5ff;
    border-color: #00e5ff;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.15);
}

.footer-mcg {
    margin-top: 0.8rem;
    font-size: 0.75rem;
    color: #2a3a5e;
    letter-spacing: 0.1em;
}

/* ===========================================
   BURST CANVAS (particle effects)
   =========================================== */
#burst-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 8999;
    pointer-events: none;
}

/* ===========================================
   SCREEN FLASH
   =========================================== */
.screen-flash {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 9500;
    opacity: 0;
    pointer-events: none;
    animation: flash-anim 0.8s ease-out forwards;
}

@keyframes flash-anim {
    0% { opacity: 0.7; }
    100% { opacity: 0; }
}
