/* Mobile app mode (body.ktp-app), phones only. */
.ktp-app-back,
.ktp-app-install,
.ktp-app-progress { display: none; }

@media (max-width: 767px) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: ktp-vt-out .16s ease both; }
  ::view-transition-new(root) { animation: ktp-vt-in .28s cubic-bezier(.22, 1, .36, 1) both; }
  @keyframes ktp-vt-out { to { opacity: 0; } }
  @keyframes ktp-vt-in { from { opacity: 0; transform: translateX(16px); } }

  body.ktp-app {
    -webkit-tap-highlight-color: transparent;
  }
  body.ktp-app a,
  body.ktp-app button { touch-action: manipulation; }

  body.ktp-app .ktp-topbar { padding-top: env(safe-area-inset-top); }

  /* App header */
  body.ktp-app .ktp-header.is-stuck { padding-top: env(safe-area-inset-top); }
  body.ktp-app .ktp-header {
    width: 100vw;
    background: #fff !important;
    border-bottom: 1px solid rgba(14, 59, 48, .07);
    box-shadow: 0 2px 14px rgba(10, 46, 38, .05);
    view-transition-name: ktp-app-header;
  }
  body.ktp-app .ktp-header--overlay { backdrop-filter: none; }
  body.ktp-app .ktp-header.is-stuck { box-shadow: 0 4px 18px rgba(10, 46, 38, .08); }
  body.ktp-app.ktp-nav-open .ktp-header { z-index: 110; }
  body.ktp-app .ktp-header .ktp-header__inner {
    width: calc(100% - 32px) !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    min-height: 72px;
  }
  body.ktp-app .ktp-header .ktp-logo { grid-area: 1 / 1 !important; justify-self: start; }
  body.ktp-app .ktp-header .ktp-logo img.ktp-brand-logo {
    width: 100% !important;
    height: 100% !important;
    max-width: 108px !important;
    max-height: 68px !important;
  }
  body.ktp-app .ktp-header .ktp-tools {
    display: flex !important;
    grid-area: 1 / 2 !important;
    justify-self: end;
    gap: .2rem;
    margin-right: -6px;
  }
  body.ktp-app .ktp-header [data-ktp-search] { display: inline-flex; }
  body.ktp-app .ktp-header .ktp-burger { display: inline-flex; }
  body.ktp-app .ktp-header a.ktp-cart { display: inline-flex; }
  body.ktp-app .ktp-search {
    position: fixed;
    top: calc(72px + env(safe-area-inset-top));
    left: 0;
    right: 0;
    z-index: 111;
    padding: .6rem 1rem .8rem;
    background: #fff;
    border: 0;
    box-shadow: 0 8px 20px rgba(10, 46, 38, .1);
  }
  body.ktp-app .ktp-search-form input {
    border-radius: 999px;
    background: var(--ktp-paper);
    border-color: transparent;
    padding-inline: 1.1rem;
    font-size: 16px;
  }

  body.ktp-app .ktp-drawer { z-index: 120; }

  /* Side navigation drawer */
  body.ktp-app .ktp-nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(360px, calc(100% - 48px));
    height: 100vh;
    height: 100dvh;
    max-width: 100%;
    max-height: none;
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 0 18px 18px 0;
    box-shadow: 18px 0 50px rgba(0, 0, 0, .18);
    transform: translateX(-105%);
    transition: transform .3s cubic-bezier(.22, 1, .36, 1);
    z-index: 120;
  }
  body.ktp-app .ktp-nav.is-open { transform: translateX(0); }
  body.ktp-app.ktp-nav-open .ktp-nav-overlay { pointer-events: auto; }
  body.ktp-app .ktp-nav__panel-head {
    position: relative;
    min-height: 72px;
    padding: .85rem 4rem .85rem 1.4rem;
    border-bottom: 1px solid #f0ede6;
  }
  body.ktp-app .ktp-nav.is-open .ktp-nav__close {
    position: fixed !important;
    top: calc(12px + env(safe-area-inset-top));
    right: 14px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #f3f1ec;
    font-size: 1.5rem;
  }
  body.ktp-app .ktp-nav__list { padding: .3rem 0 .5rem; }
  body.ktp-app .ktp-nav__list a {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: .95rem 1.4rem;
    border-bottom: 1px solid #f4f2ed;
    font-size: 1.04rem;
  }
  body.ktp-app .ktp-nav__list a::after {
    content: "";
    width: 8px;
    height: 8px;
    border-top: 1.8px solid #b8b4aa;
    border-right: 1.8px solid #b8b4aa;
    transform: rotate(45deg);
  }
  body.ktp-app .ktp-nav__list .current-menu-item a,
  body.ktp-app .ktp-nav__list a[aria-current="page"] {
    box-shadow: none;
    background: rgba(14, 59, 48, .05);
    font-weight: 600;
  }
  body.ktp-app .ktp-nav .ktp-nav__account { margin: .6rem 1.4rem 1rem; }
  body.ktp-app .ktp-app-install {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    width: calc(100% - 2.8rem);
    margin: 0 1.4rem 1.2rem;
    padding: .95rem 1rem;
    border: 0;
    border-radius: 14px;
    background: var(--ktp-green);
    color: #fff;
    font-family: var(--ktp-sans);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
  }
  body.ktp-app .ktp-app-install svg { width: 20px; height: 20px; }

  /* Page loading bar */
  body.ktp-app .ktp-app-progress {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--ktp-gold), var(--ktp-green));
    opacity: 0;
    pointer-events: none;
  }
  body.ktp-app .ktp-app-progress.is-loading {
    width: 85%;
    opacity: 1;
    transition: width 5s cubic-bezier(.1, .7, .2, 1), opacity .1s;
  }
  body.ktp-app .ktp-app-progress.is-done {
    width: 100%;
    opacity: 0;
    transition: width .2s, opacity .4s .15s;
  }

  /* App-style touch feedback and shapes */
  body.ktp-app .ktp-btn { border-radius: 12px; transition: transform .15s, background .2s; }
  body.ktp-app .ktp-btn:active { transform: scale(.97); }
  body.ktp-app .ktp-tile { border-radius: 18px; }
}
