/* ============================================
   Let's Vibe — Shared Components
   WISE-inspired: Black nav bar, pill buttons
   ============================================ */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius-pill);
  min-height: 44px;
  padding: 0.625rem 1.5rem;
  font-size: var(--small);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: transform var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out),
              background var(--duration) var(--ease-out),
              border-color var(--duration) var(--ease-out);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: var(--white);
  background: var(--black);
  border-color: var(--black);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.btn-ghost {
  color: var(--text);
  background: var(--white);
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: var(--text-muted);
  background: var(--bg-alt);
}

.btn-accent {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.25);
}

.btn-accent:hover {
  background: var(--accent-hover);
  box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3);
}

.btn-sm {
  min-height: 36px;
  padding: 0.375rem 1rem;
  font-size: var(--caption);
}

.btn-lg {
  min-height: 52px;
  padding: 0.75rem 2rem;
  font-size: var(--body);
}

/* ── Header: White Frosted Nav Bar ── */
.global-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  isolation: isolate;
  opacity: 1;
  visibility: visible;
  transform: translateZ(0);
  backface-visibility: hidden;
  background: linear-gradient(180deg, rgba(247, 245, 255, 0.98), rgba(244, 244, 255, 0.965));
  border-bottom: 1px solid rgba(191, 188, 230, 0.26);
  box-shadow: 0 1px 0 rgba(182, 180, 226, 0.24);
}

@supports ((-webkit-backdrop-filter: blur(8px)) or (backdrop-filter: blur(8px))) {
  .global-header {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
}

.header-bar {
  max-width: var(--container-max);
  margin-inline: auto;
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(1.3rem, 2.6vw, 3rem);
  padding-inline: var(--marketing-align-pad, clamp(10px, 1.8vw, 18px));
  transition: min-height var(--duration) var(--ease-out);
}

.global-header.is-compact .header-bar {
  min-height: 60px;
}

.global-header.is-home .header-bar,
.global-header.is-home.is-compact .header-bar {
  min-height: 68px;
}

/* Brand */
.brand {
  border: 0;
  background: transparent;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  overflow: visible;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  height: auto;
  line-height: 1.16;
  padding-block: 0.08em;
  font-size: clamp(1.56rem, 1.9vw, 2.02rem);
}

.lv-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.18em;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.12;
  padding-block: 0.08em;
  white-space: nowrap;
}

.lv-wordmark-lets {
  color: #121826;
  font-size: 0.9em;
  letter-spacing: -0.028em;
}

.lv-wordmark-vibe {
  color: #8b63e8;
  font-size: 1em;
}

.lv-wordmark.is-userdash {
  font-size: clamp(1.68rem, 2.02vw, 2.1rem);
}

.lv-wordmark.is-lecture {
  font-size: clamp(1.58rem, 1.92vw, 1.96rem);
}

.lv-wordmark.is-work {
  font-size: clamp(1.58rem, 1.92vw, 1.96rem);
}

.lv-wordmark.is-footer {
  font-size: clamp(1.12rem, 1.5vw, 1.44rem);
}

/* Desktop Nav */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

.nav-group {
  position: relative;
}

.top-nav-btn {
  border: 0;
  background: transparent;
  color: #253857;
  min-height: 38px;
  padding: 0.4rem 0;
  font-size: 1.03rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  position: relative;
  transition: color var(--duration) ease;
}

.top-nav-btn::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  border-radius: var(--radius-pill);
  background: linear-gradient(120deg, #3b82f6, #7c3aed);
  transition: width var(--duration) ease;
}

.top-nav-btn:hover,
.top-nav-btn.active,
.nav-group.active > .top-nav-btn {
  color: #0f1e38;
}

.top-nav-btn:hover::after,
.top-nav-btn.active::after,
.nav-group.active > .top-nav-btn::after,
.nav-group.open > .top-nav-btn::after {
  width: 100%;
}

.nav-caret {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.15s ease;
}

.nav-group.open > .top-nav-btn .nav-caret {
  transform: rotate(-135deg) translateY(-1px);
}

/* Dropdown */
.nav-dropdown {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  top: calc(100% + 12px);
  width: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: grid;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.nav-group.open > .nav-dropdown {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.nav-dropdown-item {
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: var(--small);
  font-weight: 500;
  text-align: left;
  transition: background var(--duration) ease;
}

.nav-dropdown-item:hover {
  background: var(--bg-alt);
}

.nav-dropdown-item em {
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-alt);
  color: var(--text-muted);
  font-style: normal;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
}

.nav-dropdown-item.is-disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1.08rem;
}

.header-settings-link {
  border: 1px solid #d4ddef;
  border-radius: var(--radius-sm);
  min-height: 40px;
  padding: 0.48rem 0.78rem;
  background: #ffffff;
  color: #2f4266;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--duration) ease, border-color var(--duration) ease;
}

.header-settings-link:hover {
  border-color: #b9c8df;
  background: #f8fbff;
}

.header-auth-link {
  border: 1px solid #d4ddef;
  border-radius: var(--radius-sm);
  min-height: 46px;
  padding: 0.58rem 1.02rem;
  background: #ffffff;
  color: #2f4266;
  font-size: 0.93rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--duration) ease, border-color var(--duration) ease;
}

.header-auth-link:hover {
  border-color: #b9c8df;
  background: #f8fbff;
}

.header-main-link {
  border: 1px solid #5a4be8;
  border-radius: 12px;
  min-height: 38px;
  padding: 0.42rem 0.84rem;
  background: linear-gradient(135deg, #6a49ff 0%, #4f72ff 100%);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 10px 18px rgba(88, 95, 255, 0.33);
  transition: box-shadow var(--duration) ease;
}

.header-main-link:hover {
  box-shadow: 0 12px 22px rgba(88, 95, 255, 0.42);
}

.header-mypage-link {
  border: 1px solid #d4ddef;
  border-radius: 12px;
  min-height: 38px;
  padding: 0.42rem 0.82rem;
  background: rgba(255, 255, 255, 0.9);
  color: #2d4268;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--duration) ease, border-color var(--duration) ease;
}

.header-mypage-link:hover {
  border-color: #bcccea;
  background: #f7f9ff;
}

.icon-action {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration) ease;
}

.icon-action:hover {
  background: var(--bg-alt);
}

.icon-action svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-menu {
  position: relative;
  margin-left: 10px;
}

.profile-menu-popup {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 176px;
  border: 1px solid #d5deee;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
  padding: 6px;
  display: grid;
  gap: 2px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 40;
}

.profile-menu.is-open .profile-menu-popup {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.profile-menu-popup > button {
  width: 100%;
  border: 0;
  border-radius: 9px;
  min-height: 34px;
  padding: 0.38rem 0.58rem;
  background: transparent;
  color: #243a5d;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  transition: background var(--duration) ease;
}

.profile-menu-popup > button:hover {
  background: #f3f7ff;
}

/* Mobile Menu Trigger */
.mobile-menu-trigger {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.mobile-menu-trigger span {
  width: 16px;
  height: 1.5px;
  border-radius: var(--radius-pill);
  background: var(--text);
}

/* Breadcrumbs */
.header-breadcrumbs {
  max-width: var(--container-max);
  margin: 8px auto 0;
  padding-inline: var(--container-pad);
}

.header-breadcrumbs-track {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: var(--caption);
}

.header-breadcrumb-link {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--caption);
  font-weight: 500;
  padding: 0;
}

.header-breadcrumb-link:hover {
  color: var(--text);
}

.header-breadcrumb-current {
  color: var(--text);
  font-weight: 600;
}

.header-breadcrumb-sep {
  opacity: 0.4;
}

/* ── Mobile Drawer ── */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 80;
}

.mobile-overlay.is-open {
  opacity: 1;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(92vw, 380px);
  height: 100dvh;
  background: var(--white);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
  transform: translateX(102%);
  transition: transform 0.25s var(--ease-out);
  display: grid;
  grid-template-rows: auto 1fr auto;
  z-index: 90;
}

.mobile-drawer.is-open {
  transform: translateX(0);
}

.mobile-drawer-head {
  min-height: 56px;
  border-bottom: 1px solid var(--border-light);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-drawer-head strong {
  color: var(--text);
  font-size: var(--body);
  font-weight: 700;
}

.mobile-drawer-head button {
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  min-height: 32px;
  background: var(--white);
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  font-size: var(--caption);
  font-weight: 600;
}

.mobile-drawer-body {
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: grid;
  align-content: start;
  gap: 0.5rem;
}

.mobile-link {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  min-height: 44px;
  background: var(--white);
  color: var(--text);
  font-size: var(--small);
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.75rem;
  transition: background var(--duration) ease;
}

.mobile-link:hover {
  background: var(--bg-alt);
}

.mobile-group {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.mobile-group summary {
  min-height: 44px;
  list-style: none;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  font-size: var(--small);
  font-weight: 600;
}

.mobile-group summary::-webkit-details-marker {
  display: none;
}

.mobile-caret {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.mobile-group[open] .mobile-caret {
  transform: rotate(-135deg);
}

.mobile-group-body {
  border-top: 1px solid var(--border-light);
  padding: 0.5rem;
  display: grid;
  gap: 0.5rem;
}

.mobile-group-body section {
  display: grid;
  gap: 0.25rem;
}

.mobile-group-body h4 {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.mobile-group-links {
  display: grid;
  gap: 2px;
}

.mobile-drawer-foot {
  border-top: 1px solid var(--border-light);
  padding: 0.75rem 1.25rem calc(1rem + env(safe-area-inset-bottom));
  display: grid;
  gap: 0.5rem;
}

.mobile-drawer-foot .btn {
  width: 100%;
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  background: var(--white);
  padding: clamp(48px, 6vw, 80px) 0 clamp(24px, 3vw, 40px);
}

.footer-inner {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: start;
}

.footer-brand-col {
  display: grid;
  gap: 0.75rem;
}

.footer-brand {
  color: var(--text);
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.footer-desc {
  color: var(--text-muted);
  font-size: var(--small);
  max-width: 32ch;
  line-height: 1.5;
}

.footer-links-col {
  display: flex;
  gap: 3rem;
}

.footer-link-group {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.footer-link-group h4 {
  margin: 0;
  color: var(--text);
  font-size: var(--caption);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.footer-link-group button {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--small);
  font-weight: 400;
  padding: 0;
  text-align: left;
  transition: color var(--duration) ease;
}

.footer-link-group button:hover {
  color: var(--text);
}

.footer-bottom {
  max-width: var(--container-max);
  margin-inline: auto;
  padding: 1.5rem var(--container-pad) 0;
  border-top: 1px solid var(--border-light);
  margin-top: 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-copyright {
  color: var(--text-muted);
  font-size: var(--caption);
}

/* ── Responsive ── */
@media (max-width: 980px) {
  .top-nav,
  .header-settings-link,
  .header-auth-link,
  .header-mypage-link,
  .header-main-link,
  .icon-action,
  .header-breadcrumbs {
    display: none;
  }

  .mobile-menu-trigger {
    display: inline-flex;
  }

  .header-bar {
    min-height: 62px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding-inline: 10px;
  }

  .brand-logo {
    font-size: 1.72rem;
  }

  .mobile-drawer {
    width: min(96vw, 380px);
  }

  .mobile-drawer-body {
    padding: 0.9rem 1rem;
  }

  .mobile-drawer-foot {
    padding: 0.7rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-links-col {
    gap: 2rem;
    flex-wrap: wrap;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .header-bar {
    min-height: 58px;
    padding-inline: 8px;
  }

  .brand-logo {
    font-size: 1.52rem;
  }

  .mobile-menu-trigger {
    width: 36px;
    height: 36px;
  }

  .mobile-menu-trigger span {
    width: 15px;
  }

  .mobile-drawer {
    width: 100vw;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .global-header,
  .header-bar,
  .nav-dropdown,
  .mobile-overlay,
  .mobile-drawer,
  .mobile-caret,
  .nav-caret,
  .top-nav-btn,
  .header-settings-link,
  .header-auth-link,
  .header-main-link {
    transition: none;
  }
}
