/* ===== Modern Header ===== */
:root {
  --site-topbar-height: 0px;
  --site-header-main-height: 72px;
  --site-header-offset: var(--site-header-main-height);
  --header-menu-duration: 0.44s;
  --header-menu-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --header-accordion-duration: 0.4s;
}

.site-topbar {
  background: var(--site-topbar-bg, #0f172a);
  color: var(--site-topbar-text, #e2e8f0);
  border-bottom: 1px solid var(--site-topbar-border, rgba(148, 163, 184, 0.2));
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

html[data-theme="dark"] .site-topbar {
  background: var(--site-topbar-bg, #0f172a);
  color: var(--site-topbar-text, #f8fafc);
  border-bottom-color: var(--site-topbar-border, rgba(148, 163, 184, 0.22));
}

html[data-theme="dark"] .site-topbar-link:hover {
  color: var(--color-primary);
}

html[data-theme="dark"] .site-topbar-social {
  border-left-color: rgba(148, 163, 184, 0.28);
}

.site-topbar-inner {
  width: min(1280px, 94vw);
  margin: 0 auto;
  min-height: var(--site-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
}

.site-topbar-left,
.site-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.site-topbar-right {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.site-topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: inherit;
  font-weight: 700;
  white-space: nowrap;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.site-topbar-link:hover {
  color: var(--color-primary);
}

.site-topbar-icon {
  flex-shrink: 0;
  opacity: 0.92;
}

.site-topbar-label {
  opacity: 0.82;
  font-weight: 600;
}

.site-topbar-social {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding-left: 0.35rem;
  border-left: 1px solid var(--site-topbar-border, rgba(148, 163, 184, 0.2));
}

.site-topbar-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: inherit;
  opacity: 0.9;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.site-topbar-social-link:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.site-topbar-social-link svg {
  width: 14px;
  height: 14px;
}

.brand-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.brand-mark-seo {
  color: var(--color-primary);
}

.brand-mark-solution {
  color: var(--site-text-heading, #0f172a);
}

.brand-mark-x {
  color: var(--color-accent, #f59e0b);
  font-size: 0.92em;
}

html[data-theme="dark"] .brand-mark-seo {
  color: var(--color-primary);
}

html[data-theme="dark"] .brand-mark-solution {
  color: #ffffff;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 200;
  overflow: visible;
  background: var(--site-header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--site-header-border, var(--site-border));
  box-shadow: 0 1px 0 color-mix(in srgb, var(--color-primary) 6%, transparent);
}

body.site-body {
  padding-top: var(--site-header-offset);
}

.header-container {
  width: min(1280px, 94vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--site-header-main-height);
  padding: 0.5rem 0;
  overflow: visible;
}

.header-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.3rem 0.75rem;
  border-radius: 12px;
  background: var(--site-bg-card, #ffffff);
  border: 1px solid var(--site-border, rgba(30, 64, 175, 0.1));
  box-shadow: 0 2px 12px rgba(30, 64, 175, 0.07);
}

.header-brand-img {
  height: 44px;
  width: auto;
  max-width: 180px;
  min-width: 80px;
  object-fit: contain;
  object-position: left center;
  display: block;
  filter: none;
}

html[data-theme="dark"] .header-brand {
  background: var(--site-bg-card, #111111);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.28);
}

.header-brand-text {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--color-primary);
  letter-spacing: -0.02em;
}

/* Desktop nav */
.header-menu {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
  justify-content: center;
}

.header-menu-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--site-header-link, var(--site-text-muted));
  border-radius: 999px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.header-menu-link:hover,
.header-menu-link.is-active {
  color: var(--site-header-link-hover, var(--color-primary));
  background: var(--site-header-link-active-bg, color-mix(in srgb, var(--color-primary) 8%, transparent));
}

.header-menu-trigger svg {
  transition: transform 0.25s;
}

.header-menu-dropdown.is-open .header-menu-trigger svg {
  transform: rotate(180deg);
}

/* Dropdown panels */
.header-menu-dropdown {
  position: relative;
}

.header-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  min-width: 200px;
  background: var(--site-bg-card);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  box-shadow: var(--site-shadow);
  z-index: 300;
}

.header-menu-dropdown.is-open .header-dropdown-panel,
.header-menu-dropdown:hover .header-dropdown-panel {
  display: flex;
  flex-direction: column;
}

.header-dropdown-panel a {
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--site-text);
  transition: background 0.15s, color 0.15s;
}

.header-dropdown-panel a:hover {
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  color: var(--color-primary);
}

/* Mega menu */
.header-mega {
  flex-direction: row !important;
  gap: 0;
  padding: 1rem;
  min-width: 520px;
  left: 0;
  transform: none;
}

.header-menu-dropdown:has(.header-mega) {
  position: static;
}

.header-menu-dropdown:has(.header-mega) .header-dropdown-panel {
  left: 50%;
  transform: translateX(-50%);
}

.header-mega-col {
  flex: 1;
  padding: 0 0.75rem;
  border-right: 1px solid var(--site-border);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.header-mega-col:last-child {
  border-right: none;
}

.header-mega-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-primary);
  padding: 0.25rem 1rem 0.5rem;
}

.header-mega-col a {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

/* Right tools */
.header-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  overflow: visible;
}

.header-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--site-header-chip-border, var(--site-border));
  background: var(--site-header-chip-bg, var(--site-bg-card));
  color: var(--site-header-chip-color, var(--color-primary));
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s, background 0.2s, color 0.2s;
}

.header-icon-btn:hover {
  border-color: color-mix(in srgb, var(--color-primary) 55%, var(--site-header-chip-border, var(--site-border)));
  color: var(--site-header-link-hover, var(--color-primary));
  background: color-mix(in srgb, var(--color-primary) 12%, var(--site-header-chip-bg, var(--site-bg-card)));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 12%, transparent);
}

.header-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--color-primary);
  color: var(--site-btn-text, #fff);
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-login-btn,
.header-signup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 40px;
  padding: 0.45rem 1.05rem;
  border: 1px solid var(--site-header-chip-border, var(--site-border));
  border-radius: 999px;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.22s ease, color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, transform 0.2s ease;
}

.header-login-btn {
  color: var(--color-primary);
  padding-inline: 1.15rem;
}

.header-signup-btn {
  color: var(--color-primary);
  padding: 0.4rem 1rem 0.4rem 0.5rem;
}

.header-auth-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid currentColor;
  flex-shrink: 0;
}

.header-auth-icon svg {
  display: block;
}

.header-login-btn:hover,
.header-login-btn:focus-visible,
.header-signup-btn:hover,
.header-signup-btn:focus-visible {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--site-btn-text, #000);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--color-primary) 28%, transparent);
  transform: translateY(-1px);
}

.header-login-btn--drawer,
.header-signup-btn--drawer {
  flex: 1 1 0;
  min-width: 0;
}

.header-mobile-auth-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}

.header-user-menu { position: relative; z-index: 120; }
.header-user-menu.is-open { z-index: 10050; }
.header-user-trigger {
  display: flex; align-items: center; gap: .45rem;
  padding: .35rem .65rem .35rem .35rem; border-radius: 999px;
  border: 1px solid var(--site-header-chip-border, var(--site-border));
  background: var(--site-header-chip-bg, var(--site-bg-card));
  color: var(--site-header-chip-color, inherit);
  cursor: pointer; font-family: inherit; transition: border-color .2s, box-shadow .2s, background .2s;
}
.header-user-trigger:hover { border-color: color-mix(in srgb, var(--color-primary) 55%, var(--site-header-chip-border, var(--site-border))); }
.header-user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  overflow: hidden;
  padding: 1px;
  background: var(--color-primary, #2563eb);
  color: #fff; font-size: .75rem; font-weight: 800;
  display: grid; place-items: center;
  border: 1px solid rgba(15, 23, 42, 0.18);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.08),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.25);
}
.header-user-avatar img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 50%;
  display: block;
}
html[data-theme="dark"] .header-user-avatar {
  background: #111111;
  color: #c4ef17;
  border-color: rgba(196, 239, 23, 0.35);
}
.header-user-label { font-size: .8125rem; font-weight: 700; color: var(--site-header-chip-color, var(--site-text-heading)); }
.header-user-panel {
  position: absolute; top: calc(100% + .5rem); right: 0; min-width: 220px;
  max-height: min(70vh, 420px); overflow-y: auto;
  background: var(--site-bg-card); border: 1px solid var(--site-border);
  border-radius: 16px; box-shadow: 0 16px 48px rgba(0,0,0,.12);
  padding: .5rem; opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .2s, transform .2s, visibility .2s;
  z-index: 10051;
  pointer-events: none;
}
.header-user-menu.is-open .header-user-panel {
  opacity: 1; visibility: visible; transform: none;
  pointer-events: auto;
}
.header-user-info {
  padding: .75rem 1rem; border-bottom: 1px solid var(--site-border); margin-bottom: .35rem;
}
.header-user-info strong { display: block; font-size: .875rem; color: var(--site-text-heading); }
.header-user-info span { font-size: .75rem; color: var(--muted); }
.header-user-panel a {
  display: block; padding: .6rem 1rem; border-radius: 10px;
  font-size: .875rem; font-weight: 600; color: var(--site-text);
}
.header-user-panel a:hover { background: color-mix(in srgb, var(--color-primary) 8%, transparent); color: var(--color-primary); }

.header-user-signout-form {
  display: block;
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--site-border);
}

.signout-form-inline {
  margin: 0;
  display: block;
}

.signout-form-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  padding: 0;
  color: inherit;
  text-align: left;
  position: relative;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.signout-form-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-primary) 45%, transparent);
  outline-offset: 2px;
}

.signout-form-btn.is-loading {
  opacity: 0.85;
  pointer-events: none;
}

.signout-btn-content {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.signout-btn-icon {
  flex-shrink: 0;
}

.signout-form-btn.header-user-signout {
  width: 100%;
  justify-content: flex-start;
  padding: 0.62rem 0.85rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #dc2626;
}

.signout-form-btn.header-user-signout:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
}

.signout-form-btn.header-user-signout .signout-btn-spinner {
  border-color: rgba(220, 38, 38, 0.25);
  border-top-color: #dc2626;
}

.signout-form-inline .btn.signout-form-btn {
  width: 100%;
  padding: 0.72rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #dc2626;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.04);
}

.signout-form-inline .btn.signout-form-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
  color: #b91c1c;
}

.signout-form-inline .btn.signout-form-btn .signout-btn-spinner {
  border-color: rgba(220, 38, 38, 0.25);
  border-top-color: #dc2626;
}

.header-user-admin {
  color: var(--color-primary) !important;
  font-weight: 700 !important;
  border-top: 1px solid var(--site-border);
  margin-top: 0.25rem;
  padding-top: 0.75rem !important;
}

.header-cta {
  padding: 0.6rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--site-btn-text, #fff);
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: 999px;
  box-shadow: var(--shadow-primary);
  transition: transform 0.2s, filter 0.2s;
  margin-left: 0.25rem;
}

.header-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

/* Theme toggle — swap rotate (light = moon, dark = sun) */
.header-icon-btn.theme-toggle {
  display: inline-grid;
  place-content: center;
  padding: 0;
}

.site-header .theme-icon-moon {
  color: var(--color-primary);
}

.site-header .theme-icon-sun {
  color: #f59e0b;
}

/* Burger */
.header-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 1px solid var(--site-header-chip-border, var(--site-border));
  border-radius: var(--radius);
  background: var(--site-header-chip-bg, var(--site-bg-card));
  cursor: pointer;
}

.header-burger span {
  display: block;
  height: 2px;
  background: var(--site-header-chip-color, var(--site-text));
  border-radius: 2px;
  transition: transform 0.35s var(--header-menu-ease), opacity 0.3s var(--header-menu-ease);
}

.header-burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.header-burger.is-open span:nth-child(2) { opacity: 0; }
.header-burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer — YouTube-style slide from left */
.header-mobile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 450;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity;
  -webkit-tap-highlight-color: transparent;
}

.header-mobile-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.header-mobile-backdrop[hidden]:not(.is-open) {
  display: none !important;
}

.header-mobile {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 460;
  width: min(300px, 88vw);
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--site-bg);
  border-right: 1px solid var(--site-border);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.28);
  transform: translate3d(-105%, 0, 0);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.header-mobile.is-open,
.header-mobile.is-closing {
  will-change: transform;
}

.header-mobile.is-open {
  transform: translate3d(0, 0, 0);
}

.header-mobile.is-closing {
  pointer-events: none;
}

.header-mobile[hidden]:not(.is-open) {
  display: none !important;
}

.header-mobile-top {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.65rem 0.7rem 0.85rem;
  border-bottom: 1px solid var(--site-border);
  background: var(--site-bg-card);
}

.header-mobile-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  padding: 0.2rem 0;
}

.header-mobile-brand-img {
  height: 34px;
  width: auto;
  max-width: 148px;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.header-mobile-brand-text {
  font-weight: 800;
  font-size: 1rem;
  color: var(--color-primary);
  letter-spacing: -0.02em;
}

.header-mobile-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: color-mix(in srgb, var(--site-text-heading) 6%, transparent);
  color: var(--site-text-heading);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.header-mobile-close svg {
  display: block;
  stroke-width: 2;
}

.header-mobile-close:hover {
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  color: var(--color-primary);
}

.header-mobile-close:active {
  transform: scale(0.96);
}

.header-mobile-inner {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0.65rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.header-mobile-signin-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
  padding: 0.85rem 0.5rem 0.35rem;
}

.header-mobile-signin-hint {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--site-text-muted);
  max-width: 100%;
}

.header-mobile-divider {
  height: 1px;
  margin: 0.35rem 0.5rem;
  background: var(--site-border);
  flex-shrink: 0;
}

.header-mobile-section-label {
  margin: 0.5rem 0.35rem 0.15rem;
  padding: 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--site-text-muted);
}

.header-mobile-nav {
  display: flex;
  flex-direction: column;
}

.header-mobile-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 44px;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--site-text);
  transition: background 0.18s ease, color 0.18s ease;
}

.header-mobile-item-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  color: var(--site-text-heading);
}

.header-mobile-item-icon svg {
  display: block;
}

.header-mobile-item:hover,
.header-mobile-item:active {
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  color: var(--color-primary);
}

.header-mobile-item:hover .header-mobile-item-icon,
.header-mobile-item:active .header-mobile-item-icon {
  color: var(--color-primary);
}

.header-mobile-section-flat {
  display: flex;
  flex-direction: column;
}

.header-mobile-link,
.header-mobile-sublink {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--site-text-muted);
  border-bottom: none;
  transition: color 0.2s ease, background 0.2s ease;
}

.header-mobile-sublink {
  padding-left: 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--site-text-muted);
}

.header-mobile-link:hover,
.header-mobile-link:active,
.header-mobile-sublink:hover,
.header-mobile-sublink:active {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 6%, transparent);
}

.header-mobile-accordion {
  margin-bottom: 0.15rem;
}

.header-mobile-accordion-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--site-text);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.header-mobile-accordion-btn:hover,
.header-mobile-accordion-btn:active {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 5%, transparent);
}

.header-mobile-chevron {
  flex-shrink: 0;
  color: var(--site-text-muted);
  transition: transform var(--header-accordion-duration) var(--header-menu-ease),
    color 0.25s ease;
}

.header-mobile-accordion.is-open .header-mobile-chevron {
  transform: rotate(180deg);
  color: var(--color-primary);
}

.header-mobile-accordion-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--header-accordion-duration) var(--header-menu-ease);
}

.header-mobile-accordion.is-open .header-mobile-accordion-panel {
  grid-template-rows: 1fr;
}

.header-mobile-accordion-inner {
  overflow: hidden;
  min-height: 0;
  padding-bottom: 0.35rem;
  opacity: 0;
  transition: opacity calc(var(--header-accordion-duration) * 0.85) var(--header-menu-ease);
}

.header-mobile-accordion.is-open .header-mobile-accordion-inner {
  opacity: 1;
}

.header-mobile.is-closing .header-mobile-accordion-inner {
  opacity: 0;
  transition-duration: calc(var(--header-accordion-duration) * 0.7);
}

.header-mobile-sublabel {
  margin: 0.55rem 0 0.1rem;
  padding: 0 0.65rem 0 1.1rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.header-mobile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.85rem;
  padding: 0 0.2rem 0.35rem;
}

html.mobile-nav-open,
body.mobile-nav-open {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body.mobile-nav-open #page-transition-root,
body.mobile-nav-open .site-header {
  touch-action: none;
}

.header-mobile-auth {
  display: none;
}

.header-desktop-auth {
  display: inline-flex;
}

/* Responsive */
@media (max-width: 1100px) {
  .header-menu-link { padding: 0.5rem 0.6rem; font-size: 0.8125rem; }
  .header-desktop-auth { display: none; }
}

@media (max-width: 960px) {
  .header-menu { display: none; }
  .header-burger { display: flex; }
  .header-cta { display: none; }
  .header-container {
    width: 100%;
    max-width: 100%;
    min-height: 64px;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(4px, env(safe-area-inset-right, 0px));
  }
  .header-tools { gap: 0.3rem; }
  .header-icon-btn { width: 36px; height: 36px; }
  :root {
    --site-header-main-height: 64px;
    --site-header-offset: 64px;
  }

  .site-header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 1px 0 var(--site-header-border, var(--site-border));
  }

  body.mobile-nav-open {
    padding-top: var(--site-header-offset);
  }
}

@media (prefers-reduced-motion: reduce) {
  .header-mobile,
  .header-mobile-backdrop,
  .header-mobile-accordion-panel,
  .header-mobile-chevron,
  .header-mobile-inner {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 961px) {
  .header-mobile,
  .header-mobile-backdrop {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .site-topbar-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.45rem 0;
  }
  .site-topbar-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.55rem;
  }
  .site-topbar-link {
    font-size: 0.68rem;
  }
  .site-topbar-label {
    display: none;
  }
}

@media (max-width: 640px) {
  .header-user-label { display: none; }
  .header-user-trigger { padding-right: 0.45rem; }
}

@media (max-width: 480px) {
  .header-brand-img { height: 36px; max-width: 140px; }
}

.site-header.is-scrolled {
  box-shadow: 0 4px 24px color-mix(in srgb, var(--color-primary) 10%, transparent);
}

@media (min-width: 961px) {
  .site-header {
    transition: box-shadow 0.35s var(--header-menu-ease);
  }
}
