/* ═══════════════════════════════════════════════════════════════════════════
   Beat Studio and Vocal Studio inside the native app.

   The app opens /beat-studio/ and /vocal-studio/ in a WebView (src/components/studios in the app repo) and its
   header already says the name and has Done, so the website around the studio has to go: it is a tool, not a
   page of a site. Loaded on those two pages only (includes/shortcodes-modules/beat_studio/studio-app.php).

   Every rule starts with html:is(.bh-app-link,.bh-app-text,.bh-app-hidden): the class includes/app-mode.php's head
   script puts on <html> on the client, from the address the app opened or the tab's memory. The page cache keeps
   one HTML for everybody, so a visitor outside the app gets this file and not one rule of it applies.
   !important where the theme's own sheet, the template's inline sheet or a studio sheet that prints later would
   win (the theme forces #main p, #main h1-h4; bh-full-page.php sets html,body and #bh-page-root inline).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. The website around the studio ────────────────────────────────────────
   Header and slide menu, footer, WordPress admin bar (staff sessions), the site's players (the studios play their
   own audio, and a second player would play on top of it), the community strip under Beat Studio, breadcrumbs, app
   banners, cookie and chat widgets, and the links of Vocal Studio's home that lead back to the website. */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) :is(
  nav.bh-topnav, #bh-slide-backdrop, #bh-slide-menu, footer.bh-site-footer, #wpadminbar,
  #bh-gp, #bh-vault-player, #bh-fp, section.bh-cbeats,
  .breadcrumbs, .breadcrumb, #breadcrumbs, nav[aria-label="Breadcrumb"], .woocommerce-breadcrumb, .rank-math-breadcrumb, .yoast-breadcrumbs,
  .bh-app-banner, [class*="app-banner"], [id*="app-banner"], [class*="install-banner"], [class*="install-prompt"],
  #cookie-law-info-bar, #cookie-notice, .cookie-notice-container, .cmplz-cookiebanner, #CybotCookiebotDialog, #onetrust-consent-sdk, #moove_gdpr_cookie_info_bar, .cc-window,
  #tidio-chat, #crisp-chatbox, .crisp-client, #hubspot-messages-iframe-container, .intercom-lightweight-app, #intercom-container, .tawk-min-container, #tawkchat-container, .fb_dialog, .fb-customerchat, .joinchat, #ht-ctc-chat,
  #pojo-a11y-toolbar, .om-holder, .woocommerce-store-notice,
  #bh-vs .vs-home-preview, #bh-vs .vs-home-features, #bh-vs .vs-section-viewall,
  #bh-vs #bh-vs-community
){ display:none !important; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden){ margin-top:0 !important; }

/* ── 2. The page: the app's own dark, edge to edge, still ───────────────────
   #040406 is the app's page color (role.background), so the WebView's own background, the page and the studio
   read as one screen and nothing flashes white while the page paints. */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden){
  --bh-app-bg:#040406;
  /* Vocal Studio sizes its panel as 100dvh minus this (vocal-studio.css); engine.js measures the same top offset. */
  --vs-nav-h:env(safe-area-inset-top,0px);
  color-scheme:dark;
  background:var(--bh-app-bg) !important;
  /* No page bounce or pull-to-refresh, no double-tap or pinch zoom, no text inflation, no grey tap flash. */
  overscroll-behavior:none;
  touch-action:pan-x pan-y;
  -webkit-text-size-adjust:100%; text-size-adjust:100%;
  -webkit-tap-highlight-color:transparent;
}
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) body{
  background:var(--bh-app-bg) !important;
  overscroll-behavior:none;
  /* No long-press callout, selection loupe or drag ghost on the controls; fields keep theirs (below). */
  -webkit-touch-callout:none; -webkit-user-select:none; user-select:none;
}
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) :is(input,textarea,select,[contenteditable="true"]){
  -webkit-user-select:text; user-select:text; -webkit-touch-callout:default;
}
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) :is(a,img,svg,canvas){ -webkit-touch-callout:none; -webkit-user-drag:none; }
/* One scroller at a time, none with a bar: the page, or a studio panel (the tools rail, the piano roll, the track list). */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden),
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) *{ scrollbar-width:none !important; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) *::-webkit-scrollbar{ display:none !important; width:0 !important; height:0 !important; }

/* The studio is the page: safe area on top, nothing above it and nothing under it that is not the studio. The WebView
   sits under the app's bar and above the home indicator, so these insets are 0 there and a real notch's elsewhere. */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) #bh-page-root{
  min-height:0 !important;
  padding:env(safe-area-inset-top,0px) 0 0 !important;
  background:transparent;
}

/* ── 3. Fields ──────────────────────────────────────────────────────────────
   16px keeps iOS from zooming into a field it focuses. */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) :is(input:not([type=range],[type=checkbox],[type=radio],[type=file],[type=hidden]),textarea,select){
  font-size:16px !important;
}

/* ── 4. Beat Studio ─────────────────────────────────────────────────────────
   The card on a page becomes the page: no frame, no corner, room for the home indicator. On a phone (beat-studio.css, "WAVE 15 — THE PHONE")
   the page is the studio's own: a sticky bar with Play and the tempo at the very top (the WebView sits under the app's bar, so there is nothing
   of the website above it), the sticky tabs under it, one view at a time, every control 44 pt or more, and the sheets and the status line over
   the bottom of the screen. What this sheet adds for it is the frame (none) and the room under the last row. */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) #bh-bs{
  max-width:none; margin:0; border:0; border-radius:0;
  padding:12px 12px calc(24px + env(safe-area-inset-bottom,0px)); /* (the ? is in the transport row: no room for it at the end) */
  min-height:calc(100vh - env(safe-area-inset-top,0px));
  min-height:calc(100dvh - env(safe-area-inset-top,0px));
}
@media (max-width:640px), (min-width:641px) and (max-height:500px) and (pointer:coarse){
  /* (no padding above: the bar sticks to the top of the screen, and it starts there) */
  html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) #bh-bs{ padding-top:0; }
}
/* The ? that replays the tour, when it is not in the transport row (it always is in the app: bs-tutorial.js seats it there): 44pt. */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) .bh-bs-tour-launch{
  width:44px; height:44px; right:12px; bottom:calc(12px + env(safe-area-inset-bottom,0px));
}

/* (The 44 pt targets of a phone, the BPM and Bars steppers, the Generate melody row, the M and S of a lane, the sliders, the sheets that
   Mixer, Sounds, Type Beat, Save and More are, and the sticky bars were rules of this file; they are beat-studio.css's own now, for the website
   at phone width too: w15.) */

/* Type Beat is switched off on the website (the option bh_tb_enabled, includes/shortcodes-modules/beat_studio/type-beat.php) and in
   the app (TYPE_BEAT_ENABLED): the panel in the rail follows the same switch here (beat_studio.php prints it as data-tb) and is not
   shown while it is off. Its deep link (?bh_tb=) still opens a preset. */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) #bh-bs .bh-bs-tbmenu[data-tb="0"]{ display:none !important; }

/* The ? that replays the tour sits in the transport, next to Save (bs-tutorial.js puts it there in the app): floating over the
   corner it covered steps 15 and 16 of whatever lane was under it. */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) #bh-bs .bh-bs-tour-launch.bh-bs-tour-launch--inline{
  position:static; flex:0 0 44px; width:44px; height:44px; margin:0; animation:none; box-shadow:none;
}

/* ── 5. Vocal Studio ────────────────────────────────────────────────────────
   The panel is the screen: no frame or shadow, the same height with or without a site bar above it (vh first, for a
   WebView that has no dvh). */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) #bh-vs-daw{ border:0; box-shadow:none; }
/* The home says the studio's name and tagline again right under the app's own header ("Vocal Studio  Done"): the title block goes,
   the New project button stays. The community strip is hidden above (section 1): other people's takes are the native Community's,
   which has Report and Block. */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) #bh-vs-home .vs-home-hero-left{ display:none; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) #bh-vs-home .vs-home-hero{ padding-top:20px; padding-bottom:16px; }
@media (max-width:600px){
  html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) :is(#bh-vs,#bh-vs-daw,#bh-vs-home,body.bh-vs-m #bh-vs-mshell){
    height:calc(100vh - var(--vs-nav-h,0px));
    height:calc(100dvh - var(--vs-nav-h,0px));
  }
  /* (The Track tab's layer sizes and the EQ staying on the FX tab were rules of this file; they are vocal-studio.css's own now,
     for the website at phone width too: w12, VS-05.) */
  /* The ? that replays the tour sits above the tab bar, not on its Lyrics tab. The Track and FX tabs have a control in that
     corner (the Sing bar, the sync buttons), so there it steps aside (where :has() is not known it stays, as before). */
  html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) .bh-tour-launch{
    width:44px; height:44px; right:12px; bottom:calc(52px + env(safe-area-inset-bottom,0px) + 12px);
  }
  html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) body:has(#bh-vs-daw:is([data-tab="track"],[data-tab="fx"]):not(.vh)) .bh-tour-launch{ display:none; }
  /* Touch targets that are sliders: a 44pt box around the same slider (the scrubber's row grows with it). */
  html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) :is(#bh-vs-prog,.vs-track__vol,.vs-syncsl){ min-height:44px; }
  html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) #bh-vs-scrub{ height:44px; }
  /* FX tab, sync row: with 44pt buttons, and once a take is calibrated a badge too, the slider was squeezed to 30px and the
     reset button ran off the screen. The controls wrap, and the slider has the whole line below them. */
  html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) #bh-vs-daw[data-tab="fx"] .vs-sync{ flex-wrap:wrap; }
  html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) #bh-vs-daw[data-tab="fx"] .vs-syncsl{ order:9; flex:1 0 100%; }
}

/* Corners the theme took back: beats-theme.css squares every <button> under .beatshouse-theme at (0,1,1), which beats the
   one-class rules of vocal-studio.css that round these. The corners (and the home's New project and the ? that replays
   the tour, which lose their fill too) are put back to what the studio's own sheet says. */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) :is(.vs-mute,.vs-solo){ border-radius:4px; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) :is(.vs-kshift,.vs-eq-reset,.vs-autolatbtn,.vs-syncrst,.vs-proj-item-del){ border-radius:5px; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) :is(.vs-layer-arm,.vs-clean-btn){ border-radius:6px; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) .vs-lyrics-close{ border-radius:7px; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) .vs-lyrics-btn{ border-radius:8px; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) :is(.vs-lyrics-lrc,.vs-proj-new){ border-radius:14px; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) :is(.vs-btn,.vs-sing){ border-radius:18px; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) .vs-sing{ border-radius:22px; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) .vs-home-new-btn{ border:0; border-radius:28px; background:var(--cb,#22B6FF); color:#fff; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) :is(.vs-sync-help-btn,.bh-tour-launch){ border-radius:50%; }
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden) .bh-tour-launch{
  border:1px solid rgba(34,182,255,.5); background:linear-gradient(135deg,#1A96E8,#0e2340); color:#eaf7ff;
}

/* ── 6. Files (w12, app fixer) ───────────────────────────────────────────────
   A studio's export (Vocal Studio's Save, Export Mix and Export LRC, Beat Studio's WAV and MIDI) is a download, and a WebView has
   no download manager: the app takes the file instead and opens the share sheet (assets/js/bh-studio-app.js). The page is in a
   WebView whose app cannot take it (an older app) when that script has put .bh-app-nofiles on <html>: the controls that would
   do nothing are not there, so no line says "exported" for a file that was never saved. A browser that opens the page in app mode
   (Safari, from "Open on the website") never gets that class and keeps them. */
/* ([id] and [class] lift these over vocal-studio.css's own display:flex !important on the phone's action buttons.) */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden).bh-app-nofiles :is(#bh-bs-export,#bh-bs-midi-export,#bh-vs-save,#bh-vs-mix,#bh-vs-lyrics-lrc)[id]{ display:none !important; }
/* (The guided flow's Save step, for an account without cloud projects, is a download: the same control, the same rule.) */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden).bh-app-nofiles #bh-vs-ms-save-btn[data-dl]{ display:none !important; }
/* The re-record dialog's "Save WAV" goes straight on to the count-in of the next take while the share sheet is still open over
   the studio, and the old take is replaced. In a WebView it is Cancel, Save (or Export Mix), then record again. */
html:is(.bh-app-link,.bh-app-text,.bh-app-hidden).bh-app-webview .vs-takemodal .btn-wav[class]{ display:none !important; }
