/* PSBMKJPP – app-style layout for phones (<=860px).
   Desktop and tablet layouts are untouched: everything here is inside the media query
   or hidden by default. */

.app-tabs, .app-lang, .app-back, .app-title, .app-sheet, .app-scrim, .app-install{display:none;}

@media (max-width:860px){
  html{-webkit-tap-highlight-color:transparent;}
  body{padding-bottom:calc(74px + env(safe-area-inset-bottom, 0px)); overscroll-behavior-y:none;}

  /* ---- top app bar ---- */
  .site-head{border-bottom:1px solid rgba(20,83,45,.08); box-shadow:0 1px 0 rgba(0,0,0,.02);}
  .site-head .bar{min-height:58px; gap:10px;}
  .menu-btn, .site-head .nav{display:none !important;}
  .brand img{height:36px; width:auto;}
  .brand-text span{display:none;}
  body.app-sub .brand{display:none;}
  .app-back{display:flex; align-items:center; justify-content:center; flex:none; width:40px; height:40px; margin-left:-8px; border-radius:50%; color:var(--navy); text-decoration:none;}
  .app-back:active{background:var(--emerald-tint);}
  .app-back svg{width:24px; height:24px;}
  body.app-sub .app-title{display:block; flex:1; min-width:0; font-weight:700; font-size:1.06rem; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .app-lang{display:flex; margin-left:auto; flex:none; background:var(--nest); border:1px solid var(--line); border-radius:999px; padding:3px;}
  .app-lang a{font-size:.78rem; font-weight:700; line-height:1; padding:7px 9px; border-radius:999px; color:var(--muted); text-decoration:none;}
  .app-lang a[aria-current="true"]{background:var(--navy); color:#fff;}

  /* ---- bottom tab bar ---- */
  .fab{display:none !important;}
  .app-tabs{display:grid; grid-template-columns:repeat(5,1fr); align-items:end; position:fixed; z-index:120; left:0; right:0; bottom:0;
    padding:6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
    background:rgba(255,255,255,.97); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
    border-top:1px solid rgba(20,83,45,.1); box-shadow:0 -6px 20px -12px rgba(0,59,27,.25); view-transition-name:app-tabs;}
  .app-tabs a, .app-tabs button{appearance:none; border:0; background:none; font:inherit; cursor:pointer;
    display:flex; flex-direction:column; align-items:center; gap:3px; padding:6px 2px 4px; color:#5B665D; text-decoration:none;
    font-size:.68rem; font-weight:600; line-height:1.15; letter-spacing:.01em; border-radius:14px; -webkit-user-select:none; user-select:none;}
  .app-tabs svg{width:24px; height:24px;}
  .app-tabs .on{color:var(--navy);}
  .app-tabs .on svg{stroke-width:2.4;}
  .app-tabs .on .pill{background:var(--emerald-tint);}
  .app-tabs .pill{display:flex; align-items:center; justify-content:center; width:52px; height:30px; border-radius:999px; transition:background .2s;}
  .app-tabs a:active .pill, .app-tabs button:active .pill{background:var(--emerald-tint);}
  .app-tabs .wa{color:var(--navy); font-weight:700;}
  .app-tabs .wa .pill{width:54px; height:54px; margin-top:-26px; border-radius:50%; background:var(--wa); color:#fff;
    box-shadow:0 8px 18px -6px rgba(31,168,85,.6), 0 0 0 5px #fff;}
  .app-tabs .wa svg{width:28px; height:28px;}
  .app-tabs .wa:active .pill{background:#168a45; transform:scale(.95);}

  /* ---- slide-up menu sheet ---- */
  .app-scrim{display:block; position:fixed; inset:0; z-index:130; background:rgba(0,30,12,.38); opacity:0; pointer-events:none; transition:opacity .22s;}
  .app-sheet{display:block; position:fixed; z-index:140; left:0; right:0; bottom:0; max-height:86vh; overflow:auto;
    background:#fff; border-radius:22px 22px 0 0; padding:10px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    transform:translateY(105%); transition:transform .28s cubic-bezier(.2,.8,.2,1); box-shadow:0 -10px 40px -10px rgba(0,0,0,.3);}
  body.sheet-open .app-scrim{opacity:1; pointer-events:auto;}
  body.sheet-open .app-sheet{transform:none;}
  body.sheet-open{overflow:hidden;}
  .app-sheet .grab{width:42px; height:5px; border-radius:9px; background:#D5DDD3; margin:0 auto 12px;}
  .app-sheet h2{font-size:1.1rem; margin:0 4px 8px;}
  .app-sheet .sheet-list{list-style:none; margin:0; padding:0; border:1px solid var(--line); border-radius:16px; overflow:hidden;}
  .app-sheet .sheet-list a{display:flex; align-items:center; gap:14px; padding:14px 16px; color:var(--ink); text-decoration:none; font-weight:600; border-top:1px solid var(--line);}
  .app-sheet .sheet-list li:first-child a{border-top:0;}
  .app-sheet .sheet-list a:active{background:var(--nest);}
  .app-sheet .sheet-list a[aria-current="page"]{color:var(--navy); background:var(--emerald-tint);}
  .app-sheet .sheet-list .ico{flex:none; width:34px; height:34px; border-radius:10px; background:var(--nest); color:var(--navy); display:flex; align-items:center; justify-content:center;}
  .app-sheet .sheet-list .ico svg{width:19px; height:19px;}
  .app-sheet .sheet-list .chev{margin-left:auto; color:#9AA59B;}
  .app-sheet .sheet-list .chev svg{width:18px; height:18px;}
  .app-sheet .sheet-row{display:flex; gap:10px; margin-top:14px;}
  .app-sheet .sheet-row a, .app-sheet .sheet-row button{flex:1; display:flex; align-items:center; justify-content:center; gap:8px; min-height:48px; border-radius:14px; font:inherit; font-weight:700; font-size:.95rem; text-decoration:none; border:1px solid var(--line); background:var(--nest); color:var(--navy);}
  .app-sheet .sheet-row .primary{background:var(--wa); border-color:var(--wa); color:#fff;}
  .app-sheet .sheet-row svg{width:20px; height:20px;}
  .app-sheet .sheet-note{font-size:.8rem; color:var(--muted); margin:14px 4px 0; line-height:1.5;}
  .app-sheet .ios-tip{display:none; font-size:.88rem; background:var(--amber-tint); color:#5A4300; border-radius:12px; padding:12px 14px; margin-top:12px; line-height:1.5;}
  .app-sheet .ios-tip.show{display:block;}

  /* ---- install banner (home, once) ---- */
  .app-install{position:fixed; z-index:115; left:12px; right:12px; bottom:calc(84px + env(safe-area-inset-bottom, 0px));
    background:var(--navy-deep); color:#fff; border-radius:16px; padding:12px 12px 12px 14px; align-items:center; gap:12px;
    box-shadow:0 12px 30px -10px rgba(0,0,0,.45); transform:translateY(16px); opacity:0; transition:transform .3s, opacity .3s;}
  .app-install.show{display:flex;}
  .app-install.in{transform:none; opacity:1;}
  .app-install img{width:40px; height:40px; border-radius:10px; background:#fff; flex:none;}
  .app-install .txt{flex:1; font-size:.86rem; line-height:1.35;}
  .app-install .txt b{display:block; font-size:.95rem;}
  .app-install .go{border:0; border-radius:999px; background:var(--amber); color:#3A2B00; font:inherit; font-weight:800; font-size:.85rem; padding:9px 14px;}
  .app-install .x{border:0; background:none; color:#fff; opacity:.7; font-size:1.4rem; line-height:1; padding:4px 6px;}

  /* ---- app feel for content ---- */
  .sos .wrap{padding-top:10px; padding-bottom:10px;}
  .sos p{font-size:.88rem; line-height:1.45;}
  .btn{min-height:50px; border-radius:14px;}
  .btn:active, .gcard:active, .feature:active, .mini:active{transform:scale(.98);}
  .btn, .gcard, .feature, .mini{transition:transform .12s ease;}
  .site-foot{padding-bottom:12px;}
  .site-foot .foot-grid > div:nth-child(2){display:none;}
  a:hover{color:inherit;}

  /* in the installed app, the browser chrome is gone: give the top bar a solid colour */
  @media (display-mode: standalone){
    .site-head{background:#fff;}
  }
}

/* smooth page-to-page transitions on phones (browsers that support it) */
@media (max-width:860px) and (prefers-reduced-motion:no-preference){
  @view-transition{navigation:auto;}
  ::view-transition-old(root){animation:app-out .16s ease both;}
  ::view-transition-new(root){animation:app-in .22s ease both;}
}
@keyframes app-out{to{opacity:0;}}
@keyframes app-in{from{opacity:0; transform:translateY(8px);}}
@media (prefers-reduced-motion:reduce){
  .app-sheet, .app-scrim, .app-install{transition:none;}
}
