/* The Flipbook — one card per flick, phone-first, letterboxed on desktop.
   Palette tokens come from the site's own design via applyPaletteVars. */

body.flipmode { background: #000; overflow: hidden; }
body.flipmode #chrome, body.flipmode #showBar, body.flipmode #demoBar,
body.flipmode #showPublish, body.flipmode #welcomeIntro { display: none !important; }

#flipDeck {
  position: fixed; inset: 0; margin: 0 auto;
  width: min(100vw, calc(100dvh * 9 / 16 + 2px));
  height: 100dvh;
  overflow-y: auto; overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  background: var(--bg, #101114);
  outline: none;
}
#flipDeck::-webkit-scrollbar { display: none; }

.fcard {
  position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .8rem; padding: 2rem 1.6rem; overflow: hidden;
  color: var(--ink, #eee); text-align: center;
}

/* header: who this is, before a single picture */
.fcard-head { gap: 1rem; }
.f-kicker {
  font-family: var(--font-mono, monospace); font-size: .68rem;
  letter-spacing: .34em; text-transform: uppercase; color: var(--accent, #f0532e);
}
.f-headline {
  font-family: var(--font-mono, monospace); font-size: .74rem; line-height: 1.7;
  letter-spacing: .14em; text-transform: uppercase; opacity: .75; max-width: 26ch;
}
.f-cover-name {
  position: relative; z-index: 1;
  font-family: var(--font-display, 'Archivo Black', sans-serif);
  font-size: clamp(1.5rem, 7cqw, 2.2rem); text-transform: uppercase;
}
.f-caption {
  position: relative; z-index: 1;
  font-family: var(--font-mono, monospace); font-size: .7rem;
  letter-spacing: .2em; text-transform: uppercase; opacity: .9;
  padding: .35rem .8rem; border-radius: 999px;
  background: color-mix(in srgb, var(--bg, #000) 65%, transparent);
  backdrop-filter: blur(6px);
}
.fcard-poster { justify-content: flex-end; padding-bottom: 3.4rem; }
.fcard-poster .f-caption { margin: 0 auto; }
.f-cred { font-family: var(--font-mono, monospace); font-size: .64rem; letter-spacing: .26em; text-transform: uppercase; opacity: .45; margin-top: 1.4rem; }

/* cover: name enormous over the lead image under a resolving scrim */
.fcard-cover img, .fcard-poster img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}
.fcard-cover::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 20%, color-mix(in srgb, var(--bg, #101114) 88%, transparent) 78%);
}
.fcard-cover > *:not(img) { position: relative; z-index: 1; }
.fcard-cover { justify-content: flex-end; padding-bottom: 4.5rem; }
.f-name {
  font-family: var(--font-display, 'Archivo Black', sans-serif);
  font-size: clamp(2.2rem, 11cqw, 3.4rem); line-height: .95;
  text-transform: uppercase; letter-spacing: -.01em;
}
.f-tag { font-family: var(--font-mono, monospace); font-size: .78rem; letter-spacing: .22em; text-transform: uppercase; opacity: .85; }
.f-hint {
  position: absolute; bottom: 1.1rem; left: 50%; transform: translateX(-50%);
  font-family: var(--font-mono, monospace); font-size: .64rem; letter-spacing: .3em;
  text-transform: uppercase; opacity: .6;
  animation: f-bob 1.8s ease-in-out infinite;
}
@keyframes f-bob { 50% { transform: translate(-50%, -6px); } }
@media (prefers-reduced-motion: reduce) { .f-hint { animation: none; } }

/* posters: full-bleed art, caption pill floating low when the title is known */

/* stats: one number per breath */
.fcard-stats { gap: 2rem; }
.f-stat b {
  display: block; font-family: var(--font-display, 'Archivo Black', sans-serif);
  font-size: clamp(2.6rem, 14cqw, 4rem); line-height: 1; color: var(--accent, #f0532e);
}
.f-stat span {
  font-family: var(--font-mono, monospace); font-size: .72rem;
  letter-spacing: .26em; text-transform: uppercase; opacity: .8;
}

/* tracks */
.fcard-track { gap: 1.1rem; }
.f-no { font-family: var(--font-mono, monospace); font-size: .8rem; color: var(--accent, #f0532e); letter-spacing: .2em; }
.fcard-track h2 {
  font-family: var(--font-display, serif); font-size: clamp(1.6rem, 8cqw, 2.4rem); line-height: 1.15;
}
.f-play {
  width: 3.4rem; height: 3.4rem; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--ink, #eee) 35%, transparent);
  background: none; color: var(--ink, #eee); font-size: 1.05rem; cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.f-play:hover { background: var(--accent, #f0532e); border-color: var(--accent, #f0532e); color: var(--bg, #000); transform: scale(1.06); }

/* outro */
.fcard-outro h2 { font-family: var(--font-display, serif); font-size: 1.6rem; }
.f-link {
  font-family: var(--font-mono, monospace); font-size: 1rem; color: var(--accent, #f0532e);
  text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: .15rem;
}
.f-mail { font-size: .85rem; opacity: .75; }

/* progress dots */
#flipDots {
  position: fixed; left: max(10px, calc(50vw - 100dvh * 9 / 32 - 22px)); top: 50%;
  transform: translateY(-50%); z-index: 5;
  display: flex; flex-direction: column; gap: 7px;
}
#flipDots i {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,.28); transition: background .2s, transform .2s;
}
#flipDots i.on { background: #fff; transform: scale(1.5); }











/* tessellated cards: a wall of 4 / 6 / 8 posters per flick */
.fcard-grid {
  display: grid; padding: 0; gap: 2px;
  background: var(--bg, #000);
  grid-auto-rows: 1fr;
}
.fcard-grid[data-n="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.fcard-grid[data-n="6"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
.fcard-grid[data-n="8"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr 1fr; }
.fcard-grid img {
  position: static; width: 100%; height: 100%;
  object-fit: cover; display: block; min-height: 0;
}

#flipClose {
  position: fixed; top: 14px; right: 14px; z-index: 8;
  padding: .5rem .9rem; border-radius: 999px; cursor: pointer;
  background: rgba(14,15,18,.82); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.14); color: #eceded; font-size: .78rem;
}
#flipClose:hover { border-color: rgba(255,255,255,.32); }

/* ————— the control bar: outside the reel, everything one tap away ————— */
#flipBar {
  position: fixed; z-index: 8;
  right: max(16px, calc(50vw - 100dvh * 9 / 32 - 196px));
  top: 50%; transform: translateY(-50%);
  width: 172px;
  display: flex; flex-direction: column; gap: 1.1rem;
  padding: 1rem; border-radius: 16px;
  background: rgba(14,15,18,.82); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.1);
}
.fb-group { display: flex; flex-direction: column; gap: .45rem; }
.fb-label {
  font-family: var(--font-mono, monospace); font-size: .6rem;
  letter-spacing: .3em; text-transform: uppercase; color: #8a8f99;
}
.fb-tabs { display: flex; flex-wrap: wrap; gap: .3rem; }
.fb-tab {
  padding: .32rem .55rem; border-radius: 7px; cursor: pointer;
  background: rgba(255,255,255,.05); border: 1px solid transparent;
  color: #b9bec7; font-family: var(--font-mono, monospace); font-size: .68rem;
  transition: color .12s, border-color .12s, background .12s;
}
.fb-tab:hover { color: #fff; border-color: rgba(255,255,255,.25); }
.fb-tab.on { background: #f0532e; border-color: #f0532e; color: #fff; }
.fb-act {
  padding: .5rem .7rem; border-radius: 9px; cursor: pointer;
  background: none; border: 1px solid rgba(255,255,255,.18);
  color: #eceded; font-size: .76rem;
}
.fb-act:hover { border-color: rgba(255,255,255,.4); }
.fb-edit { background: #f0532e; border-color: #f0532e; font-weight: 600; }
.fb-edit:hover { filter: brightness(1.08); }

/* narrow screens: the letterbox is gone, the bar lies along the bottom */
@media (max-width: 940px) {
  #flipBar {
    left: 50%; top: auto; bottom: 10px; transform: translateX(-50%);
    width: min(96vw, 560px);
    flex-direction: row; flex-wrap: wrap; align-items: flex-end;
    gap: .7rem 1rem; padding: .6rem .8rem;
  }
  .fb-group { gap: .3rem; }
  .fb-act { padding: .4rem .6rem; font-size: .7rem; }
}

/* ————— the deck's own preloader ————— */
#flipLoader {
  position: absolute; inset: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; background: var(--bg, #101114); color: var(--ink, #eee);
  transition: opacity .45s ease;
}
#flipLoader.out { opacity: 0; pointer-events: none; }
#flipLoader .fl-mp {
  font-family: 'Libre Franklin', sans-serif; font-weight: 800;
  font-size: 2.6rem; letter-spacing: -.03em; line-height: 1;
}
#flipLoader .fl-mp .wm-m { color: var(--ink, #eceded); }
#flipLoader .fl-mp .wm-dot { color: var(--ink, #eceded); }
#flipLoader .fl-pulse { display: inline-block; animation: fl-pulse 1.1s ease-in-out infinite; }
@keyframes fl-pulse { 50% { transform: translateY(-4px); opacity: .55; } }
#flipLoader span {
  font-family: var(--font-mono, monospace); font-size: .72rem;
  letter-spacing: .3em; text-transform: uppercase; opacity: .8;
}
@media (prefers-reduced-motion: reduce) { #flipLoader .fl-pulse { animation: none; } }

.fb-title {
  font-family: var(--font-brand, serif); font-weight: 400;
  font-size: 1.02rem; color: #eceded; margin-bottom: -.4rem;
}
.fb-sub { font-size: .68rem; line-height: 1.45; color: #8a8f99; }
.fb-hint { font-size: .62rem; color: #6d727c; margin-top: -.2rem; }
@media (max-width: 940px) {
  .fb-title, .fb-sub, .fb-hint { display: none; }   /* the phone bar stays lean */
}

/* the reel's identity cards carry the address */
.f-addr {
  font-family: var(--font-mono, monospace); font-size: .8rem;
  letter-spacing: .12em; color: var(--accent, #f0532e);
}

/* Arranging over the reel: the manager takes the WHOLE screen — a spinning
   deck bleeding through the edges made people dizzy */
body.flipmode #imgMgr { background: #0c0d0f; }
body.flipmode #imgMgr .im-card {
  width: min(1200px, 100vw); height: 100dvh; max-height: 100dvh;
  border-radius: 0;
}

/* the loader frames itself to the reel, not the screen */
#flipLoader { outline: 1px solid rgba(255,255,255,.07); outline-offset: -1px; }

/* phone: hide the controls to see the reel clean; a small handle recalls them */
#flipBarToggle { display: none; }
@media (max-width: 940px) {
  #flipBarToggle {
    display: block; position: fixed; right: 10px; bottom: 10px; z-index: 9;
    padding: .45rem .8rem; border-radius: 999px; cursor: pointer;
    background: rgba(14,15,18,.85); backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.16); color: #cfd3da;
    font-size: .72rem; font-family: var(--font-mono, monospace);
  }
  #flipBarToggle.alone { border-color: rgba(240,83,46,.55); color: #fff; }
  #flipBar.fb-off { display: none; }
  /* make room so the handle never sits on the bar */
  #flipBar { padding-right: 84px; }
}

/* the identity cards carry the mark — brand vermilion regardless of palette */
.f-brand {
  font-family: 'Libre Franklin', sans-serif; font-weight: 800;
  letter-spacing: -.03em; line-height: 1; font-size: 1.15rem;
  color: var(--ink, #eceded);
}
.f-brand .wm-p { color: #f0532e; }
.f-brand-mp { font-size: 1.6rem; margin-bottom: .4rem; }
.fcard-outro .f-brand { font-size: 1.35rem; margin-top: .1rem; }
.fcard-outro .f-cred { margin-top: 1.6rem; margin-bottom: .1rem; }
