/* ==========================================================================
   Macintology — System 7 desktop
   Fonts: ChicagoFLF (titles/menus), ChiKareGo2 (Geneva-style body)
   ========================================================================== */

@font-face {
  font-family: "Chicago";
  src: url("../fonts/ChicagoFLF.woff2") format("woff2"),
       url("../fonts/ChicagoFLF.woff") format("woff");
  font-display: swap;
}
@font-face {
  font-family: "Geneva9";
  src: url("../fonts/ChiKareGo2.woff2") format("woff2"),
       url("../fonts/ChiKareGo2.woff") format("woff");
  font-display: swap;
}

:root {
  --chicago: "Chicago", "Charcoal", "Geneva", "Helvetica Neue", sans-serif;
  --geneva: "Geneva9", "Geneva", "Verdana", sans-serif;
  --menubar-h: 30px;
  --ink: #000;
  --paper: #fff;
}

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

html, body { height: 100%; }

body {
  font-family: var(--geneva);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  overflow: hidden;
  /* 50%-dither desktop gray */
  background: conic-gradient(#9d9d9d 25%, #8f8f8f 0 50%, #9d9d9d 0 75%, #8f8f8f 0) 0 0 / 4px 4px;
  -webkit-font-smoothing: none;
  user-select: none;
}

img { -webkit-user-drag: none; }

/* ==========================================================================
   Boot screen
   ========================================================================== */

#boot {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: conic-gradient(#9d9d9d 25%, #8f8f8f 0 50%, #9d9d9d 0 75%, #8f8f8f 0) 0 0 / 4px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity .5s ease;
}
#boot.fade-out { opacity: 0; pointer-events: none; }
#boot.done { display: none; }

.boot-mac {
  position: absolute;
  opacity: 0;
}
.boot-mac.show { opacity: 1; }
.happy-mac { width: 66px; height: 78px; image-rendering: pixelated; }
.happy-mac.small { width: 44px; height: 52px; }

.boot-welcome {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 2px 2px 0 rgba(0,0,0,.4);
  padding: 26px 44px;
  text-align: center;
  opacity: 0;
  transition: opacity .35s ease;
}
.boot-welcome.show { opacity: 1; }
.boot-welcome h1 {
  font-family: var(--chicago);
  font-weight: normal;
  font-size: 30px;
}
.boot-sub { margin-top: 6px; color: #333; }

.boot-status {
  position: absolute;
  left: 24px;
  bottom: 78px;
  font-family: var(--chicago);
  font-size: 16px;
  min-height: 22px;
  white-space: pre;
}

.boot-exts {
  position: absolute;
  left: 20px;
  bottom: 20px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.boot-exts img, .boot-exts .ext-mystery {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .25s ease, transform .25s ease;
}
.boot-exts .ext-mystery {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--chicago);
  font-size: 26px;
  background: var(--paper);
  border: 2px solid var(--ink);
}
.boot-exts .on { opacity: 1; transform: translateY(0); }

.boot-skip {
  position: absolute;
  right: 20px;
  bottom: 20px;
  font-size: 14px;
  color: #555;
}

/* ==========================================================================
   Shut down screen
   ========================================================================== */

#shutdown {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: #1a1a1a;
  color: #f2f2f2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: var(--chicago);
  font-size: 26px;
  text-align: center;
  padding: 20px;
}
#shutdown[hidden] { display: none; }
.shutdown-sub { font-family: var(--geneva); font-size: 17px; color: #aaa; }
#shutdown .btn { margin-top: 18px; }

/* ==========================================================================
   Menu bar
   ========================================================================== */

#menubar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--menubar-h);
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  z-index: 500;
  font-family: var(--chicago);
  font-size: 18px;
}

.menus { display: flex; list-style: none; align-items: stretch; }
.menu { position: relative; display: flex; }

.menu-title {
  font: inherit;
  background: none;
  border: 0;
  padding: 0 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.menu.open > .menu-title { background: var(--ink); color: var(--paper); }
.menu.open > .menu-title .apple-logo { fill: var(--paper); }
.apple-logo { width: 17px; height: 20px; fill: var(--ink); display: block; }

.menu-drop {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 250px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-top: 0;
  box-shadow: 2px 2px 0 rgba(0,0,0,.4);
  padding: 3px 0;
  z-index: 600;
}
.menu.open > .menu-drop { display: block; }

.menu-drop hr {
  border: 0;
  border-top: 2px dotted #888;
  margin: 3px 0;
}

.menu-item {
  font: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 5px 18px 5px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.menu-item:hover:not(.disabled) { background: var(--ink); color: var(--paper); }
.menu-item.disabled { color: #999; cursor: default; }
.menu-item .mi-key { margin-left: auto; padding-left: 24px; opacity: .7; }
.mi-icon { width: 18px; height: 18px; border-radius: 4px; }
.menu-item.blinking { animation: mi-blink .3s steps(2, jump-none) 3; }
@keyframes mi-blink {
  0%   { background: var(--ink); color: var(--paper); }
  50%  { background: var(--paper); color: var(--ink); }
  100% { background: var(--ink); color: var(--paper); }
}

#clock {
  display: flex;
  align-items: center;
  padding: 0 16px;
  cursor: default;
}

/* ==========================================================================
   Desktop & icons
   ========================================================================== */

#desktop {
  position: fixed;
  inset: var(--menubar-h) 0 0 0;
}

.desk-icons {
  position: absolute;
  top: 18px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.desk-icon {
  font-family: var(--geneva);
  font-size: 15px;
  background: none;
  border: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 108px;
}
.desk-icon .di-art { display: block; }
.desk-icon .di-art img { width: 52px; height: 52px; border-radius: 12px; display: block; }
.bw-icon { width: 52px; display: block; }
.desk-icon .di-label {
  background: var(--paper);
  padding: 1px 5px;
  line-height: 1.2;
}
.desk-icon.selected .di-label { background: var(--ink); color: var(--paper); }
.desk-icon.selected .di-art { filter: brightness(.55); }

#trashIcon {
  position: absolute;
  right: 26px;
  bottom: 20px;
}
#trashIcon.wiggle { animation: wiggle .5s ease; }
@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-7deg); }
  50% { transform: rotate(6deg); }
  75% { transform: rotate(-3deg); }
}

.desk-icon.scatter { transition: transform .45s ease; }

/* ==========================================================================
   Windows
   ========================================================================== */

.window {
  position: absolute;
  left: var(--x, 15%);
  top: var(--y, 15%);
  width: min(var(--w, 460px), calc(100vw - 24px));
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 rgba(0,0,0,.45);
  z-index: 10;
}
.window[hidden] { display: none; }
.window.zoomed {
  left: 3% !important;
  top: 4% !important;
  width: min(760px, 94vw);
}

.titlebar {
  position: relative;
  height: 26px;
  border-bottom: 2px solid var(--ink);
  display: flex;
  align-items: center;
  padding: 0 6px;
  cursor: grab;
  background: var(--paper);
}
.window.active .titlebar {
  background:
    repeating-linear-gradient(to bottom,
      transparent 0 3px, var(--ink) 3px 4px) content-box;
  padding-top: 5px;
  padding-bottom: 5px;
}

.titlebar .title {
  font-family: var(--chicago);
  font-size: 17px;
  margin: 0 auto;
  padding: 0 10px;
  background: var(--paper);
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.closebox, .zoombox {
  width: 15px;
  height: 15px;
  border: 2px solid var(--ink);
  background: var(--paper);
  cursor: pointer;
  padding: 0;
  flex: none;
  position: relative;
}
.zoombox::after {
  content: "";
  position: absolute;
  inset: -1px auto auto -1px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--ink);
}
.closebox:active, .zoombox:active { background: var(--ink); }

.win-body {
  padding: 16px 18px;
  max-height: calc(100vh - var(--menubar-h) - 120px);
  overflow: auto;
  cursor: default;
}

/* ---- welcome ---- */
.wordmark {
  font-family: var(--chicago);
  font-weight: normal;
  font-size: 44px;
  line-height: 1.05;
}
.wordmark .tm { font-size: 16px; vertical-align: super; }
.tagline {
  font-family: var(--chicago);
  font-size: 18px;
  margin: 2px 0 12px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
}
.welcome-body p + p { margin-top: 10px; }
.hint { font-style: italic; }

.welcome-apps {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.mini-app {
  font-family: var(--geneva);
  font-size: 14px;
  flex: 1;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 8px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  line-height: 1.15;
}
.mini-app:hover { background: #eee; }
.mini-app:active { background: var(--ink); color: var(--paper); }
.mini-app img { width: 42px; height: 42px; border-radius: 10px; }

/* ---- app windows ---- */
.app-hero {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}
.app-icon { width: 86px; height: 86px; border-radius: 19px; flex: none; }
.app-hero h2 {
  font-family: var(--chicago);
  font-weight: normal;
  font-size: 26px;
  line-height: 1.1;
}
.app-tagline { font-style: italic; margin-top: 4px; }

.get-info {
  margin: 12px 0 4px;
  border-top: 2px dotted #888;
  padding-top: 10px;
  border-collapse: collapse;
}
.get-info th {
  font-family: var(--chicago);
  font-weight: normal;
  text-align: right;
  padding: 2px 10px 2px 0;
  white-space: nowrap;
  vertical-align: top;
}
.get-info td { padding: 2px 0; }

.app-actions {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---- buttons ---- */
.btn {
  font-family: var(--chicago);
  font-size: 17px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 5px 20px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:active { background: var(--ink); color: var(--paper); }
.btn.default {
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink);
  margin: 5px;
}
.btn.disabled {
  color: #999;
  border-color: #999;
  cursor: default;
}

/* ---- about ---- */
.about-head { display: flex; gap: 16px; align-items: center; }
.about-body hr { border: 0; border-top: 2px solid var(--ink); margin: 12px 0; }
.dim { color: #555; }
.mem-rows { margin-bottom: 12px; }
.mem-row { display: flex; justify-content: space-between; gap: 12px; }
.mem-label { font-family: var(--chicago); }
.mem-bars { display: grid; gap: 7px; }
.mem-bar { display: grid; grid-template-columns: 180px 1fr; gap: 10px; align-items: center; }
.mb-name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-track { border: 2px solid var(--ink); height: 14px; display: block; }
.mb-fill {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--ink) 0 3px, var(--paper) 3px 6px);
}
.about-foot { margin-top: 14px; font-size: 15px; }

/* ---- lab ---- */
.lab-warn { font-family: var(--chicago); margin-bottom: 10px; }
.lab-list { list-style: none; display: grid; gap: 12px; margin-bottom: 12px; }
.lab-list li { border: 2px dotted #888; padding: 9px 12px; }
.lab-list strong { font-family: var(--chicago); font-weight: normal; }
.lab-status { display: block; font-size: 14px; color: #555; margin-top: 3px; }

/* ---- trash & moof ---- */
.trash-line { font-family: var(--chicago); margin-bottom: 8px; }
.moof-body { text-align: center; }
.clarus { width: 130px; margin: 6px auto 10px; display: block; }
.moof-body p + p { margin-top: 6px; }

/* ==========================================================================
   Drag outline (System 7 dragged an outline, not the window)
   ========================================================================== */

#dragOutline {
  position: fixed;
  border: 2px dotted var(--ink);
  z-index: 900;
  pointer-events: none;
}
#dragOutline[hidden] { display: none; }

/* ==========================================================================
   No-script & small screens
   ========================================================================== */

.noscript-note {
  position: fixed;
  inset: auto 12px 12px 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 14px 18px;
  z-index: 2000;
}
.noscript-note ul { margin: 8px 0 0 22px; }

@media (max-width: 700px) {
  body { font-size: 16px; }
  .desk-icons {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 12px 8px 0;
  }
  .desk-icon { width: 88px; }
  #trashIcon { position: fixed; right: 10px; bottom: 12px; }
  .window {
    left: 3% !important;
    top: 16% !important;
    width: 94vw !important;
  }
  .menu-title { padding: 0 10px; }
  #clock { padding: 0 10px; }
  .welcome-apps { flex-direction: column; }
  .mini-app { flex-direction: row; justify-content: flex-start; }
  .mem-bar { grid-template-columns: 130px 1fr; }
}
