@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap');

@font-face {
  font-family: 'Cinzel Decorative';
  src: url('/assets/4ffe39b37dd79888b731/fonts/CinzelDecorative-Bold.ttf') format('truetype');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --globe-ring: 41 151 182;
  --globe-glow: 75 198 219;
  --globe-highlight: 216 248 255;
  --globe-shadow: 0 10 25;
  color: #f7f1e5;
  background: #061120;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  isolation: isolate;
  width: 100%;
  min-width: 0;
  min-height: 100svh;
  margin: 0;
  overflow-x: clip;
  background:
    radial-gradient(circle at 75% 15%, rgb(32 89 126 / 28%), transparent 28rem),
    radial-gradient(
      ellipse max(24rem, 60vw) max(24rem, 85svh) at 0% 100%,
      rgb(51 117 111 / 20%),
      transparent
    ),
    #061120;
}

:root[data-faction='horde'] {
  --globe-ring: 182 57 41;
  --globe-glow: 230 77 53;
  --globe-highlight: 255 220 196;
  --globe-shadow: 30 3 5;
  background: #1c080b;
}

body::after {
  position: fixed;
  z-index: -2;
  inset: 0;
  content: '';
  pointer-events: none;
  background:
    radial-gradient(circle at 75% 15%, rgb(155 45 31 / 30%), transparent 28rem),
    radial-gradient(
      ellipse max(24rem, 60vw) max(24rem, 85svh) at 0% 100%,
      rgb(132 48 34 / 23%),
      transparent
    ),
    #1c080b;
  opacity: 0;
  transition: opacity 650ms ease;
}

[data-faction='horde'] body::after {
  opacity: 1;
}

.faction-toggle {
  position: fixed;
  z-index: 5;
  top: max(10px, env(safe-area-inset-top, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  width: 76px;
  height: 44px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.faction-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 34px;
  border: 1px solid rgb(219 192 139 / 32%);
  border-radius: 20px;
  background: #111824;
  box-shadow: inset 0 1px 4px rgb(0 0 0 / 45%);
  transition: background 650ms ease;
}

.faction-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 32px;
  height: 28px;
  border: 1px solid rgb(227 189 114 / 50%);
  border-radius: 16px;
  background: #294f7a;
  box-shadow: 0 1px 4px rgb(0 0 0 / 45%);
  transition:
    transform 300ms ease,
    background 650ms ease;
}

.faction-icon {
  position: relative;
  width: 20px;
  height: 23px;
  object-fit: cover;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0.5;
  filter: grayscale(1);
  transition:
    opacity 650ms ease,
    filter 650ms ease;
}

.faction-alliance,
[data-faction='horde'] .faction-horde {
  opacity: 1;
  filter: grayscale(0);
}

[data-faction='horde'] .faction-alliance {
  opacity: 0.5;
  filter: grayscale(1);
}

[data-faction='horde'] .faction-track {
  background: #271214;
}

[data-faction='horde'] .faction-thumb {
  transform: translateX(38px);
  background: #8a2b2b;
}

.faction-toggle:focus-visible {
  outline: 2px solid #efc572;
  outline-offset: 3px;
  border-radius: 22px;
}

@media (prefers-reduced-motion: reduce) {
  body::after,
  .faction-track,
  .faction-thumb,
  .faction-icon,
  .globe,
  .orbit-two {
    transition: none !important;
  }
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  opacity: 0.5;
  background-image: radial-gradient(rgb(235 222 185 / 35%) 0.7px, transparent 0.7px);
  background-size: 9px 9px;
  content: '';
  mask-image: linear-gradient(to bottom, black, transparent 60%);
}

.landing-shell {
  --page-inset: clamp(1rem, 2svh, 2rem);
  width: 100%;
  min-height: 100svh;
  display: grid;
  align-items: center;
  overflow-x: clip;
}

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding-top: calc(var(--page-inset) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--page-inset) + env(safe-area-inset-bottom, 0px));
}

.hero-copy {
  width: min(38vw, 500px);
  margin-left: max(1.5rem, calc((100vw - 1480px) / 2), env(safe-area-inset-left, 0px));
  min-width: 0;
  position: relative;
  z-index: 2;
}

.globe-space {
  position: absolute;
  inset: 0;
  /* Rotated decorative orbits must not extend the document's scrollable bounds. */
  overflow: clip;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 1rem;
  color: #f3bc68;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  text-wrap: balance;
}

h1,
h2 {
  margin: 0;
  color: #fff8eb;
  font-family: Fraunces, Georgia, serif;
  line-height: 0.95;
}

h1 {
  max-width: 10ch;
  font-size: clamp(3.5rem, 7vw, 6rem);
  letter-spacing: -0.075em;
}

.hero-answer {
  margin: 1.8rem 0 2.25rem;
  color: #efbd60;
  font-family: 'Cinzel Decorative', Georgia, serif;
  font-size: clamp(3rem, 5vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  text-shadow:
    0 1px 0 #ffdfa0,
    0 3px 0 #704218,
    0 5px 12px rgb(0 0 0 / 60%);
}

.globe-stage {
  position: absolute;
  display: grid;
  /* Preserve the original desktop centre (78vw), without a fixed pixel cap. */
  left: 78%;
  top: 50%;
  width: min(60vw, 100svh);
  transform: translate(-50%, -50%);
  aspect-ratio: 1;
  place-items: center;
  pointer-events: auto;
}

.globe-stage::before {
  position: absolute;
  width: 84%;
  height: 18%;
  border-radius: 50%;
  background: rgb(0 0 0 / 55%);
  filter: blur(24px);
  content: '';
  transform: translateY(215%);
}

.globe {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 1;
  overflow: visible;
  border: 1px solid rgb(237 216 163 / 30%);
  border-radius: 50%;
  background-color: transparent;
  background-position: center;
  background-size: 100% 100%;
  box-shadow:
    -22px 16px 42px rgb(0 0 0 / 42%),
    inset -28px -17px 34px rgb(var(--globe-shadow) / 49%),
    inset 15px 14px 25px rgb(var(--globe-highlight) / 18%),
    0 0 0 10px rgb(var(--globe-ring) / 5%),
    0 0 70px rgb(var(--globe-glow) / 20%);
  transition: box-shadow 650ms ease;
  animation: none;
}

.globe-shine {
  position: absolute;
  top: -6%;
  left: 6%;
  width: 42%;
  height: 50%;
  border-radius: 50%;
  border-top: 2px solid rgb(255 255 255 / 27%);
  filter: blur(0.5px);
  transform: rotate(-35deg);
}

.orbit {
  position: absolute;
  width: 103%;
  height: 36%;
  border: 1px solid rgb(244 199 117 / 34%);
  border-radius: 50%;
  transform: rotate(-21deg);
}

.orbit-one {
  animation: orbit-breathe 7s ease-in-out infinite;
}

.orbit-two {
  width: 91%;
  height: 68%;
  border-color: rgb(var(--globe-glow) / 23%);
  transition: border-color 650ms ease;
  transform: rotate(54deg);
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  letter-spacing: -0.05em;
}

@keyframes globe-drift {
  from {
    transform: translate3d(-1%, 0, 0) rotate(-2deg);
  }

  to {
    transform: translate3d(1%, -1%, 0) rotate(2deg);
  }
}

@keyframes orbit-breathe {
  50% {
    opacity: 0.45;
    transform: rotate(-21deg) scale(1.035);
  }
}

/* Portrait layouts give the globe all the space left below the live content. */
@media (max-aspect-ratio: 1/1) {
  .hero {
    padding-top: calc(60px + env(safe-area-inset-top, 0px));
    --portrait-inset: max(
      clamp(0.5rem, 3vw, 2rem),
      env(safe-area-inset-left, 0px),
      env(safe-area-inset-right, 0px)
    );
    height: 100svh;
    min-height: 0;
    padding-inline: var(--portrait-inset);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: clamp(0.75rem, 2svh, 1.5rem);
  }
  .hero-copy {
    width: 100%;
    margin: 0;
    text-align: center;
  }
  h1 {
    max-width: none;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
  }
  .hero-answer {
    margin: 0.6rem 0;
    font-size: clamp(2rem, 8vw, 3.5rem);
  }
  .globe-space {
    position: relative;
    min-height: 0;
    width: 100%;
    height: 100%;
    container-type: size;
  }
  .globe-stage {
    left: 50%;
    width: min(100cqw, 100cqh);
  }
  .hero .status-override {
    margin: 1rem auto;
  }
  .countdown-leaves {
    margin-inline: auto;
  }
  .hero .vote-controls {
    margin-top: 0.75rem;
  }
  .vote-arrows {
    justify-content: center;
  }
  #vote-feedback,
  #vote-mode-note {
    margin-inline: auto;
  }
}

@media (max-width: 760px) and (max-aspect-ratio: 1/1) {
  .hero {
    gap: clamp(1.5rem, 4svh, 2.5rem);
    min-height: min-content;
    grid-template-rows: auto minmax(min(75vw, 16rem), 1fr);
    /* Clip at the screen edge, not where the globe's glow meets the controls. */
    overflow: clip;
  }
  .globe-space {
    width: 100vw;
    margin-left: calc(-1 * var(--portrait-inset));
    overflow: visible;
  }
  .globe-stage {
    /* Fit the remaining height, allowing up to 10% of the globe beyond each side. */
    width: min(125vw, 100cqh);
    top: auto;
    bottom: 0;
    transform: translateX(-50%);
  }
}

/* Keep controls readable while freeing space on small phones and landscape screens. */
@media (max-height: 700px) {
  .hero h1 {
    font-size: clamp(1.75rem, 7svh, 3rem);
    max-width: none;
  }
  .hero-answer {
    font-size: clamp(1.5rem, 7svh, 3rem);
    margin: 0.5rem 0;
  }
  .hero .status-override {
    margin-block: 0.75rem;
  }
  .hero .countdown-leaves {
    --leaf-type: clamp(1.5rem, 5svh, 2rem);
  }
  .hero .countdown-label {
    margin-top: 0.55rem;
  }
  .hero #override-message {
    margin-top: 0.5rem;
    font-size: 1rem;
  }
  .hero .vote-controls {
    margin-top: 0.5rem;
  }
  .hero .vote-prompt {
    margin-bottom: 0.4rem;
  }
  .hero .vote-arrow {
    min-height: 3rem;
    padding: 0.35rem 0.75rem;
    gap: 0.2rem;
  }
  .hero .vote-arrow svg {
    width: 1.5rem;
    height: 1.5rem;
  }
  .hero #vote-feedback,
  .hero #vote-mode-note {
    margin-top: 0.5rem;
    margin-bottom: 0;
  }
}

@media (min-aspect-ratio: 1/1) and (max-height: 800px) {
  .hero:has(#vote-challenge:not([hidden])) h1 {
    max-width: none;
    font-size: clamp(1.75rem, 7svh, 3rem);
  }
  .hero:has(#vote-challenge:not([hidden])) .hero-answer {
    font-size: clamp(1.5rem, 7svh, 3rem);
    margin-block: 0.5rem;
  }
}

@media (min-aspect-ratio: 1/1) and (max-height: 500px) {
  .hero:has(#vote-challenge:not([hidden])) .hero-copy {
    width: max(300px, 45vw);
  }
  .hero:has(#vote-challenge:not([hidden])) .globe-space {
    left: calc(max(300px, 45vw) + max(1.5rem, env(safe-area-inset-left, 0px)) + 1.5rem);
  }
  .hero:has(#vote-challenge:not([hidden])) .globe-stage {
    left: 50%;
    width: min(100%, calc(100svh - 2 * var(--page-inset)));
  }
  .hero:has(#vote-challenge:not([hidden])) .status-override {
    margin-block: 0.5rem;
  }
  .hero:has(#vote-challenge:not([hidden])) .vote-controls {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 0.5rem;
  }
  .hero:has(#vote-challenge:not([hidden])) .vote-prompt {
    margin: 0;
  }
  .hero:has(#vote-challenge:not([hidden])) .vote-arrows {
    justify-content: end;
  }
  #vote-challenge,
  #vote-feedback,
  #vote-mode-note {
    grid-column: 1 / -1;
  }
}

@media (max-height: 360px) {
  .landing-shell {
    --page-inset: 0.5rem;
  }
  .hero:has(#vote-challenge:not([hidden])) .status-override {
    margin-block: 0.25rem;
  }
  .hero #vote-challenge {
    margin-top: 0.5rem;
  }
  .hero #vote-feedback {
    margin-top: 0.125rem;
    line-height: 1.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.globe canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pinch-zoom;
  cursor: grab;
  position: relative;
  z-index: 2;
  opacity: 0;
}
.globe-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.globe:not([data-capture]) canvas {
  position: absolute;
  left: -10%;
  top: -10%;
  width: 120%;
  height: 120%;
}
.globe[data-complete] .globe-preview {
  visibility: hidden;
}
.globe canvas:active {
  cursor: grabbing;
}
.globe canvas:focus-visible {
  outline: 3px solid #efc572;
  outline-offset: -6px;
  border-radius: 50%;
}
.globe[data-complete] {
  background: transparent;
}
.globe[data-complete] canvas {
  opacity: 1;
}
