/* ==========================================================================
   Luna — Ibiza Hikes · mobile.css
   --------------------------------------------------------------------------
   Ibiza Bohemia poster on mobile. Chunky tab bar with inked underline, true
   bottom sheet for the Lucky Dip, safe-area-inset padding on every fixed
   element. Everything keeps the 2px ink borders and 3–4px hard drop-shadow
   so the vocabulary holds together.
   Loaded last so these rules win.
   ========================================================================== */

html, body {
  min-height: 100%;
  min-height: 100svh;
  overscroll-behavior-y: none;
}

body { padding-bottom: env(safe-area-inset-bottom, 0px); }

.app {
  padding-top: calc(var(--nav-h-mobile) + 28px);
  padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 901px) {
  .app {
    padding-top: calc(var(--nav-h) + 32px);
    padding-bottom: 96px;
  }
}

/* --------------------------------------------------------------------------
   Bottom tab bar (mobile only)
   -------------------------------------------------------------------------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 10px max(12px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-right));
  background: var(--paper);
  border-top: 2px solid var(--ink);
}

.tabbar__item,
.tabbar__dice {
  background: transparent;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  min-height: 54px;
  color: var(--ink-soft);
  font-family: var(--font-mono-caps);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-wider);
  text-decoration: none;
  transition: color var(--t-fast) ease;
}

.tabbar__item:active { opacity: 0.7; }

.tabbar__icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  color: currentColor;
}
.tabbar__icon svg { width: 100%; height: 100%; }

.tabbar__item.is-active,
.tabbar__item[aria-current="page"] {
  color: var(--magenta);
}

.tabbar__dice {
  background: var(--magenta);
  color: var(--bone);
  border: 2px solid var(--ink);
  border-radius: var(--r-pill);
  min-height: 48px;
  margin: 0 6px;
  box-shadow: 3px 3px 0 var(--ink);
}
.tabbar__dice .tabbar__dice-glyph { width: 22px; height: 22px; display: inline-flex; }
.tabbar__dice .tabbar__dice-glyph svg { width: 100%; height: 100%; color: currentColor; }
.tabbar__label--dice { display: none; }

/* Hide on desktop */
@media (min-width: 901px) {
  .tabbar { display: none; }
}

/* Hide the top nav's dice button on mobile (tab bar replaces it) */
@media (max-width: 900px) {
  .nav {
    padding: 10px 16px;
    gap: 10px;
  }
  .nav__sub { display: none; }
  .nav__links { display: none; }
  .nav__dice { display: none; }
  .nav__title { font-size: 1.3rem; }
}

/* --------------------------------------------------------------------------
   Hikes page — mobile filter row + grid
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .filter-bar {
    position: sticky;
    top: calc(var(--nav-h-mobile) + 2px);
    z-index: 20;
    background: var(--paper);
    margin: 0 -16px 24px;
    padding: 12px 16px;
    border-top: 0;
    border-bottom: 2px solid var(--ink);
  }

  .filter-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    align-items: center;
  }
  .filter-row::-webkit-scrollbar { display: none; }

  .filter-row .filter-group {
    flex: 0 0 auto;
    min-width: max-content;
  }

  .filter-row .filter-group__label { display: none; }

  .filter-row .filter-group__chips,
  .filter-row .chip-row {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .view-toggle {
    margin-top: 12px;
  }

  .trail-grid {
    grid-template-columns: 1fr;
    column-gap: 20px;
    row-gap: 48px;
  }
}

/* --------------------------------------------------------------------------
   Map page mobile
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .map-page__filters { display: none; }

  .map-wrapper,
  .map,
  #full-map {
    height: calc(100svh - 170px);
    min-height: 480px;
    margin-inline: -16px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .map-fab {
    position: fixed;
    right: 14px;
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--ink);
    color: var(--butter);
    border: 2px solid var(--ink);
    border-radius: var(--r-pill);
    box-shadow: 3px 3px 0 var(--magenta);
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-transform: none;
    min-height: 46px;
    cursor: pointer;
    transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease;
  }
  .map-fab:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--magenta);
  }
  .map-fab__count {
    font-family: var(--font-display);
    font-weight: 800;
    opacity: 0.95;
  }
}

@media (min-width: 901px) {
  .map-fab { display: none; }
}

/* --------------------------------------------------------------------------
   Detail page mobile
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .detail {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  /* Branded SVG hero — full-bleed on mobile, capped at 42vh per spec. */
  .hike-hero {
    margin-inline: -16px;
    margin-bottom: 24px;
    aspect-ratio: 4 / 3;
    max-height: 42vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }
  .hike-hero__img {
    max-height: 42vh;
  }

  /* Featured strip collapses to a single column — the Polaroid tilt stays
     but individual cards go full-width. */
  .featured-photos {
    margin: 24px 0 32px;
  }
  .featured-photos__grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .featured-photos__item {
    --tilt: -1.5deg;
  }
  .featured-photos__item:nth-child(3n+2) { --tilt: 1.5deg; }
  .featured-photos__item img {
    aspect-ratio: 4 / 3;
  }

  .detail__name,
  .detail__title { font-size: clamp(2.25rem, 12vw, 3.75rem); }

  .detail__stats {
    grid-template-columns: 1fr 1fr;
  }
  .detail__stat {
    border-right: 1.5px solid var(--ink);
    border-bottom: 1.5px solid var(--ink);
  }
  .detail__stat:nth-child(2n) { border-right: 0; }
  .detail__stat:nth-last-child(-n+2) { border-bottom: 0; }

  .detail__description {
    column-width: auto;
    column-count: 1;
  }

  .detail__cta {
    position: sticky;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    z-index: 25;
    margin-inline: -16px;
    padding: 14px 16px;
    background: var(--paper);
    border-top: 2px solid var(--ink);
    margin-top: 32px;
  }
  .detail__cta .btn { width: 100%; }
}

/* --------------------------------------------------------------------------
   Dip sheet mobile
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .dip-sheet__panel {
    max-height: 88dvh;
    width: 100%;
    max-width: none;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 12px 20px 0;
    margin: 0;
    transform: translateY(100%);
    transition: transform var(--t-slow) var(--ease-spring), opacity var(--t-slow) ease;
  }

  .dip-sheet[aria-hidden="false"] .dip-sheet__panel {
    transform: translateY(0);
    opacity: 1;
  }
  .dip-sheet[aria-hidden="true"] .dip-sheet__panel {
    transform: translateY(100%);
    opacity: 0.6;
  }

  .dip-sheet__handle {
    display: block;
    width: 48px;
    height: 4px;
    border-radius: var(--r-pill);
    background: var(--ink);
    opacity: 0.45;
    margin: 4px auto 10px;
  }

  .dip-sheet__footer {
    position: sticky;
    bottom: 0;
    background: var(--paper);
    padding: 14px 0 calc(16px + env(safe-area-inset-bottom, 0px));
    margin: 0 -20px;
    padding-inline: 20px;
  }
  .dip-sheet__footer .btn { flex: 1; min-height: 50px; }
  .dip-sheet__footer .btn--ghost { flex: 0 0 30%; }
}

@media (min-width: 901px) {
  .dip-sheet__handle { display: none; }
}

/* Body scroll lock while sheet is open */
html.is-sheet-open,
html.is-sheet-open body {
  overflow: hidden !important;
  touch-action: none;
}
html.is-sheet-open body { position: fixed; width: 100%; }

/* Tarot-stack vertical on mobile */
@media (max-width: 700px) {
  .tarot-stack {
    flex-direction: column;
    align-items: center;
    gap: 40px;
  }
  .tarot { --w: min(300px, 85%); }
}

/* Photos-block mobile */
@media (max-width: 700px) {
  .photos-block {
    padding: 56px 16px 80px;
  }
}

/* --------------------------------------------------------------------------
   Hero dice mobile — chips wrap, Roll button is full-width below them.
   -------------------------------------------------------------------------- */

@media (max-width: 700px) {
  .hero-dice {
    padding: 36px 16px 44px;
  }
  .hero-dice__title {
    font-size: clamp(2.75rem, 14vw, 4.5rem);
  }
  .hero-dice__sub {
    font-size: 1rem;
  }
  .hero-dice__bar {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }
  .hero-dice__chips {
    gap: 8px;
  }
  .hero-dice__chip-summary {
    /* Keep tap targets ≥ 44 px and let the chip span more horizontal space
       when it wraps onto its own line. */
    min-height: 46px;
    padding: 11px 16px;
  }
  .hero-dice__roll {
    width: 100%;
    min-height: 56px;
  }
  .hero-dice__menu {
    /* On mobile, anchor the menu so it doesn't overflow the viewport. */
    left: 0;
    right: auto;
    min-width: min(280px, calc(100vw - 48px));
  }
  /* Keep the SVG backdrop visible but a touch lighter on mobile so type
     reads against the wash. */
  .hero-dice__bg { opacity: 0.55; }
}

@media (max-width: 360px) {
  .hero-dice__chip-summary {
    font-size: 0.8125rem;
    padding: 10px 12px;
  }
}

/* Toast above the tab bar */
@media (max-width: 900px) {
  .toast {
    bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
    right: 16px !important;
    left: 16px !important;
    max-width: none;
    text-align: center;
  }
}

/* Tap highlight */
a, button {
  -webkit-tap-highlight-color: rgba(232, 69, 125, 0.15);
}

/* Hover-only guards for touch devices — neutralise the lift on tap so it
   doesn't stick on the :hover state after a touch. */
@media (hover: none), (pointer: coarse) {
  .trail-card:hover,
  .vibe-card:hover,
  .tarot:hover,
  .featured-photos__item:hover,
  .region-tile:hover,
  .map-preview:hover,
  .btn:hover { transform: none; animation: none; }
}

/* iOS momentum scrolling */
.dip-sheet__body,
.photos-rail,
.detail__gallery-strip,
.gallery-strip,
.filter-row { -webkit-overflow-scrolling: touch; }
