/* ESA Funds Tracker — composition notebook system
   Cover marble, bright ruled paper, a red margin, blue ballpoint, and highlighters
   as the only status colors. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Kalam";
  src: url("../fonts/kalam-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Kalam";
  src: url("../fonts/kalam-700-latin.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;

  --ink: #15171a;
  --ink-2: #3a3f46;
  --ink-3: #5a616a;
  --paper: #fdfdfb;
  --paper-shade: #f2f3ef;
  --receipt: #fbfbf6;
  --rule: #bfd2ee;
  --rule-soft: #dde7f5;
  --rule-strong: #5f86c9;
  --margin: #e4484f;
  --pen: #1d4cbc;
  --pen-deep: #173d99;

  --hl-yellow: #fff25a;
  --hl-green: #a6efb2;
  --hl-pink: #ffa6d2;
  --hl-grey: #dcded8;

  --marble: #0f0f0f;
  --tape: rgba(236, 231, 205, 0.78);

  --f-display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --f-hand: "Kalam", "Bradley Hand", "Segoe Print", cursive;
  --f-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-receipt: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --line: 2.25rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --wrap: 76rem;
  --margin-col: 11.5rem;

  --shadow-sheet: 0 1px 1px rgba(21, 23, 26, 0.06), 0 2px 6px rgba(21, 23, 26, 0.06), 0 22px 48px -22px rgba(21, 23, 26, 0.38);
  --shadow-lift: 0 1px 2px rgba(21, 23, 26, 0.1), 0 10px 24px -12px rgba(21, 23, 26, 0.35);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  scrollbar-color: var(--ink) var(--paper-shade);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--f-ui);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--pen);
}

::selection { background: var(--hl-yellow); color: var(--ink); }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--paper-shade); }
::-webkit-scrollbar-thumb { background: var(--ink); border: 3px solid var(--paper-shade); border-radius: 8px; }

img { display: block; max-width: 100%; }
svg { display: inline-block; vertical-align: -0.2em; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-stretch: 72%;
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.012em;
  margin: 0;
  text-wrap: balance;
}
h2 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); }
h3 { font-size: clamp(1.35rem, 2.2vw, 1.7rem); font-stretch: 78%; line-height: 1.05; }
p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: var(--pen); text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
a:hover { color: var(--pen-deep); text-decoration-thickness: 2.5px; }

:focus-visible {
  outline: 3px solid var(--pen);
  outline-offset: 3px;
  border-radius: 2px;
}

.num { font-variant-numeric: tabular-nums lining-nums; }
.hand { font-family: var(--f-hand); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--hl-yellow); color: var(--ink); padding: 0.6rem 1rem;
  font-weight: 700; text-decoration: none; border-radius: 3px;
}
.skip-link:focus { top: 1rem; }

/* ------------------------------------------------------------------ */
/* Highlighter                                                         */
/* ------------------------------------------------------------------ */

.hl {
  --hl: var(--hl-yellow);
  background-image: linear-gradient(100deg,
    transparent 0.08em, var(--hl) 0.22em,
    var(--hl) calc(100% - 0.25em), transparent calc(100% - 0.06em));
  background-repeat: no-repeat;
  background-size: 100% 0.78em;
  background-position: 0 72%;
  padding: 0 0.12em;
  margin: 0 -0.08em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hl--green { --hl: var(--hl-green); }
.hl--pink { --hl: var(--hl-pink); }
.hl--grey { --hl: var(--hl-grey); }
.hl--full { background-size: 100% 88%; background-position: 0 60%; }

.js .swipe { background-size: 0% 0.78em; }
.js .swipe.hl--full { background-size: 0% 88%; }
.js .swipe.is-on { background-size: 100% 0.78em; transition: background-size 0.55s var(--ease-out); }
.js .swipe.hl--full.is-on { background-size: 100% 88%; }

.write-in { display: inline-block; }
.js .write-in { clip-path: inset(0 100% 0 0); }
.js .write-in.is-on { clip-path: inset(0 0 0 0); transition: clip-path 0.7s var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .swipe, .js .swipe.hl--full { background-size: 100% 0.78em; transition: none !important; }
  .js .swipe.hl--full { background-size: 100% 88%; }
  .js .write-in { clip-path: none; transition: none !important; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------ */
/* Buttons & fields                                                     */
/* ------------------------------------------------------------------ */

.btn {
  --btn-bg: var(--ink);
  --btn-fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  min-height: 3rem; padding: 0.7rem 1.35rem;
  border: 2px solid var(--ink); border-radius: 4px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-family: var(--f-display); font-stretch: 88%; font-weight: 700;
  font-size: 1.08rem; line-height: 1.1; letter-spacing: 0.005em;
  text-decoration: none; white-space: nowrap;
  position: relative; isolation: isolate;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), background-color 0.18s;
  box-shadow: 0 1px 0 rgba(21, 23, 26, 0.25), 0 8px 18px -10px rgba(21, 23, 26, 0.55);
}
.btn:hover { color: var(--btn-fg); text-decoration: none; transform: translateY(-1px); box-shadow: 0 2px 0 rgba(21, 23, 26, 0.25), 0 12px 22px -10px rgba(21, 23, 26, 0.6); }
.btn:active { transform: translateY(1px); box-shadow: 0 0 0 rgba(21, 23, 26, 0.2), 0 4px 10px -6px rgba(21, 23, 26, 0.5); }
.btn svg { flex: none; }
.btn .btn-arrow { transition: transform 0.25s var(--ease-out); }
.btn:hover .btn-arrow { transform: translateX(3px); }

.btn--paper { --btn-bg: #fff; --btn-fg: var(--ink); }
.btn--paper:hover { --btn-bg: #fff; background-image: linear-gradient(var(--hl-yellow), var(--hl-yellow)); background-size: 100% 38%; background-position: 0 88%; background-repeat: no-repeat; }
.sale-state .btn, .check-footer .btn, .ws-actions .btn { white-space: normal; text-align: center; }
.btn--small { min-height: 2.5rem; padding: 0.45rem 0.9rem; font-size: 0.98rem; }
.btn--quiet { --btn-bg: transparent; --btn-fg: var(--ink); border-color: transparent; box-shadow: none; }
.btn--quiet:hover { box-shadow: none; background: var(--paper-shade); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }

.link-pen {
  font-family: var(--f-display); font-stretch: 88%; font-weight: 700; font-size: 1.05rem;
  color: var(--pen); text-decoration: underline; text-decoration-thickness: 2px;
  text-underline-offset: 0.28em; display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 2.75rem;
}

.field { display: grid; gap: 0.3rem; }
.field > label, .field-label {
  font-family: var(--f-display); font-stretch: 85%; font-weight: 700;
  font-size: 0.86rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2);
}
.input, .select, .textarea {
  width: 100%; min-height: 3rem; padding: 0.6rem 0.8rem;
  border: 2px solid var(--ink); border-radius: 4px; background: #fff;
  font-size: 1.0625rem; line-height: 1.3;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.input::placeholder, .textarea::placeholder { color: #737a83; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--pen); box-shadow: 0 0 0 3px rgba(29, 76, 188, 0.25); }
.input[aria-invalid="true"] { border-color: var(--margin); box-shadow: 0 0 0 3px rgba(228, 72, 79, 0.2); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1.5 1.5 7 7l5.5-5.5' fill='none' stroke='%2315171a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.85rem center;
}
.textarea { min-height: 6rem; resize: vertical; }

/* Handwritten fill-in field: a blank on a ruled line */
.fill {
  display: inline-flex; align-items: baseline; gap: 0.2rem;
  border-bottom: 2px solid var(--ink); padding: 0 0.25rem;
}
.fill input {
  border: 0; background: transparent; width: 6.5ch; min-height: 2.6rem;
  font-family: var(--f-hand); font-weight: 700; font-size: 1.6rem; color: var(--pen);
  padding: 0; text-align: left;
}
.fill input:focus { outline: none; }
.fill:focus-within { background: linear-gradient(transparent 55%, var(--hl-yellow) 55%); }

/* ------------------------------------------------------------------ */
/* Binding (top bar)                                                    */
/* ------------------------------------------------------------------ */

.binding {
  position: sticky; top: 0; z-index: 50;
  background: #111214;
  color: #f5f5f0;
  border-bottom: 1px solid #000;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 6px 16px -10px rgba(0, 0, 0, 0.5);
}
.binding::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 3px),
                    repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 4px);
}
.binding-inner {
  position: relative;
  max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter);
  min-height: 4.25rem; display: flex; align-items: center; gap: 1.25rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.7rem;
  color: #fff; text-decoration: none; margin-right: auto; min-height: 2.75rem;
}
.brand:hover { color: #fff; }
.brand-mark {
  width: 2rem; height: 2.5rem; flex: none; border-radius: 2px 3px 3px 2px;
  background: #fff url("marble.svg") 0 0 / 160px 160px;
  box-shadow: inset 5px 0 0 #111214, 0 0 0 1px rgba(255,255,255,0.25);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; left: 9px; right: 4px; top: 11px; height: 11px;
  background: #fff; border-radius: 2px; box-shadow: inset 0 0 0 1px #111;
}
.brand-name {
  font-family: var(--f-display); font-stretch: 75%; font-weight: 800; font-size: 1.3rem;
  letter-spacing: 0.01em; line-height: 1;
}
.brand-name small {
  display: block; font-family: var(--f-hand); font-stretch: normal; font-weight: 400;
  font-size: 0.8rem; letter-spacing: 0; color: #c9ccd1; margin-top: 0.15rem;
}
.nav { display: flex; align-items: center; gap: 0.2rem; }
.nav a {
  color: #e9e9e4; text-decoration: none; font-weight: 600; font-size: 0.98rem;
  padding: 0.55rem 0.75rem; border-radius: 3px; min-height: 2.75rem; display: inline-flex; align-items: center;
}
.nav a:hover { color: #111; background: var(--hl-yellow); }
.nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--hl-yellow); }
.binding .btn { --btn-bg: var(--hl-yellow); --btn-fg: var(--ink); border-color: var(--hl-yellow); box-shadow: none; }
.binding .btn:hover { --btn-bg: #fff; border-color: #fff; }

.nav-menu { display: none; position: relative; }
.nav-menu summary {
  list-style: none; cursor: pointer; min-height: 2.75rem; min-width: 2.75rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  color: #fff; font-weight: 700; border: 1px solid rgba(255,255,255,0.3); border-radius: 4px; padding: 0 0.75rem;
}
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu[open] summary { background: var(--hl-yellow); color: var(--ink); border-color: var(--hl-yellow); }
.nav-menu-panel {
  position: absolute; right: 0; top: calc(100% + 0.6rem); width: min(18rem, 86vw);
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 4px;
  box-shadow: var(--shadow-lift); padding: 0.4rem;
  display: grid;
}
.nav-menu-panel a {
  color: var(--ink); text-decoration: none; font-weight: 600; padding: 0.75rem 0.8rem;
  border-bottom: 1px solid var(--rule-soft); min-height: 3rem; display: flex; align-items: center;
}
.nav-menu-panel a:last-child { border-bottom: 0; }
.nav-menu-panel a:hover { background: var(--hl-yellow); }

@media (max-width: 980px) {
  .nav { display: none; }
  .nav-menu { display: block; }
}
@media (max-width: 520px) {
  .binding .btn--hide-sm { display: none; }
  .brand-name small { display: none; }
}

/* ------------------------------------------------------------------ */
/* Cover (hero)                                                          */
/* ------------------------------------------------------------------ */

.cover {
  position: relative;
  background: var(--marble) url("marble.svg") 0 0 / 640px 640px;
  color: var(--ink);
  padding: clamp(2.5rem, 6vw, 5.5rem) 0 0;
  overflow-x: clip;
  z-index: 2;
}
.cover::before {
  /* printed cover edge: faint board shading so the marble reads as a surface */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 30% 20%, rgba(255,255,255,0.06), transparent 55%),
              linear-gradient(180deg, rgba(0,0,0,0) 70%, rgba(0,0,0,0.35));
}
.cover-grid {
  position: relative;
  max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter);
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: clamp(1.5rem, 4vw, 4rem); align-items: start;
}

.label {
  position: relative; background: #fff; color: var(--ink);
  border-radius: 1.4rem;
  padding: clamp(1.6rem, 3.2vw, 2.8rem) clamp(1.4rem, 3.4vw, 3rem) clamp(1.4rem, 2.8vw, 2.4rem);
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--ink), 0 0 0 7px #fff, 0 24px 50px -20px rgba(0,0,0,0.7);
  margin: 0.45rem 0.45rem clamp(2.5rem, 6vw, 5rem);
}
.label h1 {
  font-size: clamp(2.6rem, 5.2vw, 4.75rem);
  font-stretch: 66%;
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.02em;
  margin-bottom: 1.1rem;
}
.label-lede { font-size: clamp(1.06rem, 1.5vw, 1.22rem); color: var(--ink-2); max-width: 38rem; margin-bottom: 1.3rem; }
.label-fields { margin: 0 0 1.5rem; padding: 0; list-style: none; display: grid; gap: 0.1rem; }
.label-fields li {
  display: grid; grid-template-columns: 6.2rem 1fr; align-items: end; gap: 0.6rem;
  border-bottom: 1.5px solid var(--ink); padding-bottom: 0.15rem; min-height: 2.6rem;
}
.label-fields span:first-child {
  font-family: var(--f-display); font-stretch: 85%; font-weight: 800;
  font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase; padding-bottom: 0.3rem;
}
.label-fields span:last-child { font-family: var(--f-hand); font-size: 1.28rem; color: var(--pen); line-height: 1.3; }
.label-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.4rem; }
.label-note { margin: 1.3rem 0 0; font-size: 0.86rem; color: var(--ink-3); max-width: 36rem; }

/* The open page beside the label */
.page {
  position: relative;
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 3.1rem, var(--margin) 3.1rem, var(--margin) calc(3.1rem + 1.5px), transparent calc(3.1rem + 1.5px)),
    linear-gradient(180deg, transparent 3.6rem, var(--rule-strong) 3.6rem, var(--rule-strong) calc(3.6rem + 2px), transparent calc(3.6rem + 2px)),
    repeating-linear-gradient(180deg, transparent 0 calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px) var(--line));
  background-position: 0 0, 0 0, 0 calc(3.6rem + 2px);
  box-shadow: var(--shadow-sheet);
  border-radius: 2px 6px 6px 2px;
}
.cover-page {
  container-type: inline-size;
  transform: rotate(1.6deg);
  margin: 0.6rem 0 -4.5rem;
  padding: 4.6rem 1.6rem 2.2rem 4.3rem;
  min-height: 34rem;
}
.cover-page::after {
  /* three-hole-less composition edge: faint stitch shadow at the gutter */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 14px;
  background: linear-gradient(90deg, rgba(21,23,26,0.14), transparent);
  border-radius: 2px 0 0 2px;
}
.page-date {
  position: absolute; top: 1.35rem; right: 1.6rem;
  font-family: var(--f-hand); color: var(--pen); font-size: 1.2rem;
}
.page-heading {
  position: absolute; top: 1.2rem; left: 4.3rem;
  font-family: var(--f-hand); font-weight: 700; color: var(--pen); font-size: 1.45rem;
}

/* Receipt */
.receipt {
  position: relative;
  background: var(--receipt);
  font-family: var(--f-receipt); font-size: 0.86rem; line-height: 1.55; color: #26282c;
  padding: 1.3rem 1.2rem 1.9rem;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08), 0 10px 22px -12px rgba(0,0,0,0.45);
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 10px) no-repeat,
                conic-gradient(from 135deg at 50% 0, #000 90deg, transparent 0) bottom / 14px 10px repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 10px) no-repeat,
        conic-gradient(from 135deg at 50% 0, #000 90deg, transparent 0) bottom / 14px 10px repeat-x;
}
.receipt-wrap { position: relative; }
.receipt-wrap::before {
  /* tape */
  content: ""; position: absolute; z-index: 2; top: -0.85rem; left: 50%; width: 6.5rem; height: 1.7rem;
  transform: translateX(-50%) rotate(-3deg);
  background: var(--tape);
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  -webkit-mask: linear-gradient(90deg, transparent 0 2px, #000 2px calc(100% - 2px), transparent calc(100% - 2px));
}
.receipt-head { text-align: center; margin-bottom: 0.8rem; }
.receipt-head strong { display: block; font-size: 1rem; letter-spacing: 0.08em; }
.receipt-line {
  display: flex; justify-content: space-between; gap: 0.8rem; align-items: baseline;
  border-top: 1px dashed #bdbfb8; padding: 0.35rem 0;
}
.receipt-line:first-of-type { border-top: 0; }
.receipt-line b { font-weight: 700; }
.receipt-total { border-top: 1.5px solid #26282c; margin-top: 0.3rem; padding-top: 0.45rem; font-weight: 700; font-size: 0.98rem; }
.receipt-sample {
  position: absolute; top: 0.55rem; right: 0.7rem; font-family: var(--f-ui); font-size: 0.72rem;
  font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #5f646b;
}

.cover-receipt { width: min(21rem, 100%); transform: rotate(-3deg); margin: 0.4rem 0 0 0.2rem; }
.margin-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1.2rem; margin-top: 1.3rem; }
@container (min-width: 40rem) {
  .margin-notes { position: absolute; right: 1.2rem; top: 5rem; width: 12.5rem; grid-template-columns: 1fr; margin: 0; gap: 0.9rem; }
}
.note {
  font-family: var(--f-hand); color: var(--pen); font-size: 1.15rem; line-height: 1.32;
}
.note b { font-weight: 700; }
.note--fix { color: #b0263a; }
.note svg { display: inline-block; vertical-align: -0.15em; margin-right: 0.2rem; }
.page-tally .hl { color: var(--ink); }
.page-tally {
  margin-top: 1.6rem; font-family: var(--f-hand); font-size: 1.35rem; color: var(--pen);
  display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap;
}

@media (max-width: 900px) {
  .cover-grid { grid-template-columns: 1fr; }
  .label { margin-bottom: 1.5rem; }
  .cover-page { transform: rotate(0.8deg); margin: 0 0.25rem -3rem; min-height: 0; }
}
@media (max-width: 560px) {
  .label { border-radius: 1rem; }
  .label-actions .btn { white-space: normal; width: 100%; text-align: center; }
  .label-fields li { grid-template-columns: 5.2rem 1fr; }
  .cover-page { padding: 4.3rem 1rem 1.6rem 3.4rem; background-image:
    linear-gradient(90deg, transparent 2.4rem, var(--margin) 2.4rem, var(--margin) calc(2.4rem + 1.5px), transparent calc(2.4rem + 1.5px)),
    linear-gradient(180deg, transparent 3.6rem, var(--rule-strong) 3.6rem, var(--rule-strong) calc(3.6rem + 2px), transparent calc(3.6rem + 2px)),
    repeating-linear-gradient(180deg, transparent 0 calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px) var(--line)); }
  .page-heading { left: 3.4rem; font-size: 1.25rem; }
  .page-date { right: 1rem; font-size: 1.05rem; }
  .cover-receipt { width: 100%; }
}

/* ------------------------------------------------------------------ */
/* Sections: content sits right of a red margin; notes live in the gutter */
/* ------------------------------------------------------------------ */

.sheet-section {
  position: relative;
  max-width: var(--wrap); margin: 0 auto;
  padding: clamp(5rem, 9vw, 8rem) var(--gutter) clamp(3rem, 6vw, 5rem);
  display: grid; grid-template-columns: var(--margin-col) minmax(0, 1fr);
  column-gap: 2.5rem;
}
.sheet-section::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: calc(var(--gutter) + var(--margin-col) + 1.2rem);
  width: 1.5px; background: var(--margin); opacity: 0.85;
}
.sheet-section > * { grid-column: 2; min-width: 0; }
.sheet-section > .gutter-note {
  grid-column: 1; grid-row: 1 / span 2; align-self: start; justify-self: end; text-align: right;
  font-family: var(--f-hand); color: var(--pen); font-size: 1.3rem; line-height: 1.2;
  padding-top: 0.4rem; transform: rotate(-3deg); max-width: 10.5rem;
}
.section-head { margin-bottom: clamp(1.8rem, 3.5vw, 2.8rem); max-width: 50rem; }
.section-head h2 { margin-bottom: 0.9rem; }
.section-head h2 .hl { background-size: 100% 0.42em; background-position: 0 88%; }
.js .section-head h2 .swipe { background-size: 0% 0.42em; }
.js .section-head h2 .swipe.is-on { background-size: 100% 0.42em; transition-duration: 0.8s; }
.section-head p { font-size: 1.14rem; color: var(--ink-2); max-width: 40rem; }
.first-section { padding-top: clamp(7rem, 12vw, 10rem); }

@media (max-width: 900px) {
  .sheet-section { grid-template-columns: 1fr; padding-left: calc(var(--gutter) + 1.1rem); }
  .sheet-section::before { left: calc(var(--gutter) * 0.5); }
  .sheet-section > * { grid-column: 1; }
  .sheet-section > .gutter-note { display: none; }
}

/* ------------------------------------------------------------------ */
/* Tracker demo                                                          */
/* ------------------------------------------------------------------ */

.spread {
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  background: var(--paper);
  box-shadow: var(--shadow-sheet);
  border-radius: 4px;
  position: relative;
}
.spread::after {
  /* center fold */
  content: ""; position: absolute; top: 0; bottom: 0; left: 45%; width: 28px; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(21,23,26,0.08) 45%, rgba(21,23,26,0.14) 50%, rgba(21,23,26,0.08) 55%, transparent);
  pointer-events: none;
}
.spread-page { padding: 1.6rem clamp(1.2rem, 2.6vw, 2.2rem) 2rem; position: relative; }
.spread-page + .spread-page { border-left: 0; }
.spread-title {
  font-family: var(--f-hand); font-weight: 700; color: var(--pen); font-size: 1.45rem;
  border-bottom: 2px solid var(--rule-strong); padding-bottom: 0.35rem; margin-bottom: 1.2rem;
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap;
}
.spread-title small { font-family: var(--f-ui); font-weight: 600; font-size: 0.86rem; color: var(--ink-3); }

.allot-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.4rem 0.8rem; margin-bottom: 1.4rem; font-size: 1.05rem; }
.remaining { margin-bottom: 1.3rem; }
.remaining-figure {
  font-family: var(--f-display); font-stretch: 70%; font-weight: 900;
  font-size: clamp(3rem, 6vw, 4.6rem); line-height: 0.9; letter-spacing: -0.02em;
}
.remaining-figure.is-over { color: #b0263a; }
.remaining-label { font-weight: 600; color: var(--ink-2); margin-top: 0.35rem; }

.scale { margin: 0 0 1.4rem; }
.scale-bar {
  display: flex; height: 2.6rem; border: 2px solid var(--ink); border-radius: 3px; overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), var(--rule) calc(10% - 1px) 10%),
    #fff;
}
.scale-seg { height: 100%; transition: flex-basis 0.6s var(--ease-out); min-width: 0; }
.scale-seg[data-status="reimbursed"] { background: var(--hl-green); }
.scale-seg[data-status="submitted"] { background: var(--hl-yellow); }
.scale-seg[data-status="attention"] { background: var(--hl-pink); }
.scale-seg[data-status="draft"] { background: repeating-linear-gradient(135deg, var(--hl-grey) 0 6px, #eceee8 6px 12px); }
.scale-seg[data-status="denied"] { background: repeating-linear-gradient(45deg, #c9ccc4 0 2px, #fff 2px 7px); }
.scale-seg + .scale-seg { border-left: 1.5px solid var(--ink); }
.scale-ticks { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--ink-3); margin-top: 0.3rem; }

.tally { list-style: none; margin: 0; padding: 0; }
.tally li {
  display: grid; grid-template-columns: 1.1rem 1fr auto; align-items: center; gap: 0.7rem;
  min-height: var(--line); border-bottom: 1px solid var(--rule); font-size: 1rem;
}
.tally li:first-child { border-top: 1px solid var(--rule); }
.swatch { width: 1.1rem; height: 1.1rem; border: 1.5px solid var(--ink); border-radius: 2px; }
.swatch[data-status="reimbursed"] { background: var(--hl-green); }
.swatch[data-status="submitted"] { background: var(--hl-yellow); }
.swatch[data-status="attention"] { background: var(--hl-pink); }
.swatch[data-status="draft"] { background: repeating-linear-gradient(135deg, var(--hl-grey) 0 3px, #eceee8 3px 6px); }
.swatch[data-status="denied"] { background: repeating-linear-gradient(45deg, #c9ccc4 0 1.5px, #fff 1.5px 4px); }
.swatch[data-status="left"] { background: #fff; }
.tally .num { font-weight: 700; }

.quick-adds { margin-top: 1.6rem; }
.quick-adds-title { font-family: var(--f-hand); color: var(--pen); font-size: 1.2rem; margin-bottom: 0.5rem; }
.quick-adds-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tab-btn {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.75rem;
  padding: 0.45rem 0.85rem; border: 1.5px solid var(--ink); border-radius: 3px;
  background: #fff; font-weight: 600; font-size: 0.96rem; text-align: left;
  box-shadow: 0 1px 1px rgba(21,23,26,0.12), 0 6px 12px -8px rgba(21,23,26,0.45);
  transition: transform 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out), background-color 0.15s;
}
.tab-btn:hover { background: var(--hl-yellow); transform: translateY(-1px); box-shadow: 0 2px 2px rgba(21,23,26,0.12), 0 10px 16px -8px rgba(21,23,26,0.5); }
.tab-btn:active { transform: translateY(1px); box-shadow: 0 1px 1px rgba(21,23,26,0.12); }
.tab-btn .num { color: var(--ink-3); font-weight: 500; }
.tab-btn--warn:hover { background: var(--hl-pink); }
.tab-btn--quiet { box-shadow: none; border-color: var(--ink-3); color: var(--ink-2); }
.tab-btn--quiet:hover { box-shadow: none; background: var(--paper-shade); transform: none; }

/* Purchases list on ruled lines */
.purchases { list-style: none; margin: 0; padding: 0; }
.purchase {
  display: grid; grid-template-columns: 4.3rem minmax(0, 1fr) auto; gap: 0.25rem 0.9rem;
  padding: 0.7rem 0; border-bottom: 1px solid var(--rule); align-items: start;
}
.purchases .purchase:first-child { border-top: 1px solid var(--rule); }
.purchase.is-new { animation: purchase-in 0.6s var(--ease-out); }
@keyframes purchase-in { from { background: var(--hl-yellow); } to { background: transparent; } }
.purchase-date { font-size: 0.86rem; color: var(--ink-3); padding-top: 0.2rem; }
.purchase-what strong { display: block; font-weight: 700; line-height: 1.3; }
.purchase-what span { display: block; font-size: 0.93rem; color: var(--ink-2); line-height: 1.35; }
.purchase-amount { font-weight: 700; text-align: right; padding-top: 0.05rem; }
.purchase-meta { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin-top: 0.35rem; }
.purchase-flag { grid-column: 2 / -1; font-family: var(--f-hand); color: #b0263a; font-size: 1.05rem; line-height: 1.32; margin: 0.25rem 0 0; }
.purchase-flag svg { margin-right: 0.15rem; vertical-align: -0.15em; }
.status-select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  border: 1.5px solid var(--ink); border-radius: 3px; min-height: 2.5rem;
  padding: 0.3rem 2rem 0.3rem 0.6rem; font-size: 0.92rem; font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' fill='none' stroke='%2315171a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.6rem center;
  background-color: #fff;
}
.status-select[data-status="reimbursed"] { background-color: var(--hl-green); }
.status-select[data-status="submitted"] { background-color: var(--hl-yellow); }
.status-select[data-status="attention"] { background-color: var(--hl-pink); }
.status-select[data-status="draft"] { background-color: #eef0ea; }
.status-select[data-status="denied"] { background-color: #fff; text-decoration: line-through; }
.remove-btn {
  border: 0; background: none; color: var(--ink-3); font-size: 0.9rem; font-weight: 600;
  min-height: 2.5rem; padding: 0 0.4rem; text-decoration: underline; text-underline-offset: 0.2em;
}
.remove-btn:hover { color: #b0263a; }
.empty-line { padding: 1.2rem 0; color: var(--ink-3); border-bottom: 1px solid var(--rule); font-family: var(--f-hand); font-size: 1.2rem; }

.fixes { margin-top: 1.8rem; }
.fixes-title { font-family: var(--f-display); font-stretch: 78%; font-weight: 800; font-size: 1.35rem; margin-bottom: 0.6rem; display: flex; gap: 0.6rem; align-items: baseline; }
.fixes-list { list-style: none; margin: 0; padding: 0; }
.fixes-list li { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0.6rem; padding: 0.55rem 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.98rem; }
.fixes-list svg { margin-top: 0.2rem; }
.fixes-ok { font-family: var(--f-hand); font-size: 1.25rem; color: #177a3a; }

@media (max-width: 900px) {
  .spread { grid-template-columns: 1fr; }
  .spread::after { display: none; }
  .spread-page + .spread-page { border-top: 2px dashed var(--rule); }
}
@media (max-width: 560px) {
  .purchase { grid-template-columns: minmax(0, 1fr) auto; }
  .purchase-date { grid-column: 1 / -1; padding: 0; }
  .purchase-meta, .purchase-flag { grid-column: 1 / -1; }
}

/* Worksheet tabs */
.worksheet { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.ws-tabs { display: flex; gap: 0.35rem; padding-left: 1rem; flex-wrap: wrap; position: relative; z-index: 1; }
.ws-tab {
  border: 2px solid var(--ink); border-bottom: 0; border-radius: 8px 8px 0 0;
  background: var(--paper-shade); padding: 0.6rem 1.1rem 0.55rem; min-height: 2.9rem;
  font-family: var(--f-display); font-stretch: 85%; font-weight: 700; font-size: 1.02rem;
  margin-bottom: -2px; color: var(--ink-2);
}
.ws-tab:hover { background: var(--hl-yellow); color: var(--ink); }
.ws-tab[aria-selected="true"] { background: #fff; color: var(--ink); position: relative; }
.ws-panel {
  border: 2px solid var(--ink); border-radius: 4px; background: #fff;
  padding: clamp(1.3rem, 3vw, 2.2rem);
  box-shadow: var(--shadow-lift);
}
.ws-panel[hidden] { display: none; }
.ws-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 1.2rem; align-items: end; }
.ws-result {
  min-height: 3rem; display: flex; align-items: center; padding: 0 0.2rem;
  font-family: var(--f-display); font-stretch: 72%; font-weight: 900; font-size: 2.2rem;
}
.ws-note {
  margin-top: 1.2rem; padding: 0.9rem 1rem; border: 1.5px dashed var(--rule-strong); border-radius: 3px;
  font-family: var(--f-hand); font-size: 1.15rem; color: var(--pen); line-height: 1.4; background: #fbfcff;
}
.ws-actions { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; align-items: center; margin-top: 1.1rem; }
.ws-small { font-size: 0.9rem; color: var(--ink-3); }
@media (max-width: 700px) { .ws-grid { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ */
/* Receipt check section                                                  */
/* ------------------------------------------------------------------ */

.check-layout { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.receipt-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin-bottom: 1.8rem; }
.receipt-pick {
  display: grid; text-align: left; gap: 0.1rem; min-height: 3.4rem;
  border: 1.5px solid var(--ink); border-radius: 3px; background: var(--receipt);
  padding: 0.5rem 0.7rem; font-family: var(--f-receipt); font-size: 0.76rem; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  box-shadow: 0 1px 1px rgba(21,23,26,0.12), 0 6px 12px -8px rgba(21,23,26,0.45);
  transition: transform 0.15s var(--ease-out), box-shadow 0.15s, background-color 0.15s;
}
.receipt-pick b { font-family: var(--f-ui); font-size: 0.95rem; }
.receipt-pick:hover { background: var(--hl-yellow); transform: translateY(-1px); }
.receipt-pick[aria-pressed="true"] { background: var(--ink); color: #fff; }
.check-receipt { max-width: 25rem; transform: rotate(-1.2deg); }

.checklist { list-style: none; margin: 0; padding: 0; }
.check-item {
  display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 0.2rem 0.9rem;
  padding: 0.95rem 0; border-bottom: 1px solid var(--rule);
}
.checklist .check-item:first-child { border-top: 2px solid var(--rule-strong); }
.check-box {
  width: 1.7rem; height: 1.7rem; border: 2px solid var(--ink); border-radius: 3px; background: #fff;
  display: grid; place-items: center; margin-top: 0.1rem;
}
.check-item h3 { font-size: 1.28rem; margin-bottom: 0.25rem; }
.check-item p { color: var(--ink-2); font-size: 1rem; }
.check-result { grid-column: 2; font-family: var(--f-hand); font-size: 1.15rem; line-height: 1.3; margin-top: 0.35rem; }
.check-result[data-state="ok"] { color: #177a3a; }
.check-result[data-state="fix"] { color: #b0263a; }
.check-result[data-state="note"] { color: var(--pen); }
.check-result:empty { display: none; }
.check-footer { margin-top: 1.4rem; display: flex; flex-wrap: wrap; gap: 0.8rem 1.2rem; align-items: center; }
.boundary-line { font-size: 0.95rem; color: var(--ink-2); margin-top: 1.8rem; max-width: 42rem; padding-top: 0.9rem; border-top: 1.5px dashed var(--rule); }
.boundary-line .hand { color: var(--pen); font-size: 1.15rem; font-weight: 700; margin-right: 0.2rem; }

@media (max-width: 900px) { .check-layout { grid-template-columns: 1fr; } .check-receipt { max-width: 22rem; } }

/* ------------------------------------------------------------------ */
/* Purchase guide                                                         */
/* ------------------------------------------------------------------ */

.guide-tools { display: flex; flex-wrap: wrap; gap: 0.8rem 1.2rem; align-items: end; margin-bottom: 1.4rem; }
.search {
  position: relative; flex: 1 1 20rem; max-width: 30rem;
}
.search svg { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 2.7rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; border: 0; margin: 0; padding: 0; }
.filters legend { width: 100%; margin-bottom: 0.3rem; }
.filter {
  min-height: 2.75rem; padding: 0.4rem 0.85rem; border: 1.5px solid var(--ink); border-radius: 999px;
  background: #fff; font-weight: 600; font-size: 0.95rem;
}
.filter:hover { background: var(--paper-shade); }
.filter[aria-pressed="true"] { background: var(--ink); color: #fff; }

.guide-table { width: 100%; border-collapse: collapse; }
.guide-table caption { text-align: left; font-size: 0.92rem; color: var(--ink-3); padding-bottom: 0.6rem; }
.guide-table th {
  text-align: left; font-family: var(--f-display); font-stretch: 85%; font-weight: 800; font-size: 0.82rem;
  letter-spacing: 0.08em; text-transform: uppercase; padding: 0.6rem 0.8rem 0.6rem 0; border-bottom: 2px solid var(--rule-strong);
}
.guide-table td { padding: 0.95rem 0.8rem 0.95rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; font-size: 0.98rem; }
.guide-table td:first-child { font-weight: 700; width: 24%; }
.guide-table td:nth-child(2) { width: 18%; color: var(--ink-2); }
.guide-table td:last-child { width: 16%; }
.guide-keep { display: block; margin-top: 0.35rem; font-family: var(--f-hand); color: var(--pen); font-size: 1.08rem; line-height: 1.3; }
.status-word { font-weight: 700; white-space: nowrap; }
.guide-empty { padding: 1.4rem 0; font-family: var(--f-hand); font-size: 1.25rem; color: var(--ink-2); border-bottom: 1px solid var(--rule); }
.guide-meta { margin-top: 1rem; font-size: 0.92rem; color: var(--ink-3); }

@media (max-width: 760px) {
  .guide-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .guide-table, .guide-table tbody, .guide-table tr, .guide-table td { display: block; width: auto !important; }
  .guide-table tr { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.8rem; }
  .guide-table td { border: 0; padding: 0; }
  .guide-table td:first-child { grid-column: 1; }
  .guide-table td:last-child { grid-column: 2; grid-row: 1; text-align: right; }
  .guide-table td:nth-child(2) { grid-column: 1 / -1; font-size: 0.9rem; }
  .guide-table td:nth-child(3) { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------------ */
/* Does / doesn't                                                          */
/* ------------------------------------------------------------------ */

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); }
.col-title { font-family: var(--f-hand); font-weight: 700; font-size: 1.6rem; color: var(--pen); border-bottom: 2px solid var(--rule-strong); padding-bottom: 0.2rem; margin-bottom: 0.2rem; }
.mark-list { list-style: none; margin: 0; padding: 0; }
.mark-list li { display: grid; grid-template-columns: 1.6rem 1fr; gap: 0.6rem; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
.mark-list svg { margin-top: 0.25rem; }
.callout-note {
  margin-top: 2rem; padding: 1.2rem 1.4rem; background: var(--hl-yellow);
  transform: rotate(-0.8deg); max-width: 40rem; box-shadow: var(--shadow-lift);
  font-size: 1.02rem;
}
.callout-note strong { font-family: var(--f-display); font-stretch: 80%; font-weight: 800; font-size: 1.15rem; display: block; margin-bottom: 0.2rem; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ */
/* Compare + pricing                                                     */
/* ------------------------------------------------------------------ */

.compare { width: 100%; border-collapse: collapse; margin-bottom: 3rem; }
.compare th, .compare td { text-align: left; padding: 0.9rem 1rem 0.9rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.compare thead th { font-family: var(--f-display); font-stretch: 80%; font-weight: 800; font-size: 1.1rem; border-bottom: 2px solid var(--rule-strong); }
.compare tbody th { font-weight: 700; width: 22%; }
.compare .is-us { background: linear-gradient(transparent, transparent); }
.compare td.is-us { font-weight: 600; }
.compare thead th.is-us span { background: var(--hl-yellow); padding: 0 0.2em; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 calc(var(--gutter) * -0.25); padding: 0 calc(var(--gutter) * 0.25); }
.table-scroll .compare { min-width: 38rem; }

.editions { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 2px solid var(--ink); border-radius: 4px; background: #fff; box-shadow: var(--shadow-sheet); }
.edition { padding: clamp(1.4rem, 3vw, 2.4rem); }
.edition + .edition { border-left: 2px dashed var(--ink-3); }
.edition h3 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); margin-bottom: 0.4rem; }
.edition-who { color: var(--ink-2); margin-bottom: 1.2rem; }
.price { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 1.2rem; }
.price b { font-family: var(--f-display); font-stretch: 70%; font-weight: 900; font-size: 4rem; line-height: 0.9; }
.price span { color: var(--ink-2); font-weight: 600; }
.edition ul { list-style: none; margin: 0; padding: 0; }
.edition li { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0.5rem; padding: 0.5rem 0; border-bottom: 1px solid var(--rule-soft); }
.edition li svg { margin-top: 0.2rem; }
.sale-state {
  display: flex; flex-wrap: wrap; gap: 1rem 1.6rem; align-items: center; justify-content: space-between;
  margin-top: 1.4rem; padding: 1.2rem 1.4rem; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper-shade);
}
.sale-state p { margin: 0; max-width: 40rem; }
.sale-state strong { font-family: var(--f-display); font-stretch: 80%; font-weight: 800; font-size: 1.2rem; }
@media (max-width: 760px) {
  .editions { grid-template-columns: 1fr; }
  .edition + .edition { border-left: 0; border-top: 2px dashed var(--ink-3); }
}

/* ------------------------------------------------------------------ */
/* Sources + FAQ                                                          */
/* ------------------------------------------------------------------ */

.sources { list-style: none; margin: 0; padding: 0; }
.sources li { padding: 1rem 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.3rem 1.5rem; align-items: baseline; }
.sources li:first-child { border-top: 2px solid var(--rule-strong); }
.sources strong { font-size: 1.05rem; }
.sources p { grid-column: 1; color: var(--ink-2); font-size: 0.97rem; margin: 0; }
.sources a { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 700; white-space: nowrap; }
@media (max-width: 640px) { .sources li { grid-template-columns: 1fr; } .sources a { grid-column: 1; grid-row: auto; } }

.faq { border-top: 2px solid var(--rule-strong); max-width: 50rem; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) 1.5rem; gap: 0.5rem; align-items: start;
  padding: 1.05rem 0; font-weight: 700; font-size: 1.12rem; line-height: 1.35; min-height: 3rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "Q."; font-family: var(--f-hand); font-weight: 700; color: var(--pen); font-size: 1.3rem; line-height: 1.1; }
.faq summary::after {
  content: ""; width: 0.8rem; height: 0.8rem; margin-top: 0.35rem; justify-self: end;
  border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg);
  transition: transform 0.25s var(--ease-out);
}
.faq details[open] summary::after { transform: rotate(-135deg) translate(-0.2rem, -0.2rem); }
.faq summary:hover { background: linear-gradient(transparent 62%, var(--hl-yellow) 62%, var(--hl-yellow) 90%, transparent 90%); }
.faq-answer { padding: 0 1.5rem 1.2rem 2.7rem; color: var(--ink-2); }
.faq-answer ul { margin: 0.4rem 0 0.8rem; padding-left: 1.2rem; }

/* ------------------------------------------------------------------ */
/* Back cover (footer)                                                   */
/* ------------------------------------------------------------------ */

.back-cover {
  margin-top: clamp(4rem, 8vw, 7rem);
  background: var(--marble) url("marble.svg") 0 0 / 640px 640px;
  padding: clamp(3rem, 6vw, 5rem) var(--gutter);
  border-top: 10px solid #111214;
}
.table-card {
  max-width: var(--wrap); margin: 0 auto; background: #fff; color: var(--ink);
  border-radius: 6px; padding: clamp(1.5rem, 3.5vw, 2.8rem);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink), 0 20px 40px -20px rgba(0,0,0,0.7);
}
.table-card-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 1.5rem 2rem; }
.table-card h2 { font-size: 1.6rem; font-stretch: 72%; margin-bottom: 0.5rem; }
.table-card h3 {
  font-size: 0.86rem; font-stretch: 85%; letter-spacing: 0.1em; text-transform: uppercase;
  border-bottom: 2px solid var(--ink); padding-bottom: 0.35rem; margin-bottom: 0.4rem;
}
.table-card ul { list-style: none; margin: 0; padding: 0; }
.table-card li { border-bottom: 1px solid var(--rule); }
.table-card li a, .table-card li span { display: flex; justify-content: space-between; gap: 0.6rem; min-height: 2.6rem; align-items: center; font-size: 0.97rem; }
.table-card li a { color: var(--ink); text-decoration: none; font-weight: 600; }
.table-card li a:hover { background: var(--hl-yellow); }
.table-card li em { font-style: normal; font-family: var(--f-hand); color: var(--pen); font-size: 1rem; }
.table-card p { color: var(--ink-2); font-size: 0.95rem; }
.independence {
  margin-top: 1.8rem; padding-top: 1.2rem; border-top: 3px double var(--ink);
  font-size: 0.9rem; color: var(--ink-2); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 2rem; align-items: end;
}
.independence p { margin: 0; max-width: 60rem; }
.independence small { color: var(--ink-3); white-space: nowrap; }
@media (max-width: 900px) { .table-card-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .table-card-grid { grid-template-columns: 1fr; } .independence { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ */
/* Home: notebook shelf                                                  */
/* ------------------------------------------------------------------ */

.shelf-wrap { align-self: center; padding-bottom: clamp(2.5rem, 6vw, 5rem); }
.sticky {
  display: inline-block; background: var(--hl-yellow); color: var(--ink);
  font-family: var(--f-hand); font-weight: 700; font-size: 1.3rem; line-height: 1.2;
  padding: 0.55rem 0.9rem 0.6rem; transform: rotate(-2.5deg); margin: 0 0 1.6rem 0.4rem;
  box-shadow: 0 10px 18px -10px rgba(0,0,0,0.8);
}
.shelf {
  position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(0.7rem, 1.6vw, 1.3rem);
  align-items: end; padding: 0 0.6rem 1.7rem;
}
.shelf::after {
  content: ""; position: absolute; left: -1.2rem; right: -1.2rem; bottom: 0; height: 1.7rem;
  background: linear-gradient(#e9e3d6, #cfc6b2); border-radius: 3px;
  box-shadow: 0 16px 26px -10px rgba(0,0,0,0.9), inset 0 2px 0 rgba(255,255,255,0.6), inset 0 -3px 0 rgba(0,0,0,0.15);
}
.book {
  --cover: #1d4cbc;
  position: relative; display: flex; flex-direction: column;
  aspect-ratio: 0.72; border-radius: 3px 9px 9px 3px; text-decoration: none; color: var(--ink);
  background-color: var(--cover);
  background-image: url("marble.svg");
  background-size: 300px 300px;
  background-blend-mode: lighten;
  box-shadow: inset 14px 0 0 #111214, inset 15px 0 0 rgba(255,255,255,0.25), 0 20px 30px -14px rgba(0,0,0,0.95), 0 0 0 1px rgba(0,0,0,0.6);
  padding: 20% 9% 10% 22%;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
  z-index: 1;
}
.book--fl { --cover: #d23a3f; transform: rotate(-1.5deg); }
.book--az { --cover: #1d4cbc; transform: translateY(0.5rem) rotate(1.2deg); }
.book--ut { --cover: #177a3a; transform: translateY(0.2rem) rotate(-0.6deg); }
a.book:hover { transform: translateY(-0.9rem) rotate(-1deg); color: var(--ink); box-shadow: inset 14px 0 0 #111214, inset 15px 0 0 rgba(255,255,255,0.25), 0 32px 36px -14px rgba(0,0,0,0.95), 0 0 0 1px rgba(0,0,0,0.6); }
a.book:focus-visible { outline: 3px solid var(--hl-yellow); outline-offset: 4px; }
.book-label {
  background: #fff; border-radius: 0.7rem; padding: 0.75rem 0.8rem 0.8rem;
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 3px var(--ink);
}
.book-label strong { display: block; font-family: var(--f-display); font-stretch: 66%; font-weight: 900; font-size: clamp(1.1rem, 2.1vw, 1.75rem); line-height: 0.92; margin-bottom: 0.4rem; }
.book-label span { display: block; font-family: var(--f-hand); color: var(--pen); font-size: 1rem; line-height: 1.3; border-top: 1.5px solid var(--ink); padding-top: 0.3rem; }
.book-state {
  margin-top: auto; align-self: flex-start;
  font-family: var(--f-display); font-stretch: 85%; font-weight: 800; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--hl-green); color: var(--ink); padding: 0.3rem 0.55rem; border-radius: 2px; box-shadow: 0 0 0 1.5px var(--ink);
}
.book--soon .book-state { background: #fff; }
.book-open {
  display: block; margin-top: 0.6rem; font-family: var(--f-display); font-stretch: 85%; font-weight: 800; font-size: 0.95rem;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

@media (max-width: 700px) {
  .book { padding: 18% 7% 9% 21%; box-shadow: inset 9px 0 0 #111214, 0 16px 24px -12px rgba(0,0,0,0.95), 0 0 0 1px rgba(0,0,0,0.6); }
  .book-label { padding: 0.45rem 0.45rem 0.5rem; border-radius: 0.45rem; }
  .book-label span { font-size: 0.8rem; }
  .book-state { font-size: 0.7rem; padding: 0.25rem 0.35rem; letter-spacing: 0.04em; }
}

.feature-lines { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--rule-strong); max-width: 56rem; }
.feature-lines li { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 0.4rem 2rem; padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
.feature-lines h3 { font-size: 1.35rem; }
.feature-lines p { color: var(--ink-2); }
@media (max-width: 700px) { .feature-lines li { grid-template-columns: 1fr; } }

.promises { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.2rem, 3vw, 2.5rem); max-width: 64rem; }
.promise { border-top: 3px solid var(--ink); padding-top: 0.9rem; }
.promise h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.promise p { color: var(--ink-2); }
.promise .note { margin-top: 0.6rem; font-size: 1.08rem; }
@media (max-width: 800px) { .promises { grid-template-columns: 1fr; } }

.state-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--rule-strong); max-width: 56rem; }
.state-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.3rem 1.5rem; padding: 1rem 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.state-list strong { font-size: 1.12rem; }
.state-list p { grid-column: 1; margin: 0; color: var(--ink-2); font-size: 0.98rem; }
.state-list .state-tag { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 700; }
@media (max-width: 560px) { .state-list li { grid-template-columns: 1fr; } .state-list .state-tag { grid-column: 1; grid-row: auto; } }


/* ------------------------------------------------------------------ */
/* Toast + print                                                          */
/* ------------------------------------------------------------------ */

.toast {
  position: fixed; left: 50%; bottom: 1.4rem; z-index: 80; transform: translate(-50%, 1rem);
  background: var(--ink); color: #fff; padding: 0.8rem 1.2rem; border-radius: 4px;
  font-weight: 600; box-shadow: var(--shadow-lift); opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.35s var(--ease-out); max-width: calc(100vw - 2rem);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

#print-summary { display: none; }
@media print {
  body > *:not(#print-summary) { display: none !important; }
  #print-summary { display: block !important; font: 11pt/1.45 -apple-system, "Segoe UI", Arial, sans-serif; color: #000; }
  #print-summary h1 { font: 700 16pt/1.2 Arial, sans-serif; margin: 0 0 4pt; }
  #print-summary table { width: 100%; border-collapse: collapse; margin: 10pt 0; }
  #print-summary th, #print-summary td { border: 1px solid #999; padding: 4pt 6pt; text-align: left; font-size: 9.5pt; }
  #print-summary td.r, #print-summary th.r { text-align: right; }
  #print-summary .ps-note { font-size: 9pt; color: #333; border-top: 1px solid #999; padding-top: 6pt; margin-top: 12pt; }
}

.guide-where { display: block; margin-top: 0.3rem; font-weight: 500; font-size: 0.82rem; color: var(--ink-3); }

/* ------------------------------------------------------------------ */
/* Guide pages                                                          */
/* ------------------------------------------------------------------ */

.cover--short .label { margin-bottom: clamp(2rem, 5vw, 4rem); }
.cover--short .label h1 { font-size: clamp(2.5rem, 4.8vw, 4.3rem); }
.crumbs { font-size: 0.9rem; color: var(--ink-3); margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.crumbs a { color: var(--ink-2); }

.toc { padding: calc(3.6rem + 2px) 1.6rem 2rem 4.3rem; min-height: 0; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; min-height: var(--line); display: flex; align-items: center; }
.toc a {
  display: flex; align-items: baseline; gap: 0.8rem; width: 100%; min-height: var(--line);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1.02rem;
}
.toc a::before { content: counter(toc); font-family: var(--f-hand); color: var(--pen); font-size: 1.2rem; width: 1.2rem; text-align: right; }
.toc a:hover { background: linear-gradient(transparent 58%, var(--hl-yellow) 58%, var(--hl-yellow) 92%, transparent 92%); }

.prose { max-width: 44rem; }
p.prose { color: var(--ink-2); margin-top: 1.2rem; }
.sub { font-size: 1.5rem; margin: 2.2rem 0 0.4rem; }
.plain { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--rule-strong); }
.plain li { padding: 0.85rem 0; border-bottom: 1px solid var(--rule); }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; max-width: 46rem; border-top: 2px solid var(--rule-strong); }
.steps li { counter-increment: step; position: relative; padding: 0.95rem 0 0.95rem 3rem; border-bottom: 1px solid var(--rule); }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0.8rem; width: 2.2rem; text-align: right; font-family: var(--f-hand); font-weight: 700; font-size: 1.6rem; line-height: 1.2; color: var(--pen); }

@media (max-width: 900px) { .toc { transform: rotate(0.6deg); } }
@media (max-width: 560px) { .toc { padding: calc(3.6rem + 2px) 1rem 1.6rem 3.4rem; } }

/* Text pages (about, privacy, 404) */
.doc h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin: 2.4rem 0 0.7rem; }
.doc p, .doc li { max-width: 44rem; color: var(--ink-2); }
.doc ul { padding-left: 1.2rem; }

/* Markdown guides (see eleventy.config.js "sectionize") */
.md-body { max-width: 46rem; }
.md-body > * + * { margin-top: 1.1rem; }
.md-body p { color: var(--ink-2); }
.md-body h3 { font-size: 1.5rem; margin-top: 2.2rem; }
.md-body ul { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--rule-strong); }
.md-body ul li { padding: 0.8rem 0 0.8rem 1.6rem; border-bottom: 1px solid var(--rule); position: relative; }
.md-body ul li::before { content: ""; position: absolute; left: 0.2rem; top: 1.35rem; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--pen); }
.md-body ol { list-style: none; margin: 0; padding: 0; counter-reset: step; border-top: 2px solid var(--rule-strong); }
.md-body ol li { counter-increment: step; position: relative; padding: 0.95rem 0 0.95rem 3rem; border-bottom: 1px solid var(--rule); }
.md-body ol li::before { content: counter(step); position: absolute; left: 0; top: 0.8rem; width: 2.2rem; text-align: right; font-family: var(--f-hand); font-weight: 700; font-size: 1.6rem; line-height: 1.2; color: var(--pen); }
.md-body blockquote { margin: 1.8rem 0 0; padding: 1.2rem 1.4rem; background: var(--hl-yellow); transform: rotate(-0.8deg); box-shadow: var(--shadow-lift); color: var(--ink); }
.md-body blockquote p { color: var(--ink); margin: 0; }
.md-body table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.md-body thead th { font-family: var(--f-display); font-stretch: 80%; font-weight: 800; font-size: 1.05rem; text-align: left; border-bottom: 2px solid var(--rule-strong); padding: 0.7rem 1rem 0.7rem 0; }
.md-body td { padding: 0.85rem 1rem 0.85rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; color: var(--ink-2); }
.md-body td:first-child { font-weight: 700; color: var(--ink); white-space: nowrap; }
@media (max-width: 640px) { .md-body td:first-child { white-space: normal; } }

/* Quick answers (guide pages) */
.qa { margin: 0; max-width: 46rem; border-top: 2px solid var(--rule-strong); }
.qa-item { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.qa dt { font-family: var(--f-display); font-stretch: 82%; font-weight: 800; font-size: 1.22rem; line-height: 1.2; margin-bottom: 0.35rem; }
.qa dd { margin: 0; color: var(--ink-2); }
