/* The start page (index.html without a mode in the address): three stories over a dim night, each a looping clip of
   its own footage. The game's own elements stay hidden here, and this page stays hidden in the game. */
[data-page="game"] .home, [data-page="home"] :is(#c, .brand, .osd, .hint, .hud) { display: none !important; }
[data-page="home"] body { height: auto; min-height: 100%; overflow-x: hidden; overflow-y: auto; }

.home {
  --paper: #ece4d6;
  --muted: #a39b8d;
  --faint: rgba(236, 228, 214, .14);
  --amber: #e8b25a;
  --amber-soft: rgba(232, 178, 90, .32);
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --vhs: 'VT323', ui-monospace, Menlo, monospace;
  --pad-x: clamp(16px, 5vw, 112px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  position: relative; isolation: isolate; min-height: 100svh; box-sizing: border-box;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto auto; gap: clamp(20px, 4.5vh, 56px);
  padding: calc(clamp(24px, 6vh, 88px) + env(safe-area-inset-top, 0px)) var(--pad-x) calc(clamp(20px, 4.5vh, 56px) + env(safe-area-inset-bottom, 0px));
  color: var(--paper); font-family: var(--sans); -webkit-font-smoothing: antialiased;
}
.home[hidden] { display: none; }

/* the chosen story's still behind everything, blurred into ambient light and slowly drifting */
.home-bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: #07090c; }
.home-bg img { position: absolute; inset: -4%; width: 108%; height: 108%; object-fit: cover; opacity: 0;
  filter: blur(6px) saturate(.9) brightness(.62); transform: scale(1.06);
  transition: opacity 1.4s var(--ease); animation: drift 36s ease-in-out infinite alternate; }
.home-bg img.on { opacity: 1; }
.home-bg::after { content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 30% 35%, transparent 0, rgba(7, 9, 12, .55) 60%, rgba(7, 9, 12, .92) 100%),
    linear-gradient(to bottom, rgba(7, 9, 12, .35), transparent 30%, rgba(7, 9, 12, .82) 78%, #07090c); }
@keyframes drift { from { transform: scale(1.06) translate3d(-1%, 0, 0); } to { transform: scale(1.12) translate3d(1%, -1%, 0); } }

/* film grain over the whole page: a hint of tape, not a costume */
.home::after { content: ''; position: fixed; inset: -50%; z-index: 5; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .9s steps(6) infinite; }
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

.home-head { align-self: center; }
.home-eyebrow { margin: 0 0 .9em; font: 500 clamp(11px, .85vw, 15px)/1 var(--sans); letter-spacing: .42em; text-transform: uppercase; color: var(--amber); opacity: .85; }
.home-title { margin: 0; font: italic 300 clamp(60px, 8.4vw, 168px)/.9 var(--serif); letter-spacing: -.01em; color: var(--paper);
  text-shadow: 0 0 48px rgba(232, 178, 90, .18); }
.home-lede { margin: .7em 0 0; max-width: 32em; font: 400 clamp(16px, 1.35vw, 26px)/1.4 var(--sans); color: var(--muted); letter-spacing: .01em; text-wrap: balance; }

/* the three stories */
.stories { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 1.7vw, 36px); }
.story { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: clamp(6px, .5vw, 10px);
  background: #0c0e12; color: inherit; text-decoration: none; outline: none; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 0 1px var(--faint), 0 18px 40px -18px rgba(0, 0, 0, .8);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.story-poster, .story-clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  filter: brightness(.62) saturate(.85); transition: filter .6s var(--ease), transform 1.2s var(--ease), opacity .6s var(--ease); }
.story-clip { opacity: 0; pointer-events: none; }
.story.has-clip .story-clip { opacity: 1; }
.story::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(6, 7, 9, .9) 0, rgba(6, 7, 9, .45) 34%, transparent 62%); }
.story-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; display: grid; gap: .3em;
  padding: clamp(14px, 1.6vw, 30px) clamp(16px, 1.7vw, 32px); }
.story-title { font: 400 clamp(28px, 2.5vw, 50px)/1 var(--serif); letter-spacing: .005em; }
.story-line { font: 400 clamp(13px, .95vw, 18px)/1.35 var(--sans); color: rgba(236, 228, 214, .72); text-wrap: balance;
  transition: color .5s var(--ease); }
.story-osd { position: absolute; top: clamp(10px, 1vw, 20px); left: clamp(12px, 1.2vw, 24px); z-index: 1;
  font: clamp(18px, 1.4vw, 28px)/1 var(--vhs); letter-spacing: .06em; color: #e9eef0; text-shadow: 2px 2px 0 rgba(0, 0, 0, .55);
  opacity: 0; transition: opacity .4s; }
.story-osd::before { content: ''; display: inline-block; width: .5em; height: .5em; margin-right: .35em; background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%); }

.story.is-on { transform: translateY(-6px); box-shadow: 0 0 0 1px rgba(232, 178, 90, .55), 0 0 44px -6px var(--amber-soft), 0 28px 50px -20px rgba(0, 0, 0, .9); }
.story.is-on :is(.story-poster, .story-clip) { filter: brightness(1) saturate(1); transform: scale(1.035); }
.story.is-on .story-line { color: rgba(236, 228, 214, .92); }
.story.is-on.has-clip .story-osd { opacity: .85; }
.story:focus-visible { box-shadow: 0 0 0 3px var(--amber), 0 0 56px -4px var(--amber-soft), 0 28px 50px -20px rgba(0, 0, 0, .9); }

.home-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px; }
.story-any { display: inline-flex; align-items: center; gap: .65em; min-height: 48px; box-sizing: border-box;
  padding: .7em 1.4em; border-radius: 999px; border: 1px solid rgba(236, 228, 214, .22);
  font: 500 clamp(15px, 1.05vw, 20px)/1 var(--sans); letter-spacing: .02em; color: var(--paper); text-decoration: none;
  background: rgba(12, 14, 18, .45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); outline: none;
  transition: background .4s var(--ease), border-color .4s var(--ease), color .4s var(--ease), box-shadow .4s var(--ease); }
.story-any svg { width: 1.2em; height: 1.2em; color: var(--amber); transition: transform .6s var(--ease); }
.story-any.is-on { background: rgba(232, 178, 90, .14); border-color: rgba(232, 178, 90, .6); }
.story-any.is-on svg { transform: rotate(180deg); }
.story-any:focus-visible { box-shadow: 0 0 0 3px var(--amber), 0 0 40px -6px var(--amber-soft); }
.home-hint { margin: 0; font: 400 clamp(13px, .9vw, 17px)/1.4 var(--sans); letter-spacing: .04em; color: rgba(236, 228, 214, .5); }

/* the story itself: over everything, the start page asleep beneath */
.story-frame { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; z-index: 100; background: #07090c; color-scheme: dark; }

/* tall screens (portrait tablets, phones): the stories stacked as wide bands that share the height */
@media (orientation: portrait), (max-width: 720px) {
  .home { grid-template-rows: auto 1fr auto; }
  .home-head { align-self: end; padding-top: 2vh; }
  .stories { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(3, minmax(150px, 1fr)); }
  .story { aspect-ratio: auto; }
  .story.is-on { transform: none; }
  .story-title { font-size: clamp(30px, 5.4vw, 46px); }
  .story-line { font-size: clamp(14px, 2.1vw, 18px); }
  .story-osd { font-size: clamp(18px, 2.8vw, 26px); }
  .story-any { font-size: clamp(15px, 2.1vw, 19px); }
  .home-hint { font-size: clamp(13px, 1.8vw, 16px); }
}
@media (max-width: 480px) {
  .home-foot { justify-content: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .home-bg img, .home::after { animation: none; }
  .story, .story-poster, .story-clip, .story-any, .story-any svg { transition: none; }
  .story.is-on { transform: none; }
}
