/* ============================================================
   VOGTOV — V2 "Arcanum"
   A grand library between worlds. Typography is the architecture.
   ============================================================ */

:root {
  --ink: #0d0b14;
  --leather: #161221;
  --recessed: #080711;
  --vellum: #f0e9da;
  --lilac: #a79fb3;
  --gilt: #d4a94f;
  --gilt-bright: #edcf8a;
  --garnet: #c25b6c;
  --hairline: rgba(212, 169, 79, 0.22);
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body: 'Newsreader', 'Georgia', serif;
}

[hidden] { display: none !important; }

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

body {
  background:
    radial-gradient(90% 60% at 50% 0%, #141021 0%, var(--ink) 55%),
    var(--ink);
  color: var(--vellum);
  font-family: var(--font-body);
  font-optical-sizing: auto;
  font-size: 1.14rem;
  line-height: 1.72;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(194, 91, 108, 0.4); color: #fff; }

:focus-visible {
  outline: 2px solid var(--gilt);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- ambient layers ---------- */

.candle {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(520px circle at var(--cx, 50%) var(--cy, 30%),
    rgba(237, 207, 138, 0.10), rgba(237, 207, 138, 0.035) 40%, transparent 70%);
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 40;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

.page-frame {
  position: fixed;
  inset: 14px;
  z-index: 45;
  pointer-events: none;
  border: 1px solid var(--hairline);
  outline: 1px solid rgba(212, 169, 79, 0.09);
  outline-offset: 4px;
}

@media (max-width: 720px) {
  .page-frame { inset: 8px; outline: none; }
}

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

.masthead {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(28px, 5vw, 64px);
  transition: background 0.5s ease, border-color 0.5s ease;
  border-bottom: 1px solid transparent;
}

.masthead.scrolled {
  background: rgba(13, 11, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(212, 169, 79, 0.14);
}

.masthead-mark {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--gilt);
  text-decoration: none;
}

.masthead-nav { display: flex; gap: clamp(14px, 3vw, 34px); flex-wrap: wrap; }

.masthead-nav a {
  font-family: var(--font-body);
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--lilac);
  text-decoration: none;
  transition: color 0.35s ease;
}

.masthead-nav a:hover, .masthead-nav a.active { color: var(--gilt-bright); }

.masthead-nav a {
  position: relative;
  padding-bottom: 4px;
}

.masthead-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--gilt), var(--garnet));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.masthead-nav a.active::after { transform: scaleX(1); }

.masthead-mark { transition: color 0.35s ease, text-shadow 0.35s ease; }
.masthead-mark:hover { color: var(--gilt-bright); text-shadow: 0 0 22px rgba(212, 169, 79, 0.6); }

.nav-min { display: none; }

@media (max-width: 760px) {
  .nav-full { display: none; }
  .nav-min { display: inline; }
  .masthead-nav { gap: 22px; }
}

/* ---------- shared type ---------- */

.small-caps {
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--lilac);
}

main { position: relative; z-index: 10; }

/* reveal primitives */
.line-mask { display: inline-block; overflow: hidden; vertical-align: bottom; }
.line-mask .line {
  display: inline-block;
  transform: translateY(112%);
  transition: transform 1.1s cubic-bezier(0.19, 1, 0.22, 1);
}
.in .line, .line-mask.in .line { transform: translateY(0); }

.fade-line {
  opacity: 0;
  letter-spacing: 0.6em;
  transition: opacity 1.4s ease, letter-spacing 1.4s cubic-bezier(0.19, 1, 0.22, 1);
}
.fade-line.in { opacity: 1; letter-spacing: 0.34em; }

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s cubic-bezier(0.19, 1, 0.22, 1), transform 1s cubic-bezier(0.19, 1, 0.22, 1);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- frontispiece ---------- */

.frontispiece {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 140px 24px 90px;
  gap: 34px;
}

.great-title {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
  font-weight: 500;
  font-size: clamp(4.2rem, 17vw, 13.5rem);
  line-height: 0.92;
  letter-spacing: 0.01em;
  color: var(--vellum);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 0.22em;
  text-shadow: 0 0 60px rgba(212, 169, 79, 0.18);
}

.ornament {
  width: clamp(130px, 18vw, 210px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--hairline), 0 0 70px rgba(212, 169, 79, 0.18);
}

.ornament img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: ornament-turn 240s linear infinite;
}

@keyframes ornament-turn { to { transform: rotate(360deg); } }

.epigraphs { display: flex; flex-direction: column; gap: 10px; }

.epigraph {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 100, 'WONK' 0;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.15rem, 2.6vw, 1.6rem);
  color: var(--lilac);
}

.epigraph-rule { color: var(--gilt); font-size: 1.1rem; }

.est { color: rgba(167, 159, 179, 0.7); }

/* ---------- chapters ---------- */

.chapter {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(90px, 14vh, 150px) clamp(24px, 5vw, 48px);
}

.chapter-head {
  position: relative;
  text-align: center;
  margin-bottom: clamp(50px, 8vh, 80px);
}

.chapter-numeral {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -54%);
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
  font-style: italic;
  font-size: clamp(11rem, 26vw, 20rem);
  line-height: 1;
  color: rgba(212, 169, 79, 0.07);
  pointer-events: none;
  user-select: none;
}

.chapter-title {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 30, 'WONK' 0;
  font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 4rem);
  margin-top: 14px;
  color: var(--vellum);
}

.chapter-sub {
  max-width: 620px;
  margin: 26px auto 0;
  color: var(--lilac);
  font-size: 1.05rem;
}

/* ---------- folio (manifesto) ---------- */

.folio {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
}

.folio-text {
  margin-bottom: 30px;
  color: rgba(240, 233, 218, 0.88);
}

.folio-text em {
  font-variation-settings: 'SOFT' 100;
  color: var(--gilt-bright);
}

.drop::first-letter {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
  font-weight: 600;
  font-size: 4.6em;
  line-height: 0.78;
  float: left;
  padding: 0.08em 0.12em 0 0;
  color: var(--gilt);
}

.marginalia {
  position: absolute;
  top: 16%;
  right: -230px;
  width: 190px;
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.5;
  color: rgba(167, 159, 179, 0.75);
  transform: rotate(1.6deg);
  border-left: 1px solid var(--hairline);
  padding-left: 16px;
}

.marginalia-2 { top: auto; bottom: 8%; right: auto; left: -230px; transform: rotate(-1.4deg); border-left: none; border-right: 1px solid var(--hairline); padding-left: 0; padding-right: 16px; text-align: right; }

@media (max-width: 1180px) { .marginalia { display: none; } }

/* ---------- sigil divider ---------- */

.sigil-divider {
  margin: clamp(60px, 10vh, 110px) auto 0;
  max-width: 560px;
  padding: 0 24px;
}

.sigil-divider svg { width: 100%; height: auto; display: block; }

.sigil-path {
  stroke: var(--gilt);
  stroke-width: 1;
  opacity: 0.65;
  stroke-dasharray: var(--len, 1200);
  stroke-dashoffset: var(--len, 1200);
  transition: stroke-dashoffset 2.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.sigil-divider.drawn .sigil-path { stroke-dashoffset: 0; }

.sigil-star {
  fill: var(--gilt-bright);
  opacity: 0;
  transition: opacity 0.8s ease;
}

.sigil-divider.drawn .sigil-star { opacity: 0.9; }
.sigil-divider.drawn .sigil-star:nth-child(3) { transition-delay: 0.5s; }
.sigil-divider.drawn .sigil-star:nth-child(4) { transition-delay: 0.9s; }
.sigil-divider.drawn .sigil-star:nth-child(5) { transition-delay: 1.3s; }
.sigil-divider.drawn .sigil-star:nth-child(6) { transition-delay: 1.7s; }
.sigil-divider.drawn .sigil-star:nth-child(7) { transition-delay: 2.1s; }
.sigil-divider.drawn .sigil-star:nth-child(8) { transition-delay: 2.5s; }

/* ---------- the works / plates ---------- */

.plate-row {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: clamp(34px, 6vw, 70px);
  align-items: center;
  margin-bottom: clamp(80px, 12vh, 130px);
}

.plate-row-flip .plate { order: 2; }
.plate-row-flip .plate-entry { order: 1; text-align: right; }
.plate-row-flip .entry-link { flex-direction: row-reverse; }

@media (max-width: 780px) {
  .plate-row { grid-template-columns: 1fr; gap: 30px; }
  .plate-row-flip .plate { order: 0; }
  .plate-row-flip .plate-entry { order: 1; text-align: left; }
}

.plate {
  position: relative;
  padding: 12px;
  border: 1px solid var(--hairline);
  outline: 1px solid rgba(212, 169, 79, 0.1);
  outline-offset: 6px;
  background: var(--leather);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.55);
}

.plate-link {
  display: block;
  overflow: hidden;
}

.plate img {
  width: 100%;
  height: auto;
  display: block;
  filter: saturate(0.96);
  transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1), filter 0.8s ease;
}

.plate-row:hover .plate img, .plate-link:focus-visible img {
  transform: scale(1.035);
  filter: saturate(1) brightness(1.08);
}

.plate figcaption {
  text-align: center;
  padding: 14px 6px 4px;
  color: var(--gilt);
  font-size: 0.72rem;
  transition: color 0.5s ease;
}

.plate-row:hover .plate figcaption { color: var(--gilt-bright); }

.plate-entry .entry-status { margin-bottom: 18px; }
.entry-status.live { color: var(--gilt); }

.entry-title {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.05;
  margin-bottom: 20px;
  background: linear-gradient(100deg, var(--vellum) 30%, var(--gilt-bright) 50%, var(--vellum) 70%);
  background-size: 240% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: background-position 1.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.plate-row:hover .entry-title, .tome:hover .tome-title { background-position: 0 0; }

.entry-body { color: rgba(240, 233, 218, 0.82); margin-bottom: 26px; max-width: 46ch; }
.plate-row-flip .entry-body { margin-left: auto; }

.entry-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: 'SOFT' 100;
  font-size: 1.12rem;
  color: var(--gilt-bright);
  text-decoration: none;
  position: relative;
  padding-bottom: 4px;
}

.entry-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--gilt), var(--garnet));
  transform: scaleX(0.3);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.entry-link:hover::after { transform: scaleX(1); }

.entry-link span {
  display: inline-block;
  transition: transform 0.45s cubic-bezier(0.19, 1, 0.22, 1);
}

.entry-link:hover span { transform: translateX(5px); }

/* ---------- the vault ---------- */

.vault {
  position: relative;
  margin: 0 calc(-1 * clamp(24px, 5vw, 48px));
  padding: clamp(70px, 10vh, 110px) clamp(24px, 5vw, 48px);
  background: var(--recessed);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.vault-head { text-align: center; margin-bottom: 60px; }

.vault-title {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 30, 'WONK' 0;
  font-weight: 500;
  font-size: clamp(1.8rem, 4.4vw, 2.7rem);
  margin: 12px 0 18px;
}

.vault-note {
  max-width: 460px;
  margin: 0 auto;
  color: var(--lilac);
  font-size: 1rem;
  font-style: italic;
}

.vault-shelf {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(26px, 4vw, 46px);
  max-width: 860px;
  margin: 0 auto;
}

@media (max-width: 720px) { .vault-shelf { grid-template-columns: 1fr; } }

.tome {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(212, 169, 79, 0.16);
  background: linear-gradient(160deg, rgba(22, 18, 33, 0.9), rgba(8, 7, 17, 0.9));
  padding: 30px;
  text-align: center;
  transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

/* ghosted spine of the sleeping volume behind its seal */
.tome::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--tome-img) center 20% / cover no-repeat;
  opacity: 0.07;
  filter: blur(2px) saturate(0.4);
  pointer-events: none;
  transition: opacity 0.7s ease;
}

.tome.open::before { opacity: 0; }
.tome > * { position: relative; }

.tome:hover { border-color: rgba(212, 169, 79, 0.4); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5); }

.tome-seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  color: inherit;
}

.seal-wax {
  position: relative;
  width: 84px;
  height: 84px;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.55));
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.seal-wax svg { width: 100%; height: 100%; overflow: visible; }

.seal-mono {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  fill: rgba(240, 233, 218, 0.92);
  letter-spacing: 1px;
}

.seal-half {
  transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease 0.1s;
  transform-origin: 50% 50%;
}

.tome-seal:hover .seal-wax { transform: rotate(-6deg) scale(1.05); }

.tome.open .seal-left { transform: translate(-16px, 7px) rotate(-16deg); opacity: 0; }
.tome.open .seal-right { transform: translate(15px, -5px) rotate(13deg); opacity: 0; }
.tome.open .seal-wax { transform: scale(0.9); }

/* gilt dust when the seal cracks */
.seal-spark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gilt-bright);
  opacity: 0;
  pointer-events: none;
}

.tome.open .seal-spark { animation: spark-fly 0.9s cubic-bezier(0.2, 0.6, 0.4, 1) 0.12s; }
.tome.open .seal-spark:nth-child(2) { --sx: -30px; --sy: -24px; }
.tome.open .seal-spark:nth-child(3) { --sx: 28px; --sy: -30px; animation-delay: 0.18s; }
.tome.open .seal-spark:nth-child(4) { --sx: -22px; --sy: 26px; animation-delay: 0.22s; }
.tome.open .seal-spark:nth-child(5) { --sx: 32px; --sy: 18px; animation-delay: 0.15s; }

@keyframes spark-fly {
  0% { opacity: 0.95; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--sx, 24px), var(--sy, -28px)) scale(0.3); }
}

.seal-label { color: var(--lilac); transition: color 0.4s ease; }
.tome-seal:hover .seal-label { color: var(--gilt-bright); }

.tome-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  visibility: hidden;
  transition: max-height 0.75s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.55s ease 0.15s,
    transform 0.65s cubic-bezier(0.19, 1, 0.22, 1) 0.1s, visibility 0s linear 0.75s;
}

.tome.open .tome-body {
  max-height: 720px;
  opacity: 1;
  transform: none;
  visibility: visible;
  margin-top: 22px;
  transition: max-height 0.75s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.55s ease 0.2s,
    transform 0.65s cubic-bezier(0.19, 1, 0.22, 1) 0.15s, visibility 0s;
}

.tome-plate {
  max-width: 300px;
  margin: 0 auto 22px;
  padding: 8px;
  border: 1px solid var(--hairline);
  background: var(--leather);
}

.tome-plate img { width: 100%; height: auto; display: block; filter: saturate(0.7) brightness(0.9); }

.tome-title {
  font-size: clamp(1.6rem, 3.6vw, 2.1rem);
  margin-bottom: 14px;
}

.tome .entry-body { margin: 0 auto 18px; max-width: 40ch; font-size: 1.02rem; }

.tome-status { color: rgba(194, 91, 108, 0.85); }

/* ---------- the index / catalogue ---------- */

.catalogue {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(22px, 3vw, 34px);
}

@media (max-width: 1024px) {
  .catalogue { grid-template-columns: 1fr 1fr; }
  .catalogue .card-entry:last-child { grid-column: 1 / -1; max-width: 540px; justify-self: center; width: 100%; }
}
@media (max-width: 680px) { .catalogue { grid-template-columns: 1fr; max-width: 520px; margin: 0 auto; } .catalogue .card-entry:last-child { max-width: none; } }

.card-entry {
  position: relative;
  border: 1px solid var(--hairline);
  background: linear-gradient(170deg, rgba(22, 18, 33, 0.75), rgba(13, 11, 20, 0.9));
  padding: 36px 30px;
  transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1), border-color 0.5s ease, box-shadow 0.5s ease;
}

.card-entry::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gilt), transparent);
  opacity: 0;
  transition: opacity 0.6s ease;
}

.card-entry:hover { transform: translateY(-7px); border-color: rgba(212, 169, 79, 0.4); box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5); }
.card-entry:hover::before { opacity: 0.8; }

.call-number {
  font-size: 0.75rem;
  letter-spacing: 0.32em;
  color: var(--garnet);
  margin-bottom: 20px;
  text-transform: uppercase;
}

.card-title {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 30, 'WONK' 0;
  font-weight: 500;
  font-size: 1.55rem;
  margin-bottom: 16px;
}

.card-body { color: rgba(240, 233, 218, 0.78); font-size: 1.02rem; }

/* ---------- colophon ---------- */

.colophon {
  text-align: center;
  padding: clamp(60px, 9vh, 100px) 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.colophon-title {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 30, 'WONK' 0;
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.colophon-note { color: var(--lilac); font-style: italic; }

.colophon-mail {
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: 'SOFT' 100;
  font-size: clamp(1.3rem, 3.4vw, 2rem);
  color: var(--gilt-bright);
  text-decoration: none;
  position: relative;
  padding-bottom: 6px;
}

.colophon-mail::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--gilt), var(--garnet));
  transform: scaleX(0.25);
  transform-origin: center;
  transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.colophon-mail:hover::after { transform: scaleX(1); }

.colophon-fine { margin-top: 50px; color: rgba(167, 159, 179, 0.55); }

/* ---------- text wrapping polish ---------- */

.chapter-title, .vault-title, .colophon-title, .chapter-sub, .vault-note, .great-title { text-wrap: balance; }
.folio-text, .entry-body, .card-body { text-wrap: pretty; }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .line-mask .line { transform: none; }
  .fade-line, .reveal { opacity: 1; transform: none; letter-spacing: 0.34em; }
  .sigil-path { stroke-dashoffset: 0; }
  .sigil-star { opacity: 0.9; }
  .candle { display: none; }
}
