/* videobook.club – book page: stage, page bar, contents, about, marginal notes */

.book-top { padding-top: 30px; }
.crumbs { font-size: var(--step--1); color: var(--text-muted); }
.crumbs a { color: var(--text-soft); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs__sep { margin: 0 .6em; opacity: .6; }

.book-head h1 {
  margin: 12px 0 4px;
  font-size: clamp(2.1rem, 1.4rem + 2.6vw, 3.5rem);
}
.book-head__byline { margin: 0; color: var(--text-soft); font-size: var(--step-1); }
.book-head__byline .muted { color: var(--text-muted); }

/* ——— theater: stage + contents ——— */

.theater {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  margin-top: 26px;
  align-items: start;
}
.theater__main { min-width: 0; }

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 3px;
  background: #060807;
  box-shadow: 0 34px 70px -34px rgba(0, 0, 0, .95), 0 0 0 1px rgba(201, 165, 94, .22);
}
.stage__mount, .stage__mount iframe, .stage__mount video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.gate {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  color: var(--text);
}
.gate[hidden] { display: none; }
.gate__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 70% at 50% 42%, rgba(255, 196, 120, .16), transparent 70%),
    linear-gradient(180deg, #120c08, #070504);
}
.gate__backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: .5; }
.gate__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(22px, 5vw, 60px);
  padding: 20px;
}
.gate__poster:empty { display: none; }
.gate__poster .cover {
  width: clamp(84px, 13vw, 168px);
  height: auto;
  aspect-ratio: 2 / 3;
  transform: rotate(-1.6deg);
  box-shadow: 0 26px 40px -16px rgba(0, 0, 0, .95), 0 0 0 1px rgba(0, 0, 0, .4);
}
.gate__actions { display: grid; justify-items: start; gap: 6px; }
.gate__play {
  display: grid;
  justify-items: start;
  gap: 14px;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.gate__disc {
  position: relative;
  width: clamp(64px, 9vw, 92px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgba(255, 240, 200, .16), rgba(0, 0, 0, .45));
  box-shadow: inset 0 0 0 2px rgba(236, 215, 161, .85), 0 10px 30px rgba(0, 0, 0, .6);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.gate__disc::after {
  content: "";
  position: absolute;
  left: 54%; top: 50%;
  width: 34%; height: 38%;
  transform: translate(-50%, -50%);
  background: var(--gilt-gradient);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.gate__play:hover .gate__disc { transform: scale(1.04); box-shadow: inset 0 0 0 2px #fff0c6, 0 12px 36px rgba(0, 0, 0, .7); }
.gate__label { font-family: var(--font-display); font-size: clamp(1.1rem, .9rem + .8vw, 1.55rem); text-shadow: 0 2px 10px rgba(0, 0, 0, .8); }
.gate__restart { position: relative; margin-left: -10px; color: var(--text-soft); }
@media (max-width: 560px) { .gate__poster { display: none; } .gate__actions { justify-items: center; } .gate__play { justify-items: center; } .gate__fine { font-size: .72rem; } }
.gate__fine {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 18px;
  padding: 10px 16px 12px;
  background: linear-gradient(0deg, rgba(0, 0, 0, .75), rgba(0, 0, 0, 0));
  font-size: .8rem;
  color: var(--text-soft);
}
.gate__fine p { margin: 0; max-width: 40rem; }
.gate__fine a { color: var(--gilt-bright); }
.gate__remember { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.gate__remember input { accent-color: var(--gilt); width: 16px; height: 16px; margin: 0; }
.stage__error {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: #0b0d0c;
}
.stage__error p { margin: 0; max-width: 28rem; }

/* ——— page bar ——— */

.pagebar {
  position: relative;
  display: flex;
  gap: 2px;
  height: 30px;
  margin-top: 14px;
}
.pagebar__seg {
  position: relative;
  flex: var(--d, 1) 1 0;
  min-width: 6px;
  padding: 0;
  border: 0;
  border-radius: 1px;
  background: rgba(232, 223, 200, .1);
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 30px;
  overflow: hidden;
  cursor: pointer;
  transition: background-color .15s;
}
.pagebar__seg::before { /* progress inside the current page */
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--p, 0) * 100%);
  background: linear-gradient(180deg, rgba(236, 215, 161, .55), rgba(201, 165, 94, .38));
}
.pagebar__seg span { position: relative; }
.pagebar__seg:hover { background: rgba(232, 223, 200, .18); color: var(--text); }
.pagebar__seg.is-past { background: rgba(201, 165, 94, .3); color: var(--text-soft); }
.pagebar__seg.is-current { background: rgba(232, 223, 200, .16); color: #fff6dd; box-shadow: inset 0 -2px 0 var(--gilt); }
.pagebar__seg--extra { background: rgba(232, 223, 200, .05); }
.pagebar__seg--extra span { font-style: italic; }
.pagebar__mark {
  position: absolute;
  top: -5px;
  z-index: 2;
  width: 6px;
  height: 14px;
  margin-left: -3px;
  background: var(--oxblood-bright);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%);
  pointer-events: none;
}
.pagebar__tip {
  position: absolute;
  bottom: calc(100% + 10px);
  z-index: 5;
  width: max-content;
  max-width: min(320px, 80vw);
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--paper-ink);
  font-size: .85rem;
  line-height: 1.4;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .8);
  transform: translateX(-50%);
  pointer-events: none;
}
.pagebar__tip strong { font-weight: 600; font-variant-numeric: lining-nums; }

/* ——— controls ——— */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 10px;
}
.controls__pages { display: flex; align-items: center; gap: 2px; }
.controls__where { min-width: 10.5em; margin: 0; text-align: center; color: var(--text); }
.controls__where .muted { color: var(--text-muted); }
.controls__step span.label-long { margin: 0 2px; }
.controls__tools { display: flex; gap: 4px; }
.controls__tools .btn[aria-pressed="true"] { color: var(--gilt-bright); }
.controls__note { min-height: 1.5em; margin: 6px 0 0; font-size: var(--step--1); color: var(--text-muted); }
.controls__note button { margin-left: 8px; padding: 0; border: 0; background: none; color: var(--gilt-bright); font: inherit; text-decoration: underline; cursor: pointer; }

@media (max-width: 560px) {
  .controls__step .label-long { display: none; }
  .controls__where { min-width: 0; flex: 1; }
  .controls__pages { flex: 1; justify-content: space-between; }
  .controls__tools { width: 100%; justify-content: space-between; }
}

/* ——— contents (pages, bookmarks, text) ——— */

.toc {
  display: flex;
  flex-direction: column;
  height: 0;
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(8, 13, 11, .45);
}
.toc__tabs { display: flex; flex: none; border-bottom: 1px solid var(--line); }
.toc__tabs [role="tab"] {
  flex: 1;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: .95rem;
  cursor: pointer;
}
.toc__tabs [role="tab"][aria-selected="true"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--gilt); }
.toc__tabs [role="tab"]:hover { color: var(--text); }
.toc__panel { flex: 1; min-height: 0; overflow: auto; padding: 6px 0 12px; scrollbar-width: thin; scrollbar-color: rgba(232, 223, 200, .25) transparent; }
.toc__panel[hidden] { display: none; }
.toc__empty { margin: 0; padding: 18px 18px; color: var(--text-muted); font-size: .92rem; }

.toc-chapter__title {
  display: block;
  width: 100%;
  margin: 0;
  padding: 14px 18px 6px;
  border: 0;
  background: none;
  color: var(--text-soft);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  text-align: left;
  cursor: pointer;
}
.toc-chapter__title:hover { color: var(--text); }
.toc-pages { margin: 0; padding: 0; list-style: none; }
.toc-page {
  display: grid;
  grid-template-columns: 2em minmax(0, 1fr) auto;
  gap: 4px 10px;
  width: 100%;
  padding: 8px 16px 8px 18px;
  border: 0;
  background: none;
  color: var(--text-soft);
  font: inherit;
  font-size: .93rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}
.toc-page:hover { background: rgba(232, 223, 200, .05); color: var(--text); }
.toc-page[aria-current="true"] { background: rgba(201, 165, 94, .11); color: var(--text); box-shadow: inset 2px 0 0 var(--gilt); }
.toc-page__n { color: var(--gilt); font-variant-numeric: lining-nums tabular-nums; }
.toc-page__incipit {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-style: italic;
}
.toc-page__meta { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: .8rem; font-variant-numeric: lining-nums tabular-nums; }
.toc-page__meta .hand--up { width: 8px; height: 13px; }
.toc-page__notes { display: inline-flex; align-items: center; gap: 3px; color: var(--gilt); }
.toc-page__meta > span { display: inline-flex; align-items: center; }
.toc-page__meta svg { width: 13px; height: 13px; color: var(--oxblood-bright); }

.marks { margin: 0; padding: 0; list-style: none; }
.mark {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  padding: 10px 14px 10px 18px;
  border-bottom: 1px solid var(--line);
}
.mark__jump {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mark__jump:hover { color: #fff; text-decoration: underline; }
.mark__where { font-variant-numeric: lining-nums tabular-nums; }
.mark__note { grid-column: 1 / -1; margin: 0; color: var(--text-soft); font-size: .9rem; font-style: italic; }
.mark__tools { display: flex; gap: 2px; }
.mark__tools .btn { min-height: 34px; padding: 4px 8px; }
.mark__tools svg { width: 16px; height: 16px; }
.mark input { grid-column: 1 / -1; min-height: 36px; padding: 6px 10px; font-size: .9rem; background: rgba(255, 252, 244, .9); }

.text-search { padding: 10px 14px 6px; }
.text-search input { min-height: 38px; padding: 6px 10px; background: rgba(10, 16, 13, .6); color: var(--text); border: 1px solid var(--line-strong); }
.text-page { padding: 12px 18px; border-bottom: 1px solid var(--line); scroll-margin-top: 10px; }
.text-page.is-current { background: rgba(201, 165, 94, .08); box-shadow: inset 2px 0 0 var(--gilt); }
.text-page h3 {
  margin: 0 0 6px;
  font-family: var(--font-text);
  font-size: .8rem;
  font-weight: 500;
  color: var(--gilt);
  font-variant-numeric: lining-nums;
}
.text-page h3 button { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.text-page p { margin: 0; font-size: .95rem; line-height: 1.6; color: var(--text-soft); hyphens: auto; -webkit-hyphens: auto; }
.text-page mark { background: rgba(201, 165, 94, .4); color: inherit; border-radius: 2px; }

@media (max-width: 1080px) {
  .theater { grid-template-columns: 1fr; }
  .toc { height: auto; min-height: 0; max-height: 460px; }
}

/* ——— cinema mode ——— */

body.is-cinema { background: #050706; }
body.is-cinema .site-header, body.is-cinema .book-top, body.is-cinema .about, body.is-cinema .notes, body.is-cinema .site-footer {
  opacity: .1;
  transition: opacity .4s;
}
body.is-cinema .site-header:hover, body.is-cinema .book-top:hover { opacity: 1; }
body.is-cinema .theater { grid-template-columns: 1fr; max-width: 100%; }
body.is-cinema .toc { display: none; }
body.is-cinema .theater__main { width: min(100%, calc((100vh - 150px) * 16 / 9)); margin-inline: auto; }

/* ——— waiting (no film yet) ——— */

.waiting { margin-top: 26px; }
.waiting__stage {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(20px, 5vw, 64px);
  padding: clamp(24px, 5vw, 56px);
  border-radius: 3px;
  background:
    radial-gradient(60% 90% at 30% 40%, rgba(255, 196, 120, .14), transparent 70%),
    linear-gradient(180deg, #120c08, #0a0705);
  box-shadow: 0 0 0 1px rgba(201, 165, 94, .18), 0 30px 60px -30px #000;
}
.waiting__stage .cover { width: clamp(120px, 18vw, 210px); height: auto; aspect-ratio: 2 / 3; box-shadow: 0 24px 40px -16px #000; transform: rotate(-1deg); }
.waiting__stage h2 { font-size: var(--step-3); margin-bottom: .35em; }
.waiting__stage p { max-width: 34rem; color: var(--text-soft); }
.waiting__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
@media (max-width: 640px) {
  .waiting__stage { grid-template-columns: 1fr; }
}

/* ——— about this book ——— */

.about {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px 48px;
  margin-top: 72px;
  align-items: start;
}
.about > .cover { width: 200px; height: 300px; box-shadow: 0 20px 40px -18px #000; }
.about h2 { font-size: var(--step-3); }
.about__desc { max-width: 40rem; font-size: 1.08rem; }
.about__facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 22px;
  max-width: 44rem;
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: .95rem;
}
.about__facts dt { color: var(--text-muted); }
.about__facts dd { margin: 0; color: var(--text-soft); }
.about__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
@media (max-width: 720px) {
  .about { grid-template-columns: 1fr; }
  .about > .cover { width: 140px; height: 210px; }
  .about__facts { grid-template-columns: 1fr; gap: 2px; }
  .about__facts dd { margin-bottom: 10px; }
}

/* ——— marginal notes ——— */

.notes {
  display: grid;
  grid-template-columns: 200px minmax(0, 760px);
  column-gap: 48px;
  margin-top: 80px;
}
.notes > * { grid-column: 2; }
@media (max-width: 720px) {
  .notes { grid-template-columns: minmax(0, 1fr); }
  .notes > * { grid-column: 1; }
}
.notes__head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 6px; }
.notes__head .hand--up { width: 20px; height: 32px; align-self: center; }
.notes__head h2 { margin: 0; }
.notes__count { color: var(--text-muted); font-variant-numeric: lining-nums; }
.notes__intro { max-width: 38rem; color: var(--text-soft); }
.notes__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 14px; }
.notes__sort { display: flex; gap: 4px; }

.note-form { margin: 18px 0 30px; padding: 24px 26px 22px; }
.note-form .row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0 18px; }
.note-form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 6px; }
.note-form__status { margin: 0; color: var(--paper-muted); font-size: var(--step--1); }
.note-form__status.is-error { color: var(--danger); }
@media (max-width: 640px) { .note-form .row { grid-template-columns: 1fr; } .note-form { padding: 20px 18px; } }

.note-list { margin: 0; padding: 0; list-style: none; }
.note { position: relative; padding: 20px 0 18px 30px; border-top: 1px solid var(--line); }
.note::before { /* margin mark */
  content: "";
  position: absolute;
  left: 2px;
  top: 25px;
  width: 9px;
  height: 15px;
  background: var(--gilt-gradient);
  -webkit-mask: url("/img/hand-up.svg") center / contain no-repeat;
  mask: url("/img/hand-up.svg") center / contain no-repeat;
  opacity: .7;
}
.note__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 6px; }
.note__name { font-weight: 600; color: var(--text); }
.note__time { color: var(--text-muted); font-size: var(--step--1); }
.note__page {
  padding: 1px 9px;
  border: 1px solid rgba(201, 165, 94, .45);
  border-radius: 999px;
  background: none;
  color: var(--gilt-bright);
  font: inherit;
  font-size: .8rem;
  font-variant-numeric: lining-nums tabular-nums;
  cursor: pointer;
}
.note__page:hover { background: rgba(201, 165, 94, .14); }
.note__page[disabled] { cursor: default; }
.note__body { margin: 0; white-space: pre-line; overflow-wrap: anywhere; color: var(--text-soft); max-width: 42rem; }
.note__actions { margin-top: 6px; }
.note__actions .btn { min-height: 34px; padding: 3px 8px; font-size: .9rem; }
.note__actions svg { width: 16px; height: 16px; }
.note__replies { margin: 10px 0 0; padding: 0 0 0 18px; list-style: none; border-left: 1px solid var(--line-strong); }
.note__replies .note { padding-left: 16px; border-top: 0; padding-top: 10px; padding-bottom: 8px; }
.note__replies .note::before { display: none; }
.note .note-form { margin: 12px 0 4px; }
.notes__empty { padding: 26px 0; border-top: 1px solid var(--line); color: var(--text-muted); font-style: italic; }

/* hands (gilt, via masks) */
.hand { display: inline-block; flex: none; background: var(--gilt-gradient); }
.hand--right { width: 30px; height: 19px; -webkit-mask: url("/img/hand-right.svg") center / contain no-repeat; mask: url("/img/hand-right.svg") center / contain no-repeat; }
.hand--up { width: 14px; height: 23px; -webkit-mask: url("/img/hand-up.svg") center / contain no-repeat; mask: url("/img/hand-up.svg") center / contain no-repeat; }
.on-paper .hand, .paper .hand { background: linear-gradient(180deg, #8f2a31, #5e1419); }
.btn--gilt .hand { background: #3b2a10; }
.btn .hand--up { width: 11px; height: 18px; }

/* Series index: the library's paper cards, with episode-local navigation. */
.episodes { margin-bottom: 2.5rem; }
.episodes__head { max-width: 48rem; margin-bottom: 1.25rem; }
.episodes__head h2 { margin: .3rem 0 .65rem; }
.episode-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.episode-card { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.25rem 1.5rem; border: 1px solid var(--line); border-radius: .3rem; background: rgba(255,255,255,.035); }
.episode-card h3 { font-size: 1.35rem; margin: .2rem 0 .4rem; }
.episode-card p { margin: 0; }
.episode-card__number { font-size: .72rem; text-transform: uppercase; letter-spacing: .13em; color: var(--text-muted); }
.episode-card__pending { color: var(--text-muted); font-size: .85rem; }
.episode-playing { font-size: 1.2rem; margin: 0 0 .8rem; }
@media (max-width: 580px) { .episode-card { align-items: stretch; flex-direction: column; gap: 1rem; padding: 1rem; } .episode-card .btn { align-self: flex-start; } }
