@import url('/design-system.css');
:root {
  --site-header-height: 80px;
  --surface: #fff;
  --lettering: color-mix(in srgb, #A5ADB5 26%, #000);
  --shimmer-edge: #A79BBF;
  --shimmer-core: #A5ADB5;
  --switch-knob: #000;
  --switch-track: #fff;
  background: var(--surface);
  scrollbar-gutter: stable;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #000;
  --lettering: color-mix(in srgb, var(--shimmer-core) 27%, #fff);
  --switch-knob: #fff;
  --switch-track: #000;
}

.theme-control {
  position: fixed;
  z-index: 1;
  top: calc(clamp(16px, 3vw, 34px) + env(safe-area-inset-top));
  right: calc(clamp(16px, 3vw, 34px) + env(safe-area-inset-right));
  display: grid;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
}

:root:active-view-transition-type(theme-change) .theme-control {
  view-transition-name: theme-switch;
}

.theme-state {
  position: absolute;
  opacity: 0;
  margin: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: inherit;
}

/* Switch styling adapted from Uiverse.io by mobinkakei. */
.theme-track {
  isolation: isolate;
  display: block;
  width: 60px;
  height: 30px;
  border-radius: 15px;
  overflow: hidden;
  pointer-events: none;
  background: var(--switch-track);
  box-shadow: 0 3px 12px rgb(0 0 0 / 16%), inset 0 0 0 1px rgb(128 128 128 / 24%);
  transition: background-color 0.4s ease;
}

.theme-indicator {
  display: block;
  width: 22px;
  height: 22px;
  margin: 4px;
  border-radius: 50%;
  background: var(--switch-knob);
  transition: transform 0.4s cubic-bezier(0.25, 0.75, 0.25, 1.1), background-color 0.4s ease;
}

.theme-state:checked + .theme-track .theme-indicator {
  transform: translateX(30px);
}

.theme-state:focus-visible + .theme-track {
  outline: 2px solid var(--lettering);
  outline-offset: 5px;
}

::view-transition {
  pointer-events: none;
}

::view-transition-old(root),
:root:active-view-transition-type(theme-change)::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

@property --wave-front {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

:root:active-view-transition-type(theme-change)::view-transition-new(root) {
  z-index: 1;
  mask-image: radial-gradient(circle at var(--theme-wave-x, 50%) var(--theme-wave-y, 50%),
    #000 max(0px, calc(var(--wave-front) - 100px)),
    transparent calc(var(--wave-front) + 18px));
}

::view-transition-group(theme-switch) {
  z-index: 2;
  animation: none;
}

::view-transition-old(theme-switch) {
  display: none;
}

::view-transition-new(theme-switch) {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .theme-track, .theme-indicator { transition: none; }
}

.hub-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 60px;
  align-items: center;
  gap: 14px;
  box-sizing: border-box;
  min-height: var(--site-header-height);
  padding: 14px clamp(12px, 4vw, 56px);
  background: var(--surface);
  transition: box-shadow .2s ease, transform .26s cubic-bezier(.2,.75,.25,1);
}

:root[data-scrolled="true"] .hub-header {
  box-shadow: 0 1px 0 color-mix(in srgb, var(--lettering) 14%, transparent);
}

/* Scrolling down: the nav steps aside. Scrolling up brings it back.
   Only transform changes — the header keeps its height, so the page never jumps. */
:root[data-header-hidden="true"] .hub-header {
  transform: translateY(-100%);
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .hub-header { transition: none; }
}

.hub-nav {
  grid-column: 2;
  position: relative;
  display: flex;
  gap: 4px;
  justify-self: center;
  max-width: 100%;
  box-sizing: border-box;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.hub-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0 15px;
  border-radius: 999px;
  font: 550 14px/1.2 system-ui, sans-serif;
  color: inherit;
  text-decoration: none;
}

.hub-nav a {
  position: relative;
  flex: none;
  scroll-snap-align: center;
  white-space: nowrap;
}

.hub-nav:not([data-liquid]) a[aria-current] {
  background: var(--switch-knob);
  color: var(--switch-track);
}

.hub-nav { --liquid-nav-inset: 4px; }

.hub-header a:focus-visible {
  outline: 2px solid var(--lettering);
  outline-offset: 2px;
}

.hub-header .theme-control {
  position: relative;
  inset: auto;
  grid-column: 3;
}

@media (max-width: 640px) {
  .hub-header { grid-template-columns: minmax(0, 1fr) 60px; gap: 8px; }
  .hub-nav { grid-column: 1; justify-self: stretch; }
  .hub-header .theme-control { grid-column: 2; }
  .hub-nav a { padding-inline: 11px; font-size: 13px; }
}
