/* Inside the Hotwire Native app, which brings its own navigation */
@layer native {
  [data-hotwire-native="true"] {
    .hide-on-native {
      display: none;
    }

    /* A long press on a link previews it as a web page, and holding on to it lifts it for
       dragging; the app's own screens do neither */
    a {
      -webkit-touch-callout: none;
    }

    a, img {
      -webkit-user-drag: none;
    }

    :is(.keep__link, .pin__link) {
      -webkit-user-select: none;
      user-select: none;
    }

    /* Clear of the home indicator, which the page runs under */
    .toast {
      bottom: 48px;
    }

    /* The app's bar has the brand, title, and actions, so on a keep's page the header has nothing left */
    .header:not(:has(.search)) {
      display: none;
    }

    /* No band under the app's bar: the kinds sit right on the page */
    .filters {
      padding-top: 8px;
      padding-bottom: 0;
      border-bottom: 0;
      background: none;
    }

    :is(.chip:not([aria-current="true"]), .sort__select) {
      background-color: var(--color-well);
    }

    /* The keep's color runs up behind the app's see-through bar */
    .keep-hero__body {
      padding-top: 12px;
    }

    .link-sheet {
      padding-top: 20px;
    }
  }

  /* WebKit fills the space behind the app's bar with the page's color, which is the body's over the root's. So
     on a keep's page the body steps aside for the keep's color on the root, and the screen carries the paper */
  [data-hotwire-native="true"]:has(.keep-hero) {
    background: none;

    /* The shadow covers the part of a pixel the page's height is rounded up by, where the keep's color would show */
    .keep-screen {
      background: var(--color-paper);
      box-shadow: 0 1px var(--color-paper);
    }
  }

  :root:has([data-hotwire-native="true"] .keep-hero) {
    &:has(.keep-hero.tint--teal) { background: var(--tint-teal); }
    &:has(.keep-hero.tint--ink-blue) { background: var(--tint-ink-blue); }
    &:has(.keep-hero.tint--plum) { background: var(--tint-plum); }
    &:has(.keep-hero.tint--umber) { background: var(--tint-umber); }
    &:has(.keep-hero.tint--terracotta) { background: var(--tint-terracotta); }
    &:has(.keep-hero.tint--ochre) { background: var(--tint-ochre); }
    &:has(.keep-hero.tint--heather) { background: var(--tint-heather); }
    &:has(.keep-hero.tint--lichen) { background: var(--tint-lichen); }
    &:has(.keep-hero.tint--sage) { background: var(--tint-sage); }
    &:has(.keep-hero.tint--mist) { background: var(--tint-mist); }
    &:has(.keep-hero.tint--sand) { background: var(--tint-sand); }
    &:has(.keep-hero.tint--blush) { background: var(--tint-blush); }
  }

  /* Controls the app shows itself, hidden once it says it handles them, like Fizzy's native.css */
  [data-bridge-components~=buttons] [data-bridge--buttons-target~=button] {
    display: none;
  }

  [data-bridge-components~=search] .header:has([data-controller~="bridge--search"]) {
    display: none;
  }

  [data-bridge-components~=form] [data-controller~="bridge--form"] .dialog__actions {
    display: none;
  }
}
