/* Gallery of Early Printed Books — quiet modern gallery, light theme.
   Source Serif 4 (self-hosted woff2) for text & display; system sans for UI details. */

/* ---------------------------------------------------------------- fonts */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-300-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/source-serif-4-greek-400-normal.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/source-serif-4-greek-400-italic.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/source-serif-4-greek-600-normal.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* --------------------------------------------------------------- tokens */

:root {
  --paper: #f8f5ef;
  --panel: #fdfcf8;
  --ink: #241f17;
  --mut: #79705f;
  --line: #e3dccd;
  --rubric: #9e2f23;
  --rubric-dark: #7e241a;
  --shadow: 0 1px 2px rgba(41, 32, 17, .07), 0 14px 36px rgba(41, 32, 17, .11);
  --shadow-lift: 0 2px 4px rgba(41, 32, 17, .09), 0 24px 56px rgba(41, 32, 17, .16);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* ----------------------------------------------------------------- base */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--rubric); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--rubric-dark); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .85em;
  background: #efeade;
  border-radius: 3px;
  padding: .08em .35em;
}

.kicker {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--rubric);
  margin: 0;
}

/* ------------------------------------------------------------- masthead */

.masthead {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vh, 4.5rem) 1.5rem 0;
  text-align: center;
}
.masthead h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 300;
  letter-spacing: -.015em;
  line-height: 1.12;
  margin: .9rem 0 1rem;
}
.masthead .lede {
  font-style: italic;
  color: var(--mut);
  font-size: 1.05rem;
  max-width: 36em;
  margin: 0 auto;
}
.masthead .orn {
  color: var(--rubric);
  font-size: 1.1rem;
  margin: 1.5rem 0 0;
}

/* ---------------------------------------------------------------- river */

.river {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem) 3rem;
  display: flex;
  flex-direction: column;
  position: relative;
}
/* the timeline spine: a continuous line the river flows down */
.river::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: #d9cfba;
}

/* year markers riding the spine */
.ymark {
  align-self: center;
  position: relative;
  margin-top: 2.6rem;
  padding: .15rem .8rem;
  background: var(--paper);
  font-family: var(--sans);
  font-size: .88rem;
  font-weight: 500;
  letter-spacing: .18em;
  color: var(--rubric);
}

.card {
  display: block;
  text-decoration: none;
  color: inherit;
  margin-top: 2.75rem;
  position: relative;
  background: var(--paper);
}
.ymark + .card { margin-top: 1.1rem; }
.card figure { margin: 0; }
.card img {
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  border-radius: 2px;
  box-shadow: var(--shadow);
  transition: box-shadow .35s ease, transform .35s ease;
}
.card:hover img { box-shadow: var(--shadow-lift); transform: translateY(-4px); }

/* important editions: hero-width, taller image, larger centered title */
.card.large { width: min(40rem, 100%); align-self: center; margin-top: 3.75rem; }
.card.large img { max-height: min(80vh, 42rem); }
.card.large figcaption { text-align: center; margin-top: 1.1rem; }
.card.large .ctitle { font-size: 1.32rem; }

/* lesser editions: compact side cards */
.card.small { width: min(17rem, 100%); }
.card.small img { max-height: 20rem; }
.card.small .ctitle { font-size: .98rem; }
.card.small.sm-l { align-self: flex-start; margin-left: clamp(0rem, 6vw, 4rem); }
.card.small.sm-r { align-self: flex-end; margin-right: clamp(0rem, 6vw, 4rem); }

.card figcaption { margin-top: .85rem; }
.ctitle {
  display: block;
  font-weight: 600;
  line-height: 1.35;
  transition: color .2s ease;
}
.card:hover .ctitle { color: var(--rubric); }
.cmeta {
  display: block;
  margin-top: .3rem;
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mut);
}

/* text-only card (edition without an image) */
.card.noimg {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 2px;
  padding: 2.6rem 2.2rem;
  text-align: center;
  transition: box-shadow .35s ease, transform .35s ease;
}
.card.noimg:hover { box-shadow: var(--shadow); transform: translateY(-4px); }
.card.noimg .fleuron { display: block; color: var(--rubric); font-size: 1.05rem; margin-bottom: 1.1rem; }
.card.noimg .ctitle { font-style: italic; font-weight: 400; font-size: 1.3rem; }
.card.noimg .cmeta { margin-top: .55rem; }

/* scroll reveal (river.js adds .will, then .in) */
.will { opacity: 0; transform: translateY(16px); }
.will.in { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s ease; }
.card.will.in { transition: opacity .7s ease, transform .7s ease, box-shadow .35s ease; }

.site-foot {
  text-align: center;
  padding: 3rem 1.5rem 2.5rem;
  color: var(--mut);
  font-family: var(--sans);
  font-size: .74rem;
  letter-spacing: .08em;
}
.site-foot p:first-child { color: var(--rubric); font-size: 1rem; margin: 0 0 1rem; }
.site-foot p { margin: 0; }
.site-foot .foot-rights { margin-top: .5rem; letter-spacing: .02em; }

/* --------------------------------------------------------- edition pages */

.crumb {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.4rem clamp(1.25rem, 4vw, 3rem);
}
.crumb a {
  font-family: var(--sans);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--mut);
}
.crumb a:hover { color: var(--rubric); }

.ed-head {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(1.2rem, 4vh, 2.5rem) 1.5rem 1rem;
  text-align: center;
}
.ed-head h1 {
  font-size: clamp(1.9rem, 4.6vw, 2.9rem);
  font-weight: 300;
  letter-spacing: -.012em;
  line-height: 1.15;
  margin: 1rem 0 .4rem;
  text-wrap: balance;
}
.ed-head .byline { font-style: italic; color: var(--mut); font-size: 1.1rem; margin: .2rem 0 0; }

/* inline carousel (arrows + counter, as in the collection index lightbox);
   click the image to open the zoomable lightbox */
.visuals {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.6rem clamp(1.25rem, 4vw, 3rem) 0;
}
.car-stage { position: relative; }
.visuals.multi .car-stage { padding: 0 3.4rem; }
.car-frames { display: grid; }
.visuals figure {
  grid-area: 1 / 1;
  margin: 0;
  cursor: zoom-in;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s ease, visibility .3s ease;
}
.visuals figure.active { opacity: 1; visibility: visible; pointer-events: auto; }
.visuals img {
  width: auto;
  max-width: 100%;
  max-height: 34rem;
  margin: 0 auto;
  background: #fff;
  border-radius: 2px;
  box-shadow: var(--shadow);
  transition: box-shadow .3s ease, transform .3s ease;
}
.visuals figure:hover img,
.visuals figure:focus-visible img { box-shadow: var(--shadow-lift); transform: translateY(-3px); }
.visuals figure:focus-visible { outline: none; }
.visuals figcaption {
  font-style: italic;
  font-size: .86rem;
  line-height: 1.5;
  color: var(--mut);
  max-width: 60ch;
  margin: .8rem auto 0;
}
.visuals figcaption em { font-style: normal; }
.car-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border: none;
  border-radius: 50%;
  background: rgba(36, 31, 23, .07);
  color: var(--ink);
  cursor: pointer;
  transition: background .12s;
}
.car-nav:hover { background: rgba(36, 31, 23, .15); }
.car-nav svg { width: 1.4rem; height: 1.4rem; }
.car-prev { left: 0; }
.car-next { right: 0; }
.car-counter {
  text-align: center;
  color: var(--mut);
  font-family: var(--sans);
  font-size: .74rem;
  letter-spacing: .08em;
  margin-top: .6rem;
}

@media (max-width: 640px) {
  .visuals.multi .car-stage { padding: 0 2.4rem; }
  .car-nav { width: 2.1rem; height: 2.1rem; }
}

.note, .details, .facs, .credit, .refs {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.note { padding-top: 1.8rem; font-size: 1.09rem; }
.note p { margin: 0 0 1.2em; }
.note > p:first-child::first-letter {
  float: left;
  font-size: 3.4em;
  line-height: .82;
  font-weight: 600;
  color: var(--rubric);
  padding: .04em .09em 0 0;
}

.details, .facs, .credit, .refs { margin-top: 2.4rem; }
.details h2, .facs h2, .credit h2, .refs h2 {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--mut);
  border-top: 1px solid var(--line);
  padding-top: 1.2rem;
  margin: 0 0 1.4rem;
}

.details dl {
  display: grid;
  grid-template-columns: 9rem 1fr;
  row-gap: .5rem;
  column-gap: 1.5rem;
  margin: 0;
}
.details dt {
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mut);
  padding-top: .22rem;
}
.details dd { margin: 0; }

.fac-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.fac {
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--rubric);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .45rem 1rem;
  background: var(--panel);
  transition: border-color .2s ease, background .2s ease;
}
.fac:hover { border-color: var(--rubric); background: #fbf3ee; }
.fac .arr { font-size: .78em; }

.credit p { margin: 0; font-size: .88rem; color: var(--mut); }

.refs { font-size: .95rem; padding-bottom: 1rem; }
.refs .istc { margin: 0 0 1rem; }
.refs h3 { font-size: 1.02rem; font-weight: 600; margin: 1.8rem 0 .6rem; }
.refs p, .refs ul { margin: 0 0 .9em; color: #4d463a; }
.refs ul { padding-left: 1.2rem; }
.refs li { margin-bottom: .35em; }

/* prev / next */
.pn {
  max-width: 56rem;
  margin: 3rem auto 0;
  padding: 1.6rem clamp(1.25rem, 4vw, 3rem) 2.5rem;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: start;
}
.pn-cell { text-decoration: none; color: inherit; display: block; }
.pn-label {
  display: block;
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mut);
  margin-bottom: .4rem;
}
.pn-title { display: block; font-size: .98rem; line-height: 1.4; transition: color .2s ease; }
a.pn-cell:hover .pn-title, a.pn-cell:hover .pn-label { color: var(--rubric); }
.pn-prev { text-align: left; }
.pn-up { text-align: center; padding-top: .05rem; }
.pn-next { text-align: right; }

/* ------------------------------------------------------------- lightbox */

.lb { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: rgba(28, 24, 19, .9); }
.lb[hidden] { display: none; }
.lb-bar { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .95rem 1.25rem; color: var(--paper); }
.lb-headings { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.lb-title { font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; }
.lb-meta { font-family: var(--sans); font-size: .72rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: #cdbfa6; }
.lb-actions { display: flex; align-items: center; gap: 1rem; flex: none; }
.lb-close { border: none; background: none; color: var(--paper); font-size: 1.15rem; line-height: 1; cursor: pointer; padding: .2rem .4rem; border-radius: 6px; }
.lb-close:hover { background: rgba(248, 245, 239, .16); }
.lb-zoom { display: flex; align-items: center; gap: .1rem; }
.lb-zbtn { border: none; background: none; color: var(--paper); font-size: 1.05rem; line-height: 1; cursor: pointer; padding: .2rem .5rem; border-radius: 6px; font-family: inherit; }
.lb-zbtn:hover:not(:disabled) { background: rgba(248, 245, 239, .16); }
.lb-zbtn:disabled { opacity: .3; cursor: default; }
.lb-stage { flex: 1 1 auto; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; padding: .4rem 4rem 1rem; }
.lb-img { max-width: 84vw; max-height: 74vh; object-fit: contain; background: #fff; border-radius: 2px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); transform-origin: center center; transition: transform .15s ease; touch-action: none; cursor: default; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.lb-img.is-zoomable { cursor: zoom-in; }
.lb-img.is-zoomed { cursor: grab; }
.lb-img.is-panning { cursor: grabbing; transition: none; }
.lb-cap { flex: none; align-self: center; color: #e7dcc7; font-style: italic; font-size: .88rem; line-height: 1.5; max-width: 64ch; text-align: center; margin: .7rem 0 0; padding: 0 1rem; }
.lb-cap em { font-style: normal; }
.lb-counter { flex: none; text-align: center; color: #cdbfa6; font-family: var(--sans); font-size: .74rem; letter-spacing: .08em; padding: .1rem 0 .7rem; min-height: 1rem; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem; border: none; border-radius: 50%; background: rgba(248, 245, 239, .12); color: var(--paper); cursor: pointer; transition: background .12s; }
.lb-nav:hover { background: rgba(248, 245, 239, .24); }
.lb-nav svg { width: 1.4rem; height: 1.4rem; }
.lb-prev { left: .7rem; }
.lb-next { right: .7rem; }

@media (max-width: 640px) {
  .lb-bar { flex-wrap: wrap; }
  .lb-stage { padding: .3rem 1rem 1rem; }
  .lb-nav { width: 2.1rem; height: 2.1rem; }
  .lb-prev { left: .2rem; }
  .lb-next { right: .2rem; }
  .lb-img { max-width: 94vw; max-height: 66vh; }
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 640px) {
  .card.small, .card.large { width: 100%; }
  .card.small.sm-l, .card.small.sm-r { margin-left: 0; margin-right: 0; }
  .details dl { grid-template-columns: 1fr; row-gap: .1rem; }
  .details dt { margin-top: .8rem; }
  .pn { grid-template-columns: 1fr; }
  .pn-prev, .pn-next, .pn-up { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card img, .card, .ctitle, .pn-title { transition: none; }
}
