/* Hamburger navigation (template-parts/topbar-nav.php): the .topbar header on the new pages, and the
   mobile header (.site-topbar, header.php) on every other page.
   Inline links above 1024px, three-line toggle + drop-down panel at 1024px and below.
   Without JS (no html.topnav-js) the links stay visible as a wrapping row. */

.topnav {
  --tn-ink: var(--ink, #1f2430);
  --tn-pink: var(--pink, #e0157a);
  --tn-pink-soft: var(--pink-soft, #fde4f0);
  --tn-rule: var(--rule, #e2e8f0);
  --tn-focus: var(--focus, #1f5fbf);
  font-family: var(--font-body, "Hanken Grotesk", "Helvetica Neue", system-ui, sans-serif);
}

.topnav-panel { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 22px; }
.topnav-panel a {
  color: var(--tn-ink); text-decoration: none;
  font-size: 12px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap;
}
.topnav-panel a:hover, .topnav-panel a[aria-current] { color: var(--tn-pink); }
.topnav a:focus-visible, .topnav-toggle:focus-visible { outline: 3px solid var(--tn-focus); outline-offset: 2px; }

.topnav-toggle, .topnav-label { display: none; }

/* "Salons": a disclosure button styled like the links, over a list of salon links. */
.topnav-group { position: relative; }
.topnav .topnav-parent {
  display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 0;
  background: none; border: 0; border-radius: 0; box-shadow: none; text-shadow: none; cursor: pointer;
  color: var(--tn-ink); font: inherit; font-size: 12px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; line-height: inherit;
}
.topnav .topnav-parent:hover, .topnav .topnav-parent:active, .topnav .topnav-parent:focus { background: none; box-shadow: none; }
.topnav .topnav-parent:hover, .topnav .topnav-parent[aria-expanded="true"], .topnav .topnav-parent[data-current] { color: var(--tn-pink); }
.topnav .topnav-parent:focus-visible { outline: 3px solid var(--tn-focus); outline-offset: 2px; }
.topnav .topnav-parent:focus:not(:focus-visible) { outline: none; }
.topnav-caret { width: 6px; height: 6px; margin-top: -3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .2s ease, margin .2s ease; }
.topnav-parent[aria-expanded="true"] .topnav-caret { margin-top: 3px; transform: rotate(-135deg); }
.topnav-sub { list-style: none; margin: 0; padding: 0; }
.topnav-sub li { margin: 0; padding: 0; }
.topnav-sub li::before { content: none; }

@media (min-width: 1025px) {
  /* A flex box, so the button doesn't sit on the baseline of the page's taller line-height. */
  .topnav-group { display: flex; flex-direction: column; align-items: flex-start; }
  /* Drop-down under the button; padding-top bridges the gap so hover survives the move. */
  html.topnav-js .topnav-sub {
    position: absolute; z-index: 40; top: 100%; left: 50%; transform: translate(-50%, 6px);
    min-width: 260px; padding: 14px 0 0;
    visibility: hidden; opacity: 0; transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
  }
  html.topnav-js .topnav-sub::before {
    content: ""; position: absolute; inset: 14px 0 0; z-index: -1;
    background: #fff; border: 1px solid var(--tn-rule); border-radius: 14px; box-shadow: 0 18px 36px -18px rgba(31, 36, 48, .35);
  }
  html.topnav-js .topnav-group.is-open .topnav-sub, html.topnav-js .topnav-group:hover .topnav-sub {
    visibility: visible; opacity: 1; transform: translate(-50%, 0); transition: opacity .18s ease, transform .18s ease, visibility 0s;
  }
  html.topnav-js .topnav-sub li:first-child { padding-top: 8px; }
  html.topnav-js .topnav-sub li:last-child { padding-bottom: 8px; }
  html.topnav-js .topnav-sub a { display: block; padding: 10px 22px; letter-spacing: .12em; }
  html.topnav-js .topnav-sub a:hover, html.topnav-js .topnav-sub a:focus-visible { background: var(--tn-pink-soft); }
  html:not(.topnav-js) .topnav-sub { display: flex; flex-wrap: wrap; gap: 8px 22px; }
}

@media (max-width: 1100px) and (min-width: 1025px) {
  .topnav-panel { gap: 8px 16px; }
  .topnav-panel a { font-size: 11px; letter-spacing: .1em; }
}

@media (max-width: 1024px) {
  html.topnav-js .topbar { position: relative; z-index: 30; padding-block: 12px; }
  html.topnav-js .topbar .frame { flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 16px; }

  html.topnav-js .topnav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0; margin-right: -9px;
    background: none; border: 0; border-radius: 8px; box-shadow: none; text-shadow: none; cursor: pointer;
    color: var(--tn-ink); -webkit-tap-highlight-color: transparent;
  }
  .topnav-label { display: block; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  html.topnav-js .topnav-toggle:hover, html.topnav-js .topnav-toggle:active, html.topnav-js .topnav-toggle:focus { background: none; box-shadow: none; }
  html.topnav-js .topnav-toggle:hover, html.topnav-js .topnav.is-open .topnav-toggle { color: var(--tn-pink); }
  html.topnav-js .topnav-toggle:focus:not(:focus-visible) { outline: none; }
  .topnav-bars { position: relative; display: block; width: 26px; height: 18px; }
  .topnav-bars span {
    position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: currentColor;
    transition: transform .3s var(--spring, ease), opacity .2s ease, top .3s ease;
  }
  .topnav-bars span:nth-child(1) { top: 0; }
  .topnav-bars span:nth-child(2) { top: 8px; }
  .topnav-bars span:nth-child(3) { top: 16px; }
  .topnav.is-open .topnav-bars span:nth-child(1) { top: 8px; transform: rotate(45deg); }
  .topnav.is-open .topnav-bars span:nth-child(2) { opacity: 0; transform: scaleX(.2); }
  .topnav.is-open .topnav-bars span:nth-child(3) { top: 8px; transform: rotate(-45deg); }

  /* The panel overlays the page under the header, so opening it never moves content. */
  html.topnav-js .topnav-panel {
    position: absolute; top: 100%; left: 0; right: 0;
    display: flex; flex-direction: column; flex-wrap: nowrap; gap: 0;
    padding: 6px max(16px, env(safe-area-inset-right, 0px)) 18px max(16px, env(safe-area-inset-left, 0px));
    max-height: calc(100vh - 100%); max-height: calc(100dvh - 100%); overflow-y: auto; overscroll-behavior: contain;
    background: #fff; border-top: 1px solid var(--tn-rule);
    box-shadow: 0 24px 40px -24px rgba(31, 36, 48, .35);
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
  }
  html.topnav-js .topnav.is-open .topnav-panel {
    visibility: visible; opacity: 1; transform: none;
    transition: opacity .22s ease, transform .22s ease, visibility 0s;
  }
  html.topnav-js .topnav-panel a {
    display: flex; align-items: center; min-height: 52px; padding: 0 4px 0 14px;
    max-width: 1200px; width: 100%; margin-inline: auto; box-sizing: border-box;
    border-bottom: 1px solid var(--tn-rule); border-left: 2px solid transparent;
    font-size: 13px; letter-spacing: .18em; white-space: normal;
  }
  html.topnav-js .topnav-panel > a:last-child { border-bottom: 0; }
  html.topnav-js .topnav-panel a[aria-current] { border-left-color: var(--tn-pink); background: linear-gradient(90deg, var(--tn-pink-soft), transparent 70%); }

  html.topnav-js .topnav-group { max-width: 1200px; width: 100%; margin-inline: auto; border-bottom: 1px solid var(--tn-rule); }
  html.topnav-js .topnav-group:last-child { border-bottom: 0; }
  html.topnav-js .topnav .topnav-parent {
    display: flex; justify-content: space-between; width: 100%; min-height: 52px; padding: 0 8px 0 14px;
    border-left: 2px solid transparent; font-size: 13px; letter-spacing: .18em; text-align: left;
  }
  html.topnav-js .topnav-group:not(.is-open) .topnav-sub { display: none; }
  html.topnav-js .topnav-sub { padding: 0 0 10px; }
  html.topnav-js .topnav-panel .topnav-sub a {
    min-height: 44px; padding-left: 34px; border-bottom: 0;
    font-size: 12px; letter-spacing: .14em;
  }
}

/* The theme's other pages: the mobile header up to 768px (the sidebar menu shows above that). */
.site-topbar { display: none; }
@media (max-width: 768px) {
  .site-topbar { display: block; background: #fff; }
  .site-topbar .frame { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
  .site-topbar-logo { display: block; flex: none; line-height: 0; }
  .site-topbar-logo img { display: block; width: 72px; height: auto; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .topnav-bars span, html.topnav-js .topnav-panel, html.topnav-js .topnav.is-open .topnav-panel { transition: none; }
}
