/* Golden Escape as a full-window book (public/js/golden-book.js). html.ge-book-on is set before first paint
   (src/pages/golden-escape-2025.js) and removed for the scrolling layout, so nothing here touches that one.
   Pages are paper (--cream with --ink text, like the flip book) in light and dark and in every colour story. */

/* ── the window: header, then one row (back, chapters, layout switch), then the book. Nothing scrolls. ── */
.ge-book-on { --footer-h: 0px; overflow: hidden; }
.ge-book-on body { height: 100dvh; min-height: 0; padding-bottom: 0; overflow: hidden; }
.ge-book-on .footer, .ge-book-on main > section.section, .ge-book-on .crumbs ol { display: none; }
.ge-book-on .nav__inner { transition: none; }
.ge-book-on main { min-height: 0; display: grid; grid-template: auto minmax(0, 1fr) / auto minmax(0, 1fr); padding-inline: clamp(8px, 1.4vw, 20px); }
.ge-book-on .crumbs { width: auto; margin: 0; padding-right: 8px; align-self: center; }
.ge-book-on .ge-chapters { position: relative; top: auto; grid-column: 2; padding-block: 8px; }
.ge-book-on .ge-chapters__bar { width: 100%; }
.ge-book-on main > .ge-hero { grid-column: 1 / -1; grid-row: 2; width: calc(100% - 136px); min-height: 0; margin: 8px auto 40px; } /* until the book opens */
.ge-book-on main > .ge-chapters { grid-row: 1; }
.dev-on.ge-book-on body:not(.adm) { padding-bottom: 72px; } /* the Dev Mode toolbar */
.dev-on.ge-book-on .dev-bar { bottom: 10px; }

.gb { grid-column: 1 / -1; grid-row: 2; min-height: 0; display: flex; flex-direction: column; }
.gb-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: clip; overflow-clip-margin: 20px; touch-action: pan-y pinch-zoom; outline: none; }

/* ── the book ── */
.gb-book { position: relative; perspective: 2600px; perspective-origin: 50% 40%; transition: transform .6s var(--ease-out); filter: drop-shadow(0 22px 26px rgba(20, 12, 4, .38)); }
.gb-view, .gb-over { position: absolute; inset: 0; }
.gb-over { pointer-events: none; transform-style: preserve-3d; z-index: 5; }
/* the closed pages under each side: they move from right to left as you read */
.gb-book::before, .gb-book::after { content: ''; position: absolute; top: 5px; bottom: 5px; z-index: -1; transition: width .6s var(--ease-out);
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--sand) 55%, var(--cream)) 0 1px, color-mix(in srgb, var(--ink) 26%, var(--cream)) 1px 2px); }
.gb-book::before { right: 100%; width: calc(var(--read, 0) * 9px); border-radius: 3px 0 0 3px; }
.gb-book::after { left: 100%; width: calc((1 - var(--read, 0)) * 9px); border-radius: 0 3px 3px 0; }

.gb-view { z-index: 0; }
.gb-spread { position: absolute; inset: 0; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.gb-spread[hidden] { display: none; }
.gb-spread:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
.gb-page {
  --text: var(--ink); --heading: var(--ink); --text-muted: color-mix(in srgb, var(--ink) 74%, var(--cream)); --link: var(--terracotta-strong);
  --glass-bg: color-mix(in srgb, var(--sand) 16%, var(--cream)); --glass-bg-hover: color-mix(in srgb, var(--sand) 34%, var(--cream));
  --glass-border: color-mix(in srgb, var(--ink) 16%, var(--cream)); --field-border: color-mix(in srgb, var(--ink) 20%, var(--cream));
  --tag-bg: color-mix(in srgb, var(--ochre) 20%, var(--cream)); --tag-text: var(--ink);
  --accent: var(--gold); --pad: clamp(16px, 3.2cqw, 46px);
  position: relative; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; container-type: inline-size; color: var(--text); color-scheme: light;
  background: radial-gradient(140% 100% at 60% 40%, var(--cream) 60%, color-mix(in srgb, var(--sand) 20%, var(--cream)) 100%);
}
/* the fold: shade along the spine (text stays clear of it: see the body's inner padding) */
.gb-page::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.gb-page:nth-child(odd)::after { background: linear-gradient(270deg, rgba(40, 24, 8, .34) 0, rgba(40, 24, 8, .12) 2.5%, rgba(40, 24, 8, .03) 5.5%, transparent 9%); }
.gb-page:nth-child(even)::after, .gb-page:only-child::after { background: linear-gradient(90deg, rgba(40, 24, 8, .34) 0, rgba(40, 24, 8, .12) 2.5%, rgba(40, 24, 8, .03) 5.5%, transparent 9%); }
.gb-page:nth-child(odd) { border-radius: 8px 0 0 8px; }
.gb-page:nth-child(even), .gb-page:only-child { border-radius: 0 8px 8px 0; }
.gb-page:only-child { border-radius: 3px 8px 8px 3px; }
.gb-run, .gb-folio { flex: none; margin: 0; padding: 12px clamp(16px, 3.2cqw, 46px) 6px; font: 600 .68rem/1.2 var(--font-body); letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted); }
.gb-folio { padding: 6px 34px 12px; font-variant-numeric: tabular-nums; }
.gb-page:nth-child(even) :is(.gb-run, .gb-folio) { text-align: right; }
.gb-page:only-child :is(.gb-run, .gb-folio) { text-align: center; }
.gb-page__body { flex: 1; min-height: 0; overflow: hidden; display: grid; align-content: safe center; container-type: size; padding: 8px clamp(16px, 5cqw, 46px); }
.gb-page:nth-child(odd):not(:only-child) .gb-page__body { padding-right: 9cqw; }
.gb-page:nth-child(even) .gb-page__body { padding-left: 9cqw; }
.gb-page.is-long .gb-page__body { overflow-y: auto; overscroll-behavior: contain; }
.gb-fit { min-width: 0; }

/* what the page shows sits straight on the paper: no glass, no entrance animations */
.gb :is(.glass, .reveal) { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
.gb-page :is(.panel, .ge-creator__body, .ge-mood, .ge-studio, .ge-way) { max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; }
.gb-page .ge-head { max-width: none; margin: 0; }
.gb-page :is(p, li) { text-wrap: pretty; }

/* ── pages ── */
.gb-page--concept .ge-intro__panel { max-width: 34em; margin-inline: auto; }
.gb-page--opener, .gb-page--blank { background: radial-gradient(130% 100% at 30% 20%, color-mix(in srgb, var(--sand) 26%, var(--cream)) 40%, color-mix(in srgb, var(--ochre) 46%, var(--cream)) 100%); }
.gb-page--opener .ge-head { max-width: 22em; margin-inline: auto; text-align: center; }
.gb-page--opener .ge-head h2 { font-size: clamp(2.3rem, 9cqw, 3.4rem); line-height: 1.04; }
.gb-page--opener .ge-head h2::after { content: ''; display: block; width: 90px; height: 2px; margin: .5em auto; background: linear-gradient(90deg, transparent, var(--terracotta-strong), transparent); }
.gb-page--opener .eyebrow { color: color-mix(in srgb, var(--ink) 84%, var(--cream)); }
.gb-page--opener .ge-head__note { color: var(--ink); }
.gb-page--toc .gb-fit { max-width: 480px; width: 100%; margin-inline: auto; }
.gb-toc h2 { margin: 0 0 .5em; font-size: 2.2rem; }
.gb-toc ol { margin: 0; padding: 0; list-style: none; }
.gb-toc a { display: flex; align-items: baseline; gap: .6em; min-height: 44px; padding: .55em 0; color: var(--text); text-decoration: none; font: 400 1.15rem/1.3 var(--font-display); }
.gb-toc a:hover { color: var(--link); }
.gb-toc i { flex: 1; border-bottom: 1px dotted currentColor; opacity: .5; }
.gb-toc b { font: 500 .95rem/1 var(--font-body); font-variant-numeric: tabular-nums; }

.gb-page--opener #fb-help { display: none; }

/* collages: as large as the page allows, keeping their own shape (--ratio) */
.gb-page--media .gb-fit { display: grid; justify-items: center; }
.gb-page--media { --chrome: 54px; }
.gb-page--media:has(.ge-mood) { --chrome: 118px; }
.gb-page--media:has(.ge-collection__media) { background: radial-gradient(140% 100% at 60% 40%, color-mix(in srgb, var(--accent) 22%, var(--cream)) 40%, color-mix(in srgb, var(--accent) 44%, var(--cream)) 100%); transition: background .6s ease; }
.gb-page--media :is(.ge-collection__media, .ge-mood) { position: static; padding: 0; border: 0; border-radius: 0; background: none; width: min(100cqw, calc((100cqh - var(--chrome)) * var(--ratio, 1))); }
.gb-page--media .ge-mood h3 { margin-bottom: .2em; }
.gb-page--media .ge-mood .eyebrow { display: block; }
.gb-page--story .ge-collection__text h3 { font-size: 2.3rem; }
.gb-page--story .ge-collection__text::before { content: ''; display: block; width: 64px; height: 4px; margin-bottom: 1.1em; background: var(--accent); transition: background .6s ease; }
.gb-page--story .gb-fit > .ge-palette { margin: 0; padding: 0; border: 0; }
.gb-page :is(.ge-collection__text, .ge-why, .ge-creator__body, .ge-palette) p:not(.eyebrow):not(.ge-hint) { font-family: var(--font-board); }
.gb-page--story .ge-swatch { grid-template-columns: 40px minmax(0, 1fr); column-gap: 10px; align-items: center; }
.gb-page--story .ge-swatch__chip { grid-row: 1 / 3; aspect-ratio: 1; }

.gb-page--looks { background: var(--texture) center / cover; }
.gb-spread .gb-page.gb-page--looks > .gb-page__body.gb-page__body { padding: 0; }
.gb-page--looks :is(.gb-run, .gb-folio) { color: var(--ink); background: color-mix(in srgb, var(--cream) 72%, transparent); }
.gb-page--looks .ge-fan { width: 100%; height: 100cqh; background: none; }
.gb-page--looks .ge-fan::after { content: none; }
.gb-page--looks .ge-fan__look { width: min(38cqw, 48cqh); transform: translateX(calc(var(--i) * 72%)) rotate(calc(var(--i) * 6deg)); }
.gb-page--looks .ge-fan:hover .ge-fan__look, .gb-page--looks .ge-fan:focus-within .ge-fan__look { transform: translateX(calc(var(--i) * 78%)) rotate(calc(var(--i) * 2deg)) translateY(-6px); }
.gb-page--looks .ge-fan .ge-fan__look:hover { z-index: 6; }
.gb-page--creator .ge-creator__body::before { content: ''; width: 64px; height: 5px; background: var(--frame); }
.gb-page--creator .ge-creator__body h3 { margin: 0; font: 400 2.4rem/1.1 var(--font-research); }

.gb-page--studio .gb-fit { height: 100%; }
.gb-page--studio .gb-page__body { align-content: stretch; }
.gb-page--studio .ge-studio { height: 100%; display: flex; flex-direction: column; }
.gb-page--studio .ge-stage { flex: 1 1 auto; min-height: 230px; aspect-ratio: auto; border-radius: 4px; }
.gb-page--studio .ge-stage__look { width: auto; height: 78%; bottom: 8%; }
.gb-page--studio figcaption { flex: none; padding: 14px 0 0; gap: 10px; }
.gb-page--kit .ge-kit { grid-template-columns: 1fr 1fr; gap: 0 26px; margin: 0; }
.gb-page--kit .ge-kit__item { padding: 12px 0; border: 0; border-top: 1px solid var(--glass-border); border-radius: 0; background: none; }
.gb-page--kit .ge-kit__item p { font-family: var(--font-research); }
.gb-page--text > .gb-page__body > .gb-fit > .ge-why p { font-family: var(--font-research); }
.gb-page--way h3 { text-align: center; font-size: 1.9rem; }
.gb-page--way .ge-way__chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; }
.gb-page--way .ge-way__chips li { width: min(27%, 20cqh); }

.gb-spread .gb-page.gb-page--plate > .gb-page__body.gb-page__body { padding-inline: 16px; }
.gb-page--plate .gb-fit { height: 100cqh; display: grid; place-items: center; }
.gb-page--plate .ge-plate { display: contents; }
.gb-page--plate img { width: auto; height: auto; max-width: 100cqw; max-height: 100cqh; border-radius: 2px; box-shadow: 0 8px 24px -10px rgba(30, 20, 10, .5); cursor: zoom-in; }

/* the cover: the whole book, closed */
.gb-spread--cover { grid-template-columns: minmax(0, 1fr); }
.gb-spread--cover .ge-hero { width: 100%; height: 100%; min-height: 0; margin: 0; display: flex; flex-direction: column; border-radius: 4px 12px 12px 4px; box-shadow: none; }
.gb-spread--cover .ge-hero__inner { width: 100%; margin: auto 0 0; padding: clamp(18px, 4vw, 56px); }
.gb-spread--cover .ge-hero::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 26px; background: linear-gradient(90deg, rgba(30, 18, 4, .42), rgba(30, 18, 4, .08) 55%, rgba(255, 244, 214, .34) 72%, rgba(30, 18, 4, .16) 80%, transparent); pointer-events: none; }
.gb-spread--cover.is-long .ge-hero { overflow-y: auto; }
.gb[data-at="cover"] .gb-book::before, .gb[data-at="end"] .gb-book::after { width: 0; }

/* ── the turning page ── */
.gb-under { position: absolute; inset: 0; }
.gb-under--left { clip-path: inset(0 50% 0 0); }
.gb-under--right { clip-path: inset(0 0 0 50%); }
.gb-leaf { position: absolute; top: 0; bottom: 0; left: 50%; width: 50%; transform-origin: 0 50%; transform-style: preserve-3d; will-change: transform; }
.gb-leaf--whole { left: 0; width: 100%; }
.gb-face { position: absolute; inset: 0; overflow: hidden; -webkit-backface-visibility: hidden; backface-visibility: hidden; background: var(--cream); }
.gb-face--back { transform: rotateY(180deg); }
.gb-face > .gb-spread { inset: 0 auto auto 0; width: 200%; height: 100%; }
.gb-face--front > .gb-spread { left: -100%; }
.gb-leaf--whole .gb-face > .gb-spread { left: 0; width: 100%; }
.gb-leaf--whole .gb-face--back { background: radial-gradient(140% 100% at 60% 40%, var(--cream) 60%, color-mix(in srgb, var(--sand) 30%, var(--cream)) 100%); }
.gb-shade { position: absolute; inset: 0; z-index: 9; opacity: 0; background: linear-gradient(90deg, rgba(30, 18, 6, .75), rgba(30, 18, 6, .15) 60%, rgba(30, 18, 6, .4)); }
.gb-cast { position: absolute; inset: 0; opacity: 0; background: radial-gradient(60% 120% at 50% 50%, rgba(20, 12, 4, .8), transparent 100%); }
.gb-over :is(*, *::before, *::after) { animation: none !important; transition: none !important; }
.gb.is-turning .gb-corner { visibility: hidden; }

/* ── controls ── */
.gb-arrow { position: absolute; top: 50%; z-index: 8; display: grid; place-items: center; width: 52px; height: 52px; margin-top: -26px; border-radius: 50%; border: 1px solid var(--glass-border); background: var(--nav-bg); color: var(--text); cursor: pointer;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow-glass); transition: background .2s, transform .2s, opacity .2s; }
.gb-arrow--prev { left: 0; }
.gb-arrow--next { right: 0; }
.gb-arrow svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gb-arrow:hover:not(:disabled) { background: var(--terracotta-strong); color: var(--cream); transform: scale(1.06); }
.gb-arrow:disabled { opacity: .35; cursor: default; }
.gb-arrow:focus-visible, .gb-stage:focus-visible .gb-book { outline: 3px solid var(--focus); outline-offset: 2px; }
/* corners that lift when pointed at: click, or drag the page over */
.gb-corner { position: absolute; z-index: 6; bottom: 0; width: 64px; height: 64px; padding: 0; border: 0; background: none; cursor: grab; touch-action: none; }
.gb-corner--next { right: 0; }
.gb-corner--prev { left: 0; }
.gb-corner:disabled { display: none; }
.gb-corner::after { content: ''; position: absolute; bottom: 0; width: 18px; height: 18px; transition: width .3s var(--ease-out), height .3s var(--ease-out); }
.gb-corner--next::after { right: 0; border-radius: 6px 0 8px 0; background: linear-gradient(135deg, color-mix(in srgb, var(--sand) 60%, var(--cream)) 0 42%, color-mix(in srgb, var(--ink) 30%, var(--sand)) 50%, transparent 51%); box-shadow: -3px -3px 8px -3px rgba(30, 18, 6, .4); }
.gb-corner--prev::after { left: 0; border-radius: 0 6px 0 8px; background: linear-gradient(225deg, color-mix(in srgb, var(--sand) 60%, var(--cream)) 0 42%, color-mix(in srgb, var(--ink) 30%, var(--sand)) 50%, transparent 51%); box-shadow: 3px -3px 8px -3px rgba(30, 18, 6, .4); }
.gb-corner:hover::after { width: 46px; height: 46px; }
.gb-foot { flex: none; display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 36px; padding: 6px 12px max(6px, env(safe-area-inset-bottom)); }
.gb-progress { width: min(220px, 34vw); height: 4px; border-radius: 2px; overflow: hidden; background: color-mix(in srgb, var(--text) 22%, transparent); }
.gb-progress span { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(var(--read, 0)); background: var(--terracotta); transition: transform .5s var(--ease-out); }
.gb-status { margin: 0; font: 600 .82rem/1.2 var(--font-body); font-variant-numeric: tabular-nums; color: var(--text); }

/* ── narrow windows: one page, with the arrows in the bottom bar ── */
@media (max-width: 960px) {
  .ge-book-on main > .ge-hero { width: calc(100% - 20px); }
  .ge-book-on .ge-hero__foot { gap: 16px; }
  .gb { position: relative; }
  .gb-foot { min-height: 60px; justify-content: center; }
  .gb-stage { position: static; }
  .gb-arrow { top: auto; bottom: max(6px, env(safe-area-inset-bottom)); width: 48px; height: 48px; margin: 0; }
  .gb-progress { width: 22vw; }
}
@media (max-width: 600px) {
  .ge-book-on .crumbs { padding-right: 6px; }
  .ge-book-on .crumbs__back { width: 42px; padding: 0; justify-content: center; gap: 0; font-size: 0; }
  .ge-book-on .ge-chapters__bar { gap: 6px; }
  .gb-page :is(.gb-run, .gb-folio) { padding-block: 8px 4px; }
  .gb-corner { display: none; }
}
@media (max-height: 520px) { .gb-run, .gb-folio { display: none; } .gb-page__body { padding-block: 10px; } }
/* pieces on a page of their own when the window is short */
.gb-page--story .gb-fit > p { font-family: var(--font-board); }
.gb-page--text .gb-fit > .ge-hint { margin-top: 1.4em; font-size: 1rem; }
/* phones in Dev Mode: the toolbar takes two rows */
@media (max-width: 600px) { .dev-on.ge-book-on body:not(.adm) { padding-bottom: 112px; } }
@media print { .ge-book-on, .ge-book-on body { height: auto; overflow: visible; } }
