/* Windows 98-ish window on a flat desktop. Depth from hard 1px bevels only:
   no blur, no gradients, no glow. */

@font-face {
  font-family: 'Fixedsys Excelsior';
  src: url('/fonts/fixedsys-excelsior.woff') format('woff');
  font-display: swap;
}

:root {
  --desk: #1f6b63;
  --face: #d6d0bf;
  --face-light: #e8e3d4;
  --highlight: #fbf8ef;
  --shadow: #8a8573;
  --dark: #1a1a17;
  --title: #0b3b36;
  --title-text: #ece4cc;
  --console: #050e0c;
  --console-text: #c8c0a8;
  --teal: #3db5a8;
  --muted: #6f8f88;
  --raised: inset -1px -1px var(--dark), inset 1px 1px var(--highlight), inset -2px -2px var(--shadow), inset 2px 2px var(--face-light);
  --sunken: inset 1px 1px var(--shadow), inset -1px -1px var(--highlight), inset 2px 2px var(--dark), inset -2px -2px var(--face-light);
  /* One line of Fixedsys (16px × 1.5). All vertical spacing is a multiple of it. */
  --line: 24px;
}

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

/* Fixedsys is drawn on a 16px grid; every size stays at 16px so it renders crisp.
   Hierarchy comes from colour and case instead of size. */
body {
  background: var(--desk);
  color: var(--dark);
  font-family: 'Fixedsys Excelsior', 'Courier New', monospace;
  font-size: 16px;
  line-height: var(--line);
  -webkit-font-smoothing: none;
  min-height: 100vh;
  padding: var(--line);
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: var(--line);
}

button {
  font: inherit;
}

/* Desktop icons */
.icons {
  display: flex;
  flex-direction: column;
  gap: calc(var(--line) / 2);
}

.icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 88px;
  padding: 6px 4px;
  background: none;
  border: 1px dotted transparent;
  color: #fff;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.icon-glyph {
  font-size: 32px;
  line-height: 1;
}

.icon-label {
  padding: 0 4px;
}

.icon:focus-visible {
  outline: none;
  border-color: #fff;
}

.icon:focus-visible .icon-label,
.icon:active .icon-label {
  background: var(--title);
}

/* Window */
.window {
  max-width: 600px;
  width: 100%;
  justify-self: center;
  align-self: start;
  background: var(--face);
  box-shadow: var(--raised);
  padding: 3px;
}

.window[hidden] {
  display: none;
}

.title-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--title);
  color: var(--title-text);
  padding: 3px 3px 3px 4px;
  user-select: none;
  -webkit-user-select: none;
}

/* Dragged by its title bar (script.js). No transition: it follows the pointer 1:1. */
.window.dragging {
  will-change: transform;
}

.title-icon {
  width: 20px;
  text-align: center;
  margin-right: 4px;
}

.title-bar h1 {
  flex: 1;
  min-width: 0;
  font-size: inherit;
  font-weight: inherit;
}

.title-button {
  width: 24px;
  height: 22px;
  display: grid;
  place-items: center;
  background: var(--face);
  box-shadow: var(--raised);
  border: 0;
  line-height: 1;
  color: var(--dark);
  cursor: pointer;
}

.title-button:last-child {
  margin-left: 2px;
}

.title-button:active:not(:disabled) {
  box-shadow: var(--sunken);
  padding: 2px 0 0 2px;
}

/* Greyed, embossed glyph: the Windows look for an unavailable control. */
.title-button:disabled {
  color: var(--shadow);
  text-shadow: 1px 1px var(--highlight);
  cursor: default;
}

.title-button:focus-visible {
  outline: 1px dotted var(--dark);
  outline-offset: -5px;
}

/* Content */
.content {
  background: var(--console);
  color: var(--console-text);
  box-shadow: var(--sunken);
  margin-top: 3px;
  padding: var(--line) calc(var(--line) - 4px);
  display: flex;
  flex-direction: column;
  gap: var(--line);
}

.lead {
  color: var(--title-text);
}

.course {
  color: var(--muted);
}

.group h2 {
  font-size: inherit;
  font-weight: inherit;
  color: var(--teal);
}

.group h2 .number {
  color: var(--muted);
}

.group ul {
  list-style: none;
}

/* Name on the left, where it goes on the right.
   A row inverts like a selected list item on hover and on keyboard focus. */
.row {
  display: flex;
  justify-content: space-between;
  gap: 2ch;
  padding: 0 6px;
  margin: 0 -6px;
  color: var(--console-text);
  text-decoration: none;
}

.row .dest {
  color: var(--muted);
  white-space: nowrap;
}

.row:focus-visible,
.row:active {
  background: var(--teal);
  color: var(--console);
  outline: 1px dotted var(--title-text);
  outline-offset: 0;
}

@media (hover: hover) {
  .row:hover {
    background: var(--teal);
    color: var(--console);
  }

  .row:hover .dest {
    color: var(--console);
  }
}

.row:focus-visible .dest,
.row:active .dest {
  color: var(--console);
}

/* Status bar */
.status-bar {
  display: flex;
  gap: 3px;
  margin-top: 3px;
}

.status-bar span {
  flex: 1;
  min-width: 0;
  box-shadow: var(--sunken);
  padding: 2px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-bar .keys {
  flex: none;
}

/* The key legend only means something with a keyboard, and needs room. */
@media (hover: none), (max-width: 640px) {
  .status-bar .keys {
    display: none;
  }
}

@media (max-width: 640px) {
  body {
    grid-template-columns: minmax(0, 1fr);
    padding: calc(var(--line) / 2);
    gap: calc(var(--line) / 2);
  }

  .icons {
    flex-direction: row;
  }

  .content {
    padding: calc(var(--line) / 2 + 4px) 12px;
  }

  .row .dest {
    display: none;
  }
}
