/* Virage — the Ex-Libris identity on the web.
   Same values as Virage/UI/Theme.swift: leather binding, gold tooling, Didot and Georgia.
   No web fonts and no external requests: two files, one round trip.

   Note on the CSP in _headers: style-src is 'self', which forbids inline style attributes.
   Everything visual therefore lives here, including the per-volume cover colours, which
   arrive as custom properties set by build.py. */

:root {
  --leather: #4a1620;
  --night: #22090f;
  --night-deep: #160709;
  --gold: #c9a227;
  --gold-soft: rgba(201, 162, 39, 0.42);
  --gold-hair: rgba(201, 162, 39, 0.22);
  --ivory: #efe3c8;
  /* Was 0.62 and too faint to read against near-black at small sizes. */
  --ivory-dim: rgba(239, 227, 200, 0.74);
  --ivory-faint: rgba(239, 227, 200, 0.5);

  --display: "Didot", "Bodoni 72", "Bodoni MT", "Playfair Display", "Hoefler Text", Garamond, serif;
  --prose: Georgia, "Iowan Old Style", "Palatino Linotype", serif;

  --page: 74rem;
  --measure: 36rem;
  --band: clamp(3.5rem, 7vw, 6.5rem);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--night-deep);
  color: var(--ivory);
  font-family: var(--prose);
  font-size: 1.0625rem;
  line-height: 1.72;
  background-image:
    radial-gradient(130% 60% at 50% -10%, rgba(74, 22, 32, 0.9) 0%, rgba(34, 9, 15, 0) 62%),
    linear-gradient(180deg, var(--night) 0%, var(--night-deep) 55%);
  background-attachment: fixed;
}

/* `.wrap` is horizontal only. It used to carry `padding: 0 1.5rem`, which — being a class
   against a bare `section` selector — won on specificity and silently deleted every
   section's vertical rhythm. Spacing now lives on `.band`, which never also centres. */
.wrap { max-width: var(--page); margin-inline: auto; padding-inline: 1.5rem; }
.band { padding-block: var(--band); }
.band + .band { padding-top: 0; }

.engraved {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.26em;
  font-size: 0.7rem;
  color: var(--gold);
  margin: 0 0 1rem;
}

h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.12; margin: 0; }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); margin-bottom: 1rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1.15rem; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }
a { color: var(--gold); }

/* --- Masthead ------------------------------------------------------------ */

.masthead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: 1.5rem;
}
.wordmark {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--display); font-size: 1.45rem; color: var(--ivory);
  text-decoration: none; letter-spacing: 0.02em;
}
.wordmark .seal { width: 1.6rem; height: 1.6rem; }

.lang { display: flex; gap: 0.35rem; align-items: center; }
.lang a, .lang span {
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 0.72rem; text-decoration: none; padding: 0.4rem 0.7rem; border-radius: 4px;
  border: 1px solid transparent;
}
.lang a { color: var(--ivory-dim); border-color: var(--gold-hair); }
.lang a:hover { color: var(--gold); border-color: var(--gold-soft); }
.lang [aria-current] { color: var(--night); background: var(--gold); }

/* --- The seal, and its drawing ------------------------------------------- */

.seal circle, .seal path,
.hero-seal circle, .hero-seal path {
  fill: none; stroke: var(--gold); stroke-linecap: round; stroke-linejoin: round;
}

.hero-seal { width: clamp(5rem, 9vw, 7rem); height: clamp(5rem, 9vw, 7rem); display: block; }
.hero-seal .ring { stroke-width: 1.6; opacity: 0.75; }
.hero-seal .bend { stroke-width: 3; }

/* The mark draws itself once, the way a seal is struck rather than faded in. */
@media (prefers-reduced-motion: no-preference) {
  .hero-seal .ring, .hero-seal .bend {
    stroke-dasharray: var(--len);
    stroke-dashoffset: var(--len);
    animation: strike 1.5s cubic-bezier(0.65, 0, 0.35, 1) forwards;
  }
  .hero-seal .ring { --len: 302; }
  .hero-seal .bend { --len: 150; animation-delay: 0.45s; }

  .hero h1, .hero .tagline, .hero .lede, .hero .actions {
    animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  }
  .hero h1 { animation-delay: 0.35s; }
  .hero .tagline { animation-delay: 0.55s; }
  .hero .lede { animation-delay: 0.7s; }
  .hero .actions { animation-delay: 0.85s; }
}

@keyframes strike { to { stroke-dashoffset: 0; } }
@keyframes rise {
  from { opacity: 0; transform: translateY(0.9rem); }
  to { opacity: 1; transform: none; }
}

/* --- Hero ---------------------------------------------------------------- */

.hero { padding-block: clamp(2rem, 5vw, 4rem) var(--band); }
.hero-inner { display: grid; gap: clamp(2.5rem, 5vw, 4rem); align-items: center; }
@media (min-width: 62rem) {
  .hero-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr); }
}

.hero h1 {
  font-size: clamp(3.4rem, 8vw, 6.2rem);
  margin: 1.2rem 0 0;
  letter-spacing: 0.005em;
}
.hero .tagline {
  font-family: var(--display); font-style: italic;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  color: var(--gold); margin: 0.7rem 0 1.7rem;
  max-width: none;
}
.hero .lede { font-size: 1.12rem; }

.actions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-top: 2rem; }
.gilded {
  display: inline-block; text-decoration: none;
  background: var(--gold); color: var(--night);
  font-family: var(--display); font-size: 1.08rem;
  padding: 0.9rem 1.9rem; border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  transition: filter 0.2s ease, transform 0.2s ease;
}
.gilded:hover { filter: brightness(1.08); transform: translateY(-1px); }
.aside { font-size: 0.9rem; color: var(--ivory-dim); max-width: 18rem; }

/* The three covers leaning on the shelf beside the pitch. */
.hero-shelf { display: none; }
@media (min-width: 62rem) {
  .hero-shelf {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 0.9rem; align-items: end;
  }
  .hero-shelf .cover:nth-child(1) { transform: rotate(-3deg) translateY(0.6rem); }
  .hero-shelf .cover:nth-child(2) { transform: translateY(-0.7rem); z-index: 2; }
  .hero-shelf .cover:nth-child(3) { transform: rotate(3deg) translateY(0.6rem); }
}

/* Heading in one column, prose in the other. A measure of 36rem is right for reading and
   wrong for a 74rem page: alone it leaves half the screen empty and the page looks
   unfinished rather than airy. */
.split { display: grid; gap: 1rem; }
@media (min-width: 62rem) {
  .split { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 3.5rem; align-items: start; }
  .split .head { margin: 0; }
  .split h2 { margin-bottom: 0; }
}

/* --- Ornament rule ------------------------------------------------------- */

.rule { display: flex; align-items: center; gap: 1.2rem; color: var(--gold-hair); }
.rule::before, .rule::after { content: ""; height: 1px; background: currentColor; flex: 1; }
.rule span { color: var(--gold); opacity: 0.75; font-size: 1rem; }

/* --- Cards --------------------------------------------------------------- */

.framed {
  border: 1px solid var(--gold-hair);
  border-radius: 10px;
  background: rgba(34, 9, 15, 0.5);
  padding: 1.6rem 1.7rem;
  position: relative;
}
.framed::after {
  content: ""; position: absolute; inset: 4px;
  border: 1px solid rgba(201, 162, 39, 0.14); border-radius: 7px;
  pointer-events: none;
}
.framed p { max-width: none; color: var(--ivory-dim); }

.grid { display: grid; gap: 1.1rem; margin-top: 2.2rem; }
@media (min-width: 48rem) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 42rem) { .grid.two { grid-template-columns: repeat(2, 1fr); } }

.step .num {
  font-family: var(--display); font-size: 2.1rem; color: var(--gold);
  line-height: 1; display: block; margin-bottom: 0.6rem;
}
.step h3 { margin-bottom: 0.45rem; }

/* --- Notice -------------------------------------------------------------- */

.notice {
  border-left: 3px solid var(--gold);
  background: rgba(74, 22, 32, 0.4);
  padding: 1.2rem 1.4rem; border-radius: 0 8px 8px 0;
  max-width: var(--measure);
}
.notice strong { color: var(--gold); font-weight: normal; font-family: var(--display); font-size: 1.05rem; }

/* --- The shelf ----------------------------------------------------------- */

.shelf { display: grid; gap: 1.4rem 1.1rem; margin-top: 2.4rem; }
.shelf.produced { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.shelf.awaited { grid-template-columns: repeat(auto-fit, minmax(min(50% - 0.55rem, 10.5rem), 1fr)); }

.volume { display: flex; flex-direction: column; gap: 0.7rem; }

/* The app's VolumeTile: the mood colour sinking into the night, title on the cover. */
.cover {
  position: relative;
  aspect-ratio: 1 / 1.32;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--gold-soft);
  background-image: linear-gradient(145deg, var(--mood, var(--leather)) 0%, var(--night) 100%);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 0.7rem;
}
.cover::after {
  content: ""; position: absolute; inset: 4px;
  border: 1px solid rgba(201, 162, 39, 0.28); border-radius: 7px;
  pointer-events: none;
}
.cover .band-tag {
  align-self: flex-start;
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.16em;
  font-size: 0.56rem; padding: 0.28rem 0.5rem; border-radius: 4px;
  border: 1px solid var(--gold-soft); color: var(--gold);
  background: rgba(22, 7, 9, 0.55);
}
.cover .band-tag.filled { background: var(--gold); color: var(--night); border-color: var(--gold); }
.cover .title {
  font-family: var(--display); color: var(--ivory);
  font-size: clamp(0.98rem, 1.5vw, 1.25rem); line-height: 1.15;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
  margin: 0; padding: 0.2rem 0.25rem 0.1rem; max-width: none;
}
/* Announced volumes are there to be wanted, not mistaken for something you can open. */
.volume.awaited .cover { opacity: 0.72; }

.loupes { display: flex; gap: 0.22rem; padding: 0.35rem 0.25rem 0; }
.loupes i {
  width: 0.5rem; height: 0.5rem; border-radius: 50%; display: block;
  border: 1px solid var(--gold); background: transparent;
}
.loupes i.on { background: var(--gold); }

.volume .caption {
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 0.6rem; color: var(--gold); margin: 0;
}
.volume .name { font-family: var(--display); font-size: 1.05rem; color: var(--ivory); margin: 0; }
.volume .blurb { font-size: 0.92rem; color: var(--ivory-dim); margin: 0.3rem 0 0; max-width: none; }

/* --- Footer -------------------------------------------------------------- */

footer { border-top: 1px solid var(--gold-hair); margin-top: var(--band); padding-block: 2.5rem 3.5rem; }
footer p { font-size: 0.88rem; color: var(--ivory-faint); }
footer .links { display: flex; flex-wrap: wrap; gap: 1.4rem; margin-bottom: 1rem; }
footer a { text-decoration: none; font-size: 0.9rem; }
footer a:hover { text-decoration: underline; }

/* --- Skip link ----------------------------------------------------------- */

.skip {
  position: absolute; left: -9999px;
  background: var(--gold); color: var(--night); padding: 0.6rem 1rem; border-radius: 0 0 6px 0;
}
.skip:focus { left: 0; top: 0; z-index: 10; }
