/**
 * AITopUp — drawer, buttons, account dropdown (TGDD header in header.css)
 * @package AITopUp
 */

/* Header — fixed on scroll (sticky breaks inside flex body + overflow-x) */
.site-header {
  position: fixed;
  top: var(--wp-admin-bar-h);
  left: 0;
  right: 0;
  width: 100%;
  z-index: 50;
  isolation: isolate;
  background: var(--header-bg);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--color-border-glow);
  box-shadow: var(--shadow-card), inset 0 1px 0 var(--glass-inset);
  transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, top 0.2s ease;
}
body.admin-bar {
  --wp-admin-bar-h: 46px;
}

@media screen and (min-width: 783px) {
  body.admin-bar {
    --wp-admin-bar-h: 32px;
  }
}
.site-header.is-scrolled {
  --header-h: 3.5rem;
  background: var(--header-scrolled-bg);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border-bottom-color: var(--accent-border-strong);
  box-shadow: var(--elevation-2), 0 0 0 1px var(--accent-border);
}
.header-inner {
  display: grid;
  grid-template-columns: var(--touch-min) 1fr auto;
  align-items: center;
  height: var(--header-h);
  max-height: 3.75rem;
  transition: height 0.3s ease;
  gap: 0.5rem;
}

@media (min-width: 1024px) {
  .header-inner {
    max-height: none;
  }
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.brand-logo-img--on-dark {
  display: none;
}

[data-theme="dark"] .footer-logo .brand-logo-img--light,
[data-theme="dark"] .drawer-logo .brand-logo-img--light {
  display: none;
}

[data-theme="dark"] .footer-logo .brand-logo-img--on-dark,
[data-theme="dark"] .drawer-logo .brand-logo-img--on-dark {
  display: block;
}

@media (hover: hover) {
  .site-logo:hover { opacity: 0.94; }
}

.site-logo:focus-visible {
  outline: 2px solid var(--accent-link);
  outline-offset: 4px;
  border-radius: 0.5rem;
}

/*
 * SVG wordmark (inc/helpers.php → aitopup_brand_logo_svg). Colours come from custom properties so one
 * inline copy serves the white header and dark footer/drawer. Paths sit inside a y-flipped group, so a
 * transform-origin of "50% 0%" is the visual bottom of a part.
 */
.atu-logo {
  --atu-ink: #0a0f1f;
  --atu-blue: #0052ff;
  --atu-plate: #ffffff;
  --atu-eye: #0a0f1f;
  display: block;
  width: auto;
  height: 2.25rem;
  max-width: 100%;
  aspect-ratio: 2877 / 961;
  overflow: visible;
}

.atu-logo__ink path { fill: var(--atu-ink); }
.atu-logo__plate path { fill: var(--atu-plate); }
.atu-logo__eye path { fill: var(--atu-eye); }
.atu-logo__swoosh path,
.atu-logo__i path,
.atu-logo__dot path,
.atu-logo__tip path,
.atu-logo__star path { fill: var(--atu-blue); }

.atu-logo__star,
.atu-logo__eye,
.atu-logo__eyes,
.atu-logo__dot,
.atu-logo__swoosh {
  transform-box: fill-box;
  transform-origin: center;
}

.atu-logo__tip {
  transform-box: fill-box;
  transform-origin: 50% 0%;
}

@media (min-width: 768px) {
  .site-header .site-logo .atu-logo {
    height: 2.75rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* Idle: the star twinkles, the robot blinks and its antenna sends a signal. */
  .atu-logo--animated .atu-logo__star { animation: atu-twinkle 5s ease-in-out 1.5s infinite; }
  .atu-logo--animated .atu-logo__eye { animation: atu-blink 5.5s ease-in-out 2.5s infinite; }
  .atu-logo--animated .atu-logo__tip { animation: atu-signal 3.2s ease-out 1s infinite; }
  .atu-logo--animated .atu-logo__dot { animation: atu-signal 3.2s ease-out 1.25s infinite; }
  .atu-logo--animated .atu-logo__dot + .atu-logo__dot { animation-delay: 1.4s; }
  .atu-logo--animated .atu-logo__eyes { transition: transform 0.25s ease; }

  /* First page of a visit: the swoosh draws in, the star lands, the robot opens its eyes. */
  .atu-logo--intro .atu-logo__swoosh { animation: atu-swoosh-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .atu-logo--intro .atu-logo__star {
    animation: atu-star-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s both,
      atu-twinkle 5s ease-in-out 2.5s infinite;
  }
  .atu-logo--intro .atu-logo__eye {
    animation: atu-eyes-open 0.3s ease-out 0.9s both,
      atu-blink 5.5s ease-in-out 3s infinite;
  }

  /* Hover / keyboard focus: the robot looks at the cursor side and the star spins once. */
  .site-logo:hover .atu-logo--animated .atu-logo__eyes,
  .site-logo:focus-visible .atu-logo--animated .atu-logo__eyes { transform: translateX(14%); }
  .site-logo:hover .atu-logo--animated .atu-logo__star,
  .site-logo:focus-visible .atu-logo--animated .atu-logo__star { animation: atu-star-spin 0.7s cubic-bezier(0.34, 1.56, 0.64, 1); }
  .site-logo:active .atu-logo--animated { transform: scale(0.97); }
  .site-logo .atu-logo--animated { transition: transform 0.12s ease; }
}

@keyframes atu-twinkle {
  0%, 70%, 100% { transform: scale(1) rotate(0deg); }
  80% { transform: scale(1.3) rotate(20deg); }
  90% { transform: scale(0.92) rotate(-6deg); }
}

@keyframes atu-blink {
  0%, 90%, 97%, 100% { transform: scaleY(1); }
  93% { transform: scaleY(0.1); }
}

@keyframes atu-signal {
  0%, 30%, 100% { transform: scale(1); }
  12% { transform: scale(1.22); }
}

@keyframes atu-swoosh-in {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes atu-star-in {
  from { transform: scale(0) rotate(-120deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes atu-eyes-open {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@keyframes atu-star-spin {
  from { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.35) rotate(-90deg); }
  to { transform: scale(1) rotate(-180deg); }
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.neon-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 9999px;
  background: var(--gradient-brand);
  background-size: 200% auto;
  color: var(--neon-badge-fg);
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--neon-shadow);
  border: 1px solid var(--glass-inset);
  animation: none;
}

.neon-badge.is-visible,
.cart-count.is-visible { display: flex; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s, transform 0.2s;
}

.btn:active { opacity: 0.88; transform: scale(0.98); }

@media (hover: hover) {
  .btn:hover { opacity: 0.92; transform: translateY(-1px); }
}

.btn-primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--gradient-brand);
  background-size: 200% auto;
  color: var(--btn-primary-fg);
  box-shadow: var(--glow-layered-primary), 0 0 0 1px var(--accent-border), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  animation: none;
}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--gradient-brand-shine);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.btn-primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-120%) skewX(-18deg);
  pointer-events: none;
}

.btn-primary:hover {
  box-shadow: var(--glow-layered-soft), 0 0 0 1px rgba(99, 102, 241, 0.28);
}

.btn-primary:hover::before {
  opacity: 0.35;
}

@media (hover: hover) and (min-width: 768px) {
  .btn-primary:hover::after {
    animation: shine-sweep 0.75s ease forwards;
  }
}

.btn-secondary {
  background: var(--card);
  color: var(--fg-bright);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-card);
}

.btn-secondary:hover {
  border-color: var(--color-border-glow);
  background: var(--card-hover);
  box-shadow: var(--shadow-card-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover { background: var(--card); color: var(--fg); }

.btn-lg { padding: 0.75rem 2rem; font-size: 1rem; border-radius: 0.75rem; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }

.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.menu-toggle:active {
  color: var(--fg-bright);
  background: var(--accent-surface);
}

@media (hover: hover) {
  .menu-toggle:hover {
    color: var(--fg-bright);
    background: var(--accent-surface);
    border-color: var(--color-border-glow);
  }
}

.menu-toggle:focus-visible {
  outline: 2px solid var(--accent-link);
  outline-offset: 2px;
}

.menu-toggle-bar {
  display: block;
  width: 1.125rem;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-toggle.is-open .menu-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-toggle.is-open .menu-toggle-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.menu-toggle.is-open .menu-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Account dropdown */
.header-account {
  position: relative;
  display: none;
}

.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: var(--touch-min);
  padding: 0 0.75rem;
  border-radius: 0.625rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.account-trigger:hover,
.account-trigger:focus-visible,
.header-account.is-open .account-trigger {
  color: var(--fg-bright);
  background: var(--accent-surface);
  border-color: var(--color-border-glow);
  outline: none;
}

.account-trigger--link { text-decoration: none; }

.account-trigger-label { display: none; }

.account-menu {
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  min-width: 10rem;
  margin: 0;
  padding: 0.375rem;
  list-style: none;
  border-radius: 0.625rem;
  background: var(--account-menu-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-elevated);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  isolation: isolate;
  z-index: 9999;
}

.account-menu a {
  display: flex;
  align-items: center;
  min-height: var(--touch-min);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}

.account-menu a:hover,
.account-menu a:focus-visible {
  color: var(--fg-bright);
  background: var(--accent-surface);
  outline: none;
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--nav-backdrop-bg);
  -webkit-tap-highlight-color: transparent;
}

.nav-backdrop.is-visible {
  display: block;
}

/* Mobile drawer */
.nav-mobile {
  display: none;
  position: fixed;
  inset: 0;
  left: auto;
  width: min(100%, 22rem);
  z-index: 60;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-left: 1px solid var(--color-border-glow);
  background: var(--nav-mobile-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  isolation: isolate;
  box-shadow: var(--mobile-nav-shadow), inset 0 1px 0 var(--glass-inset);
  transform: translateX(100%);
  transition: transform 0.28s ease-out;
  padding-top: var(--safe-top);
  padding-bottom: calc(1rem + var(--safe-bottom));
}

.nav-mobile.is-open {
  display: flex;
  flex-direction: column;
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  border-radius: 0.625rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.drawer-close svg { width: 1.25rem; height: 1.25rem; }

.drawer-close:hover,
.drawer-close:focus-visible {
  color: var(--fg-bright);
  background: var(--accent-surface);
  outline: none;
}

.drawer-logo {
  font-size: 1rem;
}

.drawer-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
}

.drawer-accordion {
  border-bottom: 1px solid var(--border);
}

.drawer-accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: var(--fg-bright);
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}

.drawer-accordion-trigger:hover,
.drawer-accordion-trigger:focus-visible {
  background: var(--accent-surface);
  outline: none;
}

.drawer-accordion-chevron {
  display: inline-flex;
  transition: transform 0.2s ease;
}

.drawer-accordion.is-open .drawer-accordion-chevron {
  transform: rotate(180deg);
}

.drawer-accordion-panel {
  padding: 0 0.5rem 0.5rem;
}

.drawer-needs-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.drawer-need-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}

.drawer-need-link:hover,
.drawer-need-link:focus-visible {
  color: var(--fg-bright);
  background: var(--accent-surface);
  outline: none;
}

.drawer-need-icon {
  display: inline-flex;
  flex-shrink: 0;
}

.drawer-links {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
}

.drawer-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}

.drawer-links a:hover,
.drawer-links a:focus-visible {
  color: var(--fg-bright);
  background: var(--accent-surface);
  outline: none;
}

.drawer-links a.is-active,
.drawer-links a[aria-current="page"] {
  color: var(--fg-bright);
  background: var(--accent-surface-strong);
}

.drawer-compare-badge {
  position: static;
  display: inline-flex;
  margin-left: auto;
}

.drawer-footer {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.drawer-account {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

.drawer-account-link {
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--fg-bright);
}

.drawer-account-link--muted {
  font-weight: 500;
  color: var(--muted);
}

.drawer-contact {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.drawer-contact-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: var(--touch-min);
  padding: 0.375rem 0;
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.2s;
}

.drawer-contact-link:hover,
.drawer-contact-link:focus-visible {
  color: var(--fg-bright);
  outline: none;
}

body.nav-open {
  overflow: hidden;
  touch-action: none;
}

body.nav-open .advisor-fab {
  visibility: hidden;
  pointer-events: none;
}
input,
select,
textarea {
  font-size: max(16px, 1rem);
}

@media (min-width: 1024px) {
  .menu-toggle { display: none; }
}

@media (max-width: 1023px) {
  .site-logo {
    justify-self: center;
    font-size: 1.0625rem;
    max-width: 100%;
    overflow: hidden;
  }
}
