/* /notebook/ (UX run-08): the reader's kept lines. A v2 page on the css/toys.css tokens with
   the lemon accent (the marker colour), Geist + Geist Mono, light and dark. Shared pieces (keys,
   sheets, the card maker) come from blog/keep.css. The header floats fixed; the body clears it. */
body.notebook {
  --t-display: "Geist", ui-sans-serif, system-ui, sans-serif;
  --nb-gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  padding-top: var(--header-h);
  font-family: var(--t-display);
  font-variation-settings: normal;
}
html:has(body.notebook) { scroll-padding-top: calc(var(--header-h) + 18px); }
body.notebook .t-wrap,
body.notebook .container-wide { width: min(100% - 2 * var(--nb-gutter), 1240px); }

.nb-main { padding-bottom: 48px; }

/* No layout shift (visual review, round 2): the head script sets html.nb-wait and notebook.js
   lifts it once the kept lines are drawn. Until then, everything under the masthead (and the
   footer) is laid out but not painted, so nothing visible moves when the lines arrive. If the
   script never runs, the animation shows it all anyway after 3 s. */
.nb-wait .nb-main > :not(.nb-mast),
.nb-wait .site-foot { visibility: hidden; animation: nb-failsafe 0s 3s forwards; }
@keyframes nb-failsafe { to { visibility: visible; } }

/* Masthead */
.nb-mast { padding: 36px 0 28px; }
.nb-kicker { margin: 0 0 14px; color: var(--t-ink-2); }
.nb-mast h1 {
  margin: 0; max-width: 12ch;
  font-size: 2.75rem; line-height: 0.92; font-weight: 800; letter-spacing: -0.02em; text-wrap: balance;
  animation: nb-rise 0.7s var(--t-spring) both;
}
.nb-lede { margin: 20px 0 0; max-width: 46ch; color: var(--t-ink-2); font-size: 1.125rem; line-height: 1.45; text-wrap: pretty; }
.nb-lede strong { color: var(--t-ink); font-weight: 600; }
@keyframes nb-rise { from { transform: translateY(18px); } }

/* Today's line: the lemon slab. */
.nb-today {
  position: relative;
  margin: 0 0 36px;
  padding: 26px 20px 24px;
  border-radius: 34px;
  background: var(--t-lemon);
  color: #141414;
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.14), 0 20px 40px -24px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  isolation: isolate;
}
.nb-today[hidden] { display: none; }
.nb-today::before {
  content: "\201C";
  position: absolute;
  right: 10px;
  bottom: -118px;
  z-index: -1;
  color: rgba(20, 20, 20, 0.12);
  font: 800 13rem/1 var(--t-display);
}
.nb-today-k { margin: 0 0 14px; font: 500 0.75rem/1.4 var(--t-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.nb-today-text { margin: 0; }
.nb-today-text p { margin: 0; max-width: 30ch; overflow-wrap: anywhere; font-size: 1.625rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.012em; text-wrap: pretty; }
.nb-today-meta { margin: 16px 0 0; max-width: 60ch; font-size: 0.9375rem; line-height: 1.45; }
.nb-today-keys { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.nb-today .keep-key-primary { background: #141414; color: #ffd23f !important; }
.nb-today .keep-key:not(.keep-key-primary) { background: rgba(255, 255, 255, 0.72); color: #141414 !important; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.1); }
.nb-today .keep-key:hover, .nb-today .keep-key:focus-visible { background: #fff; color: #141414 !important; }
body.v2 .nb-today :focus-visible { outline-color: #141414; }

/* The shelf */
.nb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 16px; }
.nb-list-title { margin: 0; color: var(--t-ink-2); font: 500 0.75rem/1.4 var(--t-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.nb-list-title:focus { outline: none; }
.nb-status { flex: 1 1 14rem; margin: 0; min-height: 1.4em; color: var(--t-ink-2); font-size: 0.9375rem; line-height: 1.4; }
.nb-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.nb-tools[hidden] { display: none; }
.nb-tools .is-armed { background: var(--t-ink); color: var(--t-surface) !important; box-shadow: none; }

.nb-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; align-items: start; }
.nb-notes[hidden] { display: none; }
.nb-note {
  padding: 20px 18px 16px;
  border-radius: var(--t-r-l);
  background: var(--t-card);
  box-shadow: var(--k-card-depth);
}
.nb-note-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.nb-note-meta { margin: 0; color: var(--t-ink-2); font: 500 0.75rem/1.4 var(--t-mono); letter-spacing: 0.04em; }
body.v2 .nb-note-title { align-self: start; color: var(--t-ink); font-size: 1.25rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; text-decoration: underline; text-decoration-thickness: 1.5px; text-decoration-color: var(--t-line); text-wrap: balance; }
body.v2 .nb-note-title:hover { text-decoration-color: currentColor; }
.nb-slips { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.nb-slip { padding: 12px 0 8px; box-shadow: inset 0 1.5px 0 var(--t-line); }
.nb-slip-text, .nb-starter-text { margin: 0; }
.nb-slip-text p, .nb-starter-text p {
  display: inline;
  margin: 0;
  padding: 0.08em 0.2em;
  background: var(--k-marker);
  color: var(--k-marker-ink);
  overflow-wrap: anywhere;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.65;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.nb-slip-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-top: 10px; }
.nb-slip-when { margin: 0; color: var(--t-ink-2); font: 500 0.75rem/1.4 var(--t-mono); letter-spacing: 0.04em; }
.nb-slip-keys { display: flex; flex-wrap: wrap; gap: 6px; }

/* Empty */
.nb-empty { padding: 24px 20px; border-radius: var(--t-r-l); background: var(--t-card); box-shadow: inset 0 0 0 2px var(--t-line); }
.nb-empty[hidden] { display: none; }
.nb-empty-title { margin: 0; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.015em; }
.nb-empty-text { margin: 8px 0 0; max-width: 52ch; color: var(--t-ink-2); line-height: 1.5; }
/* The starter line comes from a fetch after the first paint. Its box is drawn at once, empty, and
   keeps the room a starter line needs (up to 160 characters and a title of up to 60, measured at
   the narrowest width of each step below, plus a few px), so «Go to my notes» and «How keeping
   works» under it never move when the line arrives (visual review, round 2). */
.nb-starter {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 448px;
  margin: 18px 0 0; padding: 16px; border-radius: var(--t-r-m); background: var(--t-surface); box-shadow: inset 0 0 0 1.5px var(--t-line);
}
.nb-starter-line[hidden], .nb-starter-miss[hidden], .nb-starter-wait[hidden] { display: none; }
.nb-starter-miss, .nb-starter-wait { margin: 0; max-width: 52ch; color: var(--t-ink-2); line-height: 1.5; text-align: center; align-self: center; }
.nb-starter-meta { margin: 10px 0 0; color: var(--t-ink-2); font-size: 0.9375rem; line-height: 1.4; }
.nb-starter-keys { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.nb-empty-more { margin: 18px 0 0; }

/* How keeping works */
.nb-how { margin-top: 56px; }
.nb-how-title { margin: 0 0 16px; font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
.nb-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.nb-steps li { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; row-gap: 4px; padding: 18px; border-radius: var(--t-r-m); background: var(--t-surface-2); }
.nb-step-n { grid-row: span 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--t-lemon); color: #141414; font: 600 1rem/1 var(--t-mono); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.14); }
.nb-steps strong { font-size: 1.0625rem; line-height: 1.3; }
.nb-steps span:not(.nb-step-n) { color: var(--t-ink-2); font-size: 0.9375rem; line-height: 1.45; }
.nb-fine { margin: 18px 0 0; max-width: 70ch; color: var(--t-ink-2); font-size: 0.9375rem; line-height: 1.5; }

@media (min-width: 380px) { .nb-mast h1 { font-size: 3.25rem; } .nb-starter { min-height: 396px; } }
@media (min-width: 600px) {
  .nb-starter { min-height: 236px; }
  .nb-mast h1 { font-size: 4.5rem; }
  .nb-lede { font-size: 1.3125rem; }
  .nb-today { padding: 36px 36px 32px; }
  .nb-today-text p { font-size: 2.25rem; }
  .nb-note { padding: 24px 24px 18px; }
}
@media (min-width: 1000px) {
  .nb-starter { min-height: 184px; }
  .nb-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nb-notes > .nb-note:only-child { grid-column: 1 / -1; }
  .nb-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .nb-mast { padding-top: 56px; }
  .nb-mast h1 { font-size: 6rem; }
  .nb-today { padding: 44px 48px 40px; }
  .nb-today-text p { font-size: 2.75rem; }
  .nb-today::before { font-size: 20rem; top: -60px; right: 30px; bottom: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .nb-mast h1 { animation: none; }
}
