:root {
  --paper: #f3ede1;
  --paper-deep: #e8dfcd;
  --ink: #2a2724;
  --ink-soft: #4f4a44;
  --rust: #9a4426;
  --rust-soft: #c98a6a;
  --wood: #3b332c;
  --line: #cfc3ad;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --measure: 38rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.5), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(120,90,60,.05), transparent 45%);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

a { color: var(--rust); text-underline-offset: .18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--rust); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 10;
}
.skip:focus { top: 1rem; color: var(--paper); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Navigation */
.site-head { border-bottom: 1px solid var(--line); }
.nav {
  max-width: 70rem; margin: 0 auto; padding: .8rem 1rem;
  display: flex; flex-wrap: wrap; gap: .4rem 1rem;
  justify-content: space-between; align-items: center;
  font-family: var(--sans); font-size: .9rem;
}
.nav-title { color: var(--ink-soft); letter-spacing: .02em; }
.nav-home { font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--rust); padding: .3rem 0; }

/* Hero */
.hero { max-width: var(--measure); margin: 0 auto; padding: 3rem 1rem 1rem; }
.kicker {
  font-family: var(--sans); font-size: .8rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--rust); margin: 0 0 .6rem;
}
h1 {
  font-size: clamp(2.2rem, 7vw, 3.6rem); line-height: 1.05;
  font-weight: 600; letter-spacing: -.01em; margin: 0 0 1rem;
}
.standfirst { font-size: 1.25rem; color: var(--ink-soft); margin: 0 0 1.5rem; }
.hero-art { width: 100%; height: auto; display: block; margin: 1rem 0 0; }
.ink-fill { fill: var(--wood); }
.paper-fill { fill: #faf6ee; }
.ink-line { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.ink-line.thin { stroke-width: 1.6; }
.rust-fill { fill: var(--rust); }
.lens { fill: rgba(255,255,255,.25); stroke: var(--ink); stroke-width: 3; }
.handle { stroke: var(--ink); stroke-width: 8; stroke-linecap: round; }
.drawer-mini { fill: var(--paper-deep); stroke: var(--wood); stroke-width: 2; }

/* Essay */
.essay { max-width: var(--measure); margin: 0 auto; padding: 1rem 1rem 2rem; }
.essay h2 {
  font-size: 1.5rem; line-height: 1.25; margin: 2.8rem 0 .8rem;
  padding-top: 1.2rem; border-top: 1px solid var(--line);
}
.essay p { margin: 0 0 1.1rem; }
.lede::first-letter {
  float: left; font-size: 3.6rem; line-height: .85;
  padding: .3rem .5rem 0 0; color: var(--rust);
}
.principle {
  font-size: 1.3rem; line-height: 1.5;
  border-left: 4px solid var(--rust); padding: .4rem 0 .4rem 1rem; margin: 1.6rem 0;
}
.byline { font-family: var(--sans); font-size: .9rem; color: var(--ink-soft); }

/* Cabinet */
.cabinet-wrap { max-width: 56rem; margin: 1rem auto 0; padding: 2rem 1rem; }
.cabinet-wrap > h2 { font-size: 1.7rem; margin: 0 0 .5rem; }
.cabinet-intro { max-width: var(--measure); color: var(--ink-soft); }
.cabinet {
  display: grid; grid-template-columns: 1fr; gap: .9rem; align-items: start;
  background: var(--wood);
  padding: 1rem; border-radius: 4px;
  box-shadow: 0 2px 0 #1e1a16, 0 14px 30px -18px rgba(0,0,0,.5);
}
@media (min-width: 700px) { .cabinet { grid-template-columns: 1fr 1fr; padding: 1.4rem; } }

.drawer {
  background: linear-gradient(#f6f0e3, var(--paper-deep));
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px #c9bca2, 0 3px 0 #241f1a;
}
.drawer summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.1rem; min-height: 3.5rem;
  font-family: var(--sans); font-weight: 600; font-size: 1rem;
}
.drawer summary::-webkit-details-marker { display: none; }
.drawer summary::marker { content: ""; }
.drawer .label {
  background: #fffaf0; border: 1px solid #b9ab90; padding: .2rem .6rem;
  box-shadow: 1px 1px 0 rgba(0,0,0,.08);
}
.drawer summary::after {
  content: ""; flex: none; width: 2.4rem; height: .7rem;
  border: 2px solid var(--rust); border-top: none;
  border-radius: 0 0 1.2rem 1.2rem;
  transition: transform .2s ease;
}
.drawer[open] summary::after { transform: translateY(3px); }
.drawer summary:hover .label { border-color: var(--rust); }
.panel {
  padding: .2rem 1.1rem 1.1rem; font-size: 1.02rem;
  border-top: 1px dashed #b9ab90;
}
.panel p { margin: .8rem 0; }
.q { font-style: italic; color: var(--rust); }
.pick-label { font-family: var(--sans); font-size: .9rem; display: inline-flex; gap: .5rem; align-items: center; cursor: pointer; padding: .3rem 0; }
.pick-label[hidden] { display: none; }
.pick { width: 1.15rem; height: 1.15rem; accent-color: var(--rust); }

/* Note builder */
.note-builder { margin-top: 2rem; max-width: var(--measure); }
.note-builder h3 { font-size: 1.3rem; margin: 0 0 .4rem; }
.small { font-family: var(--sans); font-size: .9rem; color: var(--ink-soft); }
.note {
  white-space: pre-wrap; font-family: var(--serif); font-size: 1rem;
  background: #fffaf0; border: 1px solid var(--line);
  padding: 1rem; min-height: 6rem; margin: 1rem 0 .4rem;
  box-shadow: 3px 3px 0 var(--paper-deep);
}
.status { min-height: 1.5rem; font-family: var(--sans); font-size: .9rem; margin: .2rem 0 .6rem; }
.note-actions { display: flex; flex-wrap: wrap; gap: .7rem; }
button {
  font: 600 .95rem var(--sans); cursor: pointer;
  background: var(--ink); color: var(--paper);
  border: 2px solid var(--ink); border-radius: 3px; padding: .6rem 1.1rem; min-height: 2.75rem;
}
button:hover:not(:disabled) { background: var(--rust); border-color: var(--rust); }
button.quiet { background: transparent; color: var(--ink); }
button.quiet:hover:not(:disabled) { color: var(--paper); }
button:disabled { opacity: .45; cursor: not-allowed; }

/* Return + footer */
.return { max-width: var(--measure); margin: 0 auto; padding: 1rem 1rem 3rem; }
.return a { font-size: 1.35rem; font-weight: 600; }
.site-foot {
  border-top: 1px solid var(--line); padding: 1.5rem 1rem;
  text-align: center; font-family: var(--sans); font-size: .9rem; color: var(--ink-soft);
}
.site-foot p { margin: 0; }

/* 404 */
.lost { max-width: var(--measure); margin: 0 auto; padding: 4rem 1rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .nav, .cabinet-wrap, .return, .skip { display: none; }
  body { background: #fff; }
}
