/* Spherical gallery — phantom.land-style chrome over a WebGL sphere */

:root {
  --bg: #000000;
  --card: #161616;
  --ink: #ffffff;
  --muted: #9b9b9b;
  --faint: #5c5c5c;
  --line: rgba(255, 255, 255, 0.16);
  /* blit.studio typo: one family (Archivo), regular/medium weights, no Black, no mono */
  --font-display: "Archivo", system-ui, sans-serif;
  --font-sans: "Archivo", system-ui, sans-serif;
  --font-mono: "Archivo", system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: clamp(1rem, 2.5vw, 2rem);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  overflow: hidden;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
/* blit typo: headings use Archivo medium, not the UA bold default (700 isn't loaded) */
h1, h2, h3, h4, h5, h6 { font-weight: 500; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

/* ---------- WebGL mount ---------- */
#webgl {
  position: fixed;
  inset: 0;
  z-index: 1;
  cursor: grab;
  touch-action: none;
}
#webgl.dragging { cursor: grabbing; }
#webgl.hovering { cursor: pointer; }

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.6) 100%);
}

/* ---------- chrome ---------- */
.chrome {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: var(--pad);
  pointer-events: none;
}
.chrome > * { pointer-events: auto; }
.chrome-top { top: 0; align-items: flex-start; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.logo svg { transition: transform 0.6s var(--ease); }
.logo:hover svg { transform: rotate(90deg); }
.logo-dot { color: var(--accent); }

.topcenter {
  display: flex;
  align-items: flex-start;
  gap: clamp(1.25rem, 3.5vw, 3.5rem);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: -0.01em;
  line-height: 1.55;
  text-transform: lowercase;
}
.topcenter .blurb { color: var(--ink); text-align: center; }
.topcenter .clocks { color: var(--muted); }
.topcenter .dot {
  display: inline-block;
  width: 5px; height: 5px;
  margin-right: 0.45em;
  border-radius: 50%;
  background: #59ff8e;
  vertical-align: 1px;
}

/* pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: lowercase;
  white-space: nowrap;
}
.pill-solid {
  background: var(--ink);
  color: #0a0a0a;
  padding: 0.7rem 1.35rem;
  transition: transform 0.45s var(--ease), background 0.25s;
}
.pill-solid:hover { transform: scale(1.05); background: #e8e8e8; }
.pill-ghost {
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.6rem 1.2rem;
  transition: border-color 0.25s, background 0.25s;
}
.pill-ghost:hover { border-color: var(--ink); background: rgba(255, 255, 255, 0.06); }

/* ---------- detail overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--bg);
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
}
.overlay-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 3rem);
}
.overlay-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(2rem, 6vh, 4rem);
}
.overlay-index { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); letter-spacing: -0.01em; }
.overlay-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 8vw, 6.5rem);
  line-height: 0.95;
  text-transform: lowercase;
  letter-spacing: -0.01em;
}
.overlay-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: -0.01em;
  text-transform: lowercase;
  margin: 1.1rem 0 2rem;
}
.overlay-figure {
  border: 1px solid var(--line);
  background: var(--card);
  margin-bottom: 2rem;
}
.overlay-figure img { display: block; width: 100%; max-height: 62vh; object-fit: cover; }
.overlay-blurb { font-size: clamp(1.1rem, 2.2vw, 1.5rem); font-weight: 500; max-width: 34ch; margin-bottom: 1.25rem; }

/* ---------- loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.9rem;
  background: var(--bg);
}
.loader-mark { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; letter-spacing: -0.01em; }
.loader-track { width: 160px; height: 1px; background: rgba(255, 255, 255, 0.18); }
.loader-bar { width: 0%; height: 100%; background: var(--ink); transition: width 0.3s var(--ease); }
.loader-pct { font-family: var(--font-mono); font-size: 0.6rem; color: var(--muted); letter-spacing: -0.01em; }

/* ---------- fallback (no WebGL / script failure) ---------- */
.fallback {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  overflow-y: auto;
  padding: clamp(1.5rem, 5vw, 4rem);
  background: var(--bg);
}
.fallback.show { display: block; }
.fallback h1 { font-family: var(--font-display); text-transform: lowercase; margin-bottom: 2rem; }
.fallback-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.fallback-grid a { border: 1px solid var(--line); background: var(--card); padding: 0.5rem; }
.fallback-grid img { display: block; width: 100%; height: auto; }
.fallback-grid p { font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: -0.01em; text-transform: lowercase; padding: 0.6rem 0.25rem 0.2rem; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .topcenter .blurb, .topcenter .clocks { display: none; }
}
@media (max-width: 600px) {
  .logo span { display: none; }
  .pill-solid, .pill-ghost { padding: 0.5rem 0.85rem; font-size: 0.72rem; }
  .chrome { gap: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============================================================
   MK Studio brand layer + embed mode
   Added so the sphere reads as native MK Studio: the single coral
   accent (#ff3b1f) over the "lights-off" black, plus the tweaks that
   let it run inside the homepage's full-screen overlay (?embed=1).
   ============================================================ */
:root { --accent: #ff3b1f; }

/* coral accents */
.loader-bar { background: var(--accent); }
:focus-visible { outline-color: var(--accent); }
.overlay-meta { color: var(--accent); }
.overlay-index { color: var(--accent); }
.topcenter .dot { background: var(--accent); }
.pill-ghost:hover { border-color: var(--accent); color: var(--accent); background: rgba(255, 59, 31, 0.08); }

/* solid pills (Open project, Let’s Talk) → coral */
.pill-solid { background: var(--accent); color: #0a0a0a; }
.pill-solid:hover { background: #ff5638; transform: scale(1.05); }

/* overlay action cluster: "Open project" + running index */
.overlay-actions { display: flex; align-items: center; gap: clamp(0.75rem, 2vw, 1.25rem); }
#ovOpen { letter-spacing: -0.01em; }

/* embed mode — running inside the homepage overlay */
.sg-embed .logo { pointer-events: none; }              /* brand mark only; host owns navigation */
.sg-embed .chrome-top > .pill-solid { display: none; } /* hide standalone "Let's Talk" (host has its own close) */
.sg-embed-close { display: none; }
.sg-embed .sg-embed-close { display: inline-flex; }
