/* ============ Polar Pup — frozen navbar + icicle drop/impale system ============ */

.site-nav {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 100;
}

.nav-bar {
  max-width: 1180px;
  margin: 0 auto;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px 0 14px;
  background: url("../assets/ice/nav-ice-bar.png") center / 100% 100% no-repeat;
  border-radius: 18px;
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  filter: drop-shadow(0 14px 26px rgba(2, 10, 24, 0.45));
  transition: filter 0.3s;
}

.site-nav.scrolled .nav-bar {
  filter: drop-shadow(0 18px 34px rgba(2, 10, 24, 0.65));
}

/* ---------- brand ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand img {
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 2px 6px rgba(0, 90, 140, 0.35));
}

.brand-name {
  font-family: var(--font-ice);
  font-size: 1.45rem;
  letter-spacing: 0.05em;
  background: linear-gradient(180deg, #0a1628 20%, #0e3a5c 60%, #0b6f96);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}

.ticker-chip {
  font: 700 0.72rem/1 var(--font-ui);
  letter-spacing: 0.06em;
  color: #024;
  background: rgba(0, 212, 255, 0.22);
  border: 1px solid rgba(6, 80, 110, 0.25);
  padding: 4px 9px;
  border-radius: 999px;
}

/* ---------- menu: labels on the slab, icicles hanging below ---------- */

.nav-menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto;
  padding: 0;
  height: 100%;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 16px;
  text-decoration: none;
  cursor: pointer;
}

.nav-label {
  font: 600 0.98rem/1 var(--font-ui);
  color: var(--deep-arctic);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: color 0.2s, text-shadow 0.2s;
  white-space: nowrap;
}

.nav-item:hover .nav-label { color: #056d90; }
.nav-item.active .nav-label {
  color: #056d90;
  text-shadow: 0 0 12px rgba(0, 212, 255, 0.75), 0 1px 0 rgba(255, 255, 255, 0.6);
}

.nav-icicle {
  position: absolute;
  top: calc(100% - 4px);
  left: 50%;
  translate: -50% 0;
  height: 58px;
  width: auto;
  transform-origin: 50% 0;
  filter: drop-shadow(0 6px 10px rgba(0, 60, 110, 0.28));
  pointer-events: none;
  z-index: 1;
}

.nav-icicle.ic-b { height: 44px; }

/* organic variation per slot */
.nav-menu li:nth-child(2) .nav-icicle { translate: -58% 0; rotate: -2deg; }
.nav-menu li:nth-child(3) .nav-icicle { translate: -46% 0; rotate: 1deg; }
.nav-menu li:nth-child(4) .nav-icicle { translate: -55% 0; rotate: 2deg; }
.nav-menu li:nth-child(5) .nav-icicle { translate: -44% 0; rotate: -1.5deg; }

@media (hover: hover) and (min-width: 881px) {
  .nav-item:not(.is-dropped):not(.is-regrowing):hover .nav-icicle {
    animation: icicle-sway 1.3s ease-in-out infinite;
  }
}

@keyframes icicle-sway {
  0%, 100% { transform: rotate(-1.6deg); }
  50% { transform: rotate(1.8deg); }
}

/* ---------- shake (cracking loose) ---------- */

.nav-item.is-shaking .nav-icicle {
  animation: icicle-shake 0.44s ease-in-out both;
}

@keyframes icicle-shake {
  0% { transform: rotate(0); }
  12% { transform: rotate(-3deg); }
  24% { transform: rotate(3.4deg); }
  36% { transform: rotate(-4.4deg); }
  48% { transform: rotate(4.8deg) translateY(1px); }
  62% { transform: rotate(-5.6deg); }
  76% { transform: rotate(6.2deg) translateY(2px); }
  88% { transform: rotate(-6.5deg); }
  100% { transform: rotate(5deg); }
}

/* ---------- broken stub + refreeze ---------- */

.nav-item.is-dropped .nav-icicle { visibility: hidden; }

.nav-item::after {
  content: "";
  position: absolute;
  top: calc(100% - 4px);
  left: 50%;
  translate: -50% 0;
  width: 15px;
  height: 11px;
  background: linear-gradient(180deg, rgba(232, 244, 248, 0.95), rgba(168, 216, 234, 0.25));
  clip-path: polygon(0 0, 100% 0, 82% 48%, 58% 100%, 34% 55%, 12% 80%, 0 25%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.nav-item.is-dropped::after { opacity: 1; }

.nav-item.is-regrowing .nav-icicle {
  visibility: visible;
  animation: icicle-regrow 0.9s cubic-bezier(0.3, 1.3, 0.4, 1) both;
}

@keyframes icicle-regrow {
  0% { transform: scaleY(0.12); filter: brightness(2) drop-shadow(0 0 14px rgba(0, 212, 255, 0.9)); }
  70% { transform: scaleY(1.06); }
  100% { transform: scaleY(1); filter: brightness(1); }
}

/* ---------- falling clone ---------- */

.icicle-clone {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  transform-origin: 50% 0;
  will-change: transform;
  filter: drop-shadow(0 10px 16px rgba(0, 40, 90, 0.35));
  animation: icicle-fall var(--fall-ms, 700ms) cubic-bezier(0.5, 0.04, 0.83, 0.5) forwards;
}

.icicle-clone img,
.icicle-embedded img {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes icicle-fall {
  from { transform: translate3d(0, 0, 0) rotate(2deg) scale(1); }
  to { transform: translate3d(var(--dx, 0px), var(--dy, 300px), 0) rotate(var(--rot, 4deg)) scale(var(--s, 1.3)); }
}

/* ---------- embedded (impaled) icicle ---------- */

.icicle-embedded {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  transform: rotate(var(--rot, 0deg));
  transform-origin: 50% 96%;
  filter: drop-shadow(0 4px 10px rgba(0, 40, 90, 0.4));
  animation: icicle-stab 0.3s cubic-bezier(0.2, 0.85, 0.3, 1.3) both;
}

@keyframes icicle-stab {
  from { transform: translateY(-16px) rotate(var(--rot, 0deg)); }
  60% { transform: translateY(2px) rotate(var(--rot, 0deg)); }
  to { transform: translateY(0) rotate(var(--rot, 0deg)); }
}

.icicle-embedded.melting { animation: icicle-melt 0.8s ease-in forwards; }

@keyframes icicle-melt {
  to {
    transform: translateY(8px) rotate(var(--rot, 0deg)) scaleY(0.75);
    opacity: 0;
    filter: blur(2px);
  }
}

/* ---------- impact: crack overlay, jolt, shard burst, flash ---------- */

.logo-crack {
  position: absolute;
  width: 92px;
  height: 92px;
  left: 50%;
  top: 58%;
  translate: -50% -50%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 92 92'%3E%3Cg stroke='%23eaf7ff' stroke-opacity='.8' stroke-width='1.6' fill='none' stroke-linecap='round'%3E%3Cpath d='M46 56 20 30M46 56 74 34M46 56 70 80M46 56 16 70M46 56 44 18M46 56 62 90'/%3E%3Cpath d='M32 42 24 40M60 44 68 40M58 70 64 74M30 64 24 68' stroke-width='1'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
  opacity: 0;
  transition: opacity 0.45s;
  pointer-events: none;
  z-index: 5;
}

.impale-target.cracked .logo-crack { opacity: 0.95; }

.impale-target.impaled { animation: logo-jolt 0.45s cubic-bezier(0.3, 1.5, 0.4, 1) both; }

@keyframes logo-jolt {
  25% { transform: translateY(5px) scale(0.96) rotate(-2deg); }
  60% { transform: translateY(-2px) scale(1.02) rotate(1deg); }
  100% { transform: none; }
}

.ice-burst {
  position: absolute;
  width: 0;
  height: 0;
  z-index: 7;
  pointer-events: none;
}

.ice-bit {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--sz, 6px);
  height: var(--sz, 6px);
  background: linear-gradient(180deg, #ffffff, var(--icicle-tip));
  clip-path: polygon(50% 0, 100% 62%, 55% 100%, 0 50%);
  animation: bit-burst 0.65s cubic-bezier(0.15, 0.7, 0.35, 1) forwards;
}

@keyframes bit-burst {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to { transform: translate(var(--bx, 20px), var(--by, -30px)) rotate(var(--br, 120deg)); opacity: 0; }
}

.crack-flash {
  position: absolute;
  left: -45px;
  top: -45px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(0, 212, 255, 0.4) 42%, transparent 70%);
  animation: crack-flash 0.4s ease-out forwards;
  mix-blend-mode: screen;
}

@keyframes crack-flash {
  from { transform: scale(0.4); opacity: 1; }
  to { transform: scale(1.6); opacity: 0; }
}

/* ---------- connect wallet ---------- */

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.nav-buy-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  border-radius: 999px;
  text-decoration: none;
  font: 600 0.92rem var(--font-ui);
  color: #04263a;
  background: linear-gradient(140deg, #9df3ff, var(--glow-cyan) 50%, #22a3f0);
  box-shadow: 0 6px 16px rgba(0, 140, 200, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 0.18s var(--ease-pop), box-shadow 0.2s;
  white-space: nowrap;
}

.nav-buy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 140, 200, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* ---------- burger ---------- */

.nav-burger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(6, 60, 90, 0.2);
  background: rgba(10, 22, 40, 0.1);
  cursor: pointer;
}

.nav-burger span {
  width: 20px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--deep-arctic);
  transition: transform 0.25s var(--ease-pop), opacity 0.2s;
}

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

/* ---------- mobile ---------- */

@media (max-width: 880px) {
  .nav-burger { display: flex; }
  .brand-name { font-size: 1.25rem; }

  .nav-menu {
    position: fixed;
    top: calc(12px + var(--nav-h) + 8px);
    left: 14px;
    right: 14px;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(10, 22, 40, 0.92);
    border: 1px solid var(--frost-line);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5);
    opacity: 0;
    translate: 0 -12px;
    pointer-events: none;
    transition: opacity 0.25s, translate 0.25s;
  }

  .site-nav.open .nav-menu {
    opacity: 1;
    translate: 0 0;
    pointer-events: auto;
  }

  .nav-item {
    justify-content: flex-start;
    height: 52px;
    border-radius: 12px;
    background: rgba(232, 244, 248, 0.07);
    border: 1px solid rgba(197, 232, 240, 0.16);
    padding: 0 16px;
  }

  .nav-label {
    color: var(--ice-white);
    text-shadow: none;
    font-size: 1.05rem;
  }

  .nav-item:hover .nav-label,
  .nav-item.active .nav-label { color: var(--glow-cyan); }

  .nav-icicle,
  .nav-menu li:nth-child(n) .nav-icicle {
    left: auto;
    right: 14px;
    top: 7px;
    translate: 0 0;
    rotate: 0deg;
    height: 36px;
  }

  .nav-icicle.ic-b { height: 30px; }

  .nav-item::after { display: none; }

  .nav-buy-btn { padding: 9px 16px; font-size: 0.85rem; }
}

@media (max-width: 480px) {
  .brand img { width: 34px; height: 34px; }
  .ticker-chip { display: none; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .nav-item .nav-icicle { animation: none; }
  .icicle-clone, .icicle-embedded, .ice-bit, .crack-flash { animation: none; display: none; }
}
