/* ==========================================================================
   Hörweite — Bottom Navigation & Typography Refresh
   --------------------------------------------------------------------------
   Nocturne palette:
     --hw-night-0: #0B1026
     --hw-night-1: #131A3C
     --hw-aurora : #6B5FFF
     --hw-moon   : #8EC5FC
     --hw-cream  : #F3EFE0
     --hw-cream-dim: #B8B5A8
   ========================================================================== */

/* --- Font loading ------------------------------------------------------- */
@import url('https://api.fontshare.com/v2/css?f[]=satoshi@300,400,500,600,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&display=swap');

/* --- Design tokens ------------------------------------------------------ */
:root {
  --hw-night-0: #0B1026;
  --hw-night-1: #131A3C;
  --hw-aurora:  #6B5FFF;
  --hw-moon:    #8EC5FC;
  --hw-cream:   #F3EFE0;
  --hw-cream-dim: #B8B5A8;

  --hw-nav-height: 64px;
  --hw-nav-radius: 18px;
  --hw-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --- Global typography upgrade ----------------------------------------- */
body,
button,
input,
select,
textarea,
.state,
[id*="hw-"] *:not(h1):not(h2):not(h3):not(h4):not(.hw-serif):not(.fraunces) {
  font-family: 'Satoshi', 'Inter', -apple-system, BlinkMacSystemFont,
               'Segoe UI', Roboto, sans-serif !important;
  letter-spacing: -0.01em;
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* keep serif headings (Fraunces) untouched */
.hw-serif,
.fraunces,
h1.fraunces, h2.fraunces, h3.fraunces {
  font-family: 'Fraunces', Georgia, serif !important;
  letter-spacing: -0.015em;
}

/* --- Body padding so content isn't hidden ------------------------------ */
body {
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

/* --- Bottom nav container ---------------------------------------------- */
.hw-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9000;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  width: 100%;
  height: calc(var(--hw-nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);

  background: rgba(11, 16, 38, 0.85);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border-top: 1px solid rgba(139, 197, 252, 0.08);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);

  transition: transform 280ms var(--hw-ease), opacity 200ms var(--hw-ease);
}

.hw-bottom-nav[hidden],
.hw-bottom-nav.hw-hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

/* --- Nav items --------------------------------------------------------- */
.hw-nav-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  position: relative;

  background: transparent;
  border: 0;
  padding: 6px 4px 8px;
  margin: 0;
  cursor: pointer;

  color: var(--hw-cream-dim);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;

  transition: color 180ms var(--hw-ease), transform 180ms var(--hw-ease);
  -webkit-tap-highlight-color: transparent;
}

.hw-nav-item:hover {
  color: var(--hw-cream);
}

.hw-nav-item:active {
  transform: scale(0.94);
}

.hw-nav-item__icon {
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: grayscale(0.2) opacity(0.85);
  transition: filter 200ms var(--hw-ease), transform 200ms var(--hw-ease);
}

.hw-nav-item__label {
  font-size: 11px;
  font-weight: 500;
}

/* --- Active state ------------------------------------------------------ */
.hw-nav-item.active {
  color: #FFFFFF;
}

.hw-nav-item.active .hw-nav-item__icon {
  filter: none;
  transform: translateY(-1px);
}

.hw-nav-item.active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hw-aurora), var(--hw-moon));
  box-shadow: 0 0 12px rgba(107, 95, 255, 0.75),
              0 0 22px rgba(142, 197, 252, 0.35);
  animation: hw-glow-in 260ms var(--hw-ease);
}

@keyframes hw-glow-in {
  from { opacity: 0; transform: translateX(-50%) scaleX(0.4); }
  to   { opacity: 1; transform: translateX(-50%) scaleX(1); }
}

/* --- Badge (unread dot / count) ---------------------------------------- */
.hw-nav-item__badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  min-width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 999px;
  background: #FF4D5E;
  box-shadow: 0 0 0 2px rgba(11, 16, 38, 0.95),
              0 0 10px rgba(255, 77, 94, 0.55);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
}

.hw-nav-item__badge.has-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  top: 2px;
  right: calc(50% - 22px);
}

.hw-nav-item__badge.visible {
  display: inline-flex;
}

/* --- Desktop: hide bottom nav ------------------------------------------ */
@media (min-width: 961px) {
  .hw-bottom-nav {
    display: none;
  }
  body {
    padding-bottom: 0;
  }
}

/* --- Reduced motion ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .hw-bottom-nav,
  .hw-nav-item,
  .hw-nav-item__icon,
  .hw-nav-item.active::after {
    transition: none !important;
    animation: none !important;
  }
}
