/* ══ Phone shell: the site as an iOS app ═════════════════
   Tab bar, More sheet, safe areas and page transitions. Only on narrow screens; js/app-shell.js builds the parts. */
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

@media (max-width: 760px) {
  :root { --tabbar-h: 58px; --sys: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Nirmala UI", sans-serif; }
  button, a, summary, select { touch-action: manipulation; }
  /* iOS zooms into any field set smaller than 16px; keep them at 16 */
  input, select, textarea { font-size: 16px !important; }

  /* the section menu and Display popover give way to the tab bar and the More sheet */
  html.has-tabs .site-nav, html.has-tabs .site-head .disp, html.has-tabs .top .disp { display: none; }
  html.has-tabs .site-head { position: sticky; top: calc(env(safe-area-inset-top) + 6px); z-index: 25; flex-wrap: nowrap; justify-content: center; min-height: 44px; padding-block: 6px; }
  html.has-tabs .site-head .brand { margin: 0 auto; }
  html.has-tabs .top { top: calc(env(safe-area-inset-top) + 6px); }
  html.has-tabs body > .backdrop + header, html.has-tabs body > header:first-of-type { margin-top: env(safe-area-inset-top); }
  .as-spacer { height: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px); flex: none; }
  html.has-tabs .detail { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); }
  /* in the home-screen app the status bar is see-through; give it a ground */
  html.standalone body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top); z-index: 40;
    background: color-mix(in srgb, var(--panel-solid, #0f1117) 82%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }

  /* ── tab bar ── */
  html.has-tabs .as-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: stretch;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
    background: rgba(18, 20, 27, .86); border-top: .5px solid rgba(255, 255, 255, .12);
    -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8); view-transition-name: tabbar; font-family: var(--sys); }
  .as-tabs a, .as-tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: rgba(235, 235, 245, .6); text-decoration: none; font: 500 10.5px/1 var(--sys); letter-spacing: .01em; background: none; border: 0; padding: 0; transition: color .2s, transform .15s; }
  .as-tabs svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .as-tabs svg .f, .as-ic svg .f { fill: currentColor; stroke: none; }
  .as-tabs [aria-current="page"] { color: var(--accent); }
  .as-tabs [aria-current="page"] svg { stroke-width: 2.1; }
  .as-tabs a:active, .as-tabs button:active { transform: scale(.9); }
  :root[lang="hi"] .as-tabs span { font: 500 11px/1.1 var(--deva), var(--sys); }

  /* Liquid Glass: the bar floats as a capsule, as on iOS 26 */
  :root[data-look="liquid"].has-tabs .as-tabs { left: 14px; right: 14px; bottom: max(10px, calc(env(safe-area-inset-bottom) - 8px)); height: 62px; padding: 0 6px;
    border-radius: 31px; border: .5px solid rgba(255, 255, 255, .22);
    background: linear-gradient(180deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .03)), rgba(20, 22, 30, .8);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 10px 34px rgba(0, 0, 0, .38); }
  :root[data-look="liquid"] .as-tabs [aria-current="page"] { color: var(--text); background: rgba(255, 255, 255, .14); border-radius: 26px; margin: 5px 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22); }
  :root[data-look="liquid"] .as-tabs [aria-current="page"] svg { color: var(--accent); }

  /* ── More sheet ── */
  body.as-locked { overflow: hidden; }
  html.has-tabs .as-sheet-wrap { position: fixed; inset: 0; z-index: 60; font-family: var(--sys); }
  .as-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .3s; }
  .as-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - env(safe-area-inset-top) - 36px); display: flex; flex-direction: column;
    background: rgba(26, 28, 36, .96); -webkit-backdrop-filter: blur(30px) saturate(1.6); backdrop-filter: blur(30px) saturate(1.6);
    border-radius: 26px 26px 0 0; border-top: .5px solid rgba(255, 255, 255, .16); box-shadow: 0 -12px 40px rgba(0, 0, 0, .4);
    transform: translateY(105%); transition: transform .42s cubic-bezier(.2, .9, .25, 1); }
  .as-sheet.dragging { transition: none; }
  .as-sheet-wrap.open .as-scrim { opacity: 1; }
  .as-sheet-wrap.open .as-sheet { transform: translateY(0); }
  .as-head { position: relative; display: flex; align-items: center; justify-content: center; padding: 18px 16px 8px; touch-action: none; cursor: grab; }
  .as-grab { position: absolute; top: 7px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: rgba(255, 255, 255, .28); }
  .as-head h2 { margin: 0; font: 600 17px var(--sys); color: var(--text); }
  :root[lang="hi"] .as-head h2 { font-family: var(--deva), var(--sys); }
  .as-sheet:focus { outline: none; }
  .as-done { position: absolute; right: 16px; top: 16px; font: 600 16px var(--sys); color: var(--accent); background: none; border: 0; padding: 4px 2px; }
  .as-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 16px calc(env(safe-area-inset-bottom) + 20px); }
  .as-body h3 { margin: 18px 16px 6px; font: 400 13px var(--sys); text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
  :root[lang="hi"] .as-body h3 { text-transform: none; font-family: var(--deva), var(--sys); font-size: 14px; }
  .as-group { background: rgba(255, 255, 255, .07); border-radius: 12px; overflow: hidden; }
  .as-row, .as-set { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; width: 100%; box-sizing: border-box;
    color: var(--text); text-decoration: none; font: 400 16px var(--sys); text-align: left; background: none; border: 0; position: relative; }
  :root[lang="hi"] .as-row span, :root[lang="hi"] .as-set span { font-family: var(--deva), var(--sys); font-weight: 500; }
  .as-row + .as-row::before, .as-set + .as-set::before { content: ""; position: absolute; top: 0; right: 0; left: 56px; border-top: .5px solid rgba(255, 255, 255, .12); }
  .as-set + .as-set::before { left: 14px; }
  .as-row:active { background: rgba(255, 255, 255, .08); }
  .as-row[aria-current="page"] span { color: var(--accent); }
  .as-row span { flex: 1; min-width: 0; }
  .as-ic { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--t); color: #fff; }
  .as-ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .as-chev { flex: none; width: 8px; height: 8px; border: solid rgba(255, 255, 255, .35); border-width: 2px 2px 0 0; transform: rotate(45deg); margin-right: 4px; }
  /* settings rows: the label on the left, the choice on the right as plain text */
  .as-set { justify-content: space-between; color: var(--text) !important; font-size: 16px !important; }
  .as-set select { flex: 0 1 auto; width: auto !important; max-width: 58%; background: none !important; border: 0; padding: 8px 18px 8px 4px !important; text-align: right; text-align-last: right;
    color: var(--muted) !important; font: 400 16px var(--sys) !important; -webkit-appearance: none; appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%) !important;
    background-position: right 6px top 52%, right 1px top 52% !important; background-size: 5px 5px !important; background-repeat: no-repeat !important; }
  .as-tip { margin: 18px 16px 0; font: 400 13px/1.45 var(--sys); color: var(--muted); }
  .as-tip:empty { display: none; }
}

/* ══ Search suggestions (js/suggest.js) ══════════════════ */
.sg-host { position: relative; z-index: 30; }
.sg-host:has(.sg:not([hidden])) { z-index: 60; }
.sg { position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 8px); min-width: min(360px, calc(100vw - 32px)); max-height: min(440px, 62vh); overflow-y: auto;
  margin: 0; padding: 6px; list-style: none; text-align: left; border-radius: 16px; background: rgb(22, 24, 32); border: .5px solid rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6); box-shadow: 0 18px 48px rgba(0, 0, 0, .5); overscroll-behavior: contain; }
.sg-h { padding: 8px 10px 3px; font: 600 11px var(--ui, system-ui); letter-spacing: .05em; text-transform: uppercase; color: var(--muted, #a8a49c); }
:root[lang="hi"] .sg-h { text-transform: none; font-size: 12px; letter-spacing: 0; }
.sg-o { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; cursor: pointer; color: var(--text, #f3f1ec); }
.sg-o:hover, .sg-o[aria-selected="true"] { background: rgba(255, 255, 255, .09); }
.sg-o[aria-selected="true"] { box-shadow: inset 2px 0 0 var(--accent, #ffb38a); }
.sg-o span { display: flex; flex-direction: column; min-width: 0; }
.sg-o b { font: 500 15px/1.25 var(--ui, system-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-o small { font: 400 12.5px/1.3 var(--ui, system-ui); color: var(--muted, #a8a49c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[lang="hi"] .sg-o b { font-family: var(--deva), var(--ui, system-ui); }
.sg-dot { flex: none; width: 10px; height: 10px; border-radius: 3px; margin: 0 5px; }
.sg-ic { flex: none; width: 20px; text-align: center; font-style: normal; color: var(--accent, #ffb38a); font-size: 14px; }
.top .sg-host .sg { top: calc(100% + 10px); }

/* moving between pages slides like a pushed screen; the tab bar stays put */
@media (max-width: 760px) and (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: as-out .28s cubic-bezier(.4, 0, .2, 1) both; }
  ::view-transition-new(root) { animation: as-in .32s cubic-bezier(.2, .8, .2, 1) both; }
  ::view-transition-group(tabbar) { animation: none; }
}
@keyframes as-out { to { opacity: 0; transform: translateX(-12%); } }
@keyframes as-in { from { opacity: 0; transform: translateX(18%); } }
