/* Topbar — True Liquid Glass (SVG filter-driven) */
.topbar {
  position: fixed;
  top: clamp(10px, 1.5vw, 18px);
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  height: clamp(38px, 4vw, 48px);
  z-index: 50;
  border-radius: clamp(10px, 1.2vw, 14px);
  display: inline-flex;
  align-items: center;
  overflow: visible;
  border: 1px solid rgba(200, 200, 210, 0.35);
}

/* Glass refraction layer — the real liquid glass via SVG filter */
.topbar::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  filter: url(#topbar-glass);
  -webkit-filter: url(#topbar-glass);
  overflow: hidden;
  isolation: isolate;
}

/* Inner glow — soft inset light, kept subtle for transparency */
.topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  box-shadow:
    inset 1px 1px 0px -1px rgba(255, 255, 255, 0.5),
    inset 0 0 2px 0.5px rgba(255, 255, 255, 0.4);
  background-color: rgb(200 200 210 / 10%);
}

/* Content Layer */
.topbar-content {
  position: relative;
  z-index: 5;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(8px, 1vw, 14px);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', sans-serif;
  font-size: clamp(13px, 1.2vw, 15px);
  font-weight: 500;
  color: #636e72;
  letter-spacing: 0.01em;
}

/* ===== TOPBAR NAV BUTTONS (left group) ===== */
.topbar-nav-group {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.5vw, 8px);
}

/* Individual glass button */
.topbar-glass-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  height: clamp(28px, 3vw, 34px);
  padding: 0 clamp(10px, 1vw, 14px);
  background: transparent;
  border-radius: 9999px;
  outline: none;
  border: none;
  z-index: 0;
  font-family: inherit;
  font-size: clamp(11px, 1vw, 13px);
  font-weight: 500;
  color: #636e72;
  letter-spacing: 0.02em;
  transition: transform 0.15s ease;
  text-decoration: none;
}

.topbar-glass-btn:hover {
  transform: scale(1.04);
}

.topbar-glass-btn:active {
  transform: scale(0.97);
}

/* Glass refraction on buttons */
.topbar-glass-btn::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: 9999px;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  filter: url(#btn-glass);
  -webkit-filter: url(#btn-glass);
  overflow: hidden;
  isolation: isolate;
}

/* Inner glow on buttons */
.topbar-glass-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: 9999px;
  box-shadow:
    inset 2px 2px 0px -2px rgba(255, 255, 255, 0.7),
    inset 0 0 3px 1px rgba(255, 255, 255, 0.7);
  background-color: rgb(200 200 210 / 12%);
}

.topbar-glass-btn svg {
  width: clamp(14px, 1.3vw, 16px);
  height: clamp(14px, 1.3vw, 16px);
  stroke: #636e72;
  fill: none;
  flex-shrink: 0;
  overflow: visible;
}

.topbar-glass-btn .btn-label {
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

/* ===== GITHUB — fill on hover ===== */
.btn-github svg path {
  fill: transparent;
  transition: fill 0.35s ease;
}
.btn-github:hover svg path {
  fill: #636e72;
}

/* ===== ACCURACY — rings fill in sequence on hover ===== */
.btn-accuracy .ring {
  fill: transparent;
  transition: fill 0.3s ease;
}
.btn-accuracy:hover .ring-outer {
  fill: rgba(99, 110, 114, 0.15);
  transition-delay: 0s;
}
.btn-accuracy:hover .ring-mid {
  fill: rgba(99, 110, 114, 0.3);
  transition-delay: 0.12s;
}
.btn-accuracy:hover .ring-inner {
  fill: #636e72;
  transition-delay: 0.24s;
}
/* Reset delays on mouse-out so they unfill smoothly */
.btn-accuracy .ring-outer { transition-delay: 0.24s; }
.btn-accuracy .ring-mid   { transition-delay: 0.12s; }
.btn-accuracy .ring-inner { transition-delay: 0s; }

/* ===== DOWNLOAD DROPDOWN ===== */
.download-wrapper {
  position: relative;
}

.btn-download .dl-arrow {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-download:hover .dl-arrow {
  transform: translateY(3px);
}
.btn-download .dl-base {
  transition: stroke-width 0.3s ease;
}
.btn-download:hover .dl-base {
  stroke-width: 2.6;
}

.btn-download .dl-chevron {
  width: clamp(10px, 1vw, 12px);
  height: clamp(10px, 1vw, 12px);
  margin-left: -2px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.download-wrapper.open .btn-download .dl-chevron {
  transform: rotate(180deg);
}

/* Dropdown panel */
.download-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  border-radius: 12px;
  border: 1px solid rgba(200, 200, 210, 0.35);
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  transition:
    opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.25s;
  z-index: 100;
  overflow: hidden;
  background: rgba(200, 200, 210, 0.12);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 1px 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 0 2px rgba(255, 255, 255, 0.3);
}

.download-wrapper.open .download-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Individual option */
.download-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: #636e72;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', sans-serif;
  font-size: clamp(12px, 1.1vw, 14px);
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform: scale(1);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s ease, color 0.2s ease;
}

.download-option:hover {
  background: rgba(200, 200, 210, 0.25);
  transform: scale(1.05);
  color: #2d3436;
}

.download-option:active {
  background: rgba(200, 200, 210, 0.35);
  transform: scale(0.97);
  transition-duration: 0.08s;
}

/* Staggered pop-in when dropdown opens */
.download-wrapper.open .download-option {
  animation: dlOptionPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.download-wrapper.open .download-option:nth-child(1) { animation-delay: 0.05s; }
.download-wrapper.open .download-option:nth-child(2) { animation-delay: 0.12s; }
.download-wrapper.open .download-option:nth-child(3) { animation-delay: 0.19s; }

@keyframes dlOptionPopIn {
  0%   { opacity: 0; transform: scale(0.8) translateY(-4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.download-option svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: none;
}
