/* Shadowblade Books — additive styles, fire-and-ash, mobile first. */

.books-kicker {
  margin: 0 0 .35rem;
  text-align: center;
  font-family: var(--font-hud);
  letter-spacing: .22em;
  text-transform: uppercase;
  font-size: .72rem;
  color: var(--ember);
}

.books-tabs {
  display: flex;
  gap: .45rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: .15rem 0 .7rem;
  margin: 0;
}

.books-tab {
  flex: 0 0 auto;
  font-family: var(--font-hud);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .78rem;
  font-weight: 700;
  color: #f6d9b0;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(255, 80, 20, .28), transparent 55%),
    linear-gradient(180deg, #1a0806, #080201);
  border: 1px solid rgba(255, 90, 30, .4);
  padding: .55rem .8rem;
  box-shadow: inset 0 -10px 18px rgba(255, 50, 0, .08), 0 3px 10px rgba(0,0,0,.4);
  white-space: nowrap;
}

.books-tab:hover,
.books-tab:focus-visible {
  border-color: var(--ember-hot);
  color: #fff;
  outline: none;
}

.books-tab[aria-selected="true"] {
  color: #fff;
  border-color: var(--ember-hot);
  box-shadow:
    inset 0 -12px 20px rgba(255, 90, 20, .22),
    0 0 16px rgba(255, 70, 10, .28);
}

.books-cat-blurb {
  margin: 0 0 1rem;
  text-align: center;
  color: var(--mute);
  font-size: .92rem;
}

.books-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .9rem;
}

@media (min-width: 520px) {
  .books-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 800px) {
  .books-grid { grid-template-columns: 1fr 1fr 1fr; }
}

@media (min-width: 1080px) {
  .books-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

.book-card {
  display: grid;
  grid-template-rows: auto 1fr;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(255, 80, 20, .14), transparent 55%),
    linear-gradient(180deg, #160806, #080201);
  border: 1px solid rgba(255, 90, 30, .35);
  box-shadow: 0 6px 18px rgba(0,0,0,.4), inset 0 0 24px rgba(80, 10, 0, .12);
  overflow: hidden;
  min-width: 0;
}

.book-cover {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  background:
    linear-gradient(180deg, #1c0a06, #0a0301);
  border: 0;
  padding: 0;
  cursor: zoom-in;
}

.book-cover:focus-visible { outline: 2px solid var(--ember-hot); outline-offset: -2px; }

.book-cover img,
.book-cover-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.book-cover-fallback {
  display: grid;
  place-items: center;
  padding: .8rem;
  text-align: center;
  color: var(--ember-hot);
  font-family: var(--font-display);
  font-size: .85rem;
  letter-spacing: .06em;
  line-height: 1.3;
  background:
    repeating-linear-gradient(90deg, #2a0c05 0 8px, #140503 8px 16px);
}

.book-body { padding: .7rem .75rem .85rem; display: grid; align-content: start; gap: .25rem; }

.book-genre {
  margin: 0;
  font-family: var(--font-hud);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ember);
}

.book-title {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.3;
  color: var(--bone);
}

.book-author {
  margin: 0;
  color: var(--ember-hot);
  font-size: .9rem;
}

.book-desc {
  margin: .2rem 0 0;
  color: var(--mute);
  font-size: .86rem;
  line-height: 1.45;
}

.books-fan {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 90, 30, .28);
}

.books-subhead {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.15rem, 4vw, 1.7rem);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin: 0 0 .35rem;
  text-align: center;
  color: var(--ember-hot);
  text-shadow: 0 0 8px rgba(255, 80, 0, .55), 0 2px 0 #3a0800;
}

.books-ask {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 3.6vw, 1.45rem);
  letter-spacing: .03em;
  text-align: center;
  color: var(--ember-hot);
  margin: 1.15rem 0 .75rem;
  text-shadow: 0 0 10px rgba(255, 80, 0, .4);
  line-height: 1.35;
}

.books-fan-lede { margin-bottom: .4rem; }

.book-form .fan-fields { margin-top: .7rem; }

.book-form textarea {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  font: inherit;
  color: var(--bone);
  background: rgba(8, 2, 1, .7);
  border: 1px solid rgba(255, 90, 30, .35);
  padding: .55rem .65rem;
}

.book-form textarea:focus {
  outline: none;
  border-color: var(--ember-hot);
  box-shadow: 0 0 0 1px rgba(255, 180, 80, .35);
}

.book-form select {
  width: 100%;
  font: inherit;
  color: var(--bone);
  background: rgba(8, 2, 1, .7);
  border: 1px solid rgba(255, 90, 30, .35);
  padding: .45rem .55rem;
}

.book-form select:focus {
  outline: none;
  border-color: var(--ember-hot);
}

.book-card-fan .book-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin-top: .45rem;
}

.book-alias {
  margin: 0;
  font-family: var(--font-hud);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mute);
}

#book-more { margin: 1rem auto 0; display: block; }
#book-more[hidden] { display: none !important; }

.keep-card.is-book .keep-type {
  font-family: var(--font-hud);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .68rem;
  color: var(--ember);
  margin: 0 0 .2rem;
}

html[data-flame="off"] .books-tab[aria-selected="true"] { box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  .books-tab, .book-card { box-shadow: 0 3px 10px rgba(0,0,0,.4); }
}

/* ---------- Book detail modal (cover click) ---------- */

.book-cover {
  cursor: pointer;
}

.book-modal {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: grid;
  place-items: end center;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .22s ease, visibility .22s ease;
}

.book-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.book-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .78);
}

.book-modal-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 42rem;
  max-height: min(92vh, 920px);
  margin-top: auto;
  overflow: hidden;
  color: var(--bone);
  background:
    radial-gradient(ellipse at 50% 120%, rgba(255, 80, 20, .16), transparent 55%),
    linear-gradient(180deg, #1a0a07, #0a0301 40%, #060201);
  border: 1px solid rgba(255, 90, 30, .4);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -12px 40px rgba(0,0,0,.55), 0 0 28px rgba(255, 60, 0, .12);
}

.book-modal-close {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 2;
  width: 2.4rem;
  height: 2.4rem;
  background: transparent;
  border: 0;
  color: var(--bone);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.book-modal-close:focus-visible {
  outline: 2px solid var(--ember-hot);
  outline-offset: 2px;
}

.book-modal-top {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: .85rem;
  align-items: start;
  padding: 1.15rem 2.6rem .85rem 1rem;
}

.book-modal-coverwrap {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #120504;
  border: 1px solid rgba(255, 90, 30, .35);
  box-shadow: 0 6px 16px rgba(0,0,0,.45);
}

.book-modal-coverwrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: opacity .18s ease;
}

.book-modal-genre {
  margin: 0 0 .2rem;
  font-family: var(--font-hud);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ember);
}

.book-modal-title {
  margin: 0;
  padding-right: .2rem;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.12rem;
  line-height: 1.25;
  color: var(--bone);
}

.book-modal-author {
  margin: .25rem 0 0;
  color: var(--ember-hot);
  font-size: .92rem;
}

.book-modal-facts {
  margin: .4rem 0 0;
  color: var(--mute);
  font-family: var(--font-hud);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.book-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 1rem 1rem;
}

.book-modal-loading {
  margin: .2rem 0 0;
  color: var(--ember);
  font-family: var(--font-hud);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.book-modal-loading[hidden],
.book-modal-facts[hidden],
.book-modal-genre[hidden],
.book-modal-source[hidden] {
  display: none;
}

.book-modal-desc {
  color: var(--mute);
  font-size: .95rem;
  line-height: 1.55;
}

.book-modal-desc p {
  margin: 0 0 .75rem;
}

.book-modal-desc p:last-child {
  margin-bottom: 0;
}

.book-modal-source {
  margin: 0;
  padding: .45rem 1rem .7rem;
  color: rgba(246, 217, 176, .55);
  font-family: var(--font-hud);
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

@media (min-width: 520px) {
  .book-modal {
    place-items: center;
    padding: 1rem;
  }
  .book-modal-panel {
    margin: 0;
    max-height: min(88vh, 860px);
    border-radius: 12px;
    border-bottom: 1px solid rgba(255, 90, 30, .4);
  }
  .book-modal-top {
    grid-template-columns: 140px 1fr;
    padding: 1.3rem 3rem 1rem 1.2rem;
  }
  .book-modal-title {
    font-size: 1.28rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .book-modal { transition: none; }
}

html.is-book-modal-open,
html.is-book-modal-open body {
  overflow: hidden;
}
