/* BlackFrost phone layer: native-app feel on phones only.
   Every rule here is inside @media (max-width: 767px), so tablets and desktop never see it.
   Injected on every page by scripts/seo-copy.py; behaviour lives in /mobile/mobile.js. */

@media (max-width: 767px) {
  /* ---------- base: feel like an app, not a web page ---------- */
  html {
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  body {
    /* room for the tab bar, so the footer's last line is never trapped under it */
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }
  a,
  button {
    -webkit-touch-callout: none;
    touch-action: manipulation;
  }
  img {
    -webkit-user-drag: none;
  }

  /* heavy full-screen blend layer: costs frames on phones and is invisible at this size */
  .film-grain {
    display: none !important;
  }
  /* the floating menu button is replaced by the tab bar */
  .mobie-nav_wrapper {
    display: none !important;
  }

  /* ---------- hero headline readable over the clouds ---------- */
  .hero_section_v2 h1 {
    position: relative;
    z-index: 10;
    color: #fff !important;
    text-shadow: 0 2px 0 rgba(13, 27, 61, 0.35), 0 8px 24px rgba(13, 27, 61, 0.45);
  }

  /* the hero's bottom fade (into the games section) starts below the headline on phones */
  .hero_section_v2::after {
    background: linear-gradient(rgba(0, 0, 0, 0) 87%, rgba(0, 0, 0, 0.5) 94%, #000 100%) !important;
  }

  /* ---------- lighter art on phones (desktop keeps the full PNGs) ---------- */
  .about-tree-wrapper::after {
    background:
      linear-gradient(to bottom, rgba(12, 9, 12, 0) 70%, rgb(12, 9, 12) 100%),
      url(/brand/trees-1200.webp) center bottom / 100% 100% no-repeat !important;
  }
  /* footer: the corner nav it used to dodge is gone on phones, so the bottom line drops down */
  .bf-footer .tpf-foot {
    bottom: 34px !important;
  }
  .bf-footer .bf-chrome {
    width: 40cqw !important;
  }
  .bf-chrome__metal {
    -webkit-mask-image: url(/brand/bf-mascot-480.webp) !important;
    mask-image: url(/brand/bf-mascot-480.webp) !important;
  }

  /* ---------- top app bar: slides in once you scroll past the hero ---------- */
  .bf-appbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2147482000;
    display: flex;
    align-items: center;
    gap: 10px;
    height: calc(54px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0 14px;
    background: rgba(12, 9, 12, 0.72);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    backdrop-filter: saturate(160%) blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    color: #fff;
    transform: translateY(-105%);
    transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
    view-transition-name: bf-appbar;
  }
  .bf-appbar.is-shown {
    transform: none;
  }
  .bf-appbar__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
  }
  .bf-appbar__brand img {
    width: 30px;
    height: 30px;
    object-fit: contain;
  }
  .bf-appbar__name {
    font-family: 'Londrina Solid', Impact, sans-serif;
    font-size: 21px;
    font-weight: 900;
    letter-spacing: 0.02em;
    line-height: 1;
  }
  .bf-appbar__title {
    overflow: hidden;
    margin-left: 2px;
    font-family: Karla, system-ui, sans-serif;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: rgba(255, 255, 255, 0.55);
  }
  .bf-appbar__share {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }
  .bf-appbar__share svg {
    width: 19px;
    height: 19px;
  }

  /* ---------- bottom tab bar ---------- */
  .bf-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147482000;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 0 6px env(safe-area-inset-bottom);
    background: rgba(12, 9, 12, 0.78);
    -webkit-backdrop-filter: saturate(170%) blur(20px);
    backdrop-filter: saturate(170%) blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-family: Karla, system-ui, sans-serif;
    view-transition-name: bf-tabbar;
  }
  .bf-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 64px;
    padding: 0;
    border: 0;
    background: none;
    color: rgba(255, 255, 255, 0.55);
    font: inherit;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.15s ease;
  }
  .bf-tab__icon {
    display: block;
    width: 32px;
    height: 32px;
    opacity: 0.78;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
    -webkit-user-select: none;
    user-select: none;
  }
  .bf-tab.is-active {
    color: #ffe14d;
  }
  .bf-tab.is-active .bf-tab__icon {
    opacity: 1;
    transform: translateY(-2px) scale(1.12);
    filter: drop-shadow(0 3px 6px rgba(255, 190, 0, 0.35)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
  }
  .bf-tab:active {
    transform: scale(0.9);
  }
  /* the raised PLAY coin in the middle */
  .bf-tab--play {
    position: relative;
    color: #ffe14d;
  }
  .bf-tab__coin {
    display: block;
    width: 62px;
    height: 62px;
    margin-top: -30px;
    filter: drop-shadow(0 8px 14px rgba(59, 130, 246, 0.55)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
    transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
    -webkit-user-select: none;
    user-select: none;
  }
  .bf-tab--play:active .bf-tab__coin {
    transform: scale(0.9) rotate(-6deg);
  }
  .bf-tab span {
    font-family: 'Londrina Solid', Impact, sans-serif;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1;
  }

  /* ---------- toast (share fallback) ---------- */
  .bf-toast {
    position: fixed;
    left: 50%;
    bottom: calc(84px + env(safe-area-inset-bottom));
    z-index: 2147483001;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: #0c090c;
    font: 800 13px/1 Karla, system-ui, sans-serif;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, 12px);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.25s ease;
    pointer-events: none;
  }
  .bf-toast.is-on {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  /* ---------- game rows: snap like an app store shelf ---------- */
  .bf-row__track {
    scroll-snap-type: x mandatory !important;
    scroll-padding-inline: 16px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .bf-row__track::-webkit-scrollbar {
    display: none;
  }
  .bf-tile {
    transition: transform 0.15s ease;
  }
  .bf-tile:active,
  .bf-cta:active {
    transform: scale(0.965);
  }
  .bf-cta {
    min-height: 48px;
    border-radius: 14px;
  }

  /* ---------- crew card: full-height bottom sheet ---------- */
  .bf-modal {
    place-items: end stretch !important;
    padding: 0 !important;
  }
  .bf-modal__panel {
    grid-template-columns: 1fr !important;
    grid-template-rows: 40svh minmax(0, 1fr) !important;
    width: 100% !important;
    height: calc(100svh - env(safe-area-inset-top) - 12px) !important;
    border-radius: 22px 22px 0 0 !important;
    transform: translateY(100%) !important;
    transition: transform 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
  }
  .bf-modal.is-open .bf-modal__panel {
    transform: translateY(var(--bf-drag, 0px)) !important;
  }
  .bf-modal.is-dragging .bf-modal__panel {
    transition: none !important;
  }
  .bf-modal__panel::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    z-index: 4;
    width: 40px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.35);
    transform: translateX(-50%);
  }
  .bf-modal__stage {
    border-right: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .bf-modal__info {
    padding: 22px 20px calc(24px + env(safe-area-inset-bottom)) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .bf-modal__close {
    top: 16px !important;
    right: 14px !important;
    width: 36px !important;
    height: 36px !important;
    background: rgba(0, 0, 0, 0.45) !important;
  }
  .bf-hd__name {
    font-size: 40px !important;
  }

  /* ---------- LEARN menu: bottom sheet instead of a side panel ---------- */
  .bf-learn__panel {
    top: auto !important;
    left: 0;
    right: 0 !important;
    width: 100% !important;
    max-height: calc(92svh - env(safe-area-inset-top));
    padding: 18px 24px calc(24px + env(safe-area-inset-bottom)) !important;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(102%) !important;
    transition: transform 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
  }
  .bf-learn.is-open .bf-learn__panel {
    transform: translateY(var(--bf-drag, 0px)) !important;
  }
  .bf-learn.is-dragging .bf-learn__panel {
    transition: none !important;
  }
  .bf-learn__panel::before {
    content: '';
    align-self: center;
    flex: none;
    width: 40px;
    height: 5px;
    margin-bottom: 14px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.3);
  }
  .bf-learn__close {
    width: 40px;
    height: 40px;
  }
  .bf-learn__list {
    margin-top: 22px;
    gap: 0;
  }
  .bf-learn__list li + li {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .bf-learn__link {
    display: flex;
    justify-content: space-between;
    padding: 13px 0;
    font-size: 30px;
  }
  .bf-learn__link svg {
    opacity: 0.5;
    transform: none;
  }
  .bf-learn__slam {
    font-size: clamp(19px, 6.2vw, 26px);
    white-space: nowrap;
  }

  /* ---------- page-to-page: a quick native cross-fade (no flash of white) ---------- */
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.22s;
  }
}

/* cross-document transitions, phones only */
@media (max-width: 767px) {
  @view-transition {
    navigation: auto;
  }
}

/* phones in landscape (wider than 767px but short): keep content clear of the notch */
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .bf-appbar,
  .bf-modal__panel,
  .bf-learn__panel,
  .bf-tab,
  .bf-tile {
    transition: none !important;
  }
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}
