@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

:root {
    --status-bar-height: 24px;
    --launcher-height: 36px;
    --desktop-chrome-bottom: calc(var(--status-bar-height) + var(--launcher-height));
    --window-min-width: 220px;
    --window-min-height: 160px;
    --resize-hit: 8px;
}

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

body {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    background: #d9d9d9;
    overflow: hidden;
    height: 100vh;
    position: relative;
    color: #1a1a1a;
}

.desktop {
    width: 100vw;
    height: 100vh;
    max-height: 100dvh;
    background: #d9d9d9;
    position: relative;
    overflow: hidden;
}

.window {
    position: absolute;
    background: #f3f3f3;
    border: 1px solid #6f6f6f;
    box-shadow: 2px 2px 4px rgba(154, 154, 154, 0.3);
    display: flex;
    flex-direction: column;
    min-width: var(--window-min-width);
    min-height: var(--window-min-height);
    max-width: 100%;
    overflow: visible;
}

.window.is-closed,
.window.is-minimized {
    display: none;
}

.window.is-maximized {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: min(100vw, 100%) !important;
    height: calc(100vh - var(--desktop-chrome-bottom)) !important;
    max-height: calc(100dvh - var(--desktop-chrome-bottom)) !important;
    max-width: 100vw;
    resize: none;
}

.window.is-maximized .resize-layer {
    display: none;
}

.window.active {
    z-index: 100;
}

.title-bar {
    background: #f3f3f3;
    color: #1a1a1a;
    padding: 4px 6px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    cursor: move;
    user-select: none;
    height: 24px;
    line-height: 16px;
    border-bottom: 1px solid #6f6f6f;
    flex-shrink: 0;
}

.title-bar-text {
    flex: 1;
    font-family: 'IBM Plex Mono', monospace;
    padding-left: 4px;
    letter-spacing: 0.5px;
}

.window-controls {
    display: flex;
    gap: 4px;
    margin-right: 4px;
}

.window-control {
    width: 18px;
    height: 16px;
    border: 1px solid #6f6f6f;
    background: #f3f3f3;
    cursor: pointer;
    font-size: 10px;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    color: #1a1a1a;
    transition: background 0.1s;
    padding: 0;
    margin: 0;
}

.window-control:hover {
    background: #bfbfbf;
}

.window-control:active {
    background: #9a9a9a;
}

.window-control--close:hover {
    background: #bfbfbf;
}

.menu-bar {
    background: #f3f3f3;
    border-bottom: 1px solid #6f6f6f;
    padding: 4px 0;
    font-size: 11px;
    display: flex;
    gap: 0;
    height: 24px;
    align-items: center;
    flex-shrink: 0;
}

.menu-item {
    cursor: pointer;
    padding: 4px 12px;
    border: 1px solid transparent;
    height: 20px;
    display: flex;
    align-items: center;
    color: #1a1a1a;
    font-family: 'IBM Plex Mono', monospace;
    transition: background 0.1s;
}

.menu-item:hover {
    background: #bfbfbf;
}

.window-content {
    background: #f3f3f3;
    padding: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    border: none;
}

.window-content::-webkit-scrollbar {
    width: 12px;
}

.window-content::-webkit-scrollbar-track {
    background: #d9d9d9;
    border-left: 1px solid #6f6f6f;
}

.window-content::-webkit-scrollbar-thumb {
    background: #bfbfbf;
    border: 1px solid #6f6f6f;
}

.window-content::-webkit-scrollbar-thumb:hover {
    background: #9a9a9a;
}

/* Resize layer */
.resize-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 200;
}

.resize-handle {
    position: absolute;
    pointer-events: auto;
}

.resize-n {
    top: 0;
    left: var(--resize-hit);
    right: var(--resize-hit);
    height: var(--resize-hit);
    cursor: n-resize;
}

.resize-s {
    bottom: 0;
    left: var(--resize-hit);
    right: var(--resize-hit);
    height: var(--resize-hit);
    cursor: s-resize;
}

.resize-e {
    top: var(--resize-hit);
    bottom: var(--resize-hit);
    right: 0;
    width: var(--resize-hit);
    cursor: e-resize;
}

.resize-w {
    top: var(--resize-hit);
    bottom: var(--resize-hit);
    left: 0;
    width: var(--resize-hit);
    cursor: w-resize;
}

.resize-ne {
    top: 0;
    right: 0;
    width: calc(var(--resize-hit) * 1.5);
    height: calc(var(--resize-hit) * 1.5);
    cursor: ne-resize;
}

.resize-se {
    bottom: 0;
    right: 0;
    width: calc(var(--resize-hit) * 1.5);
    height: calc(var(--resize-hit) * 1.5);
    cursor: se-resize;
}

.resize-sw {
    bottom: 0;
    left: 0;
    width: calc(var(--resize-hit) * 1.5);
    height: calc(var(--resize-hit) * 1.5);
    cursor: sw-resize;
}

.resize-nw {
    top: 0;
    left: 0;
    width: calc(var(--resize-hit) * 1.5);
    height: calc(var(--resize-hit) * 1.5);
    cursor: nw-resize;
}

@media (max-width: 768px) {
    .resize-layer {
        display: none;
    }
}

/* File Explorer Window */
.file-explorer {
    top: 5px;
    left: 20px;
    width: 400px;
    height: 320px;
    z-index: 10;
}

.file-explorer .window-content {
    padding: 8px;
    display: flex;
    flex-direction: column;
}

.file-explorer-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.project-icons-surface {
    position: relative;
    flex: 1;
    min-height: 120px;
    user-select: none;
}

.project-icon-btn {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 104px;
    margin: 0;
    padding: 6px 4px 8px;
    background: transparent;
    border: 1px solid transparent;
    cursor: grab;
    border-radius: 0;
    font: inherit;
    color: #1a1a1a;
    text-align: center;
    line-height: 1.2;
}

.project-icon-btn:hover {
    background: rgba(232, 232, 232, 0.85);
    border-color: #6f6f6f;
}

.project-icon-btn:active {
    cursor: grabbing;
}

.project-icon-btn:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

.project-folder__icon {
    display: block;
    flex-shrink: 0;
    pointer-events: none;
}

.project-icon__label {
    display: block;
    font-size: 11px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    line-height: 1.25;
    word-wrap: break-word;
    max-width: 100%;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.35px;
}

/* Project modal */
.project-modal {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding-bottom: max(16px, var(--desktop-chrome-bottom));
}

.project-modal[hidden] {
    display: none !important;
}

.project-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 26, 0.35);
    cursor: pointer;
}

.project-modal__panel {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    max-height: min(80vh, calc(100dvh - var(--desktop-chrome-bottom) - 32px));
    background: #f3f3f3;
    border: 1px solid #6f6f6f;
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.project-modal__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-bottom: 1px solid #6f6f6f;
    background: #f3f3f3;
    flex-shrink: 0;
}

.project-modal__title {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'IBM Plex Mono', monospace;
    margin: 0;
    padding-left: 4px;
}

.project-modal__close {
    flex-shrink: 0;
}

.project-modal__body {
    padding: 16px;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.75;
    font-family: 'IBM Plex Mono', monospace;
}

.project-modal__body::-webkit-scrollbar {
    width: 12px;
}

.project-modal__body::-webkit-scrollbar-track {
    background: #d9d9d9;
    border-left: 1px solid #6f6f6f;
}

.project-modal__body::-webkit-scrollbar-thumb {
    background: #bfbfbf;
    border: 1px solid #6f6f6f;
}

.project-modal__body::-webkit-scrollbar-thumb:hover {
    background: #9a9a9a;
}

.project-modal__body h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 0 8px;
}

.project-modal__body h3:first-child {
    margin-top: 0;
}

.project-modal__body p {
    margin: 0 0 8px;
}

.project-modal__bullet-list {
    margin: 0 0 12px;
    padding-left: 1.25em;
    list-style: disc;
}

.project-modal__bullet-list li {
    margin-bottom: 6px;
}

.project-modal__bullet-list li:last-child {
    margin-bottom: 0;
}

.project-modal__media {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #d0d0d0;
}

.project-modal__media-heading {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px;
}

.project-modal__figure {
    margin: 0;
    border: 1px solid #6f6f6f;
    background: #eaeaea;
    overflow: hidden;
}

.project-modal__figure + .project-modal__figure {
    margin-top: 12px;
}

.project-modal__image {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: contain;
}

/* Wide diagrams: span full frame width, natural height (no side letterboxing). */
.project-modal__image--wide {
    max-height: none;
    height: auto;
    width: 100%;
}

.project-modal__image--cover {
    height: 280px;
    object-fit: cover;
    object-position: center;
}

.project-modal__image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 140px;
    padding: 16px;
    border: 1px dashed #6f6f6f;
    background: repeating-linear-gradient(
        -45deg,
        #ececec,
        #ececec 8px,
        #e4e4e4 8px,
        #e4e4e4 16px
    );
    color: #3d3d3d;
    text-align: center;
}

.project-modal__image-placeholder-icon {
    font-size: 28px;
    line-height: 1;
    opacity: 0.45;
}

.project-modal__image-placeholder-text {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.project-modal__image-placeholder-hint {
    font-size: 10px;
    line-height: 1.5;
    max-width: 28em;
    opacity: 0.85;
}

.project-modal__image-placeholder-hint code {
    font-size: inherit;
    background: rgba(255, 255, 255, 0.6);
    padding: 0 3px;
    border: 1px solid #b0b0b0;
}

/* Notepad Window */
.notepad-window {
    top: 145px;
    left: 100px;
    width: 700px;
    height: 550px;
    z-index: 20;
}

.notepad-content h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 24px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #1a1a1a;
    letter-spacing: -0.5px;
}

.notepad-content {
    padding-bottom: 0;
}

.profile-section {
    /* Slightly larger than 120px so text column can align top/bottom with the photo */
    --profile-photo-size: min(144px, 40vw);
    display: grid;
    grid-template-columns: var(--profile-photo-size) 1fr;
    gap: 20px;
    margin-top: 10px;
    margin-bottom: 20px;
    align-items: stretch;
}

.profile-image {
    width: var(--profile-photo-size);
    height: var(--profile-photo-size);
    border: 1px solid #6f6f6f;
    position: relative;
    background: #f3f3f3;
    overflow: hidden;
    align-self: start;
}

.profile-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.info-section {
    min-width: 140px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
}

.info-section .info-line {
    margin-bottom: 0;
}

.info-line {
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.65;
    font-family: 'IBM Plex Mono', monospace;
    color: #1a1a1a;
}

@media (max-width: 540px) {
    .profile-section {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .info-section {
        min-height: 0;
        justify-content: flex-start;
        gap: 10px;
        width: 100%;
    }
}

.info-label {
    font-weight: 600;
    text-transform: uppercase;
}

.about-text {
    margin: 24px 0;
    font-size: 12px;
    line-height: 1.7;
    font-family: 'IBM Plex Mono', monospace;
    color: #1a1a1a;
}

.section {
    margin: 24px 0;
}

.section-title {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    margin-bottom: 12px;
    font-family: 'IBM Plex Mono', monospace;
    color: #1a1a1a;
    letter-spacing: 0.5px;
}

.section-content {
    font-size: 12px;
    line-height: 1.8;
    margin-left: 20px;
    font-family: 'IBM Plex Mono', monospace;
    color: #1a1a1a;
}

.section-content > div {
    margin-bottom: 8px;
}

.notepad-content .section {
    margin: 14px 0 8px;
}

.notepad-content .section-content {
    margin-left: 0;
}

.notepad-content > a {
    display: inline-block;
    margin-top: 4px;
}

.notepad-content > a:last-of-type {
    margin-bottom: 18px;
}

.about-intro {
    line-height: 1.6;
}

.about-subtitle {
    font-size: 12px;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.about-list {
    margin: 0 0 12px 0;
    padding-left: 18px;
    list-style: disc;
    font-size: 12px;
    line-height: 1.62;
}

.about-list li {
    margin-bottom: 8px;
}

.about-list li:last-child {
    margin-bottom: 0;
}

.about-cta {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed #b8b8b8;
    line-height: 1.6;
}

.section-content--work > .work-entry {
    margin-bottom: 8px;
}

.section-content--work > .work-entry:last-child {
    margin-bottom: 0;
}

.work-entry__title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 1.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.work-entry__subtitle {
    font-size: 12px;
    line-height: 1.8;
    color: #1a1a1a;
}

.indent {
    margin-left: 20px;
}

.background-text {
    position: absolute;
    bottom: 100px;
    right: 50px;
    font-size: clamp(48px, 18vw, 120px);
    font-weight: bold;
    color: rgba(26, 26, 26, 0.03);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    pointer-events: none;
    z-index: 0;
    transform: rotate(-5deg);
}

/* Contact Window */
.contact-window {
    top: 120px;
    right: 50px;
    left: auto;
    width: 300px;
    height: 170px;
    z-index: 30;
}

.contact-content {
    font-size: 12px;
    line-height: 2;
    font-family: 'IBM Plex Mono', monospace;
    color: #1a1a1a;
}

.contact-item {
    margin-bottom: 10px;
    word-break: break-word;
}

.contact-label {
    font-weight: 600;
}

.contact-ascii {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 8px;
    line-height: 1;
    white-space: pre;
    margin: 10px 0 8px 0;
    padding: 0;
    color: #1a1a1a;
    background: transparent;
    border: none;
    overflow: visible;
}

/* Spotify Window */
.spotify-window {
    top: 320px;
    right: 50px;
    left: auto;
    width: 360px;
    height: 280px;
    z-index: 25;
}

.spotify-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 12px;
    line-height: 1.5;
}

.spotify-label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.spotify-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.spotify-btn {
    border: 1px solid #6f6f6f;
    background: #f3f3f3;
    color: #1a1a1a;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    padding: 4px 8px;
    cursor: pointer;
}

.spotify-btn:hover {
    background: #bfbfbf;
}

.spotify-help {
    margin-top: 8px;
    font-size: 10px;
    line-height: 1.45;
}

.spotify-help code {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid #b0b0b0;
    padding: 0 3px;
}

.spotify-status {
    margin: 0;
    font-weight: 600;
}

.spotify-artwork {
    display: block;
    width: min(160px, 100%);
    border: 1px solid #6f6f6f;
    background: #eaeaea;
    margin-top: 8px;
}

.spotify-track {
    margin-top: 8px;
    font-weight: 600;
}

.spotify-artist {
    margin-top: 2px;
}

.spotify-link {
    display: inline-block;
    margin-top: 8px;
}

/* Window launcher (restore closed / minimized) */
.window-launcher {
    position: fixed;
    bottom: var(--status-bar-height);
    left: 0;
    right: 0;
    height: var(--launcher-height);
    background: #e4e4e4;
    border-top: 1px solid #6f6f6f;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    z-index: 1500;
    font-family: 'IBM Plex Mono', monospace;
}

.launcher-btn {
    display: flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 10px;
    font-family: inherit;
    border: 1px solid #6f6f6f;
    background: #f3f3f3;
    color: #1a1a1a;
    cursor: pointer;
    min-height: 26px;
}

.launcher-btn:hover {
    background: #bfbfbf;
}

.launcher-btn.is-window-hidden {
    background: #d4d4d4;
    font-style: italic;
}

.launcher-btn.is-window-active {
    background: #bfbfbf;
    border-color: #6f6f6f;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.launcher-btn__label {
    pointer-events: none;
}

/* Status Bar */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--status-bar-height);
    background: #f3f3f3;
    border-top: 1px solid #6f6f6f;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    font-size: 11px;
    z-index: 1600;
    font-family: 'IBM Plex Mono', monospace;
    color: #1a1a1a;
}

.status-left {
    font-family: 'IBM Plex Mono', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-right {
    font-family: 'IBM Plex Mono', monospace;
}

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

a:visited {
    color: #1a1a1a;
}

a:hover {
    color: #6f6f6f;
}

/* Responsive layout */
@media (max-width: 900px) {
    .window-control[data-action='minimize'] {
        display: none;
    }

    .notepad-window {
        left: 12px;
        right: 12px;
        width: auto !important;
        max-width: none;
        height: min(560px, calc(100vh - var(--desktop-chrome-bottom) - 24px)) !important;
    }

    .file-explorer {
        left: 12px;
        right: 12px;
        width: auto !important;
        max-width: none;
        height: min(300px, 40vh) !important;
    }

    .contact-window {
        left: 12px;
        right: 12px;
        top: auto;
        bottom: calc(var(--desktop-chrome-bottom) + 12px);
        width: auto !important;
        height: min(175px, 34vh) !important;
    }

    .spotify-window {
        left: 12px;
        right: 12px;
        width: auto !important;
        height: min(280px, 34vh) !important;
    }

    .desktop > .window {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 0;
        height: calc(100dvh - var(--desktop-chrome-bottom)) !important;
        max-height: calc(100dvh - var(--desktop-chrome-bottom)) !important;
    }
}

@media (max-width: 600px) {
    .file-explorer {
        top: 8px;
        height: min(280px, 38vh) !important;
    }

    .notepad-window {
        top: min(300px, 44vh);
        height: min(480px, calc(100vh - var(--desktop-chrome-bottom) - 32px)) !important;
    }

    .contact-window {
        height: min(165px, 30vh) !important;
    }

    .spotify-window {
        height: min(240px, 30vh) !important;
    }

    .window-launcher {
        flex-wrap: wrap;
        height: auto;
        min-height: var(--launcher-height);
        padding: 4px 8px;
    }
}

@media (max-width: 768px) {
    .window.is-maximized {
        height: calc(100dvh - var(--desktop-chrome-bottom)) !important;
    }
}
