#keepsakes :is(a,button) {
  position:absolute;z-index:1;pointer-events:none;transform:translate(-50%,calc(-100% - 6px));
  background:var(--oak-paper);color:var(--oak-ink);border:1px solid var(--oak-muted);border-radius:2px 3px 2px 5px;
  padding:.18em .55em;box-shadow:1px 2px 2px color-mix(in srgb, var(--oak-ink) 14%, transparent);white-space:nowrap;
  font:500 1.08rem/1.15 var(--hand);text-decoration:none;opacity:0;
}
#keepsakes .is-hovered,#keepsakes :focus-visible {opacity:1}
#keepsakes :focus-visible {outline:2px solid var(--ink);outline-offset:2px}
/* The hit area follows the sewn loop and captures vertical touch drags locally. */
#keepsakes button.shade-handle {
  width:44px;height:44px;transform:translate(-50%,-50%);pointer-events:auto;
  touch-action:none;cursor:ns-resize;opacity:1;padding:0;background:transparent;
  border:0;box-shadow:none;
}
#keepsakes .shade-handle span {
  position:absolute;left:50%;bottom:100%;transform:translateX(-50%);pointer-events:none;
  padding:.18em .55em;border:1px solid var(--plum);border-radius:2px 3px 2px 5px;
  background:var(--leaf);color:var(--plum);box-shadow:2px 2px 0 var(--marigold);opacity:0;
}
#keepsakes .shade-handle:focus-visible span,
#keepsakes .shade-handle.is-hovered span {opacity:1}
@media(hover:hover){#keepsakes .shade-handle:hover span {opacity:1}}

/* A ruled writing slip and a file of previous notes share the desk blotter. */
#desk-note {
  width:min(820px,calc(100vw - 36px)); max-height:calc(100dvh - 30px);
  padding:0; overflow:auto; border:1.5px solid var(--plum); border-radius:9px;
  background:var(--leaf); color:var(--plum); box-shadow:4px 5px 0 color-mix(in srgb, var(--oak-ink) 31%, transparent);
}
#desk-note::backdrop {background:color-mix(in srgb, var(--oak-ink-dark) 35%, transparent);}
#desk-note[open] {animation:lift-slip .18s ease-out;}
@keyframes lift-slip {from{opacity:0;transform:translateY(6px)}}
@media(prefers-reduced-motion:reduce){#desk-note[open]{animation:none}}
.note-bar {
  display:flex; justify-content:space-between; align-items:center; gap:1rem;
  padding:10px 16px 10px 24px; border-bottom:1px solid var(--oak-rule);
}
.note-bar h2 {font:650 clamp(1.8rem,4vw,2.45rem)/1.1 var(--hand);margin:0;}
.note-close {font:400 1.8rem/1 var(--reading); border:none; color:var(--plum); width:44px;height:44px;}
.note-tray {display:grid;grid-template-columns:minmax(185px,30%) minmax(0,1fr);}
.note-file {min-width:0;background:var(--oak-ground);border-right:1px solid var(--oak-rule);padding:16px 0;}
.note-file-header {display:flex;align-items:center;justify-content:space-between;gap:6px;padding:0 15px;}
.note-file-header h3,.note-file-toggle,.note-new {font:550 1.25rem/1.1 var(--hand);margin:0;}
.note-file-toggle {display:none;}
.note-new {min-height:44px;padding:0 3px;color:var(--link-ink);text-decoration:underline;text-underline-offset:.2em;white-space:nowrap;}
.note-new span {text-decoration:none;}
.note-list {list-style:none;padding:0;margin:8px 0 0;max-height:min(45dvh,345px);overflow:auto;}
.note-list button {
  display:block;width:100%;min-height:54px;padding:8px 17px;text-align:left;
  border-left:3px solid transparent;color:var(--plum);
}
.note-list button:hover {background:var(--oak-amber-wash);}
.note-list button[aria-current="true"] {background:var(--oak-teal-wash);border-left-color:var(--link-ink);}
.note-list button:focus-visible {outline-offset:-4px;}
.note-list small {display:block;color:var(--soft);font:400 .82rem/1.3 var(--reading);}
.note-list span {display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:500 1.24rem/1.3 var(--hand);}
.note-empty {padding:0 18px;margin:15px 0;color:var(--soft);font:400 .92rem/1.5 var(--reading);}
.note-sheet {min-width:0;padding:clamp(18px,3vw,34px);display:flex;flex-direction:column;}
.note-dateline {border-bottom:2px solid var(--link-ink);padding:0 0 .65rem;}
.note-dateline h3 {font:600 clamp(1.4rem,3vw,1.78rem)/1.1 var(--hand);margin:0;}
#note-pencil {
  box-sizing:border-box;display:block;width:100%;height:clamp(158px,35dvh,320px);margin:12px 0 0;padding:0 2px;
  border:0;border-radius:0;resize:none;color:var(--plum);caret-color:var(--link-ink);
  font:500 1.42rem/32px var(--hand);
  background:repeating-linear-gradient(transparent 0 31px,color-mix(in srgb, var(--oak-rule) 58%, var(--oak-paper)) 31px 32px) local;
}
#note-pencil::placeholder {color:var(--oak-muted);}
#note-pencil:focus-visible {outline:1px solid var(--link-ink);outline-offset:4px;}
.note-status {margin:16px 0 0;min-height:1.2em;color:var(--soft);font:400 .86rem/1.35 var(--reading);}
@media(max-width:600px){
  #desk-note {width:calc(100vw - 24px);}
  .note-tray {grid-template-columns:minmax(0,1fr);}
  .note-file {padding:0;border-right:0;border-bottom:1px solid var(--oak-rule);}
  .note-file-header {padding:1px 17px;}
  .note-file-header h3 {display:none;}
  .note-file-toggle {display:inline-flex;align-items:center;min-height:44px;padding:0;color:var(--link-ink);}
  .note-file-toggle::after {content:"";width:.36rem;height:.36rem;border-bottom:1.5px solid;border-right:1.5px solid;transform:translateY(-1px) rotate(45deg);margin-left:9px;}
  .note-file-toggle[aria-expanded="true"]::after {transform:translateY(2px) rotate(225deg);}
  .note-file:not(.expanded) #note-entries {display:none;}
  .note-list {max-height:25dvh;margin-top:0;}
  .note-sheet {padding:17px;}
  .note-empty {margin:6px 0 16px;}
}
