/* ═══════════════════════════════════════════════════════════════════
   chrome.css — sticky header, sign-in menu, mobile nav, footer.
   Desktop nav shows inline from 960px; below that it folds into the
   menu button, which also carries the theme switch.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Header ────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgb(var(--canvas));
  border-bottom: 1px solid rgb(var(--line));
}

.header-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-inline-end: auto;
  border-radius: var(--radius-sm);
}

.brand-mark { width: 36px; height: 36px; flex: none; }

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  line-height: 1.1;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: rgb(var(--fg));
  white-space: nowrap;
}

.brand-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(var(--fg-subtle));
  white-space: nowrap;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-list a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: rgb(var(--fg-muted));
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav-list a:hover {
  color: rgb(var(--fg));
  background: rgb(var(--surface-muted));
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgb(var(--line));
  border-radius: var(--radius-sm);
  background: rgb(var(--surface));
  color: rgb(var(--fg-muted));
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover {
  color: rgb(var(--fg));
  background: rgb(var(--surface-muted));
  border-color: rgb(var(--line-strong));
}
.icon-btn svg { width: 18px; height: 18px; }

/* Moon in light mode (switch to dark), sun in dark mode. */
html.dark .icon-moon,
html:not(.dark) .icon-sun { display: none; }

.nav-toggle .icon-close,
.nav-open .nav-toggle .icon-menu { display: none; }
.nav-open .nav-toggle .icon-close { display: block; }

/* ── Sign-in menu ──────────────────────────────────────────────────── */
.signin { position: relative; }

.signin-btn .chevron {
  width: 14px;
  height: 14px;
  color: rgb(var(--fg-subtle));
  transition: transform 0.15s ease;
}
.signin-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 300px;
  padding: 6px;
  border: 1px solid rgb(var(--line));
  border-radius: var(--radius);
  background: rgb(var(--surface));
  box-shadow: var(--shadow-pop);
}
.menu[hidden] { display: none; }

.menu-title {
  padding: 8px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgb(var(--fg-subtle));
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.menu-list a,
.menu-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: rgb(var(--fg));
}
.menu-list a:hover,
.menu-foot:hover { background: rgb(var(--surface-muted)); }

.menu-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.menu-main .flag { width: 24px; height: 18px; font-size: 12px; }

.menu-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgb(var(--fg-subtle));
}

.menu-foot {
  border-top: 1px solid rgb(var(--line));
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: rgb(var(--fg-muted));
}
.menu-foot svg { width: 16px; height: 16px; }

/* ── Theme switch row (inside the folded nav) ──────────────────────── */
.nav-theme {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 8px;
  border: 0;
  border-top: 1px solid rgb(var(--line));
  background: none;
  font-size: 16px;
  font-weight: 500;
  color: rgb(var(--fg));
  cursor: pointer;
}

.switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex: none;
  border-radius: 999px;
  background: rgb(var(--line-strong));
  transition: background-color 0.15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgb(var(--surface));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
  transition: transform 0.15s ease;
}
html.dark .switch { background: rgb(var(--accent)); }
html.dark .switch::after { transform: translateX(16px); background: rgb(var(--fg)); }

/* ── Folded nav (below 960px) ──────────────────────────────────────── */
@media (max-width: 959.98px) {
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px var(--gutter) 12px;
    border-bottom: 1px solid rgb(var(--line));
    background: rgb(var(--canvas));
    box-shadow: var(--shadow-pop);
  }
  .nav-open .site-nav { display: flex; }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-list a {
    min-height: 48px;
    padding: 0 8px;
    font-size: 16px;
    color: rgb(var(--fg));
  }

  .nav-theme { display: flex; }
  .header-theme { display: none; }
}

@media (min-width: 960px) {
  .nav-toggle { display: none; }
}

/* Narrow phones: the menu spans the viewport under the header. */
@media (max-width: 639.98px) {
  .menu {
    position: fixed;
    top: calc(var(--header-h) + 8px);
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
  }
}

@media (max-width: 379.98px) {
  .brand-mark { width: 32px; height: 32px; }
  .brand-name { font-size: 14px; }
  .header-bar { gap: 10px; }
}

/* ── Footer ────────────────────────────────────────────────────────── */
.site-footer {
  background: rgb(var(--surface));  /* white in light mode: matches the lockup's own background */
  border-top: 1px solid rgb(var(--line));
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-block: 48px 32px;
}

.footer-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: start;
}

@media (min-width: 860px) {
  .footer-top {
    grid-template-columns: auto 1fr auto;
    gap: 48px;
  }
}

.footer-brand {
  display: inline-flex;
  justify-self: start;
  border-radius: var(--radius-sm);
}

.footer-lockup { width: 132px; }

.footer-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.footer-mark img { width: 40px; height: 40px; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 14px;
  font-weight: 500;
  color: rgb(var(--fg-muted));
  transition: color 0.15s ease;
}
.footer-links a:hover { color: rgb(var(--fg)); }

@media (min-width: 860px) {
  .footer-nav { justify-self: center; }
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 20px;
  border-top: 1px solid rgb(var(--line));
  font-size: 13px;
  color: rgb(var(--fg-subtle));
}
