:root {
  color-scheme: dark;
  --gold: #d2ad67;
  --gold-light: #f1d9a0;
  --ink: #0b0d10;
  --panel: rgba(12, 16, 20, .96);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #07090c; }
body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: Georgia, 'Times New Roman', serif;
  color: #ead7ad;
}
.avendor-stage {
  position: relative;
  width: min(100vw, calc(100vh * var(--stage-ratio)));
  aspect-ratio: var(--stage-ratio);
  max-height: 100vh;
  overflow: hidden;
  background: #090b0e;
  box-shadow: 0 0 55px rgba(0,0,0,.7);
}
.avendor-stage > img.stage-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  pointer-events: none;
  image-rendering: pixelated;
}
.intro-cover-panel {
  position: absolute;
  left: 40.1%;
  top: 54.8%;
  width: 20.5%;
  height: 31.5%;
  display: grid;
  place-items: center;
  padding: 1.5%;
  background:
    linear-gradient(rgba(12,16,20,.97), rgba(6,9,12,.98));
  border: clamp(2px, .25vw, 4px) solid #8f6a34;
  outline: 1px solid #2c2114;
  box-shadow:
    inset 0 0 0 3px rgba(215,177,99,.14),
    inset 0 0 25px rgba(0,0,0,.72),
    0 7px 20px rgba(0,0,0,.45);
}
.intro-cover-panel::before,
.intro-cover-panel::after {
  content: '◆';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gold);
  text-shadow: 0 0 5px #000;
  font-size: clamp(10px, 1.15vw, 20px);
}
.intro-cover-panel::before { top: -0.85em; }
.intro-cover-panel::after { bottom: -0.85em; }
.title-menu-buttons {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: clamp(8px, 1vw, 16px);
}

.early-test-button {
  appearance: none;
  width: 84%;
  padding: clamp(10px, 1.1vw, 18px) clamp(12px, 1.6vw, 24px);
  border: 2px solid #9b7137;
  background: linear-gradient(#1e2a34, #101821);
  color: var(--gold-light);
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: clamp(14px, 2vw, 34px);
  letter-spacing: .025em;
  text-shadow: 1px 2px 0 #000;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(232,194,114,.08), 0 2px 0 #000;
}
.early-test-button:hover,
.early-test-button:focus-visible {
  border-color: #e0ba70;
  color: #fff0bf;
  box-shadow: inset 0 0 17px rgba(230,185,93,.14), 0 0 15px rgba(220,175,90,.22);
  outline: none;
}

.introduction-button {
  background: linear-gradient(#273542, #131d27);
  border-color: #ad8449;
}

.introduction-button:hover,
.introduction-button:focus-visible {
  border-color: #efd18c;
}

.test-ribbon {
  position: absolute;
  left: 50%;
  bottom: 2.1%;
  transform: translateX(-50%);
  padding: .4em .85em;
  font: 700 clamp(8px, .85vw, 15px)/1.2 ui-monospace, Consolas, monospace;
  color: #e7d3a5;
  background: rgba(5,8,11,.78);
  border: 1px solid rgba(211,173,99,.45);
  border-radius: 3px;
  opacity: .8;
}

/* Walk test */
.walk-stage { touch-action: none; }
.player {
  --facing: 1;
  position: absolute;
  width: 8.6%;
  aspect-ratio: 125 / 235;
  left: 42%;
  top: 70%;
  transform-origin: 50% 100%;
  transform: translate(-50%, -100%) scaleX(var(--facing));
  filter: drop-shadow(0 5px 3px rgba(0,0,0,.42));
  image-rendering: pixelated;
  z-index: 8;
  user-select: none;
  pointer-events: none;
}
.player.walking {
  animation: hero-step .25s steps(2,end) infinite;
}
.player.confused {
  animation: hero-confused 1.5s ease-in-out;
}
.confusion-mark {
  position: absolute;
  z-index: 9;
  transform: translate(-50%, -100%);
  color: #f3dc9d;
  font: 900 clamp(18px, 2vw, 36px)/1 Georgia, serif;
  text-shadow: 2px 2px 0 #111, 0 0 7px rgba(255,230,170,.6);
  opacity: 0;
  pointer-events: none;
}
.confusion-mark.show { animation: question-pop 1.45s ease-out; }
.walk-help {
  position: absolute;
  left: 2.4%;
  bottom: 9.4%;
  width: 45.5%;
  z-index: 12;
  color: #ead9b6;
  font: 700 clamp(8px, 1.05vw, 18px)/1.35 ui-monospace, Consolas, monospace;
  text-shadow: 1px 2px 0 #000;
  pointer-events: none;
}
.dev-badge {
  position: absolute;
  right: 1.4%;
  top: 6.8%;
  z-index: 12;
  padding: .35em .55em;
  border: 1px solid rgba(211,173,99,.5);
  background: rgba(7,10,13,.7);
  font: 700 clamp(7px, .72vw, 12px)/1 ui-monospace, Consolas, monospace;
  color: #d7bd87;
  letter-spacing: .06em;
  pointer-events: none;
}
@keyframes hero-step {
  0% { margin-top: 0; }
  50% { margin-top: -.38%; }
  100% { margin-top: 0; }
}
@keyframes hero-confused {
  0%,100% { rotate: 0deg; }
  18% { rotate: -3deg; }
  36% { rotate: 3deg; }
  54% { rotate: -2deg; }
  72% { rotate: 2deg; }
}
@keyframes question-pop {
  0% { opacity: 0; scale: .6; translate: 0 8px; }
  20%,68% { opacity: 1; scale: 1; translate: 0 0; }
  100% { opacity: 0; scale: .8; translate: 0 -10px; }
}
@media (prefers-reduced-motion: reduce) {
  .player.walking, .player.confused, .confusion-mark.show { animation: none; }
}


/* Prototype 0.2 - Scene 1 production treatment */
.title-stage {
  isolation: isolate;
}

.cinematic {
  position: absolute;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  background: #020407;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .65s ease, visibility 0s linear .65s;
}

.cinematic.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .65s ease;
}

.cinematic-scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: #020407;
}

.cinematic-pan,
.cinematic-zoom {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.cinematic-pan {
  z-index: 1;
}

.cinematic-zoom {
  transform-origin: 75% 18%;
}

.cinematic-art,
.cinematic-stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  user-select: none;
  pointer-events: none;
}

.cinematic-art {
  z-index: 1;
  object-fit: cover;
  image-rendering: pixelated;
  will-change: transform, opacity, filter;
  opacity: 0;
  transition: opacity .26s ease;
}

.cinematic-art.scene-visible {
  opacity: 1;
}

.cinematic-stars {
  z-index: 2;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.cinematic-stars.active {
  opacity: .78;
}

/*
 * Scene 2 final production layers.
 * The cave glow is camera-locked to the Barrens artwork while the gust canvas
 * remains screen-space, giving the landscape a sense of depth and moving air.
 */
.cinematic-barrens-fx {
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.cinematic-barrens-fx.active {
  opacity: 1;
}

.cinematic-barrens-fx.camera-barrens {
  animation: avendor-camera-barrens 12s ease-in-out forwards;
}

.cinematic-barrens-cave-glow {
  position: absolute;
  left: 31.6%;
  top: 62.5%;
  width: 8.8%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  opacity: .42;
  mix-blend-mode: screen;
  background:
    radial-gradient(circle,
      rgba(255,238,174,.82) 0 5%,
      rgba(255,181,77,.64) 8% 18%,
      rgba(238,112,35,.34) 28%,
      rgba(169,62,18,.14) 48%,
      transparent 72%
    );
  filter: blur(3.6px);
  animation: avendor-cave-flicker 1.92s steps(1,end) infinite;
}

.cinematic-barrens-cave-glow::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 25%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255,218,142,.72);
  box-shadow:
    0 0 7px rgba(255,206,115,.72),
    0 0 15px rgba(242,137,46,.42);
}

.cinematic-barrens-gusts {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  filter: blur(.22px);
  transition: opacity .45s ease;
}

.cinematic-barrens-gusts.active {
  opacity: .92;
}

/*
 * Scene 1 camera: two wrappers on purpose.
 * Zoom owns only scale. Pan owns only travel. They never overwrite each
 * other's transform, so later tuning remains predictable.
 */
.cinematic-pan.camera-moons-pan {
  animation: avendor-moons-pan 15s cubic-bezier(.28,.03,.22,1) forwards;
}

.cinematic-zoom.camera-moons-zoom {
  animation: avendor-moons-zoom 15s cubic-bezier(.18,.02,.2,1) forwards;
}

.cinematic-art.camera-barrens {
  animation: avendor-camera-barrens 12s ease-in-out forwards;
}

.cinematic-art.camera-bruntide {
  animation: avendor-camera-bruntide 12s ease-in-out forwards;
}

.cinematic-art.camera-numynor {
  animation: avendor-camera-numynor 12s cubic-bezier(.25,.05,.22,1) forwards;
}

.cinematic-art.camera-stouthome {
  animation: avendor-camera-stouthome 12s cubic-bezier(.2,.02,.18,1) forwards;
}

.cinematic-art.camera-theland {
  animation: avendor-camera-theland 12s cubic-bezier(.3,.04,.25,1) forwards;
}

.cinematic-wind,
.cinematic-snow,
.cinematic-transition-wind {
  position: absolute;
  inset: -8%;
  pointer-events: none;
}

.cinematic-wind {
  z-index: 3;
  opacity: .1;
  mix-blend-mode: screen;
  background:
    repeating-linear-gradient(
      168deg,
      transparent 0 46px,
      rgba(220,235,245,.075) 47px 49px,
      transparent 50px 104px
    );
  background-size: 220% 100%;
  animation: avendor-wind 3.4s linear infinite;
  transition: opacity .7s ease;
}

.cinematic-wind.whisper {
  opacity: .065;
  animation-duration: 4.8s;
}

.cinematic-wind.barrens {
  opacity: .3;
  animation-duration: 1.05s;
}

.cinematic-wind.bruntide {
  opacity: .21;
  animation-duration: 1.55s;
}

.cinematic-wind.numynor {
  opacity: .14;
  animation-duration: 1.9s;
}

.cinematic-wind.stouthome {
  opacity: .10;
  animation-duration: 2.7s;
}

.cinematic-wind.theland {
  opacity: .07;
  animation-duration: 4.2s;
}

.cinematic.wind-transitioning .cinematic-wind {
  opacity: .62;
  animation-duration: .62s;
}

.cinematic-snow {
  z-index: 4;
  opacity: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.88) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(255,255,255,.65) 0 1.4px, transparent 2px),
    radial-gradient(circle, rgba(255,255,255,.45) 0 .8px, transparent 1.3px);
  background-size: 71px 71px, 103px 103px, 47px 47px;
  background-position: 0 0, 31px 17px, 9px 29px;
  animation: avendor-snow-drift 2.4s linear infinite;
  transition: opacity .5s ease;
}

.cinematic-snow.light { opacity: .34; }
.cinematic-snow.heavy { opacity: .72; }

/* Independent meteor layer. The art can move beneath it without changing its path. */
.cinematic-meteor {
  position: absolute;
  z-index: 5;
  left: 59%;
  top: 20%;
  width: 15%;
  height: 2px;
  opacity: 0;
  pointer-events: none;
  transform-origin: left center;
  background: linear-gradient(
    90deg,
    rgba(255,249,225,.98) 0,
    rgba(190,215,255,.72) 12%,
    rgba(150,181,245,.28) 48%,
    transparent 100%
  );
  filter: drop-shadow(0 0 4px rgba(205,225,255,.9));
}

.cinematic-meteor::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: #fff6d9;
  box-shadow:
    0 0 5px #fff,
    0 0 11px rgba(177,205,255,.92);
}

.cinematic-meteor.run {
  animation: avendor-meteor 1.15s cubic-bezier(.19,.72,.32,1) forwards;
}

/* A fast veil of airborne ice hides the Scene 1 -> Barrens cut. */
.cinematic-transition-wind {
  --wind-wipe-start-x: 72%;
  --wind-wipe-start-y: -2%;
  --wind-wipe-mid-x: -8%;
  --wind-wipe-mid-y: 1%;
  --wind-wipe-end-x: -72%;
  --wind-wipe-end-y: 3%;
  --wind-wipe-rotate: 0deg;
  --wind-wipe-skew: -8deg;
  z-index: 6;
  opacity: 0;
  transform: translate3d(var(--wind-wipe-start-x), var(--wind-wipe-start-y), 0) rotate(var(--wind-wipe-rotate)) skewX(var(--wind-wipe-skew));
  mix-blend-mode: screen;
  background:
    repeating-linear-gradient(
      166deg,
      transparent 0 18px,
      rgba(235,246,255,.08) 19px 22px,
      rgba(219,236,250,.31) 23px 27px,
      transparent 28px 54px
    ),
    linear-gradient(
      90deg,
      transparent 0,
      rgba(190,215,232,.08) 22%,
      rgba(231,242,250,.38) 52%,
      rgba(188,215,235,.1) 78%,
      transparent 100%
    );
  filter: blur(.6px);
  will-change: transform, opacity;
}

.cinematic-transition-wind.run {
  animation: avendor-wind-wipe 2.34s cubic-bezier(.24,.02,.19,1) forwards;
}

.cinematic-subtitle-wrap {
  position: absolute;
  z-index: 50;
  left: 8%;
  right: 8%;
  bottom: 5.5%;
  display: flex;
  justify-content: center;
  transform: none !important;
  pointer-events: none;
}

.cinematic-subtitle {
  max-width: 80%;
  margin: 0;
  padding: .28em .7em .4em;
  text-align: center;
  color: #f0cb79;
  font-family: Georgia, "Palatino Linotype", "Book Antiqua", serif;
  font-size: clamp(17px, 2.05vw, 36px);
  font-style: italic;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .015em;
  text-shadow:
    0 2px 0 #000,
    0 0 5px #000,
    0 0 11px rgba(0,0,0,.9);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(3,5,7,.58) 14%,
    rgba(3,5,7,.58) 86%,
    transparent
  );
  opacity: 0;
  transform: translateY(7px);
  transform-origin: center bottom;
  transition: opacity .24s ease, transform .24s ease;
}

.cinematic-subtitle.show {
  opacity: 1;
  transform: translateY(0);
}

.cinematic-skip {
  position: absolute;
  z-index: 51;
  top: 2.2%;
  right: 2.2%;
  color: rgba(234,215,173,.74);
  font: 700 clamp(8px, .75vw, 13px)/1.2 ui-monospace, Consolas, monospace;
  text-shadow: 1px 1px 0 #000;
  opacity: .85;
  pointer-events: none;
}

.title-stage.cinematic-running > .stage-art,
.title-stage.cinematic-running > .intro-cover-panel,
.title-stage.cinematic-running > 
.introduction-button {
  background: linear-gradient(#273542, #131d27);
  border-color: #ad8449;
}

.introduction-button:hover,
.introduction-button:focus-visible {
  border-color: #efd18c;
}

.test-ribbon {
  visibility: hidden;
}

@keyframes avendor-moons-pan {
  0%   { transform: translate3d(0, 7vh, 0); }
  28%  { transform: translate3d(0, 4vh, 0); }
  58%  { transform: translate3d(0, -1.5vh, 0); }
  82%  { transform: translate3d(0, -5vh, 0); }
  100% { transform: translate3d(0, -8vh, 0); }
}

@keyframes avendor-moons-zoom {
  0%   { transform: scale(2.00); }
  28%  { transform: scale(1.72); }
  58%  { transform: scale(1.43); }
  82%  { transform: scale(1.27); }
  100% { transform: scale(1.18); }
}

@keyframes avendor-camera-barrens {
  0%   { transform: scale(1.08) translate3d(-7%, -1%, 0); }
  48%  { transform: scale(1.20) translate3d(0, 0, 0); }
  100% { transform: scale(1.38) translate3d(8%, -2%, 0); }
}

@keyframes avendor-camera-bruntide {
  0%   { transform: scale(1.14) translate3d(-8%, 2%, 0); }
  24%  { transform: scale(1.28) translate3d(-2%, 0, 0); }
  72%  { transform: scale(1.30) translate3d(2%, 0, 0); }
  100% { transform: scale(1.44) translate3d(9%, -2%, 0); }
}

@keyframes avendor-camera-numynor {
  0%   { transform: scale(1.10) translate3d(-6%, 1%, 0); }
  48%  { transform: scale(1.18) translate3d(-1%, 0, 0); }
  100% { transform: scale(1.28) translate3d(5%, -1%, 0); }
}

/* Stouthome starts close enough to read as mountain, then opens to reveal scale. */
@keyframes avendor-camera-stouthome {
  0%   { transform: scale(1.46) translate3d(-9%, 3%, 0); }
  38%  { transform: scale(1.34) translate3d(-5%, 2%, 0); }
  100% { transform: scale(1.08) translate3d(1%, 0, 0); }
}

@keyframes avendor-camera-theland {
  0%   { transform: scale(1.10) translate3d(-2%, -4%, 0); }
  55%  { transform: scale(1.17) translate3d(0, -1%, 0); }
  100% { transform: scale(1.27) translate3d(2%, 3%, 0); }
}

@keyframes avendor-cave-flicker {
  0%, 100% { opacity: .38; transform: translate(-50%, -50%) scale(.96); filter: blur(3.8px); }
  7%       { opacity: .54; transform: translate(-50%, -50%) scale(1.03); filter: blur(3.2px); }
  12%      { opacity: .31; transform: translate(-50%, -50%) scale(.92); filter: blur(4.2px); }
  18%      { opacity: .61; transform: translate(-50%, -50%) scale(1.07); filter: blur(3px); }
  31%      { opacity: .46; transform: translate(-50%, -50%) scale(.99); filter: blur(3.6px); }
  46%      { opacity: .67; transform: translate(-50%, -50%) scale(1.10); filter: blur(2.8px); }
  52%      { opacity: .36; transform: translate(-50%, -50%) scale(.95); filter: blur(4px); }
  68%      { opacity: .57; transform: translate(-50%, -50%) scale(1.05); filter: blur(3.2px); }
  83%      { opacity: .43; transform: translate(-50%, -50%) scale(.98); filter: blur(3.7px); }
  91%      { opacity: .62; transform: translate(-50%, -50%) scale(1.08); filter: blur(3px); }
}

@keyframes avendor-wind {
  from { background-position: 0 0; }
  to   { background-position: -115% 0; }
}

@keyframes avendor-snow-drift {
  from { background-position: 0 0, 31px 17px, 9px 29px; }
  to   { background-position: 90px 150px, 150px 210px, 70px 165px; }
}

@keyframes avendor-meteor {
  0% {
    opacity: 0;
    transform: translate3d(0, -10%, 0) rotate(-23deg) scaleX(.22);
  }
  13% { opacity: 1; }
  56% { opacity: .94; }
  100% {
    opacity: 0;
    transform: translate3d(-285%, 32vh, 0) rotate(-23deg) scaleX(1.22);
  }
}

@keyframes avendor-wind-wipe {
  0% {
    opacity: 0;
    transform: translate3d(var(--wind-wipe-start-x), var(--wind-wipe-start-y), 0) rotate(var(--wind-wipe-rotate)) skewX(var(--wind-wipe-skew));
  }
  35% { opacity: .24; }
  64% { opacity: .62; }
  79% {
    opacity: .94;
    transform: translate3d(var(--wind-wipe-mid-x), var(--wind-wipe-mid-y), 0) rotate(var(--wind-wipe-rotate)) skewX(var(--wind-wipe-skew));
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--wind-wipe-end-x), var(--wind-wipe-end-y), 0) rotate(var(--wind-wipe-rotate)) skewX(var(--wind-wipe-skew));
  }
}

@media (max-width: 720px) {
  .cinematic-subtitle-wrap {
    left: 3.5%;
    right: 3.5%;
    bottom: 4%;
  }

  .cinematic-subtitle {
    max-width: 94%;
    font-size: clamp(15px, 4vw, 26px);
  }

  .cinematic-skip {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cinematic-pan.camera-moons-pan,
  .cinematic-zoom.camera-moons-zoom,
  .cinematic-art.camera-barrens,
  .cinematic-barrens-fx.camera-barrens,
  .cinematic-barrens-cave-glow,
  .cinematic-art.camera-bruntide,
  .cinematic-art.camera-numynor,
  .cinematic-art.camera-stouthome,
  .cinematic-art.camera-theland,
  .cinematic-wind,
  .cinematic-snow,
  .cinematic-meteor.run,
  .cinematic-transition-wind.run {
    animation: none;
  }
}
