/* The 16-colour Windows 3.1 palette. */
:root {
  --black: #000000;
  --gray: #808080;
  --silver: #c0c0c0;
  --white: #ffffff;
  --teal: #008080;
  --navy: #000080;
  --blue: #0000ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--teal);
  color: var(--black);
}

body {
  font-family: "MS Sans Serif", "Microsoft Sans Serif", Tahoma, Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

/* Window frame: thick silver border between two black lines. */
.window {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--black);
  outline: 3px solid var(--silver);
  outline-offset: -4px;
  padding: 3px;
  background: var(--silver);
}

.titlebar {
  display: flex;
  align-items: stretch;
  flex: none;
  min-height: 28px;
  background: var(--navy);
  color: var(--white);
  border-bottom: 1px solid var(--black);
}

.titlebar h1,
.titlebar-title {
  flex: 1;
  margin: 0;
  padding: 2px 8px;
  font-size: 1rem;
  font-weight: bold;
  line-height: 24px;
  text-align: center;
}

.titlebar-box {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  background: var(--silver);
  color: var(--black);
  font-size: .75rem;
  font-weight: bold;
  border: 1px solid var(--black);
  border-width: 0 1px;
}

.titlebar-box.raised {
  box-shadow: inset 1px 1px 0 var(--white), inset -2px -2px 0 var(--gray);
}

.statusbar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px;
  background: var(--silver);
  border-top: 1px solid var(--black);
}

/* Raised button with the Windows 3.1 bevel; it sinks when pressed. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 4px 14px;
  font: inherit;
  font-weight: bold;
  color: var(--black);
  text-decoration: none;
  background: var(--silver);
  border: 1px solid var(--black);
  border-radius: 3px;
  box-shadow: inset 1px 1px 0 var(--white), inset 2px 2px 0 var(--white),
    inset -1px -1px 0 var(--gray), inset -2px -2px 0 var(--gray);
  cursor: pointer;
}

.button:active {
  box-shadow: inset 1px 1px 0 var(--gray), inset 2px 2px 0 var(--gray);
}

.button:focus-visible {
  outline: 1px dotted var(--black);
  outline-offset: -6px;
}

.button[disabled] {
  color: var(--gray);
  cursor: default;
}

.button[hidden] { display: none; }

/* Home: the window fills the screen and nothing scrolls. */
html:has(.home),
.home {
  height: 100%;
  overflow: hidden;
}

.home .window {
  height: 100vh;
  height: 100dvh;
}

.desktop {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--teal);
  border: 1px solid var(--black);
  border-width: 0;
}

/* Centred until app.js takes over, so it also works without JavaScript. */
.logo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 290px; /* 5 screen pixels per logo pixel; app.js adapts it to the window. */
  color: var(--white);
  transform: translate(-50%, -50%);
  will-change: transform;
}

.logo.is-placed {
  top: 0;
  left: 0;
}

.logo svg {
  display: block;
  width: 100%;
  height: auto;
}

/* The spin: the disc's rotating highlights are 8 frames side by side, one logo
   width (58 logo pixels) apart, and steps() jumps between them so that the pixel
   grid stays sharp. */
.cd-frames {
  animation: cd-spin .8s steps(8) infinite;
}

@keyframes cd-spin {
  to { transform: translateX(-464px); }
}

@media (prefers-reduced-motion: reduce) {
  .cd-frames { animation: none; }
}

/* Legal notice: a document window on the desktop; this page does scroll. */
.legal-page {
  padding: 16px;
}

.legal-page .window {
  max-width: 48rem;
  margin: 0 auto;
}

.legal {
  padding: 1rem 1.25rem 2rem;
  background: var(--white);
}

.legal a { color: var(--blue); }
.legal h1 { margin-top: 1.5rem; font-size: 1.75rem; line-height: 1.2; }
.legal h2 { margin-top: 2rem; font-size: 1.125rem; }

.updated { font-size: .875rem; }

.legal-page .statusbar {
  justify-content: center;
  font-size: .875rem;
}
