/* The Archive menu, in the style of the Threadway shop menus: a parchment panel with a
   double brown border, tan buttons and the approved Canopy (titles) and Fieldnotes (reading)
   fonts. Everything is scoped under .archive so the host can embed it in any page. */
@font-face { font-family: 'Arborwake Canopy'; src: url('fonts/arborwake-canopy-bold.woff') format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Arborwake Fieldnotes'; src: url('fonts/arborwake-fieldnotes-regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Arborwake Fieldnotes'; src: url('fonts/arborwake-fieldnotes-bold.woff') format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Arborwake Fieldnotes'; src: url('fonts/arborwake-fieldnotes-italic.woff') format('woff'); font-weight: 400; font-style: italic; font-display: swap; }

.archive {
  --ar-paper: #ece6c9;
  --ar-paper-deep: #e2d6ac;
  --ar-ink: #2c2a22;
  --ar-muted: #6c5f47;
  --ar-rule: #b9805a;
  --ar-frame: #5a3c2a;
  --ar-button: #efcf8c;
  --ar-button-edge: #8a6236;
  --ar-locked: #b8ab88;
  --ar-saw: #3f7d6a;
  --ar-found: #3d5f9e;
  --ar-unknown: #9a6a1f;
  --ar-made: #8a4a86;
  display: flex;
  flex-direction: column;
  width: min(960px, 100%);
  height: min(640px, 100%);
  color: var(--ar-ink);
  background: var(--ar-paper);
  border: 3px solid var(--ar-frame);
  padding: 4px;
  box-shadow: 0 10px 40px rgb(0 0 0 / 45%);
  font: 15px/1.55 'Arborwake Fieldnotes', system-ui, sans-serif;
  overflow: hidden;
}
.archive * { box-sizing: border-box; }
.ar-inner { display: flex; flex-direction: column; flex: 1; min-height: 0; border: 2px solid var(--ar-rule); }
.archive [hidden] { display: none !important; }
.archive h2, .archive h3, .archive button, .archive .ar-eyebrow { font-family: 'Arborwake Canopy', 'Arborwake Fieldnotes', monospace; }
/* Record titles and shelf entries are read, not glanced at: they use the reading font. */
.archive .ar-record-title, .archive .ar-shelf button { font-family: 'Arborwake Fieldnotes', system-ui, sans-serif; }
.archive .ar-record-title { font-weight: 700; }
.ar-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.ar-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 10px; border-bottom: 2px solid var(--ar-rule); }
.ar-head > div { flex: 1; min-width: 0; }
.ar-title { margin: 0; font-size: 20px; letter-spacing: 0.02em; }
.ar-sub { margin: 0; font-size: 13px; color: var(--ar-muted); }
.ar-search input { width: 220px; max-width: 40vw; padding: 6px 10px; border: 2px solid var(--ar-button-edge); background: #f6f1dc; color: var(--ar-ink); font: inherit; border-radius: 2px; }
.ar-close { width: 34px; height: 34px; border: 2px solid var(--ar-button-edge); background: var(--ar-button); color: var(--ar-ink); font-size: 20px; line-height: 1; cursor: pointer; }

.ar-body { display: grid; grid-template-columns: 250px minmax(0, 1fr); flex: 1; min-height: 0; }
.ar-shelves { overflow-y: auto; padding: 10px 10px 16px 16px; border-right: 2px dashed var(--ar-rule); background: var(--ar-paper-deep); }
.ar-shelf h3 { display: flex; justify-content: space-between; gap: 6px; margin: 12px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ar-muted); }
.ar-count { font-weight: 400; }
.ar-shelf ul { list-style: none; margin: 0; padding: 0; }
.ar-shelf button {
  display: block; width: 100%; padding: 5px 8px; margin: 1px 0; border: 0; border-left: 3px solid transparent;
  background: none; color: var(--ar-ink); text-align: left; font-size: 14px; cursor: pointer;
}
.ar-shelf button:hover, .ar-shelf button:focus-visible { background: rgb(255 255 255 / 45%); }
.ar-shelf button[aria-current='true'] { border-left-color: var(--ar-frame); background: rgb(255 255 255 / 60%); }
.ar-shelf button.ar-locked { color: var(--ar-locked); letter-spacing: 0.2em; }
.ar-empty { color: var(--ar-muted); font-size: 14px; }

.ar-page { overflow-y: auto; padding: 18px 24px 24px; }
.ar-eyebrow { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ar-muted); }
.ar-record-title { margin: 2px 0 4px; font-size: 24px; line-height: 1.2; }
.ar-summary { margin: 0 0 14px; font-style: italic; color: var(--ar-muted); }
.ar-hint { padding: 10px 12px; border: 2px dashed var(--ar-rule); }
.ar-page p { margin: 0 0 10px; }
.ar-page ul { margin: 0 0 10px; padding-left: 20px; }

.ar-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 0; }
.ar-tab {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 6px;
  border: 2px solid var(--ar-button-edge); border-bottom: 0; background: var(--ar-paper-deep); color: var(--ar-ink);
  font-size: 13px; cursor: pointer; opacity: 0.8;
}
.ar-tab svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ar-tab[aria-selected='true'] { opacity: 1; background: #fbf7e6; }
.ar-tab-saw { color: var(--ar-saw); }
.ar-tab-found { color: var(--ar-found); }
.ar-tab-unknown { color: var(--ar-unknown); }
.ar-tab-madeUp { color: var(--ar-made); }
.ar-panel { padding: 14px 16px 6px; margin-bottom: 16px; border: 2px solid var(--ar-button-edge); background: #fbf7e6; font-size: 16px; }
.ar-panel-saw { box-shadow: inset 4px 0 0 var(--ar-saw); }
.ar-panel-found { box-shadow: inset 4px 0 0 var(--ar-found); }
.ar-panel-unknown { box-shadow: inset 4px 0 0 var(--ar-unknown); }
.ar-panel-madeUp { box-shadow: inset 4px 0 0 var(--ar-made); }
.ar-panel a[data-record], .ar-link { color: var(--ar-found); text-decoration: underline; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; }

.ar-small-head { margin: 0 0 4px !important; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ar-muted); }
.ar-words ul, .ar-related ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ar-words li { max-width: 100%; }
.ar-word { padding: 3px 9px; border: 2px solid var(--ar-button-edge); background: var(--ar-button); color: var(--ar-ink); font-size: 13px; cursor: pointer; }
.ar-word[aria-expanded='true'] { background: #fbf7e6; }
.ar-word-box { margin: 0 0 10px; padding: 8px 10px; background: #fbf7e6; border-left: 3px solid var(--ar-button-edge); font-size: 14px; }
.ar-related li { padding: 2px 0; }
.ar-locked-small { color: var(--ar-locked); }
.ar-sources { margin-top: 6px; border-top: 2px solid var(--ar-rule); padding-top: 8px; }
.ar-sources summary { cursor: pointer; font-family: 'Arborwake Canopy', monospace; font-size: 14px; }
.ar-sources ul { list-style: none; padding: 0; }
.ar-sources li { padding: 8px 0; border-bottom: 1px dashed var(--ar-rule); font-size: 14px; }
.ar-sources li p { margin: 0 0 2px; }
.ar-studied { color: var(--ar-muted); }
.ar-sources a { color: var(--ar-found); }

.archive button:focus-visible, .archive input:focus-visible, .archive a:focus-visible { outline: 3px solid var(--ar-found); outline-offset: 1px; }

@media (max-width: 700px) {
  .ar-body { grid-template-columns: 1fr; grid-template-rows: 38% 1fr; }
  .ar-shelves { border-right: 0; border-bottom: 2px dashed var(--ar-rule); }
  .ar-tabs { grid-template-columns: repeat(2, 1fr); }
  .ar-tab { border-bottom: 2px solid var(--ar-button-edge); }
  .ar-search input { width: 140px; }
}
@media (prefers-reduced-motion: reduce) { .archive * { transition: none !important; } }
/* APA 7 references: hanging indent. */
.ar-apa { padding-left: 2em; text-indent: -2em; overflow-wrap: anywhere; }
/* Related records: reading font in separate boxes, so neighbours never run together. */
.archive .ar-related .ar-link {
  display: inline-block; padding: 4px 10px; border: 2px solid var(--ar-button-edge); background: #fbf7e6;
  color: var(--ar-ink); font-family: 'Arborwake Fieldnotes', system-ui, sans-serif; font-size: 14px; text-decoration: none;
}
.archive .ar-related .ar-link:hover { background: var(--ar-button); }
.archive .ar-related .ar-locked-small { display: inline-block; padding: 4px 10px; border: 2px dashed var(--ar-locked); font-size: 14px; }
.ar-related ul { gap: 8px; }
