.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(244, 242, 238, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--rule);
  transition:
    box-shadow 0.3s ease,
    background 0.3s ease,
    border-color 0.3s ease;
}
.nav.scrolled {
  box-shadow: 0 1px 24px rgba(26, 29, 38, 0.08);
  background: rgba(244, 242, 238, 0.95);
  border-bottom-color: transparent;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-right: 8px;
  flex-shrink: 0;
}
.nav-brand > img {
  height: 32px;
  object-fit: contain;
  display: block;
}
/* shared brand logo sizing for header and footer */
.brand-logo {
  height: 32px;
  object-fit: contain;
  display: block;
}
/* circular badge for nav logo (matches hero badge style) */
.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(36px, 3.2vw, 44px);
  height: clamp(36px, 3.2vw, 44px);
  max-height: 44px;
  max-width: 44px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    #fff 0%,
    #fbfbfb 35%,
    #fff 100%
  );
  box-shadow: 0 8px 18px rgba(26, 29, 38, 0.06);
  position: relative;
  flex-shrink: 0;
  margin-right: 10px;
  overflow: visible;
}
.logo-badge > img {
  width: 52%;
  height: auto;
  display: block;
  object-fit: contain;
}
.logo-badge::before,
.logo-badge::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.logo-badge::before {
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(145, 110, 210, 0.05);
}
.logo-badge::after {
  width: calc(100% + 36px);
  height: calc(100% + 36px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(145, 110, 210, 0.03);
  filter: blur(0.2px);
}
.nav-logo {
  font-family: "Bebas Neue", var(--font-ui);
  font-size: 26px;
  letter-spacing: 3px;
  color: var(--ink);
  line-height: 1;
}
.nav-logo em {
  font-style: normal;
  color: var(--crimson);
}
.nav-vr {
  width: 1px;
  height: 18px;
  background: var(--rule);
}
.nav-product {
  display: flex;
  align-items: center;
  gap: 7px;
}
.nav-product img {
  height: clamp(28px, 3.5vw, 40px);
  width: auto;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}
.nav-product .nav-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.nav-cube {
  width: 16px;
  height: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}
.nav-cube span {
  background: var(--crimson);
  border-radius: 1px;
  opacity: 0.7;
}
.nav-pname {
  font-family: var(--font-ui), "IBM Plex Sans KR", sans-serif;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 1.5px;
}
.nav-pname span {
  color: var(--crimson);
  font-weight: 500;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family:
    "Pretendard",
    "Noto Sans KR",
    "Apple SD Gothic Neo",
    "Malgun Gothic",
    "Nanum Gothic",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
}
.nav-menu a {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.2px;
  padding: 10px 16px;
  border-radius: 10px;
  position: relative;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    transform 0.12s ease,
    box-shadow 0.18s ease;
  line-height: 1.1;
}
.nav-menu a::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--crimson);
  border-radius: 1px;
  transition:
    width 0.25s ease,
    left 0.25s ease;
}
.nav-menu a:hover {
  color: var(--ink);
  background: rgba(26, 29, 38, 0.04);
}
.nav-menu a:hover::after {
  width: calc(100% - 28px);
  left: 14px;
}
.nav-menu a.active {
  background: transparent;
  border: 1px solid var(--crimson);
  color: var(--crimson);
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}
.nav-menu a.active::after {
  display: none;
}
/* Separator before CTA */
.nav-separator {
  width: 1px;
  height: 24px;
  background: var(--rule);
  margin: 0 8px;
  flex-shrink: 0;
}
/* ── Dropdown wrapper ── */
.nav-buy-wrap {
  position: relative;
  display: inline-flex;
}
.nav-buy {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
  transition:
    background 0.12s ease,
    color 0.12s ease,
    transform 0.12s ease;
}
.nav-buy:hover {
  background: rgba(26, 29, 38, 0.04);
  color: var(--ink);
  border-color: rgba(26, 29, 38, 0.06);
}
.nav-buy:active {
  background: var(--bg2);
}
.nav-buy img {
  height: 20px;
  width: 20px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  border-radius: 6px;
}
.nav-buy-label {
  white-space: nowrap;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}
.nav-buy-arrow {
  color: var(--muted);
  font-size: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--rule);
  padding-left: 10px;
  transition: transform 0.2s ease;
  display: inline-block;
}

/* ── Dropdown menu ── */
.nav-buy-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  z-index: 200;
  flex-direction: column;
}
.nav-buy-menu.open {
  display: flex;
}
.nav-buy-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink2);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.nav-buy-menu a:last-child {
  border-bottom: none;
}
.nav-buy-menu a:hover {
  background: var(--surface);
  color: var(--ink);
}
.nav-buy-menu a img {
  height: 18px;
  width: 18px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
}
.nav-buy-menu a span:not(.nav-buy-arrow) {
  flex: 1;
}
.nav-buy-menu a .nav-buy-arrow {
  border-left: none;
  padding-left: 0;
}

/* Mobile: inline accordion, no floating panel */
@media (max-width: 980px) {
  .nav-buy-wrap {
    width: 100%;
  }
  .nav-buy {
    width: 100%;
    justify-content: flex-start;
    background: transparent;
    border: 1px solid var(--rule);
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 20px;
    font-weight: 900;
    color: var(--ink);
  }
  .nav-buy .nav-buy-label {
    flex: 1;
  }
  .nav-buy img {
    display: none;
  }
  .nav-buy .nav-buy-arrow {
    margin-left: auto;
    border-left: 1px solid var(--rule);
    padding-left: 10px;
    font-size: 13px;
  }
  .nav-buy[aria-expanded="true"] .nav-buy-arrow {
    transform: rotate(180deg);
  }
  .nav-buy-menu {
    position: static;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    min-width: unset;
    overflow: visible;
    z-index: auto;
    margin-top: 4px;
    padding: 0;
    gap: 4px;
  }
  .nav-buy-menu a {
    border-bottom: none;
    border-radius: 10px;
    padding: 11px 16px;
    background: rgba(26, 29, 38, 0.04);
    margin-bottom: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink2);
  }
  .nav-buy-menu a:hover {
    background: rgba(26, 29, 38, 0.08);
    color: var(--ink);
  }
  .nav-buy-menu a img {
    display: none;
  }
  .nav-buy-menu a .nav-buy-arrow {
    border-left: none;
    padding-left: 0;
    margin-left: auto;
  }
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--rule);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  margin-left: auto;
  color: var(--ink);
  flex-shrink: 0;
  position: relative;
  z-index: 201;
  transition:
    background 0.2s,
    border-color 0.2s;
  align-items: center;
  justify-content: center;
}
.nav-toggle:hover {
  background: rgba(26, 29, 38, 0.05);
  border-color: rgba(26, 29, 38, 0.15);
}
/* Animated hamburger → X */
.nav-hamburger line {
  transition:
    transform 0.25s ease,
    opacity 0.2s ease;
  transform-origin: center;
}
body.nav-open .hamburger-top {
  transform: translateY(6px) rotate(45deg);
}
body.nav-open .hamburger-mid {
  opacity: 0;
}
body.nav-open .hamburger-bot {
  transform: translateY(-6px) rotate(-45deg);
}

.nav a:focus-visible,
.nav-toggle:focus-visible,
.nav-buy:focus-visible {
  outline: 3px solid rgba(196, 32, 122, 0.12);
  outline-offset: 3px;
}

/* Mobile: collapse menu */
@media (max-width: 980px) {
  .nav {
    padding: 0 16px;
    height: 60px;
  }
  .nav-menu {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(244, 242, 238, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--rule);
    padding: 12px 16px 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    flex-direction: column;
    gap: 4px;
    animation: navSlideDown 0.25s ease-out;
  }
  @keyframes navSlideDown {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  .nav-separator {
    width: 100%;
    height: 1px;
    margin: 8px 0;
  }
  .nav-toggle {
    display: inline-flex;
  }
  body.nav-open .nav-menu {
    display: flex;
  }
  .nav-menu > a {
    display: block;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.2px;
    font-family:
      "Pretendard",
      "Noto Sans KR",
      "Apple SD Gothic Neo",
      "Malgun Gothic",
      "Nanum Gothic",
      system-ui,
      -apple-system,
      "Segoe UI",
      Roboto,
      "Helvetica Neue",
      Arial,
      sans-serif;
  }
  .nav-menu > a:hover {
    background: rgba(26, 29, 38, 0.05);
  }
  .nav-menu > a::after {
    display: none;
  }
}
