/* Header styles for Association des copropriétaires "Middle Way" */

.ctb-header {
  position: sticky;
  top: 0;
  z-index: 40;
}

.ctb-header__bar {
  padding: var(--space-3) 0;
}

.ctb-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

/* Brand */

.ctb-header__brand-wrapper {
  display: flex;
  align-items: center;
}

.ctb-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text);
}

.ctb-header__brand:hover {
  color: var(--color-text);
}

.ctb-header__logo-mark {
  position: relative;
  width: 40px;
  height: 40px;
}

.ctb-header__logo-card {
  position: absolute;
  width: 70%;
  height: 70%;
  border-radius: var(--radius-md);
  background: radial-gradient(circle at 20% 0, rgba(250, 250, 250, 0.8), #f9fafb);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.ctb-header__logo-card--primary {
  left: 0;
  bottom: 0;
}

.ctb-header__logo-card--secondary {
  right: 0;
  top: 0;
  transform: rotate(12deg);
  background: radial-gradient(circle at 15% 0, #fef9c3, #eab308);
}

.ctb-header__brand-text {
  display: flex;
  flex-direction: column;
}

.ctb-header__title {
  font-family: var(--font-display);
  font-size: var(--font-size-lg);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ctb-header__subtitle {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Navigation */

.ctb-header__nav {
  display: flex;
}

.ctb-header__nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.ctb-header__nav-link {
  position: relative;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  padding: 0.2rem 0;
}

.ctb-header__nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.15rem;
  width: 0;
  height: 2px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #e9c46a, #d4aa4c);
  transition: width var(--transition-base);
}

.ctb-header__nav-link:hover,
.ctb-header__nav-link:focus-visible {
  color: var(--color-text);
}

.ctb-header__nav-link:hover::after,
.ctb-header__nav-link:focus-visible::after {
  width: 100%;
}

.ctb-header__nav-item--highlight .ctb-header__nav-link--button {
  padding: 0.35rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(212, 170, 76, 0.6);
  background: radial-gradient(circle at top left, rgba(212, 170, 76, 0.25), transparent 55%);
  box-shadow: var(--shadow-soft);
  color: var(--color-text);
}

.ctb-header__nav-item--highlight .ctb-header__nav-link--button::after {
  display: none;
}

.ctb-header__nav-item--highlight .ctb-header__nav-link--button:hover,
.ctb-header__nav-item--highlight .ctb-header__nav-link--button:focus-visible {
  background: linear-gradient(135deg, #e9c46a, #d4aa4c);
  color: #111827;
}

/* Mobile toggle */

.ctb-header__toggle {
  display: none;
  min-width: 42px;
  min-height: 42px;
  justify-content: center;
}

.ctb-header__toggle-icon {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.ctb-header__toggle-line {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background-color: var(--color-text);
  transition: transform var(--transition-base), opacity var(--transition-base), width var(--transition-base);
}

/* Mobile state transforms for the hamburger to X */

.ctb-header__toggle[aria-expanded="true"] .ctb-header__toggle-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.ctb-header__toggle[aria-expanded="true"] .ctb-header__toggle-line:nth-child(2) {
  opacity: 0;
}

.ctb-header__toggle[aria-expanded="true"] .ctb-header__toggle-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Responsive */

@media (max-width: 960px) {
  .ctb-header__toggle {
    display: inline-flex;
  }

  .ctb-header__nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    transform-origin: top;
    transform: scaleY(1);
    background-color: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow) ease;
  }

  .ctb-header__nav-list {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-4) var(--layout-gutter) var(--space-5);
    gap: var(--space-3);
  }

  .ctb-header__nav-item--highlight {
    width: 100%;
  }

  .ctb-header__nav-item--highlight .ctb-header__nav-link--button {
    display: inline-flex;
    width: 100%;
    justify-content: center;
  }

  .ctb-header__nav--open {
    max-height: 420px;
  }
}

@media (max-width: 640px) {
  .ctb-header__title {
    font-size: var(--font-size-base);
  }

  .ctb-header__subtitle {
    display: none;
  }
}
