@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("fonts/montserrat-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("fonts/montserrat-semibold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ivory: #f3eee5;
  --paper: #fffdf9;
  --taupe: #989078;
  --sage: #74745f;
  --beige: #c7b9a5;
  --brown: #5a3e32;
  --charcoal: #4a433b;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(199,185,165,.35), transparent 32rem),
    linear-gradient(145deg, #ded7cb, #a7a18f);
  color: var(--charcoal);
  font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
  overflow-x: hidden;
}
button, a { font: inherit; }
.reader {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px) clamp(14px, 3vw, 32px) 28px;
  display: flex;
  flex-direction: column;
}
.masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
.eyebrow {
  margin: 0 0 3px;
  color: var(--brown);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  font-weight: 400;
  letter-spacing: .02em;
}
.download, .install, .fullscreen, .controls button {
  border: 1px solid rgba(74,67,59,.35);
  border-radius: 999px;
  background: rgba(243,238,229,.88);
  color: var(--charcoal);
  padding: 10px 16px;
  text-decoration: none;
  font-size: .9rem;
  transition: background .2s, transform .2s, border-color .2s;
}
.download:hover, .install:hover, .fullscreen:hover, .controls button:hover:not(:disabled) {
  background: var(--paper);
  border-color: var(--brown);
  transform: translateY(-1px);
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.install, .fullscreen { cursor: pointer; }
.install.install-ready { background: var(--brown); border-color: var(--brown); color: var(--paper); }
#installInstructions { display: grid; gap: 12px; line-height: 1.55; }
#installInstructions p { margin: 0; }
.stage {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  gap: clamp(8px, 2vw, 24px);
}
.book-shell {
  width: 100%;
  height: min(72vh, 790px);
  display: grid;
  place-items: center;
  perspective: 1800px;
}
.book {
  position: relative;
  height: 100%;
  aspect-ratio: 148 / 210;
  max-width: 100%;
  background: var(--ivory);
  box-shadow: 0 28px 65px rgba(51,44,37,.28), 0 3px 8px rgba(51,44,37,.18);
  transform-origin: left center;
  transform-style: preserve-3d;
  overflow: hidden;
  border-radius: 2px 5px 5px 2px;
  touch-action: pan-y;
}
.book::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0 auto 0 0;
  width: 10px;
  background: linear-gradient(90deg, rgba(74,67,59,.18), transparent);
  pointer-events: none;
}
.book img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; }
.contact-links { position: absolute; inset: 0; z-index: 4; }
.contact-hit { position: absolute; display: block; border: 0; padding: 0; background: transparent; border-radius: 4px; cursor: pointer; }
.contact-hit:focus-visible { outline: 3px solid var(--brown); outline-offset: 2px; background: rgba(255,253,249,.2); }
.contact-hit.email { left: 6.8%; top: 68.4%; width: 60%; height: 4%; }
.contact-hit.phone { left: 6.8%; top: 73.4%; width: 7%; height: 4%; }
.contact-hit.text { left: 14.5%; top: 73.4%; width: 7%; height: 4%; }
.contact-hit.website { left: 6.8%; top: 78.3%; width: 61%; height: 4%; }
.contact-hit.instagram { left: 6.8%; top: 84.5%; width: 7%; height: 4.6%; }
.contact-hit.facebook { left: 14.3%; top: 84.5%; width: 7%; height: 4.6%; }
.contact-hit.share { left: 21.8%; top: 84.5%; width: 7%; height: 4.6%; }
.contact-hit.website-qr { left: 79.5%; top: 80.8%; width: 13%; height: 9%; }
.share-dialog { border: 0; padding: 0; border-radius: 16px; color: var(--charcoal); background: var(--paper); box-shadow: 0 24px 70px rgba(51,44,37,.35); width: min(92vw, 470px); }
.share-dialog::backdrop { background: rgba(48,42,36,.55); backdrop-filter: blur(3px); }
.share-card { position: relative; padding: 30px; }
.share-card h2 { margin: 4px 0 8px; font-family: "Cormorant Garamond", Georgia, serif; font-size: 2rem; font-weight: 400; }
.share-card > p:not(.eyebrow):not(.copy-status) { margin: 0 0 20px; line-height: 1.55; }
.share-close { position: absolute; right: 13px; top: 10px; border: 0; background: transparent; color: var(--brown); font-size: 1.8rem; cursor: pointer; }
.share-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-options a, .share-options button { border: 1px solid rgba(90,62,50,.3); border-radius: 999px; background: var(--ivory); color: var(--brown); padding: 11px 14px; text-decoration: none; text-align: center; cursor: pointer; }
.share-options a:hover, .share-options button:hover { background: var(--beige); }
.copy-status { min-height: 1.2em; margin: 12px 0 0; color: var(--sage); font-size: .82rem; text-align: center; }
.page-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 42%, rgba(255,255,255,.34) 50%, transparent 58%);
  transform: translateX(-120%);
  pointer-events: none;
}
.book.turn-next { animation: turnNext .42s cubic-bezier(.4,0,.2,1); }
.book.turn-prev { animation: turnPrev .42s cubic-bezier(.4,0,.2,1); }
.book.turn-next .page-shine, .book.turn-prev .page-shine { animation: shine .42s ease; }
@keyframes turnNext { 0%{transform:rotateY(0)} 48%{transform:rotateY(-9deg) scale(.985)} 100%{transform:rotateY(0)} }
@keyframes turnPrev { 0%{transform:rotateY(0)} 48%{transform:rotateY(9deg) scale(.985)} 100%{transform:rotateY(0)} }
@keyframes shine { to { transform: translateX(120%); } }
.nav {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(74,67,59,.28);
  border-radius: 50%;
  background: rgba(243,238,229,.82);
  color: var(--charcoal);
  font-family: Georgia, serif;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}
.nav:disabled, .controls button:disabled { opacity: .35; cursor: default; }
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.view-tools { display: inline-flex; align-items: center; gap: 6px; }
.controls .view-tool { min-width: 42px; padding-inline: 12px; }
.controls .reset-view, .controls .rotate-view { min-width: auto; }
#counter { min-width: 110px; text-align: center; font-size: .9rem; font-weight: 600; }
.hint { margin: 10px 0 0; text-align: center; font-size: .82rem; color: rgba(74,67,59,.8); }
.quick-actions {
  position: fixed;
  z-index: 30;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: row;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(255,253,249,.55);
  border-radius: 999px;
  background: rgba(243,238,229,.72);
  box-shadow: 0 10px 30px rgba(51,44,37,.22);
  backdrop-filter: blur(10px);
  touch-action: none;
  user-select: none;
  cursor: grab;
  will-change: left, top;
}
.quick-actions.is-dragging { cursor: grabbing; }
.quick-actions.is-dragging .quick-action { pointer-events: none; }
.quick-action {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,253,249,.7);
  border-radius: 50%;
  background: var(--brown);
  color: var(--paper);
  box-shadow: 0 8px 24px rgba(51,44,37,.28);
  cursor: pointer;
  transition: transform .2s, background .2s;
}
.quick-action:hover { background: var(--charcoal); transform: translateY(-2px); }
.quick-action:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
.quick-action svg { width: 23px; height: 23px; fill: currentColor; }
body.is-fullscreen { background: #302b27; }
body.is-fullscreen .reader {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  padding: 10px;
  overflow: hidden;
}
body.is-fullscreen .masthead {
  position: fixed;
  z-index: 20;
  top: 10px;
  right: 10px;
  margin: 0;
  padding: 6px;
  border-radius: 999px;
  background: rgba(48,43,39,.7);
  backdrop-filter: blur(10px);
}
body.is-fullscreen .masthead > div:first-child,
body.is-fullscreen .masthead .install,
body.is-fullscreen .masthead .download { display: none; }
body.is-fullscreen .fullscreen { background: rgba(255,253,249,.94); }
body.is-fullscreen .stage {
  height: 100%;
  grid-template-columns: 56px minmax(0,1fr) 56px;
}
body.is-fullscreen .book-shell { height: calc(100dvh - 20px); }
body.is-fullscreen .book-shell {
  width: 100%;
  padding: 52px max(14px, env(safe-area-inset-right)) 58px max(14px, env(safe-area-inset-left));
}
body.is-fullscreen .book {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}
body.is-fullscreen .controls {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px;
  border-radius: 999px;
  background: rgba(48,43,39,.66);
  backdrop-filter: blur(10px);
}
body.is-fullscreen .hint { display: none; }
@media (max-width: 650px) {
  .reader { min-height: 100dvh; }
  .masthead { align-items: center; }
  .download, .install, .fullscreen { padding: 9px 11px; font-size: .76rem; }
  .header-actions { gap: 6px; }
  .stage { grid-template-columns: 1fr; }
  .book-shell { height: min(68dvh, 690px); }
  .nav { position: fixed; z-index: 8; top: 50%; width: 42px; height: 42px; background: rgba(243,238,229,.94); }
  .nav.prev { left: 7px; }
  .nav.next { right: 7px; }
  .controls button#first, .controls button#last { display: none; }
  .share-options { grid-template-columns: 1fr; }
  body.is-fullscreen .reader { padding: 0; }
  body.is-fullscreen .stage { display: block; }
  body.is-fullscreen .book-shell {
    height: 100dvh;
    padding-top: calc(max(8px, env(safe-area-inset-top)) + 48px);
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: calc(max(8px, env(safe-area-inset-bottom)) + 42px);
    padding-left: max(12px, env(safe-area-inset-left));
  }
  body.is-fullscreen .nav { top: 50%; }
  body.is-fullscreen .masthead { top: max(8px, env(safe-area-inset-top)); right: 8px; }
  body.is-fullscreen .controls { bottom: max(8px, env(safe-area-inset-bottom)); }
  .quick-actions { right: max(8px, env(safe-area-inset-right)); bottom: calc(max(8px, env(safe-area-inset-bottom)) + 52px); }
  .quick-action { width: 46px; height: 46px; }
  body.is-fullscreen .controls > button { display: none; }
  body.is-fullscreen .controls .view-tool { display: inline-block; padding: 8px 11px; }
  body.is-fullscreen #counter { min-width: 84px; color: var(--paper); font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
