/* Hero: blurred portrait with a dark overlay (W1e) behind the 3D book (W1r). */
:root {
  --bg: #121212;
  --text: #f2f2f2;
  --overlay-top: rgba(8, 10, 12, 0.55);
  --overlay-bottom: rgba(8, 10, 12, 0.85);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
/* Background layer: the photo is blurred and scaled a little so the blur never shows a soft edge. */
.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  background: var(--bg);
}
.hero-bg-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
  filter: blur(22px) saturate(0.85);
  transform: scale(1.12);
  will-change: transform;
}
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, var(--overlay-top), var(--overlay-bottom));
}
.hero-title {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  z-index: 2;
  text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.hero-author {
  margin: 0 0 4px;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.85;
}
.hero-book {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  line-height: 1.1;
}
.hero-sub {
  display: block;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  font-size: 0.42em;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-top: 6px;
  opacity: 0.9;
}
.photo-credit {
  position: absolute;
  right: 14px;
  bottom: 10px;
  margin: 0;
  z-index: 2;
  font-size: 0.7rem;
  opacity: 0.55;
}
.book-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.book-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y; /* sideways drags spin the book; up-and-down swipes still scroll the page */
  cursor: grab;
}
.book-canvas.dragging { cursor: grabbing; }
.book-canvas.hidden { display: none; }
.book-fallback {
  position: relative;
  width: auto;
  height: min(60svh, 520px);
  max-width: 80vw;
  margin-top: 12svh; /* keep clear of the title at the top */
  object-fit: contain;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}
.book-fallback.hidden { display: none; }
.hint {
  position: absolute;
  bottom: 86px;
  z-index: 2;
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.hint.hidden { display: none; }

/* Scroll cue: a link to the order section with a gently nodding arrow. */
.scroll-cue {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
}
.scroll-cue:hover, .scroll-cue:focus-visible { opacity: 1; }
.scroll-cue svg { animation: nod 2s ease-in-out infinite; }
@keyframes nod {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  .scroll-cue svg { animation: none; }
  html { scroll-behavior: auto; }
}

/* Order section (W1h). */
.order {
  background: var(--bg);
  padding: clamp(48px, 8vw, 96px) 16px;
}
.order-inner {
  max-width: 1040px;
  margin: 0 auto;
}
.order-head { text-align: center; margin-bottom: clamp(28px, 4vw, 48px); }
.order-head h2 {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
}
.order-lead { margin: 0; opacity: 0.8; }
.order-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 32px;
  align-items: start;
}
@media (max-width: 760px) {
  .order-grid { grid-template-columns: 1fr; }
  .order-aside { order: -1; } /* on a phone the price comes first, then the form */
}
.order-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.9rem; opacity: 0.85; }
.optional { opacity: 0.6; font-weight: normal; }
.field-row { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.field-small input { max-width: 120px; }
.field input, .field textarea {
  font: inherit;
  color: var(--text);
  background: #1c1c1c;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  padding: 12px 14px;
  min-height: 46px; /* comfortable to tap */
}
.field input:focus, .field textarea:focus {
  outline: 2px solid #58b85e;
  outline-offset: 1px;
  border-color: #58b85e;
}
.field textarea { resize: vertical; }
.order-total { margin: 4px 0 0; font-weight: 600; }
.order-button {
  font: inherit;
  font-weight: 600;
  color: #0e1a0f;
  background: #58b85e;
  border: 0;
  border-radius: 10px;
  padding: 14px 24px;
  min-height: 50px;
  cursor: pointer;
}
.order-button:hover { background: #6ccb72; }
.order-button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.order-button:disabled { background: #444; color: #999; cursor: not-allowed; }
.form-status { margin: 0; min-height: 1.4em; opacity: 0.85; }
.privacy { margin-top: 4px; font-size: 0.9rem; line-height: 1.5; opacity: 0.85; }
.privacy summary { cursor: pointer; font-weight: 600; opacity: 0.9; }
.privacy summary:focus-visible { outline: 2px solid #58b85e; outline-offset: 2px; }
.privacy p { margin: 10px 0 0; }
.privacy a { color: #7fd486; }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.order-form.hidden { display: none; }
.order-thanks {
  background: #1a2a1c;
  border: 1px solid #2f5a34;
  border-radius: 14px;
  padding: 24px;
  line-height: 1.5;
}
.order-thanks.hidden { display: none; }
.order-thanks h3 { margin: 0 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: 1.3rem; }
.order-thanks p { margin: 0; }
.order-aside { display: flex; flex-direction: column; gap: 16px; }
.card {
  background: #1a1a1a;
  border: 1px solid #2c2c2c;
  border-radius: 14px;
  padding: 20px 22px;
}
.price-label { margin: 0; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.7; }
.price {
  margin: 4px 0 2px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: #7fd486;
}
.price-note { margin: 0; opacity: 0.75; font-size: 0.95rem; }
/* Sales panel: sold and left, a bar for the share of the stock that is gone. */
.sales-row { display: flex; gap: 24px; margin-bottom: 14px; }
.sales-stat { flex: 1; }
.sales-number {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
  transition: opacity 0.3s;
}
.sales-label { margin: 2px 0 0; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.7; }
.sales-panel.loading .sales-number { opacity: 0.4; }
.stock-bar { height: 8px; background: #2a2a2a; border-radius: 4px; overflow: hidden; }
.stock-bar-fill { height: 100%; width: 0; background: #58b85e; border-radius: 4px; transition: width 0.6s ease; }
@media (prefers-reduced-motion: reduce) { .stock-bar-fill { transition: none; } }
.stock-note { margin: 10px 0 0; font-size: 0.85rem; opacity: 0.7; }
.soldout-note { margin: 10px 0 0; font-weight: 600; color: #ffb4a8; }
.soldout-note.hidden { display: none; }
.sales-panel.soldout { border-color: #7a3a33; }
.sales-panel.soldout .stock-bar-fill { background: #d9534f; }
.sales-panel.soldout #left-count { color: #ffb4a8; }
.order-form:has(:disabled) { opacity: 0.6; }
.sales-panel.closed .sales-row, .sales-panel.closed .stock-bar, .sales-panel.closed .stock-note { display: none; }
.store-closed-note { margin: 0; font-weight: 600; }
.store-closed-note.hidden { display: none; }
.how-card h3 { margin: 0 0 10px; font-size: 1rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.85; }
.how-card ol { margin: 0; padding-left: 20px; line-height: 1.5; }
.how-card li + li { margin-top: 6px; }
