/* =========================================================
   Vanilla book flip excerpt prototype
   Dev-only styling for the custom CSS/JS page flip.
   ========================================================= */

#bookflip-excerpt-demo {
  padding: 96px 0 112px;
  overflow: visible;
  background: transparent;
}

.bookflip-demo {
  position: relative;
}

.bookflip-section-intro {
  max-width: 720px;
  margin: 0 auto 34px;
  padding: 0 24px;
  text-align: center;
}

.bookflip-section-kicker {
  margin: 0 0 12px;
  color: #c8622a;
  font-family: "Spline Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.2em;
  line-height: 1;
  text-transform: uppercase;
}

.bookflip-section-title {
  margin: 0;
  color: #1c1917;
  font-family: "Spline Sans", sans-serif;
  font-size: 2.45rem;
  font-weight: 850;
  line-height: 1.05;
}

.bookflip-section-copy {
  max-width: 58ch;
  margin: 16px auto 0;
  color: #57534e;
  font-family: "EB Garamond", serif;
  font-size: 1.12rem;
  line-height: 1.55;
}

.bookflip-stage {
  position: relative;
  width: 922px;
  height: 600px;
  margin: 0 auto;
  perspective: 2400px;
  perspective-origin: 50% 50%;
}

.bookflip-book {
  position: relative;
  width: 922px;
  height: 600px;
  transform-style: preserve-3d;
  overflow: visible;
}

.bookflip-page {
  position: absolute;
  top: 0;
  width: 461px;
  height: 600px;
  box-sizing: border-box;
  overflow: hidden;
  background-color: #fefefd;
  background-image: linear-gradient(180deg, #ffffff 0%, #fcfcfa 100%);
  color: #1c1917;
  box-shadow:
    0 18px 42px rgba(28, 25, 23, 0.045),
    0 2px 8px rgba(90, 90, 86, 0.018);
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

.bookflip-page-left {
  left: 0;
  border-radius: 28px 0 0 28px;
}

.bookflip-page-right {
  left: 461px;
  border-radius: 0 28px 28px 0;
}

.bookflip-page-turning {
  z-index: 10;
  pointer-events: none;
  transition:
    transform 760ms cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 760ms ease;
  will-change: transform;
}

.bookflip-page.is-hidden {
  visibility: hidden;
}

.bookflip-page-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 34px 34px 26px;
}

.bookflip-page-inner--cover {
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.bookflip-page-inner--blank {
  padding: 0;
}

.bookflip-page-inner--back {
  align-items: center;
  justify-content: center;
  padding: 34px;
}

.bookflip-cover-layout {
  align-items: center;
  justify-content: center;
  padding: 12px 38px 12px 18px;
}

.bookflip-cover-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
  object-position: center left;
}

.bookflip-page-label {
  margin: 0;
  color: #c8622a;
  font-family: "Spline Sans", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  line-height: 1;
  text-transform: uppercase;
}

.bookflip-page-title {
  margin: 0;
  max-width: 20ch;
  color: #1c1917;
  font-family: "Spline Sans", sans-serif;
  font-size: 2rem;
  font-weight: 850;
  letter-spacing: -0.03em;
  line-height: 1.03;
}

.bookflip-title-layout,
.bookflip-part-layout {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.bookflip-title-block,
.bookflip-part-block {
  width: 100%;
  margin: auto 0;
}

.bookflip-title {
  margin: 0 0 26px;
  color: #1c1917;
  font-family: "Spline Sans", sans-serif;
  font-size: 2.52rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  line-height: 0.98;
}

.bookflip-subtitle {
  margin: 0;
  color: #2f2a24;
  font-family: "EB Garamond", serif;
  font-size: 1.58rem;
  font-style: italic;
  line-height: 1.24;
}

.bookflip-author {
  margin: 64px 0 0;
  color: #1c1917;
  font-family: "Spline Sans", sans-serif;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.bookflip-part-title {
  margin: 0 0 46px;
  color: #1c1917;
  font-family: "Spline Sans", sans-serif;
  font-size: 1.42rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.bookflip-epigraph {
  max-width: 31ch;
  margin: 0 auto;
  color: #403c37;
  font-family: "EB Garamond", serif;
  font-size: 1.14rem;
  font-style: italic;
  line-height: 1.55;
}

.bookflip-poem {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 36ch;
}

.bookflip-poem-layout {
  gap: 14px;
  padding: 42px 38px 28px;
}

.bookflip-poem-heading {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0 0 14px;
}

.bookflip-poem-title {
  margin: 0;
  color: #1c1917;
  font-family: "Spline Sans", sans-serif;
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  line-height: 1.2;
}

.bookflip-poem-subtitle {
  margin: 0;
  color: #6a3f2a;
  font-family: "EB Garamond", serif;
  font-size: 1.06rem;
  font-style: italic;
  line-height: 1.25;
}

.bookflip-poem-text {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 37ch;
}

.bookflip-stanza {
  margin: 0;
  color: #1c1917;
  font-family: "EB Garamond", serif;
  font-size: 1.10rem;
  line-height: 1.48;
  white-space: pre-line;
}

.bookflip-section-break {
  margin: 0;
  color: #8a8178;
  font-family: "EB Garamond", serif;
  font-size: 1.24rem;
  line-height: 1;
}

.bookflip-folio {
  margin-top: auto;
  padding-top: 18px;
  color: #57534e;
  font-family: "Spline Sans", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
}

.bookflip-folio--left {
  align-self: flex-start;
}

.bookflip-folio--right {
  align-self: flex-end;
}

.bookflip-back-note {
  max-width: 26ch;
  margin: 0 auto;
  color: #403c37;
  font-family: "EB Garamond", serif;
  font-size: 1.12rem;
  line-height: 1.65;
  text-align: center;
}

.bookflip-purchase-layout {
  justify-content: center;
  gap: 28px;
  padding: 48px 42px 30px;
}

.bookflip-purchase-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bookflip-purchase-title {
  max-width: 16ch;
  margin: 0;
  color: #1c1917;
  font-family: "Spline Sans", sans-serif;
  font-size: 1.72rem;
  font-weight: 850;
  line-height: 1.08;
}

.bookflip-purchase-card {
  width: 100%;
  max-width: 320px;
}

.bookflip-purchase-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 24px;
  border: 1px solid rgba(194, 92, 45, 0.28);
  border-radius: 8px;
  background: #fff9f2;
  color: #1c1917;
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(28, 25, 23, 0.06);
}

.bookflip-purchase-link:focus,
.bookflip-purchase-link:hover {
  border-color: rgba(194, 92, 45, 0.55);
  background: #fff4e8;
}

.bookflip-purchase-link-title {
  font-family: "Spline Sans", sans-serif;
  font-size: 0.98rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.bookflip-purchase-link-copy {
  color: #57534e;
  font-family: "EB Garamond", serif;
  font-size: 1.03rem;
  line-height: 1.35;
}

.bookflip-control {
  position: absolute;
  top: 50%;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(28, 25, 23, 0.12);
  color: #1c1917;
  font-family: "Spline Sans", sans-serif;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  transform: translateY(-50%);
  transition:
    background-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease,
    box-shadow 160ms ease;
}

.bookflip-control:hover:not(:disabled) {
  background: #f6f1eb;
  box-shadow: 0 12px 28px rgba(28, 25, 23, 0.16);
}

.bookflip-control:disabled {
  opacity: 0.35;
  cursor: default;
}

.bookflip-prev {
  left: -72px;
}

.bookflip-next {
  right: -72px;
}

.bookflip-stage.is-animating .bookflip-control {
  pointer-events: none;
}

.bookflip-page--cover .bookflip-page-inner,
.bookflip-page--back .bookflip-page-inner {
  height: 100%;
}

.bookflip-page--blank {
  background-image: linear-gradient(180deg, #ffffff 0%, #fcfcfa 100%);
}

.bookflip-page--blank .bookflip-page-inner {
  display: none;
}

.bookflip-page--cover .bookflip-cover-layout {
  padding: 12px 38px 12px 18px;
}

.bookflip-page-turning.bookflip-page--left,
.bookflip-page-turning.bookflip-page--right,
.bookflip-page-turning.bookflip-page--cover,
.bookflip-page-turning.bookflip-page--back,
.bookflip-page-turning.bookflip-page--blank {
  z-index: 30;
}

.bookflip-page-turning.is-animating {
  box-shadow:
    0 24px 54px rgba(28, 25, 23, 0.12),
    0 4px 12px rgba(90, 90, 86, 0.06);
}

.bookflip-page-turning.is-turning-forward,
.bookflip-page-turning.is-turning-backward {
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

/* Poem excerpt body alignment polish */
.bookflip-poem-layout .bookflip-poem-text,
.bookflip-poem-layout .bookflip-stanza {
  text-align: left;
}

.bookflip-poem-layout .bookflip-stanza {
  margin-left: 0;
  margin-right: auto;
}

@media (max-width: 900px) {
  .bookflip-demo {
    overflow-x: clip;
  }

  .bookflip-section-intro {
    margin-bottom: 28px;
  }

  .bookflip-section-title {
    font-size: 2rem;
  }

  .bookflip-stage.is-single-page {
    width: var(--bookflip-mobile-width, 461px);
    height: var(--bookflip-mobile-height, 600px);
    margin: 0 auto;
    max-width: 100vw;
  }

  .bookflip-stage.is-single-page .bookflip-book {
    left: 50%;
    width: 461px;
    height: 600px;
    transform: translateX(-50%) scale(var(--bookflip-mobile-scale, 1));
    transform-origin: top center;
  }

  .bookflip-stage.is-single-page .bookflip-page,
  .bookflip-stage.is-single-page .bookflip-page-left,
  .bookflip-stage.is-single-page .bookflip-page-right {
    left: 0;
  }

  .bookflip-stage.is-single-page .bookflip-page-right.is-hidden {
    visibility: hidden;
  }

  .bookflip-stage.is-single-page .bookflip-control {
    top: 50%;
    width: 44px;
    height: 44px;
    transform: translateY(-50%);
  }

  .bookflip-stage.is-single-page .bookflip-prev {
    left: clamp(-24px, -5vw, -16px);
  }

  .bookflip-stage.is-single-page .bookflip-next {
    right: clamp(-24px, -5vw, -16px);
  }
}

/* Poem heading alignment polish */
.bookflip-poem-layout .bookflip-poem-title,
.bookflip-poem-layout .bookflip-poem-subtitle,
.bookflip-poem-layout .bookflip-page-label {
  text-align: left;
}

/* Bookflip section introduction */
.bookflip-section-intro {
  max-width: 760px;
  margin: 0 auto 2.25rem;
  padding: 0 1.5rem;
  text-align: center;
}

.bookflip-section-kicker {
  margin: 0 0 0.65rem;
  color: #b45a3c;
  font-family: var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1.2;
  text-transform: uppercase;
}

.bookflip-section-title {
  margin: 0;
  color: #1f1f1f;
  font-family: var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  font-size: clamp(2rem, 4vw, 3.15rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.bookflip-section-copy {
  max-width: 680px;
  margin: 0.9rem auto 0;
  color: #4d4a45;
  font-family: var(--font-serif, Georgia, "Times New Roman", serif);
  font-size: 1.05rem;
  line-height: 1.55;
}

.bookflip-section-copy em {
  font-style: italic;
}
