/* ═══════════════════════════════════════════════
   CDU INTERFACE — ZHANG YUHENG PERSONAL HOMEPAGE
   ═══════════════════════════════════════════════ */

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

:root {
    --bg: #080c10;
    --bg-alt: #0c1218;
    --bg-hl: #141e28;
    --bg-active: #1a2836;

    --green: #00ff41;
    --green-dim: #00cc33;
    --green-dark: #003d10;
    --amber: #ff8c00;
    --amber-dim: #b36200;
    --cyan: #00d4ff;
    --cyan-dim: #0099bb;
    --white: #d0d0d0;
    --white-dim: #707070;
    --red: #ff4444;

    --glow-green: 0 0 6px rgba(0,255,65,0.25);
    --glow-amber: 0 0 6px rgba(255,140,0,0.25);
    --glow-cyan: 0 0 6px rgba(0,212,255,0.25);

    --font: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
    --font-zh: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei UI', sans-serif;
    --fs: 15px;
    --lh: 1.72;
    --radius: 2px;
    --speed: 150ms;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: #000;
    color: var(--green);
    font-family: var(--font);
    font-size: var(--fs);
    line-height: var(--lh);
    -webkit-font-smoothing: antialiased;
}

html[data-lang="zh"] body {
    font-family: var(--font-zh);
    letter-spacing: 0.02em;
}

body {
    padding: 18px;
    background:
        radial-gradient(circle at top, rgba(0, 212, 255, 0.08), transparent 30%),
        radial-gradient(circle at bottom, rgba(255, 140, 0, 0.07), transparent 28%),
        #000;
}

/* ── Boot Screen ───────────────────────────── */
#boot-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10vh 8vw;
    transition: opacity 600ms ease;
}

#boot-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

#boot-log {
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
}

#boot-log .line-green { color: var(--green); }
#boot-log .line-amber { color: var(--amber); text-shadow: var(--glow-amber); }
#boot-log .line-dim { color: var(--white-dim); }
#boot-log .line-cyan { color: var(--cyan); }

#boot-skip {
    position: fixed;
    bottom: 24px;
    right: 32px;
    color: var(--white-dim);
    font-size: 11px;
    letter-spacing: 1px;
    animation: blink-slow 1.5s ease-in-out infinite;
}

/* ── CDU Container ─────────────────────────── */
#cdu {
    display: flex;
    flex-direction: column;
    width: min(100%, 900px);
    height: calc(100vh - 36px);
    height: calc(100dvh - 36px);
    margin: 0 auto;
    background: var(--bg);
    border: 1px solid rgba(0, 255, 65, 0.14);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.45) inset,
        0 24px 60px rgba(0, 0, 0, 0.45);
    transition: opacity 400ms ease;
}

#cdu.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ── Status Bar ────────────────────────────── */
#status-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    background: rgba(0,0,0,0.4);
    border-bottom: 1px solid var(--green-dark);
    min-height: 40px;
}

.status-left, .status-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: var(--glow-green);
    animation: pulse 2s ease-in-out infinite;
}

#page-label {
    color: var(--amber);
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 1px;
    text-shadow: var(--glow-amber);
}

#clock {
    color: var(--white-dim);
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 0.5px;
}

#lang-btn {
    background: rgba(0,212,255,0.1);
    border: 1px solid var(--cyan-dim);
    color: var(--cyan);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: var(--radius);
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all var(--speed);
}

#lang-btn:hover {
    background: rgba(0,212,255,0.2);
    border-color: var(--cyan);
}

/* ── Navigation Bar ────────────────────────── */
#nav-bar {
    flex: 0 0 auto;
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--green-dark);
}

#nav-bar::-webkit-scrollbar { display: none; }

.nav-tab {
    flex: 1 0 auto;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--white-dim);
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    padding: 10px 16px;
    cursor: pointer;
    transition: all var(--speed);
    white-space: nowrap;
    letter-spacing: 0.5px;
    position: relative;
}

.nav-tab:hover {
    color: var(--green-dim);
    background: rgba(0,255,65,0.03);
}

.nav-tab.active {
    color: var(--green);
    border-bottom-color: var(--green);
    background: rgba(0,255,65,0.06);
    text-shadow: var(--glow-green);
}

.nav-tab.focused {
    outline: 1px solid var(--cyan);
    outline-offset: -1px;
}

.key-hint {
    display: inline-block;
    font-size: 10px;
    color: var(--white-dim);
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    padding: 0 4px;
    margin-right: 5px;
    font-weight: 400;
    vertical-align: middle;
    line-height: 16px;
}

.nav-tab.active .key-hint {
    color: var(--green-dim);
    background: rgba(0,255,65,0.1);
}

/* ── Content Area ──────────────────────────── */
#content {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 28px 40px 24px;
    outline: none;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--green-dark) transparent;
    transition: opacity var(--speed) ease;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
}

#content::-webkit-scrollbar { width: 4px; }
#content::-webkit-scrollbar-track { background: transparent; }
#content::-webkit-scrollbar-thumb {
    background: var(--green-dark);
    border-radius: 2px;
}
#content::-webkit-scrollbar-thumb:hover { background: var(--green-dim); }

#content.transitioning { opacity: 0.2; }

/* ── Content Elements ──────────────────────── */
.page-title {
    color: var(--amber);
    font-size: 1.56em;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: var(--glow-amber);
    margin-bottom: 2px;
}

.title-sub {
    color: var(--white-dim);
    font-size: 0.95em;
    font-weight: 300;
    margin-bottom: 4px;
}

.title-separator {
    height: 2px;
    background: linear-gradient(90deg, var(--amber), var(--green-dark), transparent);
    margin-bottom: 16px;
}

.cdu-section {
    margin-bottom: 20px;
}

.section-header {
    color: var(--amber-dim);
    font-size: 1em;
    font-weight: 500;
    letter-spacing: 1px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--green-dark);
    margin-bottom: 10px;
}

.data-row {
    display: flex;
    align-items: baseline;
    padding: 3px 0;
    gap: 8px;
}

.data-label {
    color: var(--white-dim);
    white-space: nowrap;
    font-weight: 300;
    font-size: 0.98em;
    flex-shrink: 0;
}

.data-dots {
    flex: 1;
    border-bottom: 1px dotted var(--green-dark);
    min-width: 16px;
    position: relative;
    top: -3px;
}

.data-value {
    color: var(--green);
    white-space: nowrap;
    font-weight: 400;
}

.data-value.amber { color: var(--amber); text-shadow: var(--glow-amber); }
.data-value.cyan { color: var(--cyan); }
.data-value.white { color: var(--white); }
.data-value.dim { color: var(--white-dim); }

.profile-text {
    color: var(--white);
    font-weight: 300;
    font-size: 1em;
    margin-bottom: 10px;
    line-height: 1.8;
}

.cdu-list-item {
    color: var(--white);
    padding: 3px 0 3px 18px;
    position: relative;
    font-weight: 300;
    font-size: 0.98em;
}

.cdu-list-item::before {
    content: '▸';
    position: absolute;
    left: 2px;
    color: var(--cyan);
}

.cdu-list-item.green::before { color: var(--green); }

/* ── Skill Bars ────────────────────────────── */
.skill-row {
    display: flex;
    align-items: center;
    padding: 3px 0;
    gap: 12px;
}

.skill-name {
    color: var(--white);
    font-weight: 400;
    width: 126px;
    flex-shrink: 0;
    font-size: 0.98em;
}

.skill-bar {
    font-family: var(--font);
    letter-spacing: 1px;
    font-size: 0.98em;
}

.skill-filled { color: var(--green); text-shadow: var(--glow-green); }
.skill-empty { color: #1a2a1a; }

/* ── Project Items ─────────────────────────── */
.project-item {
    border: 1px solid var(--green-dark);
    border-radius: var(--radius);
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color var(--speed);
    overflow: hidden;
}

.project-item:hover, .project-item:focus {
    border-color: var(--cyan-dim);
    outline: none;
}

.project-item.expanded {
    border-color: var(--green-dim);
}

.project-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
}

.project-marker { font-size: 0.85em; }
.project-marker.active { color: var(--green); }
.project-marker.done { color: var(--white-dim); }
.project-marker.event { color: var(--cyan); }

.project-status {
    font-size: 0.8em;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.project-status.active { color: var(--green); }
.project-status.done { color: var(--white-dim); }
.project-status.event { color: var(--cyan); }

.project-name {
    color: var(--white);
    font-weight: 400;
    font-size: 1em;
    flex: 1;
}

.project-toggle {
    color: var(--white-dim);
    transition: transform 200ms ease;
    font-size: 0.85em;
}

.project-item.expanded .project-toggle {
    transform: rotate(90deg);
    color: var(--green);
}

.project-summary {
    padding: 0 16px 12px 16px;
    font-size: 0.93em;
    color: var(--white-dim);
    font-weight: 300;
}

.project-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 350ms ease;
}

.project-item.expanded .project-detail {
    max-height: 600px;
}

.detail-content {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--green-dark);
    font-size: 0.96em;
}

.detail-content p {
    color: var(--white);
    font-weight: 300;
    margin-bottom: 8px;
    line-height: 1.6;
}

.detail-list {
    margin: 6px 0 10px;
}

.detail-list .list-item {
    color: var(--white);
    font-weight: 300;
    padding: 2px 0;
    font-size: 0.95em;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag {
    background: rgba(0,212,255,0.08);
    border: 1px solid rgba(0,212,255,0.2);
    color: var(--cyan);
    font-size: 0.8em;
    padding: 1px 8px;
    border-radius: var(--radius);
    font-weight: 400;
}

/* ── Research Countdown ────────────────────── */
.countdown-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(255,140,0,0.08);
    border: 1px solid rgba(255,140,0,0.25);
    border-radius: var(--radius);
    color: var(--amber);
    font-weight: 500;
    font-size: 0.92em;
    margin-top: 6px;
}

.countdown-box .cd-icon {
    font-size: 0.85em;
}

.paper-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius);
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.paper-badge.prep {
    background: rgba(255,140,0,0.15);
    border: 1px solid var(--amber-dim);
    color: var(--amber);
}

/* ── Work History Timeline ─────────────────── */
.timeline-item {
    position: relative;
    padding-left: 20px;
    margin-bottom: 16px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 8px;
    bottom: -16px;
    width: 1px;
    background: var(--green-dark);
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-item .tl-dot {
    position: absolute;
    left: 0;
    top: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: var(--glow-green);
}

.timeline-item .tl-dot.past {
    background: var(--white-dim);
    box-shadow: none;
}

.timeline-org {
    color: var(--white);
    font-weight: 500;
    font-size: 1em;
}

.timeline-role {
    color: var(--cyan);
    font-size: 0.94em;
    font-weight: 300;
}

.timeline-date {
    color: var(--white-dim);
    font-size: 0.9em;
    font-weight: 300;
}

.timeline-desc {
    margin-top: 4px;
}

/* ── Education Box ─────────────────────────── */
.edu-box {
    border: 1px solid var(--green-dark);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 12px;
}

.edu-box .edu-name {
    color: var(--green);
    font-weight: 500;
    font-size: 1em;
    text-shadow: var(--glow-green);
}

.edu-box .edu-major {
    color: var(--white);
    font-weight: 300;
    font-size: 0.98em;
}

.edu-box .edu-date {
    color: var(--white-dim);
    font-size: 0.92em;
    font-weight: 300;
}

/* ── Contact Links ─────────────────────────── */
.link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--green-dark);
    border-radius: var(--radius);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all var(--speed);
    text-decoration: none;
}

.link-item:hover, .link-item:focus {
    border-color: var(--cyan);
    background: rgba(0,212,255,0.04);
    outline: none;
}

.link-num {
    color: var(--cyan);
    font-size: 0.85em;
    font-weight: 500;
    min-width: 24px;
}

.link-label {
    color: var(--white-dim);
    font-weight: 300;
    font-size: 0.98em;
    min-width: 80px;
}

.link-value {
    color: var(--cyan);
    font-weight: 400;
    font-size: 0.98em;
}

.link-arrow {
    margin-left: auto;
    color: var(--white-dim);
    font-size: 0.85em;
}

/* ── Command Area ──────────────────────────── */
#cmd-area {
    flex: 0 0 auto;
    border-top: 1px solid var(--green-dark);
    background: rgba(0,0,0,0.3);
}

#cmd-output {
    max-height: 80px;
    overflow-y: auto;
    padding: 0 16px;
    font-size: 0.85em;
    scrollbar-width: none;
}

#cmd-output::-webkit-scrollbar { display: none; }

#cmd-output .cmd-response {
    padding: 4px 0;
    color: var(--white-dim);
    font-weight: 300;
}

#cmd-output .cmd-response.green { color: var(--green); }
#cmd-output .cmd-response.amber { color: var(--amber); }
#cmd-output .cmd-response.cyan { color: var(--cyan); }
#cmd-output .cmd-response.error { color: var(--red); }

#cmd-output .cmd-echo {
    color: var(--white-dim);
    padding: 2px 0 0;
}

#cmd-line {
    display: flex;
    align-items: center;
    padding: 8px 24px;
    gap: 8px;
}

.prompt {
    color: var(--green);
    font-weight: 700;
    font-size: 1em;
    text-shadow: var(--glow-green);
    flex-shrink: 0;
}

#cmd-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--white);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    caret-color: var(--green);
    line-height: 1.5;
}

#cmd-input::placeholder {
    color: var(--white-dim);
    opacity: 0.4;
}

#hints {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 4px 16px 6px;
    flex-wrap: wrap;
}

.hint {
    color: var(--white-dim);
    font-size: 10px;
    font-weight: 300;
    letter-spacing: 0.3px;
}

.hint kbd {
    display: inline-block;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 2px;
    padding: 0 4px;
    font-family: var(--font);
    font-size: inherit;
    color: var(--white);
    margin-right: 2px;
}

/* ── CRT Scanline Overlay ──────────────────── */
#scanlines {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.025) 2px,
        rgba(0, 0, 0, 0.025) 4px
    );
}

#scanlines::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 55%,
        rgba(0, 0, 0, 0.25) 100%
    );
}

/* ── Animations ────────────────────────────── */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

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

.blink {
    animation: blink-slow 1.5s ease-in-out infinite;
}

/* ── Neofetch Display ──────────────────────── */
.neofetch {
    line-height: 1.5;
    font-size: 0.9em;
}

.neofetch .nf-logo { color: var(--cyan); }
.neofetch .nf-label { color: var(--amber); font-weight: 500; }
.neofetch .nf-value { color: var(--white); font-weight: 300; }
.neofetch .nf-sep { color: var(--green-dark); }

/* ── Alert Banner ──────────────────────────── */
.alert-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255,140,0,0.06);
    border: 1px solid rgba(255,140,0,0.2);
    border-radius: var(--radius);
    margin-bottom: 16px;
    color: var(--amber);
    font-size: 0.85em;
    font-weight: 400;
}

.alert-banner .alert-icon {
    font-size: 1.1em;
    flex-shrink: 0;
}

.alert-banner .alert-action {
    color: var(--cyan);
    cursor: pointer;
    text-decoration: none;
    margin-left: auto;
    white-space: nowrap;
}

.alert-banner .alert-action:hover {
    text-decoration: underline;
}

/* ── Responsive — Tablet ───────────────────── */
@media (max-width: 768px) {
    :root {
        --fs: 13px;
    }

    body {
        padding: 10px;
    }

    html[data-lang="zh"] body {
        letter-spacing: 0.01em;
    }

    #cdu {
        width: 100%;
        height: calc(100vh - 20px);
        height: calc(100dvh - 20px);
    }

    #status-bar { padding: 6px 14px; }
    #page-label { font-size: 12px; }

    .nav-tab { padding: 8px 12px; font-size: 12px; }
    .key-hint { font-size: 9px; padding: 0 3px; margin-right: 3px; }

    #content { padding: 20px 22px 18px; max-width: none; }

    .page-title { font-size: 1.34em; }

    .skill-name { width: 102px; }

    #hints { gap: 10px; }
}

/* ── Responsive — Mobile ───────────────────── */
@media (max-width: 480px) {
    :root {
        --fs: 12px;
    }

    body {
        padding: 0;
    }

    #boot-screen { padding: 8vh 5vw; }
    #boot-log { font-size: 11px; }
    #boot-skip { font-size: 10px; bottom: 16px; right: 16px; }

    #cdu {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }

    #status-bar {
        padding: 4px 10px;
        min-height: 30px;
    }

    #page-label { font-size: 10px; }
    #clock { font-size: 10px; }
    #lang-btn { font-size: 10px; padding: 1px 6px; }

    .nav-tab {
        padding: 6px 8px;
        font-size: 10px;
    }

    .key-hint { display: none; }

    #content { padding: 16px 14px 14px; }

    .page-title { font-size: 1.1em; letter-spacing: 1px; }
    .section-header { font-size: 0.85em; }

    .data-row { font-size: 0.9em; }
    .data-label { font-size: 0.88em; }

    .skill-name { width: 75px; font-size: 0.85em; }
    .skill-bar { font-size: 0.8em; }

    .project-header { padding: 8px 10px; }
    .project-summary { padding: 0 10px 8px; font-size: 0.82em; }

    .link-item { padding: 6px 10px; }
    .link-label { min-width: 60px; font-size: 0.85em; }

    #cmd-line { padding: 5px 10px; }
    #cmd-input { font-size: 12px; }

    #hints { gap: 6px; padding: 3px 10px 5px; }
    .hint { font-size: 9px; }

    .timeline-item { padding-left: 16px; }
}

/* ── Utility Classes ───────────────────────── */
.hidden { display: none !important; }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-cyan { color: var(--cyan); }
.text-white { color: var(--white); }
.text-dim { color: var(--white-dim); }
.text-red { color: var(--red); }
.fw-300 { font-weight: 300; }
.fw-500 { font-weight: 500; }
.fw-700 { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.fs-sm { font-size: 0.85em; }
