/* Edgewood Ranch — world HUD, cards, markers, loader */

:root {
  --paper: #f5ead5;
  --paper-2: #ecdcc0;
  --paper-3: #dfc7a0;
  --ink: #2b1c16;
  --ink-2: #5b473b;
  --ink-3: #8a7465;
  --line: rgba(43, 28, 22, 0.16);
  --cream: #fff3df;
  --rust: #c4492c;
  --ember: #e8743b;
  --amber: #f2b25c;
  --teal: #2f6f73;
  --pine: #1f3b33;
  --plum: #4b2f63;
  --night: #161a36;
  --accent: var(--rust);
  --glass: rgba(28, 14, 24, 0.38);
  --display: "Big Shoulders Display", "Oswald", "Arial Narrow", Impact, sans-serif;
  --body: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --shadow: 0 22px 50px -14px rgba(24, 8, 4, 0.55);
  --ease: cubic-bezier(0.2, 0.75, 0.1, 1);
  --gutter: clamp(16px, 3vw, 32px);
  color-scheme: light;
}

/* The UI follows the in-world clock: night turns the paper to navy. */
body[data-tod="night"] {
  --paper: #1d2244;
  --paper-2: #262c55;
  --paper-3: #343b6c;
  --ink: #f4ecdc;
  --ink-2: #cdc5b8;
  --ink-3: #a09aab;
  --line: rgba(244, 236, 220, 0.16);
  --accent: var(--amber);
  --glass: rgba(8, 10, 30, 0.45);
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #f0a266;
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }
button:not(:disabled) { cursor: pointer; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.hand { font-family: var(--hand); font-weight: 600; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* --- world canvas & atmosphere ------------------------------------------------ */
#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#world:active { cursor: grabbing; }
#world.is-pointing { cursor: pointer; }

.atmos {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 120% 90% at 50% 45%, transparent 55%, rgba(30, 8, 20, 0.42) 100%),
    linear-gradient(to bottom, rgba(30, 10, 30, 0.28), transparent 26%, transparent 72%, rgba(20, 6, 14, 0.35));
}
.atmos::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Flat illustrated poster: loader backdrop and no-WebGL fallback */
.poster { position: fixed; inset: 0; display: none; }
.poster svg, .loader svg { width: 100%; height: 100%; display: block; }
.no-webgl .poster { display: block; }
.no-webgl #world, .no-webgl .markers, .no-webgl .compass, .no-webgl .hint, .no-webgl .tod { display: none; }

/* --- shared HUD visibility --------------------------------------------------------- */
/* Visibility flips on instantly (so things are focusable at once) and off only after the fade. */
.brand, .topbar, .hud-bottom, .stays, .markers {
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), visibility 0s linear;
}
body:is([data-view="loading"], [data-view="intro"]) :is(.brand, .topbar, .hud-bottom, .stays, .markers),
body[data-view="stay"] .stays {
  transition-delay: 0s, 0s, 0.7s;
}
body:is([data-view="loading"], [data-view="intro"]) :is(.brand, .topbar, .hud-bottom, .stays, .markers) {
  opacity: 0;
  visibility: hidden;
}
body:is([data-view="loading"], [data-view="intro"]) .stays { transform: translate(-50%, 30px); }

/* --- brand lockup -------------------------------------------------------------------- */
.brand {
  position: fixed;
  top: var(--gutter);
  left: var(--gutter);
  color: var(--cream);
  text-shadow: 0 2px 18px rgba(40, 10, 20, 0.45);
  pointer-events: none;
  max-width: min(560px, 60vw);
}
.brand__loc {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  font: 700 12px/1 var(--display);
  letter-spacing: 0.34em;
  text-transform: uppercase;
}
.brand__loc::before { content: ""; width: 28px; height: 2px; background: currentColor; }
.brand__name {
  margin: 0;
  font: 900 clamp(44px, 6.4vw, 92px)/0.82 var(--display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.brand__tag {
  margin: 10px 0 0;
  font: 600 clamp(20px, 2vw, 25px)/1.1 var(--hand);
  color: #ffe2b4;
}

/* --- top bar: time of day ----------------------------------------------------------------- */
.topbar {
  position: fixed;
  top: var(--gutter);
  right: var(--gutter);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.tod { display: grid; justify-items: end; gap: 6px; }
.tod__label {
  font: 800 12px/1 var(--display);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--cream);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}
.tod__buttons, .topbar__link {
  display: flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: inset 0 0 0 1px rgba(255, 243, 223, 0.18);
}
.tod__buttons button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--cream);
  transition: background 0.25s, color 0.25s, transform 0.25s var(--ease);
}
.tod__buttons button:hover { background: rgba(255, 243, 223, 0.14); }
.tod__buttons button[aria-pressed="true"] { background: var(--cream); color: #3a2030; }
.tod__buttons svg { width: 22px; height: 22px; }
.topbar__link {
  align-self: flex-end;
  padding: 11px 16px;
  color: var(--cream);
  text-decoration: none;
  font: 800 13px/1 var(--display);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.topbar__link:hover { background: rgba(28, 14, 24, 0.55); }

/* --- bottom-left: compass & hint ------------------------------------------------------------ */
.hud-bottom {
  position: fixed;
  left: var(--gutter);
  bottom: var(--gutter);
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: none;
  color: var(--cream);
}
.compass { display: grid; justify-items: center; gap: 6px; }
.compass__dial {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: var(--shadow), inset 0 0 0 3px var(--paper-3), inset 0 0 0 5px var(--paper);
  overflow: hidden;
}
.compass__rose { position: absolute; inset: 0; transition: transform 0.08s linear; }
.compass__rose svg { width: 100%; height: 100%; }
.compass__needle {
  position: absolute;
  left: 50%;
  top: 7px;
  width: 0;
  height: 0;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top: 9px solid var(--rust);
}
.compass__bearing {
  font: 800 12px/1 var(--display);
  letter-spacing: 0.18em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}
.hint {
  margin: 0 0 18px;
  max-width: 230px;
  font: 600 20px/1.05 var(--hand);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}
.hint--touch { display: none; }
@media (hover: none) {
  .hint--pointer { display: none; }
  .hint--touch { display: inline; }
}

/* --- stay cards: pinned trail notes ------------------------------------------------------------ */
.stays {
  position: fixed;
  left: 50%;
  bottom: var(--gutter);
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 2px;
}
body[data-view="stay"] .stays { opacity: 0; visibility: hidden; transform: translate(-50%, 30px); }
.stays__title {
  margin: 0;
  color: var(--cream);
  font-size: 24px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}
.stay-cards { display: flex; gap: 18px; }
.stay-card {
  position: relative;
  display: grid;
  gap: 4px;
  width: 262px;
  padding: 18px 20px 16px;
  border: 0;
  border-radius: 6px;
  text-align: left;
  color: var(--ink);
  background:
    linear-gradient(transparent 0 calc(100% - 6px), var(--paper-2) 0),
    var(--paper);
  box-shadow: var(--shadow);
  transform: rotate(-1.2deg);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.stay-card:nth-child(2) { transform: rotate(1.3deg); }
.stay-card::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 78px;
  height: 22px;
  translate: -50% 0;
  rotate: -3deg;
  background: rgba(255, 236, 196, 0.72);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.stay-card:hover, .stay-card:focus-visible,
body[data-hover="aframe"] .stay-card[data-stay="aframe"],
body[data-hover="airstream"] .stay-card[data-stay="airstream"] {
  transform: translateY(-8px) rotate(0deg);
  box-shadow: 0 30px 60px -16px rgba(24, 8, 4, 0.6);
}
.stay-card__site {
  justify-self: start;
  padding: 3px 8px 2px;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font: 800 11px/1.2 var(--display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.stay-card[data-stay="airstream"] { --accent: var(--teal); }
body[data-tod="night"] .stay-card { --accent: var(--amber); }
.stay-card__name {
  font: 900 34px/0.95 var(--display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.stay-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 13px;
}
.stay-card__meta svg { width: 17px; height: 17px; }
.stay-card__meta b { color: var(--ink); }
.dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.stay-card__soon { color: var(--accent); font-weight: 700; }

/* --- floating markers ------------------------------------------------------------------------- */
.markers { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: auto;
  transition: opacity 0.35s;
}
.marker.is-offscreen { opacity: 0; pointer-events: none; }
body[data-stay="aframe"] .marker[data-stay="aframe"],
body[data-stay="airstream"] .marker[data-stay="airstream"] { opacity: 0; pointer-events: none; }
.marker__pin {
  position: absolute;
  left: 0;
  top: 0;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font: 900 15px/1 var(--display);
  box-shadow: 0 6px 16px rgba(20, 6, 10, 0.45), inset 0 0 0 2px var(--rust);
  transition: scale 0.3s var(--ease);
}
.marker[data-stay="airstream"] .marker__pin { box-shadow: 0 6px 16px rgba(20, 6, 10, 0.45), inset 0 0 0 2px var(--teal); }
.marker__pin::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 243, 223, 0.8);
  animation: ping 2.4s var(--ease) infinite;
}
.marker__stem {
  position: absolute;
  left: -1px;
  top: 16px;
  height: 26px;
  border-left: 2px dashed rgba(255, 243, 223, 0.75);
}
.marker__label {
  position: absolute;
  left: 0;
  bottom: 24px;
  translate: calc(-50% + var(--nudge, 0px)) 0;
  display: grid;
  justify-items: center;
  padding: 7px 12px 6px;
  border-radius: 8px;
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--cream);
  white-space: nowrap;
  transition: translate 0.3s var(--ease), background 0.3s;
}
.marker__label b {
  font: 900 18px/1 var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.marker__label small {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 12px;
  transition: max-height 0.3s var(--ease), opacity 0.3s, margin 0.3s;
}
.marker:is(:hover, :focus-visible, .is-hot) .marker__pin { scale: 1.15; }
.marker:is(:hover, :focus-visible, .is-hot) .marker__label { translate: calc(-50% + var(--nudge, 0px)) -4px; background: rgba(28, 14, 24, 0.72); }
.marker:is(:hover, :focus-visible, .is-hot) .marker__label small { max-height: 20px; opacity: 1; margin-top: 3px; }

@keyframes ping {
  0% { transform: scale(0.85); opacity: 0.9; }
  70%, 100% { transform: scale(1.6); opacity: 0; }
}

/* --- intro title card & skip ------------------------------------------------------------------ */
.intro-title {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--cream);
  pointer-events: none;
  opacity: 0;
  text-shadow: 0 4px 30px rgba(30, 8, 20, 0.5);
}
.intro-title p {
  margin: 0;
  font: 600 30px/1 var(--hand);
}
.intro-title h2 {
  margin: 0;
  font: 900 clamp(56px, 11vw, 150px)/0.85 var(--display);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
body[data-view="intro"] .intro-title { animation: title-card 5.4s var(--ease) 0.3s both; }
@keyframes title-card {
  0% { opacity: 0; transform: translateY(14px); letter-spacing: 0.12em; }
  22%, 62% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-10px); }
}
.skip {
  position: fixed;
  right: var(--gutter);
  bottom: var(--gutter);
  padding: 11px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--glass);
  color: var(--cream);
  font: 800 13px/1 var(--display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s, visibility 0.5s;
}
body[data-view="intro"] .skip { opacity: 1; visibility: visible; transition-delay: 1s; }

/* --- loader -------------------------------------------------------------------------------------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #2d1b33;
  transition: opacity 1.1s var(--ease), visibility 1.1s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__text {
  position: absolute;
  left: 50%;
  top: 38%;
  translate: -50% -50%;
  text-align: center;
  color: var(--cream);
  white-space: nowrap;
}
.loader__text h2 {
  margin: 0;
  font: 900 clamp(52px, 9vw, 120px)/0.85 var(--display);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-shadow: 0 4px 30px rgba(40, 10, 20, 0.35);
}
.loader__text p { margin: 12px 0 0; font: 600 26px/1 var(--hand); color: #ffe2b4; }
.loader__text p::after { content: ""; animation: dots 1.6s steps(4) infinite; }
@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

noscript p {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 60;
  padding: 14px 18px;
  border-radius: 10px;
  background: var(--paper);
}

/* While a stay is open on wide screens: shrink the lockup, slide the controls clear of the panel */
@media (min-width: 761px) {
  .brand { transform-origin: 0 0; }
  .brand__tag { transition: opacity 0.4s; }
  body[data-view="stay"] .brand { transform: scale(0.6); }
  body[data-view="stay"] .brand__tag { opacity: 0; }
  body[data-view="stay"] .topbar { transform: translateX(calc(-1 * (min(450px, 100vw - 32px) + 16px))); }
  body[data-view="stay"] .topbar__link { display: none; }
}

/* --- small screens ---------------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .brand { max-width: calc(100vw - 2 * var(--gutter)); }
  .brand__tag { display: none; }
  body[data-view="stay"] :is(.brand, .topbar, .hud-bottom) { transition-delay: 0s, 0s, 0.7s; }
  body[data-view="stay"] .brand { opacity: 0; visibility: hidden; }
  .topbar { top: auto; bottom: calc(var(--gutter) + 132px); right: var(--gutter); }
  .tod__label, .topbar__link { display: none; }
  .tod__buttons button { width: 36px; height: 36px; }
  body[data-view="stay"] .topbar, body[data-view="stay"] .hud-bottom { opacity: 0; visibility: hidden; }
  .hud-bottom { bottom: calc(var(--gutter) + 132px); }
  .compass__dial { width: 56px; height: 56px; }
  .hint { display: none; }
  .stays { left: var(--gutter); right: var(--gutter); transform: none; }
  body:is([data-view="loading"], [data-view="intro"], [data-view="stay"]) .stays { transform: translateY(30px); }
  .stays__title { display: none; }
  .stay-cards { width: 100%; gap: 10px; }
  .stay-card { flex: 1; width: auto; min-width: 0; padding: 14px 14px 12px; transform: none; }
  .stay-card:nth-child(2) { transform: none; }
  .stay-card__name { font-size: 26px; }
  .stay-card__meta { flex-wrap: wrap; font-size: 12px; }
  .stay-card__meta > svg, .stay-card__meta > .dot, .stay-card__meta > span:first-of-type { display: none; }
  .marker__label b { font-size: 15px; }
}

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