/* ==========================================================
   didriksi.com: Win98 desktop design system
   Shared by every page under landing/. CourseCatalog vendors
   a copy of the tokens + components (see its index.css).
   ========================================================== */

:root {
    /* Desktop + chrome */
    --desktop: #008080;
    --desktop-dark: #006a6a;
    --face: #c0c0c0;
    --face-light: #dfdfdf;
    --hilight: #ffffff;
    --shadow: #808080;
    --dk-shadow: #0a0a0a;
    --title-a: #000080;
    --title-b: #1084d0;
    --title-inactive-a: #808080;
    --title-inactive-b: #b5b5b5;
    --window: #ffffff;
    --text: #000000;
    --text-muted: #444444;
    --link: #0000ee;
    --link-hover: #cc0000;
    --select: #000080;
    --select-text: #ffffff;
    --tooltip: #ffffe1;

    /* Accents (badges, sources) */
    --acc-teal: #008080;
    --acc-navy: #000080;
    --acc-orange: #c0561f;
    --acc-green: #1db954;
    --acc-lc: #d88b00;
    --acc-lb: #ff8000;
    --acc-purple: #6a1b9a;

    /* Bevels */
    --bevel-out: inset -1px -1px var(--dk-shadow), inset 1px 1px var(--hilight),
                 inset -2px -2px var(--shadow), inset 2px 2px var(--face-light);
    --bevel-in: inset -1px -1px var(--hilight), inset 1px 1px var(--shadow),
                inset -2px -2px var(--face-light), inset 2px 2px var(--dk-shadow);
    --bevel-btn-pressed: inset -1px -1px var(--hilight), inset 1px 1px var(--dk-shadow),
                         inset -2px -2px var(--face-light), inset 2px 2px var(--shadow);
    --bevel-thin-in: inset -1px -1px var(--hilight), inset 1px 1px var(--shadow);

    --font-ui: Tahoma, "MS Sans Serif", "Segoe UI", Verdana, Geneva, sans-serif;
    --font-pixel: "Pixelify Sans", Tahoma, sans-serif;
    --font-mono: "VT323", "Courier New", Courier, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--desktop);
    background-image:
        radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 3px 3px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 40px; /* taskbar */
}

a { color: var(--link); }
a:hover { color: var(--link-hover); }
img { max-width: 100%; }

:focus-visible { outline: 1px dotted var(--text); outline-offset: -4px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */

.desktop {
    flex: 1;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.row { display: grid; gap: 20px; }
.row-feed { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
.row-2 { grid-template-columns: 1fr 1fr; }

@media (max-width: 820px) {
    .row-feed, .row-2 { grid-template-columns: 1fr; }
}

/* ---------- Window ---------- */

.window {
    background: var(--face);
    box-shadow: var(--bevel-out), 4px 4px 0 rgba(0,0,0,0.25);
    padding: 3px;
    min-width: 0;
}

.window.opening { animation: win-open 180ms steps(4) both; }

@keyframes win-open {
    from { transform: scale(0.94); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.title-bar {
    background: linear-gradient(90deg, var(--title-a), var(--title-b));
    color: #fff;
    padding: 3px 3px 3px 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    user-select: none;
}

.window.inactive .title-bar {
    background: linear-gradient(90deg, var(--title-inactive-a), var(--title-inactive-b));
    color: var(--face-light);
}

.title-bar-text {
    font-family: var(--font-pixel);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.title-bar-text img, .title-bar-text svg { width: 16px; height: 16px; flex-shrink: 0; image-rendering: pixelated; }

.title-bar-controls { display: flex; gap: 2px; flex-shrink: 0; }

.title-bar-controls span {
    width: 16px; height: 14px;
    background: var(--face);
    box-shadow: var(--bevel-out);
    display: grid; place-items: center;
    font: bold 10px/1 var(--font-ui);
    color: #000;
}
.title-bar-controls span:last-child { margin-left: 2px; }

.menu-bar {
    display: flex;
    gap: 2px;
    padding: 2px 2px 3px;
    font-size: 12px;
}
.menu-bar span { padding: 1px 6px; }
.menu-bar span::first-letter { text-decoration: underline; }

.window-body { margin: 6px; }

.window-body.sunken {
    background: var(--window);
    box-shadow: var(--bevel-in);
    padding: 12px;
    margin: 4px;
}

.status-bar {
    display: flex;
    gap: 2px;
    margin: 2px 2px 0;
    font-size: 11px;
}
.status-bar-field {
    flex: 1;
    box-shadow: var(--bevel-thin-in);
    padding: 1px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.status-bar-field.grow-0 { flex: 0 0 auto; }

/* ---------- Controls ---------- */

.btn {
    font: 12px/1 var(--font-ui);
    color: var(--text);
    background: var(--face);
    border: none;
    border-radius: 0;
    box-shadow: var(--bevel-out);
    min-height: 26px;
    padding: 5px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { color: var(--text); background: #c8c8c8; }
.btn:active, .btn[aria-pressed="true"] {
    box-shadow: var(--bevel-btn-pressed);
    padding: 6px 13px 4px 15px;
}
.btn[aria-pressed="true"] {
    background-color: var(--face-light);
    background-image:
        linear-gradient(45deg, var(--face) 25%, transparent 25%, transparent 75%, var(--face) 75%),
        linear-gradient(45deg, var(--face) 25%, transparent 25%, transparent 75%, var(--face) 75%);
    background-size: 2px 2px;
    background-position: 0 0, 1px 1px;
}
.btn:disabled { color: var(--shadow); text-shadow: 1px 1px var(--hilight); cursor: default; }
.btn img, .btn svg { width: 16px; height: 16px; image-rendering: pixelated; }
.btn-sm { min-height: 22px; padding: 3px 8px; font-size: 11px; }
.btn-sm:active, .btn-sm[aria-pressed="true"] { padding: 4px 7px 2px 9px; }

.field {
    background: var(--window);
    box-shadow: var(--bevel-in);
    padding: 6px 8px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 4px 2px;
}
.toolbar-sep {
    width: 2px; align-self: stretch; margin: 0 4px;
    box-shadow: inset 1px 0 var(--shadow), inset -1px 0 var(--hilight);
}

.groupbox {
    border: none;
    box-shadow: inset -1px -1px var(--hilight), inset 1px 1px var(--shadow),
                inset -2px -2px var(--shadow), inset 2px 2px var(--hilight);
    padding: 14px 12px 10px;
    margin-top: 8px;
    position: relative;
}
.groupbox > legend {
    position: absolute; top: -8px; left: 8px;
    background: var(--face);
    padding: 0 4px;
    font-size: 12px;
}

/* ---------- Typography ---------- */

h1, h2, h3 { font-family: var(--font-pixel); font-weight: 600; line-height: 1.2; }
h1 { font-size: 30px; }
h2 { font-size: 20px; margin-bottom: 8px; }
h3 { font-size: 15px; margin-bottom: 4px; }
p { margin-bottom: 8px; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 11px; }
.mono { font-family: var(--font-mono); font-size: 16px; line-height: 1.1; }

.tag {
    display: inline-block;
    font: bold 10px/1.5 var(--font-ui);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #fff;
    background: var(--acc-teal);
    padding: 0 5px;
    box-shadow: inset -1px -1px rgba(0,0,0,0.35), inset 1px 1px rgba(255,255,255,0.35);
}
.tag-navy { background: var(--acc-navy); }
.tag-orange { background: var(--acc-orange); }

/* ---------- Tables (list view) ---------- */

.table-wrap { box-shadow: var(--bevel-in); background: var(--window); padding: 2px; overflow-x: auto; }
.list-view { width: 100%; border-collapse: collapse; font-size: 12px; }
.list-view th {
    text-align: left; font-weight: normal;
    background: var(--face); box-shadow: var(--bevel-out);
    padding: 3px 8px; white-space: nowrap;
}
.list-view td { padding: 3px 8px; border-bottom: 1px dotted #d0d0d0; }
.list-view tbody tr:hover td { background: var(--select); color: var(--select-text); }
.list-view tbody tr:hover td span { color: inherit !important; }

/* ---------- Dialog ---------- */

.dialog {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 10px 6px;
}
.dialog-icon { width: 32px; height: 32px; flex-shrink: 0; image-rendering: pixelated; }

/* ---------- Taskbar ---------- */

.taskbar {
    position: fixed; left: 0; right: 0; bottom: 0;
    height: 36px;
    background: var(--face);
    box-shadow: inset 0 1px var(--face-light), inset 0 2px var(--hilight);
    display: flex; align-items: center; gap: 4px;
    padding: 3px 3px 2px;
    z-index: 50;
}
.start-btn { font-weight: bold; padding: 4px 8px; min-height: 28px; }
.start-btn:active, .start-btn[aria-expanded="true"] { box-shadow: var(--bevel-btn-pressed); padding: 5px 7px 3px 9px; }
.start-btn img { width: 20px; height: 20px; }

.taskbar-items { display: flex; gap: 3px; flex: 1; min-width: 0; overflow: hidden; }
.taskbar-item {
    min-width: 0; max-width: 170px; flex: 0 1 170px;
    justify-content: flex-start;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-height: 28px;
}
.taskbar-item.current {
    box-shadow: var(--bevel-btn-pressed);
    background-color: var(--face-light);
    font-weight: bold;
}
.taskbar-item span { overflow: hidden; text-overflow: ellipsis; }
.taskbar-item img { width: 16px; height: 16px; flex-shrink: 0; }

.tray {
    box-shadow: var(--bevel-thin-in);
    height: 28px;
    padding: 0 10px;
    display: flex; align-items: center; gap: 8px;
    font-size: 12px;
    flex-shrink: 0;
}

.start-menu {
    position: fixed; left: 3px; bottom: 36px;
    background: var(--face);
    box-shadow: var(--bevel-out), 2px 2px 0 rgba(0,0,0,0.3);
    display: none;
    padding: 3px 3px 3px 30px;
    min-width: 220px;
    z-index: 60;
}
.start-menu.open { display: block; }
.start-menu::before {
    content: "didriksi98";
    position: absolute; left: 3px; top: 3px; bottom: 3px; width: 24px;
    background: linear-gradient(0deg, var(--title-a), var(--title-b));
    color: #fff;
    font: bold 16px/24px var(--font-pixel);
    writing-mode: vertical-rl; transform: rotate(180deg);
    padding-top: 8px;
}
.start-menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px; color: var(--text); text-decoration: none; font-size: 12px;
}
.start-menu a:hover, .start-menu a:focus-visible { background: var(--select); color: var(--select-text); outline: none; }
.start-menu a img { width: 24px; height: 24px; image-rendering: pixelated; }
.start-menu hr { border: none; height: 2px; margin: 3px 2px; box-shadow: inset 0 1px var(--shadow), inset 0 -1px var(--hilight); }

@media (max-width: 640px) {
    .taskbar-items { display: none; }
    .taskbar { justify-content: space-between; }
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
