/* Windows 98 mode. Everything is scoped to html[data-theme="windows"], set by windows.js.
   Same pages, same markup: the sidebar becomes the Start menu, main becomes a window. */

html[data-theme="windows"] {
  --w-desktop: #008080;
  --w-face: #c0c0c0;
  --w-light: #dfdfdf;
  --w-white: #ffffff;
  --w-shadow: #808080;
  --w-dark: #0a0a0a;
  --w-navy: #000080;
  --w-blue: #1084d0;
  --w-raised: inset -1px -1px var(--w-dark), inset 1px 1px var(--w-light),
              inset -2px -2px var(--w-shadow), inset 2px 2px var(--w-white);
  --w-sunken: inset -1px -1px var(--w-white), inset 1px 1px var(--w-shadow),
              inset -2px -2px var(--w-light), inset 2px 2px var(--w-dark);
  --w-chrome: Tahoma, "MS Sans Serif", "Segoe UI", Geneva, Verdana, sans-serif;

  /* Pin the site palette to light so the page inside the window reads like 1998. */
  --bg: #ffffff;
  --ink: #000000;
  --muted: #555555;
  --rule: #c0c0c0;
  --panel: #f4f4f4;
  --accent: #000080;
  color-scheme: light;
}

html[data-theme="windows"] body {
  background: var(--w-desktop);
  color: #000;
  font: 13px/1.4 var(--w-chrome);
}
html[data-theme="windows"] a { color: #0000ee; }
html[data-theme="windows"] a:visited { color: #551a8b; }

/* ---------- desktop + window ---------- */

html[data-theme="windows"] .layout {
  display: block;
  min-height: 100vh;
  padding: 24px 16px calc(64px + env(safe-area-inset-bottom, 0px));
}

html[data-theme="windows"] .main {
  max-width: 900px;
  margin: 0 auto;
  padding: 3px;
  background: var(--w-face);
  box-shadow: var(--w-raised);
}

html[data-theme="windows"] .win-titlebar {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, var(--w-navy), var(--w-blue));
  color: #fff;
  font: bold 13px/1 var(--w-chrome);
  padding: 4px 3px 4px 6px;
  margin-bottom: 3px;
}
html[data-theme="windows"] .win-titlebar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
html[data-theme="windows"] .win-btns { display: flex; gap: 2px; flex-shrink: 0; }
html[data-theme="windows"] .win-btns span {
  display: grid; place-items: center;
  width: 16px; height: 14px;
  background: var(--w-face); color: #000;
  box-shadow: var(--w-raised);
  font: bold 10px/1 var(--w-chrome);
}
html[data-theme="windows"] .win-btns span:last-child { margin-left: 2px; }

html[data-theme="windows"] .pane {
  background: #fff;
  box-shadow: var(--w-sunken);
  padding: 28px 32px 36px;
}

/* ---------- content inside the window ---------- */

html[data-theme="windows"] .label {
  font: bold 11px/1 var(--w-chrome);
  letter-spacing: 0;
  text-transform: none;
  color: #000;
}
html[data-theme="windows"] .lede { font: 15px/1.55 var(--w-chrome); }
html[data-theme="windows"] .empty { color: #555; border-color: var(--w-face); }

/* Explorer "Details" view. */
html[data-theme="windows"] .log th {
  background: var(--w-face);
  box-shadow: var(--w-raised);
  color: #000;
  font: 12px/1 var(--w-chrome);
  text-transform: none;
  letter-spacing: 0;
}
html[data-theme="windows"] .log td { border-bottom: 0; padding: 4px 10px; font-family: var(--w-chrome); }
html[data-theme="windows"] .log tr:hover td { background: var(--w-navy); color: #fff; }
html[data-theme="windows"] .log tr:hover a { color: #fff; }
html[data-theme="windows"] .log td.title a { color: #000; font-weight: normal; }
html[data-theme="windows"] .log td.title a::before,
html[data-theme="windows"] .log tr.soon td.title::before {
  content: "";
  display: inline-block;
  width: 11px; height: 13px;
  margin-right: 8px;
  vertical-align: -2px;
  background: #fff;
  border: 1px solid #000;
  box-shadow: inset -3px 0 0 -2px #000;
}

/* Post: WordPad. */
html[data-theme="windows"] .post h1 { font: bold 26px/1.25 var(--w-chrome); letter-spacing: 0; }
html[data-theme="windows"] .post .meta { font-family: var(--w-chrome); color: #555; }
html[data-theme="windows"] .prose { font: 18px/1.65 Georgia, "Times New Roman", serif; color: #000; }
html[data-theme="windows"] .prose h2 { font: bold 17px/1.3 var(--w-chrome); }
html[data-theme="windows"] .prose pre {
  background: #000;
  color: #c0c0c0;
  border: 3px solid var(--w-face);
  border-radius: 0;
  box-shadow: var(--w-sunken);
  font-family: "Courier New", Courier, monospace;
}
html[data-theme="windows"] .prose blockquote {
  background: #ffffe1;
  border: 1px solid #000;
  border-left-width: 1px;
  font-family: var(--w-chrome);
}
html[data-theme="windows"] .prose blockquote::before { content: "Tip of the Day"; color: #000; font: bold 12px/1 var(--w-chrome); letter-spacing: 0; text-transform: none; }

/* Report box: a Properties dialog. */
html[data-theme="windows"] .report {
  background: var(--w-face);
  border: 0;
  border-radius: 0;
  box-shadow: var(--w-raised);
  padding: 4px;
}
html[data-theme="windows"] .report dt, html[data-theme="windows"] .report dd { border-top: 0; font-family: var(--w-chrome); }
html[data-theme="windows"] .report dt { font: bold 12px/1.6 var(--w-chrome); letter-spacing: 0; text-transform: none; color: #000; }
html[data-theme="windows"] .report dt::after { content: ":"; }
html[data-theme="windows"] .feed-url { background: #fff; border: 0; border-radius: 0; box-shadow: var(--w-sunken); font-family: "Courier New", monospace; }

/* ---------- Start menu (the sidebar) ---------- */

html[data-theme="windows"] .side {
  display: none;
  position: fixed;
  left: 2px;
  top: auto;
  bottom: calc(36px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  width: 250px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  height: auto;
  background: var(--w-face);
  border: 0;
  box-shadow: var(--w-raised);
  padding: 4px 4px 4px 30px;
}
html[data-theme="windows"].start-open .side { display: block; }
/* The vertical brand band down the left edge. */
html[data-theme="windows"] .side::before {
  content: "Mark Olech 98";
  position: absolute;
  left: 3px; top: 3px; bottom: 3px;
  width: 22px;
  background: linear-gradient(0deg, var(--w-navy), var(--w-blue));
  color: #fff;
  font: bold 14px/22px var(--w-chrome);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding-top: 8px;
}
html[data-theme="windows"] .side > * { max-width: none; }
html[data-theme="windows"] .who { margin: 4px 6px 8px; color: #000; }
html[data-theme="windows"] .who strong { font: bold 13px/1.2 var(--w-chrome); }
html[data-theme="windows"] .who span { font: 11px/1.3 var(--w-chrome); color: #333; }
html[data-theme="windows"] .side-label {
  font: 11px/1 var(--w-chrome);
  color: #555;
  letter-spacing: 0;
  text-transform: none;
  margin: 8px 6px 4px;
  padding-top: 6px;
  border-top: 1px solid var(--w-shadow);
  box-shadow: 0 -1px 0 var(--w-white) inset;
}
html[data-theme="windows"] .side-nav, html[data-theme="windows"] .side-toc { margin: 0; }
html[data-theme="windows"] .side-nav a, html[data-theme="windows"] .side-toc a {
  margin: 0;
  padding: 6px 8px;
  border: 0;
  color: #000;
  font: 13px/1.3 var(--w-chrome);
  background: none;
}
html[data-theme="windows"] .side-nav a:hover, html[data-theme="windows"] .side-toc a:hover,
html[data-theme="windows"] .side-nav a:focus-visible {
  background: var(--w-navy);
  color: #fff;
  outline: none;
}
html[data-theme="windows"] .side-nav a[aria-current="page"] { background: none; }
html[data-theme="windows"] .side-nav a[aria-current="page"]:hover { background: var(--w-navy); }
html[data-theme="windows"] .side-nav .count { color: inherit; font-family: var(--w-chrome); }
html[data-theme="windows"] .side-nav a.win-off {
  display: flex !important;
  margin-top: 4px;
  border-top: 1px solid var(--w-shadow);
}

/* ---------- taskbar ---------- */

html[data-theme="windows"] .win-taskbar {
  display: flex !important;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  align-items: center;
  gap: 4px;
  height: calc(34px + env(safe-area-inset-bottom, 0px));
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  background: var(--w-face);
  box-shadow: inset 0 1px var(--w-light), inset 0 2px var(--w-white);
  font: 13px/1 var(--w-chrome);
}
html[data-theme="windows"] .win-start {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px 0 6px;
  border: 0;
  background: var(--w-face);
  box-shadow: var(--w-raised);
  color: #000;
  font: bold 13px/1 var(--w-chrome);
  cursor: pointer;
}
html[data-theme="windows"] .win-start::before {
  content: "";
  width: 14px; height: 12px;
  background:
    linear-gradient(#f33, #f33) 0 0 / 6px 5px no-repeat,
    linear-gradient(#3c3, #3c3) 100% 0 / 6px 5px no-repeat,
    linear-gradient(#36f, #36f) 0 100% / 6px 5px no-repeat,
    linear-gradient(#fc0, #fc0) 100% 100% / 6px 5px no-repeat;
}
html[data-theme="windows"].start-open .win-start { box-shadow: var(--w-sunken); }
html[data-theme="windows"] .win-task {
  display: flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  min-width: 0;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: var(--w-sunken);
  background: repeating-conic-gradient(var(--w-face) 0 25%, var(--w-white) 0 50%) 0 0 / 2px 2px;
}
html[data-theme="windows"] .win-tray {
  margin-left: auto;
  display: flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  box-shadow: inset -1px -1px var(--w-white), inset 1px 1px var(--w-shadow);
}

/* ---------- Shut Down dialog ---------- */

html[data-theme="windows"] .win-dialog:not([hidden]) {
  display: grid !important;
  position: fixed;
  inset: 0;
  z-index: 50;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.25);
}
html[data-theme="windows"] .win-dialog-box {
  width: 100%;
  max-width: 340px;
  margin: 0;
  padding: 3px;
  background: var(--w-face);
  box-shadow: var(--w-raised);
  font: 12px/1.4 var(--w-chrome);
}
html[data-theme="windows"] .win-dialog-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, var(--w-navy), var(--w-blue));
  color: #fff;
  font-weight: bold;
  padding: 3px 3px 3px 6px;
}
html[data-theme="windows"] .win-dialog-title button {
  width: 16px; height: 14px; padding: 0;
  border: 0;
  background: var(--w-face);
  box-shadow: var(--w-raised);
  font: bold 10px/1 var(--w-chrome);
  cursor: pointer;
}
html[data-theme="windows"] .sd-body { display: flex; gap: 14px; padding: 16px 14px 8px; }
/* A little CRT monitor. */
html[data-theme="windows"] .sd-icon {
  flex-shrink: 0;
  width: 32px; height: 26px;
  margin-top: 2px;
  background: #008080;
  border: 3px solid var(--w-face);
  box-shadow: 0 0 0 1px #000, 0 6px 0 -2px var(--w-shadow), 0 6px 0 -1px #000;
}
html[data-theme="windows"] .sd-body fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
html[data-theme="windows"] .sd-body legend { padding: 0; margin-bottom: 8px; }
html[data-theme="windows"] .sd-body label { display: flex; align-items: center; gap: 6px; padding-left: 8px; cursor: pointer; }
html[data-theme="windows"] .sd-buttons { display: flex; justify-content: center; gap: 8px; padding: 8px 0 10px; }
html[data-theme="windows"] .sd-buttons button {
  min-width: 75px;
  padding: 5px 10px;
  border: 0;
  background: var(--w-face);
  box-shadow: var(--w-raised);
  font: 12px/1 var(--w-chrome);
  color: #000;
  cursor: pointer;
}
html[data-theme="windows"] .sd-buttons button:active { box-shadow: var(--w-sunken); }
html[data-theme="windows"] .sd-buttons button:focus-visible { outline: 1px dotted #000; outline-offset: -5px; }

/* Restart: a moment of black, then the page reloads in Windows mode. */
html.restarting body::after { content: ""; position: fixed; inset: 0; z-index: 100; background: #000; }

/* ---------- Shut Down ---------- */

html.shutting-down .win-shutdown {
  display: grid !important;
  position: fixed;
  inset: 0;
  z-index: 100;
  place-items: center;
  background: #000;
  color: #f80;
  font: bold 26px/1.4 var(--w-chrome, Tahoma, sans-serif);
  text-align: center;
}

/* ---------- small screens ---------- */

@media (max-width: 720px) {
  html[data-theme="windows"] .layout { padding: 8px 6px calc(48px + env(safe-area-inset-bottom, 0px)); }
  html[data-theme="windows"] .pane { padding: 18px 16px 24px; }
  html[data-theme="windows"] .win-task { display: none; }
  html[data-theme="windows"] .side { display: none; flex-direction: column; align-items: stretch; gap: 0; border-bottom: 0; }
  html[data-theme="windows"].start-open .side { display: block; }
  html[data-theme="windows"] .side-label, html[data-theme="windows"] .side-toc { display: block; }
  html[data-theme="windows"] .side-nav { flex-direction: column; gap: 0; }
  html[data-theme="windows"] .side-nav .count { display: inline; }
  html[data-theme="windows"] .who { flex: none; }
}

html[data-theme="windows"] .sd-body input[type=radio] { accent-color: #000; margin: 0; }
