/* The Library — dark academia bookshelf */
:root {
  --ink: #14100b;
  --ink2: #1e1710;
  --gold: #d9a94e;
  --gold-soft: #e8c66a;
  --cream: #f0e6d2;
  --muted: #a89880;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Jost', -apple-system, 'Segoe UI', sans-serif;
}

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

html, body { min-height: 100%; }

body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* warm library photo backdrop (fixed layer; scrim keeps text legible) */
.library-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url('library-bg.jpg') center / cover no-repeat;
}
.library-bg.dim { opacity: .32; }

/* warm lamp glow + readability scrim + vignette over everything */
.atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 90% 55% at 50% -5%, rgba(255,190,90,.13), transparent 60%),
    linear-gradient(180deg, rgba(12,8,5,.80), rgba(12,8,5,.58) 45%, rgba(12,8,5,.82)),
    radial-gradient(ellipse 120% 120% at 50% 50%, transparent 55%, rgba(0,0,0,.55) 100%);
}

.mote {
  position: fixed; z-index: 0; pointer-events: none;
  width: 3px; height: 3px; border-radius: 50%;
  background: rgba(232,198,106,.55);
  animation: drift 14s linear infinite;
  opacity: 0;
}
@keyframes drift {
  0% { transform: translateY(10vh); opacity: 0; }
  15% { opacity: .7; }
  85% { opacity: .4; }
  100% { transform: translateY(-50vh); opacity: 0; }
}


.library-head {
  position: relative; z-index: 1;
  text-align: center;
  padding: 60px 24px 12px;
  animation: fadein 1.2s ease both;
}
.library-head h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(2.8rem, 7vw, 4.4rem);
  color: var(--gold-soft); letter-spacing: .05em;
}
.library-head .rule {
  width: 120px; height: 1px; margin: 18px auto;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.tagline {
  font-family: var(--serif); font-style: italic;
  font-size: 1.2rem; color: var(--muted);
}
.home-link {
  display: inline-block; margin-top: 18px;
  font-size: .82rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  border-bottom: 1px solid transparent; padding-bottom: 2px;
  transition: color .2s ease, border-color .2s ease;
}
.home-link:hover { color: var(--gold-soft); border-color: var(--gold-soft); }

.shelves { position: relative; z-index: 1; padding: 36px 0 20px; }

.shelf { max-width: 720px; margin: 0 auto 46px; padding: 0 12px; animation: fadein 1.2s ease both; }
.shelf:nth-child(2) { animation-delay: .25s; }

.shelf-label {
  font-family: var(--serif); font-style: italic;
  color: var(--muted); font-size: 1.05rem;
  padding: 0 26px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 12px;
}
.shelf-label::after { content: ''; flex: 1; height: 1px; background: rgba(217,169,78,.25); }

.books {
  display: flex; align-items: flex-end; justify-content: center; gap: 7px;
  padding: 0 26px; min-height: 250px;
  overflow-x: auto; scrollbar-width: thin;
}
.book {
  --h: 200px; --w: 44px; --c: #4a3b5a;
  position: relative; flex-shrink: 0;
  width: var(--w); height: var(--h);
  background:
    linear-gradient(90deg, rgba(0,0,0,.42), transparent 18%, rgba(255,255,255,.09) 50%, transparent 82%, rgba(0,0,0,.42)),
    var(--c);
  border-radius: 3px 7px 7px 3px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 5px 0 10px rgba(0,0,0,.45), 0 8px 14px rgba(0,0,0,.5);
  text-decoration: none;
  transition: transform .28s cubic-bezier(.2,.7,.3,1.2);
}
.book::before, .book::after {
  content: ''; position: absolute; left: 7px; right: 7px; height: 2px;
  background: rgba(232,198,106,.45); border-radius: 1px;
}
.book::before { top: 16px; }
.book::after { bottom: 16px; }
.spine-title {
  writing-mode: vertical-rl;
  font-family: var(--serif); font-size: 15px; letter-spacing: .14em;
  color: var(--gold-soft); white-space: nowrap;
  max-height: calc(100% - 60px); overflow: hidden; text-overflow: ellipsis;
}
.spine-author {
  position: absolute; bottom: 26px; left: 0; right: 0;
  text-align: center; font-size: 9px; letter-spacing: .18em;
  color: rgba(232,198,106,.65); text-transform: uppercase;
}
a.book { cursor: pointer; }
a.book:hover { transform: translateY(-14px); }

.book.featured {
  --h: 238px; --w: 58px;
  transform: translateY(-10px);
  box-shadow: inset 5px 0 10px rgba(0,0,0,.45), 0 8px 14px rgba(0,0,0,.5),
    0 0 34px rgba(217,169,78,.35);
}
.book.featured:hover { transform: translateY(-26px); }
.book-tag {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink); background: var(--gold-soft);
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
  box-shadow: 0 0 18px rgba(232,198,106,.6);
}

.stack { display: flex; flex-direction: column-reverse; gap: 4px; flex-shrink: 0; padding-bottom: 2px; }
.stack .flat {
  height: 30px; border-radius: 4px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), transparent 30%, rgba(0,0,0,.4)), var(--c, #3d4a5a);
  box-shadow: 0 4px 8px rgba(0,0,0,.5);
  border-left: 3px solid rgba(232,198,106,.4);
}
.lean { transform: rotate(7deg); transform-origin: bottom left; margin-left: 6px; }

.plaque {
  align-self: center; flex-shrink: 0;
  font-family: var(--serif); font-style: italic; font-size: .95rem;
  color: var(--muted); border: 1px solid rgba(217,169,78,.35);
  padding: 10px 18px; border-radius: 4px; background: rgba(0,0,0,.3);
  white-space: nowrap;
}

.plank {
  height: 20px; margin-top: -2px; border-radius: 3px;
  background: linear-gradient(180deg, #8a6238 0%, #6b4a2e 35%, #4a3220 75%, #33220f 100%);
  box-shadow: 0 12px 26px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,220,160,.25);
}
.plank-shadow {
  height: 26px; margin: 0 10px;
  background: radial-gradient(ellipse 50% 100% at 50% 0%, rgba(0,0,0,.5), transparent 70%);
}

.library-foot {
  position: relative; z-index: 1;
  text-align: center; padding: 10px 24px 70px;
  color: var(--muted); font-size: .85rem;
  animation: fadein 1.2s ease both;
}
.library-foot .rule {
  width: 120px; height: 1px; margin: 0 auto 18px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

@keyframes fadein { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.reading { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 40px 24px 90px; animation: fadein 1s ease both; }
.reading .back {
  display: inline-block; margin-bottom: 30px;
  color: var(--muted); text-decoration: none; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase;
  transition: color .2s ease;
}
.reading .back:hover { color: var(--gold-soft); }
.story-head { text-align: center; margin-bottom: 34px; }
.story-head .kicker {
  font-size: .78rem; letter-spacing: .24em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 14px;
}
.story-head h1 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(2.6rem, 6vw, 3.6rem);
  color: var(--gold-soft); letter-spacing: .03em; margin-bottom: 10px;
}
.story-head .byline { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--cream); }
.story-head .credit { margin-top: 10px; font-size: .8rem; color: var(--muted); letter-spacing: .04em; }
.story-head .rule {
  width: 90px; height: 1px; margin: 22px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}


.prose p {
  font-family: var(--serif); font-size: 1.24rem; line-height: 1.9;

  color: var(--cream); margin: 0 0 1.35em;
}
.prose > p:first-of-type::first-letter {
  font-size: 3.3em; float: left; line-height: .88;
  padding: 4px 12px 0 0; color: var(--gold-soft); font-weight: 600;
}
.prose em { color: #fff; }
.story-end { text-align: center; color: var(--gold); font-size: 1.3rem; margin: 34px 0 8px; letter-spacing: .5em; }
.reading .back.bottom { display: block; text-align: center; margin-top: 26px; }

@media (prefers-reduced-motion: reduce) {
  .mote { display: none; }
  .library-head, .shelf, .library-foot, .reading { animation: none; }
  a.book:hover, .book.featured:hover { transform: none; }
}


/* serial touches */

.story-head .chapter-label { font-family: var(--sans); font-size: .82rem; letter-spacing: .32em; text-transform: uppercase; color: var(--muted); margin: 8px 0 14px; }
.to-be-continued { text-align: center; font-family: var(--serif); font-style: italic; font-size: 1.15rem; letter-spacing: .05em; color: var(--muted); margin: 6px 0 36px; }
/* fit the whole shelf on phone screens */
/* wooden bookends holding each cluster */ .bookend { flex-shrink: 0; width: 22px; height: 148px; border-radius: 5px 5px 2px 2px; background: linear-gradient(90deg, #7d5a36 0%, #5f4226 55%, #42301b 100%); box-shadow: 0 10px 16px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,220,160,.35), inset -3px 0 6px rgba(0,0,0,.35); position: relative; } .bookend::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 10px; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, rgba(255,220,160,.35), transparent); } @media (max-width: 700px) {
  .books { zoom: .7; }
}
