/* ============================================================
   Hunter Powell — pastel Win9x desktop clone
   windows_girl.png palette: blue-grey graph-paper desktop,
   cream windows, soft pink title bars
   ============================================================ */

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

:root {
    /* desktop — muted blue-grey graph paper (matches reference) */
    --desk:        #9ca5ab;   /* dim slate blue-grey */
    --grid-line:   rgba(68, 78, 86, 0.16);
    --grid-faint:  rgba(68, 78, 86, 0.07);   /* fainter, for window bodies */

    /* window chrome — dimmed, dusty */
    --win-face:    #cabfc8;   /* lavender-grey frame */
    --win-content: #bdc6cb;   /* blue-grey graph-paper body */
    --win-light:   #e6dee2;   /* soft (not white) highlight */
    --win-dark:    #a48796;   /* bevel shadow */
    --win-border:  #b8819a;   /* dusty rose outline */

    /* title bar — warmer, more saturated rose-pink */
    --title-bar:   #d8a6b9;
    --title-off:   #c4bac3;   /* inactive */
    --title-ink:   #46343e;   /* dark plum text */

    /* accents + text */
    --accent:      #9f6278;   /* dusty rose */
    --accent-2:    #809b8f;   /* muted sage */
    --ink:         #3f373f;
    --ink-soft:    #645a64;
    --link:        #855570;
    --close:       #b1505b;   /* close-button X */
}

html, body { height: 100%; }

body {
    font-family: 'Inter', Tahoma, 'Segoe UI', sans-serif;
    color: var(--ink);
    line-height: 1.55;
    overflow: hidden;                 /* desktop, not a scrolling page */
    background-color: var(--desk);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 30px 30px, 30px 30px;
}

/* ============================================================
   Desktop surface + icons
   ============================================================ */
#desktop {
    position: fixed;
    inset: 0 0 44px 0;                /* leave room for taskbar */
    overflow: hidden;
    /* wallpaper layered over a grid fallback (shows if the image is missing) */
    background-color: var(--desk);
    background-image:
        url('wallpaper.png'),
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: cover, 30px 30px, 30px 30px;
    background-position: center right, 0 0, 0 0;
    background-repeat: no-repeat, repeat, repeat;
}

.icons {
    /* full-desktop layer; JS positions each icon absolutely within it.
       pointer-events:none so empty areas pass clicks/right-clicks to #desktop */
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.desktop-icon {
    position: absolute;
    width: 84px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    color: var(--ink);
    text-align: center;
    pointer-events: auto;       /* re-enable on the icons themselves */
    touch-action: none;         /* let pointer-drag work on touch */
    user-select: none;
}
.desktop-icon.dragging { opacity: 0.7; z-index: 9999; }   /* stay visible above windows while dragging */

.desktop-icon .glyph {
    font-size: 30px;
    line-height: 1;
    filter: drop-shadow(1px 1px 0 rgba(110, 66, 88, 0.25));
}

.desktop-icon .label {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    color: var(--ink);
    text-shadow: 0 1px 2px rgba(255,255,255,0.6);
}

.desktop-icon.selected {
    background: rgba(201, 138, 166, 0.25);
    border: 1px dotted var(--accent);
}

/* ============================================================
   Window component
   ============================================================ */
.window {
    position: absolute;
    min-width: 240px;
    min-height: 120px;
    max-width: calc(100vw - 16px);   /* never wider than the screen (mobile) */
    max-height: 88vh;
    background: var(--win-face);
    border: 1px solid var(--win-border);
    box-shadow:
        inset 1px 1px 0 var(--win-light),
        inset -1px -1px 0 var(--win-dark),
        5px 6px 0 rgba(110, 66, 88, 0.18);
    display: flex;
    flex-direction: column;
}

/* resize grip in the bottom-right corner */
.resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    background:
        linear-gradient(135deg, transparent 0 6px, var(--win-dark) 6px 7px,
            transparent 7px 9px, var(--win-dark) 9px 10px,
            transparent 10px 12px, var(--win-dark) 12px 13px, transparent 13px);
    touch-action: none;
}
.window.maxed .resize-handle { display: none; }

.window.dragging { box-shadow: 8px 10px 0 rgba(110, 66, 88, 0.22); }

.title-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 4px 6px;
    background: var(--title-bar);
    color: var(--title-ink);
    border-bottom: 1px solid var(--win-border);
    cursor: grab;
    user-select: none;
}
.window.dragging .title-bar { cursor: grabbing; }

/* inactive window = desaturated bar */
.window:not(.active) .title-bar {
    background: var(--title-off);
    color: var(--ink-soft);
}

.title-bar .dot {
    width: 11px; height: 11px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.65);
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.8), 0 0 0 1px var(--win-dark);
    flex: none;
}

.title-bar .title {
    font-family: 'VT323', monospace;
    font-size: 1.15rem;
    line-height: 1;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.title-controls { display: flex; gap: 4px; }

.title-controls button {
    width: 18px; height: 16px;
    font-size: 11px;
    line-height: 1;
    font-family: Tahoma, sans-serif;
    background: var(--win-face);
    color: var(--title-ink);
    border: 1px solid var(--win-border);
    box-shadow: inset 1px 1px 0 var(--win-light), inset -1px -1px 0 var(--win-dark);
    cursor: pointer;
}
.title-controls button:active {
    box-shadow: inset -1px -1px 0 var(--win-light), inset 1px 1px 0 var(--win-dark);
}
.title-controls button[aria-label="close"] {
    color: var(--close);
    font-weight: bold;
}

.menu-bar {
    display: flex;
    gap: 1rem;
    padding: 3px 8px;
    background: var(--win-face);
    border-bottom: 1px solid var(--win-dark);
    font-size: 0.82rem;
    user-select: none;
}
.menu-bar u { text-decoration: underline; }

.window-body {
    background-color: var(--win-content);
    background-image:
        linear-gradient(var(--grid-faint) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-faint) 1px, transparent 1px);
    background-size: 24px 24px, 24px 24px;
    padding: 1.25rem;
    border-top: 1px solid var(--win-light);
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
}

/* ============================================================
   Content typography
   ============================================================ */
.window-body h1 {
    font-family: 'VT323', monospace;
    font-size: 2.5rem;
    color: var(--accent);
    line-height: 1.1;
    margin-bottom: 0.25rem;
}
.window-body .subtitle { font-size: 1.05rem; color: var(--ink-soft); margin-bottom: 1rem; }
.window-body h2 { font-family: 'VT323', monospace; font-size: 1.7rem; color: var(--accent); margin-bottom: 0.6rem; }
.window-body h3 { font-family: 'VT323', monospace; font-size: 1.3rem; color: var(--accent); margin-bottom: 0.4rem; }
.window-body p { margin-bottom: 0.9rem; }
.window-body a { color: var(--link); }
.window-body code {
    font-family: 'VT323', monospace;
    font-size: 0.95em;
    padding: 0 4px;
    background: var(--win-face);
    border: 1px solid var(--win-dark);
    color: var(--accent);
}

.notes-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.notes-list li {
    position: relative;
    padding-left: 1.1rem;
    margin-bottom: 0.55rem;
    line-height: 1.45;
}
.notes-list li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-family: 'VT323', monospace;
}
.notes-window .window-body strong { color: var(--ink); }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.tag {
    font-size: 0.78rem;
    padding: 2px 9px;
    background: var(--win-face);
    border: 1px solid var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-light);
    color: var(--ink-soft);
}

.btn {
    display: inline-block;
    text-decoration: none;
    font-size: 0.92rem;
    padding: 6px 16px;
    background: var(--win-face);
    color: var(--ink);
    border: 1px solid var(--win-border);
    box-shadow: inset 1px 1px 0 var(--win-light), inset -1px -1px 0 var(--win-dark);
    cursor: pointer;
}
.btn:hover { background: var(--win-content); }
.btn:active { box-shadow: inset -1px -1px 0 var(--win-light), inset 1px 1px 0 var(--win-dark); }

/* projects inside the projects window */
.proj-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.proj-card {
    background: var(--win-face);
    border: 1px solid var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-light);
    padding: 1rem;
}

/* contact list */
.contact-list { list-style: none; display: grid; gap: 0.75rem; }
.contact-list li {
    display: flex; flex-direction: column; gap: 2px;
    padding: 0.65rem 0.9rem;
    background: var(--win-face);
    border: 1px solid var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-light);
}
.contact-list .label { font-family: 'VT323', monospace; font-size: 1.05rem; color: var(--accent); }
.contact-list a { color: var(--link); text-decoration: none; font-size: 1.02rem; }
.contact-list a:hover { text-decoration: underline; }

.card-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

/* ============================================================
   Canvas demos (tree / maze solver)
   ============================================================ */
.demo { display: flex; flex-direction: column; gap: 0.85rem; }
.demo-blurb { font-size: 0.86rem; color: var(--ink-soft); margin: 0; }

.demo-stage {
    /* hug the canvas and stay centered — does NOT stretch with the window */
    align-self: center;
    max-width: 100%;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 8px;
    background: var(--win-content);
    /* sunken bevel — the canvas sits "inside" the window */
    box-shadow: inset 1px 1px 0 var(--win-dark), inset -1px -1px 0 var(--win-light);
    border: 1px solid var(--win-dark);
}
.demo-stage canvas {
    display: block;
    max-width: 100%;
    height: auto;   /* scale proportionally if the window gets narrower than the canvas */
    background: var(--win-content);
}
.demo-stage--split figure { margin: 0; text-align: center; }
.demo-stage--split figcaption {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    color: var(--ink-soft);
    margin-top: 4px;
}

.demo-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-controls .btn { font-size: 0.85rem; padding: 5px 14px; }

.demo-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.1rem;
    padding: 6px 12px;
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    color: var(--ink-soft);
    background: var(--win-face);
    border: 1px solid var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-light);
}
.demo-stats b { color: var(--accent); font-weight: normal; }
.demo-stats .muted { color: var(--ink-soft); opacity: 0.75; }

/* ============================================================
   Start menu
   ============================================================ */
.start-menu {
    position: fixed;
    left: 8px;
    bottom: 48px;
    z-index: 100001;
    width: 210px;
    background: var(--win-face);
    border: 1px solid var(--win-border);
    box-shadow: inset 1px 1px 0 var(--win-light), inset -1px -1px 0 var(--win-dark),
        5px 6px 0 rgba(110, 66, 88, 0.25);
    display: none;
    overflow: hidden;
}
.start-menu.open { display: block; }

.start-menu .sm-head {
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    color: var(--title-ink);
    padding: 6px 10px;
    background: var(--title-bar);
    border-bottom: 1px solid var(--win-border);
}

.start-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    font-family: 'Inter', Tahoma, sans-serif;
    font-size: 0.92rem;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}
.start-menu button:hover { background: var(--accent); color: #fff; }
.start-menu button .glyph { font-size: 18px; }
.start-menu .sm-sep { height: 1px; background: var(--win-dark); margin: 2px 0; }

/* ============================================================
   Right-click context menu
   ============================================================ */
.context-menu {
    position: fixed;
    z-index: 150000;
    min-width: 172px;
    padding: 3px;
    background: var(--win-face);
    border: 1px solid var(--win-border);
    box-shadow: inset 1px 1px 0 var(--win-light), inset -1px -1px 0 var(--win-dark),
        4px 5px 0 rgba(110, 66, 88, 0.22);
}
.context-menu button {
    display: block;
    width: 100%;
    padding: 5px 16px 5px 14px;
    background: none;
    border: none;
    font-family: 'Inter', Tahoma, sans-serif;
    font-size: 0.9rem;
    color: var(--ink);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}
.context-menu button:hover { background: var(--accent); color: #fff; }
.context-menu .cm-sep { height: 1px; background: var(--win-dark); margin: 3px 2px; }

/* ============================================================
   Taskbar
   ============================================================ */
.taskbar {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    height: 44px;
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: var(--win-face);
    border-top: 1px solid var(--win-light);
    box-shadow: 0 -2px 5px rgba(110, 66, 88, 0.2);
}

.start-btn {
    font-family: 'VT323', monospace;
    font-size: 1.25rem;
    padding: 3px 16px;
    background: var(--win-face);
    border: 1px solid var(--win-border);
    box-shadow: inset 1px 1px 0 var(--win-light), inset -1px -1px 0 var(--win-dark);
    color: var(--accent);
    cursor: pointer;
    flex: none;
}

.task-items { display: flex; gap: 5px; flex: 1; overflow: hidden; }

.task-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    max-width: 180px;
    padding: 3px 10px;
    font-size: 0.85rem;
    font-family: 'Inter', Tahoma, sans-serif;
    background: var(--win-face);
    border: 1px solid var(--win-border);
    box-shadow: inset 1px 1px 0 var(--win-light), inset -1px -1px 0 var(--win-dark);
    color: var(--ink);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.task-btn.active {
    box-shadow: inset -1px -1px 0 var(--win-light), inset 1px 1px 0 var(--win-dark);
    background: var(--win-content);
}

.credit {
    flex: none;
    max-width: 46vw;
    padding: 0 12px;
    font-size: 0.78rem;
    color: var(--ink-soft);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.credit strong { color: var(--ink); font-weight: 600; }
.credit:hover { color: var(--accent); text-decoration: underline; }

.clock {
    font-family: 'VT323', monospace;
    font-size: 1.15rem;
    padding: 3px 14px;
    border: 1px solid var(--win-dark);
    box-shadow: inset 1px 1px 0 var(--win-dark);
    color: var(--ink-soft);
    flex: none;
}

/* ============================================================
   Boot splash
   ============================================================ */
#boot {
    position: fixed;
    inset: 0;
    z-index: 200000;
    background: #1d1822;            /* deep plum-black */
    color: #d8c7d2;
    font-family: 'VT323', monospace;
    font-size: 1.25rem;
    line-height: 1.5;
    padding: 7vh 8vw;
    cursor: pointer;
    overflow: hidden;
    transition: opacity 0.5s ease;
}
#boot.done { opacity: 0; pointer-events: none; }
.boot-screen { margin: 0; white-space: pre-wrap; font: inherit; }
.boot-screen::after {
    content: '▮';
    margin-left: 2px;
    color: var(--title-bar);
    animation: boot-blink 1s steps(1) infinite;
}
@keyframes boot-blink { 50% { opacity: 0; } }

/* ============================================================
   Terminal (cmd.exe)
   ============================================================ */
.term-window .term-body {
    background: #2a2230;           /* dark plum console */
    background-image: none;
    border-top: 1px solid var(--win-dark);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-family: 'VT323', monospace;
    font-size: 1.18rem;
    line-height: 1.3;
    color: #e7d6df;
    overflow: hidden;
}
.term-output {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.term-output .cmd { color: #f2c2d4; }      /* echoed command line */
.term-output .muted { color: #9a8a94; }
.term-output a { color: #f3b6cb; }
.term-input-line { display: flex; align-items: baseline; gap: 6px; flex: none; }
.term-prompt { color: #d093ab; flex: none; }
.term-input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    font: inherit;
    color: #e7d6df;
    caret-color: var(--title-bar);
}

@media (max-width: 600px) {
    .clock { display: none; }
    .credit-extra { display: none; }   /* keep the handle, drop the tagline */
    .credit { max-width: 60vw; }
    .window-body h1 { font-size: 2rem; }
    #boot { font-size: 1.05rem; padding: 6vh 6vw; }
}
