/* Header: one tall plum banner with the arched "MM" badge, the cream wordmark and links, and a long
   sage Book pill (spec 3.3). Below 960px a menu button appears and the navigation opens as a deep
   plum panel. Both key off the "menu-js" class that the inline head script puts on <html> before
   first paint, so the banner already has its final height when the deferred menu.js runs. */

.site-header { background: var(--plum); --focus: var(--page); }

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding-block: 40px;
}

/* Wordmark ------------------------------------------------------------ */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--page);
  text-decoration: none;
}
.wm-text { display: flex; flex-direction: column; line-height: 1.1; }
.wm-name {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.25rem + 1.3vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

/* "MM" badge: an arched window like the hero photo frame, deliberately not a circle (spec 3.4). */
.mm-badge {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  aspect-ratio: 4 / 5;
  border-radius: 50% 50% 6px 6px / 38% 38% 6px 6px;
  background: var(--page);
  color: var(--plum);
}
.mm-badge::after {
  content: "";
  position: absolute;
  inset: 3.5px;
  border-radius: 50% 50% 4px 4px / 38% 38% 4px 4px;
  border: 1.5px solid var(--sage);
}
.mm-badge__letters {
  display: flex;
  align-items: baseline;
  margin-top: 6px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
  line-height: 1;
  letter-spacing: -0.04em;
}

/* Navigation ---------------------------------------------------------- */
.site-nav { display: flex; align-items: center; gap: clamp(12px, 2vw, 28px); }
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: clamp(2px, 0.8vw, 12px);
}
.site-nav ul a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 10px;
  color: var(--page);
  text-decoration: none;
  border-radius: 999px;
}
.site-nav ul a:hover { text-decoration: underline; text-decoration-thickness: 1px; }

/* Book: a longer green pill with a cream outline so it stands clear of the plum. */
.site-header .btn-primary {
  min-width: 150px;
  padding-inline: 40px;
  background: var(--sage-strong);
  color: var(--page);
  border: 1.5px solid var(--page);
}
.site-header .btn-primary:hover { background: color-mix(in srgb, var(--sage-strong) 82%, #000); }

.menu-toggle { display: none; }

/* Small laptops: tighten the links so the banner stays on one row. */
@media (min-width: 960px) and (max-width: 1080px) {
  .site-nav { gap: 12px; }
  /* A 44px minimum keeps short links such as "FAQ" at the spec 6.5 target size with the tighter padding. */
  .site-nav ul a { padding-inline: 6px; min-width: 44px; justify-content: center; }
  .site-header .btn-primary { min-width: 0; padding-inline: 26px; }
}

/* Phones and tablets ---------------------------------------------------- */
@media (max-width: 959.98px) {
  .header-inner { padding-block: 24px; }

  .menu-js .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 18px 8px 16px;
    border: 1.5px solid var(--page);
    border-radius: 999px;
    background: transparent;
    color: var(--page);
    font: 600 1rem/1 var(--font-body);
    cursor: pointer;
  }
  .menu-icon {
    position: relative;
    display: block;
    width: 16px;
    height: 1.5px;
    background: currentColor;
    border-radius: 2px;
    transform: translateY(-3px);
  }
  .menu-icon::before {
    content: "";
    position: absolute;
    top: 6px;
    display: block;
    width: 16px;
    height: 1.5px;
    background: currentColor;
    border-radius: 2px;
  }
  .menu-toggle[aria-expanded="true"] .menu-icon { transform: rotate(45deg); }
  .menu-toggle[aria-expanded="true"] .menu-icon::before { top: 0; transform: rotate(-90deg); }

  /* Without JavaScript the links simply wrap onto a second row of the banner. If menu.js fails, the head
     script removes "menu-js" 3 seconds after DOMContentLoaded and the links come back the same way. */
  .site-nav { flex-basis: 100%; flex-wrap: wrap; }
  .site-nav ul { flex-wrap: wrap; }

  .menu-js .site-nav { display: none; }
  .menu-js .site-nav.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
    background: var(--plum-deep);
    border: 1px solid transparent;
    border-radius: var(--radius-card);
  }
  .menu-js .site-nav.is-open ul { flex-direction: column; gap: 0; }
  .menu-js .site-nav.is-open ul a { display: flex; min-height: 48px; padding-inline: 14px; border-radius: 12px; }
  .menu-js .site-nav.is-open ul a:hover { background: color-mix(in srgb, var(--page) 10%, transparent); }
}

@media (max-width: 400px) {
  .mm-badge { width: 36px; }
  .mm-badge::after { inset: 2.5px; border-width: 1px; }
  .mm-badge__letters { font-size: 15px; margin-top: 4px; }
  .wm-name { font-size: 1.5rem; }
  /* The visible word "Menu" is hidden to save room; the button keeps its name from aria-label. */
  .menu-js .menu-toggle { font-size: 0; gap: 0; min-width: 44px; padding-inline: 13px; justify-content: center; }
}

@media (max-width: 380px) {
  .wordmark { gap: 9px; }
}
