/* The office register.
   The page is a cloth-bound Indian office register: a crimson cover with a foil-stamped name and a
   hand-filled label, then ruled pages written in blue ink with a red double margin line.
   - One moment of motion: the cover's saffron stitch draws once on load.
   - Structure means something: totals get a double underline (accounting convention), the stamp
     appears only where an audit really happened, dot leaders only in the index.
   - Body text sits on a 30px ruled grid; spacing is kept in multiples of --lh so text stays on the lines.
   Dark mode is the register read under a desk lamp: warm dark brown paper with cream ink. */
:root {
  --paper: #F6F7F2;
  --ink: #1F3A93;
  --ink-soft: #4B5D9E;
  --rule: #C9D3EC;
  --rule-strong: #8FA2D4;
  --red: #C81E35;
  --cloth: #6E0F1F;
  --cloth-deep: #560A17;
  --foil: #E9C978;
  --thread: #F2B233;
  --stamp: #5B3FA0;
  --label: #FBFBF6;
  --lh: 30px;
  --serif: "Martel", Georgia, serif;
  --sans: "Martel Sans", "Segoe UI", system-ui, sans-serif;
  --hand: "Kalam", "Segoe Print", cursive;
  --mono: "Courier Prime", "Courier New", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1C1814; --ink: #EDE4D3; --ink-soft: #B9AC95; --rule: #2F2820; --rule-strong: #4A3F32;
    --red: #E8606D; --cloth: #5A0C19; --cloth-deep: #430812; --stamp: #C9B4FF; --label: #26201A; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1C1814; --ink: #EDE4D3; --ink-soft: #B9AC95; --rule: #2F2820; --rule-strong: #4A3F32;
  --red: #E8606D; --cloth: #5A0C19; --cloth-deep: #430812; --stamp: #C9B4FF; --label: #26201A; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/var(--lh) var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dl, dd, figure, table { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: var(--ink); text-decoration-color: var(--rule-strong); text-underline-offset: 4px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--ink); color: var(--paper); }
/* Copy deterrent: text can't be selected, except the email address and form fields. */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.mail, input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
img { -webkit-user-drag: none; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 30; background: var(--red); color: #fff; padding: 8px 14px; font-weight: 700; }
.skip:focus { top: 12px; }

/* ---------- Nav: the register's cloth binding ----------
   A crimson cloth strip with foil links that runs straight into the cover. A saffron silk bookmark
   ribbon hangs under the section being read and moves as you scroll (it marks your place, as in a
   real register). On phones the links fold into a "Contents" page. */
nav.top {
  position: sticky; top: 0; z-index: 20; color: var(--foil);
  background-color: var(--cloth);
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.10) 0 1px, transparent 1px 4px), repeating-linear-gradient(-45deg, rgba(255,255,255,.03) 0 1px, transparent 1px 4px);
  box-shadow: inset 0 -3px 0 var(--cloth-deep), 0 2px 8px rgba(40, 5, 12, .18);
}
.top-in { position: relative; max-width: 1160px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font: 800 18px/1 var(--serif); color: var(--foil); text-decoration: none; letter-spacing: -.01em; }
/* The PS logo, on its own paper tile so the ink and margin read on cloth */
.mark { width: 34px; height: 34px; flex: none; background: #F6F7F2; border-radius: 6px; box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.mark .mk-rule { stroke: #C9D3EC; stroke-width: 1.6; }
.mark .mk-margin { stroke: #C81E35; stroke-width: 3.4; }
.mark .mk-ink { fill: none; stroke: #1F3A93; stroke-width: 5.2; stroke-linecap: round; stroke-linejoin: round; }
nav.top ul { list-style: none; padding: 0; display: flex; gap: 24px; margin-left: auto; font-size: 15px; }
nav.top ul a { position: relative; display: block; line-height: 60px; color: var(--foil); opacity: .78; text-decoration: none; transition: opacity .15s; }
nav.top ul a:hover, nav.top ul a[aria-current="true"] { opacity: 1; }
nav.top ul a[aria-current="true"] { font-weight: 700; }
nav.top a:focus-visible, nav.top button:focus-visible { outline-color: var(--foil); }
.tools { display: flex; align-items: center; gap: 10px; }
.theme { width: 32px; height: 32px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--foil) 60%, transparent); background: transparent; color: var(--foil); cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }
.theme:hover { border-color: var(--foil); }
.nav-cv { font-weight: 700; font-size: 15px; text-decoration: none; color: var(--cloth-deep); background: var(--foil); padding: 6px 14px; border-radius: 3px; line-height: 20px; }
.nav-cv:hover { background: #fff; color: var(--cloth-deep); }
/* the bookmark ribbon: silk tail with a V-notch, hanging below the binding */
/* the ribbon stays inside the binding (below the link text), so it never covers the page */
.ribbon { position: absolute; top: 41px; left: 0; width: 16px; height: 19px; background: linear-gradient(90deg, #E39E1C, var(--thread) 45%, #F7C860 60%, #E39E1C);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 68%, 0 100%);
  opacity: 0; transform: translateX(var(--rx, 0px)) translateY(-8px); transition: transform .45s cubic-bezier(.3,.7,.2,1), opacity .25s; pointer-events: none; }
.ribbon.on { opacity: 1; transform: translateX(var(--rx, 0px)) translateY(0); }
.contents-btn { display: none; }
@media (max-width: 900px) {
  .top-in { gap: 12px; }
  .brand { font-size: 17px; }
  .contents-btn { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; height: 34px; padding: 0 12px; white-space: nowrap; font: 700 15px/1 var(--sans); color: var(--foil); background: transparent; border: 1px solid color-mix(in srgb, var(--foil) 60%, transparent); border-radius: 3px; cursor: pointer; }
  .contents-btn::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .2s; margin-left: 2px; }
  .contents-btn[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
  .ribbon { display: none; }
  /* the contents page */
  nav.top ul { display: none; position: absolute; top: 60px; right: 12px; left: 12px; margin: 0; flex-direction: column; gap: 0; padding: 12px 20px 16px 44px;
    background-color: var(--paper); color: var(--ink); border-radius: 0 0 4px 4px; box-shadow: 0 14px 30px rgba(20,10,30,.3);
    background-image: linear-gradient(90deg, transparent 26px, var(--red) 26px 27.5px, transparent 27.5px 31px, var(--red) 31px 32.5px, transparent 32.5px),
      repeating-linear-gradient(to bottom, transparent 0 43px, var(--rule) 43px 44px); background-position: 0 0, 0 12px; }
  nav.top.open ul { display: flex; }
  nav.top ul a { color: var(--ink); opacity: 1; line-height: 44px; font: 700 18px/44px var(--serif); }
  nav.top ul a[aria-current="true"] { color: var(--red); }
  nav.top ul a[aria-current="true"]::after { content: "you are here"; margin-left: 10px; font: 400 15px var(--hand); color: var(--red); }
  nav.top ul a:focus-visible { outline-color: var(--red); }
}
@media (max-width: 400px) { .brand span.bt { display: none; } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 46px; padding: 0 20px; border-radius: 3px; font: 700 16px/1 var(--sans); text-decoration: none; cursor: pointer; background: var(--ink); color: var(--paper); border: 2px solid var(--ink); transition: background-color .15s, border-color .15s, color .15s; }
.btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { border-color: var(--red); color: var(--red); }

/* ---------- Cover ---------- */
.cover {
  position: relative; overflow: hidden; color: var(--foil);
  background-color: var(--cloth);
  /* woven cloth: two faint diagonal weaves plus a soft vignette */
  background-image:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.07), transparent 60%),
    repeating-linear-gradient(45deg, rgba(0,0,0,.09) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.035) 0 1px, transparent 1px 4px);
  border-bottom: 6px solid var(--cloth-deep);
}
.spine { position: absolute; left: 0; top: 0; bottom: 0; width: 64px; background: var(--cloth-deep); box-shadow: inset -8px 0 14px rgba(0,0,0,.25); }
.spine svg { position: absolute; left: 22px; top: 0; width: 10px; height: 100%; overflow: visible; }
.spine line { stroke: var(--thread); stroke-width: 3; stroke-dasharray: 2.2 1.6; vector-effect: non-scaling-stroke; stroke-dasharray: 14 10; stroke-linecap: round; }
.js .spine svg { clip-path: inset(0 0 100% 0); animation: stitch 1.6s .3s cubic-bezier(.6,.05,.3,1) forwards; }
@keyframes stitch { to { clip-path: inset(0 0 0 0); } }
.cover-in { max-width: 1160px; margin: 0 auto; padding: 84px 24px 90px 120px; display: grid; gap: 28px 56px; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); }
.cover-in > * { grid-column: 1; }
.cover-in > .label { grid-column: 2; grid-row: 1 / span 3; align-self: end; }
@media (max-width: 1060px) { .cover-in { grid-template-columns: 1fr; } .cover-in > .label { grid-column: 1; grid-row: auto; } }
.foil {
  font: 900 clamp(48px, 10.5vw, 132px)/.9 var(--serif); letter-spacing: -.02em; text-transform: uppercase;
  color: var(--foil); text-shadow: 0 1px 0 rgba(0,0,0,.35), 0 -1px 0 rgba(255,240,200,.18);
}
.foil-sub { font: 700 clamp(18px, 2.2vw, 24px)/1.35 var(--serif); color: var(--foil); opacity: .92; max-width: 34ch; margin-top: -6px; }
/* the paper label stuck on the cover, filled in by hand */
.label {
  justify-self: start; max-width: 560px; width: 100%; background: var(--label); color: var(--ink);
  padding: 14px 22px 12px; border-radius: 3px; transform: rotate(-.6deg);
  box-shadow: 0 2px 0 rgba(0,0,0,.15), 0 10px 24px rgba(0,0,0,.25), inset 0 0 0 3px var(--label), inset 0 0 0 4px var(--rule-strong);
}
.label p { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: baseline; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--rule); }
.label p:last-child { border-bottom: 0; }
.label p > span { font-size: 13px; color: var(--ink-soft); }
.label b { font: 700 20px/1.35 var(--hand); color: var(--ink); }
.label b span { font: inherit; color: inherit; }
.cover-btns { display: flex; flex-wrap: wrap; gap: 12px; }
.foil-btn { background: var(--foil); border-color: var(--foil); color: var(--cloth-deep); }
.foil-btn:hover { background: #fff; border-color: #fff; color: var(--cloth-deep); }
.foil-ghost { background: transparent; border-color: var(--foil); color: var(--foil); }
.foil-ghost:hover { background: var(--foil); border-color: var(--foil); color: var(--cloth-deep); }
@media (max-width: 640px) {
  .spine { width: 30px; }
  .spine svg { left: 10px; }
  .cover-in { padding: 56px 18px 60px 52px; }
  .label { padding: 12px 14px 10px; }
  .label p { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- Ruled pages ---------- */
.page {
  /* a blue rule under every line of text */
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px) var(--lh));
  background-position: 0 4px;
}
.page-in { position: relative; max-width: 1160px; margin: 0 auto; padding: 90px 24px 60px; display: grid; grid-template-columns: 170px minmax(0, 1fr); column-gap: 52px; }
/* the red double margin line */
.page-in::before { content: ""; position: absolute; top: 0; bottom: 0; left: calc(24px + 170px + 22px); width: 5px; border-left: 1.5px solid var(--red); border-right: 1.5px solid var(--red); opacity: .8; }
.page h2 { font: 800 24px/var(--lh) var(--serif); letter-spacing: -.01em; }
.body { display: grid; gap: var(--lh); min-width: 0; }
.note { color: var(--ink-soft); }
h3 { font: 700 19px/var(--lh) var(--serif); }
@media (max-width: 760px) {
  .page-in { grid-template-columns: 1fr; padding: 60px 18px 30px 40px; row-gap: var(--lh); }
  .page-in::before { left: 14px; }
}

/* About */
.about { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 0 48px; }
@media (max-width: 760px) { .about { grid-template-columns: 1fr; row-gap: var(--lh); } }
.about .text { display: grid; gap: var(--lh); max-width: 62ch; align-content: start; }
.lead { font: 800 27px/var(--lh) var(--serif); letter-spacing: -.012em; }
.photo { position: relative; width: 210px; height: 240px; background: var(--label); padding: 8px 8px 0; transform: rotate(1.2deg); box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 8px 18px rgba(20,30,80,.16); }
.photo img { position: relative; z-index: 1; width: 100%; height: 194px; object-fit: cover; object-position: 50% 28%; display: block; }
.photo .initials { position: absolute; inset: 8px 8px 38px; display: grid; place-items: center; font: 900 64px/1 var(--serif); color: var(--rule-strong); }
.photo::after { content: "Prince Kumar"; position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font: 400 15px/24px var(--hand); color: var(--ink-soft); }
.entries { display: grid; grid-template-columns: 110px minmax(0, 1fr); }
.entries dt { color: var(--ink-soft); }
.entries dd { font-weight: 600; }
.counters { border-collapse: collapse; width: 100%; max-width: 760px; }
.counters caption { text-align: left; font: 700 19px/var(--lh) var(--serif); padding-bottom: var(--lh); }
.counters th, .counters td { text-align: left; padding: 0 16px 0 0; vertical-align: top; }
.counters thead th { font-size: 14px; font-weight: 400; color: var(--ink-soft); }
.counters tbody th { font-weight: 700; white-space: nowrap; width: 180px; }
.counters tbody td { color: var(--ink-soft); }
.counters tr.now th, .counters tr.now td { color: var(--red); }
@media (max-width: 560px) { .counters tbody th { white-space: normal; width: 40%; } }

/* What I do */
.services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lh) 48px; }
@media (max-width: 760px) { .services { grid-template-columns: 1fr; } }
.svc { display: grid; align-content: start; }
.svc .need { font-family: var(--hand); font-size: 19px; color: var(--ink-soft); }
.svc p:not(.need) { max-width: 46ch; }
.more { justify-self: start; font-weight: 700; }

/* Experience: a ledger */
.ledger { max-width: 820px; }
.ledger-head, .ledger summary, .total, .edu { display: grid; grid-template-columns: 196px minmax(0, 1fr) 64px; column-gap: 16px; }
.ledger-head { font-size: 14px; color: var(--ink-soft); box-shadow: inset 0 -2px 0 var(--ink); }
.yrs { text-align: right; font-variant-numeric: tabular-nums; }
.ledger ol { list-style: none; padding: 0; }
.ledger summary { list-style: none; cursor: pointer; }
.ledger summary::-webkit-details-marker { display: none; }
.period { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.part { position: relative; padding-left: 22px; }
.part::before { content: "+"; position: absolute; left: 0; top: 0; width: 14px; font-weight: 700; color: var(--red); }
details[open] .part::before { content: "–"; }
.ledger summary:hover .part b { text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 4px; }
.ledger li.live .period, .ledger li.live .yrs { color: var(--red); font-weight: 700; }
.detail { padding-left: calc(196px + 16px + 22px); padding-bottom: var(--lh); color: var(--ink-soft); }
.detail .where { font-size: 15px; }
.detail ul { padding-left: 1.1em; max-width: 64ch; color: var(--ink); }
.detail li::marker { color: var(--red); }
details.flash > summary { animation: flash 1.6s ease-out 1; }
@keyframes flash { 0%, 35% { background: color-mix(in srgb, var(--thread) 35%, transparent); } }
.total { font-weight: 700; }
.total span:first-child { grid-column: 2; padding-left: 22px; }
.total .yrs { text-decoration: underline double var(--ink); text-underline-offset: 5px; text-decoration-thickness: 1px; }
.edu { margin-top: var(--lh); color: var(--ink-soft); }
.edu span:last-child { grid-column: 2 / 4; padding-left: 22px; }
.edu b { color: var(--ink); }
@media (max-width: 640px) {
  .ledger-head { display: none; }
  .ledger summary, .total, .edu { grid-template-columns: minmax(0, 1fr) 46px; }
  .period { grid-column: 1 / -1; font-size: 15px; }
  .total span:first-child, .edu span:last-child { grid-column: 1; padding-left: 0; }
  .edu span:last-child { grid-column: 1 / -1; }
  .detail { padding-left: 22px; }
}

/* Work: index tabs and account pages */
.ptabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; box-shadow: inset 0 -2px 0 var(--ink); }
.ptabs::-webkit-scrollbar { display: none; }
.ptab { flex: none; height: var(--lh); padding: 0 16px; font: 700 15px/var(--lh) var(--sans); color: var(--ink-soft); background: color-mix(in srgb, var(--rule) 55%, var(--paper)); border: 0; border-radius: 4px 4px 0 0; cursor: pointer; }
.ptab:hover { color: var(--ink); }
.ptab[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.ppanels:not(.tabbed) { display: grid; gap: calc(var(--lh) * 2); }
.ppanel { position: relative; display: grid; padding-top: var(--lh); gap: var(--lh); }
.ppanel[hidden] { display: none; }
.ppanel h3 { font: 800 30px/var(--lh) var(--serif); letter-spacing: -.015em; }
.ppanel .sub { color: var(--ink-soft); margin-top: calc(var(--lh) * -1); }
.plead { max-width: 62ch; font-weight: 600; }
.prole { color: var(--ink-soft); margin-top: calc(var(--lh) * -1); max-width: 62ch; }
.prole b { color: var(--ink); }
.acct { width: 100%; border-collapse: collapse; table-layout: fixed; }
.acct th { text-align: left; font-size: 14px; font-weight: 400; color: var(--ink-soft); box-shadow: inset 0 -2px 0 var(--ink); }
.acct td { vertical-align: top; padding-right: 18px; }
.acct td + td, .acct th + th { padding-left: 14px; box-shadow: inset 1px 0 0 var(--rule-strong); }
.acct th + th { box-shadow: inset 1px 0 0 var(--rule-strong), inset 0 -2px 0 var(--ink); }
@media (max-width: 640px) {
  .acct, .acct tbody, .acct tr, .acct td { display: block; }
  .acct thead { display: none; }
  .acct td + td { padding-left: 0; box-shadow: none; }
  .acct td { padding-bottom: var(--lh); }
}
.hl { padding-left: 1.1em; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lh) 40px; color: var(--ink-soft); }
@media (max-width: 760px) { .hl { grid-template-columns: 1fr; } }
.hl li::marker { color: var(--red); }
.hl b { color: var(--ink); }
.built { font-size: 15px; color: var(--ink-soft); }
.built b { color: var(--ink); }
/* the rubber stamp: only on Mini-Banking, where the accounts really were audited */
.stamp {
  position: absolute; right: 8px; top: 36px; z-index: 1; display: grid; justify-items: center; padding: 8px 16px 6px;
  color: var(--stamp); border: 3px double var(--stamp); border-radius: 6px; transform: rotate(-7deg);
  font: 700 13px/1.2 var(--sans); text-align: center; opacity: .88; mix-blend-mode: multiply;
}
.stamp b { font: 900 24px/1.1 var(--serif); letter-spacing: .02em; }
:root[data-theme="dark"] .stamp { mix-blend-mode: normal; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stamp { mix-blend-mode: normal; } }
@media (max-width: 640px) { .stamp { position: static; justify-self: start; transform: rotate(-3deg); } }

/* Stack: an index with dot leaders */
.now-key { color: var(--red); font-weight: 700; }
.index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lh) 56px; }
@media (max-width: 860px) { .index { grid-template-columns: 1fr; } }
.grp ul { list-style: none; padding: 0; }
.grp li { display: flex; align-items: baseline; gap: 8px; }
.grp li b { font-weight: 600; flex: 0 1 auto; }
.grp li i { flex: 1; min-width: 20px; border-bottom: 2px dotted var(--rule-strong); transform: translateY(-6px); }
.grp li span { flex: none; color: var(--ink-soft); text-align: right; }
.grp li { height: var(--lh); overflow: hidden; }
.grp em.now { font-style: normal; font-weight: 700; color: var(--red); margin-right: 6px; }

/* Contact: a request slip with a counterfoil */
.slip { display: grid; grid-template-columns: minmax(0, 1fr) 250px; max-width: 900px; background: var(--label); box-shadow: inset 0 0 0 2px var(--ink), 0 10px 26px rgba(20,30,80,.10); }
.slip-main { display: grid; gap: var(--lh); padding: var(--lh) 28px; }
.slip-title { font: 800 24px/var(--lh) var(--serif); letter-spacing: -.01em; }
.boxes { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 22px; }
.boxes legend { float: left; width: 100%; padding: 0; font-weight: 700; }
.boxes label { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.boxes input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; border: 2px solid var(--ink); border-radius: 2px; background: var(--paper); display: grid; place-items: center; cursor: pointer; }
.boxes input[type="radio"] { border-radius: 50%; }
.boxes input:checked::after { content: "✓"; font: 700 19px/1 var(--hand); color: var(--red); transform: translate(1px, -2px); }
.boxes input[type="radio"]:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); transform: none; }
.boxes input:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.line { display: grid; }
.line > span { font-weight: 700; }
.line small { color: var(--ink-soft); font-weight: 400; }
.line input, .line textarea { font: 400 18px/var(--lh) var(--hand); color: var(--ink); background: transparent; border: 0; border-radius: 0; padding: 0 2px; resize: vertical;
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--lh) - 1px), var(--rule-strong) calc(var(--lh) - 1px) var(--lh)); }
.line input { height: var(--lh); }
.line textarea { min-height: calc(var(--lh) * 3); }
.line input:focus, .line textarea:focus { outline: none; background-color: color-mix(in srgb, var(--thread) 12%, transparent); }
.slip-btns { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; min-height: calc(var(--lh) * 2); }
.counterfoil { position: relative; display: grid; align-content: start; gap: 0; padding: var(--lh) 22px; border-left: 2px dashed var(--ink-soft); }
/* perforation notches */
.counterfoil::before, .counterfoil::after { content: ""; position: absolute; left: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); }
.counterfoil::before { top: -10px; box-shadow: inset 0 -2px 0 var(--ink); }
.counterfoil::after { bottom: -10px; box-shadow: inset 0 2px 0 var(--ink); }
.cf-title { font: 800 17px/var(--lh) var(--serif); margin-bottom: var(--lh); }
.counterfoil p { display: grid; }
.counterfoil p > span { font-size: 13px; line-height: 20px; color: var(--ink-soft); }
.hand { font: 700 17px/25px var(--hand); color: var(--ink); min-height: 25px; margin-bottom: 15px; box-shadow: inset 0 -1px 0 var(--rule-strong); overflow-wrap: anywhere; }
.hand:empty::before { content: "\00a0"; }
.cf-note { margin-top: var(--lh); font-size: 14px; line-height: 22px; color: var(--ink-soft); }
@media (max-width: 760px) {
  .slip { grid-template-columns: 1fr; }
  .slip-main { padding: var(--lh) 18px; }
  .counterfoil { border-left: 0; border-top: 2px dashed var(--ink-soft); padding: var(--lh) 18px; }
  .counterfoil::before { left: -10px; top: -11px; }
  .counterfoil::after { left: auto; right: -10px; top: -11px; bottom: auto; box-shadow: inset 0 -2px 0 var(--ink); }
}
.alt { color: var(--ink-soft); max-width: 70ch; }
.mail { word-break: break-all; }
.linkish { font: inherit; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 4px; }
.linkish:hover { text-decoration-color: var(--red); }
.toast { color: var(--red); font-weight: 700; min-height: var(--lh); margin-top: calc(var(--lh) * -1); }

/* ---------- Back cover ---------- */
.backcover { background: var(--cloth); color: var(--foil); border-top: 6px solid var(--cloth-deep);
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.09) 0 1px, transparent 1px 4px); }
.back-in { max-width: 1160px; margin: 0 auto; padding: 48px 24px 40px 120px; display: grid; gap: 18px; }
.backcover .foil { font-size: clamp(30px, 5vw, 48px); }
.flinks { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.backcover a, .backcover .linkish { color: var(--foil); text-decoration-color: rgba(233,201,120,.45); }
.backcover a:hover, .backcover .linkish:hover { text-decoration-color: var(--foil); }
.small { font-size: 14px; opacity: .85; }
kbd { font: 700 13px var(--mono); padding: 1px 6px; border: 1px solid currentColor; border-radius: 3px; }
@media (max-width: 640px) { .back-in { padding: 40px 18px 32px 52px; } }

/* ---------- Terminal (easter egg, press `) ----------
   A dot-matrix printout on continuous green-bar stationery: sprocket holes down both edges,
   pale green bands every three lines (they scroll with the text), a red-and-black ribbon.
   New output prints line by line, only in answer to a command. */
.term { padding: 0; border: 0; background: transparent; width: min(760px, calc(100vw - 24px)); overflow: visible; }
.term::backdrop { background: rgba(20, 14, 20, .55); }
.console {
  --pp: #F7F8F1; --bar: #DCEBD3; --ribbon: #26303F; --ribbon-red: #C0263A; --hole: #3A2A30; --plh: 24px;
  position: relative; color: var(--ribbon); background: var(--pp); padding: 0 46px;
  font: 15px/var(--plh) "Courier Prime", "Courier New", monospace;
  box-shadow: 0 2px 0 rgba(0,0,0,.08), 0 26px 60px rgba(0,0,0,.45);
  /* sprocket holes and the perforation beside them, on both edges */
  background-image:
    radial-gradient(circle at 18px 12px, var(--hole) 0 5px, transparent 5.5px),
    radial-gradient(circle at calc(100% - 18px) 12px, var(--hole) 0 5px, transparent 5.5px),
    linear-gradient(to right, transparent 35px, rgba(38,48,63,.28) 35px 36px, transparent 36px calc(100% - 36px), rgba(38,48,63,.28) calc(100% - 36px) calc(100% - 35px), transparent calc(100% - 35px));
  background-size: 100% var(--plh), 100% var(--plh), 100% 100%;
  /* torn top and bottom edges */
  clip-path: polygon(0 4px, 3% 0, 7% 4px, 12% 1px, 18% 4px, 25% 0, 31% 3px, 38% 1px, 45% 4px, 52% 0, 60% 3px, 67% 1px, 74% 4px, 81% 0, 88% 3px, 94% 1px, 100% 4px, 100% calc(100% - 3px), 95% 100%, 89% calc(100% - 4px), 82% calc(100% - 1px), 75% calc(100% - 4px), 67% 100%, 59% calc(100% - 3px), 51% calc(100% - 1px), 43% calc(100% - 4px), 35% 100%, 27% calc(100% - 3px), 19% calc(100% - 1px), 11% calc(100% - 4px), 4% 100%, 0 calc(100% - 3px));
}
.feed { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 8px; border-bottom: 1px dashed rgba(38,48,63,.4); }
.sheet-head { font-weight: 700; }
.sheet-tools { display: flex; gap: 8px; }
.term-btn { white-space: nowrap; font: 700 13px/1 "Martel Sans", sans-serif; color: var(--ribbon); background: transparent; border: 1.5px solid var(--ribbon); border-radius: 2px; padding: 6px 10px; cursor: pointer; }
.term-btn:hover { color: var(--ribbon-red); border-color: var(--ribbon-red); }
.out {
  height: calc(var(--plh) * 13); overflow-y: auto; white-space: pre-wrap; word-break: break-word; padding: 0 2px;
  /* green bars every three lines; "local" makes them scroll with the paper */
  background-image: repeating-linear-gradient(to bottom, var(--bar) 0 calc(var(--plh) * 3), transparent calc(var(--plh) * 3) calc(var(--plh) * 6));
  background-attachment: local; scrollbar-width: thin;
}
.out .p, .out .cmdline { color: var(--ribbon-red); }
.out .a, .out .h { font-weight: 700; }
.out .fresh { display: block; }
.js .out .fresh { animation: printing var(--dur, .5s) steps(var(--lines, 4), end) both; }
@keyframes printing { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; border-top: 1px dashed rgba(38,48,63,.4); }
.chips button { font: 700 13px/1 "Courier Prime", monospace; color: var(--ribbon); background: #fff; border: 1.5px solid var(--ribbon); border-bottom-width: 3px; border-radius: 3px; padding: 5px 9px; cursor: pointer; }
.chips button:hover { color: var(--ribbon-red); border-color: var(--ribbon-red); }
.chips button:active { transform: translateY(2px); border-bottom-width: 1.5px; }
form.cmd { display: flex; align-items: center; gap: 10px; padding: 8px 0 16px; }
form.cmd label { color: var(--ribbon-red); font-weight: 700; }
form.cmd input { flex: 1; min-width: 0; background: transparent; border: 0; border-bottom: 1.5px solid var(--ribbon); color: var(--ribbon); font: inherit; font-size: 16px; outline: none; caret-color: var(--ribbon-red); padding: 2px 0; }
form.cmd input:focus { border-bottom-color: var(--ribbon-red); }
@media (max-width: 560px) {
  .console { padding: 0 32px; font-size: 14px;
    background-image: radial-gradient(circle at 12px 12px, var(--hole) 0 4px, transparent 4.5px), radial-gradient(circle at calc(100% - 12px) 12px, var(--hole) 0 4px, transparent 4.5px),
      linear-gradient(to right, transparent 24px, rgba(38,48,63,.28) 24px 25px, transparent 25px calc(100% - 25px), rgba(38,48,63,.28) calc(100% - 25px) calc(100% - 24px), transparent calc(100% - 24px)); }
  .sheet-head { font-size: 13px; line-height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .spine svg { animation: none; clip-path: none; }
  details.flash > summary { animation: none; }
  .js .out .fresh { animation: none; }
  .ribbon { transition: opacity .25s; }
}
@media print {
  :root { --paper: #fff; --ink: #000; --ink-soft: #333; --rule: transparent; --red: #000; color-scheme: light; }
  nav.top, .skip, .cover-btns, .spine, .slip, .alt, .toast, .term, .ptabs, .stamp { display: none !important; }
  .cover { background: #fff; color: #000; border: 0; }
  .cover-in { padding: 0 0 20px; }
  .foil, .foil-sub { color: #000; text-shadow: none; }
  .label { transform: none; box-shadow: none; padding: 0; }
  .page-in::before { display: none; }
  .ppanel[hidden] { display: grid !important; }
  .backcover { background: #fff; color: #000; }
}
