body { overflow: hidden; }
.story-portal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  perspective: 1800px;
  isolation: isolate;
  color: #f4e8c9;
}
.portal-backdrop {
  position: absolute;
  z-index: -1;
  inset: -3%;
  background:
    radial-gradient(ellipse at 50% 55%, rgba(174, 81, 47, .22), transparent 36%),
    linear-gradient(180deg, rgba(8, 11, 14, .68), rgba(8, 11, 14, .9)),
    url('assets/redridge-rats-banner.png') center 51% / cover;
  filter: saturate(.74);
  transform: scale(1.03);
}
.portal-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(237, 193, 117, .45) .7px, transparent .8px);
  background-size: 53px 53px;
  opacity: .23;
  mask-image: linear-gradient(transparent, black 30%, black 70%, transparent);
}
.book-stage {
  position: relative;
  width: min(430px, 82vw);
  height: min(640px, 82dvh);
  transform-style: preserve-3d;
  transition: width 1.25s cubic-bezier(.2,.76,.16,1), height 1.25s cubic-bezier(.2,.76,.16,1);
}
.closed-cover {
  appearance: none;
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transform-style: preserve-3d;
  transform-origin: 50% center;
  transition: transform 1.45s cubic-bezier(.36,.03,.2,1), width 1.25s cubic-bezier(.2,.76,.16,1), opacity .7s ease 1s;
  filter: drop-shadow(0 35px 35px rgba(0,0,0,.58));
  -webkit-tap-highlight-color: transparent;
}
.closed-cover:focus-visible { outline: 2px solid #f0ce89; outline-offset: 6px; }
.cover-image-wrap, .cover-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover-art { object-fit: contain; }
.cover-title {
  position: absolute;
  top: 28%;
  left: 16%;
  right: 11%;
  color: #f0d49c;
  font: 400 clamp(15px, 2vw, 21px)/1.2 'Cinzel Decorative', 'Marcellus', Georgia, serif;
  letter-spacing: .035em;
  text-align: center;
  text-shadow: 0 2px 5px #421b12, 0 0 12px rgba(25, 9, 4, .8);
}
.cover-title b { display: inline-block; margin-top: 4px; font-size: 1.08em; }
.cover-open-hint {
  position: absolute;
  bottom: calc(12% - .5cm);
  left: 15%;
  right: 10%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #f0d49c;
  font: 700 13.8px 'DM Sans', Arial, sans-serif;
  letter-spacing: .19em;
  text-shadow: 0 2px 5px #35150d;
  animation: hint-glow 2.8s ease-in-out infinite;
}
.cover-open-hint i { width: 15px; height: 1px; background: currentColor; opacity: .72; }
.cover-back {
  position: absolute;
  inset: 1.5% 1% 1.5% 8%;
  display: block;
  border: 7px ridge #97703c;
  border-radius: 6px 13px 13px 6px;
  background: repeating-linear-gradient(0deg, #e8d9b6, #e8d9b6 2px, #c4aa7a 3px, #f2e6c7 5px);
  box-shadow: inset 0 0 22px rgba(64, 40, 19, .45);
  transform: rotateY(180deg);
  backface-visibility: hidden;
}
.open-spread {
  position: absolute;
  z-index: 2;
  inset: 0;
  padding: clamp(12px, 2.2vw, 30px);
  overflow: hidden;
  border: 1px solid rgba(241, 211, 154, .76);
  border-radius: 11px;
  background:
    linear-gradient(90deg, rgba(107, 71, 36, .22), transparent 2.3%, transparent 48.8%, rgba(92, 59, 32, .2) 50%, transparent 51.2%, transparent 98%, rgba(107, 71, 36, .22)),
    repeating-linear-gradient(0deg, #ddc99f 0, #eadbb9 2px, #e5d3ae 4px, #eaddbd 7px);
  box-shadow: 0 24px 90px rgba(0,0,0,.65), inset 0 0 32px rgba(98, 61, 29, .28);
  opacity: 0;
  transform: rotateY(12deg) scaleX(.74);
  transform-origin: center;
  transition: opacity .4s ease .55s, transform .95s cubic-bezier(.2,.76,.16,1) .18s;
  pointer-events: none;
}
.open-spread::before, .open-spread::after {
  content: "";
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 20px;
  bottom: 20px;
  width: 9px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(81, 53, 31, .24), rgba(250, 230, 192, .23), rgba(81, 53, 31, .18));
  pointer-events: none;
}
.open-spread::after { left: 50%; width: 2px; background: rgba(98, 66, 39, .2); }
.site-book-view {
  position: relative;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  background: #10151b;
  box-shadow: 0 3px 15px rgba(44, 28, 15, .44);
  opacity: 0;
  transition: opacity .5s ease .8s;
  scrollbar-color: #b39055 #151b20;
}
.book-close {
  position: absolute;
  z-index: 8;
  top: 9px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid rgba(240, 212, 156, .6);
  border-radius: 2px;
  background: rgba(12, 16, 19, .72);
  color: #f1d49b;
  font: 10px 'DM Sans', Arial, sans-serif;
  cursor: pointer;
  opacity: 0;
  transition: opacity .3s ease 1.3s, background .2s;
}
.book-close:hover { background: rgba(12, 16, 19, .95); }
.book-close:first-letter { font-size: 17px; }
.book-close span { letter-spacing: .06em; }
.story-portal.is-open .book-stage { width: min(1540px, 97vw); height: min(940px, 94dvh); }
.story-portal.is-open .open-spread { opacity: 1; transform: rotateY(0) scaleX(1); pointer-events: auto; }
.story-portal.is-open .site-book-view { opacity: 1; }
.story-portal.is-open .closed-cover {
  z-index: 5;
  width: 50%;
  right: 0;
  left: auto;
  transform-origin: left center;
  transform: rotateY(-178deg);
  opacity: 0;
  pointer-events: none;
}
.story-portal.is-open .book-close { opacity: 1; }
.portal-caption {
  position: absolute;
  bottom: max(18px, 3vh);
  margin: 0;
  color: rgba(238, 221, 186, .72);
  font: 10px 'Marcellus', Georgia, serif;
  letter-spacing: .16em;
  text-transform: uppercase;
  transition: opacity .3s;
}
.story-portal.is-open .portal-caption { opacity: 0; }
@keyframes hint-glow { 0%, 100% { opacity: .7; } 50% { opacity: 1; } }

@media (max-width: 760px) {
  .book-stage { width: min(390px, 87vw); height: min(590px, 77dvh); }
  .story-portal.is-open .book-stage { width: 100vw; height: 100dvh; }
  .open-spread { padding: 9px; border-radius: 0; }
  .open-spread::before, .open-spread::after { display: none; }
  .book-close { top: 6px; right: 6px; padding: 6px 8px; }
  .cover-title { font-size: clamp(14px, 4vw, 19px); }
  .cover-open-hint { font-size: 12.075px; letter-spacing: .15em; }
}
@media (max-width: 430px) {
  .story-portal.is-open .book-stage { width: 100vw; height: 100dvh; }
  .open-spread { padding: 0; border: 0; }
  .site-book-view { box-shadow: none; }
  .portal-caption { bottom: 12px; font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .book-stage, .closed-cover, .open-spread, .site-book-view { transition-duration: .01ms !important; }
}

/* Larger, more legible storybook cover */
.book-stage {
  width: min(900px, 90vw, 73dvh);
  height: auto;
  aspect-ratio: 3 / 4;
}
.cover-title {
  z-index: 2;
  top: 43%;
  left: 50%;
  right: auto;
  width: 82%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: 'Uncial Antiqua', 'Cinzel Decorative', Georgia, serif;
  font-size: clamp(28px, 4.5vw, 62px);
  font-weight: 700;
  line-height: .96;
  letter-spacing: .035em;
  color: #f0cf70;
  filter: none;
}
.cover-title > span {
  margin-bottom: 8px;
  font-size: .58em;
  letter-spacing: .12em;
}
.cover-title > span, .cover-title b {
  color: #f0cf70;
  -webkit-text-fill-color: #f0cf70;
  -webkit-text-stroke: .7px #936523;
  text-shadow: 0 1px 0 #fff0b0, 0 2px 0 #bd8b38, 0 4px 0 #71471e, 0 6px 5px rgba(22, 8, 3, .9), 0 0 15px rgba(248, 186, 75, .48);
}
.cover-title b {
  margin: 0;
  font: inherit;
  letter-spacing: .12em;
}
@media (max-width: 760px) {
  .book-stage {
    width: min(650px, 96vw, 88dvh);
    height: auto;
    aspect-ratio: 3 / 4;
  }
  .cover-title { top: 43%; width: 84%; font-size: clamp(28px, 7.5vw, 48px); }
  .cover-title > span { margin-bottom: 6px; }
}

/* Open book interior and page-turn layout */
.story-portal.is-open .book-stage {
  width: min(1800px, 99vw);
  height: min(1100px, 98dvh);
}
.open-spread {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 44px;
  gap: 10px;
  padding: clamp(24px, 3vw, 46px) clamp(30px, 4vw, 62px) 14px;
  border: 7px ridge #9a6d37;
  border-radius: 13px;
  background:
    linear-gradient(135deg, rgba(218, 175, 99, .26), transparent 12%, transparent 88%, rgba(218, 175, 99, .2)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.018) 0 2px, transparent 2px 5px),
    linear-gradient(135deg, #5a3018, #29140d 18%, #351a10 82%, #68411f);
  box-shadow: 0 0 0 4px #29150e, 0 24px 90px rgba(0,0,0,.72), inset 0 0 25px rgba(0,0,0,.72);
}
.open-spread::before {
  z-index: 7;
  top: clamp(25px, 3vw, 48px);
  bottom: 63px;
  width: 13px;
  background: linear-gradient(90deg, rgba(62,35,18,.72), rgba(238,217,175,.36), rgba(53,29,16,.78));
  box-shadow: -3px 0 5px rgba(0,0,0,.16), 3px 0 6px rgba(0,0,0,.18);
}
.open-spread::after { display: none; }
.site-book-view {
  grid-row: 1;
  height: auto;
  min-height: 0;
  overflow: hidden;
  border: 2px solid #bd9859;
  outline: 7px solid #e1d0a9;
  box-shadow: 0 0 0 10px #69431f, 0 0 0 12px rgba(29,15,9,.9), inset 0 0 18px rgba(0,0,0,.55);
  opacity: 1;
}
.book-page {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  isolation: isolate;
}
.book-page.is-active { display: block; z-index: 1; }
.book-page.is-leaving { display: block; z-index: 2; animation: spread-away .42s ease both; }
.book-page.is-entering { display: block; z-index: 1; animation: spread-arrive .5s ease both; }
.book-page .site-header { position: absolute; }
.book-page .hero {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  padding-top: 78px;
}
.book-page .hero-content { max-width: 54%; }
.book-page .hero h1 { font-size: clamp(48px, 7.2vw, 96px); }
.book-page .hero-copy { max-width: 420px; }
.book-page .hero-bottom { bottom: 16px; left: 6%; right: 6%; }
.book-page .hero::before { inset: 78px 2% 5%; }
.overview-page { background: #e9e4da; }
.overview-page .overview {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(35px, 5vw, 76px) clamp(50px, 8vw, 130px);
}
.overview-page .overview-heading { align-items: center; }
.overview-page .overview-heading h2 { font-size: clamp(42px, 5.2vw, 72px); }
.overview-page .overview-heading > p { font-size: clamp(13px, 1.3vw, 17px); }
.overview-page .overview-cards { margin-top: clamp(28px, 4vh, 48px); }
.overview-page .overview-cards article { min-height: clamp(135px, 20vh, 190px); padding: clamp(18px, 2vw, 30px); }
.overview-page .overview-cards h3 { font-size: clamp(18px, 1.8vw, 26px); }
.overview-page .overview-cards p { font-size: clamp(11px, 1vw, 14px); }
.page-quote {
  margin: clamp(22px, 4vh, 45px) 0 0;
  align-self: flex-end;
  color: #986b35;
  font: italic clamp(17px, 2vw, 25px) var(--serif);
}
.stream-page { background: #11181f; }
.stream-page .stream-section {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 4vw, 58px) clamp(42px, 7vw, 105px);
}
.stream-page .stream-heading { margin: 20px 0 20px; }
.stream-page .stream-heading h2 { font-size: clamp(40px, 5vw, 68px); }
.stream-page .stream-card { flex: 0 1 auto; min-height: 0; }
.stream-page .stream-player-wrap { min-height: 0; }
.stream-page .stream-player-wrap iframe { min-height: 0; height: 100%; }
.join-page { background: radial-gradient(ellipse at 50% 0%, rgba(169,76,55,.2), transparent 50%), #1a2229; }
.join-page .join-compact {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 22px;
  padding: 50px 10%;
  background: transparent;
  border: 0;
}
.join-page .join-compact > img { width: clamp(90px, 14vw, 170px); height: auto; }
.join-page .join-compact > div { flex: 0 0 auto; }
.join-page .join-compact > div > span { font-size: 10px; }
.join-page .join-compact h2 { font-size: clamp(44px, 6vw, 80px); margin: 9px 0; }
.join-page .join-compact p { font-size: clamp(13px, 1.3vw, 17px); }
.join-page footer {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 4%;
  min-height: 65px;
  padding: 10px 0;
  background: transparent;
  border-top: 1px solid rgba(224,184,110,.22);
}
.folio-controls {
  grid-row: 2;
  position: relative;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(8px, 2vw, 28px);
  color: #f0d39a;
  font: 10px 'DM Sans', Arial, sans-serif;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.folio-controls button {
  min-width: 130px;
  padding: 8px 12px;
  border: 1px solid rgba(224,184,110,.46);
  background: rgba(25,13,8,.38);
  color: #f0d39a;
  font: inherit;
  letter-spacing: .08em;
  cursor: pointer;
  transition: background .2s, color .2s, opacity .2s;
}
.folio-controls button:hover:not(:disabled) { background: #d0a75e; color: #17120d; }
.folio-controls button:disabled { opacity: .35; cursor: default; }
.page-leaf {
  display: none;
  position: absolute;
  z-index: 6;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 50%;
  transform-origin: left center;
  transform-style: preserve-3d;
  background: linear-gradient(90deg, #bca47c, #f1e5c8 8%, #e4d2aa 92%, #9a7a4e);
  box-shadow: -12px 0 18px rgba(0,0,0,.34), inset 1px 0 #fff4d5;
}
.page-leaf-front, .page-leaf-back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
}
.page-leaf-front {
  background: linear-gradient(90deg, #9b8057, #e8d6ae 7%, #eaddbc 88%, #a28353);
}
.page-leaf-back {
  transform: rotateY(180deg);
  background: linear-gradient(90deg, #a98c5d, #efe2c5 12%, #dfcca5 90%, #82633d);
  box-shadow: inset 0 0 25px rgba(59,37,18,.22);
}
.page-preview {
  position: absolute !important;
  top: 0 !important;
  left: -100% !important;
  width: 200% !important;
  height: 100% !important;
  display: block !important;
  z-index: 1 !important;
  opacity: 1 !important;
  overflow: hidden !important;
  transform: none !important;
  animation: none !important;
  pointer-events: none !important;
}
.page-preview.preview-left { left: 0 !important; }
.page-zone {
  position: absolute;
  z-index: 5;
  top: 10%;
  bottom: 10%;
  width: clamp(24px, 4vw, 52px);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background .2s;
}
.page-zone-prev { left: 0; }
.page-zone-next { right: 0; }
.page-zone-prev:hover { background: linear-gradient(90deg, rgba(224,184,110,.14), transparent); }
.page-zone-next:hover { background: linear-gradient(270deg, rgba(224,184,110,.14), transparent); }
.book-stage.is-flipping .page-zone { pointer-events: none; }
.book-stage.turning-prev .page-leaf {
  left: 0;
  transform-origin: right center;
  animation: turn-back .82s cubic-bezier(.55,.03,.28,1) both;
}
.book-stage.turning-next .page-leaf {
  left: 50%;
  transform-origin: left center;
  animation: turn-forward .82s cubic-bezier(.55,.03,.28,1) both;
}
.folio-controls button:focus-visible, .page-zone:focus-visible {
  outline: 2px solid #f2d18c;
  outline-offset: -3px;
}
.page-zone-prev::after, .page-zone-next::after {
  position: absolute;
  top: 50%;
  color: rgba(222,184,110,.0);
  font-size: 24px;
  transform: translateY(-50%);
  transition: color .2s;
}
.page-zone-prev::after { content: "‹"; left: 5px; }
.page-zone-next::after { content: "›"; right: 5px; }
.page-zone-prev:hover::after, .page-zone-next:hover::after { color: rgba(222,184,110,.82); }
@media (max-width:760px) {
  .page-zone { width: 28px; }
}
.book-stage.turning-next .page-leaf { display: block; animation: turn-forward .82s cubic-bezier(.55,.03,.28,1) both; }
.book-stage.turning-prev .page-leaf { display: block; left: 0; transform-origin: right center; animation: turn-back .82s cubic-bezier(.55,.03,.28,1) both; }
.book-stage.is-flipping .folio-controls { pointer-events: none; }
@keyframes turn-forward { from { transform: rotateY(0); } to { transform: rotateY(-180deg); } }
@keyframes turn-back { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }
@keyframes spread-away { to { opacity: .12; transform: translateX(-2%); } }
@keyframes spread-arrive { from { opacity: .12; transform: translateX(2%); } to { opacity: 1; transform: translateX(0); } }
@media(max-width:760px) {
  .story-portal.is-open .book-stage { width: 100vw; height: 100dvh; }
  .open-spread { padding: 12px 12px 8px; grid-template-rows: minmax(0, 1fr) 42px; gap: 4px; }
  .site-book-view { outline-width: 3px; box-shadow: 0 0 0 5px #69431f, inset 0 0 18px rgba(0,0,0,.55); }
  .open-spread::before { display: block; top: 12px; bottom: 54px; width: 6px; }
  .book-page .site-header { height: 58px; padding: 0 5%; }
  .book-page .brand img { width: 36px; height: 36px; }
  .book-page .brand-name { font-size: 8px; }
  .book-page .nav { display: none; }
  .book-page .hero { padding: 73px 7% 45px; }
  .book-page .hero-content { max-width: 100%; }
  .book-page .hero h1 { font-size: clamp(43px, 11vw, 66px); }
  .book-page .hero-emblem { display: none; }
  .overview-page .overview { padding: 35px 7%; }
  .overview-page .overview-heading { display: block; }
  .overview-page .overview-heading h2 { font-size: 39px; }
  .overview-page .overview-heading > p { margin-top: 14px; font-size: 12px; }
  .overview-page .overview-cards { grid-template-columns: 1fr; gap: 6px; margin-top: 14px; }
  .overview-page .overview-cards article { min-height: 0; padding: 9px 12px; }
  .overview-page .overview-cards h3 { margin: 5px 0 1px; font-size: 16px; }
  .overview-page .overview-cards p { font-size: 10px; }
  .page-quote { margin-top: 12px; font-size: 15px; }
  .stream-page .stream-section { padding: 24px 5%; }
  .stream-page .stream-heading { display: block; margin: 12px 0; }
  .stream-page .stream-heading h2 { font-size: 36px; }
  .stream-page .stream-heading > p { margin-top: 8px; font-size: 11px; }
  .stream-page .stream-card { grid-template-columns: 1fr; }
  .stream-page .stream-player-wrap { min-height: 0; aspect-ratio: 16/9; }
  .stream-page .stream-player-wrap iframe { display: none; }
  .stream-page .stream-mobile-note { display: grid; place-items: center; min-height: 100%; font-size: 11px; }
  .stream-page .stream-aside { min-height: 140px; padding: 10px 14px; }
  .stream-page .stream-aside h3 { font-size: 19px; margin: 5px 0; }
  .stream-page .stream-aside .button { margin-top: 0; }
  .join-page .join-compact { padding: 20px 8%; gap: 12px; }
  .join-page .join-compact > img { width: 74px; }
  .join-page .join-compact h2 { font-size: 37px; }
  .join-page .join-compact .button { margin-left: 0; }
  .join-page footer { display: flex; }
  .folio-controls { padding: 0; font-size: 8px; letter-spacing: .04em; }
  .folio-controls button { min-width: 0; padding: 7px 8px; font-size: 8px; }
}
@media(prefers-reduced-motion:reduce) {
  .book-page.is-leaving, .book-page.is-entering, .book-stage.turning-next .page-leaf, .book-stage.turning-prev .page-leaf { animation-duration: .01ms !important; }
}
