/* Phone-only "frosted glass" look (Leonardo-style) for nav, dropdown boxes,
 * menus and secondary buttons.
 *
 * PURELY VISUAL. This file may only change colour, background, backdrop
 * blur, border COLOUR, box-shadow and text-shadow. It must never change
 * size, padding, margin, border width, font weight, position, display,
 * order, outline (focus rings) or anything a script reads. Focus and
 * scroll behaviour on these pages has been tuned carefully.
 *
 * Every box-shadow on a focusable control sits behind :not(:focus-visible),
 * so any focus ring built from box-shadow is never overwritten.
 *
 * backdrop-filter is only put on small leaf controls (tiles, buttons, the
 * tab pill), never on page containers: on a container it would change
 * where position:fixed children sit.
 *
 * Readability first: text is bright white with a soft dark text-shadow so
 * it stays legible over busy art. If it ever reads poorly, make the glass
 * DARKER (raise the tint alpha), not lighter.
 *
 * Desktop is untouched: every rule sits inside max-width: 767px.
 */
@media (max-width: 767px) {
  :root {
    /* tile = light sheen on top of a thin dark tint, so art shows through */
    --glass-tile:
      linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.05) 100%),
      rgba(20, 22, 28, 0.30);
    --glass-tile-active:
      linear-gradient(180deg, rgba(255, 255, 255, 0.30) 0%, rgba(255, 255, 255, 0.14) 100%),
      rgba(20, 22, 28, 0.25);
    --glass-pill: rgba(14, 16, 20, 0.34);
    --glass-panel: rgba(14, 16, 20, 0.46);
    --glass-edge: rgba(255, 255, 255, 0.28);
    --glass-edge-strong: rgba(255, 255, 255, 0.55);
    --glass-blur: blur(20px) saturate(170%);
    --glass-glow:
      inset 0 1px 0 rgba(255, 255, 255, 0.25),
      0 0 18px rgba(255, 255, 255, 0.07),
      0 6px 18px rgba(0, 0, 0, 0.28);
    --glass-text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  }

  /* ── Tab pill (the rounded bar around the tabs) ── */
  .fm-tabs-bar,
  .fm-tabs-mobile-bar {
    background: var(--glass-pill) !important;
    border-color: var(--glass-edge) !important;
    box-shadow: 0 0 22px rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.3) !important;
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }
  /* the strip behind the pill: see-through so art can scroll under softly */
  .fm-tabs-wrap,
  .sticky-header { background: rgba(11, 13, 16, 0.62) !important; }

  /* ── Each tab is its own glass tile ── */
  .fm-tab,
  .fm-tab-mobile {
    color: #ffffff !important;
    background: var(--glass-tile) !important;
    text-shadow: var(--glass-text-shadow);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }
  .fm-tab:not(:focus-visible),
  .fm-tab-mobile:not(:focus-visible) {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
  }
  .fm-tab.fm-tab-active,
  .fm-tab-mobile.fm-tab-mobile-active { background: var(--glass-tile-active) !important; }
  .fm-tab.fm-tab-active:not(:focus-visible),
  .fm-tab-mobile.fm-tab-mobile-active:not(:focus-visible) {
    box-shadow: inset 0 0 0 1px var(--glass-edge-strong), 0 0 14px rgba(255, 255, 255, 0.18) !important;
  }

  /* ── Artifacts: Product / Style / Bag colour boxes ── */
  #generatorCard { background: var(--glass-panel) !important; }
  #compactControls .cc-select {
    background: var(--glass-tile) !important;
    border-color: var(--glass-edge) !important;
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }
  #compactControls .cc-select .cc-label { color: #F0F3F6 !important; text-shadow: var(--glass-text-shadow); }
  #compactControls .cc-select .cc-value { color: #ffffff !important; text-shadow: var(--glass-text-shadow); }
  #compactControls .cc-select .cc-chevron::before { border-color: #ffffff !important; }
  #compactControls .cc-select[aria-expanded="true"] { border-color: var(--accent) !important; }
  #compactControls .cc-select[aria-expanded="true"] .cc-chevron::before { border-color: var(--accent) !important; }

  /* "Use your photo" / whichever mode button is NOT picked (picked = orange).
     Also the sticker "How many?" and "Size" choices that aren't picked, so
     they read as tappable options like the tabs (owner request 2026-12-01). */
  #modeChoices .cc-seg-btn[data-active="false"],
  .buy-box-seg .cc-seg-btn[data-active="false"] {
    background: var(--glass-tile) !important;
    border-color: var(--glass-edge) !important;
    color: #ffffff !important;
    text-shadow: var(--glass-text-shadow);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }
  #compactControls .cc-select:not(:focus-visible),
  #modeChoices .cc-seg-btn[data-active="false"]:not(:focus-visible),
  .buy-box-seg .cc-seg-btn[data-active="false"]:not(:focus-visible) {
    box-shadow: var(--glass-glow) !important;
  }

  /* ── Header buttons (hamburger, Sign in, credits, cart, bag, account) ──
     My Library's Sign in is the orange primary CTA, so it is left alone.
     Text colour is left as-is: focus rings follow it. */
  .nav-menu-btn,
  body:not(:has(nav.topnav)) .nav-login-btn,
  .credit-pill,
  body:not(:has(nav.topnav)) .nav-cart-btn,
  .nav-bag-btn,
  .nav-account-btn {
    background: var(--glass-tile) !important;
    border-color: var(--glass-edge) !important;
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }

  /* ── Secondary / ghost buttons and pills ── */
  .discover-chip,
  .hero-order-pill,
  .pill,
  .inspo-nav,
  .gallery-nav,
  .worlds-state-btn.secondary,
  .world-tile-btn:not(.world-tile-remix):not(.world-tile-bag) {
    background: var(--glass-tile) !important;
    border-color: var(--glass-edge) !important;
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }

  /* ── Drop-down menus: kept SOLID dark glass. Testing showed any
     see-through let page text ghost behind the menu rows. ── */
  .nav-dropdown,
  .nav-account-dropdown,
  .cc-menu {
    background: linear-gradient(180deg, #1A1D23 0%, #0E1014 100%) !important;
    border-color: var(--glass-edge) !important;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.06), 0 12px 30px rgba(0, 0, 0, 0.5) !important;
  }
}

/* No blur support: fall back to solid dark so text never sits on clear
   glass over busy art. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  @media (max-width: 767px) {
    :root {
      --glass-tile: #2A2F37;
      --glass-tile-active: #3A404A;
      --glass-pill: #12151A;
      --glass-panel: #12161B;
    }
    .fm-tabs-wrap, .sticky-header { background: #0B0D10 !important; }
  }
}
