/* ============================================================
   Cannaclankathon — Mac OS System 7 style
   ============================================================ */

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

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

:root {
  --font: 'ChiKareGo2', 'ChicagoFLF', 'Charcoal', 'Geneva', 'Verdana', sans-serif;
  --menubar-h: 21px;
  --scale: 1; /* set from JS; whole UI is zoomed by this factor */
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: none;
  font-smooth: never;
  background: #fff;
}

/* The "CRT": everything lives inside here and gets scaled up,
   like an old 512x342 / 640x480 display on a modern monitor. */
#screen {
  position: relative;
  width: calc(100vw / var(--scale));
  height: calc(100vh / var(--scale));
  overflow: hidden;
  transform: scale(var(--scale));
  transform-origin: 0 0;
}

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

#boot {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  transition: opacity .45s ease;
}
#boot.gone { opacity: 0; pointer-events: none; }
#boot .boot-mac svg { width: 72px; height: 72px; display: block; }
.boot-text { font-size: 18px; }

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

#menubar {
  position: relative;
  z-index: 5000;
  height: var(--menubar-h);
  background: #fff;
  border-bottom: 1px solid #000;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
}

#menus { display: flex; }

.menu-root {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 11px;
  white-space: nowrap;
}
.menu-root.logo { padding: 0 13px 0 15px; color: #2a8a2a; }
.menu-root.logo svg { width: 15px; height: 15px; display: block; }
.menu-root.open { background: #000; color: #fff; } /* leaf turns white via currentColor */

.dropdown {
  position: absolute;
  top: var(--menubar-h);
  left: 0;
  min-width: 190px;
  background: #fff;
  color: #000;
  border: 1px solid #000;
  box-shadow: 2px 2px 0 rgba(0,0,0,.35);
  padding: 3px 0;
  z-index: 6000;
}
.dropdown .item {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  padding: 2px 14px 2px 24px;
  white-space: nowrap;
  position: relative;
}
.dropdown .item:hover:not(.disabled) { background: #000; color: #fff; }
.dropdown .item.disabled { color: #999; }
.dropdown .item .check {
  position: absolute;
  left: 8px;
}
.dropdown .sep {
  border-top: 1px dotted #777;
  margin: 3px 2px;
  height: 0;
}

#menubar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px 0 0;
}
#clock {
  display: inline-block;
  min-width: 14ch; /* fits "Wed 12:59 PM"; right edge stays put */
  text-align: right;
}
#finder-menu { display: flex; align-items: center; gap: 5px; font-weight: bold; }
#finder-menu svg { width: 13px; height: 13px; display: block; }

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

#desktop {
  position: absolute;
  inset: var(--menubar-h) 0 0 0;
  overflow: hidden;
  /* Classic 50% gray dither desktop */
  background: repeating-conic-gradient(#000 0% 25%, #fff 0% 50%);
  background-size: 2px 2px;
}

.icon {
  position: absolute;
  width: 80px;
  padding: 4px 2px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  touch-action: none;
}
.icon svg { width: 34px; height: 34px; display: block; }
.icon .label {
  font-size: 11px;
  line-height: 1.15;
  text-align: center;
  padding: 0 4px 1px;
  max-width: 100%;
}
.icon.selected svg { filter: invert(1); }
.icon.selected .label { background: #000; color: #fff; }

/* Icons inside Finder windows are not absolutely positioned */
.icon.inline { position: static; flex: 0 0 auto; }

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

.window {
  position: absolute;
  min-width: 190px;
  background: #fff;
  border: 1px solid #000;
  box-shadow: 2px 2px 0 rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
}

.titlebar {
  position: relative;
  flex: none;
  height: 20px;
  border-bottom: 1px solid #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
  /* System 7 title bar pinstripes */
  background: repeating-linear-gradient(to bottom, #fff 0 2px, #000 2px 3px);
  touch-action: none;
}
.window:not(.active) .titlebar { background: #fff; }
.window:not(.active) .box { visibility: hidden; }

.title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  padding: 0 9px;
  max-width: 68%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.box {
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1px solid #000;
  position: relative;
  z-index: 1;
  flex: none;
}
.box:active { filter: invert(1); }
.zoom-box::after {
  content: '';
  position: absolute;
  top: 1px;
  right: 1px;
  width: 5px;
  height: 5px;
  border-left: 1px solid #000;
  border-bottom: 1px solid #000;
}

.win-info {
  flex: none;
  padding: 3px 8px;
  border-bottom: 1px solid #000;
  font-size: 11px;
  text-align: center;
}

.content {
  flex: 1;
  overflow: auto;
  padding: 10px;
  background: #fff;
  position: relative;
}

/* Classic scrollbars (WebKit) */
.content::-webkit-scrollbar { width: 15px; height: 15px; }
.content::-webkit-scrollbar-track { background: #fff; }
.content::-webkit-scrollbar-track:vertical { border-left: 1px solid #000; }
.content::-webkit-scrollbar-track:horizontal { border-top: 1px solid #000; }
.content::-webkit-scrollbar-thumb {
  background: #cfcfcf;
  border: 1px solid #000;
}
.content::-webkit-scrollbar-thumb:active {
  background: repeating-conic-gradient(#000 0% 25%, #fff 0% 50%);
  background-size: 2px 2px;
}
.content::-webkit-scrollbar-button:single-button {
  display: block;
  width: 15px;
  height: 15px;
  background-color: #fff;
  border: 1px solid #000;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 7px 5px;
}
.content::-webkit-scrollbar-button:single-button:vertical:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='5'%3E%3Cpath d='M0 5 L3.5 0 L7 5 Z' fill='%23000'/%3E%3C/svg%3E");
}
.content::-webkit-scrollbar-button:single-button:vertical:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='5'%3E%3Cpath d='M0 0 L3.5 5 L7 0 Z' fill='%23000'/%3E%3C/svg%3E");
}
.content::-webkit-scrollbar-button:single-button:horizontal:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='5' height='7'%3E%3Cpath d='M5 0 L0 3.5 L5 7 Z' fill='%23000'/%3E%3C/svg%3E");
}
.content::-webkit-scrollbar-button:single-button:horizontal:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='5' height='7'%3E%3Cpath d='M0 0 L5 3.5 L0 7 Z' fill='%23000'/%3E%3C/svg%3E");
}
.content::-webkit-scrollbar-button:single-button:active { filter: invert(1); }
.content::-webkit-scrollbar-corner { background: #fff; border-top: 1px solid #000; border-left: 1px solid #000; }

/* ============ Buttons & dialogs ============ */

.btn {
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.2;
  background: #fff;
  border: 1px solid #000;
  border-radius: 5px;
  padding: 2px 16px 3px;
  cursor: default;
}
.btn:active { background: #000; color: #fff; }
.btn.default { box-shadow: 0 0 0 1px #fff, 0 0 0 2px #000; margin: 2px; }

.dialog-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 6px 4px 0;
}
.dialog-body svg { width: 34px; height: 34px; flex: none; }
.dialog-body p { max-width: 240px; }
.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 4px 2px;
}

/* ============ Window content helpers ============ */

.finder-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 10px;
  align-items: flex-start;
}

.about {
  text-align: center;
  padding: 6px 4px;
}
.about h1 { font-size: 22px; font-weight: normal; margin-bottom: 2px; }
.about .sub { margin-bottom: 12px; }
.about hr { border: none; border-top: 1px dotted #777; margin: 10px 26px; }
.about p { margin: 8px 0; }
.about .mem { display: inline-block; text-align: left; }

.trash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 4px 4px;
}
.trash-empty svg { width: 44px; height: 44px; }
