/* Book detail / confirm page — cover-as-hero layout. */

/* Explicit back button for book preview/detail pages. */
.back-fab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(20, 16, 14, .58);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
}
.back-fab svg {
  width: 19px;
  height: 19px;
  display: block;
}
.back-fab:hover {
  background: rgba(20, 16, 14, .78);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .34);
}
.back-fab:active {
  transform: scale(.94);
}
.back-fab:focus-visible {
  outline: 2px solid var(--ring, #fff);
  outline-offset: 2px;
}

.detail-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  margin-bottom: 22px;
  isolation: isolate;
  min-height: 240px;
}

/* Blurred, darkened, scaled copy of the cover filling the background. */
.detail-hero__bg {
  position: absolute;
  inset: -8%;
  z-index: -2;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: blur(28px) saturate(120%) brightness(.85);
  transform: scale(1.18);
}

/* Fallback gradient hero when there is no cover image. */
.detail-hero--fallback .detail-hero__bg {
  inset: 0;
  transform: none;
  filter: none;
  background-image: none;
  background:
    radial-gradient(120% 140% at 85% 0%, var(--primary-soft), transparent 60%),
    linear-gradient(135deg, var(--primary-strong), var(--primary));
}

/* Dark scrim so foreground text is always legible over any cover. */
.detail-hero__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(8, 6, 5, .78), rgba(8, 6, 5, .42) 55%, rgba(8, 6, 5, .58)),
    linear-gradient(180deg, rgba(8, 6, 5, .25), rgba(8, 6, 5, .55));
}

.detail-hero__inner {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 30px 28px;
}

/* Foreground crisp cover. */
.detail-hero__cover {
  flex: 0 0 auto;
  width: 150px;
  height: 210px;
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, .08);
  box-shadow: 0 22px 48px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .12);
}
/* Cover is a button so it can be tapped to take/replace the photo. */
.detail-cover-edit { position: relative; padding: 0; border: 0; cursor: pointer; display: block; }
.detail-cover-hint {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  background: rgba(0, 0, 0, .58);
  color: #fff;
  font-size: .74rem;
  font-weight: 800;
  padding: 6px 4px;
  text-align: center;
}
.detail-cover-edit:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.detail-hero__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-hero__cover .cover-fallback {
  width: 100%;
  height: 100%;
  min-height: 0;
  font-size: 3rem;
}

.detail-hero__body {
  min-width: 0;
  flex: 1;
  color: #fdfbf9;
}
.detail-hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
/* Hero badges sit on a translucent chip regardless of theme. */
.detail-hero__badges .badge {
  background: rgba(255, 255, 255, .16);
  color: #fff;
  backdrop-filter: blur(4px);
}
.detail-hero__title {
  margin: 0 0 8px;
  color: #fff;
  font-size: clamp(1.5rem, 2.6vw, 2.15rem);
  line-height: 1.3;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .45);
}
.detail-hero__author {
  margin: 0;
  color: rgba(255, 255, 255, .9);
  font-weight: 750;
  font-size: 1rem;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .4);
}
.detail-hero__sub {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, .78);
  font-size: .9rem;
}

/* Content grid below the hero. */
.detail-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 18px;
  align-items: start;
}

.detail-meta dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  margin: 0;
}
.detail-meta .meta-row { min-width: 0; }
.detail-meta .meta-row.full { grid-column: 1 / -1; }
.detail-meta dt {
  color: var(--muted-foreground);
  font-size: .8rem;
  font-weight: 800;
  margin-bottom: 3px;
}
.detail-meta dd {
  margin: 0;
  color: var(--foreground);
  font-weight: 750;
  font-size: .94rem;
  word-break: break-word;
}
.detail-card-title {
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 1.05rem;
}

@media (max-width: 880px) {
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .detail-hero__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding: 22px 18px;
  }
  .detail-hero__cover { width: 120px; height: 168px; }
  .detail-meta dl { grid-template-columns: 1fr; }
}
