/* ===== world.css — 3D world homepage overlay UI ===== */
/* Relies on the design tokens defined in wireframe.css (--wf-*). */

html, body { height: 100%; }
body.world-page { overflow: hidden; }

/* ---------- 3D canvas ---------- */
#world {
  position: fixed;
  inset: 0;
  z-index: 0;
}
#world canvas {
  display: block;
  cursor: grab;
  touch-action: none;
}
#world canvas:active { cursor: grabbing; }

/* ---------- Top bar ---------- */
.world-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.4rem;
  pointer-events: none;
}
.world-topbar > * { pointer-events: auto; }
.world-topbar .wf-logo img { height: 36px; }
.world-topbar-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* ---------- Headline overlay ---------- */
.world-headline {
  position: fixed;
  left: 1.6rem;
  bottom: 3.4rem;
  z-index: 10;
  max-width: 520px;
  pointer-events: none;
}
.world-headline h1 {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  line-height: 1.15;
  margin-bottom: 0.5rem;
}
.world-headline h1 .highlight { color: var(--wf-primary); }
.world-headline p {
  color: var(--wf-text-muted);
  font-size: clamp(0.9rem, 1.6vw, 1.05rem);
  margin-bottom: 1rem;
  text-shadow: 0 1px 8px var(--wf-bg);
}
.world-headline .wf-btn { pointer-events: auto; }

/* ---------- Hint chip ---------- */
.world-hint {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: color-mix(in srgb, var(--wf-surface) 82%, transparent);
  border: 1px solid var(--wf-border);
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-size: 0.8rem;
  color: var(--wf-text-muted);
  backdrop-filter: blur(6px);
  pointer-events: none;
  transition: opacity 0.8s;
  white-space: nowrap;
}
.world-hint.hidden { opacity: 0; }

/* ---------- Floating top toolbar ---------- */
/* Floats below the header instead of docking to the bottom edge, so the
   reCAPTCHA badge (bottom-right) stays visible. */
.world-dock {
  position: fixed;
  top: 4.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 0.3rem;
  padding: 0.35rem;
  max-width: calc(100vw - 1.6rem);
  background: color-mix(in srgb, var(--wf-surface) 82%, transparent);
  border: 1px solid var(--wf-border);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px var(--wf-shadow);
  overflow-x: auto;
  scrollbar-width: none;
}
.world-dock::-webkit-scrollbar { display: none; }
.world-dock button {
  flex: 0 0 auto;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--wf-text-muted);
  font: 500 0.8rem 'Space Grotesk', 'Zen Kaku Gothic New', system-ui, sans-serif;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
}
.world-dock button:hover,
.world-dock button:focus-visible {
  color: var(--wf-primary);
  border-color: var(--wf-primary);
  background: var(--wf-primary-dim);
}
.world-dock button.dock-contact {
  color: var(--wf-bg);
  background: var(--wf-primary);
  font-weight: 700;
}
.world-dock button.dock-contact:hover { opacity: 0.85; }

/* ---------- Content modals ---------- */
dialog.world-modal {
  width: min(720px, calc(100vw - 2rem));
  max-height: min(82vh, 900px);
  border: 1px solid var(--wf-border);
  border-radius: 12px;
  background: var(--wf-surface);
  color: var(--wf-text);
  padding: 0;
  box-shadow: 0 24px 64px var(--wf-shadow);
}
dialog.world-modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}
dialog.world-modal[open] { animation: modal-in 0.22s ease-out; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.world-modal-inner {
  padding: 2rem;
  overflow-y: auto;
  max-height: inherit;
}
.world-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}
.world-modal-header h2 {
  font-size: 1.5rem;
  line-height: 1.25;
}
.world-modal-close {
  flex: 0 0 auto;
  background: none;
  border: 1px solid var(--wf-border);
  border-radius: 50%;
  width: 36px; height: 36px;
  color: var(--wf-text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.world-modal-close:hover { color: var(--wf-primary); border-color: var(--wf-primary); }
.world-modal-lead { color: var(--wf-text-muted); margin-bottom: 1.3rem; }

.world-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}
.world-modal-grid article {
  border: 1px solid var(--wf-border);
  border-radius: var(--wf-radius);
  padding: 0.9rem 1rem;
  background: var(--wf-bg);
}
.world-modal-grid h3 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  color: var(--wf-primary);
}
.world-modal-grid p { font-size: 0.85rem; color: var(--wf-text-muted); line-height: 1.5; }

.world-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.world-live-slot { margin-bottom: 1rem; }

/* ---------- No-WebGL / no-JS fallback ---------- */
.world-fallback { display: none; }
body.no-webgl #world, body.no-webgl .world-hint { display: none; }
body.no-webgl { overflow: auto; }
body.no-webgl .world-fallback {
  display: block;
  position: relative;
  z-index: 5;
  max-width: 640px;
  margin: 7rem auto 3rem;
  padding: 0 1.5rem;
  text-align: center;
}
body.no-webgl .world-headline { position: static; margin: 0 auto; max-width: 640px; }

/* ---------- Footer strip ---------- */
/* Bottom-left, so the bottom-right corner stays free for the reCAPTCHA badge */
.world-legal {
  position: fixed;
  left: 1.6rem;
  bottom: calc(0.7rem + env(safe-area-inset-bottom));
  z-index: 9;
  font-size: 0.7rem;
  color: var(--wf-text-muted);
  opacity: 0.8;
}
.world-legal a { color: var(--wf-text-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .world-headline {
    left: 1rem;
    right: 1rem;
    bottom: 2.2rem;
    max-width: none;
  }
  .world-hint { display: none; }
  .world-modal-grid { grid-template-columns: 1fr; }
  .world-modal-inner { padding: 1.4rem; }
  .world-legal { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  dialog.world-modal[open] { animation: none; }
}
