/* ============================================================
   KAMEGEMZ — THE OBSERVATORY  (index.html + studio-os.html)
   Diegetic layer on top of style.css. Palette and type come
   from the site tokens: --void --mint --gold --bone (style.css).
   ============================================================ */

/* ===== WARP LANDING SEQUENCE =====
   Plays once per session, fades out, hero resolves underneath.
   Reduced motion or a missing video file skips it entirely. */
.warp {
  position: fixed; inset: 0; z-index: 999; background: #000;
  display: flex; align-items: center; justify-content: center;
  opacity: 1; transition: opacity 1.1s ease;
}
/* THE fix: display:flex above was overriding the HTML hidden attribute,
   so the black overlay kept rendering and eating clicks even when the
   code had correctly hidden it. hidden must always win. */
.warp[hidden] { display: none !important; }
.warp.done { opacity: 0; pointer-events: none; }
.warp video { width: 100%; height: 100%; object-fit: cover; }
.warp__skip {
  position: absolute; bottom: 2rem; right: 2rem; z-index: 2;
  font-family: 'Syne', sans-serif; font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: rgba(238,244,240,0.6); background: rgba(7,9,13,0.55);
  border: 1px solid rgba(79,237,214,0.25); padding: 0.6rem 1.2rem;
  cursor: pointer; transition: color 0.2s, border-color 0.2s;
}
.warp__skip:hover, .warp__skip:focus-visible { color: var(--mint); border-color: var(--mint); }

/* ===== COCKPIT HERO =====
   The wide office master shot. Two hotspots sit over the planets
   in the shattered window. Positions are percentage variables so
   they can be tuned against the final render (open /#tune). */
.cockpit {
  /* --- TUNE THESE against images/observatory/master-wide.png ---
     x/y are the planet centers as % of the image, w is hotspot size */
  --hs-rehm-x: 50%;  --hs-rehm-y: 38%;  --hs-rehm-w: 24vw;
  --hs-build-x: 80%; --hs-build-y: 44%; --hs-build-w: 15vw;

  position: relative; height: 100vh; min-height: 620px;
  overflow: clip; isolation: isolate; background: var(--void);
}
.cockpit__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 38%;
  transform-origin: 50% 35%;
  transition: transform 1.6s cubic-bezier(0.16, 1, 0.3, 1), filter 1.6s ease;
}
.cockpit.focus-rehm  .cockpit__img { transform: scale(1.07); transform-origin: var(--hs-rehm-x) var(--hs-rehm-y); filter: brightness(1.06); }
.cockpit.focus-build .cockpit__img { transform: scale(1.07); transform-origin: var(--hs-build-x) var(--hs-build-y); }
.cockpit::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    linear-gradient(to top, rgba(7,9,13,0.96) 0%, rgba(7,9,13,0.35) 22%, rgba(7,9,13,0) 45%),
    linear-gradient(to bottom, rgba(7,9,13,0.55) 0%, rgba(7,9,13,0) 18%);
}

/* hotspots */
.hotspot {
  position: absolute; z-index: 3;
  left: var(--x); top: var(--y);
  width: var(--w); height: var(--w);
  min-width: 96px; min-height: 96px; max-width: 520px; max-height: 520px;
  transform: translate(-50%, -50%);
  border-radius: 50%; cursor: pointer;
  border: 1px solid transparent;
  background: radial-gradient(circle, rgba(79,237,214,0.0) 55%, rgba(79,237,214,0.05) 72%, transparent 74%);
  transition: border-color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
}
.hotspot--rehm  { --x: var(--hs-rehm-x);  --y: var(--hs-rehm-y);  --w: var(--hs-rehm-w); }
.hotspot--build { --x: var(--hs-build-x); --y: var(--hs-build-y); --w: var(--hs-build-w); }

/* planet lens: the close-up art fades in over the planet and slowly spins */
.hotspot__lens {
  position: absolute; inset: -4%; border-radius: 50%; overflow: hidden;
  opacity: 0; transform: scale(0.82);
  transition: opacity 0.45s ease, transform 0.8s cubic-bezier(0.2, 0.9, 0.3, 1);
  box-shadow: 0 0 70px rgba(79, 237, 214, 0.28), inset 0 0 60px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}
.hotspot--build .hotspot__lens { box-shadow: 0 0 70px rgba(226, 185, 111, 0.25), inset 0 0 60px rgba(0, 0, 0, 0.65); }
.hotspot__lens img {
  position: absolute; left: 50%; top: 50%; width: 175%; height: 175%;
  object-fit: cover; transform: translate(-50%, -50%) rotate(0deg);
}
.hotspot:hover .hotspot__lens, .hotspot:focus-visible .hotspot__lens { opacity: 1; transform: scale(1); }
.hotspot:hover .hotspot__lens img, .hotspot:focus-visible .hotspot__lens img {
  animation: lens-spin 55s linear infinite;
}
@keyframes lens-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.hotspot:hover, .hotspot:focus-visible {
  border-color: rgba(79,237,214,0.45);
  box-shadow: 0 0 40px rgba(79,237,214,0.18), inset 0 0 34px rgba(79,237,214,0.10);
  outline: none;
}
.hotspot--build:hover, .hotspot--build:focus-visible {
  border-color: rgba(226,185,111,0.45);
  box-shadow: 0 0 40px rgba(226,185,111,0.15), inset 0 0 34px rgba(226,185,111,0.08);
}
/* slow idle spin ring on the live world */
.hotspot--rehm::before {
  content: ""; position: absolute; inset: -9%; border-radius: 50%;
  border: 1px dashed rgba(79,237,214,0.28);
  animation: hs-spin 26s linear infinite; opacity: 0;
  transition: opacity 0.4s ease;
}
.hotspot--rehm:hover::before, .hotspot--rehm:focus-visible::before { opacity: 1; }
@keyframes hs-spin { to { transform: rotate(360deg); } }

.hotspot__chip {
  position: absolute; left: 50%; top: calc(100% + 14px); transform: translateX(-50%) translateY(6px);
  white-space: nowrap; pointer-events: none; opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  font-family: 'Syne', sans-serif; font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--bone); background: rgba(7,9,13,0.82);
  border: 1px solid rgba(79,237,214,0.3); padding: 0.55rem 1rem;
}
.hotspot__chip em { font-style: normal; color: var(--mint); }
.hotspot--build .hotspot__chip { border-color: rgba(226,185,111,0.3); }
.hotspot--build .hotspot__chip em { color: var(--gold); }
.hotspot:hover .hotspot__chip, .hotspot:focus-visible .hotspot__chip {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* hero caption block */
.cockpit__caption {
  position: absolute; left: 0; right: 0; bottom: 4.5vh; z-index: 4; text-align: left;
}
.cockpit__caption h1 {
  font-size: clamp(2.4rem, 6.5vw, 5.2rem); text-transform: uppercase;
  text-shadow: 0 2px 30px rgba(7,9,13,0.9);
}
.cockpit__caption .sub {
  margin-top: 0.9rem; max-width: 54ch; color: var(--bone-dim);
  font-size: 0.98rem; line-height: 1.6; text-shadow: 0 1px 10px rgba(7,9,13,0.9);
}
.cockpit__hint {
  margin-top: 1.4rem; display: inline-flex; align-items: center; gap: 10px;
  font-family: 'Syne', sans-serif; font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--mint);
}
.cockpit__hint::before {
  content: ""; width: 8px; height: 8px; background: var(--mint);
  clip-path: polygon(50% 0,100% 50%,50% 100%,0 50%);
  box-shadow: 0 0 10px var(--mint); animation: obs-pulse 3s ease-in-out infinite;
}
@keyframes obs-pulse { 0%,100%{opacity:.45} 50%{opacity:1} }

/* tuner (open /#tune): click the hero, coordinates print on screen */
.tuner-badge {
  position: absolute; top: 5.5rem; left: 1rem; z-index: 9;
  font: 600 0.72rem/1.5 monospace; color: var(--mint);
  background: rgba(7,9,13,0.9); border: 1px solid var(--mint);
  padding: 0.7rem 0.9rem; white-space: pre; display: none;
}
.cockpit.tuning .tuner-badge { display: block; }
.cockpit.tuning { cursor: crosshair; }
.cockpit.tuning .hotspot { border-color: rgba(79,237,214,0.7); }
.cockpit.tuning .hotspot--build { border-color: rgba(226,185,111,0.7); }

/* ===== WORLD GATES =====
   Accessible / mobile route into both worlds. Two plates. */
.gates { padding: clamp(4.5rem, 9vw, 7.5rem) 0; border-top: 1px solid var(--border); }
.gates__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 2.5rem; }
.gate {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 460px; overflow: clip; isolation: isolate;
  border: 1px solid var(--border); background: #000;
  transition: border-color 0.35s ease, transform 0.35s ease;
}
.gate:hover { border-color: var(--border-mid); transform: translateY(-4px); }
.gate__art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.85; transition: transform 1.4s cubic-bezier(0.16,1,0.3,1), opacity 0.5s ease; }
.gate:hover .gate__art { transform: scale(1.05); opacity: 1; }
.gate__art--contain { object-fit: contain; padding: 2.2rem; opacity: 0.95; }
.gate::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.25) 45%, rgba(0,0,0,0) 70%);
}
.gate__body { position: relative; z-index: 2; padding: 1.8rem; }
.gate__status {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'Syne', sans-serif; font-size: 0.58rem; font-weight: 700;
  letter-spacing: 0.24em; text-transform: uppercase; margin-bottom: 0.7rem;
}
.gate__status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.gate--live .gate__status { color: #c05b6b; }
.gate--live .gate__status::before { background: #c05b6b; box-shadow: 0 0 10px #c05b6b; animation: obs-pulse 2.4s ease-in-out infinite; }
.gate--dormant .gate__status { color: var(--gold); }
.gate--dormant .gate__status::before { background: var(--gold); box-shadow: 0 0 8px rgba(226,185,111,0.7); }
.gate__title { font-size: clamp(1.6rem, 3vw, 2.2rem); text-transform: uppercase; }
.gate__desc { margin-top: 0.5rem; max-width: 44ch; color: var(--bone-dim); font-size: 0.92rem; line-height: 1.6; }
.gate__go {
  margin-top: 1.1rem; display: inline-block;
  font-family: 'Syne', sans-serif; font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--mint);
}
.gate--dormant .gate__go { color: var(--gold); }

/* ===== POV REVEAL (scroll-triggered full-bleed) ===== */
.povband {
  position: relative; min-height: 92vh; display: flex; align-items: flex-end;
  overflow: clip; isolation: isolate; border-top: 1px solid var(--border);
}
.povband__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.povband::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(7,9,13,0.95) 0%, rgba(7,9,13,0.2) 40%, rgba(7,9,13,0.15) 100%);
}
.povband__copy { position: relative; z-index: 2; padding: 0 0 5rem; opacity: 0; transform: translateY(26px); transition: opacity 1s ease, transform 1s cubic-bezier(0.16,1,0.3,1); }
.povband__copy.inview { opacity: 1; transform: none; }
.povband__copy h2 { font-size: clamp(1.8rem, 4.4vw, 3.2rem); max-width: 20ch; }
.povband__copy p { margin-top: 1rem; max-width: 52ch; color: var(--bone-dim); line-height: 1.7; }

/* ===== STUDIO CREST plate (about) ===== */
.crest-plate {
  background: #000; border: 1px solid var(--border-mid);
  padding: 0; overflow: clip;
}
.crest-plate img { width: 100%; height: auto; display: block; }

/* ===== STUDIO OS page hero ===== */
.osx-hero {
  position: relative; min-height: 78vh; display: flex; align-items: flex-end;
  overflow: clip; isolation: isolate; border-bottom: 1px solid var(--border);
}
.osx-hero__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.osx-hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(7,9,13,0.97) 0%, rgba(7,9,13,0.3) 45%, rgba(7,9,13,0.2) 100%);
}
.osx-hero__copy { position: relative; z-index: 2; padding: 8rem 0 3.6rem; }
.osx-hero__copy h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); text-transform: uppercase; }
.osx-hero__copy .sub { margin-top: 1rem; max-width: 54ch; color: var(--bone-dim); line-height: 1.65; }

@media (max-width: 900px) {
  .gates__grid { grid-template-columns: 1fr; }
  .cockpit { --hs-rehm-w: 24vw; --hs-build-w: 19vw; min-height: 540px; }
  .cockpit__img { object-position: 62% 38%; }
}
@media (prefers-reduced-motion: reduce) {
  .warp { display: none !important; }
  .cockpit__img, .gate__art, .hotspot--rehm::before, .hotspot__lens, .hotspot__lens img { transition: none; animation: none; }
  .povband__copy { opacity: 1; transform: none; transition: none; }
}

/* clamped hotspot: on narrow screens a planet can be cropped out of the cover
   framing; the mapper pins its hotspot to the screen edge and the lens stays
   visible so the planet itself is still on screen and tappable */
.hotspot--clamped .hotspot__lens { opacity: 0.95; transform: scale(1); }
.hotspot--clamped .hotspot__chip { opacity: 1; transform: translate(-50%, 0); }
