/* Exemplar: paper, ink and a teacher's red pen.
   One warm neutral ramp, one accent (the pen), Newsreader for reading, Instrument Sans for the interface,
   Caveat only for the reviewer's handwriting. */

:root {
  --paper: #f7f4ee;
  --sheet: #fffdf8;
  --card: #fdfbf7;
  --raised: #efe9df;
  --ink: #1f1b16;
  --ink-2: #5e554a;
  --ink-3: #746b5f;
  --hair: rgba(31, 27, 22, 0.1);
  --hair-strong: rgba(31, 27, 22, 0.18);
  --pen: #b8321f;          /* red pen marks and the one key figure */
  --pen-ink: #a32a18;      /* pen as text on paper, 5.9:1 */
  --pen-wash: rgba(184, 50, 31, 0.08);
  --good: #2f6b45;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;

  --r-sm: 6px;
  --r: 10px;
  --r-card: 14px;
  --r-panel: 18px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 150ms;
  --mid: 200ms;
  --slow: 420ms;

  --shadow-sm: 0 1px 2px rgba(31, 27, 22, 0.06);
  --shadow-sheet: 0 1px 2px rgba(31, 27, 22, 0.05), 0 12px 32px rgba(31, 27, 22, 0.08);
  --page-pad: 32px;
  --max: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: rgba(184, 50, 31, 0.16); }

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

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--page-pad); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.logo-word { font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: -0.01em; line-height: 1; }
.logo-mark { width: 22px; height: 22px; color: var(--pen); }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 20; background: rgba(247, 244, 238, 0.86);
  backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid transparent; transition: border-color var(--mid) var(--ease); }
.nav.scrolled { border-bottom-color: var(--hair); }
.nav-in { height: 64px; display: flex; align-items: center; gap: 32px; }
.nav-links { display: flex; gap: 24px; margin-right: auto; }
.nav-links a, .nav-quiet { font-size: 14px; color: var(--ink-2); text-decoration: none;
  transition: color var(--fast) var(--ease); }
.nav-links a:hover, .nav-quiet:hover { color: var(--ink); }
.nav-end { display: flex; align-items: center; gap: 20px; margin-left: auto; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--r); border: 1px solid transparent;
  font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease),
              color var(--fast) var(--ease), transform var(--fast) var(--ease); }
.btn:active { transform: scale(0.98); }
.btn svg { width: 18px; height: 18px; }
.btn-ink { background: var(--ink); color: #fbf8f2; }
.btn-ink:hover { background: #3a332b; }
.btn-line { background: transparent; border-color: var(--hair-strong); color: var(--ink); }
.btn-line:hover { background: var(--raised); }
.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; }
.btn[disabled], .btn.is-busy { opacity: 0.55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink-2); padding: 0 12px; }
.btn-ghost:hover { color: var(--ink); background: var(--raised); }

/* ---------- red pen ---------- */
.pen { color: var(--pen); }
.pen-hand { font-family: var(--hand); color: var(--pen); font-weight: 500; line-height: 1; }
.pen-path { fill: none; stroke: var(--pen); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pen-draw .pen-path { stroke-dasharray: var(--len, 600); stroke-dashoffset: var(--len, 600);
  animation: pen-draw 900ms var(--ease) forwards; animation-delay: var(--d, 0ms); }
@keyframes pen-draw { to { stroke-dashoffset: 0; } }
.strike { position: relative; display: inline-block; }
.strike::after { content: ""; position: absolute; left: -4px; right: -4px; top: 54%; height: 2px;
  background: var(--pen); border-radius: 2px; transform: rotate(-2deg); }

/* ---------- forms ---------- */
.field { display: grid; gap: 8px; }
.label { font-size: 14px; font-weight: 500; }
.hint { font-size: 13px; color: var(--ink-3); }
.input, .textarea, .select { width: 100%; border: 1px solid var(--hair-strong); background: var(--sheet);
  border-radius: var(--r); padding: 10px 12px; font-size: 15px; line-height: 1.5;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.input, .select { height: 44px; }
.textarea { min-height: 140px; resize: vertical; }
.input:hover, .textarea:hover, .select:hover { border-color: rgba(31, 27, 22, 0.3); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(31, 27, 22, 0.08); }
.input::placeholder, .textarea::placeholder { color: #9a9083; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important;
    transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .pen-draw .pen-path { stroke-dashoffset: 0; }
}

@media (max-width: 720px) {
  :root { --page-pad: 20px; }
  .nav-links { display: none; }
}
