/* AurelSon OS: laptop workspace, shared by desktop and narrow viewports. */
:root {
    --font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --taskbar-height: 56px;
    --primary-color: #527be3;
    --xp-panel: #f5f7fb;
    --xp-border: #d3dbe8;
    --xp-text: #233047;
    --wallpaper-base: #101b36;
    --wallpaper-glow: #314d91;
    --wallpaper-ribbon: #6564c8;
    --wallpaper-edge: #228da5;
    color-scheme: light;
}

:root[data-wallpaper="dusk"] {
    --wallpaper-base: #281a39;
    --wallpaper-glow: #7a426f;
    --wallpaper-ribbon: #b7788b;
    --wallpaper-edge: #d19a75;
}

:root[data-wallpaper="forest"] {
    --wallpaper-base: #0c292b;
    --wallpaper-glow: #226260;
    --wallpaper-ribbon: #4e9386;
    --wallpaper-edge: #78a894;
}

html, body {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: var(--wallpaper-base);
}

.desktop {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    isolation: isolate;
    background: radial-gradient(ellipse at 80% 5%, var(--wallpaper-glow), transparent 65%), var(--wallpaper-base);
}

.desktop::before {
    position: absolute;
    inset: auto;
    left: 30%;
    bottom: -19%;
    width: 90vw;
    height: 100vh;
    border-radius: 48% 62% 30% 65%;
    background: linear-gradient(155deg, var(--wallpaper-edge), var(--wallpaper-ribbon) 46%, transparent 80%);
    box-shadow: inset 2px 2px 2px #ffffff30, inset 30px 15px 100px #ffffff12, -50px -30px 90px #00000012;
    transform: rotate(-29deg);
    opacity: .64;
    z-index: 0;
}

.desktop::after {
    position: absolute;
    inset: auto;
    top: -46%;
    left: 56%;
    width: 72vw;
    height: 105vh;
    border-radius: 48%;
    background: linear-gradient(145deg, #ffffff09, transparent 55%);
    border: 1px solid #ffffff18;
    transform: rotate(-29deg);
    z-index: 0;
}

.desktop-icons {
    position: absolute;
    top: calc(18px + var(--safe-area-top));
    left: calc(16px + var(--safe-area-left));
    right: auto;
    display: grid;
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-template-rows: repeat(auto-fill, 86px);
    grid-auto-columns: 88px;
    align-content: start;
    justify-content: start;
    gap: 10px;
    width: max-content;
    max-width: calc(100vw - var(--safe-area-left) - var(--safe-area-right) - 32px);
    height: calc(100dvh - var(--taskbar-height) - var(--safe-area-top) - var(--safe-area-bottom) - 36px);
    margin: 0;
    padding: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #ffffff55 transparent;
}

.desktop-icon {
    width: 88px;
    min-height: 86px;
    padding: 5px 3px;
    margin: 0;
    justify-content: flex-start;
    gap: 5px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
    text-shadow: 0 1px 4px #000a;
    user-select: none;
    cursor: default;
    touch-action: manipulation;
}

.desktop-icon:hover,
.desktop-icon:focus-visible {
    background: #d9e8ff18;
    border-color: #e6efff35;
    box-shadow: none;
    transform: none;
}

.desktop-icon.selected {
    background: #accbff30;
    border-color: #c6ddff70;
    box-shadow: none;
    transform: none;
}

.desktop-glyph {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    filter: drop-shadow(0 3px 4px #0003);
}

.desktop-icon span {
    color: #fff;
    background: transparent;
    padding: 0 2px;
    font-size: 11px;
    line-height: 1.3;
    font-weight: 500;
    overflow-wrap: normal;
    text-wrap: balance;
}

.desktop-signature {
    position: absolute;
    right: 44px;
    bottom: calc(var(--taskbar-height) + 38px);
    display: grid;
    justify-items: end;
    gap: 6px;
    color: #e0e9ffad;
    pointer-events: none;
}

.desktop-signature svg { width: 42px; height: 42px; opacity: .6; }
.desktop-signature strong { font-size: 25px; font-weight: 500; letter-spacing: -.8px; }
.desktop-signature span { font-size: 12px; }

.taskbar {
    height: calc(var(--taskbar-height) + var(--safe-area-bottom));
    min-height: var(--taskbar-height) !important;
    padding: 0 max(8px, var(--safe-area-right)) var(--safe-area-bottom) max(8px, var(--safe-area-left));
    background: #111a2beF;
    border-top: 1px solid #ffffff21;
    box-shadow: 0 -4px 24px #0002;
    backdrop-filter: blur(24px);
    z-index: 100000 !important;
    gap: 8px;
}

.taskbar-left { gap: 8px; height: 100%; }
.taskbar-right { height: 100%; gap: 7px; }
.start-button, .taskbar-pinned button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    min-height: 40px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #e8eefb;
    text-shadow: none;
    box-shadow: none;
    font: 500 12px var(--font-family);
    gap: 8px;
    cursor: pointer;
}

.start-button svg { width: 27px; height: 27px; }
.start-button:hover, .start-button:focus-visible, .start-button[aria-expanded="true"], .taskbar-pinned button:hover { background: #ffffff13; }
.taskbar-pinned { display: flex; gap: 2px; padding-right: 8px; border-right: 1px solid #ffffff18; }
.taskbar-pinned button { width: 40px; padding: 5px; }
.taskbar-pinned svg { width: 29px; height: 29px; }
.taskbar-apps { align-items: center; padding: 0; gap: 5px; }
.taskbar-app {
    height: 38px;
    min-height: 38px;
    max-width: 170px;
    padding: 7px 13px;
    border: 1px solid #ffffff0e;
    border-radius: 5px;
    background: #ffffff08;
    box-shadow: none;
    color: #c3cee1;
    font: 12px var(--font-family);
}
.taskbar-app:hover { background: #ffffff16; }
.taskbar-app.is-current { color: #fff; background: #ffffff19; box-shadow: inset 0 -3px #8eb5ff; }
.taskbar-app.minimized { background: transparent; box-shadow: inset 0 -2px #7283a0; }
.system-tray { padding: 0 7px; gap: 8px; min-height: 0; background: transparent; border: 0; box-shadow: none; }
.tray-item { padding: 0; font-size: 13px; }
.clock { min-width: 76px; margin: 0; padding: 0 2px; background: transparent; color: #ecf2ff; }
.clock .time { font-size: 12px; font-weight: 500; }
.clock .date { font-size: 10px; color: #a7b5ce; }
.system-tray .clock { background: transparent; border: 0; box-shadow: none; }
.show-desktop-button { width: 8px; height: 36px; border: 0; border-left: 1px solid #ffffff35; background: transparent; cursor: pointer; }
.show-desktop-button:hover { background: #ffffff25; }

/* A single touch-sized row preserves space in portrait and landscape. */
@media (max-width: 1100px) {
    :root { --taskbar-height: 60px; }
    .taskbar {
        display: grid !important;
        grid-template-columns: 44px auto minmax(0, 1fr) auto;
        grid-template-rows: 44px;
        align-content: center;
        gap: 4px;
        padding: 7px max(8px, var(--safe-area-right)) calc(8px + var(--safe-area-bottom)) max(8px, var(--safe-area-left));
    }
    .taskbar-left { display: contents; }
    .taskbar .start-button { grid-column: 1; width: 44px; height: 44px; padding: 4px; }
    .taskbar .start-button-label { display: none; }
    .taskbar .taskbar-pinned { grid-column: 2; gap: 0; padding: 0; border: 0; }
    .taskbar .taskbar-pinned button { width: 44px; min-width: 44px; height: 44px; }
    .taskbar .taskbar-apps { grid-column: 3; grid-row: 1; width: 100%; height: 44px; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; }
    .taskbar .taskbar-apps::-webkit-scrollbar { display: none; }
    .taskbar .taskbar-app { height: 44px; min-height: 44px; min-width: 44px; max-width: 140px; flex: 0 0 auto; }
    .taskbar-right { grid-column: 4; grid-row: 1; gap: 4px; }
    .taskbar .system-tray { padding: 0 2px; }
    .taskbar .tray-item:not(.clock) { display: none; }
    .taskbar .show-desktop-button { width: 44px; height: 44px; padding: 0; color: #c3cee1; }
    .taskbar .show-desktop-button::before { content: "▱"; font-size: 24px; }
}
@media (max-width: 600px) {
    .taskbar { grid-template-columns: 44px minmax(0, 1fr) auto; }
    .taskbar .taskbar-pinned { display: none; }
    .taskbar .taskbar-apps { grid-column: 2; }
    .taskbar-right { grid-column: 3; }
    .taskbar .clock { min-width: 44px; }
    .taskbar .clock .date { display: none; }
}
#chatLauncher { display: none; }

.start-menu {
    left: max(10px, var(--safe-area-left));
    right: auto;
    bottom: calc(var(--taskbar-height) + var(--safe-area-bottom) + 8px);
    width: min(410px, calc(100vw - 20px));
    max-height: calc(100dvh - var(--taskbar-height) - var(--safe-area-bottom) - var(--safe-area-top) - 24px);
    padding: 16px;
    border: 1px solid #ffffff26;
    border-radius: 12px;
    background: #172239f5;
    color: #ecf2ff;
    box-shadow: 0 18px 60px #0006;
    backdrop-filter: blur(24px);
    overflow: hidden;
    z-index: 100010 !important;
}
.start-menu.active { display: flex !important; flex-direction: column; gap: 14px; }
.start-menu-profile { margin: 0; padding: 0 2px; background: transparent; text-shadow: none; flex-shrink: 0; gap: 4px; }
.start-menu-profile strong { font-size: 15px; font-weight: 600; }
.start-menu-profile span { color: #a5b5d1; font-size: 11px; }
.app-search { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border: 1px solid #8b9ebe45; border-radius: 6px; background: #0c1528a6; flex-shrink: 0; }
.app-search > span { font-size: 24px; line-height: 1; color: #9cafce; }
.app-search input { width: 100%; min-width: 0; padding: 3px 0; border: 0; outline-offset: 5px; background: transparent; color: #f2f6ff; font: 12px var(--font-family); }
.app-search input::placeholder { color: #a7b6d0; }
.start-menu-apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #7285aa transparent; }
.start-menu-item { display: flex; flex-direction: column; justify-content: center; gap: 7px; margin: 0; padding: 10px 5px; min-height: 72px; border-radius: 6px; color: #e4ecfb; font-size: 11px; white-space: normal; text-align: center; cursor: pointer; }
.start-menu-item span { width: auto; font-size: 22px; line-height: 1; }
.start-menu-item svg { width: 28px; height: 28px; display: block; }
.start-menu-item:hover, .start-menu-item:focus { background: #d3e3ff17; color: #fff; }
.start-menu-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px; margin: 0; padding: 12px 0 0; border-top: 1px solid #ffffff18; background: transparent; flex-shrink: 0; }
.start-menu-actions button, .start-menu-actions .privacy-settings { position: static; min-height: 32px; margin: 0; padding: 5px 7px; border: 1px solid transparent; border-radius: 4px; background: transparent; box-shadow: none; color: #b3c3df; font: 11px var(--font-family); cursor: pointer; }
.start-menu-actions button:hover { color: #fff; background: #ffffff12; }
.desktop-context-menu { position: fixed; z-index: 100010 !important; width: 230px; padding: 5px; border: 1px solid #ffffff29; border-radius: 9px; background: #172239f5; box-shadow: 0 12px 34px #0005; backdrop-filter: blur(20px); }
.desktop-context-menu button { display: block; width: 100%; padding: 11px 12px; border: 0; border-radius: 4px; background: transparent; color: #e4ecfb; text-align: left; font: 12px var(--font-family); cursor: pointer; }
.desktop-context-menu button:hover, .desktop-context-menu button:focus-visible { background: #ffffff14; }

.window {
    position: fixed;
    width: min(740px, var(--workspace-width, calc(100vw - 32px)));
    min-width: min(320px, var(--workspace-width, calc(100vw - 32px)));
    min-height: min(220px, var(--workspace-height, calc(100dvh - var(--taskbar-height) - 32px)));
    max-width: var(--workspace-width, calc(100vw - 32px));
    max-height: var(--workspace-height, calc(100dvh - var(--taskbar-height) - var(--safe-area-bottom) - 32px));
    left: 64px;
    top: 48px;
    right: auto;
    border: 1px solid #b9c6dd;
    border-radius: 10px;
    background: #dce3ed;
    box-shadow: 0 14px 45px #050c263d, 0 1px 5px #0002;
    resize: both;
    animation: none;
    filter: none;
}
.window.active { animation: none; filter: none; }
.window.is-focused { border-color: #7c9ed4; box-shadow: 0 22px 70px #050c266b, 0 2px 10px #0003; }
.window.dragging { transition: none; user-select: none; }
.window-header { min-height: 43px; padding: 0 5px 0 14px; background: #cbd5e3; color: #46536c; border: 0; border-bottom: 1px solid #d8dfeb; box-shadow: none; font: 500 12px var(--font-family); text-shadow: none; cursor: move; touch-action: none; user-select: none; }
.window.is-focused .window-header { background: #d6e0ee; color: #25324c; }
.window-controls { align-self: stretch; align-items: center; gap: 2px; margin-left: 8px; }
.window-control { width: 34px; height: 30px; min-width: 34px; border: 0; border-radius: 4px; box-shadow: none; background: transparent; font: 18px/1 var(--font-family); color: #53637b; }
.window-control.minimize, .window-control.maximize, .window-control.close { background: transparent; color: #53637b; }
.window-control:hover { background: #dce4f0; }
.window-control.close:hover { background: #d43c51; color: #fff; }
.window-content { min-width: 0; overscroll-behavior: contain; background: #dfe6ef; border: 0; box-shadow: none; color: #334155; padding: 22px; }
.window.maximized {
    inset: auto !important;
    left: var(--workspace-left, 8px) !important;
    top: var(--workspace-top, 8px) !important;
    width: var(--workspace-width, calc(100vw - 16px)) !important;
    height: var(--workspace-height, calc(100dvh - var(--taskbar-height) - var(--safe-area-bottom) - 16px)) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border-radius: 0;
    resize: none;
}
.window.maximized .window-content { max-height: none; }
.xp-browser-window, .xp-explorer-window, .terminal-window, .file-browser-window, .notepad-window { width: min(820px, calc(100vw - 32px)); height: min(550px, calc(100dvh - var(--taskbar-height) - 40px)); }
.chat-window { width: min(540px, calc(100vw - 32px)); height: min(680px, calc(100dvh - var(--taskbar-height) - 40px)); }
.chat-window .window-content { padding: 0; }
.file-browser-content, .xp-browser-content, .notepad-window .window-content { padding: 0; }
.browser-toolbar, .browser-favorites, .file-browser-toolbar, .notepad-menubar { background: #d3dce8; border-color: #d8dfeb; box-shadow: none; }
.browser-toolbar button, .browser-favorites button, .explorer-sidebar button, .notepad-menubar button { background: #e3e8ef; border: 1px solid #d2dae7; color: #334155; border-radius: 4px; }
.browser-page, .explorer-main { background: #e3e8ef; color: #334155; }
.browser-page h2, .content-section h2, .welcome-title { color: #233b65; }
.browser-statusbar { background: #d3dce8; border-color: #d8dfeb; color: #64748b; }
.explorer-sidebar { background: #d3dce8; border-color: #d8dfeb; }
.explorer-file { border-radius: 6px; }
.terminal-window .window-content { padding: 0; background: #101827; color: #dbe6fa; }
.terminal-output, .terminal-input-line { background: #101827; color: #dbe6fa; border-color: #2c3b53; }
.file-browser-header { background: #d3dce8; }
.service-step, .skill-category, .featured-service, .cv-info, .mail-info, .phone-info, .matrix-info { background: #e3e8ef; border: 1px solid #dfe5ef; box-shadow: none; }
.content-section h3, .welcome-message h3 { color: #3b5c91; }
.content-section p, .content-section ul { color: #3b4960; }
.welcome-window { width: min(560px, calc(100vw - 32px)); height: auto; min-width: 0; min-height: 0; }
.welcome-window .window-content { padding: 28px; background: #dfe6ef; }
.welcome-header { text-align: center; }
.welcome-os-icon { width: 48px; height: 48px; margin-bottom: 15px; }
.welcome-eyebrow { color: #667b9c; font-size: 10px; font-weight: 600; letter-spacing: 1.6px; margin-bottom: 9px; }
.welcome-title { font-size: 25px; line-height: 1.25; margin-bottom: 9px; letter-spacing: -.6px; }
.welcome-subtitle { color: #6a7a93; font-size: 12px; margin: 0; }
.welcome-shortcuts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 25px 0 20px; }
.welcome-shortcuts button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 15px 5px; border: 1px solid #dce3ef; border-radius: 7px; background: #e3e8ef; color: #354d73; font: 12px var(--font-family); cursor: pointer; }
.welcome-shortcuts button:hover { background: #edf3ff; border-color: #b3c6eb; }
.welcome-shortcuts svg { width: 34px; height: 34px; }
.desktop-help { margin: 0; color: #7b889e; font-size: 11px; line-height: 1.7; text-align: center; }
.welcome-close-btn, .cv-button, .mail-button, .phone-button, .matrix-button, .chat-fallback-message button { border: 1px solid #456ac1; border-radius: 6px; background: #466fd1; box-shadow: none; color: #fff; text-shadow: none; font-weight: 500; }
.welcome-close-btn { padding: 11px; margin-top: 20px; font-size: 12px; }
.cv-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.cv-actions .cv-note { width: 100%; }
a.cv-button { text-decoration: none; }
.welcome-close-btn:hover, .cv-button:hover, .mail-button:hover, .phone-button:hover, .matrix-button:hover, .chat-fallback-message button:hover { background: #365db9; transform: none; box-shadow: none; }
.privacy-panel { z-index: 100020; bottom: calc(var(--taskbar-height) + 10px); left: 10px; background: #f7f9ff; border: 1px solid #b5c4df; color: #233047; box-shadow: 0 12px 40px #0004; }
.xp-notice { z-index: 100020; background: #dce3ed; border: 1px solid #c3cfe1; }

@media (max-width: 768px) {
    .desktop-signature { display: none; }
    .start-button-label { display: none; }
    .tray-item:not(.clock) { display: none; }
    .system-tray { padding: 0 2px; }
    .window { width: var(--workspace-width, calc(100vw - 16px)); min-width: 0; resize: none; }
    .xp-browser-window, .xp-explorer-window, .terminal-window, .file-browser-window, .notepad-window, .chat-window { height: var(--workspace-height, calc(100dvh - var(--taskbar-height) - var(--safe-area-bottom) - 16px)); }
    .window-content { padding: 16px; }
    .file-browser-content, .xp-browser-content, .terminal-window .window-content, .chat-window .window-content { padding: 0; }
}

@media (max-width: 480px) {
    .desktop-icons { left: 10px; max-width: calc(100vw - 20px); gap: 6px; }
    .start-menu { padding: 12px; }
    .start-menu-apps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .window-header { padding-left: 10px; }
    .welcome-window .window-content { padding: 20px 16px; }
    .welcome-title { font-size: 22px; }
    .welcome-shortcuts { gap: 6px; margin: 18px 0; }
    .welcome-shortcuts button { font-size: 11px; }
}

@media (max-height: 480px) {
    .start-menu { overflow-y: auto; }
    .start-menu-apps { flex-shrink: 0; overflow: visible; }
}

/* Use the additional CSS-pixel workspace on large displays without scaling text. */
@media (min-width: 1920px) {
    .window { width: clamp(820px, 46vw, 1100px); }
    .xp-browser-window, .xp-explorer-window, .terminal-window, .file-browser-window, .notepad-window { width: clamp(960px, 50vw, 1280px); height: min(900px, 68dvh); }
    .chat-window { width: 660px; height: min(940px, 72dvh); }
}

@media (min-width: 3200px) {
    .window { width: 1440px; }
    .xp-browser-window, .xp-explorer-window, .terminal-window, .file-browser-window, .notepad-window { width: 1600px; height: min(1100px, 68dvh); }
    .chat-window { width: 740px; height: min(1100px, 72dvh); }
}

@media (any-pointer: coarse) {
    .window { resize: none; }
    .window-header { min-height: 52px; }
    .window-control { width: 44px; min-width: 44px; height: 44px; }
}
