/* ---------------------------------------------------------------
   Design tokens
   --------------------------------------------------------------- */
:root {
  --paper: #E7E0CD;         /* grey-warm parchment, not peachy cream */
  --card: #F6F1E3;          /* lighter vellum for card surface */
  --ink: #241F17;           /* warm near-black, book-ink brown */
  --ink-soft: #5C5442;      /* muted body text */
  --rule: #C7BB9B;          /* hairline rule, aged paper */
  --rubric: #7B2C22;        /* rubrication red — primary accent, from scribal red ink */
  --rubric-dark: #601F18;
  --gold: #97752E;          /* muted brass — secondary accent */

  --display: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --body: "Source Serif 4", Georgia, serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --radius: 2px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--rubric-dark); }
a:hover { color: var(--gold); }

/* ---------------------------------------------------------------
   Layout shell
   --------------------------------------------------------------- */
.binder {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

.masthead {
  margin-bottom: 40px;
}

.eyebrow {
  font-family: var(--display);
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--rubric-dark);
  margin: 0 0 6px;
}

.title {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.05;
  margin: 0 0 10px;
  color: var(--ink);
}

.subtitle {
  font-family: var(--body);
  font-style: italic;
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0;
  max-width: 46ch;
}

/* ---------------------------------------------------------------
   Folder tabs
   --------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 4px;
}

.tab {
  appearance: none;
  border: 1px solid var(--rule);
  border-bottom: none;
  background: #DCD3B9;
  color: var(--ink-soft);
  font-family: var(--body);
  font-weight: 500;
  font-size: 14px;
  padding: 12px 20px 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  position: relative;
  top: 1px;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab:hover { color: var(--ink); }

.tab.active {
  background: var(--card);
  color: var(--ink);
  border-color: var(--rule);
  font-weight: 600;
}

.tab-index {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 14px;
  color: var(--rubric);
  margin-right: 6px;
}

.tab:focus-visible {
  outline: 2px solid var(--rubric);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------
   Sheet (panel container)
   --------------------------------------------------------------- */
.sheet {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  box-shadow: 0 1px 2px rgba(35, 43, 43, 0.04);
}

.panel-inner {
  padding: 36px 38px 40px 34px;
  border-left: 3px solid var(--rubric);   /* rubrication: the scribe's red marginal rule */
}

.panel h2 {
  font-family: var(--display);
  font-weight: 600;
  font-style: italic;
  font-size: 1.4rem;
  margin: 0 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
  color: var(--rubric-dark);
}

.bio p {
  color: var(--ink-soft);
  max-width: 60ch;
  font-size: 17px;
}

/* Illuminated-manuscript drop cap on the opening paragraph */
.bio .lede::first-letter {
  font-family: var(--display);
  font-weight: 600;
  font-size: 3.4em;
  line-height: 0.78;
  float: left;
  padding: 4px 6px 0 0;
  color: var(--rubric);
}

.facts {
  margin: 28px 0 0;
  display: grid;
  gap: 14px;
}

.fact {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: baseline;
  padding-top: 12px;
  border-top: 1px dotted var(--rule);
}

.fact:first-child { border-top: none; padding-top: 0; }

.fact dt {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rubric-dark);
}

.fact dd {
  margin: 0;
  color: var(--ink);
}

/* ---------------------------------------------------------------
   Work / catalog list
   --------------------------------------------------------------- */
.work-hint {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: -8px;
}

.work-hint code {
  font-family: var(--mono);
  background: var(--paper);
  padding: 1px 5px;
  border-radius: 2px;
}

.work-status {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
  padding: 20px 0;
}

.work-status.error { color: var(--gold); }

.work-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  position: relative;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.doc-card:hover {
  border-color: var(--rubric);
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.doc-stamp {
  flex: 0 0 auto;
  min-width: 44px;
  height: 28px;
  padding: 0 8px;
  border: 1.5px solid var(--rubric);
  color: var(--rubric);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-style: italic;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.doc-info {
  flex: 1 1 auto;
  min-width: 0;
}

.doc-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
  margin: 0 0 4px;
  word-break: break-word;
}

.doc-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.doc-open {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  border: 1px solid var(--rubric);
  color: var(--rubric-dark);
  padding: 7px 14px;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.doc-open:hover {
  background: var(--rubric);
  color: #fff;
}

/* Inline media players — sit below the title row, full card width */
.doc-audio {
  width: 100%;
  height: 36px;
}

.doc-video {
  width: 100%;
  max-height: 360px;
  border-radius: var(--radius);
  background: #111;
}

.doc-thumb {
  display: block;
  max-width: 100%;
  max-height: 420px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------
   Footer
   --------------------------------------------------------------- */
.colophon {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */
@media (max-width: 520px) {
  .panel-inner { padding: 26px 20px 30px; }
  .tab { padding: 10px 14px 12px; font-size: 13px; }
  .fact { grid-template-columns: 90px 1fr; }
  .doc-row { flex-wrap: wrap; }
  .doc-open { margin-left: 60px; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
