:root {
  --shell-bg: rgba(5, 9, 14, 0.88);
  --shell-ink: #e9f3f4;
  --shell-mute: #91a4ad;
  --shell-line: rgba(157, 207, 217, 0.2);
  --shell-hover: rgba(88, 214, 225, 0.09);
  --shell-mark: #7bd8e3;
}

html[data-theme="light"] {
  --bg0: #f3efe4;
  --bg1: #e7ecdf;
  --panel: rgba(255, 253, 246, 0.82);
  --panel-glass: rgba(255, 253, 246, 0.7);
  --foam: #173842;
  --tide: #087f91;
  --gold: #9c6412;
  --ember: #bf4d35;
  --violet: #68509f;
  --ok: #246d4e;
  --ink: #172a31;
  --mute: #5e6e73;
  --border: rgba(32, 69, 78, 0.17);
  --border-light: rgba(32, 69, 78, 0.32);
  --shell-bg: rgba(248, 245, 235, 0.9);
  --shell-ink: #182c32;
  --shell-mute: #62747a;
  --shell-line: rgba(31, 68, 77, 0.18);
  --shell-hover: rgba(4, 127, 145, 0.08);
  --shell-mark: #087f91;
}

html[data-theme="dark"] {
  --bg0: #04070b;
  --bg1: #0a1118;
}

body { background-color: var(--bg0); }
body.site-shell-injected { padding-top: 4.4rem; }

.site-header.site-header--shell {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(0.8rem, 2vw, 2.2rem);
  min-height: 4.1rem;
  padding: 0.55rem clamp(0.8rem, 2.2vw, 2rem);
  border: 0;
  border-bottom: 1px solid var(--shell-line);
  background: var(--shell-bg);
  color: var(--shell-ink);
  box-shadow: 0 0.75rem 2rem rgba(4, 8, 12, 0.08);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.site-header--shell .brand {
  display: inline-flex;
  align-items: baseline;
  margin: 0;
  color: var(--shell-ink);
  font: 650 0.84rem/1 "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}
.site-header--shell .brand:hover { color: var(--shell-ink); }
.site-header--shell .brand span { color: var(--gold); }

.site-header--shell .nav--site-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-header--shell .nav--site-shell::-webkit-scrollbar { display: none; }
.site-header--shell .nav--site-shell a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  flex: 0 0 auto;
  min-height: 2.45rem;
  padding: 0.45rem 0.68rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--shell-mute);
  background: transparent;
  font: 520 0.7rem/1 "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.035em;
  text-shadow: none;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.site-header--shell .nav--site-shell a i {
  width: 1rem;
  color: var(--shell-mark);
  font: 500 0.76rem/1 "IBM Plex Mono", Menlo, monospace;
  text-align: center;
}
.site-header--shell .nav--site-shell a:hover,
.site-header--shell .nav--site-shell a.active {
  border-color: var(--shell-line);
  color: var(--shell-ink);
  background: var(--shell-hover);
  text-shadow: none;
}
.site-header--shell .nav--site-shell a.active::after {
  content: "";
  position: absolute;
  right: 0.7rem;
  bottom: 0.22rem;
  left: 0.7rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.site-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  white-space: nowrap;
}
.site-header--shell .claim-pill,
.site-header--shell .header-action {
  display: none;
}
.site-header--shell .locale-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
  border: 0;
  font: 600 0.58rem/1 "IBM Plex Mono", Menlo, monospace;
  letter-spacing: 0.06em;
}
.site-header--shell .locale-switch a,
.site-header--shell .locale-switch b {
  min-width: 1.78rem;
  padding: 0.35rem 0.32rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--shell-mute);
  background: transparent;
  text-align: center;
}
.site-header--shell .locale-switch a:hover { border-color: var(--shell-line); color: var(--shell-ink); }
.site-header--shell .locale-switch b { color: var(--bg0); background: var(--shell-ink); }

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--shell-line);
  border-radius: 999px;
  color: var(--shell-mute);
  background: transparent;
  font: 600 0.55rem/1 "IBM Plex Mono", Menlo, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.theme-switch:hover { color: var(--shell-ink); background: var(--shell-hover); }
.theme-switch [data-theme-icon] { color: var(--gold); font-size: 0.86rem; }

@media (max-width: 940px) {
  .site-header.site-header--shell {
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.7rem;
    padding-block: 0.48rem;
  }
  .site-header--shell .nav--site-shell {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }
  .site-tools { grid-column: 2; grid-row: 1; }
  body.site-shell-injected { padding-top: 6.8rem; }
}

@media (max-width: 560px) {
  .site-header--shell .nav--site-shell a { min-height: 2.1rem; padding: 0.34rem 0.5rem; font-size: 0.64rem; }
  .site-header--shell .nav--site-shell a i { display: none; }
  .theme-switch [data-theme-label] { display: none; }
  .theme-switch { min-width: 2rem; justify-content: center; padding-inline: 0.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header--shell *, .theme-switch { transition: none !important; }
}
