* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #2b2a27;
  background: radial-gradient(ellipse at 50% 30%, #f4f2ec, #dcd9cf);
}

.demo {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

.demo header { text-align: center; margin-bottom: 28px; }
.demo h1 { margin: 0; font-size: 28px; letter-spacing: 0.02em; }
.demo header p { margin: 6px auto 0; max-width: 520px; color: #5d5a52; }

/* The book itself. Only its size and the paper colour are set from outside;
   grabfold draws everything else. */
.book {
  max-width: 820px;
  margin: 0 auto;
  --grabfold-paper: #fbf8f1;
  --grabfold-lift: #ffffff;
  filter: drop-shadow(0 18px 24px rgba(40, 32, 20, 0.22));
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}
.controls button, .jump select {
  font: inherit;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #b9b3a4;
  background: #fffdf8;
  color: inherit;
  cursor: pointer;
}
.controls button:disabled { opacity: 0.4; cursor: default; }
#where, .where { min-width: 110px; font-variant-numeric: tabular-nums; color: #5d5a52; }
.jump { text-align: center; color: #5d5a52; margin-top: 12px; }
.sound { display: flex; gap: 18px; justify-content: center; align-items: center; color: #5d5a52; margin-top: 8px; }
.sound label { display: inline-flex; gap: 6px; align-items: center; }

/* ------------------------------------------------------------- pages */

.page {
  position: relative;
  height: 100%;
  /* Room at the foot for the page number. */
  padding: 9% 10% 14%;
  display: flex;
  flex-direction: column;
}

.folio {
  position: absolute;
  bottom: 5%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: #9a9486;
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8f8878;
}

.cover {
  justify-content: center;
  align-items: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(233, 162, 59, 0.16), transparent 60%),
    #f7f1e3;
}
.cover h2 {
  margin: 8px 0 18px;
  font: 600 clamp(28px, 6vw, 44px)/1.1 Georgia, "Times New Roman", serif;
}
.cover .hint { margin: 0; color: #6c6556; }
.cover .small { margin-top: 28px; font-size: 12px; color: #9a9486; }
.cover.end { background: #f3efe6; }

.swatch { gap: 6px; }
.swatch .chip {
  flex: 1 1 auto;
  min-height: 40%;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.swatch h3 { margin: 14px 0 0; font: 600 clamp(18px, 3vw, 24px)/1.2 Georgia, serif; }
.swatch .hex { margin: 0; font-size: 12px; color: #8f8878; letter-spacing: 0.08em; text-transform: uppercase; }
.swatch .line { margin: 8px 0 0; font-style: italic; color: #5d5a52; font-size: clamp(13px, 1.8vw, 15px); }

.notes .ruled {
  flex: 1;
  margin-top: 16px;
  border-left: 2px solid color-mix(in oklab, var(--accent) 60%, transparent);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 23px,
    rgba(80, 110, 160, 0.22) 23px 24px
  );
}

/* Hard covers: a cloth-bound board outside, marbled endpapers inside. */
.book { --grabfold-board: #1f4f5a; }

.board.outside {
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #f1e6c8;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.10), transparent 55%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 4px),
    #1f4f5a;
  box-shadow: inset 0 0 0 10px rgba(0, 0, 0, 0.12), inset 0 0 0 12px rgba(241, 230, 200, 0.35);
}
.board.outside h2 { margin: 6px 0 22px; font: 600 clamp(30px, 6vw, 48px)/1.1 Georgia, serif; }
.board.outside .eyebrow, .board.outside .small { color: rgba(241, 230, 200, 0.75); }
.board.outside.back { justify-content: flex-end; }

.endpaper {
  justify-content: center;
  align-items: center;
  background:
    radial-gradient(circle at 20% 30%, rgba(31, 79, 90, 0.22) 0 6%, transparent 7%),
    radial-gradient(circle at 70% 60%, rgba(233, 162, 59, 0.20) 0 5%, transparent 6%),
    radial-gradient(circle at 40% 80%, rgba(142, 111, 168, 0.18) 0 7%, transparent 8%),
    #f1ead9;
  background-size: 90px 90px, 110px 110px, 130px 130px, auto;
}
.endpaper .label {
  background: #fbf8f1;
  padding: 18px 22px;
  border-radius: 6px;
  text-align: center;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}
.endpaper h2 { margin: 4px 0 8px; font: 600 clamp(22px, 4vw, 30px)/1.1 Georgia, serif; }
.endpaper .hint { margin: 0; color: #6c6556; font-size: 14px; }
