/* More Power — flip book experience */

@font-face {
  font-family: 'Feature Deck';
  src: url('../fonts/FeatureDeck-Regular-Web.woff2') format('woff2');
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: 'Aeonik Pro';
  src: url('../fonts/aeonikpro-regular.otf') format('opentype');
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: 'Aeonik Pro';
  src: url('../fonts/aeonikpro-medium.otf') format('opentype');
  font-weight: 500;
  font-display: block;
}
@font-face {
  font-family: 'ABC Social Mono';
  src: url('../fonts/ABCSocialMono-Regular.otf') format('opentype');
  font-weight: 400;
  font-display: block;
}

:root {
  --orange: #F66F00;
  --yellow: #FCCC3C;
  --beige: #FFF7E9;
  --black: #111111;
  --brown: #4C2806;
  --ink: #FFF7E9;
  --ink-soft: rgb(255 247 233 / 0.75);
  --hairline: rgb(255 247 233 / 0.25);
  --accent: #FFF7E9;
  --ease-reveal: cubic-bezier(0.16, 1.08, 0.38, 0.98);
  --ease-hover: cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: 'Aeonik Pro', system-ui, sans-serif;
  letter-spacing: -0.02em;
  background-color: #F66F00;
  color: var(--ink);
  overflow: hidden;
}

/* the room: the orange motion gradient — the same mux grain clip as
   godaylight.com, played plain over flat #F66F00 (the low-power fallback) */
#motionBg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #F66F00;
}
#motionBg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* chrome */
#chrome-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 32px 0;
}

.logo { display: block; color: var(--ink); }
.logo svg { height: 21px; width: auto; display: block; }
.logo svg path { fill: currentColor; }

.top-right { display: flex; align-items: center; gap: 28px; }

.chrome-link {
  font-family: 'Aeonik Pro', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 150ms var(--ease-hover);
}
.chrome-link:hover { opacity: 0.6; }

/* stage */
#stage {
  position: relative;
  z-index: 10;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 76px 0 96px;
}

#bookWrap {
  position: relative;
  width: min(86vw, calc((100dvh - 280px) * 1.3333));
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1000ms var(--ease-reveal), transform 1000ms var(--ease-reveal);
}
body.reading #bookWrap { opacity: 1; transform: translateX(var(--book-shift, 0%)); }

/* layered cast shadow: one contact layer, two key layers, one wide ambient.
   It tracks the visible book — half-width when a lone cover parks on one side. */
#bookShadow {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: -1;
  border-radius: 2px;
  box-shadow:
    0 2px 6px rgb(17 17 17 / 0.16),
    0 12px 28px rgb(17 17 17 / 0.17),
    0 32px 72px rgb(17 17 17 / 0.2),
    0 64px 140px rgb(17 17 17 / 0.16);
  transition: left 1000ms var(--ease-reveal), right 1000ms var(--ease-reveal);
}
body.at-cover #bookShadow { left: 50%; }
body.at-back #bookShadow { right: 50%; }

#book { width: 100%; }

.page { overflow: hidden; }
.page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

#hint {
  margin-top: 26px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
  opacity: 0;
  transition: opacity 800ms var(--ease-reveal);
}
body.reading #hint.show { opacity: 1; }

/* chapter rail */
#chapters {
  position: fixed;
  bottom: 88px;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  column-gap: 32px;
  row-gap: 8px;
  padding: 0 32px;
  opacity: 0;
  transition: opacity 1000ms var(--ease-reveal);
}
body.reading #chapters { opacity: 1; }

.chapter {
  font-family: 'Aeonik Pro', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  opacity: 0.7;
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 150ms var(--ease-hover);
}
.chapter:hover { opacity: 1; }
.chapter.active { font-weight: 500; opacity: 1; }
.chapter .num { opacity: 0.7; margin-right: 7px; }

/* end actions */
#endRow {
  position: fixed;
  bottom: 132px;
  left: 0;
  right: 0;
  z-index: 21;
  display: flex;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 800ms var(--ease-reveal), visibility 0s 800ms;
}
#endRow.show { opacity: 1; visibility: visible; transition: opacity 800ms var(--ease-reveal); }

/* when the lone back cover parks on the right half, the closing actions
   take the empty left half at book height */
body.at-back #endRow.show {
  bottom: auto;
  right: 50%;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
  align-items: center;
}
body.at-back #endRow.show .btn { min-width: 200px; }

/* bottom footer — the book's own leader-line motif */
#chrome-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 0 32px 26px;
}

.mono {
  font-family: 'ABC Social Mono', 'SF Mono', monospace;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.35;
  color: var(--ink);
}
#chrome-bottom .mono { opacity: 0.78; }

#leader {
  position: relative;
  height: 3px;
  color: var(--ink);
}
#leader::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1.5px 1.5px, currentColor 1.2px, transparent 1.7px);
  background-size: 10px 3px;
  background-repeat: repeat-x;
  opacity: 0.32;
}
#leaderFill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0%;
  color: var(--accent);
  background-image: radial-gradient(circle at 1.5px 1.5px, currentColor 1.2px, transparent 1.7px);
  background-size: 10px 3px;
  background-repeat: repeat-x;
}

/* embedded on godaylight.com (?embed=1): the host page supplies the chrome,
   so the book's own logo, site link, and sound toggle stay out of the room */
body.embed #chrome-top { display: none; }
body.embed #endRow .btn-yellow { display: none; }
body.embed #chapters {
  top: 112px;
  bottom: auto;
}
body.embed #stage { padding: 132px 0 48px; }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 0 24px;
  border-radius: 4px;
  border: 1px solid rgb(255 247 233 / 0.25);
  font-family: 'Aeonik Pro', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgb(17 17 17 / 0.07);
  opacity: 0;
  transition: opacity 300ms var(--ease-reveal);
}
.btn:hover::after { opacity: 1; }

.btn-yellow { background: var(--yellow); color: #111111; }
.btn-beige { background: var(--beige); color: #111111; }

button:focus:not(:focus-visible), a:focus:not(:focus-visible) { outline: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--beige); outline-offset: 2px; }

@media (max-width: 760px) {
  #chrome-top { padding: 18px 20px 0; }
  .top-right { gap: 18px; }
  #chrome-bottom { padding: 0 20px 18px; grid-template-columns: auto 1fr auto; gap: 12px; }
  #chapters { bottom: 92px; column-gap: 18px; }
  .chapter .name { display: none; }
  .chapter.active .name { display: inline; }
  #stage { padding: 64px 0 110px; }
  #bookWrap { width: min(92vw, calc((100dvh - 260px) * 0.6667)); }
  body.embed #chapters {
    top: 84px;
    bottom: auto;
  }
  body.embed #stage { padding: 88px 0 40px; }
}
