*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Paper — aged, varied */
  --card-cream: #f1e6cd;
  --card-cream-deep: #d8c9a6;
  --card-cream-shadow: #b9a679;
  --ink: #2a2018;
  --ink-soft: #5a4a38;
  --ink-faded: #7a6a52;

  /* Stamp / accent inks */
  --stamp-red: #8a2a22;
  --stamp-red-deep: #5e1a14;
  --rule-red: #9c382a;

  /* Brass / gilt */
  --brass: #b8893a;
  --brass-hi: #e8c878;
  --brass-shadow: #6a4a18;
  --gilt-edge: #d4a644;

  /* Leather — oxblood / cordovan */
  --leather-1: #2a0e0c;
  --leather-2: #3e1612;
  --leather-3: #4f1d18;
  --leather-4: #5e251f;
  --leather-shadow: #100403;
  --leather-stitch: #8a6a3a;

  /* Walnut */
  --walnut-1: #2a1810;
  --walnut-2: #3d2418;
  --walnut-3: #553420;
  --walnut-4: #6e4528;
  --walnut-hi: #8a5a36;
  --walnut-grain: rgba(0,0,0,0.22);

  /* Felt — desk blotter green */
  --felt-1: #1a3326;
  --felt-2: #244838;
  --felt-3: #2e5a48;
}

html {
  font-size: 21px;
  /* Dark backstop behind the page so cross-document view transitions
     never flash through to the browser's default white. */
  background-color: #0a0504;
}

body {
  background: #0a0504;
  color: var(--ink);
  min-height: 100vh;
  font-family: 'Cormorant Garamond', 'Libre Baskerville', Georgia, serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────────────────────────
   OUTER LEATHER — like the cover of a tome, with corner blocks
   ───────────────────────────────────────────────────────────── */
.lib {
  min-height: 100vh;
  padding: clamp(18px, 3vw, 38px);
  position: relative;
  background:
    /* hairline grain */
    repeating-linear-gradient(
      73deg,
      rgba(255,255,255,0.014) 0,
      rgba(255,255,255,0.014) 1px,
      transparent 1px,
      transparent 3px
    ),
    repeating-linear-gradient(
      -8deg,
      rgba(0,0,0,0.10) 0,
      rgba(0,0,0,0.10) 1px,
      transparent 1px,
      transparent 4px
    ),
    /* mottled pebbled leather highlights */
    radial-gradient(circle at 22% 18%, rgba(180,90,70,0.30) 0%, transparent 8%),
    radial-gradient(circle at 78% 32%, rgba(180,90,70,0.22) 0%, transparent 9%),
    radial-gradient(circle at 38% 72%, rgba(180,90,70,0.20) 0%, transparent 10%),
    radial-gradient(circle at 88% 84%, rgba(180,90,70,0.18) 0%, transparent 7%),
    radial-gradient(circle at 12% 92%, rgba(180,90,70,0.20) 0%, transparent 8%),
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(140,60,45,0.45), transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(0,0,0,0.55), transparent 55%),
    linear-gradient(165deg, var(--leather-4) 0%, var(--leather-3) 35%, var(--leather-2) 70%, var(--leather-1) 100%);
  background-attachment: fixed;
}

/* outer gilt frame */
.lib::before {
  content: '';
  position: fixed;
  inset: clamp(12px, 2.2vw, 24px);
  border: 1px solid rgba(216, 166, 68, 0.45);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.6),
    inset 0 0 0 4px rgba(216, 166, 68, 0.15),
    inset 0 0 0 5px rgba(0,0,0,0.5),
    inset 0 0 80px rgba(0,0,0,0.6);
  pointer-events: none;
  border-radius: 2px;
  z-index: 1;
}

/* gilt corner ornaments — fleurons */
.corner {
  position: fixed;
  width: 60px;
  height: 60px;
  pointer-events: none;
  z-index: 2;
  color: var(--gilt-edge);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7));
}
.corner.tl { top: clamp(14px, 2.4vw, 26px); left: clamp(14px, 2.4vw, 26px); }
.corner.tr { top: clamp(14px, 2.4vw, 26px); right: clamp(14px, 2.4vw, 26px); transform: scaleX(-1); }
.corner.bl { bottom: clamp(14px, 2.4vw, 26px); left: clamp(14px, 2.4vw, 26px); transform: scaleY(-1); }
.corner.br { bottom: clamp(14px, 2.4vw, 26px); right: clamp(14px, 2.4vw, 26px); transform: scale(-1, -1); }

.lib-inner {
  max-width: 1240px;
  margin: 0 auto;
  position: relative;
  z-index: 3;
}

/* ─────────────────────────────────────────────────────────────
   MASTHEAD — embossed leather plaque with brass nameplate
   ───────────────────────────────────────────────────────────── */
.masthead {
  position: relative;
  overflow: visible;
  padding: clamp(28px, 4vw, 48px) clamp(22px, 4vw, 56px) clamp(24px, 3.5vw, 40px);
  margin-bottom: clamp(22px, 3vw, 36px);
  border-radius: 4px;
  background:
    repeating-linear-gradient(73deg, rgba(255,255,255,0.014) 0, rgba(255,255,255,0.014) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(200,110,80,0.18), transparent 70%),
    linear-gradient(170deg, var(--leather-4) 0%, var(--leather-3) 50%, var(--leather-2) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(216, 166, 68, 0.35),
    inset 0 0 0 2px rgba(0,0,0,0.7),
    inset 0 0 0 6px rgba(216, 166, 68, 0.12),
    inset 0 0 0 7px rgba(0,0,0,0.6),
    inset 0 2px 0 rgba(255,255,255,0.05),
    0 14px 32px rgba(0,0,0,0.5),
    0 30px 60px rgba(0,0,0,0.4);
}

/* embossed dotted leather stitch */
.masthead::before {
  content: '';
  position: absolute;
  inset: 14px;
  border: 1px dashed rgba(216, 166, 68, 0.32);
  border-radius: 2px;
  pointer-events: none;
}

.masthead-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(20px, 3.5vw, 44px);
  align-items: center;
  position: relative;
  z-index: 1;
  overflow: visible;
}

/* Round logo — no medallion housing */
.crest {
  width: clamp(150px, 17vw, 200px);
  height: clamp(150px, 17vw, 200px);
  flex-shrink: 0;
}
.crest-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 30%, #fff8ec 0%, #f1e6cd 60%, #d8c9a6 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.25),
    inset 0 -6px 14px rgba(0,0,0,0.18),
    0 6px 14px rgba(0,0,0,0.55),
    0 12px 26px rgba(0,0,0,0.4);
  text-decoration: none;
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
  padding: 8%;
}
.crest-link:hover { transform: rotate(-4deg) scale(1.02); }
.crest-link img {
  display: block;
  width: 84%;
  height: 84%;
  object-fit: contain;
}

.masthead-title {
  text-align: center;
  color: var(--brass-hi);
  overflow: visible;
  padding-inline: clamp(8px, 2vw, 32px);
}

.masthead-kicker {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(216, 166, 68, 0.85);
  margin-bottom: 10px;
  font-weight: 500;
}

/* Drop-shadow lives on h1 only; gradient + clip stay on inner span (avoids clipping swash tails). */
.masthead-name {
  font-family: 'Cormorant Garamond', 'EB Garamond', 'Times New Roman', Times, serif;
  font-weight: 600;
  font-style: italic;
  font-size: clamp(2.8rem, 6.4vw, 5rem);
  line-height: 1.08;
  letter-spacing: 0.005em;
  margin: 0 auto 4px;
  display: inline-block;
  overflow: visible;
  padding: 0.05em 0.34em 0.18em 0.06em;
  filter:
    drop-shadow(0 1px 0 rgba(255, 245, 210, 0.45))
    drop-shadow(0 2px 0 rgba(0, 0, 0, 0.58))
    drop-shadow(0 5px 14px rgba(0, 0, 0, 0.52));
}

.masthead-name-inner {
  display: inline;
  white-space: nowrap;
  color: transparent;
  background:
    linear-gradient(
      168deg,
      #fffef8 0%,
      #fff4c8 10%,
      #f0d070 26%,
      #c9a03a 44%,
      #9a7020 58%,
      #e8c878 72%,
      #b8893a 86%,
      #f6e4a8 100%
    );
  -webkit-background-clip: text;
  background-clip: text;
}

.masthead-name em {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: 500;
}

.masthead-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 8px 0 12px;
}
.masthead-rule .line {
  flex: 1;
  max-width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gilt-edge), transparent);
}
.masthead-rule .ornament {
  color: var(--gilt-edge);
  font-size: 16px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
}

.masthead-tag {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: clamp(15px, 1.45vw, 18px);
  color: rgba(241, 230, 205, 0.82);
  letter-spacing: 0.04em;
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.45;
}
.masthead-tag a {
  color: var(--brass-hi);
  text-decoration: none;
  border-bottom: 1px dotted rgba(216, 166, 68, 0.6);
  padding-bottom: 1px;
}
.masthead-tag a:hover { color: #fff4d0; border-bottom-color: var(--brass-hi); }

.masthead-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.masthead-link {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(241, 230, 205, 0.92);
  padding: 8px 14px;
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(216, 166, 68, 0.18) 0%, rgba(216, 166, 68, 0.06) 100%);
  border: 1px solid rgba(216, 166, 68, 0.4);
  box-shadow: inset 0 1px 0 rgba(255,235,180,0.18), 0 2px 4px rgba(0,0,0,0.4);
  transition: all 0.2s ease;
  white-space: nowrap;
}
.masthead-link:hover {
  color: #fff4d0;
  border-color: var(--brass-hi);
  background: linear-gradient(180deg, rgba(216, 166, 68, 0.28) 0%, rgba(216, 166, 68, 0.1) 100%);
  transform: translateY(-1px);
}

button.masthead-link {
  font: inherit;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.masthead-link-dev {
  opacity: 0.65;
}
.masthead-link-dev:hover {
  opacity: 1;
}

@media (max-width: 800px) {
  .masthead-grid { grid-template-columns: 1fr; gap: 18px; }
  .crest { margin: 0 auto; }
  .masthead-meta { align-items: center; flex-direction: row; flex-wrap: wrap; justify-content: center; }
}

/* ─────────────────────────────────────────────────────────────
   READING ROOM — felt-topped catalog cabinet sits on this
   ───────────────────────────────────────────────────────────── */
.cabinet {
  position: relative;
  border-radius: 6px;
  padding: clamp(18px, 2.4vw, 30px) clamp(16px, 2.4vw, 28px) clamp(28px, 3vw, 40px);
  background:
    /* wood grain — fine */
    repeating-linear-gradient(
      91deg,
      transparent 0, transparent 9px,
      var(--walnut-grain) 9px, var(--walnut-grain) 10px
    ),
    repeating-linear-gradient(
      93deg,
      transparent 0, transparent 27px,
      rgba(255,255,255,0.025) 27px, rgba(255,255,255,0.025) 28px
    ),
    /* knots — subtle */
    radial-gradient(ellipse 60px 14px at 18% 28%, rgba(0,0,0,0.30), transparent 70%),
    radial-gradient(ellipse 50px 12px at 72% 78%, rgba(0,0,0,0.25), transparent 70%),
    radial-gradient(ellipse 80px 16px at 88% 18%, rgba(0,0,0,0.22), transparent 70%),
    linear-gradient(178deg, var(--walnut-hi) 0%, var(--walnut-4) 18%, var(--walnut-3) 60%, var(--walnut-2) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.7),
    inset 0 0 0 2px rgba(216, 166, 68, 0.22),
    inset 0 0 0 3px rgba(0,0,0,0.55),
    inset 0 2px 0 rgba(255,235,180,0.06),
    inset 0 -8px 18px rgba(0,0,0,0.5),
    0 22px 50px rgba(0,0,0,0.55);
}

/* Section heading bar — engraved brass plate */
.shelf-label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  margin-bottom: clamp(20px, 2.5vw, 28px);
  background:
    radial-gradient(ellipse 60% 200% at 50% 50%, rgba(255,235,180,0.25), transparent 70%),
    linear-gradient(180deg, #d4a644 0%, #b8893a 45%, #8a6420 100%);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,235,180,0.55),
    inset 0 -2px 4px rgba(0,0,0,0.35),
    0 4px 10px rgba(0,0,0,0.4),
    0 1px 0 rgba(255,235,180,0.1);
  position: relative;
}
/* tiny screws */
.shelf-label::before,
.shelf-label::after {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  top: 50%; transform: translateY(-50%);
  background:
    radial-gradient(circle at 30% 30%, #f4dc9a, var(--brass-shadow));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.2);
}
.shelf-label::before { left: 6px; }
.shelf-label::after { right: 6px; }

.shelf-label-text {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--leather-1);
  text-shadow: 0 1px 0 rgba(255, 235, 180, 0.4);
  flex: 1;
  text-align: center;
}

/* ─────────────────────────────────────────────────────────────
   CATALOG GRID — drawer with cards
   ───────────────────────────────────────────────────────────── */

/* The drawer area — green felt blotter inside walnut frame */
.drawer {
  position: relative;
  padding: clamp(24px, 3vw, 38px) clamp(18px, 2.4vw, 28px) clamp(34px, 4vw, 48px);
  border-radius: 3px;
  background:
    /* felt fibers */
    repeating-linear-gradient(45deg, rgba(255,255,255,0.012) 0, rgba(255,255,255,0.012) 1px, transparent 1px, transparent 2px),
    repeating-linear-gradient(-45deg, rgba(0,0,0,0.04) 0, rgba(0,0,0,0.04) 1px, transparent 1px, transparent 2px),
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.04), transparent 60%),
    linear-gradient(165deg, var(--felt-3) 0%, var(--felt-2) 50%, var(--felt-1) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.5),
    inset 0 0 0 2px rgba(216, 166, 68, 0.2),
    inset 0 0 0 3px rgba(0,0,0,0.6),
    inset 0 6px 20px rgba(0,0,0,0.55),
    inset 0 -4px 14px rgba(0,0,0,0.4);
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(22px, 3vw, 36px) clamp(18px, 2.4vw, 28px);
  align-items: stretch;
}

/* ─────────────────────────────────────────────────────────────
   CARD — heavy cream stock, hand-typed, brass corners
   ───────────────────────────────────────────────────────────── */

.cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 380px;
  padding: 22px 18px 18px 36px;
  text-decoration: none;
  color: var(--ink);
  border-radius: 2px;
  background:
    /* paper fiber & age spots */
    radial-gradient(circle at 18% 12%, rgba(180, 140, 80, 0.16) 0%, transparent 4%),
    radial-gradient(circle at 82% 28%, rgba(180, 140, 80, 0.14) 0%, transparent 3%),
    radial-gradient(circle at 28% 78%, rgba(160, 100, 60, 0.10) 0%, transparent 4%),
    radial-gradient(circle at 78% 88%, rgba(180, 140, 80, 0.12) 0%, transparent 3%),
    repeating-linear-gradient(
      17deg,
      rgba(180, 140, 80, 0.04) 0,
      rgba(180, 140, 80, 0.04) 1px,
      transparent 1px,
      transparent 4px
    ),
    /* edge darkening */
    radial-gradient(ellipse 100% 70% at 50% 100%, rgba(140, 100, 50, 0.18), transparent 60%),
    radial-gradient(ellipse 100% 70% at 50% 0%, rgba(140, 100, 50, 0.14), transparent 60%),
    linear-gradient(160deg, #f7eed5 0%, var(--card-cream) 45%, var(--card-cream-deep) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(120, 90, 50, 0.35),
    inset 0 0 24px rgba(180, 140, 80, 0.18),
    2px 3px 0 rgba(0, 0, 0, 0.18),
    4px 6px 0 rgba(0, 0, 0, 0.10),
    10px 14px 28px rgba(0, 0, 0, 0.45),
    20px 28px 48px rgba(0, 0, 0, 0.32);
  transition: transform 0.32s cubic-bezier(.2,.8,.2,1), box-shadow 0.32s;
}

/* Brass-rimmed punch holes at bottom corners (catalog-card hallmark) */
.cat-card::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  height: 14px;
  pointer-events: none;
  background:
    radial-gradient(circle 7px at 22px 7px,
      #4a3220 0%,
      #1a0e08 35%,
      #000 55%,
      rgba(0,0,0,0.5) 62%,
      rgba(216, 166, 68, 0.75) 68%,
      rgba(216, 166, 68, 0.35) 78%,
      transparent 92%),
    radial-gradient(circle 7px at calc(100% - 22px) 7px,
      #4a3220 0%,
      #1a0e08 35%,
      #000 55%,
      rgba(0,0,0,0.5) 62%,
      rgba(216, 166, 68, 0.75) 68%,
      rgba(216, 166, 68, 0.35) 78%,
      transparent 92%);
  background-repeat: no-repeat;
}

/* Red guideline that runs the length — like catalog cards have */
/* Red guideline — stop above footer + typewriter prompt region */
.cat-card::after {
  content: '';
  position: absolute;
  left: 28px;
  top: 0;
  bottom: clamp(88px, 20%, 128px);
  width: 1px;
  background: linear-gradient(180deg, transparent 0, rgba(156, 56, 42, 0.45) 8%, rgba(156, 56, 42, 0.45) 92%, transparent 100%);
}

/* Subtle rotation for casual stack feel */
.cat-card:nth-child(7n+1) { transform: rotate(-0.55deg); }
.cat-card:nth-child(7n+2) { transform: rotate(0.4deg); }
.cat-card:nth-child(7n+3) { transform: rotate(-0.25deg); }
.cat-card:nth-child(7n+4) { transform: rotate(0.6deg); }
.cat-card:nth-child(7n+5) { transform: rotate(-0.4deg); }
.cat-card:nth-child(7n+6) { transform: rotate(0.2deg); }
.cat-card:nth-child(7n+7) { transform: rotate(-0.15deg); }

.cat-card:hover {
  transform: translateY(-8px) rotate(0deg) scale(1.015);
  box-shadow:
    inset 0 0 0 1px rgba(120, 90, 50, 0.4),
    inset 0 0 24px rgba(180, 140, 80, 0.18),
    2px 3px 0 rgba(0, 0, 0, 0.16),
    4px 6px 0 rgba(0, 0, 0, 0.08),
    14px 18px 32px rgba(0, 0, 0, 0.5),
    24px 36px 60px rgba(0, 0, 0, 0.4);
}

.cat-card:focus-visible {
  outline: 3px solid var(--gilt-edge);
  outline-offset: 4px;
}

/* Brass corner clip top-right */
.cat-corner {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 38px;
  height: 38px;
  pointer-events: none;
  z-index: 2;
}
.cat-corner svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4)); }

/* Header strip on card */
.cat-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(156, 56, 42, 0.4);
  position: relative;
}
.cat-head::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(156, 56, 42, 0.25);
}

.cat-call {
  font-family: 'Special Elite', 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--stamp-red);
  font-weight: 400;
}

.cat-category {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-style: normal;
  font-size: 12.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: right;
  max-width: 58%;
  line-height: 1.2;
}

.cat-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 24px;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: -0.005em;
  /* Reserve space for two lines so single-line titles still
     leave the image plate at the same y across cards. */
  min-height: calc(1.15em * 2);
}

.cat-card:hover .cat-title-inner {
  color: var(--stamp-red);
}
.cat-title-inner { transition: color 0.2s ease; }

.cat-attrib {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
  /* Reserve space for both attribution lines (name + school/grade)
     so cards with a single-line attribution don't pull the plate up. */
  min-height: calc(15px * 1.25 + 14px * 1.3 + 2px);
}

.cat-attrib-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-style: normal;
  font-size: 15px;
  line-height: 1.25;
  color: var(--ink);
}

.cat-attrib-school {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 400;
  font-style: normal;
  font-size: 14px;
  line-height: 1.3;
  color: var(--ink-soft);
}

/* Plate window — like a tipped-in engraving */
.cat-plate-frame {
  position: relative;
  margin: 4px 0 14px;
  padding: 5px;
  background:
    linear-gradient(135deg, #c9a85c 0%, #8a6420 50%, #b8893a 100%);
  border-radius: 1px;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,235,180,0.4),
    2px 3px 6px rgba(0,0,0,0.25);
}

.cat-window {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #2a2018;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.7),
    inset 0 1px 6px rgba(0,0,0,0.5);
}

.cat-window img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  filter: sepia(0.18) saturate(0.95) contrast(1.02);
  transition: filter 0.3s ease, transform 0.4s ease;
}

.cat-card:hover .cat-window img {
  filter: sepia(0.05) saturate(1.05) contrast(1.04);
  transform: scale(1.03);
}

.cat-plate-cap { display: none; }

.cat-window-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14.5px;
  color: rgba(241, 230, 205, 0.55);
  background:
    repeating-linear-gradient(
      -12deg,
      transparent 0,
      transparent 10px,
      rgba(216, 166, 68, 0.08) 10px,
      rgba(216, 166, 68, 0.08) 11px
    ),
    radial-gradient(ellipse at 50% 50%, var(--leather-3), var(--leather-1));
}

/* Example prompt — IDE-style mono, same cream stock as the card (no inset panel).
   `margin-top: auto` anchors the prompt block to the bottom of the card so all
   prompts share a baseline regardless of title/attribution length. */
.cat-prompt {
  font-family: 'IBM Plex Mono', ui-monospace, 'Menlo', 'Monaco', 'Consolas', 'Courier New', monospace;
  font-weight: 400;
  font-style: normal;
  font-variant-ligatures: none;
  font-size: 13.5px;
  line-height: 1.55;
  letter-spacing: 0;
  tab-size: 2;
  color: var(--ink);
  margin: auto 0 0;
  padding: 10px 2px 0 0;
  border-top: 1px dashed rgba(120, 90, 50, 0.28);
  text-wrap: pretty;
}

/* ─────────────────────────────────────────────────────────────
   INVITATION CARD — looks like a leather-bound chapbook
   ───────────────────────────────────────────────────────────── */
.cat-card-invite {
  background:
    repeating-linear-gradient(73deg, rgba(255,255,255,0.014) 0, rgba(255,255,255,0.014) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(180,90,70,0.30), transparent 60%),
    linear-gradient(165deg, var(--leather-4) 0%, var(--leather-3) 50%, var(--leather-1) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(216, 166, 68, 0.3),
    inset 0 0 0 2px rgba(0,0,0,0.65),
    inset 0 0 0 5px rgba(216, 166, 68, 0.12),
    inset 0 0 0 6px rgba(0,0,0,0.55),
    2px 3px 0 rgba(0, 0, 0, 0.2),
    10px 14px 28px rgba(0, 0, 0, 0.5),
    20px 28px 48px rgba(0, 0, 0, 0.35);
  color: #f1e6cd;
  transform: rotate(0.8deg) !important;
}
.cat-card-invite:hover {
  transform: translateY(-8px) rotate(0deg) scale(1.015) !important;
}
.cat-card-invite::before { display: none; }
.cat-card-invite::after { display: none; }
.cat-card-invite .cat-corner { display: none; }

.cat-invite-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 24px 14px;
}

.cat-invite-mono {
  font-family: 'Playfair Display', serif;
  font-weight: 800;
  font-size: 72px;
  line-height: 1;
  color: transparent;
  background: linear-gradient(180deg, #f8e0a4 0%, #d4a644 60%, #8a6420 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.6));
}

.cat-invite-kicker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(216, 166, 68, 0.85);
}

.cat-invite-title {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-style: italic;
  font-size: 28px;
  line-height: 1.1;
  color: #f1e6cd;
}

.cat-invite-rule {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gilt-edge), transparent);
}

.cat-invite-text {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 17px;
  line-height: 1.4;
  color: rgba(241, 230, 205, 0.85);
  max-width: 240px;
}

.cat-invite-mailto {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-hi);
  padding: 7px 14px;
  border: 1px dashed rgba(216, 166, 68, 0.5);
  border-radius: 1px;
  margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────────
   FOOTER
   ───────────────────────────────────────────────────────────── */
.lib-footer {
  margin-top: clamp(28px, 3.5vw, 44px);
  padding: 22px 18px;
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 16px;
  color: rgba(241, 230, 205, 0.7);
  position: relative;
}
.lib-footer-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 12px;
}
.lib-footer-rule .line { flex: 1; max-width: 180px; height: 1px; background: linear-gradient(90deg, transparent, rgba(216,166,68,0.4), transparent); }
.lib-footer-rule .ornament { color: var(--gilt-edge); font-size: 20px; }

.lib-footer p { margin: 4px 0; }
.lib-footer a { color: var(--brass-hi); text-decoration: none; border-bottom: 1px dotted rgba(216,166,68,0.5); }
.lib-footer a:hover { color: #fff4d0; }

.lib-footer-mono {
  font-family: 'IBM Plex Mono', monospace;
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(216, 166, 68, 0.55);
  margin-top: 8px;
}

/* Bottom-right collection switcher (Teachers / Students) */
.view-nav {
  position: fixed;
  bottom: clamp(22px, 3vw, 36px);
  right: clamp(22px, 3vw, 36px);
  z-index: 20;
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(60, 30, 24, 0.9) 0%, rgba(30, 12, 10, 0.9) 100%);
  border: 1px solid rgba(216, 166, 68, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(216, 166, 68, 0.25),
    0 4px 12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.view-nav-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(241, 230, 205, 0.65);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 2px;
  border: 1px solid transparent;
  transition: color 120ms ease, background 120ms ease, border-color 120ms ease;
}
.view-nav-link:hover {
  color: #fff4d0;
  border-color: rgba(216, 166, 68, 0.45);
}
.view-nav-link.is-active {
  color: #fff4d0;
  background: rgba(216, 166, 68, 0.14);
  border-color: rgba(216, 166, 68, 0.55);
}

/* ─────────────────────────────────────────────────────────────
   SHELF BOTTOM — Student page only.
   A wide, thin band at the very bottom of the viewport that reads
   as the front edge of the drawer / the bottom of the shelf.
   Decorative (pointer-events: none); the bottom-right view-nav
   handles actual navigation.
   ───────────────────────────────────────────────────────────── */
.shelf-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16px;
  z-index: 18;
  pointer-events: none;
  background:
    /* faint horizontal wood-grain striations */
    repeating-linear-gradient(
      92deg,
      rgba(255, 255, 255, 0.035) 0 1px,
      transparent 1px 7px
    ),
    linear-gradient(180deg,
      #1f3354 0%,
      #14223c 55%,
      #0a142a 100%);
  border-top: 1px solid rgba(200, 212, 232, 0.32);
  box-shadow:
    inset 0 1px 0 rgba(220, 228, 240, 0.18),
    0 -8px 18px rgba(0, 0, 0, 0.55);
}

@media (max-width: 600px) {
  .shelf-bottom { height: 12px; }
}

/* Student-page title scales down and stays on one line so
   "Student Vibe-rary" never wraps mid-word. */
.students-view .masthead-name {
  font-size: clamp(1.9rem, 4.6vw, 4rem);
  white-space: nowrap;
}

/* Pewter recoloring of the same switcher on the students view */
.students-view .view-nav {
  background:
    linear-gradient(180deg, rgba(24, 38, 70, 0.92) 0%, rgba(10, 18, 36, 0.92) 100%);
  border-color: rgba(154, 166, 184, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(200, 208, 220, 0.22),
    0 4px 12px rgba(0, 0, 0, 0.55);
}
.students-view .view-nav-link { color: rgba(220, 228, 240, 0.7); }
.students-view .view-nav-link:hover {
  color: #ecf2fb;
  border-color: rgba(154, 166, 184, 0.45);
}
.students-view .view-nav-link.is-active {
  color: #ecf2fb;
  background: rgba(154, 166, 184, 0.16);
  border-color: rgba(154, 166, 184, 0.6);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cat-card { transition: none; }
  .cat-card:hover { transform: none !important; }
  .cat-window img { transition: none; }
}

@media (max-width: 600px) {
  .cat-card { min-height: 360px; padding: 20px 14px 14px 28px; }
  .cat-card::after { left: 22px; }
  .cat-title { font-size: 21px; }
}

/* ─────────────────────────────────────────────────────────────
   STUDENTS VIEW — same catalog, cooler palette
   Navy/ink leather binding + pewter/steel accents instead of
   oxblood + brass. Cream paper stays the same so the cards feel
   kindred to the teacher collection.
   ───────────────────────────────────────────────────────────── */
.students-view {
  /* Stamp ink shifts from red to deep ink-blue */
  --stamp-red: #1f3a6a;
  --stamp-red-deep: #122247;
  --rule-red: #29457a;

  /* Brass becomes pewter / steel */
  --brass: #6f7a8a;
  --brass-hi: #c8d0dc;
  --brass-shadow: #2c3340;
  --gilt-edge: #9aa6b8;

  /* Leather becomes deep navy / midnight */
  --leather-1: #0b1424;
  --leather-2: #11203a;
  --leather-3: #182c4d;
  --leather-4: #213860;
  --leather-shadow: #050a14;
  --leather-stitch: #5a6a8a;

  /* Walnut shifts to a cool slate */
  --walnut-1: #131a24;
  --walnut-2: #1d2734;
  --walnut-3: #2a3645;
  --walnut-4: #354456;
  --walnut-hi: #4a5a72;
  --walnut-grain: rgba(0,0,0,0.26);

  /* Felt — deeper teal-blue */
  --felt-1: #122a36;
  --felt-2: #19384a;
  --felt-3: #224a60;
}

/* ─────────────────────────────────────────────────────────────
   CROSS-DOCUMENT DRAWER SLIDE
   The Student catalog is a drawer that slides DOWN over the
   Teacher catalog. The teacher page sits still underneath; only
   the student layer moves. Stowing reverses it — the student
   drawer slides back up and out.
   Browsers without the View Transitions API snap-cut.
   ───────────────────────────────────────────────────────────── */
@view-transition { navigation: auto; }

/* Paint the transition stage dark so any uncovered region during
   the slide reads as part of the cabinet, not a white flash. */
::view-transition { background-color: #0a0504; }
::view-transition-group(root) { background-color: #0a0504; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 720ms;
  animation-timing-function: cubic-bezier(0.32, 0.04, 0.18, 1);
  animation-fill-mode: both;
  mix-blend-mode: normal;
  background-color: #0a0504;
}

/* Forward: Teachers → Students. Teacher (old) stays put;
   student (new) drops down from above and lands on top. */
html:active-view-transition-type(forward)::view-transition-old(root) {
  animation: none;
  z-index: 1;
}
html:active-view-transition-type(forward)::view-transition-new(root) {
  animation-name: drawer-pull-down;
  z-index: 2;
  /* drawer face shadow as it descends */
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

/* Back: Students → Teachers. Student (old) lifts back up
   and out; teacher (new) is revealed beneath. */
html:active-view-transition-type(back)::view-transition-old(root) {
  animation-name: drawer-stow-up;
  z-index: 2;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}
html:active-view-transition-type(back)::view-transition-new(root) {
  animation: none;
  z-index: 1;
}

@keyframes drawer-pull-down {
  from { transform: translate3d(0, -100%, 0); }
  to   { transform: translate3d(0, 0, 0); }
}
@keyframes drawer-stow-up {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, -100%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 1ms !important;
  }
}

/* Recolor the brass-corner gradient on student cards.
   The SVG uses a per-card linearGradient, so we overlay a CSS gradient
   on the wrapping span instead — the SVG sits beneath at lower opacity. */
.students-view .cat-corner svg stop:first-child { stop-color: #d8dee9; }
.students-view .cat-corner svg stop:nth-child(2) { stop-color: #8a96aa; }
.students-view .cat-corner svg stop:last-child { stop-color: #2c3340; }

/* Student call-number chip reads in pewter rather than warm brass */
.students-view .cat-call { color: var(--brass-shadow); }
.students-view .cat-category { color: var(--brass-shadow); }
