/* Sizes are design pixels from Figma, multiplied by --s (the screen scale set
   in app.js). Colors and type come from data/site.json via CSS variables. */

:root {
  --s: 1;
  --w: 1; /* extra shrink (set in app.js) so a window always fits the screen */
  --text: #000;
  --secondary-alpha: 0.5;
  --strong: 800;
  --title-weight: 700;
  --size: 13px;
  --line: 16px;
  --label: #000;
  --label-selected: #fff;
  --label-selected-bg: #0088ff;
  --selection-box: rgba(0, 0, 0, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Inter", system-ui, sans-serif;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #9cc3e6;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

#screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background-position: center;
  background-size: cover;
  user-select: none;
  -webkit-user-select: none;
}

#menu-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(1512px * var(--s));
  height: auto;
  z-index: 2;
  pointer-events: none;
}

/* ---------- desktop icons ---------- */

#icons { position: absolute; inset: 0; z-index: 1; }

.icon {
  position: absolute;
  width: calc(128px * var(--s));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(4px * var(--s));
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: default;
  touch-action: none;
}
.icon:focus-visible { outline: none; }
.icon .box {
  padding: calc(4px * var(--s));
  border-radius: calc(5px * var(--s));
}
.icon img {
  display: block;
  width: calc(72px * var(--s));
  height: calc(72px * var(--s));
  object-fit: cover;
  border-radius: calc(2px * var(--s));
  pointer-events: none;
}
.icon .label {
  padding: calc(1px * var(--s)) calc(4px * var(--s));
  border-radius: calc(3px * var(--s));
  color: var(--label);
  font-size: calc(var(--size) * var(--s));
  line-height: calc(var(--line) * var(--s));
  font-weight: var(--strong);
  text-align: center;
}
.icon.is-selected .box { background: var(--selection-box); }
.icon.is-selected .label { background: var(--label-selected-bg); color: var(--label-selected); }
.icon.is-dragging { z-index: 2; }

/* ---------- windows ---------- */

#windows { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

.win {
  position: absolute;
  width: calc(420px * var(--s) * var(--w));
  height: calc(660px * var(--s) * var(--w));
  pointer-events: auto;
}
.win-chrome {
  position: absolute;
  left: calc(-54px * var(--s) * var(--w));
  top: calc(-36px * var(--s) * var(--w));
  width: calc(528px * var(--s) * var(--w));
  height: calc(768px * var(--s) * var(--w));
  pointer-events: none;
}
.win-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(32px * var(--s) * var(--w));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: calc(var(--size) * var(--s) * var(--w));
  font-weight: var(--title-weight);
  cursor: grab;
  touch-action: none;
}
.win-bar:active { cursor: grabbing; }
.win-bar span { max-width: 62%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* Invisible hit areas over the kit's traffic lights (drawn in the chrome image). */
.win-light {
  position: absolute;
  top: calc(8px * var(--s) * var(--w));
  width: calc(16px * var(--s) * var(--w));
  height: calc(16px * var(--s) * var(--w));
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: default;
}
.win-light.close { left: calc(7px * var(--s) * var(--w)); }
.win-light.minimize { left: calc(30px * var(--s) * var(--w)); }
.win-light.zoom { left: calc(53px * var(--s) * var(--w)); }
.win-light:hover { background: rgba(0, 0, 0, 0.12); }

.win-body {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(33px * var(--s) * var(--w));
  bottom: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 0 0 calc(14px * var(--s) * var(--w)) calc(14px * var(--s) * var(--w));
  padding: calc(16px * var(--s) * var(--w)) calc(20px * var(--s) * var(--w)) calc(20px * var(--s) * var(--w));
  box-sizing: border-box;
  color: var(--text);
  font-size: calc(var(--size) * var(--s) * var(--w));
  line-height: calc(var(--line) * var(--s) * var(--w));
  user-select: text;
  -webkit-user-select: text;
  scrollbar-width: thin;
}
.win-head { display: flex; align-items: center; gap: calc(12px * var(--s) * var(--w)); }
.win-head img {
  width: calc(56px * var(--s) * var(--w));
  height: calc(56px * var(--s) * var(--w));
  object-fit: cover;
  border-radius: calc(4px * var(--s) * var(--w));
  flex: none;
}
.win-title { font-weight: var(--strong); }
.win-sub { opacity: var(--secondary-alpha); }
.win-body p { margin: calc(14px * var(--s) * var(--w)) 0; white-space: pre-line; }
.win-section { margin-top: calc(14px * var(--s) * var(--w)); }
.win-toggle {
  display: flex;
  align-items: center;
  gap: calc(4px * var(--s) * var(--w));
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: var(--strong);
  cursor: default;
}
.win-toggle img { width: calc(24px * var(--s) * var(--w)); height: calc(24px * var(--s) * var(--w)); }
.win-section[data-open="false"] .win-section-body { display: none; }
.win-type { padding-left: calc(28px * var(--s) * var(--w)); margin-top: calc(4px * var(--s) * var(--w)); }
.win-type b { font-weight: var(--strong); }
.win-gallery { display: grid; gap: calc(8px * var(--s) * var(--w)); margin-top: calc(8px * var(--s) * var(--w)); }
.win-gallery img { display: block; width: 100%; height: auto; border-radius: calc(6px * var(--s) * var(--w)); background: rgba(0, 0, 0, 0.05); }

/* ---------- dock ---------- */

#dock {
  position: absolute;
  left: 50%;
  bottom: calc(4px * var(--s));
  transform: translateX(-50%);
  width: calc(253px * var(--s));
  z-index: 2;
}
#dock > img { display: block; width: 100%; height: auto; pointer-events: none; }
#dock a,
#dock span {
  position: absolute;
  border-radius: calc(9px * var(--s));
  transition: transform 0.15s ease;
}
#dock a:hover { transform: translateY(calc(-4px * var(--s))); background: rgba(255, 255, 255, 0.08); }
#dock a:focus-visible { outline: 2px solid var(--label-selected-bg); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  #dock a { transition: none; }
}
