/* =====================================================================
   shell.css: skip link, top bar, subnav, tab bar, page frame, footer,
   install dialog.
   ===================================================================== */

/* ---------------------------------------------------------- skip link */
.skip {
  position: fixed; top: calc(var(--safe-t) + 8px); left: var(--gutter); z-index: var(--z-skip);
  display: inline-flex; align-items: center; height: 44px; padding: 0 20px; border-radius: var(--radius-pill);
  background: var(--inverse); color: var(--on-inverse); font: 600 15px/1 var(--font);
  transform: translateY(calc(-100% - 24px - var(--safe-t)));
}
.skip:focus { transform: none; }

/* ------------------------------------------------------------ top bar */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: var(--z-header); isolation: isolate;
  padding: var(--safe-t) var(--gutter) 0;
  transition: transform var(--dur-3) var(--ease-std);
}
.topbar::before {
  content: ""; position: absolute; inset: 0 0 -48px 0; z-index: -1; pointer-events: none;
  background: var(--scrim-top); transition: opacity var(--dur-3) var(--ease-std);
}
.topbar::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--chrome); box-shadow: 0 1px 0 var(--line);
  opacity: 0; transition: opacity var(--dur-3) var(--ease-std);
}
.topbar.is-solid::before { opacity: 0; }
.topbar.is-solid::after { opacity: 1; }
.topbar__bar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 40px;
  transition: opacity var(--dur-2);
}

/* Scrolling down on phones tucks the brand row away; the section chips stay. */
@media (max-width: 860px) {
  html.has-subnav .topbar.is-tucked { transform: translateY(calc(-1 * var(--topbar-h))); }
  html.has-subnav .topbar.is-tucked .topbar__bar { opacity: 0; visibility: hidden; }
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; font-weight: 700; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.brand__mark { width: 28px; height: 28px; color: var(--text); flex: none; }
.brand__glyph { fill: var(--bg); }
.brand__word--light { color: var(--text-2); font-weight: 500; }
html.is-tv .brand__mark { width: calc(36px * var(--tvu)); height: calc(36px * var(--tvu)); }

.nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.nav a {
  display: inline-flex; align-items: center; height: 40px; padding: 0 14px; border-radius: var(--radius-pill);
  color: var(--text-2); font-size: 15px; font-weight: 500; white-space: nowrap;
  transition: color var(--dur-2), background-color var(--dur-2), transform var(--dur-2) var(--ease-calm);
}
@media (pointer: coarse) { .nav a { height: 44px; } }
@media (hover: hover) and (pointer: fine) { .nav a:hover { color: var(--text); } }
.nav a[aria-current="page"] { color: var(--text); background: var(--fill-1); }
html.is-tv .nav a { height: var(--control); font-size: var(--fs-callout); }
html.is-tv .nav a:focus-visible { background: var(--inverse); color: var(--on-inverse); transform: scale(1.04); }

.topbar__end { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.topbar__install { height: 40px; padding: 0 14px; }
.topbar__install .icon { width: 18px; height: 18px; }
@media (pointer: coarse) { .topbar__install { height: 44px; } }
@media (max-width: 1279px) {
  .topbar__install { width: 40px; padding: 0; }
  .topbar__install .install-label { display: none; }
}
@media (max-width: 1279px) and (pointer: coarse) { .topbar__install { width: 44px; } }
.topbar__search { width: clamp(220px, 18vw, 300px); height: 40px; }
@media (pointer: coarse) { .topbar__search { height: 44px; } }
.topbar__search-btn { display: none; }
.topbar__search-btn[aria-current="page"] { color: var(--text); background: var(--fill-1); }

/* 861–1119: nav tightens, search becomes an icon, wordmark hides. */
@media (max-width: 1119px) {
  .topbar__bar { gap: 24px; }
  .topbar__search { display: none; }
  .topbar__search-btn { display: inline-flex; }
  .nav a { padding: 0 10px; font-size: 14px; }
}
@media (min-width: 861px) and (max-width: 1119px) {
  .brand__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* ≤860: tab bar navigation; the top bar only keeps the brand and install. */
@media (max-width: 860px) {
  .topbar__bar { gap: 12px; }
  .nav, .topbar__search, .topbar__search-btn { display: none; }
}
@media (max-width: 379px) {
  .brand__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ------------------------------------------------------------- subnav */
.subnav {
  display: none; height: var(--subnav-h); align-items: center; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
  margin-inline: calc(-1 * var(--gutter)); padding: 4px var(--gutter);
}
.subnav::-webkit-scrollbar { display: none; }
.subnav .chip { position: relative; height: 40px; }
.subnav .chip::before { content: ""; position: absolute; inset: -2px 0; }
@media (max-width: 860px) { html.has-subnav .subnav { display: flex; } }
/* Over the home hero the chips need their own backing to stay legible. */
.topbar:not(.is-solid) .subnav .chip:not([aria-current="page"]) {
  background: rgba(0, 0, 0, .38); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), var(--shadow-1); color: #fff;
}

/* ------------------------------------------------------------ tab bar */
.tabbar { display: none; }
@media (max-width: 860px) {
  .tabbar {
    position: fixed; inset: auto 0 0 0; z-index: var(--z-tabbar);
    height: var(--tabbar-total); padding: 0 max(8px, var(--safe-r)) var(--safe-b) max(8px, var(--safe-l));
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: var(--chrome); box-shadow: 0 -1px 0 var(--line);
  }
  html.is-tv .tabbar { display: none; }
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: var(--tabbar-h); color: var(--text-2); font-size: var(--fs-tab); font-weight: 500; line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.tabbar__pill {
  display: flex; align-items: center; justify-content: center; width: 56px; height: 30px; border-radius: var(--radius-pill);
  transition: background-color var(--dur-2), transform var(--dur-1) var(--ease-std);
}
.tabbar__pill .icon { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--text); font-weight: 600; }
.tabbar a[aria-current="page"] .tabbar__pill { background: var(--fill-2); }
.tabbar a:active .tabbar__pill { transform: scale(.94); }
.tabbar a:focus-visible { outline-offset: -4px; box-shadow: none; }
@media (orientation: landscape) and (max-height: 500px) {
  .tabbar__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tabbar__pill { width: 48px; height: 28px; }
}

/* -------------------------------------------------------- page frame */
main { min-height: 100vh; min-height: 100svh; padding-bottom: calc(var(--tabbar-total) + 48px); }
#view:focus { outline: none; box-shadow: none; }
.page { animation: page-in var(--dur-3) var(--ease-calm); }
.page.is-restored { animation: none; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } }
.page--padded { padding: calc(var(--header-h) + 32px) var(--gutter) 0; }
@media (min-width: 861px) { .page--padded { padding-top: calc(var(--header-h) + 40px); } }
html.is-tv .page--padded { padding-top: calc(var(--header-h) + 56px * var(--tvu)); }

/* ------------------------------------------------------------- footer */
.footer {
  margin-top: 72px; padding: 48px var(--gutter) 24px; box-shadow: 0 -1px 0 var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.footer__brand { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 13px; font-weight: 600; }
.footer__brand .brand__mark { width: 20px; height: 20px; color: var(--text-3); }
.footer__links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.footer__link { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-2); font-size: 14px; font-weight: 500; }
.footer__link .icon { display: none; }
@media (hover: hover) and (pointer: fine) { .footer__link:hover { color: var(--text); } }

/* ------------------------------------------------------ install dialog */
.modal {
  border: 0; padding: 0; margin: auto; background: transparent; color: var(--text);
  max-width: none; max-height: none; overflow: visible;
}
.modal::backdrop { background: rgba(0, 0, 0, .6); }
.modal--fallback {
  position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; background: rgba(0, 0, 0, .6);
}
.modal[open], .modal--fallback { animation: fade-in var(--dur-3) var(--ease-calm); }
.modal__box {
  width: min(440px, calc(100vw - 32px)); padding: 28px; border-radius: var(--radius-xl);
  background: var(--surface-2); box-shadow: var(--shadow-3);
}
html.is-tv .modal__box { width: calc(600px * var(--tvu)); }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.modal__head h2 { font-size: var(--fs-title-3); line-height: var(--lh-title-3); font-weight: 600; padding-top: 8px; }
.modal__head .btn { margin: 0 -10px 0 0; }
.modal__steps { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 16px; }
.modal__steps li { display: grid; grid-template-columns: 32px 1fr; gap: 14px; align-items: start; }
.modal__step-num {
  display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3); color: var(--text); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.modal__step-text { padding-top: 4px; color: var(--text-soft); font-size: 15px; line-height: 1.5; }
.modal__step-text .icon { width: 18px; height: 18px; vertical-align: -3px; margin: 0 2px; }
.modal__note { margin: 0 0 20px; color: var(--text-3); font-size: 13px; }
