/* UI Stack: the shared page chrome for the six sites on uistack.sky-ai.com.
   Every page links /css/stack.css before its own css/site.css. These rules live only here; a site's
   site.css keeps what differs per site and may override a rule below, but never copies one.
   Source of truth: Courses/uistack/site/css/stack.css. */
:root {
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bg: #fafaf8; --fg: #16161a; --fg2: #5a5a62; --fg3: #8b8b94;
  --line: #e4e4e0; --panel: #ffffff; --panel2: #f2f2ee; --accent: #1d4ed8;
  --radius: 14px; --gutter: 16px; --max: 1240px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111114; --fg: #ececf0; --fg2: #a6a6b0; --fg3: #6f6f78;
    --line: #26262c; --panel: #18181c; --panel2: #1f1f25; --accent: #7aa2ff;
  }
}
:root[data-theme="dark"] {
  --bg: #111114; --fg: #ececf0; --fg2: #a6a6b0; --fg3: #6f6f78;
  --line: #26262c; --panel: #18181c; --panel2: #1f1f25; --accent: #7aa2ff;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--ui); }
a { color: inherit; text-decoration: none; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* Header and the shared nav: a site's own links, then the stack links (href starting with /). */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 20px; height: 54px; }
.brand { font-weight: 700; letter-spacing: -0.01em; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.brand svg { width: 22px; height: 22px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--fg2); font-weight: 500; font-size: 14px; }
.nav a:hover, .nav a[aria-current] { background: var(--panel2); color: var(--fg); }
/* The stack nav is long: on a narrow screen it scrolls sideways instead of wrapping or widening the header. */
.brand { flex: none; }
.brand__site { flex: none; margin-left: -8px; padding-left: 10px; border-left: 1px solid var(--line); color: var(--fg2); font-weight: 600; font-size: 15px; white-space: nowrap; }
.brand__site:hover { color: var(--fg); }
.nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; }
@media (max-width: 560px) { .nav a { padding: 6px 8px; } }

/* Search, suggestions, group tabs, chips and dropdown filters */
.search { display: flex; gap: 10px; align-items: center; position: relative; }
.search input { flex: 1; max-width: 520px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); font: 15px var(--ui); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.count { color: var(--fg3); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.suggest { position: absolute; top: 46px; left: 0; width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); z-index: 30; overflow: hidden; }
.suggest button { display: flex; justify-content: space-between; width: 100%; padding: 9px 14px; border: 0; background: none; color: var(--fg); font: 14px var(--ui); text-align: left; cursor: pointer; }
.suggest button:hover, .suggest button[aria-selected="true"] { background: var(--panel2); }
.suggest button small { color: var(--fg3); }
.gtabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.gtab { padding: 6px 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--fg2); font: 600 13px/1.2 var(--ui); cursor: pointer; }
.gtab:hover { color: var(--fg); }
.gtab[aria-pressed="true"] { color: var(--fg); border-bottom-color: var(--fg); }
.chip { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--fg2); font: 500 12.5px/1.2 var(--ui); cursor: pointer; }
.chip:hover { border-color: var(--fg3); color: var(--fg); }
.chip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.chip small { color: inherit; opacity: 0.6; margin-left: 4px; }
.dd { position: relative; }
.dd__btn { display: flex; align-items: center; gap: 6px; padding: 7px 10px 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--fg2); font: 500 13px var(--ui); cursor: pointer; }
.dd__btn:hover { border-color: var(--fg3); color: var(--fg); }
.dd__btn[data-on="1"] { border-color: var(--fg); color: var(--fg); }
.dd__btn b { font-weight: 600; color: var(--fg); }
.dd__btn svg { width: 12px; height: 12px; opacity: 0.6; }
.dd__pop { position: absolute; top: 40px; left: 0; min-width: 220px; max-height: 340px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); z-index: 30; padding: 6px; }
.dd__pop label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; font: 13.5px var(--ui); color: var(--fg); cursor: pointer; }
.dd__pop label:hover { background: var(--panel2); }
.dd__pop label small { margin-left: auto; color: var(--fg3); font-variant-numeric: tabular-nums; }
.dd__pop label.off { color: var(--fg3); }
.dd__pop input { margin: 0; accent-color: var(--fg); }
@media (max-width: 560px) { .dd__pop { left: auto; right: 0; } }

/* Footer */
footer { border-top: 1px solid var(--line); padding: 20px 0 40px; color: var(--fg3); font-size: 13px; }

/* Sites menu: the seven stack sites behind one button at the right of the header, so each site's nav holds only its own links. */
.sites { position: relative; margin-left: 8px; flex: none; }
.brand__site + .sites, .brand + .sites { margin-left: auto; }
.sites summary { list-style: none; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--fg2); font-weight: 500; font-size: 13.5px; cursor: pointer; user-select: none; white-space: nowrap; }
.sites summary::-webkit-details-marker { display: none; }
.sites summary svg { width: 18px; height: 18px; }
.sites summary:hover, .sites[open] summary { border-color: var(--fg3); color: var(--fg); }
.sites summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sites__menu { position: absolute; top: 40px; right: 0; z-index: 40; width: 260px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.16); }
.sites__menu a { display: grid; gap: 1px; padding: 7px 10px; border-radius: 8px; color: var(--fg); }
.sites__menu a b { font-weight: 600; font-size: 14px; }
.sites__menu a small { color: var(--fg3); font-size: 12px; }
.sites__menu a:hover { background: var(--panel2); }
.sites__menu a[aria-current] { background: var(--panel2); }
.sites__menu a[aria-current] b::after { content: " \00b7 here"; color: var(--fg3); font-weight: 500; }
.sites__menu a:first-child { border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; margin-bottom: 4px; }
@media (max-width: 560px) { .sites summary span { display: none; } .sites summary { padding: 0 7px; } .sites__menu { right: -8px; } }
