/* Hub-only tokens; shared ones come from /shared/tokens.css. The background gradients
   derive from the palette, so they follow the visitor's palette choice. */
:root {
  --prefs-top: 3.75rem;
  --gradient-1: light-dark(rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.3));
  --gradient-2: light-dark(rgba(var(--secondary-rgb), 0.12), rgba(var(--secondary-rgb), 0.14));
  --gradient-3: light-dark(rgba(var(--accent-rgb), 0.06), rgba(var(--accent-rgb), 0.1));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

.mesh-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, var(--gradient-1) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 80% 70%, var(--gradient-2) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 50% 50%, var(--gradient-3) 0%, transparent 70%), var(--bg);
  animation: meshShift 18s ease-in-out infinite alternate;
}

.mesh-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .mesh-bg {
    animation: none;
  }
}

/* Shell style (E2-18): a faint grid instead of the glowing mesh, and no particles */
:root[data-style="shell"] .mesh-bg {
  background: var(--bg);
  animation: none;
}

:root[data-style="shell"] .mesh-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 35%, transparent 85%);
}

:root[data-style="shell"] .particles {
  display: none;
}

@keyframes meshShift {
  0% {
    filter: hue-rotate(0deg);
    transform: scale(1);
  }
  100% {
    filter: hue-rotate(12deg);
    transform: scale(1.03);
  }
}

.particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* Appearance switcher (/shared/prefs-menu.css), in the top-right corner */
.hub-prefs {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 5;
}

.hub {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.hub-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: 2.5rem 2rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* VA monogram; the stroke follows the palette */
.hub-mark {
  display: block;
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 1.25rem;
}

.hub-mark__tile {
  fill: var(--surface-2);
}

.hub-mark__from {
  stop-color: var(--accent-text);
}

.hub-mark__to {
  stop-color: var(--secondary);
}

.hub-name {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  text-transform: var(--display-case);
  font-size: clamp(1.45rem, 6.5vw, 1.8rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: var(--tracking-display);
  text-wrap: balance;
}

.hub-tagline {
  margin: 0 0 2rem;
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.hub-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hub-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--button-font);
  font-size: 0.95rem;
  font-weight: 500;
  text-transform: var(--button-case);
  text-decoration: none;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  transition:
    border-color var(--duration) var(--ease),
    transform var(--duration) var(--ease),
    background var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

.hub-link:focus-visible,
.hub-tool:focus-visible,
.hub-profile:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

.hub-link:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.hub-link--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: var(--shadow-glow);
}

.hub-link--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
  box-shadow: var(--shadow-glow-strong);
}

.hub-drawer-open {
  width: 100%;
  margin-top: 0.75rem;
  font-family: var(--button-font);
  cursor: pointer;
}

.hub-drawer-open svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.hub-link svg {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.hub-profiles {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.hub-profile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  color: var(--text-muted);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  transition:
    color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    transform var(--duration) var(--ease);
}

.hub-profile:hover {
  color: var(--accent-text);
  border-color: var(--accent-text);
  transform: translateY(-2px);
}

.hub-profile svg {
  width: 1.25rem;
  height: 1.25rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Tools & apps drawer (E2-09) ─────────────────────────────────────────── */

.drawer {
  box-sizing: border-box;
  width: min(26rem, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.drawer[open] {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  animation: drawer-in var(--duration-slow) var(--ease);
}

.drawer::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}

@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 0.75rem;
}

.drawer-title {
  margin: 0;
  font-family: var(--font-display);
  text-transform: var(--display-case);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: var(--tracking-display);
}

.drawer-close {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.drawer-close:hover {
  color: var(--text);
}

.drawer-close svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.drawer-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  margin: 0 1.25rem 1rem;
  padding: 0.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.drawer-tab {
  padding: 0.55rem;
  font: 600 0.9rem/1 var(--button-font);
  text-transform: var(--button-case);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
}

.drawer-tab[aria-selected="true"] {
  color: var(--on-accent);
  background: var(--accent);
}

.drawer-panel {
  overflow-y: auto;
  padding: 0 1.25rem 1.25rem;
}

.drawer-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.drawer-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  color: var(--text);
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition:
    border-color var(--duration) var(--ease),
    transform var(--duration) var(--ease);
}

.drawer-item:hover {
  border-color: var(--accent);
  transform: translateX(-2px);
}

.drawer-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

.drawer-icon svg {
  width: 1.2rem;
  height: 1.2rem;
}

.drawer-item-body {
  display: grid;
  gap: 0.15rem;
}

.drawer-item-name {
  font-weight: 600;
}

.drawer-item-desc {
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.drawer-tab:focus-visible,
.drawer-close:focus-visible,
.drawer-item:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

/* Phones: a bottom sheet */
@media (max-width: 640px) {
  .drawer {
    /* Anchored to the bottom only, so the sheet is as tall as its content */
    inset: auto 0 0;
    width: 100vw;
    height: auto;
    max-height: 85dvh;
    margin: 0;
    border-right: 1px solid var(--border);
    border-bottom: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .drawer[open] {
    animation-name: drawer-up;
  }
}

@keyframes drawer-up {
  from {
    transform: translateY(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .drawer[open] {
    animation: none;
  }
}

/* 404 page (site/404.html) */
.not-found-code {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 14vw, 5.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.not-found-title {
  font-size: clamp(1.4rem, 5vw, 1.9rem);
}

/* Page changes cross-fade (cross-document view transitions), unless motion is reduced */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}
