/* Portal front page and 404 page. The artwork is Misty's Canva design,
   exported as-is and filling the whole window. Only the moon glow and
   the clickable link sit on top of it. */

:root {
  color-scheme: dark;
  --sky-top: #4f4e52;       /* the art's top edge */
  --field-bottom: #56604f;  /* the art's bottom edge */
  --cream: #efe6d2;
  --glow: 255, 238, 196;    /* warm moonlight, used as rgba() */
  --art-ratio: 1.7786;      /* 2732 / 1536 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: linear-gradient(to bottom, var(--sky-top), var(--field-bottom));
  color: var(--cream);
  font-family: "Cinzel", "Trajan Pro", Georgia, serif;
}

/* On screens taller than the art, the sky and the grass carry on past
   its top and bottom edges, column by column, so there is no border. */
body::before,
body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  height: 50%;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  z-index: 0;
}
body::before { top: 0; background-image: url("/images/edge-top.png"); }
body::after  { bottom: 0; background-image: url("/images/edge-bottom.png"); }

/* The design IS the page: the art always covers the full window,
   like a background set to "cover". It keeps its true proportions, so
   the overlays below stay locked to the moon and the painted words. */
.stage {
  position: fixed;
  left: 50%;
  top: 50%;
  width: max(100vw, calc(100vh * var(--art-ratio)));
  aspect-ratio: 2732 / 1536;
  transform: translate(-50%, -50%);
  overflow: hidden;
  z-index: 1;
}

.stage picture,
.stage img {
  display: block;
  width: 100%;
  height: 100%;
}

/* Soft glow on the moon. Moon centre is about 75.75% across and 40%
   down the artwork, radius about 14.6% of its width. */
.moon-glow {
  position: absolute;
  left: 75.75%;
  top: 40%;
  width: 46%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  mix-blend-mode: screen;
  background: radial-gradient(circle closest-side,
      rgba(var(--glow), 0.12) 0%,
      rgba(var(--glow), 0.14) 56%,
      rgba(var(--glow), 0.28) 63%,
      rgba(var(--glow), 0.12) 75%,
      rgba(var(--glow), 0.00) 100%);
  animation: moon-breathe 7s ease-in-out infinite;
}

@keyframes moon-breathe {
  0%, 100% { opacity: 0.65; }
  50%      { opacity: 1; }
}

/* Real, clickable link laid exactly over the painted "ENTER MY WORLD". */
.enter {
  position: absolute;
  left: 33.5%;
  top: 71.5%;
  width: 33%;
  height: 9%;
  border-radius: 999px;
  color: transparent;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  outline: none;
}

.enter::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  mix-blend-mode: screen;
  background: radial-gradient(ellipse closest-side,
      rgba(var(--glow), 0.22), rgba(var(--glow), 0) 100%);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.enter:hover::after,
.enter:focus-visible::after { opacity: 1; }

.enter:focus-visible {
  box-shadow: 0 0 0 2px rgba(var(--glow), 0.75);
}

.copyright {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 2;
  text-align: center;
  font-size: clamp(10px, 0.85vw, 13px);
  letter-spacing: 0.08em;
  color: rgba(239, 230, 210, 0.62);
  pointer-events: none;
  padding: 0 16px;
}

.lost-note {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(5vh + env(safe-area-inset-top, 0px));
  z-index: 2;
  text-align: center;
  font-size: clamp(12px, 1.35vw, 20px);
  letter-spacing: 0.12em;
  color: rgba(239, 230, 210, 0.85);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  padding: 0 16px;
}

.lost-note small {
  display: block;
  margin-top: 0.4em;
  font-size: 0.72em;
  letter-spacing: 0.08em;
  color: rgba(239, 230, 210, 0.7);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Tall or squarish screens (phones held upright, tablets): covering
   them would cut the name off,
   so the art spans the full width and its own top and bottom colours
   carry on seamlessly to the screen edges. Tapping anywhere enters. */
@media (max-aspect-ratio: 13/10) {
  .stage {
    width: 100vw;
    -webkit-mask-image: linear-gradient(to bottom, transparent 2%, #000 16%, #000 86%, transparent 98%);
    mask-image: linear-gradient(to bottom, transparent 2%, #000 16%, #000 86%, transparent 98%);
  }
  .enter {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    border-radius: 0;
    z-index: 1;
  }
  .enter::after { display: none; }
  .lost-note { top: calc(18vh + env(safe-area-inset-top, 0px)); font-size: 14px; }
  .copyright { font-size: 11px; bottom: calc(18vh + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .moon-glow { animation: none; opacity: 0.85; }
  .enter::after { transition: none; }
}
