/* SheedyNotes 1.2 — subject-pile Notes explorer and homepage workbench */
:root {
  --notes-v12-paper: #fbf8f0;
  --notes-v12-paper-deep: #eee4cf;
  --notes-v12-wood: #704622;
  --notes-v12-wood-dark: #402817;
  --notes-v12-ink-soft: color-mix(in srgb, var(--ink) 66%, transparent);
  --notes-v12-ease: cubic-bezier(.2,.78,.2,1);
  --notes-v12-bounce: cubic-bezier(.2,1.18,.3,1);
}

/* Homepage Notes preview */
.home-v12-library-section {
  position: relative;
  overflow: clip;
  background:
    radial-gradient(circle at 8% 18%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 28%),
    radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--red) 7%, transparent), transparent 25%),
    var(--paper);
}
.home-v12-library-section::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: repeating-linear-gradient(90deg, transparent 0 47px, color-mix(in srgb, var(--ink) 3%, transparent) 48px 49px);
}
.home-v12-library-section > .shell { position: relative; }
.home-library-subjects {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.65rem);
  align-items: stretch;
}
.home-library-subject {
  --pile-colour: var(--red);
  --pile-dark: #5d1320;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(86px, auto) 292px auto;
  border: 1px solid color-mix(in srgb, var(--pile-colour) 22%, var(--line));
  background: linear-gradient(155deg, color-mix(in srgb, var(--pile-colour) 6%, var(--surface)), var(--surface));
  box-shadow: 0 22px 55px color-mix(in srgb, var(--ink) 9%, transparent);
  overflow: hidden;
  isolation: isolate;
}
.home-library-subject::before {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  right: -90px;
  top: -100px;
  border-radius: 50%;
  border: 32px solid color-mix(in srgb, var(--pile-colour) 8%, transparent);
  pointer-events: none;
  z-index: -1;
}
.home-library-subject > header {
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) auto;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1rem .8rem;
  border-bottom: 1px solid color-mix(in srgb, var(--pile-colour) 15%, var(--line));
}
.home-library-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--pile-colour);
  background: color-mix(in srgb, var(--pile-colour) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--pile-colour) 22%, transparent);
  font-size: 1.35rem;
  box-shadow: 0 9px 20px color-mix(in srgb, var(--pile-colour) 12%, transparent);
}
.home-library-subject > header small,
.home-library-preview-copy > span {
  display: block;
  color: var(--pile-colour);
  font: 750 .66rem/1.2 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.home-library-subject > header h3 {
  margin: .18rem 0 0;
  font-family: var(--font-display);
  font-size: 1.22rem;
}
.home-library-subject > header b {
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  color: var(--muted);
  font: 700 .75rem/1 var(--font-mono);
}
.home-library-preview-copy {
  min-width: 0;
  padding: .85rem 1rem .6rem;
  transition: opacity .22s, transform .22s;
}
.home-library-preview-copy > strong {
  display: block;
  margin-top: .3rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-display);
  font-size: .96rem;
}
.home-library-preview-copy > small {
  display: block;
  margin-top: .32rem;
  color: var(--muted);
  font-size: .7rem;
}
.home-library-stack {
  position: relative;
  min-height: 292px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 24px .75rem 42px;
  perspective: 900px;
  transform-style: preserve-3d;
}
.home-library-stack::before {
  content: "";
  position: absolute;
  inset: 5% 8% 34px;
  border-radius: 50%;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--pile-colour) 11%, transparent), transparent 68%);
  filter: blur(9px);
  pointer-events: none;
}
.home-library-spine {
  --book: var(--pile-colour);
  --spine-index: 0;
  position: relative;
  z-index: calc(20 - var(--spine-index));
  width: calc(88% + (var(--spine-index) * .6%));
  min-height: 32px;
  display: grid;
  grid-template-columns: 36px minmax(0,1fr) auto;
  align-items: center;
  gap: .45rem;
  margin-top: -1px;
  padding: .45rem .65rem .45rem .75rem;
  border: 1px solid color-mix(in srgb, var(--pile-dark) 70%, #141414);
  border-radius: 6px 4px 4px 8px;
  color: white;
  text-decoration: none;
  background: linear-gradient(90deg, rgba(0,0,0,.17), transparent 13%, rgba(255,255,255,.11) 55%, rgba(0,0,0,.12)), var(--book);
  box-shadow: 0 6px 10px rgba(24,22,19,.18), inset 0 1px rgba(255,255,255,.2), inset 0 -2px rgba(0,0,0,.13);
  transform: translateX(calc((var(--spine-index) - 3) * 1.5px)) rotate(calc((var(--spine-index) - 3) * .22deg));
  transform-origin: center bottom;
  transition: transform .42s var(--notes-v12-bounce), filter .25s, opacity .25s, box-shadow .3s;
}
.home-library-spine::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 4px;
  top: -4px;
  height: 4px;
  border: 1px solid rgba(68,52,35,.15);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: repeating-linear-gradient(0deg, #fffaf0 0 1px, #d6cbb7 1px 2px);
}
.home-library-spine > span,
.home-library-spine > small {
  font: 700 .58rem/1 var(--font-mono);
  white-space: nowrap;
  opacity: .78;
}
.home-library-spine > strong {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font: 700 .69rem/1.15 var(--font-display);
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.home-library-spine:hover,
.home-library-spine:focus-visible,
.home-library-spine.is-inspected {
  z-index: 90;
  transform: translateX(12px) translateY(-4px) rotate(0deg) scale(1.025);
  filter: saturate(1.1) brightness(1.04);
  box-shadow: 0 15px 22px rgba(24,22,19,.27), inset 0 1px rgba(255,255,255,.23), inset 0 -2px rgba(0,0,0,.13);
}
.home-library-stack:has(.home-library-spine:hover) .home-library-spine:not(:hover),
.home-library-stack:has(.home-library-spine:focus-visible) .home-library-spine:not(:focus-visible) {
  opacity: .56;
  filter: saturate(.58);
}
.home-library-shelf {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 17px;
  height: 19px;
  z-index: 2;
  border-radius: 4px 4px 7px 7px;
  background: linear-gradient(180deg, #9b7048, var(--notes-v12-wood) 48%, var(--notes-v12-wood-dark));
  box-shadow: 0 12px 17px rgba(46,29,16,.28), inset 0 2px rgba(255,255,255,.2);
}
.home-library-shelf::before {
  content: "";
  position: absolute;
  inset: 16px 5px auto;
  height: 8px;
  border-radius: 0 0 5px 5px;
  background: var(--notes-v12-wood-dark);
}
.home-library-empty {
  width: 86%;
  min-height: 164px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: .4rem;
  border: 1px dashed color-mix(in srgb, var(--pile-colour) 35%, var(--line));
  color: var(--muted);
  text-align: center;
  background: color-mix(in srgb, var(--pile-colour) 4%, var(--surface));
}
.home-library-empty > span { font-size: 1.5rem; color: var(--pile-colour); }
.home-library-empty > small { max-width: 20ch; }
.home-library-open {
  min-height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 1rem;
  border-top: 1px solid color-mix(in srgb, var(--pile-colour) 15%, var(--line));
  color: var(--pile-dark);
  text-decoration: none;
  font-weight: 750;
  font-size: .79rem;
}
.home-library-open:hover { color: var(--pile-colour); background: color-mix(in srgb, var(--pile-colour) 5%, transparent); }
.home-library-key-hint { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); font-size: .75rem; }
.home-library-key-hint kbd,
.notes-v12-key-guide kbd {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 0 2px 0 var(--line);
  font: 700 .68rem/1 var(--font-mono);
}

/* Homepage featured tools */
.home-v12-tools-section { overflow: hidden; }
.home-v12-tools-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.home-v12-python-row { margin-top: 1rem; }
.home-v12-tool {
  display: grid;
  grid-template-columns: minmax(230px, .85fr) minmax(0, 1.15fr);
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.home-v12-tool-media {
  position: relative;
  min-height: 260px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #172c31;
  color: white;
  text-decoration: none;
}
.home-v12-tool-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s var(--notes-v12-ease), filter .35s;
}
.home-v12-tool-media > span {
  position: absolute;
  left: .8rem;
  bottom: .8rem;
  padding: .45rem .6rem;
  background: rgba(18,25,28,.78);
  backdrop-filter: blur(8px);
  font: 750 .68rem/1 var(--font-body);
}
.home-v12-tool-media:hover img { transform: scale(1.025); filter: brightness(1.05); }
.home-v12-tool-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.2rem, 3vw, 2rem);
}
.home-v12-tool-body > p:first-child {
  margin: 0 0 .55rem;
  color: var(--red);
  font: 750 .68rem/1.2 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.home-v12-tool-body h3 {
  margin: 0;
  font: 700 clamp(1.4rem, 2.5vw, 2.05rem)/1.04 var(--font-display);
}
.home-v12-tool-body h3 span { color: var(--muted); font: 700 .72rem/1 var(--font-mono); white-space: nowrap; }
.home-v12-tool-body > p:not(:first-child) { color: var(--muted); }
.home-v12-tool-body > div { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 1rem; }
.home-v12-python-row .home-v12-tool { grid-template-columns: minmax(320px, 1fr) minmax(0, 1fr); }
.home-v12-python-row .home-v12-tool-media { min-height: 300px; }
.home-v12-tool.is-coming-soon { border-style: dashed; background: color-mix(in srgb, #236b73 4%, var(--surface)); }
.home-v12-tool.is-coming-soon .home-v12-tool-media { background: linear-gradient(145deg, #122d34, #1d555d); }
.home-v12-tool.is-coming-soon .home-v12-tool-media > span { background: #e5d4a3; color: #493b19; }
.home-v12-tool.is-coming-soon .button:disabled { cursor: not-allowed; opacity: .58; filter: grayscale(.6); }
.home-v12-status { color: var(--muted); font-size: .7rem; }
.chemlab-preview {
  position: relative;
  width: min(78%, 300px);
  aspect-ratio: 1.4;
  border: 1px solid rgba(255,255,255,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.12));
  box-shadow: 0 28px 50px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.12);
  overflow: hidden;
}
.chemlab-preview::before {
  content: "";
  position: absolute;
  inset: 62% 8% 17%;
  border-radius: 50%;
  background: rgba(67,213,211,.2);
  filter: blur(13px);
}
.chemlab-preview .flask {
  position: absolute;
  left: 50%;
  top: 43%;
  transform: translate(-50%, -50%);
  font-size: 4.7rem;
  color: #dffcf8;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.3));
}
.chemlab-preview .bench-line {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 20%;
  height: 8px;
  background: #9c7148;
  box-shadow: 0 8px 0 #604328;
}
.chemlab-preview i {
  position: absolute;
  width: 15px;
  height: 48px;
  bottom: 24%;
  border: 2px solid rgba(229,255,252,.62);
  border-top: 0;
  border-radius: 0 0 8px 8px;
}
.chemlab-preview i:nth-of-type(1) { left: 16%; }
.chemlab-preview i:nth-of-type(2) { left: 25%; height: 36px; }
.chemlab-preview i:nth-of-type(3) { right: 17%; height: 58px; }

/* Public Notes explorer */
.notes-v12-page-hero {
  padding-bottom: clamp(2.1rem, 5vw, 4rem);
  background:
    radial-gradient(circle at 84% 18%, color-mix(in srgb, var(--red) 8%, transparent), transparent 24%),
    linear-gradient(145deg, var(--paper), color-mix(in srgb, var(--gold) 6%, var(--paper)));
}
.notes-v12-page-hero .lead { max-width: 72ch; }
.notes-v12-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: 1.25rem;
}
.notes-v12-hero-meta span {
  padding: .45rem .62rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--muted);
  font-size: .73rem;
}
.notes-v12-guide {
  margin-top: 1.25rem;
  border: 1px solid var(--line);
  background: var(--surface);
}
.notes-v12-guide summary {
  cursor: pointer;
  padding: .8rem 1rem;
  font-weight: 750;
}
.notes-v12-guide > div {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}
.notes-v12-guide article { padding: 1rem; background: var(--surface); }
.notes-v12-guide article strong { display: block; margin-bottom: .28rem; }
.notes-v12-guide article p { margin: 0; color: var(--muted); font-size: .82rem; }
#notes-v12-app {
  display: grid;
  gap: clamp(1.2rem, 3vw, 2.4rem);
}
.notes-v12-subjects,
.notes-v12-workbench,
.notes-v12-browser {
  --pile-colour: var(--red);
  --pile-dark: #5d1320;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 22px 65px color-mix(in srgb, var(--ink) 9%, transparent);
}
.notes-v12-subjects { padding: clamp(1rem, 2.5vw, 1.6rem); }
.notes-v12-intro,
.notes-v12-workbench-head,
.notes-v12-browser-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
}
.notes-v12-intro { margin-bottom: 1rem; }
.notes-v12-intro h2,
.notes-v12-workbench-head h2,
.notes-v12-browser-head h2 { margin: .2rem 0 0; }
.notes-v12-intro > p,
.notes-v12-workbench-head > div > p:last-child,
.notes-v12-browser-head > div > p:last-child { max-width: 62ch; color: var(--muted); margin: .45rem 0 0; }
.notes-v12-subject-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .7rem;
}
.notes-v12-subject-card {
  --pile-colour: var(--red);
  --pile-dark: #5d1320;
  min-width: 0;
  min-height: 116px;
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) 58px;
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: .65rem;
  padding: .85rem;
  border: 1px solid color-mix(in srgb, var(--pile-colour) 18%, var(--line));
  background: color-mix(in srgb, var(--pile-colour) 4%, var(--surface));
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform .28s var(--notes-v12-ease), border-color .25s, background .25s, box-shadow .25s;
}
.notes-v12-subject-card:hover,
.notes-v12-subject-card.is-active {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--pile-colour) 48%, var(--line));
  background: color-mix(in srgb, var(--pile-colour) 8%, var(--surface));
  box-shadow: 0 13px 28px color-mix(in srgb, var(--pile-colour) 12%, transparent);
}
.notes-v12-subject-card.is-active { box-shadow: inset 0 -3px var(--pile-colour), 0 13px 28px color-mix(in srgb, var(--pile-colour) 12%, transparent); }
.notes-v12-subject-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--pile-colour);
  background: color-mix(in srgb, var(--pile-colour) 11%, var(--surface));
  font-size: 1.17rem;
}
.notes-v12-subject-copy { min-width: 0; }
.notes-v12-subject-copy small { display: block; color: var(--pile-colour); font: 750 .57rem/1.1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.notes-v12-subject-copy strong { display: block; margin-top: .18rem; font: 700 .95rem/1.15 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-v12-subject-copy em { display: block; margin-top: .22rem; color: var(--muted); font-size: .62rem; font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-v12-subject-card > b { grid-column: 1/-1; justify-self: end; color: var(--muted); font: 700 .62rem/1 var(--font-mono); }
.notes-v12-mini-stack {
  align-self: end;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 64px;
}
.notes-v12-mini-stack i {
  --mini: var(--pile-colour);
  display: block;
  width: calc(48px - var(--mini-index) * 2px);
  height: 9px;
  margin-top: -1px;
  border: 1px solid color-mix(in srgb, var(--pile-dark) 68%, #111);
  border-radius: 2px;
  background: var(--mini);
  box-shadow: 0 2px 3px rgba(0,0,0,.13);
}
.notes-v12-mini-stack i.is-empty { height: 42px; border-style: dashed; background: transparent; border-color: var(--line-strong); }

.notes-v12-workbench { overflow: hidden; }
.notes-v12-workbench-head,
.notes-v12-browser-head { padding: clamp(1.1rem, 3vw, 1.8rem); border-bottom: 1px solid var(--line); }
.notes-v12-key-guide { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .7rem; }
.notes-v12-key-guide > span { display: flex; align-items: center; gap: .22rem; white-space: nowrap; }
.notes-v12-stack-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 355px);
  gap: clamp(1rem, 2.5vw, 2rem);
  padding: clamp(1rem, 2.5vw, 1.8rem);
  align-items: center;
  background:
    radial-gradient(circle at 35% 45%, color-mix(in srgb, var(--pile-colour) 9%, transparent), transparent 43%),
    color-mix(in srgb, var(--pile-colour) 2%, var(--paper));
}
.notes-v12-stack-shell {
  position: relative;
  min-height: 600px;
  padding: 52px 58px 72px 42px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--pile-colour) 18%, var(--line));
  background: linear-gradient(155deg, color-mix(in srgb, var(--surface) 86%, transparent), color-mix(in srgb, var(--pile-colour) 4%, var(--surface)));
  box-shadow: inset 0 1px rgba(255,255,255,.55), inset 0 -50px 90px rgba(72,50,27,.04);
  perspective: 1400px;
}
.notes-v12-stack-caption {
  position: absolute;
  left: 1rem;
  right: 4.2rem;
  top: .9rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: .66rem;
}
.notes-v12-stack-caption small { color: var(--pile-colour); font: 750 .62rem/1 var(--font-mono); }
.notes-v12-volume-stack {
  height: 474px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  overflow-y: auto;
  overflow-x: visible;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--pile-colour) 28%, transparent) transparent;
  padding: 76px 34px 38px 12px;
  scroll-padding-block: 90px;
}
.notes-v12-volume-stack::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 52px;
  height: 25px;
  border-radius: 50%;
  background: rgba(33,27,22,.18);
  filter: blur(12px);
  pointer-events: none;
}
.notes-v12-book {
  --book: var(--pile-colour);
  --book-width: 94%;
  --stack-offset: 0;
  position: relative;
  flex: 0 0 auto;
  width: var(--book-width);
  min-height: 48px;
  display: grid;
  grid-template-columns: 62px minmax(0,1fr) auto 22px;
  align-items: center;
  gap: .8rem;
  margin-top: -2px;
  padding: .58rem .8rem .58rem 1rem;
  border: 1px solid color-mix(in srgb, var(--pile-dark) 72%, #171717);
  border-radius: 8px 5px 5px 11px;
  color: white;
  text-align: left;
  background: linear-gradient(90deg, rgba(0,0,0,.19), transparent 13%, rgba(255,255,255,.11) 54%, rgba(0,0,0,.13)), var(--book);
  box-shadow: 0 8px 12px rgba(20,22,21,.18), inset 0 1px rgba(255,255,255,.2), inset 0 -2px rgba(0,0,0,.12);
  transform: translateX(calc((var(--stack-offset) - 3) * 2px)) rotate(calc((var(--stack-offset) - 3) * .18deg));
  transform-origin: center bottom;
  cursor: pointer;
  transition: transform .44s var(--notes-v12-bounce), opacity .3s, filter .3s, min-height .42s var(--notes-v12-ease), margin .42s var(--notes-v12-ease), width .42s var(--notes-v12-ease), box-shadow .3s;
}
.notes-v12-book::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 5px;
  top: -6px;
  height: 6px;
  border: 1px solid rgba(65,49,31,.16);
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: repeating-linear-gradient(0deg, #fffaf0 0 1px, #d5c9b4 1px 2px);
}
.notes-v12-book::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 5px;
  bottom: 3px;
  width: 7px;
  border: 1px solid rgba(65,49,31,.15);
  border-left: 0;
  border-radius: 0 4px 4px 0;
  background: repeating-linear-gradient(90deg, #f8f0df 0 1px, #d2c7b3 1px 2px);
  transform: skewY(-11deg);
  transform-origin: left;
}
.notes-v12-book-ridges {
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  display: flex;
  gap: 4px;
}
.notes-v12-book-ridges i { width: 2px; border-radius: 4px; background: rgba(255,255,255,.19); box-shadow: 1px 0 rgba(0,0,0,.18); }
.notes-v12-book > small,
.notes-v12-book > em { font: 750 .61rem/1 var(--font-mono); white-space: nowrap; opacity: .76; font-style: normal; }
.notes-v12-book > strong { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 700 clamp(.78rem, 1.25vw, 1rem)/1.1 var(--font-display); text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.notes-v12-book > b { opacity: .64; transition: transform .25s, opacity .25s; }
.notes-v12-book:hover,
.notes-v12-book:focus-visible,
.notes-v12-book.is-active {
  z-index: 80;
  width: min(100%, 720px);
  min-height: 66px;
  margin: 10px 0 13px;
  transform: translateX(22px) translateY(-5px) rotate(0) scale(1.02);
  filter: saturate(1.08) brightness(1.03);
  box-shadow: 0 21px 24px rgba(20,22,21,.25), inset 0 1px rgba(255,255,255,.22), inset 0 -2px rgba(0,0,0,.12);
}
.notes-v12-book:hover > b,
.notes-v12-book:focus-visible > b,
.notes-v12-book.is-active > b { opacity: 1; transform: translate(2px,-2px); }
.notes-v12-book.is-empty {
  color: color-mix(in srgb, white 68%, #888);
  background: linear-gradient(90deg, rgba(0,0,0,.16), transparent, rgba(255,255,255,.07)), #777874;
  border-color: #5b5d5a;
  opacity: .38;
  filter: grayscale(1);
  cursor: not-allowed;
}
.notes-v12-book.is-empty:hover { transform: translateX(calc((var(--stack-offset) - 3) * 2px)); margin-top: -2px; min-height: 48px; width: var(--book-width); }
.notes-v12-wood-shelf {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 24px;
  height: 24px;
  border-radius: 5px 5px 9px 9px;
  background: linear-gradient(180deg, #9c7047, var(--notes-v12-wood) 48%, var(--notes-v12-wood-dark));
  box-shadow: 0 15px 22px rgba(47,31,18,.28), inset 0 2px rgba(255,255,255,.2);
}
.notes-v12-wood-shelf::before {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: 20px;
  height: 10px;
  border-radius: 0 0 7px 7px;
  background: var(--notes-v12-wood-dark);
}
.notes-v12-wood-shelf span {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translate(-50%,-50%);
  width: 78px;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(180deg, #edcf83, #b48739);
  box-shadow: 0 3px 7px rgba(42,25,10,.22);
}
.notes-v12-stack-arrows {
  position: absolute;
  right: .7rem;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: .45rem;
}
.notes-v12-stack-arrows button,
.notes-v12-browser-nav button {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--pile-colour) 26%, var(--line));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--pile-colour);
  cursor: pointer;
  font-weight: 800;
  transition: transform .22s, background .22s, opacity .22s;
}
.notes-v12-stack-arrows button:hover:not(:disabled),
.notes-v12-browser-nav button:hover:not(:disabled) { transform: translateY(-2px); background: color-mix(in srgb, var(--pile-colour) 9%, var(--surface)); }
.notes-v12-stack-arrows button:disabled,
.notes-v12-browser-nav button:disabled { opacity: .27; cursor: not-allowed; }
.notes-v12-empty-stack {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}
.notes-v12-empty-stack > span { font-size: 3rem; color: var(--pile-colour); }
.notes-v12-empty-stack > strong { margin-top: .5rem; color: var(--ink); font-family: var(--font-display); font-size: 1.35rem; }
.notes-v12-empty-stack > p { max-width: 42ch; }
.notes-v12-inspector {
  --pile-colour: var(--red);
  --pile-dark: #5d1320;
  position: sticky;
  top: 90px;
  min-height: 485px;
  align-self: center;
  padding: 1.35rem;
  border: 1px solid color-mix(in srgb, var(--pile-colour) 24%, var(--line));
  background: linear-gradient(155deg, color-mix(in srgb, var(--pile-colour) 7%, var(--surface)), var(--surface));
  box-shadow: 0 20px 48px color-mix(in srgb, var(--ink) 10%, transparent), inset 0 1px rgba(255,255,255,.55);
  overflow: hidden;
}
.notes-v12-inspector::before {
  content: "";
  position: absolute;
  right: -65px;
  top: -72px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  border: 35px solid color-mix(in srgb, var(--pile-colour) 7%, transparent);
  pointer-events: none;
}
.notes-v12-inspector-status {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  color: var(--pile-colour);
  font: 750 .62rem/1 var(--font-mono);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.notes-v12-inspector-status span { display: flex; align-items: center; gap: .45rem; }
.notes-v12-inspector-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--pile-colour); box-shadow: 0 0 0 5px color-mix(in srgb, var(--pile-colour) 10%, transparent); }
.notes-v12-inspector-book {
  --book: var(--pile-colour);
  position: relative;
  width: 106px;
  height: 64px;
  margin: 2rem 0 1.4rem;
  border-radius: 7px 4px 4px 9px;
  background: linear-gradient(90deg, rgba(0,0,0,.18), transparent 17%, rgba(255,255,255,.12)), var(--book);
  box-shadow: 0 14px 22px rgba(20,24,23,.21);
  transform: rotate(-3deg);
}
.notes-v12-inspector-book::before { content: ""; position: absolute; left: 8px; right: 4px; top: -6px; height: 6px; border-radius: 4px 4px 0 0; background: repeating-linear-gradient(0deg,#fff9eb 0 1px,#d8cdb9 1px 2px); }
.notes-v12-inspector-book::after { content: ""; position: absolute; right: -6px; top: 5px; bottom: 3px; width: 6px; background: repeating-linear-gradient(90deg,#f5eddd 0 1px,#d3c8b5 1px 2px); border-radius: 0 4px 4px 0; }
.notes-v12-inspector-kicker { margin: 0 0 .35rem; color: var(--pile-colour); font: 750 .65rem/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.notes-v12-inspector h3 { position: relative; margin: 0; font: 700 clamp(1.45rem, 2.8vw, 2rem)/1.04 var(--font-display); }
.notes-v12-inspector > p:not(.notes-v12-inspector-kicker):not(.notes-v12-available-note) { position: relative; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.notes-v12-inspector-metrics { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: .42rem; margin: 1rem 0; }
.notes-v12-inspector-metrics span { display: grid; justify-items: center; align-content: center; min-height: 62px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 72%, transparent); }
.notes-v12-inspector-metrics b { font: 700 1.2rem/1 var(--font-display); }
.notes-v12-inspector-metrics small { margin-top: .25rem; color: var(--muted); font-size: .58rem; text-transform: uppercase; }
.notes-v12-inspector-actions { position: relative; display: grid; gap: .5rem; }
.notes-v12-inspector-actions .button { width: 100%; }
.notes-v12-available-note { position: relative; display: flex; gap: .5rem; align-items: flex-start; margin: 1rem 0 0; padding: .7rem; border-left: 3px solid #1d643c; background: color-mix(in srgb, #1d643c 7%, var(--surface)); color: #1d643c; font-size: .7rem; }
.notes-v12-available-note > span { flex: 0 0 auto; width: 7px; height: 7px; margin-top: .15rem; border-radius: 50%; background: currentColor; }
.notes-v12-available-note.is-planned { border-color: var(--muted); color: var(--muted); background: var(--paper); }
.notes-v12-inspector-empty { min-height: 440px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.notes-v12-inspector-empty > span { font-size: 2.8rem; color: var(--pile-colour); }
.notes-v12-inspector-empty h3 { margin-top: .5rem; }
.notes-v12-inspector-empty button { min-height: 42px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); padding: .6rem .9rem; }

.notes-v12-browser { overflow: hidden; }
.notes-v12-browser-nav { display: flex; gap: .45rem; }
.notes-v12-browser-tools {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(220px, 1fr) repeat(2, minmax(130px, .55fr)) auto auto;
  align-items: end;
  gap: .55rem;
  padding: .8rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--pile-colour) 3%, var(--paper));
}
.notes-v12-browser-tools nav {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  color: var(--muted);
  font-size: .7rem;
}
.notes-v12-browser-tools nav button,
.notes-v12-browser-tools > button {
  min-height: 39px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: .55rem .7rem;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 700;
}
.notes-v12-browser-tools nav button { min-height: 0; padding: .2rem .3rem; border: 0; background: transparent; color: var(--pile-colour); }
.notes-v12-browser-tools label { display: grid; gap: .28rem; color: var(--muted); font-size: .65rem; font-weight: 700; }
.notes-v12-browser-tools input,
.notes-v12-browser-tools select {
  width: 100%;
  min-height: 39px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: .55rem .65rem;
}
.notes-v12-browser-tools input:focus,
.notes-v12-browser-tools select:focus { outline: 3px solid color-mix(in srgb, var(--pile-colour) 20%, transparent); border-color: var(--pile-colour); }
.notes-v12-result-status { padding: .65rem .85rem; color: var(--muted); border-bottom: 1px solid var(--line); font-size: .72rem; }
.notes-v12-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}
.notes-v12-record {
  min-width: 0;
  min-height: 218px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 1rem;
  background: var(--surface);
  transition: background .22s, transform .22s;
}
.notes-v12-record:hover { position: relative; z-index: 2; background: color-mix(in srgb, var(--pile-colour) 4%, var(--surface)); box-shadow: 0 12px 30px color-mix(in srgb, var(--ink) 9%, transparent); }
.notes-v12-record > header { display: flex; justify-content: space-between; gap: .8rem; align-items: center; }
.notes-v12-record code { color: var(--pile-colour); font-size: .66rem; }
.notes-v12-record > header span { padding: .25rem .4rem; border: 1px solid var(--line); color: var(--muted); font-size: .58rem; text-transform: uppercase; letter-spacing: .04em; }
.notes-v12-record.is-published > header span { color: #1d643c; border-color: color-mix(in srgb, #1d643c 34%, var(--line)); background: color-mix(in srgb, #1d643c 7%, var(--surface)); }
.notes-v12-record.is-planned { color: color-mix(in srgb, var(--ink) 58%, var(--surface)); background: color-mix(in srgb, var(--muted) 3%, var(--surface)); }
.notes-v12-record h3 { margin: .75rem 0 .42rem; font: 700 1rem/1.17 var(--font-display); }
.notes-v12-record p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.notes-v12-record > footer { display: flex; justify-content: space-between; gap: .8rem; align-items: center; margin-top: .9rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.notes-v12-record > footer > span { color: var(--muted); font-size: .64rem; }
.notes-v12-record > footer a,
.notes-v12-record > footer button { border: 0; background: transparent; color: var(--pile-colour); text-decoration: none; font-size: .7rem; font-weight: 750; cursor: pointer; white-space: nowrap; }
.notes-v12-record > footer button:disabled { color: var(--muted); cursor: not-allowed; opacity: .6; }
.notes-v12-results.is-compact { grid-template-columns: repeat(4, minmax(0,1fr)); }
.notes-v12-results.is-compact .notes-v12-record { min-height: 155px; padding: .75rem; }
.notes-v12-results.is-compact .notes-v12-record p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notes-v12-empty { min-height: 240px; display: grid; place-items: center; align-content: center; color: var(--muted); text-align: center; }
.notes-v12-empty strong { color: var(--ink); font-family: var(--font-display); font-size: 1.2rem; }
.notes-v12-empty span { margin-top: .35rem; }
.notes-v12-browser > footer { display: flex; justify-content: center; padding: 1rem; border-top: 1px solid var(--line); }

/* Dark theme */
html[data-theme="dark"] .home-library-subject,
html[data-theme="dark"] .notes-v12-subjects,
html[data-theme="dark"] .notes-v12-workbench,
html[data-theme="dark"] .notes-v12-browser,
html[data-theme="dark"] .notes-v12-inspector,
body.dark .home-library-subject,
body.dark .notes-v12-subjects,
body.dark .notes-v12-workbench,
body.dark .notes-v12-browser,
body.dark .notes-v12-inspector {
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
html[data-theme="dark"] .notes-v12-stack-shell,
body.dark .notes-v12-stack-shell { box-shadow: inset 0 1px rgba(255,255,255,.05), inset 0 -50px 90px rgba(0,0,0,.1); }
html[data-theme="dark"] .home-v12-tool.is-coming-soon,
body.dark .home-v12-tool.is-coming-soon { background: color-mix(in srgb, #236b73 11%, var(--surface)); }
html[data-theme="dark"] .notes-v12-available-note,
body.dark .notes-v12-available-note { color: #77d1a1; }

@media (max-width: 1320px) {
  .home-library-subjects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-library-subject { grid-template-rows: auto minmax(80px,auto) 272px auto; }
  .notes-v12-subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes-v12-results { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .notes-v12-results.is-compact { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .notes-v12-browser-tools { grid-template-columns: minmax(260px, 1.4fr) repeat(2, minmax(130px, .7fr)) auto auto; }
  .notes-v12-browser-tools > button:first-of-type { grid-column: auto; }
}
@media (max-width: 1050px) {
  .home-v12-tools-pair { grid-template-columns: 1fr; }
  .home-v12-tool,
  .home-v12-python-row .home-v12-tool { grid-template-columns: minmax(250px,.9fr) minmax(0,1.1fr); }
  .notes-v12-stack-layout { grid-template-columns: 1fr; }
  .notes-v12-inspector { position: relative; top: auto; min-height: 0; display: grid; grid-template-columns: 112px minmax(0,1fr); column-gap: 1.25rem; }
  .notes-v12-inspector-status { grid-column: 1/-1; }
  .notes-v12-inspector-book { grid-column: 1; grid-row: 2/5; }
  .notes-v12-inspector-kicker,
  .notes-v12-inspector h3,
  .notes-v12-inspector > p:not(.notes-v12-inspector-kicker):not(.notes-v12-available-note) { grid-column: 2; }
  .notes-v12-inspector-metrics,
  .notes-v12-inspector-actions,
  .notes-v12-available-note { grid-column: 1/-1; }
  .notes-v12-browser-tools { grid-template-columns: 1fr 1fr 1fr; }
  .notes-v12-browser-tools label:first-of-type { grid-column: 1/-1; }
}
@media (max-width: 760px) {
  .home-library-subjects { grid-template-columns: 1fr; }
  .home-library-subject { grid-template-rows: auto minmax(74px,auto) 242px auto; }
  .home-library-stack { min-height: 242px; }
  .home-v12-tool,
  .home-v12-python-row .home-v12-tool { grid-template-columns: 1fr; }
  .home-v12-tool-media,
  .home-v12-python-row .home-v12-tool-media { min-height: 220px; }
  .notes-v12-guide > div { grid-template-columns: 1fr 1fr; }
  .notes-v12-intro,
  .notes-v12-workbench-head,
  .notes-v12-browser-head { align-items: flex-start; flex-direction: column; gap: .8rem; }
  .notes-v12-key-guide { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .notes-v12-subject-grid { grid-template-columns: 1fr; }
  .notes-v12-subject-card { min-height: 96px; }
  .notes-v12-stack-layout { padding: .65rem; }
  .notes-v12-stack-shell { min-height: 540px; padding: 47px 44px 63px 15px; }
  .notes-v12-volume-stack { height: 426px; padding-inline: 8px 24px; }
  .notes-v12-book { grid-template-columns: 47px minmax(0,1fr) auto; gap: .5rem; min-height: 45px; padding-left: .8rem; }
  .notes-v12-book > b { display: none; }
  .notes-v12-book:hover,
  .notes-v12-book:focus-visible,
  .notes-v12-book.is-active { transform: translateX(9px) translateY(-3px) scale(1.012); min-height: 58px; }
  .notes-v12-stack-caption span { display: none; }
  .notes-v12-inspector { display: block; }
  .notes-v12-inspector-book { margin-top: 1.6rem; }
  .notes-v12-browser-tools { grid-template-columns: 1fr 1fr; }
  .notes-v12-browser-tools nav,
  .notes-v12-browser-tools label:first-of-type { grid-column: 1/-1; }
  .notes-v12-results,
  .notes-v12-results.is-compact { grid-template-columns: 1fr; }
  .notes-v12-record,
  .notes-v12-results.is-compact .notes-v12-record { min-height: 0; }
}
@media (max-width: 480px) {
  .notes-v12-guide > div { grid-template-columns: 1fr; }
  .home-library-spine { grid-template-columns: 32px minmax(0,1fr); }
  .home-library-spine > small { display: none; }
  .home-library-key-hint { display: none; }
  .notes-v12-browser-tools { grid-template-columns: 1fr; }
  .notes-v12-browser-tools nav,
  .notes-v12-browser-tools label:first-of-type { grid-column: auto; }
  .notes-v12-stack-shell { min-height: 510px; }
  .notes-v12-volume-stack { height: 396px; }
  .notes-v12-book { width: 96% !important; grid-template-columns: 42px minmax(0,1fr); }
  .notes-v12-book > em { display: none; }
  .notes-v12-inspector-metrics { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .notes-v12-subject-card { grid-template-columns: 38px minmax(0,1fr) 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .home-library-spine,
  .notes-v12-book,
  .notes-v12-subject-card,
  .home-v12-tool-media img { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .home-v12-library-section,
  .home-v12-tools-section,
  .notes-v12-subjects,
  .notes-v12-stack-arrows,
  .notes-v12-browser-tools,
  .notes-v12-key-guide { break-inside: avoid; }
  .notes-v12-stack-shell { min-height: 0; }
  .notes-v12-volume-stack { height: auto; max-height: none; overflow: visible; }
  .notes-v12-book { break-inside: avoid; color: #111; background: white !important; border-color: #777; box-shadow: none; }
  .notes-v12-wood-shelf { display: none; }
  .notes-v12-results { display: block; background: white; }
  .notes-v12-record { break-inside: avoid; border-bottom: 1px solid #999; }
}

/* Progressive-loading state used before the controlled hierarchy is ready. */
.notes-v12-loading {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: .45rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--muted);
  text-align: center;
}
.notes-v12-loading > span {
  color: var(--red);
  font-size: 2rem;
  animation: notes-v12-loading-pulse 1.3s ease-in-out infinite alternate;
}
.notes-v12-loading > strong { color: var(--ink); font-family: var(--font-display); font-size: 1.12rem; }
.notes-v12-loading > p { margin: 0; }
@keyframes notes-v12-loading-pulse { from { opacity: .36; transform: translateY(2px); } to { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .notes-v12-loading > span { animation: none; } }
.notes-v12-empty[hidden],
#notes-v12-load-more[hidden] { display: none !important; }

/* v1.2 focus refinements: the selected book remains dominant while the rest of
   the pile stays visible as structural context. */
.home-library-stack:has(.home-library-spine.is-inspected) .home-library-spine:not(.is-inspected) {
  opacity: .72;
  filter: saturate(.72);
}
.home-library-spine.is-empty {
  color: rgba(255,255,255,.7);
  background: linear-gradient(90deg, rgba(0,0,0,.15), transparent, rgba(255,255,255,.07)), #777874;
  border-color: #5b5d5a;
  opacity: .42 !important;
  filter: grayscale(1) !important;
  cursor: not-allowed;
}
.notes-v12-volume-stack .notes-v12-book:not(.is-active):not(.is-empty) {
  opacity: .7;
  filter: saturate(.74);
}
.notes-v12-volume-stack .notes-v12-book:hover,
.notes-v12-volume-stack .notes-v12-book:focus-visible,
.notes-v12-volume-stack .notes-v12-book.is-active {
  opacity: 1;
  filter: saturate(1.08) brightness(1.03);
}
.home-latest-writing-grid {
  grid-template-columns: minmax(0, 1fr);
  max-width: 920px;
}
.home-latest-writing-grid .blog-card-link {
  grid-template-columns: minmax(230px, .65fr) minmax(0, 1.35fr);
}
@media (max-width: 720px) {
  .home-latest-writing-grid .blog-card-link { grid-template-columns: 1fr; }
}

/* ================================================================
   Version 1.2.1 — interaction and accessibility hardening
   ================================================================ */
.home-library-spine[aria-current="true"] {
  z-index: 96;
}
.home-library-spine[aria-current="true"]::after {
  content: "Selected";
  position: absolute;
  right: .55rem;
  top: -.7rem;
  padding: .18rem .38rem;
  border: 1px solid color-mix(in srgb, var(--pile-colour) 38%, var(--line));
  border-radius: 999px;
  background: var(--surface);
  color: var(--pile-dark);
  font: 800 .48rem/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 5px 12px rgba(20,22,21,.11);
}
.home-v12-tool[data-project-status="wip"] {
  position: relative;
  isolation: isolate;
}
.home-v12-tool[data-project-status="wip"]::after {
  content: "W.I.P.";
  position: absolute;
  top: .85rem;
  right: .85rem;
  z-index: 4;
  padding: .42rem .58rem;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  background: rgba(18,45,52,.86);
  color: #fff8df;
  font: 800 .58rem/1 var(--font-mono);
  letter-spacing: .12em;
  box-shadow: 0 8px 20px rgba(0,0,0,.2);
}
.home-v12-tool[data-project-status="wip"] .home-v12-status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.home-v12-tool[data-project-status="wip"] .home-v12-status::before {
  content: "";
  width: .48rem;
  height: .48rem;
  border-radius: 50%;
  background: #b88b32;
  box-shadow: 0 0 0 4px color-mix(in srgb, #b88b32 14%, transparent);
}
.notes-v12-volume-stack {
  outline: none;
  touch-action: pan-y;
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
}
.notes-v12-volume-stack:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--pile-colour) 46%, transparent);
  outline-offset: 5px;
}
.notes-v12-book {
  scroll-snap-align: center;
}
.notes-v12-book[tabindex="0"] {
  isolation: isolate;
}
.notes-v12-book.is-active::selection,
.home-library-spine.is-inspected::selection {
  background: rgba(255,255,255,.25);
}
.notes-v12-book.is-empty:disabled {
  pointer-events: none;
}
.notes-v12-workbench:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--pile-colour) 38%, transparent);
  outline-offset: 5px;
}
.notes-v12-key-guide {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.notes-v12-key-guide kbd {
  min-width: 1.55rem;
  text-align: center;
}
@media (max-width: 720px) {
  .home-library-spine[aria-current="true"]::after { display: none; }
  .notes-v12-stack-shell { padding-inline: 28px 38px; }
  .notes-v12-volume-stack { overflow-x: clip; }
  .notes-v12-key-guide { justify-content: flex-start; }
}
@media (max-width: 480px) {
  .notes-v12-stack-shell { padding-inline: 12px 22px; }
  .notes-v12-book { max-width: calc(100% - 12px); }
  .home-v12-tool[data-project-status="wip"]::after { top: .55rem; right: .55rem; }
}
@media (prefers-reduced-motion: reduce) {
  .home-library-spine,
  .notes-v12-book,
  .notes-v12-volume-stack {
    scroll-behavior: auto;
    transition-duration: .01ms !important;
  }
}

/* ========================================================================
   Version 1.2.4 — scroll-aware physical book stack
   The scroll viewport ends exactly at the wooden stand so the lowest book
   visually rests on the platform. Edge controls and pointer-edge panning
   reveal higher or lower volumes without moving the entire page.
   ======================================================================== */
.notes-v12-stack-shell {
  min-height: 680px;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--pile-colour) 4%, transparent), transparent 18%, transparent 82%, color-mix(in srgb, var(--pile-colour) 4%, transparent)),
    linear-gradient(155deg, color-mix(in srgb, var(--surface) 88%, transparent), color-mix(in srgb, var(--pile-colour) 4%, var(--surface)));
}
.notes-v12-stack-shell::before {
  content: "";
  position: absolute;
  inset: 54px 66px 58px 20px;
  border: 1px solid color-mix(in srgb, var(--pile-colour) 10%, transparent);
  background:
    radial-gradient(ellipse at 50% 96%, rgba(43, 29, 18, .13), transparent 42%),
    linear-gradient(180deg, color-mix(in srgb, var(--pile-colour) 2%, transparent), transparent 30%);
  pointer-events: none;
  z-index: 0;
}
.notes-v12-stack-caption {
  z-index: 75;
  left: 1.15rem;
  right: 5.2rem;
  top: 1rem;
}
.notes-v12-volume-stack {
  position: absolute;
  inset: 58px 78px 58px 26px;
  z-index: 12;
  height: auto;
  min-height: 0;
  padding: 86px 30px 0 12px;
  overflow-y: auto;
  overflow-x: clip;
  justify-content: flex-start;
  scroll-padding-block: 92px 68px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--pile-colour) 38%, transparent) transparent;
  -webkit-overflow-scrolling: touch;
}
.notes-v12-volume-stack::-webkit-scrollbar { width: 8px; }
.notes-v12-volume-stack::-webkit-scrollbar-track { background: transparent; }
.notes-v12-volume-stack::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pile-colour) 38%, transparent);
  background-clip: padding-box;
}
.notes-v12-volume-stack > .notes-v12-book:first-child { margin-top: auto; }
.notes-v12-volume-stack::before {
  left: 10%;
  right: 10%;
  bottom: 3px;
  height: 22px;
  z-index: -1;
}
.notes-v12-book {
  scroll-margin-block: 92px 70px;
  will-change: transform, opacity;
}
.notes-v12-book:hover,
.notes-v12-book:focus-visible,
.notes-v12-book.is-active {
  width: min(98%, 760px);
  transform: translateX(20px) translateY(-4px) rotate(0) scale(1.018);
}
.notes-v12-wood-shelf {
  left: 2.5%;
  right: 2.5%;
  bottom: 20px;
  height: 38px;
  z-index: 54;
  border: 1px solid #4c2d17;
  border-radius: 7px 7px 12px 12px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.08), transparent 18%, rgba(255,255,255,.09) 45%, transparent 73%),
    repeating-linear-gradient(8deg, transparent 0 31px, rgba(66,35,14,.10) 32px 34px),
    linear-gradient(180deg, #b88453 0 18%, #805129 20% 57%, #59351c 60% 100%);
  box-shadow: 0 18px 25px rgba(47,31,18,.31), inset 0 3px rgba(255,255,255,.18), inset 0 -4px rgba(45,25,12,.24);
}
.notes-v12-wood-shelf::before {
  left: 1.5%;
  right: 1.5%;
  top: 34px;
  height: 12px;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(180deg, #4c2c17, #342013);
  box-shadow: inset 0 2px rgba(255,255,255,.07);
}
.notes-v12-wood-shelf::after {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: -21px;
  height: 16px;
  border-radius: 50%;
  background: rgba(37, 23, 14, .24);
  filter: blur(8px);
}
.notes-v12-wood-shelf span {
  top: 17px;
  z-index: 3;
  width: 126px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid #76541f;
  border-radius: 3px;
  background: linear-gradient(180deg, #f1d48c, #b98b38);
  box-shadow: 0 4px 9px rgba(42,25,10,.28), inset 0 1px rgba(255,255,255,.35);
}
.notes-v12-wood-shelf span::after {
  content: "SHEEDY NOTES";
  color: #5c3c12;
  font: 800 .47rem/1 var(--font-mono);
  letter-spacing: .11em;
}
.notes-v12-wood-shelf > i {
  position: absolute;
  bottom: -18px;
  width: 14px;
  height: 20px;
  border: 1px solid #352012;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, #3f2615, #5b371e 48%, #352013);
  box-shadow: 0 4px 6px rgba(28,17,10,.2);
}
.notes-v12-wood-shelf > i:nth-of-type(1) { left: 9%; }
.notes-v12-wood-shelf > i:nth-of-type(2) { right: 9%; }
.notes-v12-stack-fade {
  position: absolute;
  left: 26px;
  right: 78px;
  height: 88px;
  z-index: 32;
  pointer-events: none;
  opacity: .82;
  transition: opacity .22s;
}
.notes-v12-stack-fade.is-top {
  top: 58px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface) 72%, transparent) 43%, transparent);
}
.notes-v12-stack-fade.is-bottom {
  bottom: 58px;
  background: linear-gradient(0deg, color-mix(in srgb, var(--surface) 88%, transparent), transparent);
  opacity: .42;
}
.notes-v12-stack-shell:not(.can-pan-later) .notes-v12-stack-fade.is-top,
.notes-v12-stack-shell:not(.can-pan-earlier) .notes-v12-stack-fade.is-bottom { opacity: 0; }
.notes-v12-edge-control {
  position: absolute;
  left: 50%;
  z-index: 72;
  min-width: 150px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .35rem .72rem;
  border: 1px solid color-mix(in srgb, var(--pile-colour) 28%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 89%, transparent);
  color: var(--pile-colour);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--ink) 10%, transparent);
  backdrop-filter: blur(10px);
  font: 750 .61rem/1 var(--font-body);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) scale(.94);
  transition: opacity .22s, transform .22s, background .22s;
}
.notes-v12-edge-control b { font-size: .92rem; }
.notes-v12-edge-control.is-later { top: 66px; }
.notes-v12-edge-control.is-earlier { bottom: 66px; }
.notes-v12-stack-shell.can-pan-later .notes-v12-edge-control.is-later,
.notes-v12-stack-shell.can-pan-earlier .notes-v12-edge-control.is-earlier {
  opacity: .92;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}
.notes-v12-edge-control:hover:not(:disabled),
.notes-v12-stack-shell.is-edge-panning-later .notes-v12-edge-control.is-later,
.notes-v12-stack-shell.is-edge-panning-earlier .notes-v12-edge-control.is-earlier {
  background: color-mix(in srgb, var(--pile-colour) 9%, var(--surface));
  transform: translateX(-50%) translateY(-1px) scale(1.02);
}
.notes-v12-edge-control:disabled { opacity: 0 !important; pointer-events: none !important; }
.notes-v12-stack-rail {
  position: absolute;
  right: 53px;
  top: 92px;
  bottom: 92px;
  z-index: 63;
  width: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pile-colour) 12%, var(--line));
  pointer-events: none;
}
.notes-v12-stack-rail span {
  --stack-progress: 1;
  --stack-viewport: .15;
  position: absolute;
  left: -3px;
  top: calc((100% - max(28px, calc(100% * var(--stack-viewport)))) * var(--stack-progress));
  width: 10px;
  height: max(28px, calc(100% * var(--stack-viewport)));
  border-radius: 999px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--pile-colour) 70%, white), var(--pile-colour));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--pile-colour) 28%, transparent);
  transition: top .12s linear, height .2s;
}
.notes-v12-stack-position {
  position: absolute;
  left: 50%;
  bottom: 23px;
  z-index: 67;
  min-width: 210px;
  max-width: calc(100% - 200px);
  display: grid;
  justify-items: center;
  gap: .12rem;
  transform: translateX(-50%);
  color: #4e3215;
  text-align: center;
  pointer-events: none;
}
.notes-v12-stack-position strong {
  font: 800 .62rem/1.1 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.notes-v12-stack-position small {
  max-width: 38ch;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: .5rem;
  opacity: .78;
}
.notes-v12-stack-arrows {
  right: 10px;
  z-index: 76;
  padding: .35rem;
  border: 1px solid color-mix(in srgb, var(--pile-colour) 16%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--ink) 9%, transparent);
  backdrop-filter: blur(10px);
}
.notes-v12-stack-arrows button { border-radius: 50%; }
.notes-v12-stack-shell.is-edge-panning-later .notes-v12-volume-stack,
.notes-v12-stack-shell.is-edge-panning-earlier .notes-v12-volume-stack {
  cursor: ns-resize;
  scroll-snap-type: none;
  scroll-behavior: auto;
}

/* Empty subject piles stay visibly grounded on the same physical platform. */
.notes-v12-empty-stack {
  min-height: 100%;
  margin-top: auto;
  padding-bottom: 3rem;
}
.home-library-stack.is-empty .home-library-empty { margin-bottom: 0; }
.home-library-stack.is-empty .home-library-shelf { opacity: .82; }

@media (max-width: 760px) {
  .notes-v12-stack-shell { min-height: 590px; padding: 0; }
  .notes-v12-stack-shell::before { inset: 50px 47px 54px 8px; }
  .notes-v12-volume-stack { inset: 52px 50px 54px 10px; height: auto; padding: 76px 12px 0 4px; }
  .notes-v12-stack-fade { left: 10px; right: 50px; }
  .notes-v12-stack-fade.is-top { top: 52px; }
  .notes-v12-stack-fade.is-bottom { bottom: 54px; }
  .notes-v12-wood-shelf { left: 1.5%; right: 1.5%; bottom: 18px; height: 36px; }
  .notes-v12-stack-rail { right: 34px; top: 85px; bottom: 86px; }
  .notes-v12-stack-arrows { right: 2px; }
  .notes-v12-edge-control { min-width: 118px; }
  .notes-v12-edge-control.is-later { top: 58px; }
  .notes-v12-edge-control.is-earlier { bottom: 61px; }
  .notes-v12-stack-position { bottom: 21px; min-width: 160px; max-width: calc(100% - 130px); }
  .notes-v12-stack-position small { display: none; }
  .notes-v12-book:hover,
  .notes-v12-book:focus-visible,
  .notes-v12-book.is-active { transform: translateX(7px) translateY(-3px) scale(1.01); }
}
@media (max-width: 480px) {
  .notes-v12-stack-shell { min-height: 550px; }
  .notes-v12-volume-stack { right: 42px; padding-top: 70px; }
  .notes-v12-stack-caption { right: 3.2rem; }
  .notes-v12-edge-control span { display: none; }
  .notes-v12-edge-control { min-width: 38px; width: 38px; height: 30px; padding: 0; }
  .notes-v12-stack-position { min-width: 142px; max-width: calc(100% - 110px); }
  .notes-v12-wood-shelf span { width: 104px; }
}
@media (hover: none), (pointer: coarse) {
  .notes-v12-edge-control { display: none; }
  .notes-v12-stack-fade { opacity: .24; }
}
@media (prefers-reduced-motion: reduce) {
  .notes-v12-edge-control,
  .notes-v12-stack-rail span { transition: none !important; }
}
@media print {
  .notes-v12-edge-control,
  .notes-v12-stack-fade,
  .notes-v12-stack-rail,
  .notes-v12-stack-position { display: none !important; }
  .notes-v12-volume-stack { position: static; inset: auto; padding: 0; overflow: visible; }
}

/* v1.2.4 final platform-label separation */
.notes-v12-stack-position {
  bottom: 64px;
  min-width: 190px;
  width: fit-content;
  max-width: calc(100% - 180px);
  padding: .36rem .68rem .32rem;
  border: 1px solid color-mix(in srgb, var(--pile-colour) 20%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 91%, transparent);
  color: var(--pile-colour);
  box-shadow: 0 7px 20px color-mix(in srgb, var(--ink) 9%, transparent);
  backdrop-filter: blur(10px);
}
.notes-v12-stack-position strong { color: var(--pile-colour); }
@media (max-width: 760px) {
  .notes-v12-stack-position { bottom: 60px; max-width: calc(100% - 110px); }
}

/* v1.2.4 final wooden-stand nameplate: position information belongs on the
   stand rather than covering the lowest book. */
.notes-v12-wood-shelf span { display: none; }
.notes-v12-stack-position {
  left: 50%;
  right: auto;
  top: auto;
  bottom: 27px;
  z-index: 70;
  min-width: 164px;
  width: fit-content;
  max-width: min(54%, 310px);
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .28rem .78rem .25rem;
  border: 1px solid #76541f;
  border-radius: 4px;
  background: linear-gradient(180deg, #f2d78f, #b98a36);
  color: #57370f;
  box-shadow: 0 5px 10px rgba(42,25,10,.30), inset 0 1px rgba(255,255,255,.42);
  transform: translateX(-50%);
  backdrop-filter: none;
}
.notes-v12-stack-position strong {
  color: #57370f;
  font-size: .55rem;
  line-height: 1;
  white-space: nowrap;
}
.notes-v12-stack-position small { display: none; }
@media (max-width: 760px) {
  .notes-v12-stack-position { bottom: 25px; min-width: 146px; max-width: 58%; }
}

/* v1.2.4 — explicit hierarchy and reliable stack input containment. */
.notes-v12-hierarchy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .32rem;
  margin: .58rem 0 0;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.45;
}
.notes-v12-hierarchy strong { color: var(--ink); }
.notes-v12-hierarchy span { color: var(--pile-colour, var(--accent)); font-weight: 800; }
.notes-v12-volume-stack {
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scroll-behavior: auto;
  -webkit-user-select: none;
  user-select: none;
}
.notes-v12-stack-shell:focus-within::before {
  border-color: color-mix(in srgb, var(--pile-colour) 28%, var(--line));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pile-colour) 7%, transparent);
}
.notes-v12-stack-shell.can-pan-later .notes-v12-stack-fade.is-top,
.notes-v12-stack-shell.can-pan-earlier .notes-v12-stack-fade.is-bottom { pointer-events: none; }
@media (max-width: 620px) {
  .notes-v12-hierarchy { font-size: .64rem; }
}
