/* ============================================================
   App shell: frame, sidebar (brand · nav · city sub-nav · foot), mobile top bar + bottom tab bar.
   The frame sits on --chrome: darker than the content in dark, white on a hairline in light,
   so the work (and the city) is the brightest thing on screen.
   ============================================================ */

/* ---------- app shell ---------- */
.app-shell { position: relative; min-height: 100vh; }

.shell-grid {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ---------- sidebar ---------- */
.side-nav {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 20px 14px 16px;
  background: var(--chrome);
  border-inline-end: 1px solid var(--chrome-line);
}

/* brand: the observatory dish on the stage ink (theme-invariant, like the presentation) */
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: block;
  background:
    radial-gradient(circle at 50% 50%, var(--stage-accent) 0 3px, transparent 4px),
    radial-gradient(circle at 50% 50%, transparent 0 7px, rgba(196, 204, 255, 0.78) 7.8px 9.2px, transparent 10px),
    radial-gradient(circle at 50% 50%, transparent 0 11.6px, rgba(196, 204, 255, 0.32) 12.4px 13.4px, transparent 14.2px),
    radial-gradient(circle at 50% 0%, rgba(154, 168, 255, 0.28), transparent 70%),
    linear-gradient(160deg, var(--stage-bg-2), var(--stage-bg));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 0 1px rgba(196, 204, 255, 0.12), 0 4px 12px rgba(11, 14, 25, 0.22);
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 2px 8px 18px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--chrome-line);
  border-radius: 0;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 15px; font-weight: 800; color: var(--ink-hi); line-height: 1.35; }
.brand-sub { font-size: 12.5px; font-weight: 500; color: var(--ink-dim); line-height: 1.45; margin-top: 1px; }
html[lang="en"] .brand-name { letter-spacing: -0.01em; }
html[lang="en"] .brand-sub { font-size: 11.5px; }

/* ---------- nav ---------- */
.nav-list { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
  color: var(--ink-dim); font-size: 14.5px; font-weight: 700;
  transition: background var(--t-fast) var(--ease-std), color var(--t-fast) var(--ease-std);
}
html[lang="en"] .nav-item { font-size: 14px; font-weight: 600; }
.nav-item .ico { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: color-mix(in srgb, var(--ink-hi) 5%, transparent); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--ink-hi); }
.nav-item.active .ico, .nav-item.open .ico { color: var(--accent); }
.nav-item.active::before {
  content: ""; position: absolute; inset-block: 9px; inset-inline-start: 0;
  width: 3px; border-start-end-radius: 3px; border-end-end-radius: 3px;
  background: var(--accent);
}
.nav-item.open { color: var(--ink-hi); }
.nav-item:focus-visible, .nav-sub-item:focus-visible { outline-offset: -2px; }   /* the list scrolls: keep the ring inside */

/* city sub-nav: a branch under "Cities" — the city (current page) and its presentation */
.nav-sub {
  display: flex; flex-direction: column; gap: 2px;
  margin: 2px 0 6px; margin-inline-start: 21px; padding-inline-start: 12px;
  border-inline-start: 1px solid var(--line-strong);
}
.nav-sub-item {
  position: relative;
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 36px; padding: 0 10px; border-radius: 8px;
  font-size: 14px; font-weight: 700; color: var(--ink-dim); text-align: start;
  transition: background var(--t-fast) var(--ease-std), color var(--t-fast) var(--ease-std);
}
html[lang="en"] .nav-sub-item { font-size: 13.5px; font-weight: 600; }
.nav-sub-item:hover { background: color-mix(in srgb, var(--ink-hi) 5%, transparent); color: var(--ink); }
.nav-sub-item.active { background: var(--accent-soft); color: var(--ink-hi); }
.nav-sub-item.active::before {   /* the branch line lights up beside the current page */
  content: ""; position: absolute; inset-block: 7px; inset-inline-start: -14px;
  width: 3px; border-radius: 3px; background: var(--accent);
}
.nav-sub-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.nav-present { color: var(--accent); }
.nav-present .ico { width: 13px; height: 13px; flex: none; }   /* media glyph: never mirrored */
.nav-present:hover { color: var(--accent-strong); background: var(--accent-soft); }

/* ---------- foot: language · theme · ⋯ in one row, then one quiet line ---------- */
.nav-foot { border-top: 1px solid var(--chrome-line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.foot-row { display: flex; align-items: center; gap: 6px; }
.foot-row .lang-toggle { flex: 1; }

.lang-toggle {
  display: inline-flex; gap: 2px; padding: 2px; height: var(--h-sm);
  border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line);
}
:root[data-theme="dark"] .lang-toggle { background: var(--bg-soft); }
.lang-toggle button {
  flex: 1; min-width: 0; padding: 0 12px; border-radius: 7px;
  font-size: 12.5px; font-weight: 700; color: var(--ink-dim); white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.lang-toggle button[lang="en"] { font-family: var(--f-body-en); }
.lang-toggle button[lang="ar"] { font-family: var(--f-body-ar); }
.lang-toggle button:hover { color: var(--ink-hi); }
.lang-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--ink-hi); box-shadow: 0 1px 2px rgba(15, 21, 48, 0.08), 0 0 0 1px var(--line); cursor: default; }
:root[data-theme="dark"] .lang-toggle button[aria-pressed="true"] { background: var(--surface-3); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }

.nav-foot .icon-btn.bordered, .top-bar .icon-btn.bordered { background: transparent; border-color: var(--line); }
.nav-foot .icon-btn.bordered:hover, .top-bar .icon-btn.bordered:hover,
.nav-foot .icon-btn[aria-expanded="true"], .top-bar .icon-btn[aria-expanded="true"] { background: var(--surface-3); border-color: var(--line-strong); }
.theme-toggle svg { width: 16px; height: 16px; display: block; }

.nav-note {
  font-size: 12px; line-height: 1.5; color: var(--ink-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-inline: 2px;
}

/* about this demo (modal body) */
.about-lead { font-size: 15px; line-height: 1.8; color: var(--ink); }
.about-note { margin-top: 12px; font-size: 13.5px; line-height: 1.75; color: var(--ink-dim); }

/* ---------- main column ---------- */
.main-col { min-width: 0; display: flex; flex-direction: column; }

/* mobile / tablet chrome — hidden on desktop */
.top-bar, .tab-bar { display: none; }

/* ---------- ≤980: slim top bar + bottom tab bar (all four destinations always visible) ---------- */
@media (max-width: 980px) {
  .shell-grid { grid-template-columns: minmax(0, 1fr); }
  .side-nav { display: none; }

  .top-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    height: 52px; padding-inline: 16px 10px;
    background: var(--chrome);
    border-bottom: 1px solid var(--chrome-line);
    position: relative; z-index: 30;
  }
  .top-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .top-brand .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .top-brand .brand-name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-bar .icon-btn { width: var(--h-md); height: var(--h-md); border-radius: var(--radius-sm); }   /* a thumb-sized target */

  .tab-bar {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding: 0 6px env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--chrome) 92%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid var(--chrome-line);
    box-shadow: 0 -8px 24px rgba(10, 13, 27, 0.06);
  }
  :root[data-theme="dark"] .tab-bar { box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35); }
  .tab-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-width: 0; color: var(--ink-dim);
    -webkit-tap-highlight-color: transparent;
    transition: color var(--t-fast) var(--ease-std);
  }
  .tab-ico {
    display: grid; place-content: center; width: 52px; height: 28px; border-radius: 999px;
    transition: background var(--t-fast) var(--ease-std), color var(--t-fast) var(--ease-std);
  }
  .tab-ico .ico { width: 20px; height: 20px; }
  .tab-label {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 12.5px; font-weight: 700; line-height: 1.3;
  }
  html[lang="en"] .tab-label { font-size: 11.5px; font-weight: 600; }
  .tab-item:hover { color: var(--ink); }
  .tab-item.active { color: var(--ink-hi); }
  .tab-item.active .tab-ico { background: var(--accent-soft); color: var(--accent); }
  .tab-item:focus-visible { outline: none; }
  .tab-item:focus-visible .tab-ico { box-shadow: 0 0 0 2px var(--accent); }

  /* the last content and toasts clear the bar */
  .main-col { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .toast-zone { bottom: calc(64px + 14px + env(safe-area-inset-bottom, 0px)); }
}
/* tablets: the four tabs gather in the middle instead of stretching edge to edge */
@media (min-width: 761px) and (max-width: 980px) {
  .tab-bar { grid-template-columns: repeat(4, minmax(0, 132px)); justify-content: center; gap: 8px; }
}

/* a phone on its side: every pixel of height counts — the bar slims to one row of icon + word */
@media (max-width: 980px) and (max-height: 500px) and (orientation: landscape) {
  .tab-bar {
    height: calc(44px + env(safe-area-inset-bottom, 0px));
    grid-template-columns: repeat(4, minmax(0, 150px)); justify-content: center; gap: 6px;
  }
  .tab-item { flex-direction: row; gap: 6px; }
  .tab-ico { width: 34px; height: 26px; }
  .main-col { padding-bottom: calc(44px + env(safe-area-inset-bottom, 0px)); }
  .toast-zone { bottom: calc(44px + 12px + env(safe-area-inset-bottom, 0px)); }
}

/* the presentation is chrome-less (it covers the shell; the fixed bar must not peek through) */
html.is-presenting .tab-bar { display: none; }

@media print {
  .tab-bar { display: none !important; }
  .main-col { padding-bottom: 0; }
}
