:root {
  color-scheme: dark;
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color: #f7f2ec;
  background: #08080b;
  --header-height: 72px;
  --selector-height: 58px;
}

* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p { margin: 0; }
button { font: inherit; }

.header {
  position: relative;
  display: grid;
  place-items: center;
  height: var(--header-height);
  overflow: hidden;
  background: #08080b;
}

.header h1 {
  position: relative;
  padding-left: .64em;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: .64em;
  text-transform: uppercase;
}

.stars { position: absolute; inset: 0; pointer-events: none; }

.star {
  position: absolute;
  width: var(--size);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f2ede1;
  box-shadow: 0 0 5px #fbf4dc88;
  opacity: .45;
  animation: twinkle var(--period) ease-in-out var(--delay) infinite alternate;
}

@keyframes twinkle {
  from { opacity: .14; }
  to { opacity: .77; }
}

[data-character="red"] {
  --accent: #e03945;
  --scene-color: #2d121a;
  --scene-background: url("assets/layers/red-background.jpg");
  --portrait-x: 32%;
  --mobile-background-position: 29% center;
}

[data-character="orange"] {
  --accent: #f19344;
  --scene-color: #242735;
  --scene-background: url("assets/layers/orange-background.jpg");
  --portrait-x: 30%;
  --mobile-background-position: 25% center;
}

[data-character="green"] {
  --accent: #80bf8e;
  --scene-color: #142925;
  --scene-background: url("assets/layers/green-background.jpg");
  --portrait-x: 32%;
  --mobile-background-position: 31% center;
}

.selector {
  display: grid;
  grid-template-columns: auto minmax(9.75rem, max-content) auto;
  align-items: center;
  justify-content: center;
  gap: clamp(.65rem, 2vw, 1.75rem);
  height: var(--selector-height);
  position: relative;
  z-index: 1;
  background: #08080b;
  border-bottom: 1px solid #ffffff13;
}

.selector button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .85rem;
  min-height: 44px;
  min-width: 44px;
  padding: .35rem .45rem;
  color: #e4ddd6;
  background: transparent;
  border: 0;
  border-radius: .4rem;
  cursor: pointer;
  transition: background-color 140ms, color 140ms;
}

.selector button:hover { background: #ffffff13; color: #fff; }
.selector button:focus-visible { outline: 2px solid #f4e8d8; outline-offset: 1px; }

.selector kbd {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  font: inherit;
  font-size: .87rem;
  line-height: 1;
  border: 1px solid #ffffff65;
  border-radius: .3rem;
}

.chevron {
  width: .43rem;
  height: .43rem;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}

.chevron.previous { transform: rotate(-135deg); }

.selection {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .65rem;
  font-size: .87rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.dot {
  width: .65rem;
  aspect-ratio: 1;
  flex: none;
  border-radius: 50%;
  background-color: var(--accent);
  transition: background-color 180ms;
}

.stage {
  display: grid;
  isolation: isolate;
  overflow: clip;
  min-height: max(32rem, calc(100vh - var(--header-height) - var(--selector-height)));
  min-height: max(32rem, calc(100svh - var(--header-height) - var(--selector-height)));
}

.scene {
  position: relative;
  display: grid;
  grid-area: 1 / 1;
  grid-template-columns: minmax(0, 62fr) minmax(0, 38fr);
  min-width: 0;
  min-height: 100%;
  isolation: isolate;
  background: var(--scene-color);
}

.scene:not(.is-current):not(.is-leaving) { visibility: hidden; }
.scene.is-current { z-index: 1; }

.environment,
.art {
  position: absolute;
  z-index: -2;
  pointer-events: none;
}

.environment {
  inset: 0;
  background:
    linear-gradient(90deg, #08080b26, #08080b26 38%, #08080b92 66%, #08080bb8),
    var(--scene-background) var(--background-position, center) / cover no-repeat;
}

.art {
  z-index: -1;
  width: min(60%, 68rem);
  height: 98%;
  inset: auto auto var(--portrait-bottom, 0px) var(--portrait-x);
  transform: translateX(-50%);
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 8px 18px #08080b66);
}

.dossier {
  grid-column: 2;
  align-self: center;
  max-width: 35rem;
  padding: clamp(2rem, 6vh, 5rem) clamp(1.75rem, 5vw, 5.5rem) clamp(2rem, 6vh, 5rem) 0;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 16px #08080bbb;
}

.eyebrow {
  margin-bottom: 1rem;
  color: #e4d7ce;
  font-size: .875rem;
  font-weight: 500;
  letter-spacing: .42em;
  text-transform: uppercase;
}

.dossier h2 {
  font-size: clamp(2.5rem, 4.8vw, 5.3rem);
  font-weight: 600;
  line-height: 1.03;
  letter-spacing: -.045em;
}

.description {
  margin-top: clamp(1rem, 2.5vh, 1.9rem);
  max-width: 34ch;
  color: #f3ebe4;
  font-size: clamp(1rem, 1.52vw, 1.45rem);
  line-height: 1.55;
}

.traits {
  margin-top: clamp(1.3rem, 3.4vh, 2.5rem);
  padding-top: .85rem;
  border-top: 1px solid #ffffff51;
  color: #e4d7ce;
  font-size: .875rem;
  line-height: 1.55;
}

@media (max-width: 760px) {
  :root { --header-height: 56px; --selector-height: 54px; }
  .selector button { gap: .55rem; }
  .scene {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: min(100vw, 29rem) auto;
  }

  .environment {
    background:
      linear-gradient(#08080b24 4%, #08080b32 33%, #08080bcf 66%, #08080bf7),
      var(--scene-background) var(--mobile-background-position) / cover no-repeat;
  }

  .art {
    width: 100%;
    height: min(112vw, 33rem);
    inset: .75rem 0 auto;
    transform: none;
    mask-image: linear-gradient(#000 79%, transparent);
  }

  .dossier {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    width: 100%;
    padding: 1rem clamp(1.25rem, 6vw, 3rem) 2.5rem;
    background: linear-gradient(transparent, #08080b78);
  }

  .eyebrow { margin-bottom: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .star { animation: none; }
  .selector button, .dot { transition: none; }
}
