:root {
  /* Backgrounds - black/charcoal dominant */
  --bg: #000000;
  --bg-card: #0d0d0d;
  --bg-elevated: #1a1a1a;
  --bg-surface: #141414;

  /* Text - desktop hierarchy */
  --text-bright: #fafafa;
  --text-primary: rgba(255,255,255,0.85);
  --text-secondary: rgba(255,255,255,0.65);
  --text-tertiary: rgba(255,255,255,0.55);
  --text-muted: rgba(255,255,255,0.45);
  --text-faint: rgba(255,255,255,0.2);
  --text: var(--text-primary);

  /* Borders */
  --border: rgba(255,255,255,0.08);
  --border-light: rgba(255,255,255,0.12);

  /* Accent - desktop mahogany */
  --accent: #6B2E1B;
  --accent-glow: rgba(107,46,27,0.30);
  --accent-hover: rgba(107,46,27,0.07);
  --accent-subtle: rgba(107,46,27,0.10);
  --accent-active: rgba(107,46,27,0.16);
  --accent-ring: rgba(107,46,27,0.14);
  --accent-border: rgba(107,46,27,0.40);
  --focus-ring: #fbbf24;
  --focus-ring-glow: rgba(251,191,36,0.35);

  /* Status */
  --status-green: #22c55e;
  --status-yellow: #eab308;
  --status-red: #ef4444;
  --status-green-rgb: 34,197,94;
  --status-yellow-rgb: 234,179,8;
  --status-red-rgb: 239,68,68;

  /* Glass */
  --glass-base: rgba(255,255,255,0.07);
  --glass-hover: rgba(255,255,255,0.10);
  --glass-active: rgba(255,255,255,0.14);

  /* Deprecated aliases */
  --green: var(--status-green);
  --yellow: var(--status-yellow);
  --red: var(--status-red);

  /* Layout */
  --max-width: 1100px;
  --radius: 16px;
  --radius-sm: 8px;
}

/* ── Shared Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

:where(a[href], button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 2px solid var(--focus-ring) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 4px var(--focus-ring-glow) !important;
}

a[href="#main"]:focus,
a[href="#main"]:focus-visible {
  position: fixed !important;
  top: 12px !important;
  left: 12px !important;
  z-index: 10000 !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
  padding: 10px 14px !important;
  border-radius: var(--radius-sm) !important;
  background: var(--bg-elevated) !important;
  color: var(--text) !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── Nav ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(0, 0, 0, 0.85);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-cta {
  background: var(--accent);
  color: var(--text-bright);
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.nav-cta:hover {
  opacity: 0.85;
}

/* Hamburger toggle */
.nav-toggle {
  display: none;
  border: none;
  background: none;
  padding: 4px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
  margin: 3px 0;
}

/* ── Footer ── */
.footer {
  margin-top: auto;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

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

.footer-links a {
  color: var(--text-muted);
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  overflow-wrap: anywhere;
}

/* ── Mobile Responsive ── */
@media (max-width: 640px) {
  .nav-inner {
    height: auto;
    padding: 12px 24px;
    flex-wrap: wrap;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    gap: 4px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 8px 0;
  }

  .nav-toggle {
    display: block;
  }

  .nav-cta {
    margin-left: auto;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }
}

/* ── Nav Auth ── */
#nav-auth {
  display: flex;
  align-items: center;
}

.nav-signin {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.15s;
  padding: 8px 16px;
  white-space: nowrap;
}

.nav-signin:hover {
  color: var(--text);
}

.nav-user {
  position: relative;
}

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 999px;
  transition: background 0.15s;
  font-family: inherit;
}

.nav-user-btn:hover,
.nav-user-btn:focus-visible {
  background: var(--glass-base);
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.nav-username {
  font-size: 0.875rem;
  color: var(--text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  min-width: 160px;
  padding: 4px 0;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.nav-dropdown.active {
  display: block;
}

.nav-dropdown a,
.nav-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
  text-decoration: none;
}

.nav-dropdown a:hover,
.nav-dropdown button:hover,
.nav-dropdown a:focus-visible,
.nav-dropdown button:focus-visible {
  background: var(--glass-base);
  color: var(--text);
}

@media (max-width: 640px) {
  .nav-username {
    display: none;
  }
  .nav-signin {
    padding: 8px 10px;
  }
}
