/* MILKMAN ZERO — OS desktop page styles.
   Ported from docs/Architecture/OS_Desktop/Mockups/desktop_mockup.html
   (permanent prototyping sandbox — never edit that file from here).
   This is a line-for-line transcription of the mockup's inline <style>
   block; the only content differences are asset path prefixes (mockup's
   parent-relative Fonts./assets/icons./assets/images/Movies references became absolute
   /Fonts, /Icons, /Images, /Movies — see the full divergence list at the
   top of JavaScript/desktop.js), the audience-render override added
   at the bottom of this file (also listed there, item 6), the
   `.launch-locked` input-lock rule, and the LAUNCH SEQUENCE block
   (invert-flash / zoom-ring / splash / bloom / cover styles +
   keyframes) — both port-only additions with no mockup equivalent,
   part of divergence item 7. */

/* ---- FONT: GeistPixel-Square (solid-pixel variant) for all text ---- */
@font-face {
  font-family: 'GeistPixel';
  src: url('../assets/fonts/GeistPixel-Square.woff2') format('woff2'),
       url('../assets/fonts/GeistPixel/ttf/GeistPixel-Square.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* ---- PIXEL GRID ----
   GeistPixel draws on a 38/1000-em grid: one glyph "pixel" = 0.038em.
   Multiples of 26.3158px render glyph pixels on whole device pixels
   (at DPR 1); the current 19.7368px (0.75x, per the 2026-07-24 text
   scale-down) puts a glyph pixel on 0.75 device px — slightly soft at
   DPR 1, fine on retina. Crisp alternatives if it bothers: 26.3158
   (old size) or 13.1579 (tiny). All text uses --fs-px; line-heights
   are integer px so line boxes don't drift glyphs off the row grid. */
:root {
  --fs-px: 19.7368px;
}

/* ---- RESET ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Native image drag swallows mouseup mid-icon-drag (the ghost
   "silhouette" bug): the browser's drag-and-drop takes over, our
   mouseup never fires, and the icon stays glued to the cursor.
   Kill it at the source for every image in the page. */
img {
  -webkit-user-drag: none;
  user-select: none;
}

/* ---- BODY: 4px-cell 50% checkerboard, edge to edge (from 01_cold_milk) ----
   8×8px tile, two 4×4 black squares diagonally opposed on white fill.
   No gray used anywhere — pure #000/#fff dither.
*/
body {
  /* ---- UI SCALE ----
     Any FRACTIONAL zoom lands the 1-bit art (checkerboard, glyph grid,
     dither dots) on fractional device pixels and smears it. Breathing
     room comes from LAYOUT spacing instead — icon grid steps, column
     separation, window positions — which can move freely without
     touching pixel-native sizes. The JS still reads this back as Z and
     normalizes all mouse math, so a temporary preview zoom keeps
     working if one is ever needed.
     FORK (milkman0-site): the milkengine copy sets zoom:2 — a 4K
     (3840x2160 webrender) legibility fix that doubles everything and
     pushes half the desktop off-screen in a normal browser window.
     Reverted to 1 for the site; desktop.js's Z-normalized helpers
     (localRect()/vpW()/vpH()) read the computed value, so either
     setting keeps coordinate math correct. */
  zoom: 1;
  cursor: none;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: none;
  /* NOT geometricPrecision — that forces subpixel glyph placement,
     which smears a pixel font. optimizeSpeed keeps advances simple. */
  text-rendering: optimizeSpeed;
  font-family: 'GeistPixel', monospace;
  background-color: #fff;
  /* Checkerboard as conic gradient: axis-aligned cell edges rasterize
     crisp. The old 45deg linear-gradient pair antialiased every cell
     edge into gray fringe. */
  background-image: repeating-conic-gradient(#000 0% 25%, #fff 0% 50%);
  background-size: 8px 8px;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}

/* Part of the zoom:2 divergence (item 11): Blink bilinear-scales raster
   images even at integer zoom, fringing the pre-baked 1-bit PNGs (icons,
   cursor) and dither canvases with gray. At EXACTLY 2x, pixelated =
   nearest-neighbor = lossless 2x2 pixel duplication, so every asset stays
   pure #000/#fff. (Verified: 0.17% gray pixels without this, all located
   on <img>/<canvas> elements.) */
img, canvas {
  image-rendering: pixelated;
}

/* ---- MENU BAR: 40px, white, 4px black bottom rule (from 02_whole_milk) ---- */
#menubar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: #fff;
  border-bottom: 4px solid #000;
  display: flex;
  align-items: center;
  padding: 0 10px;
  z-index: 1000;
  gap: 0;
}

#sigil {
  margin-right: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

#sigil img {
  display: block;
  width: 24px;
  height: 24px;
}

/* Menu bar titles: 26px, rounded black pill when active */
.menu-title {
  font-family: 'GeistPixel', monospace;
  font-size: var(--fs-px);
  padding: 2px 12px 3px;
  border-radius: 10px;
  color: #000;
  background: transparent;
  cursor: none;
  user-select: none;
  white-space: nowrap;
  line-height: 1;
}

.menu-title.active {
  background: #000;
  color: #fff;
}

/* ---- CLOCK: bare text in menu bar — NO border, NO chip ----
   Fixed-width per-character inline-block spans prevent layout shift
   as digit values change. Hour tens slot is blank (non-breaking space)
   when hour < 10, so the layout never shifts between 9 and 10.
*/
#clock {
  margin-left: auto;
  padding-right: 16px;
  font-family: 'GeistPixel', monospace;
  font-size: var(--fs-px);
  color: #000;
  white-space: nowrap;
  display: flex;
  align-items: center;
  line-height: 1;
  flex-shrink: 0;
}

/* Character slot base */
.cs {
  display: inline-block;
  text-align: center;
  line-height: 1;
}

/* Slot widths: sized to the widest expected glyph in each slot category */
.cs-digit { width: 17px; } /* 0-9 */
.cs-colon { width: 12px; } /* : */
.cs-space  { width: 12px; } /* separator between seconds and AM/PM */
.cs-ampm  { width: 36px; } /* AM or PM */

/* ---- DESKTOP ---- */
#desktop {
  position: fixed;
  top: 36px;
  left: 0;
  right: 0;
  bottom: 0;
  /* No background: body checkerboard shows through */
}

/* ---- ICON TILES (from 02_whole_milk) ----
   White backing plate, fat 4px black border, ~10px rounded corners,
   hard +3/+3 black shadow, 48px PNG inside the 64px tile.
*/
.icon {
  position: absolute;
  width: 220px; /* fixed grid-cell width — all tiles share the same center axis
                   regardless of label width */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: none;
  user-select: none;
}

.icon-plate {
  width: 70px;
  height: 70px;
  background: #fff;
  border: 4px solid #000;
  border-radius: 10px;
  box-shadow: 3px 3px 0 #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-png {
  width: 52px;  /* matches the pre-scaled 52px asset 1:1 */
  height: 52px;
  display: block;
}

/* Icon label: solid white chip — clearly legible over the checkerboard.
   Never wraps: single line always. */
.icon-label {
  font-family: 'GeistPixel', monospace;
  font-size: var(--fs-px);
  color: #000;
  background: #fff;
  border: 1px solid #000;
  border-radius: 6px;
  padding: 1px 7px;
  text-align: center;
  line-height: 28px;
  white-space: nowrap;
}

/* Selected state: plate turns black, PNG inverts to white lines, label inverts */
.icon.selected .icon-plate {
  background: #000;
}

.icon.selected .icon-png {
  filter: invert(1);
}

.icon.selected .icon-label {
  background: #000;
  color: #fff;
}

/* Icon positions (desktop chrome only — the mobile launcher grid
   follows index.html DOM order instead). Two edge columns on the
   140px vertical grid, all pixel-native, per the 2026-07-27 layout:

     LEFT (24px):  TICKETS, Mail up top; Milk Pouch anchored to the
                   bottom slot so it sits low on any viewport tall
                   enough to hold the right column (Map removed —
                   the vacated bottom-left slot now belongs to
                   Milk Pouch, moved down from its old top slot).
     RIGHT (24px): MILKMAN ZERO, about.txt, trailer.mov,
                   TEAM, PRESS, Recycle Bin — six slots
                   (24/164/304/444/584/724; 724 + ~110px icon height
                   wants a ~840px-tall viewport — icons are draggable
                   and Clean Up Desktop restores these slots). */
#icon-tickets {
  top: 24px;
  left: 24px;
}

#icon-mail {
  top: 164px; /* 24 + 140 grid step */
  left: 24px;
}

#icon-milkpouch {
  top: 724px;
  left: 24px;
}

#icon-milkman {
  top: 24px;
  right: 24px;
}

#icon-about {
  top: 164px;
  right: 24px;
}

#icon-trailer {
  top: 304px;
  right: 24px;
}

#icon-team {
  top: 444px;
  right: 24px;
}

#icon-press {
  top: 584px;
  right: 24px;
}

#icon-recycle {
  top: 724px;
  right: 24px;
}

/* ---- DROPDOWN MENU PANELS (from 02_whole_milk) ----
   Rounded corners, 4px border, hard +6/+6 black shadow.
   Menu items 22px with rounded black pill on hover.
*/
.menu-panel {
  position: fixed;
  top: 36px;
  background: #fff;
  border: 4px solid #000;
  border-radius: 10px;
  box-shadow: 6px 6px 0 #000;
  padding: 5px;
  min-width: 210px;
  z-index: 1050;
  display: none;
}

.menu-panel.open {
  display: block;
}

.menu-item {
  font-family: 'GeistPixel', monospace;
  font-size: var(--fs-px);
  padding: 4px 14px 5px;
  border-radius: 8px;
  color: #000;
  cursor: none;
  white-space: nowrap;
  user-select: none;
  line-height: 30px;
}

/* Hover: rounded black pill. Guarded to hover-capable pointers so a
   coarse (touch) tap never leaves a menu item stuck in the hover state. */
@media (hover: hover) {
  .menu-item:hover {
    background: #000;
    color: #fff;
  }
}

.menu-item.disabled,
.menu-item.disabled:hover {
  color: #999;
  background: transparent;
  cursor: default;
}

.menu-divider {
  height: 3px;
  background: #000;
  margin: 5px 10px;
  border-radius: 2px;
}

/* Classic Mac select flash: chosen item's highlight blinks before
   the menu closes */
.menu-item.flashing {
  background: #000;
  color: #fff;
}
.menu-item.flashing.flash-off {
  background: transparent;
  color: #000;
}

/* ---- ALERT DIALOG (classic Mac caution alert) ---- */
#alert-dialog {
  position: fixed;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  width: 600px;
  background: #fff;
  border: 4px solid #000;
  border-radius: 10px;
  box-shadow: 6px 6px 0 #000;
  z-index: 2000; /* above windows + menubar, below cursor */
  display: none;
  gap: 24px;
  align-items: flex-start;
  padding: 24px 24px 68px;
  font-family: 'GeistPixel', monospace;
  font-size: var(--fs-px);
  line-height: 36px;
  color: #000;
  cursor: none;
}
#alert-dialog.open { display: flex; }
#alert-dialog img {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}
#alert-ok {
  position: absolute;
  right: 22px;
  bottom: 18px;
  border: 3px solid #000;
  border-radius: 10px;
  padding: 2px 28px 3px;
  background: #fff;
  user-select: none;
}
#alert-ok:active {
  background: #000;
  color: #fff;
}

/* ---- FAKE CURSOR: arrow (locked 2026-07-08) with white halo ----
   cursor:none on body hides the real cursor.
   The element tracks mousemove via JS transform.
   White halo: four 0-blur drop-shadows at ±2px keep the hand
   separated from the checkerboard without introducing gray fringe.
*/
#fake-cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  will-change: transform;
  display: none; /* shown on first mousemove */
}

#fake-cursor img {
  display: block;
  width: 40px;
  height: 40px;
  filter:
    drop-shadow( 2px  0   0 #fff)
    drop-shadow(-2px  0   0 #fff)
    drop-shadow( 0    2px 0 #fff)
    drop-shadow( 0   -2px 0 #fff);
}

/* ---- ZOOM RECT LAYER ---- */
#zoom-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 500;
  overflow: hidden;
}

/* ================================================================
   WINDOW SYSTEM — shared engine styles
   ================================================================ */

#windows-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

/* Every window is pointer-events:all so only the layer is transparent.
   Windows are POOLED: every FILE_TREE node's window is built once at
   load and hidden; open/close toggles .win-open. Position rides
   transform:translate() (layout-neutral), never left/top.
   contain:strict makes each window its own layout/paint island —
   the single biggest lever for many overlapping windows (benchmark-
   verified 2026-07-13). */
.win {
  position: absolute;
  left: 0;
  top: 0;
  contain: strict;
  visibility: hidden;
  pointer-events: all;
  display: flex;
  flex-direction: column;
  font-family: 'GeistPixel', monospace;
  cursor: none;
  /* clamp keeps title bar accessible */
}

.win.win-open {
  visibility: visible;
}

/* Transient layer promotion during drag only — never static will-change
   (each promoted layer is a full GPU surface at output resolution) */
.win.win-dragging {
  will-change: transform;
}

/* Title bar */
.win-title-bar {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  cursor: none;
}

/* The drag region is the title bar minus control boxes */
.win-drag-region {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  cursor: none;
}

.win-title-text {
  font-family: 'GeistPixel', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Control box wrappers */
.win-controls-left,
.win-controls-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Info strip */
.win-info-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  font-family: 'GeistPixel', monospace;
  white-space: nowrap;
  padding: 0 10px;
}

/* Body area: grid or viewer */
.win-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ---- GRID (icon view) ---- */
.win-grid {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0;
  padding: 8px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
}
.win-grid::-webkit-scrollbar { display: none; }

.win-grid-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: none;
  position: relative;
  box-sizing: border-box;
}

.win-grid-icon {
  display: block;
  width: 52px;
  height: 52px;
  image-rendering: pixelated;
  position: relative;
  z-index: 1;
}

.win-grid-label {
  font-family: 'GeistPixel', monospace;
  font-size: 18px;
  text-align: center;
  line-height: 1.2;
  /* Wrap at spaces, up to 2 lines — never truncate (labels must stay legible) */
  white-space: normal;
  max-width: 100%;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

/* ---- TEXT EDITOR ----
   Mail's mirror-field technique scaled up to a document: a transparent
   real <textarea> owns input/selection/caret position, a GeistPixel
   mirror underneath renders the text split around a fake block caret.
   The mirror sits in normal flow so the wrap (and the OS-8 scrollbar's
   scroll container) grows with the document; the textarea overlays it
   with IDENTICAL metrics so native click-to-place-caret still lands on
   the right character. No saving — edits live in the textarea only. */
.win-text-scroll {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  right: 20px; /* OS-8 scrollbar gutter */
  background: #fff;
  overflow-y: auto;
  scrollbar-width: none;
}
.win-text-scroll::-webkit-scrollbar { display: none; }

.win-text-edit-wrap {
  position: relative;
  min-height: 100%;
}

.win-text-mirror,
.win-text-input {
  font-family: 'GeistPixel', monospace;
  font-size: var(--fs-px);
  line-height: 36px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  padding: 14px 18px;
  box-sizing: border-box;
}

.win-text-mirror {
  color: #000;
  pointer-events: none;
}

/* Zero-width block caret: the █ paints OVER the character to its right
   (terminal overstrike) so mid-document edits never shift the text. */
.win-text-caret {
  display: none;
}
.win-text-focused .win-text-caret {
  display: inline-block;
  width: 0;
  overflow: visible;
}
/* Blink is JS-driven (see desktop.js CARET BLINK) — infinite CSS
   animations are unreliable in the offscreen webrender. `body` gets
   `caret-blink-off` toggled on a timer while a field is focused. */
body.caret-blink-off .win-text-focused .win-text-caret {
  opacity: 0;
}

.win-text-input {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  color: transparent;
  background: transparent;
  caret-color: transparent;
  border: none;
  outline: none;
  resize: none;
  margin: 0;
  overflow: hidden;
  cursor: none;
}

/* ---- IMAGE VIEWER ---- */
.win-image-body {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

/* The dithered canvas is drawn at its exact display size (no CSS
   scaling — dots stay on the pixel grid); the max rules cover the
   plain <img> fallback path only. */
.win-image-body img,
.win-image-body canvas {
  image-rendering: pixelated;
  border: 2px solid #000;
  display: block;
}

.win-image-body img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

/* Fork: node.corrupted glitch — recycle-bin's route_photo.jpg. Small,
   on-brand with the 1-bit look: the dithered canvas periodically
   slices and inverts a few rows. No new markup, no JS timing —
   pure CSS steps() animation on the existing canvas/img element. */
.win-image-body.img-corrupted img,
.win-image-body.img-corrupted canvas {
  animation: imgCorruptGlitch 2.6s steps(1) infinite;
}
@keyframes imgCorruptGlitch {
  0%, 92%, 100% { clip-path: inset(0 0 0 0); transform: translateX(0); filter: none; }
  93%           { clip-path: inset(10% 0 60% 0); transform: translateX(-6px); filter: invert(1); }
  95%           { clip-path: inset(40% 0 20% 0); transform: translateX(8px); filter: invert(1); }
  97%           { clip-path: inset(70% 0 5% 0); transform: translateX(-4px); filter: none; }
}

/* ---- MOVIE VIEWER ----
   1-bit playback: hidden <video> decodes; a WebGL fragment shader
   thresholds luma against an ordered-dither matrix onto the canvas.
   Falls back to the plain <video> if the GL path fails. */
.win-movie-body {
  /* Fix wave 3: black, not white — contain-fit letterboxing (js/desktop.js
     MOVIE PLAYER resize()) leaves this showing around a smaller canvas
     whenever the wrap's aspect doesn't match the video's; black reads as
     letterbox bars instead of a visible white gutter. Flexbox centering
     below is what actually places the shrunk canvas — no manual offset
     math needed. */
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.win-movie-body canvas,
.win-movie-body video {
  display: block;
  border: 2px solid #000;
}

/* ================================================================
   WINDOW LOOK — OS 8 Pinstripe (Matt's pick 2026-07-08; looks 1 & 2 removed)
   ================================================================ */
.win {
  /* Outer 3px black + 6px white gutter + 8px black ring */
  border: 3px solid #000;
  outline: 6px solid #fff;
  box-shadow:
    0 0 0 8px #000,
    6px 6px 0 8px #000;
  border-radius: 0;
  background: #fff;
  /* compensate for outline in stacking */
  margin: 8px;
}

.win-title-bar {
  height: 36px;
  border-bottom: 2px solid #000;
  background: #fff;
  padding: 0 4px;
}

/* Active: pinstripes */
.win.win-active .win-title-bar {
  background-image: repeating-linear-gradient(
    to bottom,
    #000 0px, #000 2px,
    #fff 2px, #fff 5px
  );
}

/* Title cartouche: white, height 24px, centered */
.win-title-text {
  background: #fff;
  padding: 0 10px;
  font-size: var(--fs-px);
  color: #000;
  height: 28px;
  line-height: 28px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

/* Inactive title: solid black text on the plain (stripe-less) bar.
   NO dithered text — banned project-wide (Matt, 2026-07-08). The
   missing pinstripes are the inactive tell. */
.win:not(.win-active) .win-title-text {
  background: transparent;
}

.win-close-btn,
.win-collapse-btn,
.win-zoom-btn {
  width: 16px;
  height: 16px;
  border: 2px solid #000;
  background: #fff;
  cursor: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-sizing: border-box;
}

/* Pads around controls */
.win-controls-left {
  padding: 0 3px 0 10px;
  gap: 6px;
}
.win-controls-right {
  padding: 0 12px 0 3px;
  gap: 6px;
}

/* CLOSE hover: nested inner square. Hover-capable pointers only — a
   touch tap must not paint this affordance. */
@media (hover: hover) {
  .win-close-btn:hover::after {
    content: '';
    position: absolute;
    width: 6px; height: 6px;
    border: 1px solid #000;
    background: transparent;
  }
}
.win-close-btn:active {
  background: #000;
}

/* COLLAPSE: 2px horizontal center line */
.win-collapse-btn::before {
  content: '';
  width: 8px; height: 2px;
  background: #000;
  display: block;
}

/* ZOOM: nested square */
.win-zoom-btn::after {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  border: 1px solid #000;
  background: transparent;
}

/* Inactive windows show no control boxes (classic Mac behavior; also
   replaces the old dithered button fills) */
.win:not(.win-active) .win-close-btn,
.win:not(.win-active) .win-collapse-btn,
.win:not(.win-active) .win-zoom-btn {
  visibility: hidden;
}

/* Info strip: 26px, 2px bottom rule */
.win-info-strip {
  height: 36px;
  border-bottom: 2px solid #000;
  font-size: var(--fs-px);
  color: #000;
  background: #fff;
}

/* Scrollbar right only, 20px */
.win-scrollbar-right {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 20px;
  /* 2px checker dither track — axis-aligned so it rasterizes crisp
     (45deg stripes antialiased into gray fringe) */
  background-image: repeating-conic-gradient(#000 0% 25%, #fff 0% 50%);
  background-size: 4px 4px;
  border-left: 1px solid #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between; /* arrows pin top + bottom; thumb is absolute */
}

.win-sb-arrow {
  width: 20px; height: 20px;
  background: #fff;
  border: 1px solid #000;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  box-sizing: border-box;
}
.win-sb-thumb-v {
  width: 18px; height: 18px;
  background: #fff;
  border: 1px solid #000;
  flex-shrink: 0;
  /* JS-driven: rides translateY between the arrows; hidden when the
     content fits (the classic empty-track state) */
  position: absolute;
  top: 21px;
  left: 0;
  will-change: transform;
}

/* Grid cells: 116x128 — tall enough for 2-line labels */
.win-grid-cell {
  width: 152px;
  height: 136px;
  padding: 8px 4px 4px;
  gap: 4px;
}
.win-grid-label {
  font-size: var(--fs-px);
  line-height: 32px;
  color: #000;
  background: transparent;
  padding: 0 4px;
  max-width: 144px;
  /* Long space-less filenames (milk_01.jpeg) get no space to wrap at
     and used to overflow into the neighboring cell. Classic-Mac fix:
     wrap onto a second line (preferring the break BEFORE the file
     extension — see .lbl-ext), two lines max, ellipsis beyond that. */
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* The extension is an atomic inline: it fits on the line whole or
   wraps whole, so "milk_03.png" breaks as "milk_03" / ".png" instead
   of "milk_03.pn" / "g". Base names that are themselves too long
   still break anywhere (inherited from the label). */
.win-grid-label .lbl-ext {
  display: inline-block;
  max-width: 100%;
}

/* Selected cell: black backing plate behind the inverted icon (the
   look-2 treatment — invert alone turned the white line art invisible
   on the white window body). Plate is 60x60 centered over the 52px
   icon; left offset is integral to stay on the pixel grid. */
.win-grid-cell.cell-selected::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 46px;
  width: 60px;
  height: 60px;
  background: #000;
  border-radius: 4px;
  z-index: 0;
}
.win-grid-cell.cell-selected .win-grid-icon {
  filter: invert(1);
}
.win-grid-cell.cell-selected .win-grid-label {
  background: #000;
  color: #fff;
  border-radius: 4px;
}

/* Right scrollbar padding */
.win-grid {
  padding-right: 26px;
}

/* ================================================================
   MAIL APP
   ================================================================ */

/* Window shell */
.mail-body {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.mail-toolbar {
  height: 64px;
  flex-shrink: 0;
  border-bottom: 2px solid #000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: #fff;
}

.mail-btn {
  font-family: 'GeistPixel', monospace;
  font-size: var(--fs-px);
  color: #000;
  background: #fff;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 4px 16px 5px;
  cursor: none;
  user-select: none;
  line-height: 30px;
}
.mail-btn:active {
  background: #000;
  color: #fff;
}
/* Primary button: classic default-button outer ring (#alert-ok treatment) */
.mail-btn-primary {
  border: 3px solid #000;
  border-radius: 10px;
}

/* Compose view — the whole Mail body below the info strip. Static
   rows (To/Subject/Body) use .mail-static-value; the one editable
   field (Your Email) is the mirror-field stack below. */
.mail-view-compose {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 18px;
}
.mail-compose-row {
  display: flex;
  border-bottom: 2px solid #000;
  flex-shrink: 0;
}
.mail-compose-row-tall {
  flex: 1;
  min-height: 0;
}
.mail-compose-label {
  width: 170px;
  flex-shrink: 0;
  font-family: 'GeistPixel', monospace;
  font-size: 24px;
  line-height: 33px;
  padding-top: 8px;
}
.mail-static-value {
  flex: 1;
  font-family: 'GeistPixel', monospace;
  font-size: 24px;
  line-height: 33px;
  color: #000;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 8px 0;
}
.mail-compose-row-tall .mail-static-value {
  overflow-y: auto;
}
.mail-field-wrap {
  position: relative;
  flex: 1;
  min-height: 44px;
  padding: 8px 0;
}
/* One size everywhere in compose — what you type is what you read. */
.mail-field-mirror {
  position: absolute;
  top: 8px; left: 0; right: 0; bottom: 0;
  font-family: 'GeistPixel', monospace;
  font-size: 24px;
  line-height: 33px;
  color: #000;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  pointer-events: none;
}
/* Caret lives only in the FOCUSED field:/* Caret lives only in the FOCUSED field: blinks while the field is
   empty, goes solid once typing starts, hidden everywhere else. */
.mail-caret {
  display: none;
}
.mail-field-focused .mail-caret {
  display: inline;
}
/* Blink is JS-driven (see desktop.js CARET BLINK) — infinite CSS
   animations are unreliable in the offscreen webrender. */
body.caret-blink-off .mail-field-focused.mail-field-empty .mail-caret {
  opacity: 0;
}
.mail-field-input {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  font-family: 'GeistPixel', monospace;
  font-size: 24px;
  line-height: 33px;
  color: transparent;
  background: transparent;
  caret-color: transparent;
  border: none;
  outline: none;
  resize: none;
  padding: 0;
  margin: 0;
  cursor: none;
}

/* ================================================================
   LAUNCH SEQUENCE (port addition, divergence item 7 — no mockup
   equivalent). Commit invert-flash -> zoom-rect flourish -> Option-B
   "Wrong note" splash -> white bloom -> terminal cover. CSS owns the
   pixels; every phase rides animation-delay/duration custom properties
   set by armLaunchSequence()/playZoomRect() in desktop.js off ONE
   start. Pure #000/#fff only; page-local keyframes (single owner).
   ================================================================ */

/* ---- Commit: EXE tile double invert-flash (~360ms) ----
   steps(1) between keyframes = hard cuts (two black flashes). */
#icon-milkman.exe-flash .icon-plate { animation: exePlateFlash 360ms steps(1) both; }
#icon-milkman.exe-flash .icon-png   { animation: exeIconFlash  360ms steps(1) both; }
@keyframes exePlateFlash {
  0%   { background: #000; }
  25%  { background: #fff; }
  50%  { background: #000; }
  75%  { background: #fff; }
  100% { background: #fff; }
}
@keyframes exeIconFlash {
  0%   { filter: invert(1); }
  25%  { filter: invert(0); }
  50%  { filter: invert(1); }
  75%  { filter: invert(0); }
  100% { filter: invert(0); }
}

/* ---- Flourish: zoom-rect rings (screamSpray CSS-delay pattern) ----
   Each ring is centered on the icon (left/top = icon center + the
   translate(-50%,-50%)) and scales concentrically past the viewport,
   its start delayed by --ring-delay. `opacity: 0` base + `forwards`
   (not `both`) fill keeps the ring fully invisible for the entire
   delay window — `both` would backwards-fill the 0% keyframe (opaque,
   scale 1) across the delay, framing the icon with a static outline
   from t=0. --ring-scale-x/--ring-scale-y (independent axes, set in
   JS) reproduce the mockup's original expansion to width:vw*1.6 /
   height:vh*1.6 — an icon-aspect rect growing into a viewport-aspect
   one, not a uniform scale that stays square mid-flight. */
.zoom-ring {
  position: absolute;
  border: 4px solid #000;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;                 /* hidden until --ring-delay elapses */
  transform: translate(-50%, -50%) scale(1);
  animation: zoomRing 460ms ease-out var(--ring-delay, 0ms) forwards;
}
@keyframes zoomRing {
  0%   { transform: translate(-50%, -50%) scale(1);                                                       opacity: 1; }
  60%  {                                                                                                   opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(var(--ring-scale-x, 12), var(--ring-scale-y, 12));         opacity: 0; }
}

/* ---- Splash (Option B "Wrong note") — chrome-less chassis on the
   LIVE checkerboard (no early blackout). Derived from #alert-dialog:
   640px, 4px border, hard +6/+6 shadow. ---- */
#launch-splash {
  position: fixed;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: 640px;
  background: #fff;
  border: 4px solid #000;
  box-shadow: 6px 6px 0 #000;
  z-index: 9000;              /* above windows/menubar/alert; cursor is hidden by now */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 32px 44px;
  opacity: 0;                /* revealed by .launch-splash-run */
  pointer-events: none;
  cursor: none;
}
#launch-splash.launch-splash-run { animation: splashIn 300ms ease-out var(--splash-in-at, 1000ms) both; }
#launch-splash.launch-chrome-hidden { display: none; }
@keyframes splashIn { from { opacity: 0; } to { opacity: 1; } }

/* Hero EXE face — pre-scaled 96px asset, displayed 1:1 (never scale an icon). */
.launch-splash-hero { width: 96px; height: 96px; display: block; }

.launch-splash-wordmark {
  font-family: 'GeistPixel', monospace;
  font-size: 52.6316px;      /* exactly 2x the 26.3158px GeistPixel grid */
  line-height: 56px;
  color: #000;
  text-align: center;
  white-space: nowrap;
}
.launch-splash-status {
  font-family: 'GeistPixel', monospace;
  font-size: var(--fs-px);   /* 26.3158px */
  line-height: 32px;
  color: #000;
  text-align: center;
  min-height: 32px;          /* reserve the row so the wrong-note flip doesn't reflow */
}

/* Stepped solid-black fill in a 480x24 well — steps(16), square ends,
   no numeric %, no barber-pole. Solid #000 is 1-bit-legal. */
.launch-splash-well {
  width: 480px;
  height: 24px;
  border: 4px solid #000;
  background: #fff;
  overflow: hidden;
}
.launch-splash-fill {
  width: 0;
  height: 100%;
  background: #000;
}
#launch-splash.launch-splash-run .launch-splash-fill {
  animation: loadFill var(--loading-ms, 2280ms) steps(16, end) var(--splash-in-at, 1000ms) both;
}
@keyframes loadFill { from { width: 0; } to { width: 100%; } }

/* ---- Wipe: hard-edged white bloom grown from the splash footprint
   past the viewport. Opacity 1 throughout = hard cut, never a fade. ---- */
#launch-bloom {
  position: fixed;
  left: 50%;
  top: 46%;                  /* splash center */
  width: 640px;              /* splash footprint */
  height: 260px;
  background: #fff;
  z-index: 9500;             /* above splash, below the terminal cover */
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
}
#launch-bloom.launch-bloom-run {
  animation: bloomGrow var(--wipe-ms, 220ms) linear var(--wipe-at, 3280ms) forwards;
}
#launch-bloom.launch-chrome-hidden { display: none; }
@keyframes bloomGrow {
  0%   { transform: translate(-50%, -50%) scale(1);  opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(24); opacity: 1; } /* scale 24 clears 4K */
}

/* ---- Terminal cover: the ONE frame snapCover() and the normal
   cover-up timer both converge on. Above EVERYTHING incl. #fake-cursor
   (9999). ---- */
#launch-cover {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 10000;
  display: none;
}
#launch-cover.show { display: block; }

/* ---- LAUNCH INPUT LOCK (port addition, divergence item 7) ----
   Applied as a class on <body> the instant beginLaunch()/snapCover()
   fire in desktop.js (JS's own launch-skeleton comment has full
   context). #menubar, every .menu-panel, and every .win are SIBLINGS
   of #desktop, not children, so locking #desktop's pointer-events
   alone leaves them clickable through the whole launch window — this
   rule locks every interactive root in one step. #alert-dialog and
   .mail-toast are included too since both accept clicks (OK button /
   toast-to-open-Mail) and are equally reachable siblings.
   Specificity note: two classes (body.launch-locked + the descendant
   selector) beats each target's own single-class pointer-events rule
   (e.g. .win's `pointer-events:all`) without needing !important. */
body.launch-locked #desktop,
body.launch-locked #menubar,
body.launch-locked .menu-panel,
body.launch-locked .win,
body.launch-locked #alert-dialog,
body.launch-locked .mail-toast {
  pointer-events: none;
}

/* ---- AUDIENCE-RENDER OVERRIDE (port divergence, item 6) ----
   core.css sets text-rendering:geometricPrecision on body.audience-render
   for every other audience page; that smears GeistPixel's 1-bit glyph
   grid. This page opts into audience-render (for the shared hook
   conventions) but restores the mockup's original
   text-rendering:optimizeSpeed for its own body. */
body.audience-render {
  text-rendering: optimizeSpeed;
}

/* ============================================================
   FORK (milkman0-site): TICKETS — desktop-native CTA.
   A note window that auto-opens at boot ('ticketnote' node,
   type 'note') + the TICKETS tile in the icon grid. No menu-bar
   chrome: everything on this desktop is icons and windows, so
   the CTA is one too.
   ============================================================ */
.note-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  height: 100%;
  padding: 24px;
  background: #fff;
  text-align: center;
}

.note-headline {
  font-weight: bold;
  font-size: 26px;
  letter-spacing: 3px;
}

.note-line {
  font-size: 18px;
  letter-spacing: 1px;
}

.note-cta {
  margin-top: 6px;
  padding: 12px 26px;
  border: 4px solid #000;
  border-radius: 10px;
  box-shadow: 4px 4px 0 #000;
  background: #fff;
  font-weight: bold;
  font-size: 20px;
  letter-spacing: 2px;
  cursor: pointer;
}

/* Hover-capable pointers only — the CTA keeps its :active feedback on
   touch (see below); the hover invert would otherwise stick after a tap. */
@media (hover: hover) {
  .note-cta:hover {
    background: #000;
    color: #fff;
  }
}

.note-cta:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

/* ============================================================
   EXE — milkman0.exe boot beat + title screen (Task 5, see the
   divergence list entry 16 in js/desktop.js). .exe-body replaces
   .win-body's plain flex slot with a black/white terminal look;
   `flex: 1` reproduces .win-body's own sizing rule (an .exe-body
   element carries both classes) so it still fills the window
   below the title bar.
   .exe-title-art is a verbatim ASCII-art <pre> (~126 chars wide)
   sized to fit the 640px milkman0 window (see WIN_DEFAULTS in
   js/desktop.js). white-space: pre — never wrap it, that breaks
   the art; overflow-x is the fallback if a glyph substitution
   ever widens a line past the window instead of shrinking further.
   ============================================================ */
.exe-body {
  flex: 1;
  position: relative;
  overflow: auto;
  background: #000;
  color: #fff;
  font-family: 'MorePerfectDOSVGA', 'Courier New', monospace;
  padding: 8px;
}

.exe-boot {
  margin: 0;
  color: #fff;
  font-size: 14px;
  line-height: 1.3;
  white-space: pre;
}

.exe-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
}

@keyframes exeTitleFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Reveal: the art steps in over 5s; NEW GAME/CONTINUE and the date
   hold at 0 and FLASH to full (steps(1) — no ramp) right as the art
   lands on its final step. desktop.js keys music off the art's
   animationend and the date blink off the date's. */
.exe-title-art {
  margin: 0;
  max-width: 100%;
  font-size: 9px;   /* 126 chars at 9px = ~683px — fits the 720px window */
  line-height: 1.05;
  white-space: pre;
  overflow-x: auto;
  opacity: 0;
  animation: exeTitleFadeIn 5s steps(5) forwards;
}

/* NOT steps(1): a finished animation's forwards-fill can freeze at
   progress 0.99999... (fp error on delay+duration), and steps(1, end)
   maps anything below exactly 1.0 back to the start value — the flash
   never lands. Holding at 0 until 99.9% then jumping is equivalent
   visually and immune to that. */
@keyframes exeFlashIn {
  0%, 99.9% { opacity: 0; }
  100%      { opacity: 1; }
}

.exe-title-menu,
.exe-date {
  opacity: 0;
  animation: exeFlashIn 5.1s linear forwards;
}

.exe-boot,
.exe-title-menu,
.exe-date {
  font-family: 'GeistPixel', 'MorePerfectDOSVGA', monospace;
}

.exe-title-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.exe-menu-item.disabled {
  color: #666;
  cursor: default;
  letter-spacing: 2px;
}

.exe-date {
  color: #fff;
  letter-spacing: 2px;
  text-align: center;
  white-space: pre-line;  /* SHOW_DATE_TEXT is three \n-separated lines */
  line-height: 1.6;
}

.exe-date-flash {
  animation: exeDateFlash 1.4s steps(2, start) infinite;
}

@keyframes exeDateFlash {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ============================================================
   TEAM — bio windows for the TEAM folder (Task 6, see js/desktop.js
   buildTeamBody/startTeamPhoto). .team-body carries both `win-body`
   and `team-body` (note-body's pattern) so it inherits win-body's
   flex:1 sizing; overflow:auto (vs win-body's overflow:hidden) lets
   a long bio scroll instead of clipping. Text sizes are explicit
   px, not inherited — body's --font-size-body (2.2rem, core.css) is
   sized for typewriter game text, not a compact bio card.
   ============================================================ */
.team-body {
  padding: 12px;
  overflow: auto;
  height: 100%;
}

.team-photo {
  width: 160px;
  height: 160px;
  margin-bottom: 8px;
}

.team-photo canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Checkerboard placeholder for members without a photo yet */
.team-photo.placeholder {
  background: repeating-conic-gradient(#000 0 25%, #fff 0 50%) 0 0 / 8px 8px;
  border: 2px solid #000;
}

.team-name {
  font-weight: bold;
  font-size: 22px;
  letter-spacing: 1px;
}

.team-role {
  font-size: 16px;
  letter-spacing: 1px;
  margin-bottom: 8px;
  color: #333;
}

.team-bio {
  font-size: 15px;
  line-height: 1.4;
  max-width: 36ch;
}

.contact-body { padding: 12px; overflow: auto; }
.contact-text { margin: 0 0 8px; white-space: pre-wrap; font: inherit; }
.contact-email { color: #000; text-decoration: underline; cursor: pointer; }

/* ============================================================
   TRAILER PLAYER HARDENING (Task 7, see js/desktop.js MOVIE PLAYER /
   FULLSCREEN BOX sections) — tap-to-play poster + fake-fullscreen
   control on movie windows.
   ============================================================ */

/* Poster needs an anchor for its position:absolute inset:0 — win-body
   already declares position:relative but win-movie-body (its direct
   flex child) did not. */
.win-movie-body {
  position: relative;
}

/* Solid black box, white play triangle — same monochrome, no-gray-
   fill language as the title-bar control glyphs. Hidden until a
   play() call is actually rejected (movie-poster.js sets .visible);
   clicking it retries play() (js/desktop.js poster click handler). */
.movie-poster {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: #000;
  cursor: none;
  z-index: 2;
}
.movie-poster.visible {
  display: flex;
}
.movie-poster::before {
  content: '';
  width: 0;
  height: 0;
  margin-left: 6px; /* optically center the triangle in its box */
  border-top: 22px solid transparent;
  border-bottom: 22px solid transparent;
  border-left: 36px solid #fff;
}

/* FULLSCREEN control (title-bar corner glyph): two opposite pixel
   brackets — an "expand" glyph built the same way every other
   win-*-btn glyph here is (pure border/pseudo-element geometry, no
   text glyphs — this file draws icons, it doesn't set them). */
.win-fullscreen-btn {
  width: 16px;
  height: 16px;
  border: 2px solid #000;
  background: #fff;
  cursor: none;
  flex-shrink: 0;
  position: relative;
  box-sizing: border-box;
}
.win-fullscreen-btn::before,
.win-fullscreen-btn::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
}
.win-fullscreen-btn::before {
  top: 2px;
  left: 2px;
  border-top: 2px solid #000;
  border-left: 2px solid #000;
}
.win-fullscreen-btn::after {
  bottom: 2px;
  right: 2px;
  border-bottom: 2px solid #000;
  border-right: 2px solid #000;
}
/* Active state: filled, matching .win-close-btn:active's tell */
.win-fullscreen-btn.active {
  background: #000;
}
.win-fullscreen-btn.active::before {
  border-top-color: #fff;
  border-left-color: #fff;
}
.win-fullscreen-btn.active::after {
  border-bottom-color: #fff;
  border-right-color: #fff;
}
/* Inactive windows hide every control box — .win-fullscreen-btn joins
   the pre-existing close/collapse/zoom rule (desktop.css line ~857). */
.win:not(.win-active) .win-fullscreen-btn {
  visibility: hidden;
}

/* Class name is exactly `fake-fullscreen` — Task 9's mobile chrome
   reuses it verbatim, do not rename. `transform: none` cancels the
   inline translate(x,y) setWinPos leaves on the element; without it
   a fixed, inset:0 box would still sit offset by its last dragged
   position instead of covering the viewport. */
.win.fake-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  margin: 0 !important; /* .win's normal 8px margin (outline-stacking
    compensation) would otherwise over-constrain a position:fixed box
    that also has explicit inset:0 + width/height */
  transform: none !important;
  width: 100vw !important;
  height: 100dvh !important;
  /* !important: bringToFront() sets an inline style.zIndex (100-899)
     on every window, which otherwise beats a plain class rule outright
     regardless of value — without this a "fullscreen" window would
     render fixed/inset:0 but still sit BEHIND the menu bar (z-index
     1000, desktop.css ~line 115). */
  z-index: 9000 !important;
}

/* Milk Monster overlay — above every z-band incl. menubar (1000+).
   NOT under a chrome scope: it must cover both desktop and mobile.
   body { zoom: 1 } on this site (see line ~77), so position: fixed +
   inset: 0 covers the full viewport with no zoom compensation needed. */
#scare-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
}
#scare-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.8);  /* crush the grays — blacks pop against the flash */
}
