/* assets/responsive.css
   Global mobile responsiveness + navigation toggle.
   Safe to include on every page.
*/

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

/* Prefer dynamic viewport units on mobile (prevents "100vh jump" when address bar shows/hides) */
@supports (height: 100dvh) {
  #spa-shell { min-height: 100dvh; }
}

/* Make media flexible by default */
img, video, iframe {
  max-width: 100%;
  height: auto;
}

/* Embed (itch.io) – keep the fixed height but make width fluid */
iframe[src*="itch.io/embed"] {
  width: 100% !important;
  max-width: 552px;
  height: 167px;
  display: block;
  margin: 0 auto;
}

/* Mobile-friendly tap targets */
a, button {
  touch-action: manipulation;
}

/* =========================
   Responsive Navigation
   ========================= */

.nav-toggle {
  display: none;
  appearance: none;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.2);
  color: inherit;
  border-radius: 10px;
  padding: 10px 12px;
  line-height: 0;
  cursor: pointer;
  user-select: none;
}

.nav-toggle:focus-visible {
  outline: 2px solid rgba(0, 243, 255, 0.6);
  outline-offset: 2px;
}

/* Hamburger icon */
.nav-toggle .nav-toggle-icon {
  display: inline-block;
  width: 22px;
  height: 14px;
  position: relative;
}
.nav-toggle .nav-toggle-icon::before,
.nav-toggle .nav-toggle-icon::after,
.nav-toggle .nav-toggle-icon span {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  opacity: 0.9;
}
.nav-toggle .nav-toggle-icon::before { top: 0; }
.nav-toggle .nav-toggle-icon span { top: 6px; }
.nav-toggle .nav-toggle-icon::after { top: 12px; }

@media (max-width: 900px) {
  /* Ensure sticky nav doesn't overlap notch */
  nav {
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    flex-wrap: wrap;
    gap: 10px;
  }

  /* Show toggle */
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Make the logo shrink instead of forcing overflow */
  .logo {
    min-width: 0;
    flex: 1 1 auto;
  }
  /* Keep logo + toggle on the same row */
  .logo {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav-toggle {
    margin-left: auto;
  }

  .logo img {
    width: 36px;
    height: 36px;
  }

  /* Default: menu hidden (page CSS already does this, but keep explicit) */
  nav .nav-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 14px;
    padding: 10px 0 6px;
  }

  /* Open state */
  nav.nav-open .nav-menu {
    display: flex !important; /* override page-level @media rules */
  }

  nav .nav-menu a {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
  }

  /* Reduce large vertical padding that feels huge on phones */
  header { padding: 56px 16px 28px !important; }
  .container { padding-left: 16px !important; padding-right: 16px !important; }
}

/* Prefer no animation if user requests it */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
