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

html {
    overflow: hidden;
}

body {
    font-family: 'Courier New', Courier, monospace;
    font-size: 15px;
    line-height: 1.7;
    color: #1a1a1a;
    background: #ffffff;
    overflow: hidden;
}

html.ready,
body.ready {
    overflow: auto;
}

/* ========== Page wrapper ========== */
.page {
    padding: 40px 48px;
    max-width: 960px;
    margin: 0 auto;
}

/* ========== Header ========== */
.header {
    text-align: center;
    margin-bottom: 32px;
    transition: transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.ascii-hero {
    display: inline-flex;
    gap: 12px;
    margin-bottom: 4px;
}

.ascii-hero pre {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-style: italic;
    font-size: 14px;
    line-height: 1.2;
    color: #1a1a1a;
    white-space: pre;
    text-align: left;
    overflow: hidden;
    width: 0;
}

.ascii-hero pre.revealed {
    overflow: visible;
}

/* Loading percent */
.loading-percent {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: #999;
    font-weight: 500;
    margin-top: 4px;
    margin-bottom: 0;
    transition: opacity 0.4s ease;
}

.loading-percent.done {
    opacity: 0;
}

/* Nav links */
.header-nav {
    font-size: 13px;
    display: block;
    opacity: 0;
    margin-top: 8px;
}

.header-nav.revealed {
    opacity: 1;
    transition: opacity 0.4s ease;
}

.header-nav a {
    color: #1a1a1a;
    text-decoration: underline;
    margin: 0 12px;
}

.header-nav a:hover {
    color: #555;
}

/* ========== Main content ========== */
.main .type-block {
    opacity: 0;
}

.main .type-block.revealed {
    opacity: 1;
}

.main h2 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    color: #2a5db0;
    margin-top: 32px;
    margin-bottom: 12px;
}

.main p {
    margin-bottom: 8px;
}

.main a {
    color: #1a1a1a;
    text-decoration: underline;
}

.main a:hover {
    color: #555;
}

/* ========== Experience hover terminal ========== */
.work-item {
    margin-bottom: 8px;
}

.work-role {
    font-weight: 700;
    font-size: 14px;
    padding: 2px 0;
    cursor: pointer;
    transition: color 0.15s;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.work-role:hover {
    color: #1a1a1a;
}

.work-arrow {
    font-size: 12px;
    color: #999;
    transition: transform 0.2s, color 0.15s;
    display: inline-block;
}

.work-role:hover .work-arrow {
    color: #2a5db0;
}

.work-item.open .work-arrow {
    transform: rotate(90deg);
    color: #2a5db0;
}

.work-role a {
    color: #2a5db0;
    text-decoration: underline;
}

.work-role a:hover {
    color: #1a1a1a;
}

.terminal-out {
    font-size: 13px;
    color: #555;
    padding-left: 24px;
    height: 0;
    overflow: hidden;
    transition: height 0.2s ease;
}

.terminal-out .typed {
    white-space: pre-wrap;
}

/* ========== Inline graph preview ========== */
.graph-inline {
    height: 0;
    overflow: hidden;
    transition: height 0.4s ease;
    margin-left: 0;
    margin-top: 4px;
    position: relative;
    border-radius: 4px;
}

.graph-inline.active {
    height: 300px;
    border: 1px solid #e0e0e0;
}

.graph-inline svg {
    width: 100%;
    height: 100%;
    display: block;
    background: #fafafa;
}

.graph-inline .graph-expand {
    position: absolute;
    top: 8px;
    right: 8px;
    cursor: pointer;
    z-index: 10;
    background: none;
    border: none;
    padding: 4px;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.graph-inline .graph-expand:hover {
    opacity: 1;
}

.graph-inline .graph-expand svg {
    width: 16px;
    height: 16px;
    fill: #1a1a1a;
}

/* ========== Fullscreen overlay panel ========== */
.graph-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.graph-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.graph-overlay .overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.graph-overlay .overlay-panel {
    position: relative;
    width: 55vw;
    height: 70vh;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.graph-overlay.active .overlay-panel {
    transform: scale(1);
}

.graph-overlay .overlay-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.graph-overlay .overlay-close:hover {
    opacity: 1;
}

.graph-overlay .overlay-close svg {
    width: 20px;
    height: 20px;
    fill: #1a1a1a;
}

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

.overlay-controls {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.overlay-controls .color-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: #666;
}

.overlay-controls input[type="color"] {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 0 0 1px #ccc;
}

.overlay-controls input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; border: none; }
.overlay-controls input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }

.overlay-filters {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 50px;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.overlay-filters .o-filter-btn {
    padding: 3px 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    color: #666;
    transition: all 0.15s;
}

.overlay-filters .o-filter-btn:hover {
    border-color: #999;
}

.overlay-filters .o-filter-btn.active {
    background: #2a5db0;
    color: #fff;
    border-color: #2a5db0;
}

#graph-tooltip {
    position: fixed;
    visibility: hidden;
    background: #1e1e1e;
    color: #ccc;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'IBM Plex Mono', monospace;
    pointer-events: none;
    max-width: 220px;
    word-wrap: break-word;
    z-index: 1000;
    line-height: 1.4;
}

/* ========== Project cards ========== */
.exp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.exp-card {
    border: 1px solid #e0e0e0;
    padding: 16px;
    transition: border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.exp-card:hover {
    border-color: #1a1a1a;
}

.exp-title {
    font-weight: 700;
    font-size: 14px;
    display: block;
    margin-bottom: 2px;
}

.exp-org {
    font-size: 12px;
    color: #2a5db0;
    display: block;
    margin-bottom: 10px;
}

.exp-desc {
    font-size: 13px;
    color: #444;
    line-height: 1.5;
    margin-bottom: 10px;
}

.exp-links {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.exp-cta {
    font-size: 12px;
    font-family: 'IBM Plex Mono', monospace;
    color: #2a5db0;
    font-weight: 700;
    text-decoration: underline;
}

.exp-github {
    display: inline-block;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.exp-github:hover {
    opacity: 1;
}

.exp-github svg {
    width: 16px;
    height: 16px;
    fill: #1a1a1a;
    vertical-align: middle;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .page {
        padding: 24px 20px;
    }

    .ascii-hero {
        display: inline-flex;
        flex-direction: column;
        gap: 4px;
    }

    .ascii-hero pre {
        font-size: 10px;
        width: auto !important;
        overflow: hidden !important;
        max-height: 0;
        opacity: 0;
        transition: max-height 0.6s ease, opacity 0.6s ease;
    }

    .ascii-hero pre.revealed {
        max-height: 200px;
        opacity: 1;
        overflow: visible !important;
    }

    .exp-grid {
        grid-template-columns: 1fr;
    }

    .graph-inline.active {
        height: 220px;
    }

    .graph-overlay .overlay-panel {
        width: 92vw;
        height: 75vh;
    }

    .work-role {
        font-size: 13px;
        padding: 6px 0;
    }
}

@media (max-width: 480px) {
    .page {
        padding: 16px 14px;
    }

    .ascii-hero pre {
        font-size: 8px;
    }

    .header-nav a {
        margin: 0 6px;
        font-size: 12px;
    }

    .work-role {
        font-size: 12px;
        padding: 8px 0;
    }

    .graph-overlay .overlay-panel {
        width: 96vw;
        height: 80vh;
    }

    .overlay-filters {
        bottom: 6px;
        left: 6px;
        right: 6px;
    }

    .overlay-controls {
        top: 6px;
        left: 6px;
    }
}
