/* Apple product-page grammar: white stage, system type set large and tight, one tint, rounded tiles. */
:root {
  --bg: #f3e2c7; --tile: rgba(255, 251, 244, .62); --text: #1d1d1f; --text-2: #4a4750; --text-3: #6f6a72;
  --tint: #2a483b; --tint-hover: #35594a; --hair: rgba(0, 0, 0, .08);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --g: max(22px, calc((100vw - 980px) / 2));
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); font-size: 17px; line-height: 1.47; letter-spacing: -0.022em; background: transparent; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; letter-spacing: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--tint); outline-offset: 3px; border-radius: 6px; }
h1, h2 { font-weight: 600; letter-spacing: -0.015em; }

.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.sky-back, .sky-front { position: absolute; inset: -6% -4%; background-size: cover; background-position: center; will-change: transform; }
.sky-back { background-image: url('../sky.webp'); }
.sky-front { background-image: url('../sky-front.webp'); }
@media (max-width: 734px) { .sky-back { background-image: url('../sky-portrait.webp'); } .sky-front { background-position: 30% bottom; opacity: .9; } }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }

/* Global nav: 48px, translucent, small type */
.nav { position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: 48px; background: rgba(255, 251, 244, .55); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--hair); transform: translateY(-100%); }
.nav-in { height: 100%; max-width: 1024px; margin: 0 auto; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.logo img { width: 30px; height: auto; }
.links { display: flex; gap: 32px; font-size: 12px; color: var(--text); }
.links a { opacity: .8; transition: opacity .2s; }
.links a:hover { opacity: 1; }

.pill { display: inline-flex; align-items: center; justify-content: center; background: var(--tint); color: #fff; border-radius: 980px; padding: 12px 22px; font-size: 17px; font-weight: 400; transition: background .2s; }
.pill:hover { background: var(--tint-hover); }
.pill.small { padding: 4px 13px; font-size: 12px; }
.link { color: var(--tint); font-size: 17px; }
.link:hover { text-decoration: underline; }

/* Story beats: headline centred at the top of each pinned chapter, the 3D stage below it */
.story { position: relative; z-index: 2; pointer-events: none; }
.ch { position: relative; height: var(--h); }
.beat { position: sticky; top: 0; padding: 13vh var(--g) 0; text-align: center; pointer-events: none; }
.beat > * { pointer-events: auto; opacity: 0; transform: translateY(30px); }
.beat h1 { font-size: clamp(56px, 8vw, 96px); line-height: 1.04; }
.beat h1, .beat h2 { text-shadow: 0 1px 30px rgba(255, 246, 230, .9); }
.lede { text-shadow: 0 1px 18px rgba(255, 246, 230, .95); }
.beat .mark { width: clamp(120px, 12vw, 170px); height: auto; margin: 0 auto 18px; display: block; }
.beat .portrait { width: clamp(110px, 10vw, 156px); height: auto; aspect-ratio: 1; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto 16px; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .35); }
.beat-left { text-align: left; max-width: calc(44vw + var(--g)); padding-top: 22vh; }
.beat-left .lede { margin-left: 0; }
.lede.bio { font-size: clamp(18px, 1.5vw, 21px); max-width: 700px; color: var(--text); font-weight: 400; }
.beat h2 { font-size: clamp(40px, 5.6vw, 72px); line-height: 1.05; }
.lede { font-size: clamp(19px, 1.7vw, 24px); line-height: 1.38; color: var(--text-2); font-weight: 500; max-width: 640px; margin: 16px auto 0; letter-spacing: -0.01em; }
.lede .suit { color: var(--text); }
.cue { position: absolute; left: 0; right: 0; top: calc(100vh - 56px); text-align: center; font-size: 14px; color: var(--text-3); z-index: 2; }

.beat-game > .seg, .beat-game > .q, .beat-game > .count, .beat-game > .game-acts { margin-left: auto; margin-right: auto; }
.seg { display: inline-flex; margin-top: 26px; padding: 3px; background: var(--tile); border-radius: 10px; gap: 2px; }
.seg button { padding: 7px 18px; border-radius: 8px; font-size: 14px; color: var(--text); transition: background .25s var(--ease), box-shadow .25s var(--ease); }
.seg button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); font-weight: 500; }
.q { display: block; max-width: 460px; margin-top: 18px; }
.q input { width: 100%; height: 44px; border-radius: 12px; border: 1px solid #d2d2d7; background: rgba(255, 255, 255, .9); padding: 0 16px; font: inherit; font-size: 17px; color: var(--text); text-align: center; transition: border-color .2s, box-shadow .2s; }
.q input:focus { outline: none; border-color: var(--tint); box-shadow: 0 0 0 4px rgba(0, 113, 227, .15); }
.q input::placeholder { color: var(--text-3); }
.count { margin-top: 16px; font-size: 17px; color: var(--text-2); }
.game-acts { display: flex; justify-content: center; gap: 28px; margin-top: 6px; }

/* Result: its own section, tiles on light gray */
.result, .sitting, .foot { position: relative; z-index: 3; }
.result { background: var(--tile); backdrop-filter: blur(30px) saturate(140%); -webkit-backdrop-filter: blur(30px) saturate(140%); padding: 110px var(--g) 110px; }
.result-head { text-align: center; margin-bottom: 56px; }
.result-head h2 { font-size: clamp(44px, 5.6vw, 72px); line-height: 1.05; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.tile { background: rgba(255, 255, 255, .82); border-radius: 28px; padding: 36px 30px 38px; text-align: center; opacity: 0; transform: translateY(40px) scale(.98); }
.tile img { width: 62%; max-width: 220px; height: auto; aspect-ratio: 900 / 1560; margin: 0 auto 28px; display: block; border-radius: 10px; box-shadow: 0 24px 40px -22px rgba(0, 0, 0, .45); }
.tile .pos { font-size: 14px; color: var(--text-3); font-weight: 500; }
.tile h3 { font-size: 28px; font-weight: 600; letter-spacing: -0.015em; margin: 4px 0 8px; }
.tile .keys { font-size: 14px; color: var(--text-2); margin-bottom: 14px; }
.tile .meaning { font-size: 17px; color: var(--text); max-width: 30ch; margin: 0 auto; }
.together { margin-top: 20px; background: #1c2e27; color: #f5f5f7; border-radius: 28px; padding: 56px clamp(26px, 6vw, 80px); text-align: center; opacity: 0; transform: translateY(40px); }
.together-kicker { font-size: 17px; color: #86868b; font-weight: 500; }
.story-line { font-size: clamp(28px, 3.4vw, 44px); font-weight: 600; line-height: 1.12; letter-spacing: -0.015em; max-width: 22ch; margin: 10px auto 26px; }
.ai-reading { max-width: 620px; margin: 0 auto 28px; font-size: 19px; line-height: 1.55; color: #f5f5f7; white-space: pre-line; text-align: left; }
.ai-reading.loading { color: #a1a1a6; text-align: center; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }
.care { max-width: 720px; margin: 0 auto; text-align: center; background: rgba(255, 255, 255, .85); border-radius: 28px; padding: 48px clamp(22px, 5vw, 56px); }
.care h2 { font-size: clamp(30px, 3.6vw, 44px); line-height: 1.1; }
.care-lines { margin-top: 22px; font-size: 18px; line-height: 1.6; }
.care-lines a { color: var(--tint); text-decoration: underline; }
.notes { list-style: none; max-width: 640px; margin: 0 auto; display: grid; gap: 12px; color: #a1a1a6; font-size: 17px; }
.result-acts { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 18px 30px; margin-top: 44px; }

.sitting { background: #fff; padding: 130px var(--g); text-align: center; }
.sitting h2 { font-size: clamp(40px, 5.6vw, 72px); line-height: 1.05; }
.book-row { display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 34px; }
.book-note { font-size: 14px; color: var(--text-3); }

.foot { background: rgba(255, 251, 244, .7); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--hair); }
.foot-in { max-width: 980px; margin: 0 auto; padding: 22px 22px 30px; font-size: 12px; color: var(--text-2); display: grid; gap: 8px; }
.foot-name { color: var(--text); margin-top: 8px; }

/* Info buttons over drawn cards, and the popover they open */
.info-layer { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
.info-btn { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); color: var(--tint); font: 600 16px/30px Georgia, 'Times New Roman', serif; font-style: italic; text-align: center; pointer-events: auto; transition: transform .2s var(--ease); }
.info-btn:hover { transform: scale(1.12); }
.info-pop { position: fixed; z-index: 7; width: min(320px, calc(100vw - 32px)); background: rgba(255, 255, 255, .96); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 18px; box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .3); padding: 22px 22px 24px; opacity: 0; transform: translateY(8px) scale(.98); pointer-events: none; transition: opacity .25s var(--ease), transform .25s var(--ease); }
.info-pop.open { opacity: 1; transform: none; pointer-events: auto; }
.info-pop .pos { font-size: 13px; color: var(--text-3); font-weight: 500; }
.info-pop h3 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin: 2px 0 4px; }
.info-pop .keys { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.info-pop p:last-child { font-size: 15px; }
.info-x { position: absolute; top: 14px; right: 16px; font-size: 13px; color: var(--tint); }

/* Pendulum */
.pend { position: relative; z-index: 3; background: rgba(255, 251, 244, .5); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); padding: 120px var(--g) 110px; text-align: center; }
.pend h2 { font-size: clamp(40px, 5.6vw, 72px); line-height: 1.05; }
.pend-stage { display: grid; grid-template-columns: 1fr minmax(260px, 420px) 1fr; align-items: end; max-width: 900px; margin: 30px auto 0; }
#pendCanvas { width: 100%; height: 440px; display: block; }
.pend-label { width: 100%; max-width: 160px; justify-self: center; margin-bottom: 40px; border: 0; border-bottom: 1px solid #d2d2d7; background: transparent; font: 600 28px/1.2 var(--font); letter-spacing: -0.015em; color: var(--text-2); text-align: center; padding: 6px 0; transition: color .4s, border-color .4s; }
.pend-label:focus { outline: none; border-color: var(--tint); }
.pend-label.win { color: var(--tint); border-color: var(--tint); }
.pend-answer { min-height: 1.4em; font-size: clamp(22px, 2.4vw, 30px); font-weight: 600; letter-spacing: -0.015em; margin-top: 8px; }
.pend-row { margin-top: 18px; }

@media (max-width: 734px) {
  .beat-left { max-width: none; text-align: center; padding-top: 8vh; }
  .beat-left .lede { margin-left: auto; }
  .lede.bio { font-size: 15px; line-height: 1.4; }
  .pend-stage { grid-template-columns: 1fr 1fr; }
  #pendCanvas { grid-column: 1 / -1; grid-row: 1; height: 360px; }
  .pend-label { grid-row: 2; margin: 0; font-size: 22px; }
  .links { display: none; }
  .beat { padding-top: 10vh; }
  .beat h1 { font-size: 48px; }
  .beat h2 { font-size: 36px; }
  .lede { font-size: 18px; }
  .beat-game { padding-top: 64px; }
  .beat-game h2 { font-size: 30px; }
  .seg { margin-top: 12px; }
  .seg button { padding: 6px 12px; font-size: 13px; }
  .q { margin-top: 10px; }
  .q input { height: 40px; font-size: 16px; }
  .count { margin-top: 8px; font-size: 15px; }
  .result { padding: 80px 18px; }
  .tile { border-radius: 22px; }
  .together { border-radius: 22px; padding: 40px 22px; }
}
