/* Shared navigation shell */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}

.nav-logo {
  display: flex;
  align-items: center;
  justify-self: center;
  text-decoration: none;
}

.nav-logo img {
  display: block;
  width: auto;
  height: 72px;
}

.nav-bottom {
  border-top: 1px solid var(--border);
}

.nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 44px;
}

.nav-links {
  display: flex;
  grid-column: 2;
  gap: 28px;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a,
.nav-back {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active,
.nav-back:hover {
  color: var(--fg);
}

.nav-links > li {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

.has-submenu {
  gap: 2px;
}

.submenu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

.submenu-toggle:hover,
.has-submenu:hover > .submenu-toggle {
  color: var(--fg);
}

.submenu-toggle svg {
  width: 12px;
  height: 12px;
  transition: transform 0.15s ease;
}

.has-submenu.open .submenu-toggle svg,
.has-submenu:focus-within .submenu-toggle svg {
  transform: rotate(180deg);
}

.submenu {
  position: absolute;
  top: 100%;
  left: 50%;
  z-index: 110;
  min-width: 200px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 14%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

@media (hover: hover) {
  .has-submenu:hover .submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
  }
}

.has-submenu:focus-within .submenu,
.has-submenu.open .submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.submenu a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.submenu a:hover {
  background: var(--bg);
  color: var(--fg);
}

.nav-actions {
  display: flex;
  grid-column: 3;
  gap: 16px;
  align-items: center;
  justify-self: end;
}

.nav-search,
.nav-hamburger,
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-search:hover,
.nav-hamburger:hover,
.theme-toggle:hover {
  background: var(--bg);
  color: var(--fg);
}

.nav-hamburger {
  display: none;
}

.radio-btn svg {
  width: 14px;
  height: 14px;
}

.nav-search svg,
.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.nav-hamburger svg {
  width: 20px;
  height: 20px;
}

.mobile-menu {
  position: fixed;
  inset: var(--mobile-header-height) 0 0;
  z-index: 99;
  display: none;
  overflow-y: auto;
  padding: 24px;
  background: var(--surface);
}

.mobile-menu.open {
  display: block;
}

.mobile-menu a {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
}

.mobile-nav-group {
  border-bottom: 1px solid var(--border);
}

.mobile-nav-row {
  display: flex;
  align-items: center;
}

.mobile-nav-row > a {
  flex: 1;
}

.mobile-submenu-toggle {
  display: flex;
  align-items: center;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.mobile-submenu-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.15s ease;
}

.mobile-submenu-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.mobile-submenu {
  display: none;
  padding: 0 0 12px 12px;
}

.mobile-submenu.open {
  display: block;
}

.mobile-submenu a {
  padding: 8px 0;
  border-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.mobile-submenu a:hover {
  color: var(--fg);
}

.radio-widget,
.weather-widget {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgb(0 0 0 / 4%);
}

.radio-widget {
  position: relative;
  justify-self: start;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 24px;
}

.radio-btn {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.radio-btn:hover {
  background: var(--accent-hover);
}

.radio-info,
.weather-info,
.weather-detail {
  display: flex;
  flex-direction: column;
}

.radio-info {
  min-width: 0;
}

.radio-label,
.weather-detail .wd-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.radio-title {
  overflow: hidden;
  max-width: 140px;
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radio-eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}

.radio-eq span {
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
  animation: eq 1s ease-in-out infinite;
  transform-origin: bottom;
}

.radio-eq span:nth-child(1) { height: 6px; animation-delay: 0s; }
.radio-eq span:nth-child(2) { height: 12px; animation-delay: 0.2s; }
.radio-eq span:nth-child(3) { height: 9px; animation-delay: 0.4s; }
.radio-eq span:nth-child(4) { height: 14px; animation-delay: 0.6s; }
.radio-eq.paused span { height: 3px; animation: none; }

@keyframes eq {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

.radio-volume-btn {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.radio-volume-btn:hover {
  color: var(--fg);
  background: rgb(0 0 0 / 6%);
}

.radio-volume-btn svg {
  width: 16px;
  height: 16px;
}

.radio-volume-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 12%);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.radio-volume-popover::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

@media (min-width: 769px) {
  .radio-widget:hover .radio-volume-popover,
  .radio-widget:focus-within .radio-volume-popover {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
}

.radio-volume-slider {
  width: 120px;
  accent-color: var(--accent);
}

@media (max-width: 768px) {
  .radio-widget.playing .radio-volume-popover {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
}

.weather-widget {
  justify-self: end;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 14px;
}

.weather-icon {
  width: 34px;
  height: 34px;
}

.weather-temp {
  color: var(--fg);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.1;
}

.weather-info {
  justify-content: center;
}

.weather-loc {
  display: flex;
  gap: 3px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.weather-loc svg {
  width: 10px;
  height: 10px;
}

.weather-details {
  display: flex;
  gap: 12px;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.weather-detail {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.weather-detail .wd-label {
  font-size: 9px;
  letter-spacing: 0.06em;
}

.weather-detail .wd-value {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
}

.weather-detail .wd-value svg {
  width: 11px;
  height: 11px;
}

@media (max-width: 768px) {
  .nav-top {
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: 12px;
    row-gap: 10px;
    width: min(100% - 32px, 1320px);
    padding: 10px 0;
  }

  .nav-hamburger {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .nav-logo {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
  }

  .nav-logo img {
    height: 42px;
  }

  .radio-widget {
    grid-column: 1 / 3;
    grid-row: 2;
    gap: 8px;
    min-width: 0;
    padding: 6px 12px;
  }

  .radio-info {
    min-width: 0;
  }

  .radio-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .radio-eq {
    display: none;
  }

  .radio-title {
    max-width: 100px;
  }

  .weather-widget {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
    gap: 8px;
    min-width: 0;
    padding: 6px 12px;
  }

  .weather-details {
    display: none;
  }

  .weather-icon {
    width: 24px;
    height: 24px;
  }

  .radio-widget,
  .weather-widget {
    height: 50px;
  }

  .nav-bottom {
    border-top: 0;
  }

  .nav-inner {
    position: absolute;
    top: 10px;
    right: 16px;
    display: flex;
    align-items: center;
    width: auto;
    height: 42px;
    margin: 0;
  }

  .nav-links {
    display: none;
  }
}

@media (max-width: 360px) {
  .radio-volume-btn {
    display: none;
  }

  .weather-loc {
    display: none;
  }
}
