/* A small working desk inside the existing editorial grid. */
.notes-section {
  --desk-paper: #fff;
  --desk-paper-back: #efeeeb;
  --desk-rule: rgba(71, 65, 53, .09);
  --desk-pencil: #6b6358;
  --desk-title: #685e54;
  --desk-ink: var(--color-accent-human);
  --desk-slip: #eee8d8;
  --desk-shadow: rgba(35, 28, 18, .12);
  --desk-edge: polygon(.4% 1%, 6% .5%, 12% .9%, 19% .3%, 26% .7%, 32% .4%, 41% .8%, 48% .2%, 56% .7%, 64% .4%, 72% .8%, 81% .2%, 89% .6%, 95% .3%, 99.5% 1%, 99.1% 8%, 99.7% 16%, 99.3% 24%, 99.8% 34%, 99.2% 43%, 99.6% 53%, 99.1% 65%, 99.7% 76%, 99.3% 86%, 99.8% 97.5%, 96% 99%, 93% 98.4%, 89% 99.4%, 85% 98.7%, 80% 99.5%, 76% 98.8%, 71% 99.3%, 67% 98.5%, 62% 99.6%, 58% 98.9%, 53% 99.5%, 48% 98.7%, 43% 99.4%, 38% 98.5%, 34% 99.2%, 29% 98.6%, 24% 99.5%, 20% 98.8%, 15% 99.3%, 11% 98.5%, 6% 99.4%, .7% 98.6%, 1.1% 90%, .3% 82%, .8% 73%, .2% 64%, .7% 54%, .3% 44%, .9% 34%, .2% 23%, .8% 13%);
}
body[data-theme="dark"] .notes-section {
  --desk-paper: #2c2922;
  --desk-paper-back: #24221d;
  --desk-rule: rgba(237, 224, 202, .075);
  --desk-pencil: #b9b0a1;
  --desk-title: #c9beb0;
  --desk-slip: #3b352b;
  --desk-shadow: rgba(0, 0, 0, .28);
}
.notes-section .notes-map { gap: 1rem; margin-bottom: 0; }
.notes-section .notes-map span,
body[data-theme="dark"] .notes-section .notes-map span {
  border: 0; border-radius: 0; padding: .35rem 0;
  background: none; color: var(--muted); font-weight: 400;
}
.notes-section .notes-rail-wrap { padding-bottom: 3.5rem; }
.notes-section .notes-rail-wrap::after { width: 32px; bottom: 3.5rem; }
.notes-section .notes-grid {
  grid-auto-columns: clamp(320px, 35vw, 440px);
  gap: 1rem;
  padding: 40px 24px 48px 16px;
  margin-left: -16px;
  align-items: start;
  scroll-padding-inline: 16px;
}
.notes-section .note-card,
:where(body[data-theme="dark"]) .notes-section .note-card {
  --desk-angle: -1.8deg;
  --desk-offset: 4px;
  --desk-lift: 0px;
  display: grid;
  grid-template-rows: auto 152px 1fr auto;
  min-height: 380px;
  padding: 24px 28px 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  isolation: isolate;
  filter: drop-shadow(0 9px 7px var(--desk-shadow));
  transform: perspective(900px) translateY(calc(var(--desk-offset) + var(--desk-lift))) rotateX(var(--desk-rx, 0deg)) rotateY(var(--desk-ry, 0deg)) rotateZ(var(--desk-angle));
  transform-origin: 50% 55%;
  transition: transform 220ms var(--ease);
}
.notes-section .note-card::before,
.notes-section .note-card::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  pointer-events: none; clip-path: var(--desk-edge);
}
.notes-section .note-card::before {
  background-color: var(--desk-paper);
  background-image: url("./assets/paper-grain.svg"), linear-gradient(var(--desk-rule) 1px, transparent 1px), linear-gradient(90deg, var(--desk-rule) 1px, transparent 1px);
  background-size: 160px 160px, 20px 20px, 20px 20px;
}
.notes-section .note-card::after {
  z-index: -2; background: var(--desk-paper-back);
  transform: translate(4px, 5px) rotate(.8deg);
}
.notes-section .note-card:nth-child(3n + 2) { --desk-angle: 2.1deg; --desk-offset: 24px; }
.notes-section .note-card:nth-child(3n) { --desk-angle: -1deg; --desk-offset: 0px; }
.notes-section .note-card:nth-child(3n + 2)::before {
  background-image: url("./assets/paper-grain.svg"), repeating-linear-gradient(transparent 0 23px, var(--desk-rule) 23px 24px);
  background-size: 160px 160px, auto;
}
.notes-section .note-card:nth-child(3n)::before { background-size: 160px 160px, 16px 16px, 16px 16px; }
.notes-section .note-card:hover,
.notes-section .note-card:focus-visible,
body[data-theme="dark"] .notes-section .note-card:hover,
body[data-theme="dark"] .notes-section .note-card:focus-visible {
  --desk-lift: -10px; z-index: 2; background: transparent;
}
.notes-section .note-card:focus-visible { outline: var(--focus-ring); outline-offset: 8px; }
.notes-section .note-card-index {
  display: grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid var(--line); border-radius: 48% 53% 45% 51%;
  font-family: var(--font-heading); font-size: .75rem;
}
.notes-section .note-card-head { gap: 1rem; }
.notes-section .note-card-theme { font-weight: 400; font-size: .7rem; }
.notes-section .note-card-body { align-self: start; padding: 0; }
.notes-section .note-card h3 { font-size: 26px; font-weight: 600; color: var(--desk-title); line-height: 1.35; margin: 0 0 16px; }
.notes-section .note-card-tags { gap: 4px 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.notes-section .note-card-tags span,
body[data-theme="dark"] .notes-section .note-card-tags span {
  padding: 0; border-radius: 0; background: transparent;
  color: var(--muted); font-size: .7rem; font-weight: 400; letter-spacing: .02em;
}
.note-desk-tape {
  position: absolute; z-index: 3; top: -10px; left: 36%;
  width: 88px; height: 27px; transform: rotate(-6deg);
  background: repeating-linear-gradient(92deg, rgba(255,255,255,.08) 0 2px, transparent 2px 5px), rgba(163,150,120,.2);
  clip-path: polygon(2% 0, 99% 3%, 97% 16%, 100% 28%, 97% 42%, 100% 56%, 98% 70%, 100% 89%, 97% 100%, 1% 96%, 3% 80%, 0 63%, 3% 45%, 0 27%);
  pointer-events: none;
}
.note-card:nth-child(3n + 2) .note-desk-tape { left: auto; right: 14px; width: 65px; transform: rotate(22deg); }
.note-card:nth-child(3n) .note-desk-tape { left: 18px; transform: rotate(-18deg); }
.note-desk-art { position: relative; align-self: center; padding-bottom: 10px; pointer-events: none; }
.note-desk-sketch { display: block; width: 100%; height: 118px; overflow: visible; transform: rotate(-2deg); }
.note-desk-sketch path { fill: none; stroke: var(--desk-pencil); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.note-desk-sketch .desk-ink { stroke: var(--desk-ink); stroke-width: 1.8; }
.note-margin-mark {
  position: absolute; right: -10px; bottom: 1px;
  padding: 6px 12px; color: var(--desk-ink); background: var(--desk-slip);
  font-size: .75rem; font-style: italic; line-height: 1.5; transform: rotate(-4deg);
  box-shadow: 1px 3px 3px rgba(0,0,0,.035);
  clip-path: polygon(1% 4%, 98% 0, 100% 93%, 69% 98%, 42% 94%, 0 100%);
}
.note-card:nth-child(2n) .note-margin-mark { transform: rotate(3deg); right: 12px; bottom: 0; }
.notes-section .notes-rail-button { width: var(--size-touch); height: var(--size-touch); }
@media(max-width:600px) {
  .notes-section .notes-grid { grid-auto-columns: minmax(280px, 82vw); gap: 12px; padding-top: 28px; }
  .notes-section .note-card { min-height: 370px; padding-inline: 24px; }
  .notes-section .note-card h3 { font-size: 1.5rem; }
  .notes-section .note-card:nth-child(3n + 2) { --desk-offset: 16px; }
}
@media(prefers-reduced-motion:reduce) {
  .notes-section .notes-grid { scroll-behavior: auto; }
  .notes-section .note-card { transition: none; }
  .notes-section .note-card:hover, .notes-section .note-card:focus-visible,
  body[data-theme="dark"] .notes-section .note-card:hover,
  body[data-theme="dark"] .notes-section .note-card:focus-visible { --desk-lift: 0px; }
}

/* Paper sizes and torn silhouettes vary independently of appearance mode. */
.notes-section .notes-grid {grid-auto-columns:auto;grid-template-columns:none}
.notes-section .note-card {width:clamp(310px,33vw,420px);box-sizing:border-box;min-height:400px;padding-bottom:38px}
.notes-section .note-card:nth-child(4n + 2) {
 width:clamp(300px,30vw,390px);min-height:450px;grid-template-rows:auto 136px 1fr auto;padding:30px 30px 48px 24px;
 --desk-edge:polygon(1% 0,99% 1%,98.7% 15%,100% 31%,98.6% 49%,99.5% 66%,98% 82%,99% 96%,94% 97%,89% 96.6%,82% 98%,76% 97.2%,68% 98.7%,60% 98%,53% 99.2%,46% 98.5%,38% 100%,30% 99%,22% 99.7%,15% 98.8%,8% 99.5%,0 98%,1.2% 79%,.3% 60%,1% 42%,0 23%);
}
.notes-section .note-card:nth-child(4n + 3) {
 width:clamp(320px,35vw,450px);min-height:375px;grid-template-rows:auto 124px 1fr auto;padding:22px 34px 32px 30px;
 --desk-edge:polygon(0 1%,99% 0,99.5% 19%,98.5% 38%,100% 57%,99% 78%,98.8% 99%,91% 98%,85% 98.8%,78% 97.5%,72% 98.4%,65% 97%,58% 97.8%,51% 96.5%,44% 97.5%,37% 96%,29% 97%,22% 95.8%,15% 96.5%,8% 95.2%,1% 96%,.3% 75%,1.2% 56%,.2% 36%,1% 18%);
}
.notes-section .note-card:nth-child(4n) {width:clamp(300px,31vw,400px);min-height:425px;padding:34px 24px 44px 34px;grid-template-rows:auto 144px 1fr auto;--desk-angle:1.3deg;--desk-offset:18px}
@media(max-width:600px) {
 .notes-section .note-card:nth-child(n) {width:82vw;min-width:280px;max-width:360px;padding-inline:26px}
}
