/* videobook.club – the library: intro, bookcase, spines, covers, loan card */

/* ——— intro ——— */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px 56px;
  align-items: end;
  padding-top: clamp(40px, 7vw, 92px);
  padding-bottom: 8px;
}
.intro h1 { max-width: 12ch; margin-bottom: 0.32em; }
.intro .lede {
  max-width: 34rem;
  margin: 0;
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--text-soft);
}

/* reading slip: last book in progress */
.resume {
  display: grid;
  grid-template-columns: 64px auto;
  gap: 14px 16px;
  align-items: center;
  width: min(100%, 340px);
  padding: 14px 18px 14px 14px;
  border-radius: var(--radius);
  color: var(--paper-ink);
  transform: rotate(0.6deg);
}
.resume .cover { width: 64px; height: 96px; }
.resume__kicker { margin: 0; font-size: var(--step--1); color: var(--paper-muted); }
.resume__title { margin: 0 0 2px; font-family: var(--font-display); font-size: 1.25rem; line-height: 1.15; }
.resume__page { margin: 0 0 8px; font-size: var(--step--1); color: var(--paper-muted); font-variant-numeric: lining-nums; }
.resume .btn { min-height: 38px; padding: 6px 14px; font-size: .95rem; }

@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; align-items: start; }
  .resume { transform: none; }
}

/* ——— toolbar ——— */

.library { padding-top: 44px; }
.library:focus { outline: none; }
.library__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
}
.library__title {
  margin: 0 auto 0 0;
  font-size: var(--step-2);
  font-style: italic;
  font-weight: 400;
  color: var(--text-soft);
}

.search { position: relative; }
.search input {
  width: min(78vw, 280px);
  min-height: 42px;
  padding: 8px 12px 8px 38px;
  background: rgba(10, 16, 13, 0.55);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}
.search input::placeholder { color: var(--text-muted); }
.search input:focus-visible { outline: 2px solid var(--gilt-bright); outline-offset: 2px; border-color: transparent; }
.search__icon {
  position: absolute;
  left: 13px; top: 50%;
  width: 16px; height: 16px;
  transform: translateY(-50%);
  border: 1.6px solid var(--text-muted);
  border-radius: 50%;
}
.search__icon::after {
  content: "";
  position: absolute;
  right: -5px; bottom: -4px;
  width: 6px; height: 1.6px;
  background: var(--text-muted);
  transform: rotate(45deg);
}

.library__legend {
  margin: 14px 0 0;
  font-size: var(--step--1);
  color: var(--text-muted);
}
.library__status { min-height: 1.5em; margin: 12px 0 0; color: var(--text-muted); font-size: var(--step--1); }

/* ——— bookcase ——— */

.case {
  --row-h: 232px;
  --side: clamp(12px, 2vw, 22px);
  --gap: 3px;
  position: relative;
  margin-top: 22px;
  padding: 0 var(--side);
  border-radius: 4px 4px 2px 2px;
  background:
    /* side panels */
    linear-gradient(90deg, #1f130b, #4a2f1d 30%, #5d3c26 55%, #2b1a0f) left top / var(--side) 100% no-repeat,
    linear-gradient(90deg, #2b1a0f, #5d3c26 45%, #4a2f1d 70%, #1f130b) right top / var(--side) 100% no-repeat,
    /* back panel */
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 132px),
    linear-gradient(180deg, #120b07 0%, #1b120b 40%, #130c07 100%);
  box-shadow: var(--shadow-deep), 0 0 0 1px rgba(0, 0, 0, .55);
}
.case::before { /* cornice */
  content: "";
  display: block;
  height: 22px;
  margin: 0 calc(-1 * var(--side) - 8px);
  border-radius: 3px 3px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 220, 170, .18), transparent 3px),
    linear-gradient(180deg, transparent 13px, rgba(0, 0, 0, .45) 14px, transparent 16px),
    url("/img/wood-grain.svg") center / 900px 160px,
    linear-gradient(180deg, #6a4529, #4e321f 60%, #3a2516);
  box-shadow: 0 8px 14px -6px rgba(0, 0, 0, .8);
}
.case::after { /* plinth */
  content: "";
  display: block;
  height: 20px;
  margin: 0 calc(-1 * var(--side) - 4px);
  background:
    linear-gradient(180deg, rgba(255, 220, 170, .12), transparent 2px),
    url("/img/wood-grain.svg") center / 900px 160px,
    linear-gradient(180deg, #4b301d, #2f1d11);
  border-radius: 0 0 2px 2px;
}

.case__loading, .case__empty {
  margin: 0;
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

.case__row { position: relative; }
.case__row:first-of-type .case__books::before { opacity: 1; }
.case__books {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: var(--gap);
  height: var(--row-h);
  margin: 0;
  padding: 0 6px;
  list-style: none;
}
.case__books::before { /* lamp light on the back panel */
  content: "";
  position: absolute;
  inset: 0 calc(-1 * var(--side));
  background:
    radial-gradient(60% 150px at 50% -40px, var(--lamp), transparent 75%),
    linear-gradient(180deg, rgba(0, 0, 0, .55), transparent 26px);
  opacity: .75;
  pointer-events: none;
}

.case__board {
  position: relative;
  z-index: 2;
  height: 17px;
  margin: 0 calc(-1 * var(--side));
  background:
    linear-gradient(180deg, rgba(255, 226, 180, .28) 0, rgba(255, 226, 180, 0) 2px),
    linear-gradient(180deg, transparent 4px, rgba(0, 0, 0, .25) 17px),
    url("/img/wood-grain.svg") 0 -40px / 900px 160px,
    linear-gradient(180deg, #7b5536 0, #5e3e26 40%, #4a2f1c);
  box-shadow: 0 9px 14px -5px rgba(0, 0, 0, .85);
}
.case__label {
  position: absolute;
  left: 50%;
  top: 3px;
  z-index: 3;
  transform: translateX(-50%);
  min-width: 64px;
  padding: 0 10px;
  border-radius: 2px;
  background: linear-gradient(180deg, #e9d29a, #b99145 55%, #8d6c31);
  box-shadow: inset 0 1px 0 rgba(255, 250, 225, .7), 0 1px 2px rgba(0, 0, 0, .6);
  color: #3b2a10;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 13px;
  text-align: center;
  font-variant-numeric: lining-nums;
  white-space: nowrap;
}

/* ——— books ——— */

.book { position: relative; z-index: 0; flex: none; }
.book__btn {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transform-origin: 50% 100%;
  transition: transform .28s var(--ease), box-shadow .28s var(--ease), filter .2s;
}
.book__btn:hover { transform: translateY(-5px); }
.book__btn:focus-visible { outline-offset: 4px; }
.book.is-open .book__btn { transform: translateY(-16px) rotate(-1.6deg); }
.book.is-dimmed { opacity: .2; filter: grayscale(.6); }

/* spines (cloth / leather) */
.book--spine .book__btn {
  width: var(--w);
  height: var(--h);
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 2px 2px 1px 1px;
  background-color: var(--cloth);
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, .46) 0, rgba(255, 255, 255, .06) 16%, rgba(255, 255, 255, .13) 34%, rgba(255, 255, 255, .03) 60%, rgba(0, 0, 0, .42) 100%),
    url("/img/cloth-weave.svg");
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 -2px 3px rgba(0, 0, 0, .35), 2px 0 5px rgba(0, 0, 0, .45);
}
.book--spine .book__btn::before,
.book--spine .book__btn::after { /* gilt double rules */
  content: "";
  position: absolute;
  left: 3px; right: 3px;
  height: 5px;
  background:
    linear-gradient(90deg, transparent, #d9bb76 15%, #f0dba4 50%, #b8934c 85%, transparent) top / 100% 1px no-repeat,
    linear-gradient(90deg, transparent, #d9bb76 15%, #f0dba4 50%, #b8934c 85%, transparent) bottom / 100% 1px no-repeat;
  opacity: .9;
}
.book--spine .book__btn::before { top: 11px; }
.book--spine .book__btn::after { bottom: 22px; }

.spine__author, .spine__title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spine__title {
  order: 2;
  display: block;
  flex: 0 1 auto;
  min-height: 0;
  margin: auto 0;
  max-height: calc(var(--h) - 120px);
  font-family: var(--font-display);
  font-size: var(--fs, 12px);
  font-weight: 600;
  letter-spacing: .07em;
  line-height: 1.15;
  text-transform: uppercase;
  color: #e6c987;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 236, 190, .12);
}
.spine__author {
  order: 1;
  flex: none;
  margin-top: 22px;
  max-height: 56px;
  font-family: var(--font-text);
  font-size: var(--afs, 9.5px);
  letter-spacing: .04em;
  color: rgba(230, 201, 135, .85);
}
.spine__mark { /* publisher's mark: the pointing hand */
  order: 3;
  width: 14px;
  height: 9px;
  margin-bottom: 7px;
  background: linear-gradient(180deg, #f0dba4, #b8934c);
  -webkit-mask: url("/img/hand-right.svg") center / contain no-repeat;
  mask: url("/img/hand-right.svg") center / contain no-repeat;
  opacity: .9;
}

/* leather title label */
.book--label .spine__title {
  padding: 10px 0;
  max-height: calc(var(--h) - 120px);
  background: linear-gradient(90deg, #120d0a, #2a1e17 50%, #120d0a);
  box-shadow: inset 0 0 0 1px rgba(214, 183, 118, .5), 0 0 0 1px rgba(0, 0, 0, .5);
  width: calc(100% - 6px);
}

/* vellum: waiting for its videobook */
.book--vellum .book__btn {
  background-color: var(--vellum-tone, var(--vellum));
  background-image:
    linear-gradient(90deg, rgba(90, 66, 34, .28) 0, rgba(255, 255, 255, .28) 18%, rgba(255, 255, 255, .1) 40%, rgba(90, 66, 34, .06) 64%, rgba(90, 66, 34, .34) 100%),
    radial-gradient(40% 30% at 30% 22%, rgba(140, 108, 60, .12), transparent),
    radial-gradient(50% 26% at 70% 70%, rgba(140, 108, 60, .1), transparent),
    url("/img/paper-grain.svg");
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -2px 3px rgba(90, 66, 34, .2), 2px 0 5px rgba(0, 0, 0, .4);
  filter: saturate(.9) brightness(.94);
}
.book--vellum .book__btn::before, .book--vellum .book__btn::after { display: none; }
.book--vellum .spine__title {
  max-height: calc(var(--h) - 94px);
  font-style: italic;
  font-weight: 500;
  text-transform: none;
  letter-spacing: .01em;
  color: var(--vellum-ink);
  text-shadow: none;
}
.book--vellum .spine__author { color: rgba(87, 69, 47, .8); margin-top: 12px; max-height: 62px; }
.book--vellum .spine__title { margin: 8px 0 12px; }
.spine__title--two { white-space: nowrap; line-height: 1.08; text-align: center; }
.book--vellum .book__btn:hover { filter: saturate(1) brightness(1); }

/* face-out books with their cover */
.book--face { margin: 0 12px; }
.book--face .book__btn {
  width: var(--face-w, 116px);
  height: calc(var(--face-w, 116px) * 1.5);
}
.book--face .cover { box-shadow: inset 5px 0 6px -4px rgba(0, 0, 0, .55), 7px 9px 16px -6px rgba(0, 0, 0, .8), -1px 0 0 rgba(0, 0, 0, .5); }

.book__ribbon { /* your bookmark */
  position: absolute;
  z-index: 3;
  bottom: -27px;
  left: 62%;
  width: 7px;
  height: 34px;
  background: linear-gradient(90deg, #5e1419, #9c2c34 50%, #6b1b21);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  pointer-events: none;
}
.book__slip { /* work in progress: a paper slip sticking out */
  position: absolute;
  z-index: -1;
  top: -16px;
  left: 54%;
  width: 15px;
  height: 46px;
  background: #ece3cd url("/img/paper-grain.svg");
  transform: rotate(4deg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  pointer-events: none;
}
.book--spine .book__slip { left: 18%; width: 62%; }

.bookend {
  flex: none;
  align-self: flex-end;
  width: 11px;
  height: 118px;
  margin-left: 4px;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(90deg, #6f5326, #d7b977 35%, #f3e1ad 50%, #b18a43 70%, #5d4420);
  box-shadow: 3px 0 6px rgba(0, 0, 0, .55);
}

/* ——— covers ——— */

.cover {
  --cloth: #3c4752;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  container-type: inline-size;
  border-radius: 1px 3px 3px 1px;
  background: var(--cloth);
  color: var(--paper-ink);
}
.cover img, .cover__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover::after { /* hinge and board edge */
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .35), rgba(255, 255, 255, .12) 4%, rgba(0, 0, 0, .18) 6.5%, transparent 9%),
    linear-gradient(0deg, rgba(0, 0, 0, .12), transparent 30%);
  pointer-events: none;
}
.cover__label {
  position: absolute;
  left: 13%;
  right: 13%;
  top: 12%;
  display: grid;
  gap: 4cqw;
  padding: 8cqw 6cqw 7cqw;
  background: #f1e8d3 url("/img/paper-grain.svg");
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  transform: rotate(-0.7deg);
  text-align: center;
  hyphens: auto;
  -webkit-hyphens: auto;
}
.cover__title {
  font-family: var(--font-display);
  font-size: clamp(9px, 11.5cqw, 34px);
  font-weight: 500;
  line-height: 1.04;
  overflow-wrap: anywhere;
  color: #1d1914;
}
.cover__author {
  font-size: clamp(6px, 6.4cqw, 15px);
  letter-spacing: .06em;
  font-variant-caps: small-caps;
  color: #5b5244;
}

.cover--vellum {
  background:
    radial-gradient(60% 40% at 30% 25%, rgba(150, 118, 70, .14), transparent),
    radial-gradient(50% 30% at 75% 80%, rgba(150, 118, 70, .12), transparent),
    url("/img/paper-grain.svg"),
    var(--vellum-tone, var(--vellum));
}
.cover--vellum .cover__label {
  inset: 18% 10% auto;
  background: none;
  box-shadow: none;
  transform: none;
  border-top: 1px solid rgba(87, 69, 47, .5);
  border-bottom: 1px solid rgba(87, 69, 47, .5);
  padding: 6cqw 2cqw;
}
.cover--vellum .cover__title { font-style: italic; color: var(--vellum-ink); }
.cover--vellum .cover__author { color: rgba(87, 69, 47, .85); }

/* ——— loan card (the book you pulled out) ——— */

.loan-card {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 22px 30px;
  margin: 18px 6px 26px;
  padding: 28px 30px 26px;
  background-color: var(--card);
  animation: card-in .32s var(--ease);
}
.loan-card::before { /* the notch pointing at the book */
  content: "";
  position: absolute;
  top: -9px;
  left: var(--notch, 50%);
  width: 18px;
  height: 18px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
  box-shadow: -1px -1px 0 rgba(0, 0, 0, .06);
}
.loan-card__rule { /* red rule like on an old library card */
  position: absolute;
  left: 0; right: 0;
  top: 58px;
  height: 1px;
  background: rgba(125, 34, 41, .45);
}
.loan-card .cover { width: 148px; height: 222px; box-shadow: 4px 6px 14px -6px rgba(0, 0, 0, .6); }
.loan-card__body { display: grid; align-content: start; gap: 2px; min-width: 0; }
.loan-card__call {
  position: absolute;
  top: 18px;
  right: 22px;
  margin: 0;
  font-size: var(--step--1);
  color: var(--paper-muted);
  font-variant-numeric: lining-nums;
  letter-spacing: .04em;
}
.loan-card__status { margin: 0 0 16px; font-size: var(--step--1); color: var(--oxblood); }
.loan-card h3 { margin: 0; font-size: var(--step-3); }
.loan-card__author { margin: 2px 0 14px; color: var(--paper-muted); }
.loan-card__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 26px;
  margin: 0 0 14px;
}
.loan-card__facts div { display: flex; gap: 7px; }
.loan-card__facts dt { color: var(--paper-muted); }
.loan-card__facts dd { margin: 0; font-variant-numeric: lining-nums; }
.loan-card__text { grid-column: 2; max-width: 44rem; margin: -8px 0 4px; }
.loan-card__actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.loan-card > a, .loan-card > .cover { grid-row: span 3; align-self: start; }
.loan-card__close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
}
.loan-card__close svg { width: 20px; height: 20px; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .case { --row-h: 206px; }
  .book--face { margin: 0 8px; }
  .book--face .book__btn { --face-w: 92px; }
  .loan-card { grid-template-columns: 92px minmax(0, 1fr); gap: 16px 18px; padding: 22px 18px 20px; margin-inline: 0; }
  .loan-card .cover { width: 92px; height: 138px; }
  .loan-card h3 { font-size: var(--step-2); }
  .loan-card > a, .loan-card > .cover { grid-row: auto; }
  .loan-card__text, .loan-card__actions, .loan-card__facts { grid-column: 1 / -1; }
  .loan-card__text { margin-top: 0; }
  .loan-card__call { top: 12px; right: 16px; }
}

/* ——— invitation ——— */

.invite { margin-top: 72px; }
.invite__slip {
  max-width: 560px;
  margin-left: auto;
  padding: 28px 30px 30px;
  transform: rotate(-0.4deg);
}
.invite__slip h2 { font-size: var(--step-2); margin-bottom: .4em; }
.invite__slip p { color: #3d372d; }
