/* kept. one sheet of paper, one ink. */
:root{
  --paper:#f2eee4;    /* the sheet: desk, windows, menu, 'on' pixels */
  --paper-2:#e6e0d1;  /* hover wash, dog-ear, empty still */
  --ink:#000;         /* system only: lines, shadows, inversion, 'off' pixels */
  --type:#2e2b26;     /* ribbon: everything typed */
  --graphite:#625c51; /* pencil: counts, dates, stamps, behind-state, withheld */
  --note:#eddc74;     /* the one colour. one note per screen */
  --u:8px; --line:2px; --drop:4px; --lift:7px;
  --sys:"Tiny5",ui-monospace,monospace;
  --typed:"Courier Prime","Courier New",ui-monospace,monospace;
  --d25:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2'%3E%3Crect width='1' height='1'/%3E%3C/svg%3E") 0 0/2px 2px repeat;
  /* print: textures from scripts/texture.mjs. grain is the stock, specks are toner that didn't hold */
  --grain:url("tex/grain.png") 0 0/200px 200px;
  --specks:url("tex/specks.png") 0 0/128px 128px;
  --ground:url("tex/ground.png") 0 0/192px 192px repeat;
  --d50:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2'%3E%3Crect width='1' height='1'/%3E%3Crect x='1' y='1' width='1' height='1'/%3E%3C/svg%3E") 0 0/2px 2px repeat;
}
*{box-sizing:border-box;margin:0}
html,body{background:var(--paper)}
.defs{position:absolute}
body{font:14px/1.6 var(--typed);color:var(--type);-webkit-font-smoothing:antialiased;text-shadow:0 0 .6px rgba(46,43,38,.5)}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
:focus-visible{outline:2px dashed var(--ink);outline-offset:2px}

/* surround: the 1-bit ground lives outside the sheet */
.surround{position:relative;min-height:100vh;min-height:100svh;padding:40px 24px 48px}
.surround::before{content:"";position:absolute;inset:0;background:var(--ink);-webkit-mask:var(--ground);mask:var(--ground)}
.frame{position:relative;max-width:1120px;margin:0 auto;background:var(--grain),var(--paper);border:var(--line) solid var(--ink);box-shadow:6px 6px 0 var(--ink),inset 0 0 72px rgba(98,92,81,.07)}
/* toner that didn't hold: paper flecks over the copy, ink and shadow included. never blocks a pointer.
   the sheet's layer sits above desk content (z 2) and under the real things left on it: specimen (3), note (4).
   windows (5) and the menu bar carry their own */
.frame::after,.menubar::after,.win::after{content:"";position:absolute;background:var(--specks);pointer-events:none}
.frame::after{inset:-8px;z-index:2}
.menubar::after{inset:0}
.win::after{inset:-2px -6px -6px -2px;z-index:1}

/* menu bar */
.menubar{position:relative;z-index:50;display:flex;align-items:center;height:28px;padding:0 8px;border-bottom:var(--line) solid var(--ink);font:16px/1 var(--sys);color:var(--ink)}
.menubar,.bar,.btn{text-shadow:none}
.mark{width:14px;height:14px;margin-right:8px;flex:none;animation:pilot 1.2s steps(1) 3}
@keyframes pilot{50%{opacity:0}}
.menu{position:relative}
.menu>button{padding:5px 8px 6px}
.menu>button:hover,.menu.on>button{background:var(--ink);color:var(--paper)}
.drop{display:none;position:absolute;left:0;top:100%;min-width:216px;padding:4px 0;background:var(--paper);border:var(--line) solid var(--ink);box-shadow:var(--drop) var(--drop) 0 var(--ink);font:14px/24px var(--typed)}
.menu.on .drop{display:block}
.drop button{display:block;width:100%;padding:0 12px;text-align:left;color:var(--type)}
.drop button:hover:not(:disabled){background:var(--ink);color:var(--paper)}
.drop button:disabled{color:var(--graphite);cursor:default}
.where{margin-left:auto;font:13px/1 var(--typed);color:var(--type);white-space:nowrap}
.where .p{color:var(--graphite)}

/* desk */
.desk{position:relative;height:640px;overflow:hidden}
/* the sheet was folded once, and a cup stood on it. first child of the desk, so under everything on it */
.desk::before{content:"";position:absolute;inset:0;pointer-events:none;
  background:url("tex/ring.png") 27% 74%/136px 136px no-repeat,
    linear-gradient(to bottom,transparent calc(38% - 14px),rgba(98,92,81,.06) calc(38% - 1px),rgba(255,253,246,.65) 38%,rgba(98,92,81,.14) calc(38% + 1px),rgba(98,92,81,.04) calc(38% + 4px),transparent calc(38% + 20px))}
.index{position:absolute;left:32px;top:32px;width:288px}
.row{display:grid;align-items:center;gap:0 12px;width:100%;min-height:26px;padding:0 6px;text-align:left;color:var(--type);font:15px/1.75 var(--typed)}
.index .row{grid-template-columns:1fr 4ch 5ch}
.index .row span+span,.list .row .m{color:var(--graphite);text-align:right;font-size:12px}
.row:hover{background:var(--paper-2)}
.row.sel,.row:active{background:var(--ink);color:var(--paper)}
.row.sel span,.row:active span{color:var(--paper)}
.row.withheld{color:var(--graphite);cursor:default}
.row.withheld:hover,.row.withheld:active{background:none;color:var(--graphite)}
.row.withheld:active span{color:var(--graphite)}
.row.withheld:hover .n{text-decoration:line-through}
.redact .n{display:inline-block;width:12ch;height:.85em;background:var(--ink);vertical-align:-1px}
.redact:hover .n,.redact:focus .n{width:auto;height:auto;background:none}
.redact:hover .n::after,.redact:focus .n::after{content:"no."}
.index .row .span{grid-column:2/4}
.index .tail{margin-top:8px;padding:0 6px;font-size:12px;color:var(--graphite)}

/* folder + clip icons. symbol parts are coloured from here, never inline */
.i-body{fill:var(--if);stroke:var(--is);stroke-width:3}
.i-lip{fill:none;stroke:var(--il);stroke-width:2}
.i-hole{fill:var(--ih)}
.g-fill{fill:currentColor;stroke:none}
.h-bg{fill:var(--paper)}
.h-ln{stroke:var(--ink)}
.mark path{fill:var(--ink)}
.icons{position:absolute;right:40px;top:32px;display:flex;flex-direction:column;align-items:center;gap:24px}
.icon{display:flex;flex-direction:column;align-items:center;gap:6px;width:96px;padding:4px;font:14px/1.3 var(--typed);color:var(--type)}
.icon svg{width:44px;height:36px;overflow:visible}
.icon{--if:var(--paper);--is:var(--ink);--ih:var(--ink);--il:var(--ink)}
.icon span{padding:0 4px}
.icon:hover{--if:var(--paper-2)}
.icon.open{--if:url(#hatch)}
.icon.sel{--if:var(--ink);--ih:var(--paper);--il:var(--paper)}
.icon.sel span{background:var(--ink);color:var(--paper)}
.trace{position:absolute;left:40px;bottom:48px;width:44px;height:36px;border:2px dotted var(--graphite)}

/* specimen: a pinned monarch on aged card, left on the sheet. decorative, under windows, never clicked */
.specimen{position:absolute;left:41%;top:316px;z-index:3;width:232px;pointer-events:none;user-select:none;-webkit-user-select:none}
.specimen img{display:block;width:176px;height:auto;rotate:-7deg}
.specimen p{width:max-content;margin:-6px 0 0 104px;padding:3px 8px 4px;background:var(--grain),var(--paper-2);border:1px solid rgba(98,92,81,.45);box-shadow:2px 2px 0 rgba(46,43,38,.18);rotate:2deg;font:11px/1.4 var(--typed);color:var(--graphite)}

/* sticky note: the only colour. held by a strip of adhesive, bottom corner lifting */
.note{position:absolute;right:176px;bottom:56px;z-index:4;width:208px;padding:22px 16px 18px;
  background:linear-gradient(to top left,rgba(46,43,38,.13),rgba(46,43,38,.04) 9%,transparent 16%),var(--grain),var(--note);
  box-shadow:2px 2px 0 var(--ink);transform:rotate(-1.5deg);font:15px/1.6 var(--typed);color:var(--type)}
/* the note can be picked up on a free desk: snaps like a window, lifts while held, straightens a touch */
@media (min-width:641px){
  .note{cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none}
  .note.held{cursor:grabbing;box-shadow:5px 5px 0 var(--ink);transform:rotate(-.6deg)}
}
.note::before{content:"";position:absolute;left:50%;top:-9px;width:68px;height:18px;margin-left:-38px;rotate:3deg;
  background:linear-gradient(to bottom,rgba(255,253,246,.25),transparent 40%),rgba(242,238,228,.62);
  clip-path:polygon(0 8%,4% 0,3% 30%,7% 45%,2% 62%,5% 82%,0 100%,100% 96%,97% 78%,100% 60%,95% 44%,99% 24%,96% 6%,100% 0)}

/* windows */
.stack{position:absolute;inset:0;z-index:5;pointer-events:none}
.win{position:absolute;width:336px;rotate:var(--tilt,0deg);background:var(--grain),var(--paper);border:var(--line) solid var(--ink);box-shadow:var(--drop) var(--drop) 0 var(--ink);color:var(--type);pointer-events:auto}
.win.wide{width:376px}
.win.drag{box-shadow:var(--lift) var(--lift) 0 var(--ink)}
.bar{display:flex;align-items:center;gap:8px;height:26px;padding:0 6px 0 8px;border-bottom:var(--line) solid var(--ink);font:16px/1 var(--sys);color:var(--ink);touch-action:none;user-select:none;-webkit-user-select:none;cursor:grab}
.drag .bar{cursor:grabbing}
.bar .grain{flex:1;height:10px;background:var(--ink);-webkit-mask:var(--d50);mask:var(--d50)}
.bar .age{color:var(--graphite)}
.win:not(.front) .bar{color:var(--graphite)}
.win:not(.front) .grain{visibility:hidden}
.close{position:relative;flex:none;width:14px;height:14px;border:var(--line) solid var(--ink);border-radius:50%;background:var(--paper)}
.close::after{content:"";position:absolute;inset:-8px}
.close:hover{background:var(--ink)}
.close:active{background:var(--ink);box-shadow:0 0 0 2px var(--paper) inset}
.body{max-height:380px;overflow:auto;padding:12px 14px}
.body p+p{margin-top:2px}
.body .gap{height:10px}
.body .list.after{margin-top:8px}
.foot{position:relative;display:flex;justify-content:space-between;gap:8px;padding:5px 28px 5px 14px;border-top:1px solid var(--ink);font-size:12px;color:var(--graphite)}
.ear{position:absolute;right:0;bottom:0;width:18px;height:18px;background:linear-gradient(to top left,var(--paper-2) calc(50% - 1px),var(--ink) calc(50% - 1px) calc(50% + 1px),transparent calc(50% + 1px))}
.list .row{grid-template-columns:14px 1fr auto;font-size:14px;padding:0 4px}
.list .row.clip{grid-template-columns:14px 1fr auto auto}
.g{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.5}
.stamp{display:inline-block;padding:1px 4px;border:1.5px solid var(--graphite);color:var(--graphite);font:11px/1.2 var(--typed);letter-spacing:.04em;transform:rotate(-3deg)}
.row.sel .stamp,.row:active .stamp{border-color:var(--paper)}
.quiet{color:var(--graphite)}

/* clip player */
/* the still is a print: a paper margin inside the ink edge */
.screen{position:relative;aspect-ratio:16/9;padding:4px;border:var(--line) solid var(--ink);background:var(--paper)}
.screen img{position:relative;z-index:1;display:block;width:100%;height:100%;image-rendering:crisp-edges;image-rendering:pixelated}
.pulp{position:absolute;inset:4px;display:grid;place-items:end start;padding:10px 12px;background:var(--paper-2);font-size:12px;color:var(--graphite)}
.ov{position:absolute;inset:4px;z-index:2;display:grid;place-items:center}
.btn{padding:6px 14px 7px;background:var(--paper);border:var(--line) solid var(--ink);box-shadow:2px 2px 0 var(--ink);font:16px/1 var(--sys);color:var(--ink)}
.btn:hover{background:var(--ink);color:var(--paper)}
.btn:active{transform:translate(2px,2px);box-shadow:none}
.prog{display:flex;align-items:center;gap:10px;margin-top:10px}
.cells{flex:1;display:grid;grid-template-columns:repeat(12,1fr);gap:2px;height:12px}
.cells i{border:1px solid var(--ink)}
.cells i.on{background:var(--ink)}
.tc{font-size:12px;color:var(--graphite);white-space:nowrap}
.say{min-height:1.6em;margin-top:6px;font-size:12px}

/* status line */
.statusbar{display:flex;justify-content:space-between;align-items:center;height:24px;padding:0 10px;border-top:var(--line) solid var(--ink);font-size:12px;color:var(--graphite)}

/* small screens: the desk stops being free */
@media (max-width:640px){
  .surround{padding:8px 12px 14px 8px}
  .frame{box-shadow:var(--drop) var(--drop) 0 var(--ink)}
  .where .p,.menu.look{display:none}
  .desk{height:auto;min-height:calc(100svh - 28px - 24px - 30px);display:flex;flex-direction:column;gap:24px;padding:16px 16px 32px}
  .index,.icons{position:static;width:auto}
  .index .row{min-height:44px}
  .icons{flex-direction:row;justify-content:space-around;gap:8px}
  .icon{width:auto;min-height:44px}
  .trace{display:none}
  .stack{position:static;display:flex;flex-direction:column;gap:16px;pointer-events:auto}
  .stack:empty{display:none}
  .win,.win.wide{position:relative;left:auto!important;top:auto!important;width:auto;rotate:calc(var(--tilt,0deg) * .4)}
  .desk::before{background:url("tex/ring.png") right -52px bottom -44px/136px 136px no-repeat}
  .bar{height:32px;cursor:default}
  .close{width:18px;height:18px}
  .close::after{inset:-16px}
  .body{max-height:none}
  .list .row{min-height:44px}
  .note{position:relative;right:auto!important;bottom:auto!important;left:auto!important;top:auto!important;align-self:flex-end;width:70%}
  .specimen{position:relative;left:auto;top:auto;order:9;align-self:flex-start;width:180px;margin-top:-8px}
  .specimen img{width:120px}
  .specimen p{margin:-4px 0 0 64px}
  .desk:has(.win) .note{display:none}
}
@media (prefers-reduced-motion:reduce){.mark{animation:none}}

/* the prompt: one line, one button */
.ask .askrow{display:flex;gap:10px;align-items:stretch}
.ask .ans{flex:1;min-width:0;padding:6px 8px;background:var(--paper);border:var(--line) solid var(--ink);border-radius:0;font:15px/1.4 var(--typed);color:var(--type)}
.ask .ans:focus{outline:2px solid var(--ink);outline-offset:2px}
.ask .ans:disabled{color:var(--graphite)}
.ask .btn:disabled{color:var(--graphite);border-color:var(--graphite);box-shadow:none}
@media (max-width:640px){
  .ask .ans,.ask .btn{min-height:44px}
  .ask .ans{font-size:16px}
}

/* 404 */
.lost{padding:48px 32px;min-height:240px}
.lost-t{font:32px/1.2 var(--sys);color:var(--ink);margin-bottom:16px}
.lost a{color:var(--type)}
