/* GO GET THAT NOW — shared styles for every location in the universe.
   Desktop: the scene is a 1672x941 "stage"; links sit over it at artwork coordinates.
   Mobile:  the same links become real cards. Keep both media queries in sync with the
   <source media> on each page's <picture>. */

:root {
  --gold: #f6d58a;
  --gold-deep: #c9974a;
  --teal: #5fe3d6;
  --ink: #fff8ea;
  --ink-soft: #d9d3e4;
  --night: #0c0f24;
  --glass: rgba(14, 18, 44, 0.72);
  --edge: rgba(246, 213, 138, 0.42);
  --display: 'Cinzel', Georgia, serif;
  --body: 'Jost', 'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 50;
  padding: 10px 16px; border-radius: 8px;
  background: var(--gold); color: var(--night); font-weight: 600;
}
.skip:focus { top: 12px; }

:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

/* ---------- Glass menu button (homepage, and mobile world pages) ---------- */

.menu-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; min-height: 44px;
  border: 1px solid var(--edge); border-radius: 999px;
  background: var(--glass); backdrop-filter: blur(8px);
  letter-spacing: 0.14em; font-size: 0.8rem; text-transform: uppercase;
}
.menu-btn svg { width: 18px; height: 18px; stroke: var(--gold); stroke-width: 2; fill: none; stroke-linecap: round; }

/* ---------- In-world panel (menu + "under construction") ---------- */

dialog.panel {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 28px;
  border: 1px solid var(--edge);
  border-radius: 20px;
  background: rgba(12, 15, 36, 0.92);
  color: var(--ink);
  box-shadow: 0 0 60px rgba(246, 190, 100, 0.25);
}
dialog.panel::backdrop { background: rgba(5, 6, 18, 0.6); backdrop-filter: blur(4px); }
dialog.panel h2 {
  margin: 0 0 8px; font-family: var(--display); font-size: 1.55rem;
  color: var(--gold); letter-spacing: 0.04em;
}
dialog.panel h3 {
  margin: 22px 0 6px; font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-soft);
}
dialog.panel p { margin: 0 0 18px; color: var(--ink-soft); }
dialog.panel ul { list-style: none; margin: 0; padding: 0; }
dialog.panel li a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 11px 2px; border-bottom: 1px solid rgba(246, 213, 138, 0.16);
  text-decoration: none;
}
dialog.panel li a:hover { color: var(--gold); }
dialog.panel li small { color: var(--ink-soft); font-size: 0.82rem; text-align: right; }
.panel-close {
  margin-top: 20px; min-height: 44px; padding: 8px 22px;
  border: 1px solid var(--edge); border-radius: 999px; background: transparent;
}
.panel-close:hover { background: rgba(246, 213, 138, 0.14); }

/* ---------- Pages built on a scene: homepage, LEARN, BUILD ---------- */

.district .label, .district .card-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.backdrop { position: fixed; inset: -60px; z-index: -1; background-size: cover; background-position: center; filter: blur(36px) saturate(1.2) brightness(0.72); }

@media (min-width: 821px) and (min-aspect-ratio: 1/1) {
  /* Stage is the largest 1672:941 box that fits, so hotspots stay on the art at every size. */
  .universe { display: grid; place-items: center; height: 100vh; height: 100dvh; overflow: hidden; }
  .stage {
    position: relative;
    width: min(100vw, calc(100vh * 1672 / 941));
    width: min(100vw, calc(100dvh * 1672 / 941));
    aspect-ratio: 1672 / 941;
    transition: transform 0.45s cubic-bezier(0.6, 0, 0.9, 0.4), opacity 0.45s ease-in;
  }
  .stage.warp { transform: scale(2.5); opacity: 0; }
  .scene, .scene img { position: absolute; inset: 0; width: 100%; height: 100%; }

  /* Any element positioned by artwork pixels */
  .spot {
    position: absolute;
    left: calc(var(--x) / 1672 * 100%);
    top: calc(var(--y) / 941 * 100%);
    width: calc(var(--w) / 1672 * 100%);
    height: calc(var(--h) / 941 * 100%);
    padding: 0; border: 0; background: none;
    border-radius: 14px;
    text-decoration: none;
    transition: box-shadow 0.25s, background-color 0.25s;
  }
  .spot:hover { box-shadow: 0 0 22px 4px rgba(246, 213, 138, 0.55); background: rgba(255, 240, 200, 0.07); }
  .spot:focus-visible { outline-offset: 0; }
  .spot .card-text, .spot .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

  .spot.portal { border-radius: 150px 150px 30px 30px; }
  .spot.portal:hover { box-shadow: 0 0 34px 8px rgba(246, 213, 138, 0.45), inset 0 0 50px rgba(255, 240, 200, 0.16); background: rgba(255, 240, 200, 0.05); }

  .only-mobile { display: none !important; }

  /* Homepage: each district is its own lit-up copy of the art, clipped to the district */
  .district {
    position: absolute; inset: 0; display: block; text-decoration: none;
    clip-path: var(--shape);
    background: url('/assets/img/home.webp') center / 100% 100%;
    filter: brightness(1.2) saturate(1.15);
    opacity: 0;
    transition: opacity 0.3s;
  }
  .district:hover, .district:focus-visible { opacity: 1; outline: 0; }

  .beacon {
    position: absolute; pointer-events: none;
    left: calc(var(--x) / 1672 * 100%);
    top: calc(var(--y) / 941 * 100%);
    width: calc(76 / 1672 * 100%);
    aspect-ratio: 1;
    translate: -50% -50%;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255, 240, 200, 0.7), 0 0 24px 6px rgba(246, 213, 138, 0.5);
    opacity: 0;
    animation: beacon 4.5s ease-in-out infinite;
    animation-delay: var(--delay);
  }
  .district:hover + .beacon, .district:focus-visible + .beacon { animation: none; opacity: 1; }

  .corner { position: absolute; top: 2.2%; right: 1.6%; }
}

@keyframes beacon {
  0%, 60%, 100% { opacity: 0; transform: scale(0.92); }
  78% { opacity: 0.85; transform: scale(1.12); }
}

@media (max-width: 820px), (max-aspect-ratio: 999/1000) {
  .only-desktop { display: none !important; }
  .stage { display: flex; flex-direction: column; min-height: 100dvh; }
  .backdrop { filter: blur(30px) saturate(1.2) brightness(0.42); }

  .scene img { width: 100%; height: auto; }
  .scene { order: 1; position: relative; }
  .scene::after {
    content: ''; position: absolute; inset: auto 0 0; height: 8%;
    background: linear-gradient(transparent, rgba(12, 15, 36, 0.7));
  }

  .hud {
    order: 0; position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 16px; background: rgba(12, 15, 36, 0.88); backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(246, 213, 138, 0.2);
  }
  .hud .home-link { font-family: var(--display); font-size: 0.95rem; color: var(--gold); text-decoration: none; padding: 10px 0; }
  .hud nav { display: none; }

  /* Homepage on a phone: the approved mobile art, full screen, with links over its labels.
     Coordinates are in pixels of the 1024x1536 mobile art. */
  .home .universe { display: grid; place-items: center; height: 100vh; height: 100dvh; overflow: hidden; }
  .home .stage {
    position: relative; display: block; min-height: 0;
    width: min(100vw, calc(100vh * 1024 / 1536));
    width: min(100vw, calc(100dvh * 1024 / 1536));
    aspect-ratio: 1024 / 1536;
  }
  .home .scene, .home .scene img { position: absolute; inset: 0; width: 100%; height: 100%; }
  /* Phones are taller than the art: fade its top and bottom into the glow behind it */
  .home .scene img { -webkit-mask-image: linear-gradient(transparent, #000 7%, #000 93%, transparent); mask-image: linear-gradient(transparent, #000 7%, #000 93%, transparent); }
  .home .scene::after { display: none; }
  .home .backdrop { filter: blur(26px) saturate(1.2) brightness(0.98); }
  .home .floor { padding: 0; }
  .district {
    position: absolute;
    left: calc(var(--mx) / 1024 * 100%);
    top: calc(var(--my) / 1536 * 100%);
    width: calc(var(--mw) / 1024 * 100%);
    height: calc(var(--mh) / 1536 * 100%);
    border-radius: 24px;
    -webkit-tap-highlight-color: transparent;
    transition: box-shadow 0.2s, background-color 0.2s;
  }
  .district:active { box-shadow: 0 0 26px 6px rgba(246, 213, 138, 0.65); background: rgba(255, 240, 200, 0.14); }
  /* The menu icon is part of the art here, so the button sits invisibly on top of it */
  .home .corner {
    position: absolute; left: calc(922 / 1024 * 100%); top: calc(16 / 1536 * 100%);
    width: calc(92 / 1024 * 100%); aspect-ratio: 1; min-height: 44px; padding: 0;
    border: 0; border-radius: 12px; background: none; backdrop-filter: none; font-size: 0;
  }
  .home .corner svg { display: none; }

  .floor { order: 2; padding: 4px 16px 28px; }
  .floor > h2, .tagline {
    margin: 4px 0 16px; text-align: center; font-family: var(--display);
    font-size: 1.3rem; font-weight: 400; color: var(--gold);
  }
  .intro { margin: 0 0 16px; text-align: center; color: var(--ink-soft); }

  .card-grid { display: grid; gap: 14px; }
  .card-grid.two { grid-template-columns: 1fr 1fr; gap: 12px; }

  .card {
    position: relative; display: flex; flex-direction: column; justify-content: flex-end;
    width: 100%; min-height: 150px; padding: 0; overflow: hidden; text-align: left;
    border: 1px solid var(--edge); border-radius: 16px;
    background: var(--glass) var(--img, none) center top / 100% auto no-repeat;
    text-decoration: none;
  }
  .card:active { box-shadow: 0 0 22px 4px rgba(246, 213, 138, 0.55); }
  .card .card-text { display: block; padding: 84px 14px 14px; background: linear-gradient(transparent, rgba(12, 15, 36, 0.92) 46%); }
  .card-grid:not(.two) .card .card-text { padding-top: 112px; }
  .card .label { display: block; font-family: var(--display); font-size: 1.1rem; color: var(--gold); letter-spacing: 0.05em; }
  .card .desc { display: block; font-size: 0.92rem; color: var(--ink-soft); }
  .card .go { display: block; margin-top: 6px; font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--teal); }

  .card.inner-circle {
    min-height: 0; text-align: center; border-color: var(--gold);
    background: radial-gradient(ellipse at top, rgba(246, 190, 100, 0.34), var(--glass) 70%);
    box-shadow: 0 0 30px rgba(246, 190, 100, 0.3);
  }
  .card-grid:not(.two) .card.inner-circle .card-text { padding: 22px 14px; background: none; }
}

/* ---------- MOVE, GROW, 404: branded holding pages ---------- */

.outpost {
  position: relative; display: grid; place-items: center;
  min-height: 100dvh; padding: 88px 16px 32px; overflow: hidden;
}
.outpost::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background: var(--img) center / cover no-repeat;
}
.outpost::after {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at center, rgba(12, 15, 36, 0.35), rgba(12, 15, 36, 0.8));
}
.outpost-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; background: rgba(12, 15, 36, 0.7); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(246, 213, 138, 0.2);
}
.outpost-bar .home-link { font-family: var(--display); color: var(--gold); text-decoration: none; padding: 8px 0; }
.outpost-bar nav { display: flex; gap: 22px; }
.outpost-bar nav a { letter-spacing: 0.14em; font-size: 0.82rem; text-decoration: none; padding: 8px 0; }
.outpost-bar nav a:hover, .outpost-bar nav a[aria-current] { color: var(--gold); }
.outpost-card {
  width: min(620px, 100%); padding: clamp(24px, 5vw, 44px);
  border: 1px solid var(--edge); border-radius: 24px;
  background: var(--glass); backdrop-filter: blur(14px);
  text-align: center;
  box-shadow: 0 0 70px rgba(246, 190, 100, 0.22);
}
.outpost-card h1 {
  margin: 0; font-family: var(--display); font-size: clamp(2.8rem, 9vw, 4.6rem);
  font-weight: 500; line-height: 1.1; color: var(--gold);
  text-shadow: 0 0 26px rgba(246, 190, 100, 0.55);
}
.outpost-card .lede { margin: 10px 0 22px; font-size: 1.15rem; color: var(--ink); }
.stops { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); text-align: left; }
.stops li { padding: 12px 14px; border: 1px solid rgba(246, 213, 138, 0.22); border-radius: 12px; }
.stops b { display: block; font-family: var(--display); font-weight: 500; color: var(--gold); letter-spacing: 0.05em; }
.stops span { font-size: 0.92rem; color: var(--ink-soft); }
.status { margin: 0 0 20px; font-size: 0.8rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--teal); }
.back {
  display: inline-block; padding: 11px 26px; border: 1px solid var(--edge); border-radius: 999px;
  text-decoration: none;
}
.back:hover { background: rgba(246, 213, 138, 0.14); }

@media (max-width: 560px) {
  .outpost-bar nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .stage.warp { transform: none; opacity: 1; }
}
