/* The Ink Library — midnight reading-room landing page */

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

:root {
  --paper: #ede3cf;
  --paper-dim: #cfc3ab;
  --room: #17130e;
  --room-warm: #241c12;
  --gold: #c9a35c;
  --ink: #211d16;
}

body {
  min-height: 100vh;
  background: var(--room);
  color: var(--paper);
  font-family: 'Newsreader', Georgia, serif;
  overflow-x: hidden;
}

/* Warm lamplight falling from above */
.lamp {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 50% -8%, rgba(214, 164, 89, 0.28), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 110%, rgba(0, 0, 0, 0.55), transparent 60%);
}

/* Film grain over everything, very quiet */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.masthead {
  position: relative;
  text-align: center;
  padding: 9vh 24px 4vh;
  animation: settle 0.9s ease-out both;
}

.overline {
  font-family: 'Newsreader', serif;
  font-size: 0.8rem;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 18px;
}

.masthead h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 380;
  font-size: clamp(2.6rem, 7vw, 4.8rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.masthead h1 em {
  font-style: italic;
  font-weight: 340;
  color: var(--gold);
}

.masthead .sub {
  max-width: 42ch;
  margin: 22px auto 0;
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--paper-dim);
  font-style: italic;
}

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

.shelf {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 44px;
  padding: 5vh 24px 6vh;
  max-width: 1180px;
  margin: 0 auto;
}

.book {
  --accent: #8a7b5c;
  width: 280px;
  text-decoration: none;
  color: inherit;
  display: block;
  animation: settle 0.8s ease-out both;
  animation-delay: var(--stagger, 0ms);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.book:hover {
  transform: translateY(-8px);
}

/* Cover: proportions of a trade paperback (280 × 420 = 2:3) */
.cover {
  position: relative;
  height: 420px;
  border-radius: 3px 8px 8px 3px; /* spine on the left */
  overflow: hidden;
  box-shadow:
    -6px 0 0 -2px rgba(0, 0, 0, 0.35),  /* spine shadow */
    0 14px 34px rgba(0, 0, 0, 0.55),
    0 3px 8px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.35s ease;
}

.book:hover .cover {
  box-shadow:
    -6px 0 0 -2px rgba(0, 0, 0, 0.35),
    0 26px 52px rgba(0, 0, 0, 0.65),
    0 6px 14px rgba(0, 0, 0, 0.5);
}

/* Shared: subtle spine crease + top light on every cover */
.cover::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.28) 0, rgba(0, 0, 0, 0.08) 3%, transparent 7%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0, transparent 12%);
}

/* Typographic cover — vintage paperback, accent bands over cream */
.type-cover {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 120% 60% at 50% 0%, rgba(255, 255, 255, 0.25), transparent 60%),
    var(--paper);
}

.type-cover .band {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  flex: 0 0 58px;
}

.type-cover .band.top span {
  font-family: 'Newsreader', serif;
  font-size: 0.62rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}

.type-cover .mid {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px;
  text-align: center;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.type-cover .type-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 1.55rem;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
}

.type-cover .fleuron {
  font-size: 1.1rem;
  color: var(--accent);
}

/* Image cover — real art with a title plate */
.image-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.book:hover .image-cover img {
  transform: scale(1.05);
}

.cover-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(10, 8, 6, 0.85) 100%);
}

.cover-title {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 450;
  font-size: 1.35rem;
  line-height: 1.15;
  color: var(--paper);
  text-wrap: balance;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Blurb under the cover */
.blurb {
  padding: 18px 6px 0;
}

.blurb h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 450;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.blurb p {
  font-size: 0.92rem;
  font-weight: 300;
  line-height: 1.5;
  color: var(--paper-dim);
  margin-bottom: 10px;
}

.begin {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.begin .arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}

.book:hover .begin .arrow {
  transform: translateX(5px);
}

.empty-shelf {
  grid-column: 1 / -1;
  text-align: center;
  padding: 8vh 24px;
  font-style: italic;
  font-weight: 300;
  color: rgba(237, 227, 207, 0.5);
}

.colophon {
  text-align: center;
  padding: 0 24px 6vh;
  font-size: 0.85rem;
  font-weight: 300;
  color: rgba(237, 227, 207, 0.4);
}

.colophon a {
  color: rgba(201, 163, 92, 0.7);
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .masthead,
  .book {
    animation: none;
  }
  .book,
  .image-cover img,
  .begin .arrow {
    transition: none;
  }
}
