/* Envisioned Games: page styles on top of the Haisham design system (tokens.css, components.css) */

/* ---------- The mark ---------- */
/* The body and lids take the text colour; the holes show the page through; the pupil is brand blue. */
.eg-mark { --px: 0px; --py: 0px; --ease-lid: cubic-bezier(.3, 1.4, .5, 1); display: inline-block; flex-shrink: 0; color: var(--fg); }
.eg-mark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.eg-body, .eg-lid, .eg-lower, .eg-lower-flat { fill: currentColor; }
.eg-pupil {
  fill: var(--brand);
  transform-box: fill-box; transform-origin: center;
  transform: translate(var(--px), var(--py)) scale(var(--ps, 1));
  transition: transform .45s var(--ease-soft);
}
.eg-lid   { transform: translate(51px, var(--lid-y, 21.5px)) rotate(var(--lid-r, 10deg)); transition: transform .35s var(--ease-lid); }
.eg-lower      { transform: translateY(var(--dome-y, 0px)); transition: transform .35s var(--ease-lid); }
.eg-lower-flat { transform: translateY(var(--flat-y, 0px)); transition: transform .35s var(--ease-lid); }

/* Moods: where the upper lid sits and how it tilts, where the two lower lids sit, and the pupil size */
.eg-mark[data-mood='angry']     { --lid-y: 21.5px; --lid-r: 10deg; }
.eg-mark[data-mood='neutral']   { --lid-y: 15px;   --lid-r: 0deg; }
.eg-mark[data-mood='focused']   { --lid-y: 24px;   --lid-r: 0deg;  --flat-y: -12px; }
.eg-mark[data-mood='sad']       { --lid-y: 21.5px; --lid-r: -12deg; }
.eg-mark[data-mood='surprised'] { --lid-y: 4px;    --lid-r: 0deg;  --ps: .72; }
.eg-mark[data-mood='happy']     { --lid-y: 9px;    --lid-r: 0deg;  --dome-y: -28px; --ps: 0; }
.eg-mark[data-mood='blink'],
.eg-mark.is-blinking            { --lid-y: 52px;   --lid-r: 0deg; }
.eg-mark.is-blinking .eg-lid    { transition-duration: .07s; transition-timing-function: ease-in; }

.eg-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--fg); }
.eg-brand .eg-mark { width: 34px; height: 34px; }
.eg-word { display: flex; flex-direction: column; line-height: 1; }
.eg-word b { font: 700 19px var(--font-display); letter-spacing: -0.03em; }
.eg-word small { margin-top: 5px; display: flex; align-items: center; gap: 6px; font: 500 9.5px var(--font-display); letter-spacing: 0.42em; text-transform: uppercase; color: var(--dim); }
.eg-word small::before { content: ''; width: 5px; height: 5px; background: var(--brand); }

.eg-nav { display: flex; align-items: center; gap: 8px; }

/* once the page scrolls, the header gets a glass backing so it never sits on top of headings */
.hd-header { transition: padding var(--t-base) ease, background-color var(--t-base) ease, border-color var(--t-base) ease; border-bottom: 1px solid transparent; }
.hd-header.is-scrolled {
  padding-block: 14px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom-color: var(--line);
}

/* ---------- Hero ---------- */
.eg-hero {
  position: relative;
  min-height: min(100svh, 980px);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: 48px;
  padding: 140px var(--pad) 72px;
  overflow: hidden;
}
.eg-hero::before {
  content: '';
  position: absolute;
  right: -10vw;
  top: 10%;
  width: 70vw;
  height: 70vw;
  max-width: 980px;
  max-height: 980px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 62%);
  pointer-events: none;
  z-index: -1;
}
.eg-hero .hd-hero { max-width: 11ch; margin-top: 28px; }
.eg-hero .hd-body { max-width: 520px; margin-top: 28px; }
.eg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 40px; }
.eg-hero-mark { justify-self: center; width: min(100%, 460px); color: var(--fg); }
.eg-hero-mark .eg-mark { width: 100%; aspect-ratio: 1; cursor: pointer; filter: drop-shadow(0 40px 80px rgba(48, 28, 233, 0.25)); }
.eg-hero-mark .eg-mood-hint { margin-top: 18px; text-align: center; }

/* 3D mascot (3d.html). #heroMark is only its spot in the hero; the mascot itself is drawn on a full-screen layer
   so it can leave the hero, peek, drive and flip as you scroll. */
.eg-hero-3d { width: min(100%, 560px); }
.eg-hero-mark .eg-mood-hint--top { margin: 0; position: relative; z-index: 42; }   /* above the mascot, clear of its shadow */
.eg-3d { position: relative; width: 100%; aspect-ratio: 1; }
/* the 2D mark shows until the 3D one has actually started (no WebGL, script blocked, offline: you still see a logo) */
.eg-3d .eg-3d-fallback { position: absolute; inset: 18%; width: auto; aspect-ratio: auto; }
.eg-3d.is-3d .eg-3d-fallback { display: none; }

/* ---------- Hero stage (3d.html) ----------
   Back to front: floor grid and glow → giant word → the 3D layer (mascot and props hide parts of the letters) → copy */
.eg-stage {
  position: relative;
  min-height: max(100svh, 640px);
  display: flex; flex-direction: column;
  padding: 104px var(--pad) 40px;
  overflow: hidden;                          /* no isolation: the shade and copy must stack above the fixed 3D layer */
}
/* the city is drawn by the 3D layer into this section's box; the shade keeps the header and the copy readable over it */
.eg-city { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
.eg-stage-shade {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;   /* over the city, under the mascot's layer */
  background:
    linear-gradient(to bottom, color-mix(in srgb, var(--bg) 70%, transparent) 0%, transparent 18%),
    linear-gradient(to top, var(--bg) 0%, color-mix(in srgb, var(--bg) 75%, transparent) 20%, transparent 44%),
    linear-gradient(to right, color-mix(in srgb, var(--bg) 70%, transparent) 0%, transparent 42%);   /* behind the copy column */
}

.eg-stage-center { position: relative; z-index: 42; flex: 1; display: grid; place-items: center; min-height: 0; pointer-events: none; }
/* the mascot sits on the desk, to the right of the monitor */
.eg-stage-center { justify-items: end; padding-right: 9vw; }
.eg-stage-center .eg-3d { width: clamp(180px, 17vw, 300px); margin-top: 10vh; }
.eg-stage-side .eg-stage-hint { position: static; translate: none; margin: 20px 0 0; text-align: left; white-space: normal; }
@media (max-width: 759px) { .eg-stage-center { justify-items: center; padding-right: 0; } }
.eg-stage-hint { position: absolute; bottom: 0; left: 50%; translate: -50% 0; margin: 0; white-space: nowrap; }

.eg-stage-copy {
  position: relative; z-index: 42;          /* above the 3D layer, so props never cover the copy */
  display: flex; flex-direction: column; align-items: flex-start; gap: 20px;   /* one column on the left; the right of the desk is the mascot's */
  max-width: min(520px, 46vw);
  padding-top: 32px;
}
.eg-stage-title {
  margin: 18px 0 0; max-width: 12ch;
  font: 700 clamp(38px, 4.6vw, 76px)/0.92 var(--font-display); letter-spacing: -0.045em;
}
@media (max-width: 759px) { .eg-stage-copy { max-width: none; } }
.eg-stage-title em { font-style: normal; color: var(--accent); }
.eg-stage-side { max-width: 420px; }
.eg-stage-side .hd-body { margin: 0; }
.eg-stage-side .eg-actions { margin-top: 24px; }
@media (max-width: 759px) {
  .eg-stage { padding-top: 92px; }
  .eg-stage-center { min-height: 320px; }
  .eg-stage-center .eg-3d { width: min(50vw, 220px); }
  .eg-stage-center { min-height: 420px; }
}

/* ---------- Homepage: title-screen hero ---------- */
.eg-title {
  position: relative; z-index: 42; margin: 0; pointer-events: none;
  font: 700 clamp(44px, 8.4vw, 150px)/0.86 var(--font-display); letter-spacing: -0.05em;
  text-shadow: 0 4px 48px color-mix(in srgb, var(--bg) 70%, transparent);
}
.eg-title em { font-style: normal; color: var(--accent); }
.eg-bar {
  position: relative; z-index: 42;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px;
  margin-top: clamp(20px, 3vw, 36px); padding-top: 18px; border-top: 1px solid var(--line-strong);
  font-size: 15px; color: var(--muted);
}
.eg-bar p { margin: 0; }
.eg-bar-mood b { color: var(--fg); font-weight: 500; }
@media (max-width: 759px) { .eg-bar-mood { display: none; } }

/* ---------- Homepage: one full-width world per game, in the game's own colours (same in both themes) ---------- */
.eg-world {
  position: relative; overflow: clip;
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: center;
  gap: clamp(32px, 6vw, 104px);
  padding: clamp(72px, 10vw, 150px) var(--pad);
  background: var(--world-bg); color: #f2f2f5;
}
.eg-world--mayhem { --pa: #f05a1a; --pa-text: #ff8a4a; --world-bg: #160b06; }
.eg-world--ascendex { --pa: #7b5cff; --pa-text: #b3a2ff; --world-bg: #0b0820; }
.eg-world--mayhem::before {          /* a hazard stripe, like the game's loading bar */
  content: ''; position: absolute; inset: 0 0 auto; height: 12px;
  background: repeating-linear-gradient(115deg, var(--pa) 0 16px, transparent 16px 32px);
}
.eg-world--ascendex::before {        /* the arena's violet light */
  content: ''; position: absolute; left: 50%; top: 50%; width: 90vw; aspect-ratio: 1; translate: -20% -50%;
  background: radial-gradient(closest-side, rgba(123, 92, 255, .22), transparent); pointer-events: none;
}
.eg-world.is-flipped .eg-world-shots { order: 2; }
.eg-world-shots { position: relative; padding-bottom: 10%; }
.eg-world-shots img { display: block; width: 100%; border-radius: 10px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .75); }
.eg-world-shots .main { rotate: -1.2deg; }
.eg-world-shots .inset { position: absolute; right: -3%; bottom: 0; width: 44%; rotate: 2.4deg; border: 5px solid var(--world-bg); }
.eg-world.is-flipped .main { rotate: 1.2deg; }
.eg-world.is-flipped .inset { right: auto; left: -3%; rotate: -2.4deg; }
.eg-world-info { position: relative; }
.eg-world-logo { display: block; width: min(380px, 85%); margin-bottom: 28px; }
.eg-world-info p { margin: 0; max-width: 40ch; font-size: 19px; line-height: 1.55; color: rgba(242, 242, 245, .84); text-wrap: pretty; }
.eg-world-facts { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 10px; font: 500 16px var(--font-display); }
.eg-world-facts li { display: flex; align-items: baseline; gap: 12px; }
.eg-world-facts li::before { content: ''; flex-shrink: 0; width: 8px; height: 8px; background: var(--pa); translate: 0 -1px; }
.eg-world-info .eg-world-status {
  display: inline-block; margin-top: 30px; padding: 7px 14px;
  border: 1px solid color-mix(in srgb, var(--pa) 65%, transparent); border-radius: var(--r-pill);
  font: 500 13px var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--pa-text);
}
@media (max-width: 899px) {
  .eg-world { grid-template-columns: 1fr; }
  .eg-world.is-flipped .eg-world-shots { order: 0; }
}

.eg-world-heading { margin: 0; }
.eg-world-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-top: 30px; }
.eg-world-info .eg-world-actions .eg-world-status { margin: 0; }
.eg-world-follow { font: 500 15px var(--font-display); color: #f2f2f5; text-decoration: underline; text-decoration-color: var(--pa); text-underline-offset: 5px; text-decoration-thickness: 2px; }
.eg-world-follow:hover { color: var(--pa-text); }

/* the 3D scene and the mascot fade in together once the island has loaded, so nothing pops in piece by piece */
.eg-city, .eg-layer { opacity: 0; transition: opacity .9s var(--ease-soft); }
.is-scene-ready .eg-city, .is-scene-ready .eg-layer { opacity: 1; }

/* ---------- Homepage: footer (wordmark only: on this page the mascot is the logo) ---------- */
.eg-footer { padding: 56px var(--pad) 32px; border-top: 1px solid var(--line); }
.eg-footer-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 28px 48px; }
.eg-footer .eg-word b { font-size: 28px; }
.eg-footer .eg-word small { font-size: 11px; margin-top: 8px; }
.eg-footer-nav { display: flex; flex-wrap: wrap; gap: 10px 28px; font: 500 16px var(--font-display); }
.eg-footer-nav a { color: var(--muted); transition: color var(--t-fast) ease; }
.eg-footer-nav a:hover { color: var(--fg); }
.eg-footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 48px; font-size: 14px; color: var(--dim); }
.eg-footer-bottom a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Homepage: Era Derby, featured, in the game's own brand (same in both themes) ----------
   Store-art look: dark stadium photo under a deep-teal gradient, Anton headlines in cream with the second line
   in orange, phones tilted. Fonts: Anton (headlines, uppercase), Saira Semi Condensed (labels), Inter (body). */
.ed-feature {
  --ed-teal: #083D40; --ed-orange: #E66637; --ed-orange-hi: #FF8A4C; --ed-cream: #FFF6E6;
  position: relative; overflow: clip;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center;
  gap: clamp(32px, 5vw, 88px);
  padding: clamp(80px, 10vw, 150px) var(--pad);
  color: var(--ed-cream);
  background:
    linear-gradient(100deg, rgba(4, 30, 32, .97) 0%, rgba(8, 61, 64, .9) 45%, rgba(8, 61, 64, .55) 100%),
    url('../assets/era-derby/stadium.jpg') center / cover;
}
.ed-kicker { margin: 0 0 22px; font: 700 15px 'Saira Semi Condensed', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--ed-orange-hi); }
.ed-name { display: flex; align-items: center; gap: 16px; margin: 0; font: 400 clamp(44px, 5.6vw, 84px)/1 'Anton', sans-serif; text-transform: uppercase; letter-spacing: .01em; }
.ed-name img { width: auto; height: 1.05em; }
.ed-tagline { margin: 22px 0 0; font: 400 clamp(30px, 3.6vw, 54px)/1.02 'Anton', sans-serif; text-transform: uppercase; }
.ed-tagline span { color: var(--ed-orange-hi); }
.ed-copy { margin: 26px 0 0; max-width: 44ch; font-size: 18px; line-height: 1.55; color: rgba(255, 246, 230, .86); }
.ed-points { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 10px; font: 600 17px 'Saira Semi Condensed', sans-serif; }
.ed-points li { display: flex; align-items: baseline; gap: 12px; }
.ed-points li::before { content: ''; flex-shrink: 0; width: 9px; height: 9px; border-radius: 2px; background: var(--ed-orange); translate: 0 -1px; }
.ed-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin-top: 34px; }
.ed-play {
  display: inline-flex; align-items: center; gap: 12px; padding: 10px 22px 10px 16px;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 10px; background: #000; color: #fff;
  font: 600 20px/1 'Inter', sans-serif; transition: border-color var(--t-fast) ease;
}
.ed-play span { display: flex; flex-direction: column; gap: 3px; }
.ed-play small { font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; opacity: .8; }
.ed-play:hover { border-color: #fff; }
.ed-more { font: 700 16px 'Saira Semi Condensed', sans-serif; color: var(--ed-cream); text-decoration: underline; text-decoration-color: var(--ed-orange); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.ed-more:hover { color: var(--ed-orange-hi); }
@media (max-width: 899px) {
  .ed-feature { grid-template-columns: 1fr; }
  .ed-feature .ed-stage { order: -1; max-width: 520px; width: 100%; margin: 0 auto; }
}

/* ---------- Homepage: studio ---------- */
.eg-about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px clamp(32px, 6vw, 104px); align-items: start; }
.eg-about .hd-lead { max-width: 14ch; }
.eg-about .hd-lead em { font-style: normal; color: var(--accent); }
.eg-about .hd-body { margin: 0 0 18px; max-width: 52ch; }
.eg-about .hd-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 899px) { .eg-about { grid-template-columns: 1fr; } }

.eg-layer { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 40; pointer-events: none; }
.eg-hit { position: fixed; left: 0; top: 0; z-index: 41; border-radius: 22%; cursor: grab; touch-action: pan-y; }
.eg-hit:active { cursor: grabbing; }
.eg-bubble {
  position: fixed; left: 0; top: 0; z-index: 45;
  padding: 10px 16px; border-radius: 18px 18px 18px 4px;
  font: 500 15px var(--font-display); letter-spacing: -0.01em; white-space: nowrap;
  color: var(--on-brand); background: var(--brand);
  box-shadow: 0 12px 30px -10px rgba(48, 28, 233, .6);
  opacity: 0; scale: .9; transform-origin: bottom left;
  transition: opacity .2s ease, scale .35s var(--ease-pop);
  pointer-events: none;
}
.eg-bubble.is-right { border-radius: 18px 18px 4px 18px; transform-origin: bottom right; }
.eg-bubble.is-on { opacity: 1; scale: 1; }
@media (max-width: 899px) { .eg-hero-mark.eg-hero-3d { order: -1; width: min(100%, 320px); justify-self: center; } }
.eg-hero-mark .eg-mood-hint b { color: var(--fg); font-weight: 500; }
@media (max-width: 899px) {
  .eg-hero { grid-template-columns: 1fr; min-height: 0; padding-top: 120px; }
  .eg-hero-mark { order: -1; width: 140px; justify-self: start; }
  .eg-hero .hd-hero { margin-top: 20px; }
}

/* ---------- Games ---------- */
.eg-games { display: grid; gap: clamp(48px, 6vw, 96px); }
.eg-game {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: center;
  padding: 12px;
  border-radius: var(--r-xl);
}
.eg-game.is-flipped { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
.eg-game.is-flipped .eg-shots { order: 2; }
@media (max-width: 899px) {
  .eg-game, .eg-game.is-flipped { grid-template-columns: 1fr; }
  .eg-game.is-flipped .eg-shots { order: 0; }
}

.eg-shots { position: relative; display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.eg-shots .hd-media { border-radius: var(--r-md); aspect-ratio: 16 / 9; }
.eg-shots .hd-media:first-child { grid-column: 1 / -1; }
.eg-shots .hd-media:not(:first-child) { aspect-ratio: 4 / 3; }
.eg-shots img { width: 100%; height: 100% !important; object-fit: cover; transition: transform var(--t-slow) cubic-bezier(0.2, 0.7, 0.2, 1); }
.eg-shots .hd-media:hover img { transform: scale(1.05); }
.eg-shots .eg-logo-tile {
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: var(--r-md);
  aspect-ratio: 4 / 3;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--pa) 32%, #0b0b10) 0%, #0b0b10 75%);
}
.eg-shots .eg-logo-tile img { width: 88%; height: auto !important; object-fit: contain; }
.eg-shots .eg-logo-tile:hover img { transform: none; }

.eg-info { padding: 12px clamp(8px, 2vw, 28px) 24px; }
.eg-info .hd-h3 { margin-top: 20px; }
.eg-info .hd-body { max-width: 46ch; }
.eg-info .hd-spec-row { margin-top: 32px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 24px; }
.eg-info .hd-value { font-size: 17px; }
.eg-badge { display: inline-flex; align-items: center; gap: 8px; }
.eg-info .eg-actions { margin-top: 32px; }

/* the play button takes the game's own accent */
.eg-play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--r-pill);
  font: 600 14px var(--font-body);
  color: #fff;
  background: var(--brand);
  transition: background-color var(--t-fast) ease;
}
.eg-play:hover { background: var(--brand-hover); }

/* ---------- Studio ---------- */
.eg-studio .hd-lead { max-width: 22ch; }
.eg-studio .hd-lead em { font-style: normal; color: var(--accent); }
.eg-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 32px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

/* ---------- Closing ---------- */
.eg-close { text-align: left; }
.eg-close .hd-h2 { max-width: 12ch; }
.eg-close .hd-body { margin-top: 24px; }
.eg-close .hd-cta-xl { margin-top: 40px; }
@media (max-width: 759px) { .eg-close .hd-h2 { white-space: normal; } }

/* ---------- Entrance ---------- */
.eg-reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.9s var(--ease-soft), transform 0.9s var(--ease-soft); }
.eg-reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .eg-reveal { opacity: 1; transform: none; } }
