/* Windows 95 widget kit, taken from the app so the site and Sound95 share one look.
   Page layout is in site.css. */

@font-face {
  font-family: "Pixelated MS Sans Serif";
  src: url("../fonts/ms_sans_serif.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Pixelated MS Sans Serif";
  src: url("../fonts/ms_sans_serif_bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --face: #c0c0c0;
  --hilite: #ffffff;
  --light: #dfdfdf;
  --shadow: #808080;
  --dark: #000000;
  --muted: #404040;
  --select: #000080;
  --select-text: #ffffff;
  --desktop: #008080;
  --tooltip: #ffffe1;
  --disabled: #808080;
  --raised: inset -1px -1px var(--dark), inset 1px 1px var(--hilite),
            inset -2px -2px var(--shadow), inset 2px 2px var(--light);
  --pressed: inset -1px -1px var(--hilite), inset 1px 1px var(--dark),
             inset -2px -2px var(--light), inset 2px 2px var(--shadow);
  --sunken: inset -1px -1px var(--hilite), inset 1px 1px var(--shadow),
            inset -2px -2px var(--light), inset 2px 2px var(--dark);
  --sunken-thin: inset -1px -1px var(--hilite), inset 1px 1px var(--shadow);
  --raised-thin: inset -1px -1px var(--shadow), inset 1px 1px var(--hilite);
  --etched: inset 0 1px var(--shadow), inset 0 2px var(--hilite);
  --checker: repeating-conic-gradient(var(--hilite) 0 25%, var(--face) 0 50%) 0 0 / 2px 2px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--desktop);
  color: var(--dark);
  font: 11px/1.25 "Pixelated MS Sans Serif", "MS Sans Serif", Arial, sans-serif;
  -webkit-font-smoothing: none;
  font-smooth: never;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

img { display: block; max-width: 100%; }
img.px { flex: none; width: 16px; height: 16px; image-rendering: pixelated; }
img.px32 { flex: none; width: 32px; height: 32px; image-rendering: pixelated; }
img.px9 { flex: none; width: 9px; height: 9px; image-rendering: pixelated; }

/* Buttons. Links that lead somewhere use .button and look the same. */
button, .button {
  font: inherit;
  color: var(--dark);
  background: var(--face);
  border: 0;
  border-radius: 0;
  box-shadow: var(--raised);
  min-width: 75px;
  min-height: 23px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
a.button { cursor: pointer; }
button:active:not(:disabled), .button:active { box-shadow: var(--pressed); padding: 1px 11px 0 13px; }
button:focus, .button:focus { outline: none; }
button:focus-visible, .button:focus-visible, a:focus-visible, summary:focus-visible { outline: 1px dotted currentColor; outline-offset: -4px; }
button:disabled { color: var(--disabled); text-shadow: 1px 1px var(--hilite); }
.default { box-shadow: inset 0 0 0 1px var(--dark), inset -2px -2px var(--dark), inset 2px 2px var(--hilite),
                       inset -3px -3px var(--shadow), inset 3px 3px var(--light); }

button.tool, .button.tool {
  min-width: 24px; width: 24px; height: 22px; min-height: 22px; padding: 0;
  display: inline-grid; place-items: center;
}
button.tool:active:not(:disabled), .button.tool:active { padding: 1px 0 0 1px; }
button.tool:disabled img { opacity: .35; }

.sunken { background: var(--hilite); box-shadow: var(--sunken); }
.sunken-thin { box-shadow: var(--sunken-thin); }

/* Sliders */
input.slider {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  height: 20px;
  margin: 0;
  outline: none;
}
input.slider::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--dark);
  box-shadow: 0 1px var(--hilite), 1px 0 var(--hilite), -1px 0 var(--shadow), 0 -1px var(--shadow);
}
input.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 20px;
  margin-top: -8px;
  background: var(--face);
  box-shadow: var(--raised);
}
input.slider::-moz-range-track {
  height: 4px;
  background: var(--dark);
  box-shadow: 0 1px var(--hilite), 1px 0 var(--hilite), -1px 0 var(--shadow), 0 -1px var(--shadow);
}
input.slider::-moz-range-thumb {
  width: 11px;
  height: 20px;
  border: 0;
  border-radius: 0;
  background: var(--face);
  box-shadow: var(--raised);
}
input.slider:focus-visible { outline: 1px dotted var(--dark); }

/* Scrollbars. Touch screens keep their own overlay scrollbars. */
@media (pointer: fine) {
  ::-webkit-scrollbar { width: 16px; height: 16px; }
  ::-webkit-scrollbar-track { background: var(--checker); }
  ::-webkit-scrollbar-thumb { background: var(--face); box-shadow: var(--raised); }
  ::-webkit-scrollbar-corner { background: var(--face); }
  ::-webkit-scrollbar-button:single-button { display: block; width: 16px; height: 16px; background-color: var(--face); box-shadow: var(--raised);
    background-repeat: no-repeat; background-position: center; }
  ::-webkit-scrollbar-button:single-button:vertical:decrement {
    background-image: url("../img/icons/scroll-up.svg"); }
  ::-webkit-scrollbar-button:single-button:vertical:increment {
    background-image: url("../img/icons/scroll-down.svg"); }
  ::-webkit-scrollbar-button:single-button:horizontal { display: none; }
}
@supports not selector(::-webkit-scrollbar) {
  .content { scrollbar-color: var(--face) var(--light); }
}

/* Window chrome */
.window {
  display: flex;
  flex-direction: column;
  background: var(--face);
  box-shadow: var(--raised);
  padding: 3px;
}
.titlebar {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  flex: none;
  padding: 0 2px;
  background: var(--select);
  color: var(--select-text);
  font-weight: 700;
}
.titlebar.idle { background: var(--shadow); color: var(--face); }
.titlebar-icon { width: 16px; height: 16px; flex: none; filter: brightness(0) invert(1); }
.titlebar-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; align-self: stretch; line-height: 18px; }
.titlebar-buttons { display: flex; flex: none; }
button.caption {
  min-width: 16px; width: 16px; height: 14px; min-height: 14px; padding: 0;
  display: grid; place-items: center; color: var(--dark);
}
button.caption:active:not(:disabled) { padding: 1px 0 0 1px; }
button.caption:disabled img { opacity: .35; }
#win-close, .dialog-close { margin-left: 2px; }

/* Menus */
.menubar { display: flex; height: 19px; flex: none; position: relative; z-index: 30; }
.menu-wrap { position: relative; }
button.menu-title {
  min-width: 0; min-height: 19px; height: 19px; padding: 0 7px;
  background: none; box-shadow: none; color: inherit;
}
button.menu-title:active:not(:disabled) { box-shadow: none; padding: 0 7px; }
button.menu-title[aria-expanded="true"] { background: var(--select); color: var(--select-text); }
.menu {
  position: absolute;
  z-index: 50;
  min-width: 190px;
  padding: 3px;
  background: var(--face);
  box-shadow: var(--raised);
}
.menu[hidden] { display: none; }
.menubar .menu { top: 100%; left: 0; }
.menu-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  justify-content: stretch;
  gap: 4px;
  width: 100%;
  text-align: left;
  min-height: 19px;
  padding: 0 10px 0 2px;
  white-space: nowrap;
  color: var(--dark);
  background: none;
  box-shadow: none;
  text-decoration: none;
  cursor: default;
}
button.menu-item:active:not(:disabled) { box-shadow: none; padding: 0 10px 0 2px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--select); color: var(--select-text); outline: none; }
.menu-sep { height: 2px; margin: 3px 1px; box-shadow: var(--etched); }

/* Dialogs */
dialog.window { border: 0; padding: 3px; width: 400px; max-width: calc(100vw - 32px); color: var(--dark); }
dialog.window:not([open]) { display: none; }
dialog::backdrop { background: transparent; }
.dialog-body { padding: 12px; display: grid; gap: 10px; line-height: 1.35; }
.dialog-row { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 6px; padding: 0 12px 12px; }
.dialog p { margin: 0; }

/* Tabs */
.tabs { display: flex; flex: none; padding: 2px 2px 0; position: relative; z-index: 1; }
.tab {
  background: var(--face);
  color: var(--dark);
  box-shadow: inset 1px 1px var(--hilite), inset -1px 0 var(--dark), inset -2px 0 var(--shadow);
  min-height: 19px; height: 19px; padding: 0 14px;
  margin-top: 2px;
  display: inline-flex; align-items: center; gap: 4px;
  text-decoration: none;
}
.tab.selected { height: 22px; margin-top: 0; margin-bottom: -2px; z-index: 2; position: relative; font-weight: 700; }

/* Status bar */
.statusbar { display: flex; gap: 2px; height: 20px; flex: none; padding-top: 2px; }
.status-cell { padding: 2px 5px; box-shadow: var(--sunken-thin); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-cell.grow { flex: 1; min-width: 0; }

.badge { flex: none; padding: 0 3px; background: var(--tooltip); color: var(--dark); box-shadow: inset 0 0 0 1px var(--dark); }
