/* Component: Header
 *
 * Responsive header (mobile-first)
 *
 * Breakpoints:
 * default (375–699)   — mobile:  burger, padding 32px, margin 20px
 * 700px   (700–1199)  — tablet:  burger, padding 64px, margin 60px
 * 1200px  (1200–1439) — desktop: full nav, 12-col grid, margin 60px
 * 1440px  (1440+)     — desktop: margin 120px
 *
 * Divider: 5px, within grid margins at all breakpoints
 */

/* =====================
   Default: mobile (375–699)
   ===================== */

.header {
  position: sticky;
  top: 0;
  z-index: 101;
  padding: 32px 20px 0;
  background-color: #fff;
  transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 102;
}

.header__logo {
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* Desktop nav — hidden on mobile/tablet */
.header__nav {
  display: none;
  gap: 40px;
}

.header__nav-link {
  letter-spacing: 0.04em;
  white-space: nowrap;
  position: relative;
}

.header__nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 3px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header__nav-link:hover::after {
  transform: scaleX(1);
}

/* Desktop contact — hidden on mobile/tablet */
.header__contact {
  display: none;
  align-items: center;
  gap: 12px;
}

.header__contact-label {
  letter-spacing: 0.04em;
}

.header__contact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #000000;
}

.header__contact-btn img {
  width: 20px;
  height: 20px;
}

/* Burger — visible on mobile/tablet */
.header__burger {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header__burger-label {
  letter-spacing: 0.04em;
}

.header__burger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

/* Burger icon — 3 lines → cross */
.header__burger-icon {
  display: block;
  width: 34px;
  height: 22px;
  position: relative;
}

.header__burger-icon span {
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 1px;
  background: var(--color-black);
  position: absolute;
  left: 0;
  /* Close animation: rotate back → then slide to position */
  transition: top 0.3s 0.15s cubic-bezier(0.4, 0, 0.2, 1),
              bottom 0.3s 0.15s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s 0.15s ease;
}

.header__burger-icon span:nth-child(1) {
  top: 0;
}

.header__burger-icon span:nth-child(2) {
  top: 50%;
  transform: translateY(-50%);
}

.header__burger-icon span:nth-child(3) {
  bottom: 0;
}

/* Open state — cross */
/* Open animation: slide to center → then rotate */
.header__burger-btn.is-open .header__burger-icon span {
  transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s 0.15s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease;
}

.header__burger-btn.is-open .header__burger-icon span:nth-child(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.header__burger-btn.is-open .header__burger-icon span:nth-child(2) {
  opacity: 0;
}

.header__burger-btn.is-open .header__burger-icon span:nth-child(3) {
  bottom: auto;
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
}

/* Mobile nav — overlay, hidden by default */
.header__mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: #fff;
  z-index: 100;
  padding: 120px 20px 32px;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.header__mobile-nav.is-open {
  clip-path: inset(0 0 0 0);
  pointer-events: auto;
}

.header__mobile-link {
  display: block;
  padding: 20px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.header__mobile-link:last-child {
  border-bottom: none;
  padding-bottom: 64px;
  margin-bottom: 0;
}

.header__mobile-nav::after {
  content: '';
  display: block;
  height: 5px;
  background-color: #000;
}


/* Divider */
.header__divider {
  height: 5px;
  background-color: #000000;
  margin-top: 32px;
}

/* =====================
   700px: tablet (700–1199)
   ===================== */

@media (min-width: 700px) {
  .header {
    padding: 64px 60px 0;
  }

  .header--scrolled {
    padding-top: 32px;
  }

  .header__mobile-nav {
    padding: 160px 60px 0;
  }

  .header__divider {
    margin-top: 64px;
  }
}

/* =====================
   1200px: desktop (1200–1439) — nav visible, burger hidden
   ===================== */

@media (min-width: 1200px) {
  .header__row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    align-items: center;
  }

  .header__logo {
    grid-column: 1 / 7;
  }

  .header__nav {
    display: flex;
    grid-column: 7 / 10;
  }

  .header__contact {
    display: flex;
    grid-column: 11 / 13;
    justify-self: end;
  }

  .header__burger {
    display: none;
  }

  .header__mobile-nav {
    display: none !important;
  }
}

/* =====================
   1440px: desktop (1440+) — margin 120px
   ===================== */

@media (min-width: 1440px) {
  .header {
    padding: 64px 120px 0;
  }

  .header--scrolled {
    padding-top: 32px;
  }
}
