/* ALTIMIT OS shell chrome: boot screen, desktop, windows, taskbar.
 * Consumes tokens.css exclusively -- no raw colours in here. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--void);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  overflow: hidden;
  /* The client is chrome, not a document -- stray text selection on
   * panels and labels makes it feel like a web page. Inputs and prose
   * opt back in below. */
  user-select: none;
}

.icon {
  display: block;
  flex: none;
}

.noscript {
  padding: var(--sp-6);
  color: var(--text);
  font-family: var(--font-mono);
}

/* ------------------------------------------------------------------ */
/* boot                                                               */
/* ------------------------------------------------------------------ */

.boot {
  position: fixed;
  inset: 0;
  z-index: var(--z-boot);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--sp-8);
  background: var(--void);
  cursor: pointer;
  transition: opacity var(--t-med) var(--ease);
}

.boot--out {
  opacity: 0;
}

.boot__log {
  margin: 0;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.6;
  white-space: pre;
}

.boot__skip {
  position: absolute;
  right: var(--sp-6);
  bottom: var(--sp-6);
  border: 0;
  background: none;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* desktop                                                            */
/* ------------------------------------------------------------------ */

.desktop {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.surface {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  /* A fine technical grid plus a vignette. Structure, not decoration:
   * no decorative gradient blobs anywhere in this project. */
  background-color: var(--void);
  background-image:
    radial-gradient(circle at 50% 0%, rgba(79, 214, 232, 0.05), transparent 60%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  background-position: 0 0, -1px -1px, -1px -1px;
}

/* Single scanline layer, toggleable by removing one rule. Not baked
 * into component styles. */
.surface::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.16) 0 1px,
    transparent 1px 3px
  );
}

/* ------------------------------------------------------------------ */
/* desktop shortcuts                                                  */
/* ------------------------------------------------------------------ */

.icons {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: var(--sp-1);
  height: 100%;
  padding: var(--sp-3);
}

.shortcut {
  display: flex;
  width: 84px;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-1);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: var(--fs-xs);
  text-align: center;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease);
}

.shortcut:hover,
.shortcut:focus-visible {
  border-color: var(--line-hi);
  background: var(--cyan-glow);
  color: var(--cyan);
  outline: none;
}

.shortcut__glyph {
  display: block;
  color: inherit;
}

.shortcut__label {
  line-height: var(--lh-tight);
}

/* ------------------------------------------------------------------ */
/* windows                                                            */
/* ------------------------------------------------------------------ */

.window {
  position: absolute;
  z-index: var(--z-window);
  display: flex;
  min-width: 280px;
  min-height: 140px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-hi);
  border-radius: var(--radius);
  background: var(--panel);
  /* A hard 1px outer edge, not a blur. */
  box-shadow: 0 0 0 1px var(--panel-lo);
}

.window--active {
  border-color: var(--cyan-dim);
}

.window--min {
  display: none;
}

/* Maximised. Geometry itself is set inline by the window manager; this
 * only squares off the edges that now meet the screen. */
.window--max {
  border-radius: 0;
  box-shadow: none;
}

.window--max .window__bar {
  cursor: default;
}

.window--dragging {
  /* Stop text/iframe selection fighting the drag. */
  user-select: none;
}

.window__bar {
  display: flex;
  height: var(--titlebar-h);
  flex: none;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-1) 0 var(--sp-2);
  border-bottom: var(--border);
  background: var(--panel-hi);
  color: var(--text-dim);
  cursor: grab;
  touch-action: none;
}

.window--active .window__bar {
  color: var(--cyan);
}

.window--dragging .window__bar {
  cursor: grabbing;
}

.window__bar-icon {
  color: inherit;
}

.window__title {
  flex: 1;
  overflow: hidden;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.window__controls {
  display: flex;
  gap: 2px;
}

.window__btn {
  display: grid;
  width: 20px;
  height: 18px;
  place-items: center;
  border: 1px solid transparent;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: color var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease);
}

.window__btn:hover,
.window__btn:focus-visible {
  border-color: var(--line-hi);
  background: var(--panel-lo);
  color: var(--cyan);
  outline: none;
}

.window__btn--close:hover,
.window__btn--close:focus-visible {
  border-color: var(--blood);
  color: var(--blood);
}

.window__body {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* taskbar                                                            */
/* ------------------------------------------------------------------ */

.taskbar {
  display: flex;
  height: var(--taskbar-h);
  flex: none;
  align-items: stretch;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2);
  border-top: 1px solid var(--line-hi);
  background: var(--panel-hi);
  z-index: var(--z-taskbar);
}

.taskbar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-right: var(--sp-3);
  border-right: var(--border);
  color: var(--cyan);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
}

.taskbar__list {
  display: flex;
  flex: 1;
  align-items: stretch;
  gap: var(--sp-1);
  overflow: hidden;
}

.task {
  display: flex;
  max-width: 190px;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-3);
  border: var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text-dim);
  font: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}

.task span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task:hover {
  color: var(--text);
}

.task--active {
  border-color: var(--cyan-dim);
  background: var(--panel-lo);
  color: var(--cyan);
}

.taskbar__clock {
  display: flex;
  align-items: center;
  padding-left: var(--sp-3);
  border-left: var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ */
/* scrollbars -- thin and in-palette                                  */
/* ------------------------------------------------------------------ */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-hi) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--panel-lo);
}

*::-webkit-scrollbar-thumb {
  border: 2px solid var(--panel-lo);
  background: var(--line-hi);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--cyan-dim);
}
