/* ==========================================================================
   AUSR — High-End Studio Aesthetic (Mobile Glitch & Bottom Text Fix)
   ========================================================================== */

:root {
  --bg-main: #f8fafc;
  --text-primary: #09090b;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --font-display: 'Space Grotesk', 'Syne', 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-syne: 'Syne', sans-serif;
  --font-outfit: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Architectural Studio Grid Overlay
   ========================================================================== */

.grid-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 2;
  pointer-events: none;
  background-image: 
    linear-gradient(rgba(15, 23, 42, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.025) 1px, transparent 1px);
  background-size: 80px 80px;
  background-position: center center;
}

/* ==========================================================================
   3D Low-Poly Archipelago Background Canvas
   ========================================================================== */

#archipelago-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1;
  pointer-events: none;
}

/* ==========================================================================
   Viewport Architectural Layout
   ========================================================================== */

.viewport-layout {
  position: relative;
  z-index: 10;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem 3.5rem;
  padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  z-index: 50;
}

.coords-wrapper {
  display: inline-block;
  min-width: 260px;
  min-height: 28px;
  cursor: pointer;
  padding: 0.2rem 0;
}

.meta-item {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  transition: color 0.3s ease;
}

#coords-badge {
  display: inline-block;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

.coords-wrapper:hover #coords-badge {
  color: var(--text-primary);
}

.font-mono {
  font-family: var(--font-mono);
}

.tracking-wide {
  letter-spacing: 0.28em;
}

.bar:hover .meta-item {
  color: var(--text-primary);
}

/* ==========================================================================
   Hero Brand Typography & Desktop Digital Glitch Effect
   ========================================================================== */

.hero {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  overflow: visible;
}

.wordmark-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 100%;
  overflow: visible;
  cursor: pointer;
}

#wordmark {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(4rem, 17vw, 14rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1.15;
  text-transform: uppercase;
  margin: 0;
  padding: 0.25em 0.15em;
  white-space: nowrap;
  color: #09090b;
  
  /* Obsidian Fill Gradient */
  background: linear-gradient(
    135deg,
    #09090b 0%,
    #18181b 35%,
    #334155 50%,
    #18181b 65%,
    #09090b 100%
  );
  background-size: 250% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  
  filter: drop-shadow(0 20px 40px rgba(255, 255, 255, 0.95)) drop-shadow(0 15px 30px rgba(0, 0, 0, 0.08));
  transition: letter-spacing 0.4s ease, filter 0.4s ease;
}

/* Desktop Glitch Pseudo-elements */
#wordmark::before,
#wordmark::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: inherit;
  margin: inherit;
  font-size: inherit;
  font-family: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  white-space: nowrap;
  background: transparent;
  pointer-events: none;
  opacity: 0;
  box-sizing: border-box;
}

#wordmark::before {
  color: #09090b;
  -webkit-text-fill-color: #09090b;
  text-shadow: -2px 0 #ef4444;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

#wordmark::after {
  color: #09090b;
  -webkit-text-fill-color: #09090b;
  text-shadow: 2px 0 #3b82f6;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

.wordmark-wrapper:hover #wordmark::before,
#wordmark.glitching::before {
  opacity: 0.9;
  animation: glitch-anim-1 0.4s steps(2, end) infinite;
}

.wordmark-wrapper:hover #wordmark::after,
#wordmark.glitching::after {
  opacity: 0.9;
  animation: glitch-anim-2 0.4s steps(2, end) infinite;
}

@keyframes glitch-anim-1 {
  0% {
    clip-path: polygon(0 10%, 100% 10%, 100% 35%, 0 35%);
    transform: translate(-2px, -1px);
  }
  20% {
    clip-path: polygon(0 40%, 100% 40%, 100% 60%, 0 60%);
    transform: translate(2px, 1px);
  }
  40% {
    clip-path: polygon(0 15%, 100% 15%, 100% 30%, 0 30%);
    transform: translate(-1px, 1px);
  }
  60% {
    clip-path: polygon(0 65%, 100% 65%, 100% 85%, 0 85%);
    transform: translate(1px, -1px);
  }
  80% {
    clip-path: polygon(0 5%, 100% 5%, 100% 25%, 0 25%);
    transform: translate(-1px, 0);
  }
  100% {
    clip-path: polygon(0 50%, 100% 50%, 100% 75%, 0 75%);
    transform: translate(1px, -1px);
  }
}

@keyframes glitch-anim-2 {
  0% {
    clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
    transform: translate(2px, 1px);
  }
  20% {
    clip-path: polygon(0 20%, 100% 20%, 100% 45%, 0 45%);
    transform: translate(-2px, -1px);
  }
  40% {
    clip-path: polygon(0 70%, 100% 70%, 100% 90%, 0 90%);
    transform: translate(1px, -1px);
  }
  60% {
    clip-path: polygon(0 30%, 100% 30%, 100% 50%, 0 50%);
    transform: translate(-1px, 1px);
  }
  80% {
    clip-path: polygon(0 80%, 100% 80%, 100% 95%, 0 95%);
    transform: translate(1px, 0);
  }
  100% {
    clip-path: polygon(0 10%, 100% 10%, 100% 40%, 0 40%);
    transform: translate(-1px, 1px);
  }
}

/* ==========================================================================
   Mobile Devices (< 768px) — Clean Typography & 100% Guaranteed Footer
   ========================================================================== */

@media (max-width: 768px) {
  .viewport-layout {
    padding: 1.2rem 1rem max(1.8rem, env(safe-area-inset-bottom, 1.8rem)) 1rem;
    height: 100dvh;
    min-height: -webkit-fill-available;
  }

  .grid-overlay {
    background-size: 50px 50px;
  }
  
  #wordmark {
    font-size: clamp(2.8rem, 16vw, 6.5rem);
    letter-spacing: -0.04em;
    padding: 0.1em 0.05em;
  }

  /* DISABLE RGB Text Glitch Pseudo-elements on Mobile to prevent odd distortion */
  #wordmark::before,
  #wordmark::after {
    display: none !important;
    animation: none !important;
  }

  /* Sleek clean pulse on mobile tap/touch */
  .wordmark-wrapper:active #wordmark,
  #wordmark.glitching {
    transform: scale(1.02);
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.15));
  }

  .bottom-bar {
    position: relative !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    z-index: 999 !important;
    margin-top: auto;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0.5rem));
  }

  .bottom-bar .meta-item {
    font-size: 0.62rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.12em !important;
    color: #09090b !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .coords-wrapper {
    min-width: 180px;
  }

  .tracking-wide {
    letter-spacing: 0.14em !important;
  }
}
