/* Noah OS: a Mac OS 8/9 "Platinum" desktop. Gray chrome, pinstriped title bars, pixel type for the system,
   readable sans for content. Everything is crisp: 1px borders, hard bevels, no blur. */
:root {
  --ink: #000;
  --paper: #fff;
  --plat: #dddddd;       /* window and menu chrome */
  --plat-2: #cccccc;
  --shade: #888888;
  --hi: #ffffff;
  --lo: #6b6b6b;
  --select: #3333cc;     /* classic highlight */
  --desk: #5a6fa8;       /* desktop blue */
  --desk-2: #4f6399;
  --sys: 'Pixelify Sans', 'Chicago', 'Charcoal', ui-monospace, monospace;
  --text: 'Geneva', 'Verdana', system-ui, sans-serif;
  --menubar: 24px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--desk); color: var(--ink); font-family: var(--text); -webkit-font-smoothing: none; }
button { font: inherit; color: inherit; }
img { display: block; }
::selection { background: var(--select); color: #fff; }

/* ---------- Boot ---------- */
#boot { position: fixed; inset: 0; z-index: 1000; background: #9a9a9a; display: grid; place-items: center; cursor: pointer; }
#boot.done { animation: boot-out 260ms steps(4) forwards; }
@keyframes boot-out { to { opacity: 0; visibility: hidden; } }
.boot-face { width: 64px; height: 72px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 36' shape-rendering='crispEdges'%3E%3Crect x='3' y='1' width='26' height='28' fill='%23ddd' stroke='%23000'/%3E%3Crect x='6' y='4' width='20' height='15' fill='%23fff' stroke='%23000'/%3E%3Crect x='11' y='8' width='2' height='3'/%3E%3Crect x='19' y='8' width='2' height='3'/%3E%3Crect x='15' y='9' width='2' height='4'/%3E%3Crect x='12' y='15' width='8' height='1'/%3E%3Crect x='11' y='14' width='1' height='1'/%3E%3Crect x='20' y='14' width='1' height='1'/%3E%3Crect x='6' y='23' width='8' height='2'/%3E%3Crect x='2' y='30' width='28' height='5' fill='%23ccc' stroke='%23000'/%3E%3C/svg%3E") center/contain no-repeat; image-rendering: pixelated; }
.boot-welcome { position: fixed; inset: 0; display: grid; place-items: center; background: var(--desk); }
.boot-box { width: min(340px, 86vw); padding: 22px 26px 18px; background: var(--plat); border: 1px solid var(--ink); box-shadow: inset 1px 1px var(--hi), inset -1px -1px var(--shade), 2px 2px 0 rgba(0,0,0,.4); text-align: center; }
.boot-logo { font-family: var(--sys); font-size: 34px; font-weight: 600; letter-spacing: 1px; }
.boot-sub { font-family: var(--sys); font-size: 15px; margin: 2px 0 14px; }
.boot-bar { height: 12px; border: 1px solid var(--ink); background: var(--paper); }
.boot-bar span { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, #4f4fd0 0 10px, #6b6bdc 10px 12px); animation: boot-fill 1100ms steps(14) forwards; }
@keyframes boot-fill { to { width: 100%; } }

/* ---------- Menu bar ---------- */
#menubar { position: fixed; top: 0; left: 0; right: 0; height: calc(var(--menubar) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); z-index: 500; display: flex; align-items: stretch; background: var(--plat); border-bottom: 1px solid var(--ink); box-shadow: inset 0 1px var(--hi); font-family: var(--sys); font-size: 15px; }
.menu-title { border: 0; background: none; padding: 0 10px; height: var(--menubar); cursor: default; line-height: var(--menubar); }
.menu-title.open, .menu-title:active { background: var(--select); color: #fff; }
.menu-title.logo { padding: 0 12px; }
.logo-mark { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; background: linear-gradient(#5fb747 0 17%, #fbb33f 17% 33%, #f3802e 33% 50%, #df4746 50% 67%, #9b4c9b 67% 83%, #3e9bd8 83%); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' shape-rendering='crispEdges'%3E%3Cpath d='M2 2h3l6 8V2h3v12h-3L5 6v8H2z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' shape-rendering='crispEdges'%3E%3Cpath d='M2 2h3l6 8V2h3v12h-3L5 6v8H2z'/%3E%3C/svg%3E") center/contain no-repeat; }
.menu-title.open .logo-mark { background: #fff; }
.menubar-spacer { flex: 1; }
#clock { padding: 0 12px; height: var(--menubar); line-height: var(--menubar); white-space: nowrap; border: 0; background: none; font: inherit; cursor: default; }
#clock:active { background: var(--select); color: #fff; }

#menus .menu { position: fixed; z-index: 600; min-width: 210px; padding: 3px 0; background: var(--plat); border: 1px solid var(--ink); box-shadow: inset 1px 1px var(--hi), 2px 2px 0 rgba(0,0,0,.45); font-family: var(--sys); font-size: 15px; }
.menu button, .menu .sep { display: flex; width: 100%; justify-content: space-between; gap: 24px; border: 0; background: none; padding: 2px 14px; text-align: left; cursor: default; }
.menu button:hover, .menu button:focus-visible { background: var(--select); color: #fff; outline: none; }
.menu button[disabled] { color: var(--shade); background: none; }
.menu .sep { height: 1px; padding: 0; margin: 3px 0; background: repeating-linear-gradient(90deg, var(--shade) 0 1px, transparent 1px 2px); }
.menu kbd { font: inherit; opacity: .8; }

/* ---------- Desktop ---------- */
#desktop { position: fixed; inset: calc(var(--menubar) + env(safe-area-inset-top)) 0 0 0; background-color: var(--desk); background-image: radial-gradient(var(--desk-2) 1px, transparent 1px); background-size: 4px 4px; }
/* View > Desktop: the patterns (remembered per visitor). */
[data-pattern=bondi] #desktop { background-color: #2a9bb0; background-image: radial-gradient(#238596 1px, transparent 1px); }
[data-pattern=gray] #desktop { background-color: #9a9a9a; background-image: repeating-conic-gradient(#8c8c8c 0 25%, #a6a6a6 0 50%); background-size: 2px 2px; }
/* Film: one of Noah's photos as the wallpaper, dimmed a little so the icons stay readable. */
[data-pattern=film] #desktop { background: linear-gradient(rgba(0,0,0,.18), rgba(0,0,0,.18)), #3a2a20 url(/photos/full/11.jpg) center/cover no-repeat; }
#icons { position: absolute; top: 14px; right: 16px; bottom: 14px; display: flex; flex-direction: column; flex-wrap: wrap-reverse; align-content: flex-start; gap: 18px 18px; }
.icon { width: 84px; padding: 4px 2px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: default; touch-action: manipulation; }
.icon .glyph { image-rendering: pixelated; }
/* Classic name box: black text on white, inverted when selected. */
.icon .label { font-family: var(--sys); font-size: 14px; line-height: 1.2; color: #000; background: #fff; padding: 0 3px; text-align: center; max-width: 84px; }
.icon.selected .glyph { filter: brightness(.55) sepia(1) hue-rotate(190deg) saturate(4); }
.icon.selected .label { background: var(--select); text-shadow: none; }
.icon:focus-visible { outline: 1px dotted #fff; outline-offset: 2px; }
.icon:active .glyph { transform: translate(1px, 1px); }

/* Folder windows show icons on white with black labels. */
.win .icon .label { color: var(--ink); background: none; }
.win .icon.selected .label { color: #fff; }

/* ---------- Windows ---------- */
#windows { position: absolute; inset: 0; pointer-events: none; }
.win { position: absolute; pointer-events: auto; min-width: 260px; display: flex; flex-direction: column; background: var(--plat); border: 1px solid var(--ink); box-shadow: inset 1px 1px var(--hi), inset -1px -1px var(--shade), 2px 2px 0 rgba(0,0,0,.45); }
.win.opening { animation: win-in 180ms steps(3); }
@keyframes win-in { from { transform: scale(.94); opacity: .2; } }
.titlebar { position: relative; height: 22px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 5px; cursor: grab; touch-action: none; user-select: none; }
.titlebar::before { content: ''; position: absolute; left: 6px; right: 58px; top: 5px; height: 11px; background: repeating-linear-gradient(var(--shade) 0 1px, var(--hi) 1px 2px); box-shadow: inset 1px 1px var(--shade), inset -1px -1px var(--hi); }
.win.alert .titlebar::before { right: 24px; }
.win:not(.active) .titlebar::before { background: none; }
.titlebar .title { position: absolute; z-index: 1; left: 50%; transform: translateX(-50%); padding: 0 8px; background: var(--plat); font-family: var(--sys); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 110px); }
.win:not(.active) .titlebar .title { color: var(--shade); }
.wbtn { position: relative; z-index: 1; width: 13px; height: 13px; padding: 0; border: 1px solid var(--ink); background: linear-gradient(135deg, var(--hi), var(--plat-2)); box-shadow: inset 1px 1px var(--hi); cursor: default; }
.wbtn:active { background: var(--shade); }
/* Minimize, zoom and close sit together on the right, each with a clear symbol. */
/* The first button after the (centered) title pushes the group to the right edge. */
.titlebar .wbtn:first-of-type { margin-left: auto; }
.wbtn.shade::after { content: ''; position: absolute; left: 2px; right: 2px; bottom: 3px; height: 2px; background: var(--ink); }
.wbtn.zoom::after { content: ''; position: absolute; inset: 2px; border: 1px solid var(--ink); border-top-width: 2px; }
.wbtn.close::before, .wbtn.close::after { content: ''; position: absolute; left: 1px; right: 1px; top: 5px; height: 1px; background: var(--ink); transform: rotate(45deg); }
.wbtn.close::after { transform: rotate(-45deg); }
.win:not(.active) .wbtn { visibility: hidden; }
.win .body { flex: 1; min-height: 0; margin: 0 5px 5px; background: var(--paper); border: 1px solid var(--ink); box-shadow: inset 1px 1px var(--shade); overflow: auto; }
.win.shaded .body, .win.shaded .statusbar, .win.shaded .resize { display: none; }
/* Minimized: roll up to just the title bar (the window's set height would otherwise leave an empty gray box). */
.win.shaded { height: auto !important; min-height: 0; }
/* Alerts and info windows: close only, sized to content, the classic thick inner frame. */
.win.alert { min-width: 0; }
.win.alert .body { flex: none; overflow: visible; border-width: 2px; box-shadow: inset 1px 1px var(--shade), 0 0 0 2px var(--plat), 0 0 0 3px var(--ink); margin: 4px 7px 7px; }
/* Stickies: yellow, no stripes, the welcome note. */
.win.sticky { background: #fff3a3; }
.win.sticky .titlebar::before { background: none; box-shadow: none; }
.win.sticky .titlebar .title { background: #fff3a3; }
.win.sticky .body { background: #fff8c4; border-color: #b5a64a; box-shadow: none; }
.note { padding: 10px 12px; font-family: var(--sys); font-size: 15px; line-height: 1.35; }
.note p { margin: 0 0 8px; }
.statusbar { flex: none; margin: -2px 5px 4px; padding: 2px 6px; font-family: var(--sys); font-size: 13px; display: flex; justify-content: space-between; }
.resize { position: absolute; right: 0; bottom: 0; width: 15px; height: 15px; cursor: nwse-resize; touch-action: none; background: linear-gradient(135deg, transparent 0 45%, var(--ink) 45% 52%, transparent 52% 64%, var(--ink) 64% 71%, transparent 71%); }

/* Zoom rectangles: the classic Mac open animation, outlines growing from the icon to the window. */
.zoomrect { position: fixed; z-index: 450; border: 1px dotted #000; outline: 1px dotted #fff; pointer-events: none; }

/* Scrollbars in Platinum gray */
.win .body::-webkit-scrollbar { width: 15px; height: 15px; background: repeating-conic-gradient(#ccc 0 25%, #eee 0 50%) 0 0/2px 2px; }
.win .body::-webkit-scrollbar-thumb { background: var(--plat); border: 1px solid var(--ink); box-shadow: inset 1px 1px var(--hi), inset -1px -1px var(--shade); }

/* ---------- App content ---------- */
.prose { padding: 18px 22px 24px; font-size: 14px; line-height: 1.55; }
.prose h1 { font-family: var(--sys); font-weight: 600; font-size: 26px; margin: 0 0 4px; }
.prose h2 { font-family: var(--sys); font-weight: 600; font-size: 18px; margin: 18px 0 4px; }
.prose p { margin: 0 0 10px; }
.prose .muted { color: #555; }
.prose a { color: var(--select); }
.me { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.me img { width: 104px; height: 104px; flex: none; object-fit: cover; border: 1px solid #000; box-shadow: 2px 2px 0 rgba(0,0,0,.35); background: #eee; }
.me h1 { margin: 0; }
.me .muted { margin: 2px 0 0; }
.draft { margin: 0 0 14px; padding: 6px 9px; border: 1px dashed #a66; background: #fff5f5; color: #833; font-size: 12px; }

/* Thumbnails grow with the window: about four across at any width, never smaller than 104px or larger than 280px. */
.win .body:has(.grid) { container-type: inline-size; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(104px, calc(25cqi - 12px), 280px), 1fr)); gap: 6px; padding: 8px; }
.thumb { padding: 0; border: 1px solid #000; background: #eee; aspect-ratio: 1; cursor: zoom-in; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 160ms steps(3); }
.thumb:hover img { transform: scale(1.04); }
.thumb:focus-visible { outline: 2px solid var(--select); outline-offset: 1px; }

.viewer { height: 100%; display: flex; flex-direction: column; background: #1a1a1a; }
.viewer .stage { position: relative; flex: 1; min-height: 0; }
/* Fill the stage and let object-fit letterbox: percentage max sizes don't resolve in a flex child, which cropped wide photos. */
.viewer .stage img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; }
.viewer .controls { flex: none; display: flex; justify-content: center; gap: 8px; padding: 6px; background: var(--plat); border-top: 1px solid var(--ink); }

.btn { min-width: 74px; padding: 3px 12px; border: 1px solid var(--ink); border-radius: 5px; background: linear-gradient(var(--hi), var(--plat-2)); box-shadow: inset 1px 1px var(--hi), inset -1px -1px var(--shade); font-family: var(--sys); font-size: 14px; cursor: default; text-decoration: none; color: var(--ink); display: inline-block; text-align: center; }
.btn:active { background: var(--shade); color: #fff; }
.btn.default { outline: 2px solid var(--ink); outline-offset: 1px; }

.folder { display: flex; flex-wrap: wrap; gap: 14px 10px; padding: 14px; align-content: flex-start; }

.info { display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 16px 18px; font-size: 14px; line-height: 1.5; }
.info .glyph, .dialog .glyph, .about-mac .glyph, .cpanel .glyph { image-rendering: pixelated; }
.info h1 { font-family: var(--sys); font-size: 20px; margin: 0 0 2px; }
.info dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 10px; margin: 10px 0 14px; }
.info dt { font-weight: bold; text-align: right; }
.info dd { margin: 0; }

.mail { display: flex; flex-direction: column; height: 100%; font-size: 13px; }
.mail .hdr { display: grid; grid-template-columns: 64px 1fr; gap: 6px 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid #999; background: #f4f4f4; }
.mail .hdr label { text-align: right; font-family: var(--sys); }
.mail input, .mail textarea { font: inherit; border: 1px solid #000; box-shadow: inset 1px 1px #999; padding: 4px 6px; background: #fff; width: 100%; }
.mail textarea { flex: 1; border: 0; box-shadow: none; resize: none; padding: 12px; outline: none; min-height: 140px; }
.mail .actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid #999; background: #f4f4f4; }

.dialog { display: grid; grid-template-columns: 32px 1fr; gap: 14px; padding: 18px; font-size: 14px; line-height: 1.5; }
.sys { font-family: var(--sys); font-size: 17px; }
.muted { color: #555; }
.cpanel { display: grid; grid-template-columns: 32px 1fr; gap: 14px; padding: 16px 18px; font-size: 14px; }
.cpanel p { margin: 4px 0 10px; }
.cpanel label { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; }
.swatches { display: grid; gap: 6px; margin-top: 8px; }
.swatch { display: flex; align-items: center; gap: 10px; border: 1px solid transparent; background: none; padding: 3px 6px; text-align: left; cursor: default; }
.swatch.on { border-color: #000; background: #eee; }
.sw { width: 34px; height: 20px; border: 1px solid #000; flex: none; }
.sw-platinum { background: #5a6fa8 radial-gradient(#4f6399 1px, transparent 1px) 0 0/4px 4px; }
.sw-bondi { background: #2a9bb0 radial-gradient(#238596 1px, transparent 1px) 0 0/4px 4px; }
.sw-gray { background: repeating-conic-gradient(#8c8c8c 0 25%, #a6a6a6 0 50%) 0 0/2px 2px; }
.sw-film { background: #3a2a20 url(/photos/thumb/11.jpg) center/cover; }
.simpletext { font-family: 'Courier New', monospace; font-size: 14px; }
/* Projects as a list */
.list { font-size: 14px; }
.list .lhead, .list .row { display: grid; grid-template-columns: 1fr 150px; align-items: center; padding: 3px 10px; }
.list .lhead { font-family: var(--sys); border-bottom: 1px solid #000; background: #eee; }
.list .row { width: 100%; flex-direction: row; gap: 8px; justify-items: start; border-bottom: 1px solid #ddd; }
.list .row .label { max-width: none; text-align: left; }
.list .row .kind { color: #555; }
.list .icon.row { display: grid; grid-template-columns: 16px 1fr 150px; }
.dialog .actions { grid-column: 2; display: flex; justify-content: flex-end; gap: 8px; }

.about-mac { padding: 16px 18px; font-size: 14px; }
.about-mac .row { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.mem { margin-top: 10px; }
.mem .bar { height: 12px; border: 1px solid #000; background: #fff; margin-top: 3px; }
.mem .bar span { display: block; height: 100%; background: repeating-linear-gradient(90deg, #4f4fd0 0 6px, #6b6bdc 6px 8px); }

/* ---------- Shut Down and the screensaver ---------- */
#shutdown { position: fixed; inset: 0; z-index: 2000; background: #000; color: #fff; display: grid; place-content: center; text-align: center; font-family: var(--sys); cursor: pointer; animation: fade-in 400ms steps(4); }
#shutdown p { font-size: 26px; margin: 0 0 18px; }
#shutdown span { font-size: 14px; opacity: .55; }
#saver { position: fixed; inset: 0; z-index: 1500; background: #000; display: grid; place-items: center; animation: fade-in 600ms steps(6); }
#saver img { max-width: 86vw; max-height: 80vh; opacity: 0; transition: opacity 900ms steps(9); border: 6px solid #fff; }
#saver img.in { opacity: 1; }
#saver p { position: fixed; bottom: 24px; left: 0; right: 0; text-align: center; color: #aaa; font-family: var(--sys); font-size: 15px; margin: 0; }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Phones: windows fill the screen, no dragging ---------- */
@media (max-width: 700px) {
  #menubar .menu-title[data-menu=edit], #menubar .menu-title[data-menu=view] { display: none; }
  #icons { top: 18px; left: 12px; right: 12px; bottom: auto; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 18px 6px; }
  #icons { bottom: 14px; }
  .icon { width: calc(25% - 5px); }
  #icons .icon.trash { position: absolute; right: 0; bottom: 0; }
  .win.doc { left: 6px !important; right: 6px; top: 6px !important; bottom: calc(6px + env(safe-area-inset-bottom)); width: auto !important; height: auto !important; min-width: 0; }
  .win.alert, .win.sticky { left: 12px !important; right: 12px; width: auto !important; }
  .win.sticky { top: auto !important; bottom: calc(110px + env(safe-area-inset-bottom)); height: auto !important; }
  .titlebar { height: 30px; cursor: default; }
  .titlebar::before { top: 9px; }
  .wbtn { width: 18px; height: 18px; }
  .wbtn.zoom, .wbtn.shade, .resize { display: none; }
  .titlebar .wbtn.close { margin-left: auto; } /* minimize and zoom are hidden on phones: close still sits on the right */
  .grid { grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; }
  .info { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .win.opening, .boot-bar span, #boot.done { animation-duration: 1ms; }
}

/* Embedded apps (ChefGuest, Split) */
.win.app .body { overflow: hidden; background: #fff; }
.win.app iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
body.dragging iframe { pointer-events: none; }
.win.app .statusbar a, .linkish { color: var(--ink); font: inherit; text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
