/* ===========================================================================
   Athanor — antiquarian catalogue styling.

   Self-contained on purpose: one self-hosted display face (Cormorant, SIL OFL
   1.1; no third-party font CDN) over a system-serif body/fallback, plus one
   small progressive-enhancement filter script and eBay-CDN-hotlinked covers.
   The "signature" element is the catalogue card (the listing treatment): a
   tipped-in cover plate, a monospace accession number, and a wax-seal "just
   listed" mark. Everything else stays disciplined.

   Quality floor: responsive grid, visible :focus-visible states, motion gated
   behind prefers-reduced-motion, no layout shift (aspect-ratio on plates).
   =========================================================================== */

:root {
  --paper:        #efe7d5;   /* aged parchment            */
  --paper-panel:  #e8ddc6;   /* deeper parchment (panels) */
  --paper-edge:   #e0d3b6;
  --ink:          #2a2017;   /* sepia-black ink           */
  --ink-soft:     #5d4e3b;   /* faded ink                 */
  --ink-faint:    #8a795f;
  --rule:         #cdbb97;   /* hairline rule             */
  --oxblood:      #6e2326;   /* primary accent            */
  --oxblood-deep: #511619;
  --gold:         #997a3c;   /* gold leaf                 */
  --gold-bright:  #b8945a;
  --shadow:       rgba(42,32,18,.20);
  --shadow-soft:  rgba(42,32,18,.10);
  --maxw:         1180px;
}

/* One self-hosted display face — Cormorant SemiBold, SIL OFL 1.1 (license in
   assets/fonts/OFL.txt). Headings only; the system serif stays the body voice
   AND the fallback, so first paint / any missing-font case looks unchanged. */
@font-face {
  font-family: "Cormorant";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/cormorant-semibold-latin.woff2") format("woff2");
}

* { box-sizing: border-box; }

/* The filter bar toggles [hidden] on cards/sections; .entry sets display:flex,
   which would otherwise win over the UA [hidden] rule — force it off. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--paper);
  /* faint, image-free paper mottling */
  background-image:
    radial-gradient(circle at 18% 8%, rgba(255,255,255,.40), transparent 42%),
    radial-gradient(circle at 84% 96%, rgba(110,35,38,.05), transparent 46%),
    radial-gradient(circle at 50% 50%, rgba(120,92,42,.04), transparent 70%);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 18px;
  line-height: 1.55;
  font-variant-numeric: oldstyle-nums;   /* book typography: text figures */
  text-rendering: optimizeLegibility;
}

/* Display headings borrow Cormorant; everything else stays system serif. */
.masthead h1,
.section-head h2,
.leaf h1,
.collection-header h1 {
  font-family: "Cormorant", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-weight: 600;
}

/* Figures that must stay unambiguous/aligned keep lining (tabular) numerals. */
.price, .accession, .count, .fb-count, .tile-count, .site-foot .built {
  font-variant-numeric: lining-nums tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

a { color: var(--oxblood); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }

/* --- Masthead ------------------------------------------------------------ */

.masthead { text-align: center; padding: 3.2rem 1.5rem 1.4rem; }

.masthead .ornament {
  color: var(--gold);
  font-size: 1.4rem;
  letter-spacing: .5em;
  margin-left: .5em;   /* offset the letter-spacing so it stays centered */
}

.masthead h1 {
  font-size: clamp(2.1rem, 5.5vw, 3.4rem);
  font-weight: 600;
  letter-spacing: .04em;
  margin: .5rem 0 .2rem;
  line-height: 1.05;
}

.masthead .tagline {
  font-style: italic;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2.4vw, 1.18rem);
  margin: 0 auto;
  max-width: 38rem;
}

/* ADR 0009 curated reframe: an understated framing line so a hand-picked (sparse)
   Index reads as an intentional editorial selection, not a thin/broken feed. */
.curated-lede {
  text-align: center;
  color: var(--ink-soft);
  font-size: .95rem;
  letter-spacing: .02em;
  max-width: 42rem;
  margin: 0 auto 1.6rem;
}

.rule-double {
  max-width: var(--maxw);
  margin: 1.6rem auto 0;
  border: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  height: 4px;
}

/* --- Affiliate disclosure ------------------------------------------------ */

.disclosure {
  background: var(--paper-panel);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--oxblood);
  color: var(--ink-soft);
  font-size: .86rem;
  line-height: 1.5;
  padding: .8rem 1.1rem;
  margin: 1.6rem auto;
  border-radius: 2px;
}
.disclosure strong { color: var(--ink); }

/* --- Filter bar (catalogue request slip) --------------------------------- */

.filter-bar {
  background: linear-gradient(177deg, #f1e9d8, var(--paper-panel));
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: 2px;
  padding: .9rem 1.1rem;
  margin: 1.6rem auto;
}
.fb-row { display: flex; flex-wrap: wrap; gap: .8rem 1.1rem; align-items: flex-end; }
.fb-field { display: flex; flex-direction: column; gap: .28rem; }
.fb-field > span {
  font-variant: small-caps;
  letter-spacing: .07em;
  font-size: .74rem;
  color: var(--ink-faint);
}
.fb-grow { flex: 1 1 15rem; }
.fb-field input, .fb-field select {
  font-family: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: #f8f2e4;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: .42rem .55rem;
}
.fb-grow input { width: 100%; }
.fb-range { display: flex; align-items: center; gap: .4rem; color: var(--ink-faint); }
.fb-range input { width: 5.2rem; }
.fb-check {
  display: flex; align-items: center; gap: .45rem;
  align-self: center;
  font-variant: small-caps; letter-spacing: .06em;
  font-size: .9rem; color: var(--ink-soft);
}
.fb-reset {
  align-self: center;
  font-family: inherit; font-size: .82rem;
  color: var(--ink-soft);
  background: #efe4cd;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: .46rem .9rem;
  cursor: pointer;
}
.fb-reset:hover { background: #e7d9bd; }
.fb-count {
  margin: .7rem 0 0;
  font-family: ui-monospace, "Courier New", monospace;
  font-size: .73rem;
  color: var(--ink-faint);
}
.filter-bar :focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* --- Section headers ----------------------------------------------------- */

.section { margin: 2.6rem auto; }

.section-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.section-head::before,
.section-head::after {
  content: "";
  flex: 1;
  border-top: 4px double var(--rule);   /* frontispiece / title-page rule */
}
.section-head h2 {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 0;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .section-head { flex-wrap: wrap; gap: .7rem; }
  .section-head h2 { white-space: normal; font-size: 1.05rem; letter-spacing: .08em; }
  .section-head .count { flex-basis: 100%; text-align: center; }
}
.section-head .count {
  font-family: ui-monospace, "Courier New", monospace;
  font-size: .8rem;
  color: var(--ink-faint);
  letter-spacing: .05em;
}

/* --- Catalogue grid + card (the signature element) ----------------------- */

.catalogue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.6rem;
}

.entry {
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(177deg, #f3ecdc 0%, var(--paper-panel) 100%);
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: 0 1px 0 #fff6e6 inset, 0 2px 8px var(--shadow-soft);
  padding: 1.1rem 1.1rem 1.2rem;
}

@media (prefers-reduced-motion: no-preference) {
  .entry { transition: box-shadow .25s ease, transform .25s ease; }
  .entry:hover { box-shadow: 0 1px 0 #fff6e6 inset, 0 10px 22px var(--shadow); transform: translateY(-2px); }
}

/* accession number, like a card-catalogue index */
.entry .accession {
  position: absolute;
  top: .55rem;
  right: .7rem;
  font-family: ui-monospace, "Courier New", monospace;
  font-size: .64rem;
  letter-spacing: .06em;
  color: var(--ink-faint);
}

/* cover "plate", tipped-in */
.plate {
  position: relative;
  aspect-ratio: 4 / 5;
  margin: .2rem 0 1rem;
  background: #ded0b2;
  border: 1px solid var(--paper-edge);
  box-shadow: 0 2px 6px var(--shadow), 0 0 0 5px #f1e9d8;
  overflow: hidden;
}
.plate img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* illuminated monogram placeholder when no cover exists */
.plate--empty {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 38%, #f1e7d2, #d9c8a6);
}
.plate--empty .monogram {
  font-size: 4.2rem;
  color: var(--oxblood);
  opacity: .55;
  font-weight: 600;
  text-shadow: 0 1px 0 #fff3df;
}
.plate--empty .glyph {
  position: absolute;
  bottom: .5rem;
  color: var(--gold);
  font-size: 1rem;
  opacity: .7;
}

/* wax-seal "just listed" mark */
.seal {
  position: absolute;
  top: -.6rem;
  left: -.6rem;
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, #9c3a35, var(--oxblood) 55%, var(--oxblood-deep) 100%);
  color: #f4e3c4;
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: 0 2px 5px var(--shadow), 0 0 0 1px rgba(81,22,25,.5) inset;
  transform: rotate(-9deg);
  z-index: 2;
}
.seal .seal-glyph { font-size: 1.1rem; line-height: 1; margin-bottom: .04rem; }
.seal .seal-text {
  font-size: .34rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-family: ui-monospace, "Courier New", monospace;
}

.entry h3 {
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.28;
  margin: 0 0 .35rem;
  overflow-wrap: break-word;
}
.entry h3 a { color: var(--ink); text-decoration: none; }
.entry h3 a:hover { color: var(--oxblood); text-decoration: underline; text-decoration-color: var(--gold); }

.entry .byline { font-style: italic; color: var(--ink-soft); margin: 0 0 .55rem; font-size: .95rem; }

.entry .meta {
  list-style: none;
  margin: 0 0 .9rem;
  padding: 0;
  font-size: .82rem;
  color: var(--ink-soft);
}
.entry .meta li { display: flex; gap: .5rem; padding: .12rem 0; }
.entry .meta .k {
  font-variant: small-caps;
  letter-spacing: .05em;
  color: var(--ink-faint);
  min-width: 5.2rem;
}
.tag {
  display: inline-block;
  font-size: .72rem;
  font-variant: small-caps;
  letter-spacing: .06em;
  padding: .05rem .5rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-soft);
  background: #f1e8d6;
}

.entry .foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding-top: .7rem;
  border-top: 1px solid var(--rule);
}
.price { font-size: 1.32rem; font-weight: 600; color: var(--oxblood-deep); white-space: nowrap; }
.price .cur { font-size: .7rem; vertical-align: .35em; color: var(--ink-faint); margin-right: .1rem; }

/* --- Call-to-action ------------------------------------------------------ */

.cta {
  display: inline-block;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: .9rem;
  letter-spacing: .03em;
  color: #f6ead0;
  background: linear-gradient(180deg, #7c2a2c, var(--oxblood) 60%, var(--oxblood-deep));
  border: 1px solid var(--oxblood-deep);
  border-radius: 2px;
  padding: .5rem .9rem;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(255,235,200,.25) inset, 0 1px 3px var(--shadow);
  white-space: nowrap;
}
@media (prefers-reduced-motion: no-preference) {
  .cta { transition: background .2s ease, transform .1s ease; }
}
.cta:hover { background: linear-gradient(180deg, #8a3032, #6e2326 60%, #441214); }
.cta:active { transform: translateY(1px); }

/* visible focus everywhere */
a:focus-visible, .cta:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
  border-radius: 1px;
}

/* --- Per-listing (catalogue plate) page ---------------------------------- */

.crumb { font-size: .82rem; margin: 1.6rem 0 0; color: var(--ink-soft); }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

.leaf {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 2.2rem;
  margin: 1.4rem auto 2.6rem;
  background: linear-gradient(177deg, #f3ecdc, var(--paper-panel));
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: 0 2px 12px var(--shadow-soft);
  padding: 1.8rem;
}
.leaf .plate { aspect-ratio: 4 / 5; margin: 0; }
.leaf h1 { font-size: clamp(1.5rem, 3.6vw, 2.1rem); line-height: 1.18; margin: .2rem 0 .5rem; overflow-wrap: break-word; }
.leaf .byline { font-style: italic; font-size: 1.15rem; color: var(--ink-soft); margin: 0 0 1.1rem; }
.leaf .specs { list-style: none; padding: 0; margin: 0 0 1.4rem; }
.leaf .specs li { display: flex; gap: 1rem; padding: .35rem 0; border-bottom: 1px dotted var(--rule); }
.leaf .specs .k { font-variant: small-caps; letter-spacing: .05em; color: var(--ink-faint); min-width: 7rem; }
.leaf .buy { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; margin-top: .4rem; }
.leaf .buy .price { font-size: 1.8rem; }
.leaf .cta { font-size: 1.02rem; padding: .7rem 1.3rem; }

@media (max-width: 640px) {
  .leaf { grid-template-columns: 1fr; gap: 1.4rem; padding: 1.2rem; }
  .leaf .plate { max-width: 260px; }
}

/* --- Footer -------------------------------------------------------------- */

.site-foot {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding: 2rem 1.5rem 3rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: .82rem;
}
.site-foot .ornament { color: var(--gold); letter-spacing: .4em; }
.site-foot p { margin: .5rem auto; max-width: 44rem; }
.site-foot .built { font-family: ui-monospace, "Courier New", monospace; font-size: .72rem; color: var(--ink-faint); }

/* dev banner shown only when affiliate IDs are placeholders */
.devnote {
  background: #f6e9c8;
  border: 1px dashed var(--gold);
  color: #6b551f;
  font-size: .8rem;
  padding: .6rem 1rem;
  margin: 1.2rem auto;
  border-radius: 2px;
  text-align: center;
}

.empty-state { text-align: center; color: var(--ink-soft); font-style: italic; padding: 3rem 1rem; }

/* --- Subject links + "browse by subject" band ---------------------------- */

.subject-link {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--gold);
  text-underline-offset: 2px;
}
.subject-link:hover { color: var(--oxblood); text-decoration-style: solid; }

.browse-band {
  text-align: center;
  margin: 1.4rem auto;
  font-variant: small-caps;
  letter-spacing: .06em;
}
.browse-band a {
  color: var(--oxblood);
  text-decoration: none;
  border-bottom: 1px dotted var(--gold);
  padding-bottom: 2px;
}
.browse-band a:hover { color: var(--oxblood-deep); border-bottom-style: solid; }

.crumb-sep { color: var(--ink-faint); margin: 0 .15rem; }

/* --- Collection page + "Browse by subject" hub --------------------------- */

.collection-header { text-align: center; margin: 1.8rem auto 1.2rem; max-width: 46rem; }
.collection-header .eyebrow {
  display: inline-block;
  font-variant: small-caps;
  letter-spacing: .22em;
  font-size: .8rem;
  color: var(--ink-faint);
  margin: 0 auto .5rem;
  padding: 0 1rem .4rem;
  border-bottom: 4px double var(--rule);   /* knocked-out label over a double rule */
}
.collection-header h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: .01em;
  margin: .2rem 0 .5rem;
}
.collection-intro {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.02rem;
  margin: 0 auto;
  max-width: 40rem;
}
.collection-foot { margin: 2rem 0 1rem; text-align: center; }
.collection-foot a { color: var(--oxblood); text-decoration: none; }
.collection-foot a:hover { text-decoration: underline; text-decoration-color: var(--gold); }

/* hub tiles reuse the .entry shell (card frame + hover lift) */
.collection-tile { text-decoration: none; color: var(--ink); }
.collection-tile .plate { margin-bottom: .8rem; }
.collection-tile h3 {
  font-size: 1.12rem;
  font-weight: 600;
  text-align: center;
  margin: .1rem 0 .2rem;
}
.collection-tile .tile-count {
  margin: 0;
  text-align: center;
  font-family: ui-monospace, "Courier New", monospace;
  font-size: .72rem;
  letter-spacing: .04em;
  color: var(--ink-faint);
}
.collection-tile:hover h3 { color: var(--oxblood); }
