/* ---- Container ---- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
}

/* ---- Brand ---- */
.lockup { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.lockup:hover { text-decoration: none; }
.brand-mark { color: var(--green); flex: none; }
.wordmark { font-family: var(--font-display); line-height: 1; color: var(--green); }
.wm-halal { font-weight: 600; }
.wm-disc { font-weight: 400; font-style: italic; }
:root[data-theme="dark"] .wm-halal { color: var(--paper); }
:root[data-theme="dark"] .wm-disc { color: var(--amber); }

/* ---- TopNav ---- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topnav .container { height: 100%; display: flex; align-items: center; gap: 18px; }
.topnav .spacer { flex: 1; }
.topnav .lockup { flex: 0 0 auto; }
.nav-links { display: flex; align-items: center; gap: 24px; flex: 0 0 auto; }
.nav-link {
  color: var(--sub);
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  padding: 7px 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav-link:hover { color: var(--ink); text-decoration: none; }
.nav-link.is-active { color: var(--ink); border-bottom-color: var(--green); }

.search-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: clamp(172px, 17vw, 224px);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--round);
  padding: 8px 14px;
  color: var(--faint);
  font-size: 14px;
  flex: 0 1 auto;
  white-space: nowrap;
}
.search-chip .icon { width: 16px; height: 16px; }
.search-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-chip kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-alt);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--sub);
}

.locale-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 40px;
  padding: 3px;
  border: 1.5px solid var(--line);
  border-radius: var(--round);
  background: var(--surface);
  flex: 0 0 auto;
}
.locale-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 54px;
  height: 32px;
  color: var(--sub);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 0 8px;
  border-radius: calc(var(--round) - 6px);
  text-decoration: none;
}
.locale-link:hover { color: var(--ink); text-decoration: none; }
.locale-link.is-active {
  background: var(--green);
  color: var(--on-green);
}
.locale-flag { font-size: 13px; line-height: 1; }
.locale-code {
  font-family: var(--font-mono);
  letter-spacing: 0;
}

.theme-toggle {
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--sub);
  width: 40px; height: 40px;
  border-radius: var(--round);
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle .icon { width: 18px; height: 18px; }

/* Theme toggle icon swap */
.theme-icon-sun { display: none; }
.theme-icon-moon { display: inline-flex; }
:root[data-theme="dark"] .theme-icon-sun { display: inline-flex; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-icon-sun { display: inline-flex; }
  :root:not([data-theme]) .theme-icon-moon { display: none; }
}

/* Account dropdown (native <details>) */
.nav-menu { position: relative; }
.nav-menu summary { list-style: none; cursor: pointer; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 168px; padding: 6px; z-index: 50;
}
.nav-menu-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--ink); background: transparent; border: none;
  font-size: 14px; font-weight: 500;
}
.nav-menu-item:hover { background: var(--surface-alt); text-decoration: none; }
.nav-menu-signout { color: var(--amber); }

/* ---- Footer ---- */
.footer {
  margin-top: 80px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 48px 0 28px;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; }
.footer h4 { font-family: var(--font-body); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); font-weight: 700; margin-bottom: 14px; }
.footer ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer a { color: var(--sub); font-size: 14.5px; }
.footer-tagline { color: var(--sub); font-size: 14.5px; margin: 14px 0; max-width: 260px; }
.footer-bar {
  margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 16px;
  color: var(--faint); font-size: 13px;
}

/* ---- Bottom nav (mobile < 480) ---- */
.bottom-nav { display: none; }

/* ---- Responsive ---- */
@media (max-width: 920px) {
  .nav-links { display: none; }
}
@media (max-width: 1120px) {
  .search-chip { width: 44px; min-width: 44px; justify-content: center; padding-inline: 0; }
  .search-chip span, .search-chip kbd { display: none; }
}
@media (max-width: 760px) {
  .nav-cta-label { display: none; }
  .locale-switch { display: none; }
}
@media (max-width: 1080px) {
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bar { flex-direction: column; }
}
@media (max-width: 480px) {
  .topnav { display: none; }
  .bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: var(--surface);
    border-top: 1px solid var(--line);
    justify-content: space-around;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  }
  .bottom-nav a { color: var(--sub); display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; }
  .bottom-nav a.is-active { color: var(--green); }
  .bottom-nav .icon { width: 22px; height: 22px; }
  body { padding-bottom: 64px; }
}
