/* A long-form reading page in the Notebook theme: the Marketing Page's materials (loose-leaf and chalkboard, tape, cream notes,
   framed controls, the orange marker) with the words resting on the paper's ruled lines. Colours and faces come from
   tokens.css; light is loose-leaf, dark is the chalkboard, and the two change roles only, never a box. */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body { color: var(--ink); font-family: var(--hand); -webkit-font-smoothing: antialiased; overflow-x: hidden; background-color: var(--paper); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
img { display: block; }
:root { --ring: var(--focus); }
:focus-visible { outline: 2.5px solid var(--ring); outline-offset: 4px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.9em; letter-spacing: -0.01em; line-height: 0; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 20; padding: 12px 18px; background: var(--slab) url("assets/art/card-stock-light.webp") center / cover; color: var(--on-slab); font-family: var(--press); font-weight: 800; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- the ground ----------
   Light: one loose-leaf sheet the page long: the plate's head (worn top edge, first rules, first hole) at the top and a band
   of twenty rules repeating below it. page.js sets --plate-w, --tile-y and --pitch so the rules and the words agree.
   Dark: the chalkboard stays still behind the page and carries no rules. */
:root { --gutter: clamp(76px, 6vw, 110px); --pitch: 36px; --fs: 20px; }
body { background-image: url("assets/art/paper-wide-cap.webp"), url("assets/art/paper-wide-tile.webp"); background-size: var(--plate-w, 100%) auto, var(--plate-w, 100%) auto; background-repeat: no-repeat, repeat-y; background-position: 0 0, 0 var(--tile-y, 172px); }
:root[data-plate="phone"] body { background-image: url("assets/art/paper-real-cap.webp"), url("assets/art/paper-real-tile.webp"); }
.ground { position: fixed; inset: -160px 0; z-index: -1; display: none; background: var(--paper) url("assets/art/chalk-wide.webp") left top / cover no-repeat; }
:root[data-theme="dark"] body { background-image: none; }
:root[data-theme="dark"] .ground { display: block; }
.ground span { display: none; }
.page { padding-left: var(--gutter); padding-right: var(--gutter); overflow-x: clip; }

/* ---------- top: the switches on the left; Feedback & ideas and Log in on the right ---------- */
.top { position: relative; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; row-gap: 10px; min-height: 76px; padding: 14px var(--gutter) 0; }
.toggles { display: flex; gap: 22px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 46px; font-family: var(--press); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pencil); white-space: nowrap; }
.toggle:first-child { gap: 22px; }
.toggle__box { width: 40px; height: 22px; overflow: visible; }
.toggle__frame { fill: none; stroke: var(--pencil); stroke-width: 1.6; stroke-linecap: round; }
.toggle__dot { fill: var(--pencil); transition: transform 0.2s ease; }
.toggle[aria-checked="true"] .toggle__frame { stroke: var(--ink); }
.toggle[aria-checked="true"] .toggle__dot { fill: var(--ink); transform: translateX(18px); }
.toggle[aria-checked="true"] .toggle__word { color: var(--ink); }
.toggle__word > span { display: inline-block; min-width: 3.2ch; }
.ink-path { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.slab { position: relative; display: inline-flex; align-items: center; min-height: 48px; padding: 0 20px; background: var(--slab) url("assets/art/card-stock-light.webp") center / cover; color: var(--on-slab); text-decoration: none; box-shadow: var(--sh-card); }
:root[data-theme="dark"] .slab { background-image: url("assets/art/card-stock-dark.webp"); }
.slab-frame { position: absolute; left: 3px; top: 3px; width: calc(100% - 6px); height: calc(100% - 6px); pointer-events: none; color: var(--on-slab); opacity: 0.8; }
.slab-frame .ink-path { stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.slab span { position: relative; font-family: var(--press); font-weight: 800; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; }
.slab:hover span, .slab:focus-visible span { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.feedback { margin-left: auto; margin-right: 14px; transform: rotate(-1deg); }
.top__right { display: flex; align-items: center; margin-left: auto; }
.top__right .feedback { margin-left: 0; }

/* The marker: the token orange cut to a real marker swath. Still on these pages: nothing here hops. */
.marker { position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 26px; font-family: var(--press); font-weight: 900; font-size: 15px; line-height: 1.1; letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; color: var(--on-marker); transform: rotate(-1deg); transition: transform 0.18s ease; }
.marker__ink { position: absolute; inset: 0; z-index: -1; background: var(--marker); -webkit-mask: url("assets/art/marker-mask.webp") center / 100% 100% no-repeat; mask: url("assets/art/marker-mask.webp") center / 100% 100% no-repeat; filter: drop-shadow(0 3px 0 color-mix(in srgb, var(--marker) 50%, #000)); }
.marker__label { position: relative; white-space: nowrap; }
.marker:hover, .marker:focus-visible { transform: translateY(-2px) rotate(-1deg); }
.marker:active { transform: rotate(-1deg) scale(0.97); }
.login { min-width: 118px; }

/* ---------- materials: the mark, tape, cream notes ---------- */
.sticker { position: relative; display: block; width: 280px; aspect-ratio: 1.568; margin: 0 0 14px -10px; transform: rotate(-3deg); }
.sticker img { position: absolute; width: 118.3%; max-width: none; left: -9.47%; top: -50.8%; filter: drop-shadow(3px 0 0 #fff) drop-shadow(-3px 0 0 #fff) drop-shadow(0 3px 0 #fff) drop-shadow(0 -3px 0 #fff) drop-shadow(var(--sh-vinyl)); }
.tape { position: absolute; top: 0; left: 40%; width: 96px; height: auto; aspect-ratio: 512 / 50; transform: translateY(-50%) rotate(-3deg); opacity: 0.92; pointer-events: none; z-index: 2; }
.note { --ring: var(--on-card); position: relative; isolation: isolate; padding: 40px 30px 30px; color: var(--on-card); }
.note::before { content: ""; position: absolute; inset: 0; z-index: -1; border-style: solid; border-width: 34px 8px 6px 8px; border-image: url("assets/art/note-flat.webp") 90 20 12 20 fill / 34px 8px 6px 8px stretch round; filter: drop-shadow(0 1px 1px rgba(var(--sh-rgb), 0.34)) drop-shadow(0 10px 18px rgba(var(--sh-rgb), 0.3)); }
.note p { margin: 12px 0 0; font-family: var(--hand); font-size: 17.5px; line-height: 1.45; }
.note a { text-decoration-thickness: 1.5px; text-underline-offset: 3px; }


/* ---------- cover ---------- */
.cover { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); column-gap: 48px; align-items: center; padding-top: 28px; }
.cover__words { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.cover__title { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(44px, 6.4vw, 100px); line-height: 0.94; letter-spacing: 0.01em; text-transform: uppercase; text-wrap: balance; overflow-wrap: break-word; max-width: 100%; }
.notice { width: min(100%, 560px); margin-top: 30px; transform: rotate(-0.8deg); }
.notice .tape { left: 52%; }
.dates { margin: 24px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-family: var(--hand); font-weight: 700; font-size: 18px; color: var(--ink); }
.dates__k { font-family: var(--press); font-weight: 800; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--pencil); }
.cover__art { position: relative; width: 100%; max-width: 660px; justify-self: end; aspect-ratio: 1 / 0.9; }
.cover__art img { position: absolute; max-width: none; height: auto; filter: drop-shadow(0 8px 6px rgba(var(--sh-rgb), 0.24)); }

/* ---------- the reading area: the contents beside the sheet ---------- */
.read { display: grid; grid-template-columns: 300px minmax(0, 1fr); column-gap: 56px; align-items: start; margin-top: 72px; }
.toc { position: sticky; top: 20px; align-self: start; max-height: calc(100vh - 40px); overflow: auto; overscroll-behavior: contain; padding: 6px 4px 10px 0; z-index: 4; scrollbar-width: thin; }
.toc__h { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 12px; font-family: var(--press); font-weight: 800; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink); }
.toc__prog { font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--ink); line-height: 1; }
.toc__btn { display: none; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc__panel { position: relative; padding-left: 14px; }
/* A hand-drawn spine runs down the contents; a heavier stroke over it fills as you read. */
.toc__spine, .toc__fill { position: absolute; left: 0; top: 4px; bottom: 4px; width: 8px; pointer-events: none; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 1000' preserveAspectRatio='none'%3E%3Cpath d='M5 2C2.4 140 7.4 300 4.2 480S2.2 790 6.2 998' fill='none' stroke='%23000' stroke-width='2.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 1000' preserveAspectRatio='none'%3E%3Cpath d='M5 2C2.4 140 7.4 300 4.2 480S2.2 790 6.2 998' fill='none' stroke='%23000' stroke-width='2.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.toc__spine { background: var(--pencil); opacity: 0.55; }
.toc__fill { background: var(--ink); transform-origin: 50% 0; transform: scaleY(var(--prog, 0)); transition: transform 0.25s ease-out; }
.toc a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 10px 6px 6px; text-decoration: none; color: var(--ink); font-family: var(--hand); font-weight: 700; font-size: 16.5px; line-height: 1.2; transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
.toc a .num { flex: none; width: 2.2ch; font-size: 13px; font-weight: 600; color: var(--pencil); }
.toc a:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.toc a[aria-current="location"] { --ring: var(--on-card); color: var(--on-card); transform: translateX(12px); background: var(--card) url("assets/art/card-stock-light.webp") center / cover; box-shadow: var(--sh-card); text-decoration: none; }
.toc a[aria-current="location"] .num { color: var(--on-card); }

/* ---------- the sheet: every line of words rests on a rule ----------
   line-height is exactly one rule, and every block is a whole number of rules tall, so one measured offset (--phase) puts
   the whole sheet on its lines. Headings are display type that sits on the same lines. */
.doc { --lead: calc(var(--pitch) * 2); position: relative; top: var(--phase, 0px); width: 100%; max-width: 35em; margin-inline: auto; font-size: var(--fs); line-height: var(--pitch); color: var(--ink); }
.doc p, .doc li { font-family: var(--hand); font-size: 1em; line-height: var(--pitch); margin: 0; overflow-wrap: break-word; hyphens: manual; }
.doc p { margin-bottom: var(--pitch); }
.doc a { text-decoration-thickness: 1.5px; text-underline-offset: 0.18em; }
.doc a:hover { text-decoration-thickness: 3px; }
.sec { margin: 0 0 var(--lead); }
.sec__h { position: relative; top: var(--hshift, 0px); margin: 0; font-family: var(--display); font-weight: 400; font-size: calc(var(--pitch) * 0.98); line-height: var(--pitch); letter-spacing: 0.01em; text-transform: uppercase; text-wrap: balance; scroll-margin-top: 28px; }
.sec__h:focus { outline: none; }
.sec__h:focus-visible { outline: 2.5px solid var(--ring); outline-offset: 6px; }
.sec__n { position: relative; top: -0.3em; margin-right: 0.55em; font-size: 0.42em; font-weight: 600; letter-spacing: 0.04em; color: var(--pencil); }
.doc ul.items { list-style: none; margin: 0 0 var(--pitch); padding: 0; }
.doc ul.items li { position: relative; padding-left: 1.5em; }
.doc ul.items li::before { content: ""; position: absolute; left: 0.2em; top: calc(var(--pitch) * 0.5 - 1px); width: 0.8em; height: 2px; background: var(--ink); transform: rotate(-3deg); }


/* ---------- pop-ins: art and cards only, once, as they scroll in. Nothing loops. ---------- */
.js .pop { opacity: 0; translate: 0 18px; scale: 0.86; }
.js .pop.in { animation: pop-in 0.62s cubic-bezier(0.3, 1.5, 0.5, 1) var(--d, 0s) both; }
@keyframes pop-in {
  0% { opacity: 0; translate: 0 18px; scale: 0.86 0.8; }
  55% { opacity: 1; translate: 0 -6px; scale: 1.05 0.95; }
  78% { translate: 0 1px; scale: 0.98 1.02; }
  100% { opacity: 1; translate: 0 0; scale: 1; }
}

/* ---------- the footer: the live site's four groups on a torn sheet ---------- */
.foot { position: relative; isolation: isolate; margin-top: 72px; padding: 96px 0 40px; }
.foot::before { content: ""; position: absolute; z-index: -1; inset: 0; border-image: url("assets/art/foot-sheet.webp") 110 0 0 0 fill / 70px 0 0 0 stretch; filter: drop-shadow(0 -1px 3px rgba(var(--sh-rgb), 0.16)); }
:root[data-theme="dark"] .foot::before { display: none; }
.foot__in { padding-left: var(--gutter); padding-right: var(--gutter); }
.foot__cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 2fr); gap: 34px 30px; }
.foot__h { margin: 0 0 14px; font-family: var(--press); font-size: 11px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink); }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot__col--social ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
.foot a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; font-family: var(--hand); font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--ink); text-decoration: none; transition: transform 0.18s ease; }
.foot a:hover, .foot a:focus-visible { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; transform: translateX(3px); }
.foot__langs, .foot__end { position: relative; margin-top: 38px; padding-top: 30px; }
.foot__langs::before, .foot__end::before { content: ""; position: absolute; left: 0; right: 0; top: -4px; height: 10px; background: var(--pencil); opacity: 0.55; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 10' preserveAspectRatio='none'%3E%3Cpath d='M2 5.6C90 3 190 8.2 330 4.4S560 2.4 700 6.6S900 3.2 998 5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 10' preserveAspectRatio='none'%3E%3Cpath d='M2 5.6C90 3 190 8.2 330 4.4S560 2.4 700 6.6S900 3.2 998 5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
:root[data-theme="dark"] .foot__langs::before, :root[data-theme="dark"] .foot__end::before { opacity: 0.85; }
.foot__lang-row { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-bottom: 14px; }
.foot__lang-row li { font-family: var(--hand); font-size: 16px; font-weight: 700; color: var(--ink); }
.foot__lang-row li[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.foot__end { display: flex; align-items: center; gap: 26px; }
.foot__line { margin: 0; font-family: var(--hand); font-size: 16px; font-weight: 700; color: var(--ink); }
.foot__line .num { font-family: inherit; font-size: 1em; }

/* ---------- a phone ---------- */
@media (max-width: 899px) {
  .cover { grid-template-columns: minmax(0, 1fr); row-gap: 28px; }
  .cover__art { justify-self: center; max-width: 520px; }
  .read { grid-template-columns: minmax(0, 1fr); margin-top: 48px; }
  .toc { position: sticky; top: 0; max-height: none; overflow: visible; padding: 0; margin: 0 calc(var(--gutter) * -1); padding-inline: var(--gutter); z-index: 6; }
  .toc__h { display: none; }
  .toc__btn { --ring: var(--on-card); display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 6px 14px; background: var(--card) url("assets/art/card-stock-light.webp") center / cover; color: var(--on-card); box-shadow: var(--sh-card); font-family: var(--hand); font-weight: 700; font-size: 16px; text-align: left; border: 2px solid var(--on-card); }
  .toc__btn .toc__word { font-family: var(--press); font-weight: 900; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; }
  .toc__btn .toc__title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .toc__chev { width: 16px; height: 16px; flex: none; transition: transform 0.2s; }
  .toc__chev path { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
  .toc.open .toc__chev { transform: rotate(180deg); }
  .toc__panel { display: none; position: absolute; left: var(--gutter); right: var(--gutter); top: calc(100% + 4px); max-height: min(70vh, 560px); overflow: auto; padding: 12px 10px 12px 22px; background: var(--card) url("assets/art/card-stock-light.webp") center / cover; color: var(--on-card); box-shadow: 0 14px 24px rgba(var(--sh-rgb), 0.3); border: 2px solid var(--on-card); --ring: var(--on-card); }
  .toc.open .toc__panel { display: block; }
  .toc__panel   .toc__panel a { color: var(--on-card); }
  .toc__panel a .num { color: var(--on-card-dim); }
  .toc__panel a[aria-current="location"] { transform: none; background: rgba(20, 16, 38, 0.1); box-shadow: inset 4px 0 0 var(--on-card); text-decoration: none; }
  .toc__spine { background: var(--on-card); left: 8px; } .toc__fill { background: var(--on-card); left: 8px; }
  .toc__panel { padding-left: 24px; }
  .sec__h { scroll-margin-top: 72px; }
  .foot__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 18px; }
  .foot__col--social { grid-column: 1 / -1; }
  .foot__end { flex-direction: column; align-items: flex-start; gap: 14px; }
}
@media (min-width: 900px) and (max-width: 1099px) {
  .read { grid-template-columns: 250px minmax(0, 1fr); column-gap: 36px; }
  .toc a { font-size: 15.5px; }
}
@media (max-width: 700px) {
  :root { --gutter: 22px; }
  .toc__btn .toc__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .page, .foot__in { padding-left: 38px; padding-right: 18px; }
  .top { padding: 8px 18px 0 14px; min-height: 60px; column-gap: 8px; flex-wrap: nowrap; }
  .toggles { flex-direction: column; align-items: flex-start; gap: 0; }
  .toggle { font-size: 10.5px; gap: 7px; }
  .toggle:first-child { gap: 18px; }
  .toggle__box { width: 34px; height: 19px; }
  .toggle[aria-checked="true"] .toggle__dot { transform: translateX(15px); }
  .slab { padding: 0 12px; }
  .slab span { font-size: 11.5px; letter-spacing: 0.06em; }
  .feedback { margin-right: 8px; }
  .login { min-width: 0; padding: 0 16px; font-size: 12px; }
  .toc { margin: 0 -18px 0 -38px; padding-inline: 38px 18px; }
  .toc__panel { left: 38px; right: 18px; }
  .sticker { width: 210px; }
  .cover__title { font-size: clamp(40px, 13vw, 64px); }
  .notice { margin-top: 24px; padding: 38px 22px 24px; }
  .note p { font-size: 16.5px; }
  .foot { padding-top: 76px; margin-top: 48px; }
}

/* ---------- print: the text, black on white, black on white ---------- */
@media print {
  :root, :root[data-theme="dark"] { --paper: #fff; --ink: #000; --pencil: #444; --on-card: #000; --card: #fff; }
  body { background: #fff !important; color: #000; }
  .ground, .top, .toc, .cover__art, .foot, .skip, .tape, .sticker, .marker, .tagboard__bar { display: none !important; }
  .page { padding: 0; }
  .cover { display: block; padding: 0; }
  .cover__title { font-size: 28pt; color: #000; }
  .notice { transform: none; width: auto; border: 1.5pt solid #000; padding: 10pt; margin-top: 10pt; }
  .notice::before { display: none; }
  .read { display: block; margin-top: 14pt; }
  .doc { top: 0 !important; max-width: none; font-size: 11pt; line-height: 1.5; color: #000; }
  .doc p, .doc li { line-height: 1.5; margin-bottom: 6pt; }
  .sec { margin-bottom: 14pt; }
  .sec__h { top: 0 !important; font-size: 15pt; line-height: 1.25; break-after: avoid; color: #000; }
  .snap { padding-bottom: 0 !important; }
  .doc a { color: #000; }
  .pop { opacity: 1 !important; translate: none !important; scale: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .pop { opacity: 1 !important; translate: none !important; scale: none !important; }
}

/* ================= Terms: the tab index ================= */
/* Cover art: the clipboard lies on the desk; Min-jun stands to read the sheet. */
.cover__art .art-clip { left: 0; bottom: 4%; width: 58%; transform: rotate(-5deg); z-index: 1; }
.cover__art .art-person { right: 2%; bottom: 0; height: 98%; width: auto; z-index: 3; }
.cover__art .tape { z-index: 4; }
/* The contents are binder tabs: the page you are on slides out as a card, and the pencil spine fills. */
.toc--tabs .toc__panel li + li { margin-top: 2px; }
.toc--tabs a { border-left: 0; }

