:root {
    --kraft: #c4ab7c;
    --kraft-dark: #a88d5c;
    --paper: #ece4cf;
    --ink: #221f1a;
    --stamp-red: #b3261e;
    --stamp-violet: #4b3f78;
    --serif: "PT Serif", Georgia, "Times New Roman", serif;
    --mono: "PT Mono", "Courier New", monospace;
    --stamp: "Oswald", "Arial Narrow", Impact, sans-serif;
  }
  * { box-sizing: border-box; }
  html { background: var(--kraft-dark); }
  body {
    margin: 0;
    color: var(--ink);
    font: 1.1rem/1.7 var(--serif);
    background: var(--kraft-dark);
  }
  a { color: var(--stamp-violet); }
  a:focus-visible, button:focus-visible { outline: 3px solid var(--stamp-red); outline-offset: 3px; }

  /* ---------- Folder cover (hero) ---------- */
  .folder {
    position: relative;
    max-width: 80rem;
    margin: 2.5rem auto 0;
    padding: 3rem clamp(1.5rem, 5vw, 4rem) 4rem;
    background:
      radial-gradient(ellipse at 20% 10%, rgba(255,255,255,.18), transparent 60%),
      radial-gradient(ellipse at 80% 90%, rgba(80,50,10,.18), transparent 55%),
      var(--kraft);
    border-radius: 2px 14px 2px 2px;
    box-shadow: 0 1px 0 #d8c298 inset, 0 18px 40px rgba(40,25,5,.35);
    overflow: hidden;
    container-type: inline-size;
  }
  .folder::before { /* folder tab */
    content: "";
    position: absolute; top: 0; right: 0;
    width: 30%; height: 10px;
    background: var(--kraft-dark);
    opacity: .5;
  }
  .folder-head {
    display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    font-family: var(--mono); font-size: .95rem;
    border-bottom: 2px solid var(--ink);
    padding-bottom: .6rem;
  }
  .folder h1 {
    font-family: var(--stamp);
    font-weight: 700;
    font-size: min(8rem, 14cqi);
    line-height: 1.05;
    letter-spacing: .02em;
    margin: 2.5rem 0 1.5rem;
  }
  .folder .lede {
    max-width: 40rem;
    font-size: 1.25rem;
    margin: 0;
  }
  .fields {
    margin-top: 2.5rem;
    font-family: var(--mono);
    font-size: .95rem;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .4rem 1rem;
    max-width: 30rem;
  }
  .fields dd { margin: 0; border-bottom: 1px solid rgba(34,31,26,.5); }

  .stamp {
    position: absolute;
    right: clamp(1rem, 6vw, 4rem);
    top: 10.5rem;
    transform: rotate(-11deg);
    font-family: var(--stamp);
    font-weight: 700;
    font-size: clamp(1.1rem, 3.4vw, 2rem);
    line-height: 1.1;
    text-align: center;
    color: var(--stamp-red);
    border: 5px double var(--stamp-red);
    padding: .5rem 1rem;
    opacity: .85;
    mix-blend-mode: multiply;
    -webkit-mask-image: repeating-radial-gradient(circle at 30% 40%, #000 0 2px, rgba(0,0,0,.72) 3px 4px);
            mask-image: repeating-radial-gradient(circle at 30% 40%, #000 0 2px, rgba(0,0,0,.72) 3px 4px);
    animation: thump .45s cubic-bezier(.2,1.6,.4,1) .4s both;
  }
  @keyframes thump {
    from { transform: rotate(-11deg) scale(1.9); opacity: 0; }
    to   { transform: rotate(-11deg) scale(1);   opacity: .85; }
  }
  @media (prefers-reduced-motion: reduce) { .stamp { animation: none; } }

  /* ---------- Paper sheets ---------- */
  .sheet {
    max-width: 76rem;
    margin: -1.2rem auto 0;
    position: relative;
    background: var(--paper);
    padding: 3rem clamp(1.5rem, 5vw, 4rem);
    box-shadow: 0 10px 30px rgba(40,25,5,.3);
  }
  .sheet + .sheet { margin-top: 1.5rem; }
  .sheet h2 {
    font-family: var(--serif);
    font-size: 1.6rem;
    margin: 0 0 1rem;
  }
  .sheet p { max-width: 44rem; }

  .redact {
    background: var(--ink);
    color: transparent;
    border: 0;
    font: inherit;
    padding: 0 .15em;
    cursor: pointer;
    transition: background .3s, color .3s;
  }
  .redact[aria-pressed="true"] { background: rgba(179,38,30,.15); color: var(--ink); }

  .violet-stamp {
    display: inline-block;
    font-family: var(--mono);
    font-size: .85rem;
    color: var(--stamp-violet);
    border: 2px solid var(--stamp-violet);
    border-radius: 50%;
    padding: 1.2rem 1rem;
    transform: rotate(6deg);
    text-align: center;
    line-height: 1.3;
    opacity: .75;
    float: right;
    margin: 0 0 1rem 1.5rem;
  }

  /* ---------- Register table ---------- */
  .register-wrap { overflow-x: auto; }
  table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--mono);
    font-size: .95rem;
    min-width: 36rem;
  }
  th, td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid rgba(34,31,26,.35); vertical-align: top; }
  thead th { border-bottom: 2px solid var(--ink); font-weight: 400; }
  td:first-child { white-space: nowrap; }
  td .subject { font-family: var(--serif); font-size: 1.05rem; display: block; }
  td .note { color: #5a5245; }
  .status { color: var(--stamp-red); white-space: nowrap; }

  footer {
    max-width: 76rem;
    margin: 0 auto;
    padding: 2rem clamp(1.5rem, 5vw, 4rem) 3rem;
    font-family: var(--mono);
    font-size: .9rem;
    color: #2e2618;
  }

  @media (min-width: 56.01rem) {
    .folder h1 { max-width: 64%; } /* long titles wrap beside the stamp */
  }
  @media (max-width: 56rem) {
    .stamp { position: static; display: inline-block; margin-top: 2rem; }
  }
  @media (max-width: 40rem) {
    .folder { margin-top: 0; border-radius: 0; }
    .violet-stamp { float: none; margin: 0 0 1rem; }
    .fields { grid-template-columns: 1fr; gap: 0; }
    .fields dt { margin-top: .6rem; }
  }

  /* ---------- Site navigation (folder tabs) ---------- */
  .tabs {
    max-width: 80rem;
    margin: 1.5rem auto 0;
    padding: 0 clamp(1rem, 4vw, 2rem);
    display: flex; gap: .4rem; flex-wrap: wrap;
    font-family: var(--mono); font-size: .95rem;
  }
  .tabs a {
    color: var(--ink);
    text-decoration: none;
    background: #b39a6a;
    padding: .5rem 1.1rem .4rem;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 6px rgba(40,25,5,.2);
  }
  .tabs a:hover { background: #bda476; }
  .tabs a[aria-current="page"] { background: var(--kraft); }
  .tabs + .folder { margin-top: 0; }

  .sheet figure { margin: 1.5rem 0 0; }
  .sheet figcaption { font-family: var(--mono); font-size: .9rem; color: #5a5245; margin-top: .5rem; }
  .map-svg { width: 100%; max-width: 48rem; height: auto; display: block; background: #e3d9bd; border: 1px solid rgba(34,31,26,.4); }
  .card-list { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
  .card-list li {
    background: #f6f1e2;
    border: 1px solid rgba(34,31,26,.35);
    padding: 1rem 1.1rem;
    font-size: 1rem;
    position: relative;
  }
  .card-list li::before { /* catalogue card punch hole */
    content: ""; position: absolute; bottom: .5rem; left: 50%; width: .7rem; height: .7rem;
    margin-left: -.35rem; border-radius: 50%; background: var(--paper); border: 1px solid rgba(34,31,26,.35);
  }
  .card-list .call { font-family: var(--mono); font-size: .85rem; color: var(--stamp-violet); display: block; }
  .card-list strong { display: block; margin: .2rem 0 .3rem; }
  .card-list p { margin: 0 0 1rem; }
  @media (max-width: 40rem) { .tabs { margin-top: .5rem; } }

  /* ---------- References ---------- */
  sup.ref { font-family: var(--mono); font-size: .7em; line-height: 0; }
  sup.ref a { text-decoration: none; }
  .refs { font-size: .95rem; padding-left: 1.6rem; max-width: 52rem; }
  .refs li { margin-bottom: .6rem; overflow-wrap: anywhere; }
  .refs li:target { background: rgba(75,63,120,.12); }

  /* ---------- Hand correction on the home title (drawn by script) ---------- */
  .correction { position: relative; display: inline-block; }
  .correction .scribble {
    position: absolute; left: -5%; top: 0;
    width: 110%; height: 100%;
    overflow: visible; pointer-events: none;
  }
  .correction .handwriting {
    position: absolute; left: 28%; bottom: 74%;
    height: .8em; width: auto;
    overflow: visible; pointer-events: none;
    transform-origin: left bottom;
  }
  .folder h1:has(.correction) { margin-top: 1em; } /* room for the handwriting */
