/* Sphere Global Navigation & Responsive SPA-like Transitions */

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: 120ms cubic-bezier(0.4, 0, 1, 1) both sphere-fade-out;
}
::view-transition-new(root) {
  animation: 180ms cubic-bezier(0, 0, 0.2, 1) both sphere-fade-in;
}

@keyframes sphere-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes sphere-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Global Content Container Layout Alignment */
.wrap,
main {
  max-width: 1040px !important;
  margin: 0 auto !important;
  padding-left: 1.25rem !important;
  padding-right: 1.25rem !important;
  box-sizing: border-box !important;
}

.sphere-global-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15, 17, 21, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-family: var(--font, "Noto Sans KR", system-ui, sans-serif);
}

.sphere-global-nav-wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0.55rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sphere-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text, #e8eaed);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}
.sphere-nav-brand:hover {
  opacity: 0.85;
  text-decoration: none;
}
.sphere-nav-brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: block;
}
.sphere-nav-brand-text {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text, #e8eaed);
}

/* Kill page-level `nav a` / `a` bleed (Astro lore/tech set margin-right + font-size on nav a) */
.sphere-global-header a {
  color: inherit;
  text-decoration: none;
}
.sphere-global-header a:hover {
  color: inherit;
  text-decoration: none;
}
.sphere-global-header nav a {
  margin: 0;
  margin-right: 0;
  font-size: inherit;
}

.sphere-nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 0.15rem 0;
}
.sphere-nav-links::-webkit-scrollbar {
  display: none;
}

.sphere-global-header .sphere-nav-item,
.sphere-nav-item {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  /* equal tab chrome across pages; label lengths still differ slightly */
  min-width: 4.75rem;
  padding: 0.4rem 0.75rem;
  margin: 0 !important;
  border-radius: 8px;
  color: var(--text-muted, #9aa0a6) !important;
  font-family: inherit;
  font-size: 0.88rem !important;
  /* constant weight so active page doesn't widen the pill */
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none !important;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  border: 1px solid transparent;
  flex: 0 0 auto;
}
.sphere-global-header .sphere-nav-item:hover,
.sphere-nav-item:hover {
  color: #f0f6fc !important;
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none !important;
  border-color: rgba(255, 255, 255, 0.08);
}
.sphere-nav-item:focus-visible {
  outline: 2px solid #ff8a50;
  outline-offset: 1px;
}

.sphere-global-header .sphere-nav-item.active,
.sphere-global-header .sphere-nav-item[aria-current="page"],
.sphere-nav-item.active,
.sphere-nav-item[aria-current="page"] {
  color: #fff !important;
  background: rgba(255, 138, 80, 0.15);
  border-color: rgba(255, 138, 80, 0.35);
  font-weight: 600;
}
.sphere-nav-item.active .sphere-nav-icon,
.sphere-nav-item[aria-current="page"] .sphere-nav-icon {
  opacity: 1;
}

.sphere-nav-icon {
  font-size: 0.95rem;
  opacity: 0.8;
  display: inline-block;
  line-height: 1;
  width: 1.1em;
  text-align: center;
  flex-shrink: 0;
}

/* Page Header Hero Harmonization */
.hero,
main .hero {
  padding: 1.75rem 0 1rem !important;
  margin-bottom: 1.5rem !important;
}
.hero h1,
main .hero h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem) !important;
  margin: 0 0 0.5rem !important;
  letter-spacing: -0.02em !important;
  font-weight: 700 !important;
}
.hero .lead,
.tagline {
  color: var(--text-muted, #9aa0a6) !important;
  font-size: 0.98rem !important;
  line-height: 1.5 !important;
  margin: 0 !important;
}

@media (max-width: 640px) {
  .wrap,
  main {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  .sphere-global-nav-wrap {
    padding: 0.5rem 0.85rem;
    gap: 0.5rem;
  }
  .sphere-nav-brand-text {
    display: none;
  }
  .sphere-nav-item {
    padding: 0.35rem 0.55rem;
    font-size: 0.82rem;
  }
}


/* Layout stability (pairs with sphere-theme scrollbar-gutter) */
@supports (scrollbar-gutter: stable) {
  html {
    scrollbar-gutter: stable;
  }
}
