/* swimmingbrain.dev desktop
   colours follow the Yaru dark palette: jet #181818, bg lighten(jet, 8%),
   headerbar darken(bg, 3%), menus lighten(jet, 2%), accent #e95420 */

:root {
    --jet: #181818;
    --bg: #2c2c2c;
    --base: #272727;
    --headerbar: #242424;
    --menu: #1d1d1d;
    --hairline: rgba(255, 255, 255, 0.08);
    --fg: #f7f7f7;
    --fg-dim: #b0b0b0;
    --accent: #e95420;
    --accent-hover: #f0673a;
    --terminal-bg: #300a24;
    --t-green: #8ae234;
    --t-blue: #729fcf;
    --t-cyan: #34e2e2;
    --t-yellow: #fce94f;
    --t-red: #ef2929;
    --t-magenta: #ad7fa8;
    --t-white: #eeeeec;
    --t-gray: #555753;
    --panel-h: 28px;
    --dock-w: 64px;
    --radius: 8px;
    --font: 'Ubuntu', system-ui, sans-serif;
    --mono: 'Ubuntu Mono', 'DejaVu Sans Mono', monospace;
}

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

html, body {
    height: 100%;
}

body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--fg);
    background: #2c001e;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

a {
    color: #ffb27a;
}

svg {
    display: block;
}

.sprite {
    display: none;
}

.muted {
    color: var(--fg-dim);
}

::selection {
    background: var(--accent);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.wallpaper {
    position: fixed;
    inset: 0;
    background: #2c001e url('../img/bg.jpg') center / cover no-repeat;
    z-index: 0;
}

.noscript {
    position: fixed;
    top: var(--panel-h);
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: var(--bg);
    z-index: 2000;
}

/* ---------- top panel ---------- */

.panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--panel-h);
    background: var(--jet);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    font-size: 13px;
    font-weight: 700;
    z-index: 1000;
    user-select: none;
}

.panel-left, .panel-right {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 2px;
}

.panel-btn {
    height: 22px;
    padding: 0 10px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.panel-btn img {
    width: 18px;
    height: 18px;
    margin-left: -3px;
}

.panel-btn:hover, .panel-btn.on {
    background: rgba(255, 255, 255, 0.12);
}

.panel-app {
    padding: 0 10px;
    font-weight: 700;
    color: var(--fg);
}

.panel-app:empty {
    display: none;
}

.panel-clock {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: pre;
    font-weight: 700;
}

.tray svg {
    width: 16px;
    height: 16px;
}

.tray .chev {
    width: 12px;
    height: 12px;
    margin-left: -2px;
}

/* ---------- system menu ---------- */

.popover {
    position: fixed;
    top: calc(var(--panel-h) + 6px);
    right: 6px;
    width: 300px;
    background: var(--menu);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    padding: 8px;
    z-index: 1100;
}

.popover[hidden] {
    display: none;
}

.menu-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--fg);
    text-decoration: none;
}

.menu-user img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.menu-user span {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.menu-user small {
    color: var(--fg-dim);
    font-family: var(--mono);
    font-size: 12px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--fg);
    text-decoration: none;
    text-align: left;
    font-size: 14px;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.menu-item svg {
    width: 14px;
    height: 14px;
    color: var(--fg-dim);
}

.menu-sep {
    height: 1px;
    background: var(--hairline);
    margin: 6px 4px;
}

/* ---------- dock ---------- */

.dock {
    position: fixed;
    top: var(--panel-h);
    bottom: 0;
    left: 0;
    width: var(--dock-w);
    background: rgba(24, 24, 24, 0.86);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 0;
    gap: 4px;
    z-index: 900;
}

.dock-item {
    position: relative;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--fg);
    transition: background 0.12s;
}

.dock-item svg {
    width: 44px;
    height: 44px;
}

.dock-item:hover {
    background: rgba(255, 255, 255, 0.12);
}

.dock-item.running::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 50%;
    width: 4px;
    height: 4px;
    margin-top: -2px;
    border-radius: 50%;
    background: var(--fg);
}

.dock-item.focused {
    background: rgba(255, 255, 255, 0.1);
}

.dock-item::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--menu);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s;
}

.dock-item:hover::after {
    opacity: 1;
}

.dock-spacer {
    flex: 1;
}

.dock-apps svg {
    width: 24px;
    height: 24px;
    color: var(--fg-dim);
}

.dock-apps:hover svg, .dock-apps.on svg {
    color: var(--fg);
}

/* ---------- activities overview ---------- */

.overview {
    position: fixed;
    inset: var(--panel-h) 0 0 var(--dock-w);
    background: rgba(0, 0, 0, 0.86);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 6vh;
    gap: 40px;
    z-index: 950;
}

.overview[hidden] {
    display: none;
}

.overview-search {
    width: min(360px, 80%);
    height: 36px;
    padding: 0 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.1);
    color: var(--fg);
    font: inherit;
    text-align: center;
    outline: none;
}

.overview-search:focus {
    border-color: var(--accent);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 118px);
    gap: 18px;
}

.app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 6px 12px;
    border-radius: 14px;
    color: var(--fg);
    text-decoration: none;
    font-size: 13px;
}

.app:hover {
    background: rgba(255, 255, 255, 0.1);
}

.app svg, .app img {
    width: 64px;
    height: 64px;
}

.app[hidden] {
    display: none;
}

.overview-empty {
    color: var(--fg-dim);
}

/* ---------- desktop and windows ---------- */

.desktop {
    position: fixed;
    inset: var(--panel-h) 0 0 var(--dock-w);
    overflow: hidden;
    z-index: 1;
}

.window {
    position: absolute;
    display: none;
    flex-direction: column;
    min-width: 320px;
    min-height: 180px;
    width: 640px;
    height: 400px;
    background: var(--bg);
    border: 1px solid rgba(0, 0, 0, 0.7);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    resize: both;
}

.window.open {
    display: flex;
}

.window.focused {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 20px 50px rgba(0, 0, 0, 0.65);
}

.window.maximized {
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0;
    resize: none;
}

.titlebar {
    flex: none;
    height: 38px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--headerbar);
    border-bottom: 1px solid rgba(0, 0, 0, 0.55);
    font-size: 13px;
    font-weight: 700;
    user-select: none;
    touch-action: none;
}

.window:not(.focused) .titlebar {
    color: var(--fg-dim);
}

.title {
    max-width: calc(100% - 200px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.controls {
    position: absolute;
    right: 7px;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wbtn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--fg);
}

.wbtn svg {
    width: 14px;
    height: 14px;
}

.wbtn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.wbtn.close {
    background: rgba(255, 255, 255, 0.13);
}

.wbtn.close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.window:not(.focused) .wbtn {
    color: var(--fg-dim);
}

.content {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* window sizes */
#win-terminal { width: 720px; height: 320px; }
#win-files { width: 640px; height: 420px; }
#win-about { width: 460px; height: 600px; }
#win-linkedin { width: 480px; height: 600px; }
#win-resume { width: 760px; height: 620px; }
.window.legal { width: 620px; height: 480px; }

/* ---------- terminal ---------- */

.terminal {
    flex: 1;
    background: var(--terminal-bg);
    color: var(--fg);
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.35;
    padding: 8px 10px;
    overflow-y: auto;
    cursor: text;
}

.tline {
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 1.35em;
}

.t-green { color: var(--t-green); }
.t-blue { color: var(--t-blue); }
.t-cyan { color: var(--t-cyan); }
.t-orange { color: var(--accent); }
.t-key { color: var(--accent); font-weight: 700; }
.b { font-weight: 700; }

.t-block {
    display: inline-block;
    width: 3ch;
    height: 1.25em;
    vertical-align: text-bottom;
}

.terminal-line {
    display: flex;
    align-items: baseline;
    white-space: pre;
}

.terminal-input {
    flex: 1;
    min-width: 40px;
    background: transparent;
    color: var(--fg);
    border: 0;
    outline: none;
    font: inherit;
    caret-color: var(--fg);
}

.terminal-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.terminal-input:focus::placeholder {
    color: rgba(255, 255, 255, 0.22);
}

.terminal-user {
    color: var(--t-green);
    font-weight: 700;
}

.terminal-path {
    color: var(--t-blue);
    font-weight: 700;
}

/* ---------- files ---------- */

.files-bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--headerbar);
    border-bottom: 1px solid rgba(0, 0, 0, 0.5);
}

.fbtn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    color: var(--fg);
}

.fbtn svg {
    width: 16px;
    height: 16px;
}

.fbtn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
}

.fbtn:disabled {
    color: #6a6a6a;
    cursor: default;
}

.crumbs {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 28px;
    padding: 0 4px;
    border-radius: 6px;
    background: var(--base);
    border: 1px solid var(--hairline);
    font-size: 13px;
}

.crumb {
    padding: 0 10px;
    height: 24px;
    line-height: 24px;
    border-radius: 5px;
    color: var(--fg-dim);
}

.crumb:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--fg);
}

.crumb.on {
    color: var(--fg);
    font-weight: 700;
}

.files-view {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    align-content: start;
    gap: 6px;
    padding: 12px;
    overflow-y: auto;
}

.file {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 4px;
    border-radius: 8px;
    color: var(--fg);
    text-decoration: none;
    font-size: 12.5px;
    text-align: center;
    word-break: break-word;
}

.file:hover, .file:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.file-icon {
    position: relative;
    width: 56px;
    height: 56px;
}

.file-icon > svg, .file-icon > img.logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.badge {
    position: absolute;
    right: -7px;
    bottom: -5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1b1f23;
    border: 2px solid var(--bg);
    display: grid;
    place-items: center;
    color: #fff;
}

.badge svg {
    width: 12px;
    height: 12px;
}

.files-empty {
    grid-column: 1 / -1;
    padding: 24px 12px;
    color: var(--fg-dim);
    text-align: center;
}

.files-status {
    flex: none;
    padding: 5px 12px;
    border-top: 1px solid var(--hairline);
    color: var(--fg-dim);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- about ---------- */

.about {
    padding: 8px 14px 16px;
}

.about-hero {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 0 16px;
    text-align: center;
}

.avatars {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 12px;
}

.avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 20%;
    background: #3d3d3d;
}

.avatar.jar {
    object-fit: contain;
    padding: 12px;
}

.about h1 {
    font-size: 20px;
    font-weight: 700;
}

.about-hero .muted {
    font-family: var(--mono);
    font-size: 13px;
}

.group {
    flex: none; /* a flex child with overflow hidden would shrink and clip its last rows */
    background: var(--base);
    border: 1px solid var(--hairline);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 14px;
}

.row {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 14px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--hairline);
    font-size: 13px;
    line-height: 1.4;
    color: var(--fg);
    text-decoration: none;
}

.row:last-child {
    border-bottom: 0;
}

.row > span:first-child {
    color: var(--fg-dim);
}

.row > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

a.row, button.row {
    width: 100%;
    cursor: pointer;
    text-align: left;
}

a.row:hover, button.row:hover {
    background: rgba(255, 255, 255, 0.06);
}

a.row > span:last-child::after, button.row > span:last-child::after {
    content: '›';
    margin-left: 8px;
    color: var(--fg-dim);
}


/* ---------- linkedin ---------- */

.linkedin {
    background: var(--base);
}

.li-card {
    flex: none;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--hairline);
}

.avatar.small {
    width: 56px;
    height: 56px;
    margin: 0;
}

.li-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    line-height: 1.35;
}

.btn {
    flex: none;
    padding: 7px 14px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--fg);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.btn.primary {
    background: var(--accent);
    color: #fff;
}

.btn.primary:hover {
    background: var(--accent-hover);
}

.li-feed {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.li-feed p {
    padding: 20px 16px 12px;
    font-size: 13px;
    line-height: 1.5;
    max-width: 48ch;
}

.li-feed .btn {
    margin: 0 16px;
}

/* ---------- document viewer ---------- */

.viewer-bar {
    flex: none;
    display: flex;
    gap: 16px;
    padding: 6px 12px;
    background: var(--headerbar);
    border-bottom: 1px solid rgba(0, 0, 0, 0.5);
    font-size: 12.5px;
}

.viewer-bar a {
    color: var(--fg-dim);
    text-decoration: none;
}

.viewer-bar a:hover {
    color: var(--fg);
}

#resume-frame {
    flex: 1;
    width: 100%;
    border: 0;
    background: #525659;
}

/* ---------- legal text ---------- */

.text {
    padding: 16px 20px 24px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--fg-dim);
}

.text h3 {
    color: var(--fg);
    font-size: 14px;
    margin: 14px 0 6px;
}

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

.text ul {
    margin-left: 18px;
}

.text .muted {
    margin-top: 14px;
    font-size: 12px;
}

/* ---------- power off ---------- */

.poweroff {
    position: fixed;
    inset: 0;
    background: #000;
    color: #ccc;
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.5;
    padding: 20px 24px;
    z-index: 3000;
    cursor: pointer;
}

.poweroff[hidden] {
    display: none;
}

.poweroff-log {
    font: inherit;
    white-space: pre-wrap;
}

.poweroff-log .ok {
    color: var(--t-green);
}

.poweroff-boot {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

.poweroff-boot[hidden] {
    display: none;
}

.poweroff-boot img {
    margin-bottom: 12px;
    opacity: 0.9;
}

/* ---------- small screens ---------- */

@media (max-width: 768px) {
    :root {
        --dock-w: 0px;
    }

    .panel-clock {
        font-size: 12px;
    }

    .dock {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 60px;
        flex-direction: row;
        justify-content: center;
        padding: 0 8px;
        gap: 8px;
    }

    .dock-spacer {
        display: none;
    }

    .dock-item::after,
    .dock-item.running::before {
        display: none;
    }

    .dock-item.focused {
        background: rgba(255, 255, 255, 0.14);
    }

    .desktop {
        inset: var(--panel-h) 0 60px 0;
    }

    .overview {
        inset: var(--panel-h) 0 60px 0;
        padding-top: 20px;
        gap: 28px;
        background: rgba(0, 0, 0, 0.92);
    }

    .app-grid {
        grid-template-columns: repeat(3, 96px);
        gap: 8px;
    }

    .app svg {
        width: 52px;
        height: 52px;
    }

    .window,
    .window.maximized {
        inset: 0 !important;
        width: auto !important;
        height: auto !important;
        min-width: 0;
        border-radius: 0;
        border: 0;
        resize: none;
    }

    .wbtn[data-action="maximize"] {
        display: none;
    }

    .popover {
        right: 0;
        left: 0;
        width: auto;
        margin: 0 6px;
    }
}

@media (max-width: 420px) {
    .panel-app {
        display: none;
    }
}

@media (max-height: 500px) and (max-width: 768px) {
    .dock {
        height: 48px;
    }

    .dock-item {
        width: 40px;
        height: 40px;
    }

    .dock-item svg {
        width: 34px;
        height: 34px;
    }

    .desktop, .overview {
        inset: var(--panel-h) 0 48px 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
