header {
  position: sticky;
  top: 0;
  z-index: 100;
  /* iOS (viewport-fit=cover): the header reaches up under the status bar
     and its background covers that strip, so the page never shows above it */
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--color-bg);
  box-shadow: 0 2px 2px rgba(27, 28, 29, 0.04);
}

/* Figma desktop header: full 1440 frame, 80px side padding, 64px tall */
.header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  max-width: 1440px;
  min-height: 64px;
  padding-block: 8px;
  padding-inline: clamp(16px, 5.56vw, 80px);
}


.header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header__brand {
  gap: 0;
}

/* logo.svg is the mark + "fntekin" wordmark, 140 × 47 */
.header__logo-img {
  width: auto;
  height: 52px;
  aspect-ratio: 140 / 47;
}

.header__logo-text {
  font-family: var(--font-logo);
  font-size: 24px;
  line-height: 50px;
  color: var(--color-heading);
}

/* Desktop: logo — 24px — nav (items 16px apart) … social icons on the right */
.header__nav {
  display: flex;
  align-items: center;
  gap: 16px;
  /* + the row's 16px gap = 24px between logo and nav */
  margin-left: 8px;
  margin-right: auto;
}

/* Nav items: DM Sans Bold 18px, #333330 */
.header__nav-link {
  padding: 16px;
  font-family: var(--font-base);
  font-weight: 700;
  font-size: 18px;
  line-height: 24px;
  color: #333330;
  border-radius: 90px;
  transition: background-color 0.2s ease;
}

.header__nav-link:hover {
  background: rgba(51, 51, 48, 0.06);
}

/* CTA + hamburger group */
.header__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header__menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 32px;
  height: 32px;
  padding: 4px 2px;
  color: var(--color-heading);
}

.header__menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Tablet + mobile: nav moves into a hamburger dropdown */
@media (max-width: 860px) {
  .header__inner {
    flex-wrap: nowrap;
  }

  .header__menu-toggle {
    display: flex;
  }

  .header__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 16px 16px;
    background: var(--color-bg);
    box-shadow: 0 8px 16px rgba(27, 28, 29, 0.08);
  }

  .is-menu-open .header__nav {
    display: flex;
  }

  .header__nav-link {
    padding: 14px 0;
    border-bottom: 1px solid rgba(51, 51, 48, 0.08);
    border-radius: 0;
  }

  .header__nav-link:hover {
    background: none;
  }

  .is-menu-open .header__menu-toggle span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .is-menu-open .header__menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .is-menu-open .header__menu-toggle span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }
}

/* Mobile (390px design) */
@media (max-width: 600px) {
  .header__inner {
    padding-block: 12px;
  }

  .header__logo-img {
    height: 38px;
  }

  .header__actions {
    gap: 12px;
  }

  .header__cta {
    height: 40px;
    padding-inline: 18px;
    font-size: 15px;
  }
}

/* Social icons: 24px, 24px apart (shared with the detail hero cards) */
.socials {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.socials__link {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

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

.socials__link:focus-visible {
  outline: 2px solid #2a3307;
  outline-offset: 3px;
}

.socials__link svg {
  display: block;
}

@media (max-width: 860px) {
  .header__nav {
    margin: 0;
  }

  .header__actions {
    margin-left: auto;
  }

  .header__actions .socials {
    gap: 16px;
  }
}

/* ---------- Detail-page header ---------- */
.detail-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  flex-wrap: nowrap;
}

.detail-header__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  padding: 8px 8px 8px 0;
  font-family: var(--font-base);
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  color: #333330;
}

.detail-header__back svg {
  color: #2a3307;
  transition: transform 0.2s ease;
}

.detail-header__back:hover svg {
  transform: translateX(-3px);
}

/* page title: DM Sans Regular 16px, #333330 */
.detail-header__title {
  font-family: var(--font-base);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: #333330;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-header .socials {
  justify-self: end;
}

@media (max-width: 600px) {
  .detail-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
  }

  /* arrow only; the title takes the middle */
  .detail-header__back span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .detail-header__title {
    font-size: 14px;
  }

  .detail-header .socials {
    gap: 12px;
  }

  .detail-header .socials__link,
  .detail-header .socials__link svg {
    width: 22px;
    height: 22px;
  }
}

/* Social icons sit in the header row on desktop and move into the
   hamburger menu on phones/tablets */
.header__nav-socials {
  display: none;
}

@media (max-width: 860px) {
  /* phones/tablets: social icons stay in the header instead of a menu */
  .header__menu-toggle {
    display: none !important;
  }

  .header__actions .header__socials {
    display: flex;
    gap: 16px;
  }

  .header__nav .header__nav-socials {
    display: none;
  }
}

/* Phones: the detail header keeps only the back arrow and the title */
@media (max-width: 600px) {
  .detail-header .detail-header__socials {
    display: none;
  }

  .detail-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .detail-header::after {
    content: "";
    width: 24px;
  }
}

/* Detail pages: header hides on scroll down, returns on scroll up
   (js/header-autohide.js) */
body:not(.home) > header {
  transition: transform 0.3s ease;
}

body:not(.home) > header.is-hidden {
  transform: translateY(-100%);
}

@media (prefers-reduced-motion: reduce) {
  body:not(.home) > header {
    transition: none;
  }
}
