/* =========================================
   dancephl — masthead (js/nav.js renders it)
   The masthead is the navigation: one band, one 2px rule, no link twice.
   Day (paper/ink) on dancephl.com, night (plus/on-plus) on /read.
   Values come from dancephl-brand/tokens.css.
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&display=swap');

/* Motion, site-wide. Type never moves; one moving thing per screen; loops
   and transitions count in eights. For anyone who has asked for less
   motion, everything stops (the lens light holds as a still glow —
   see css/editorial.css). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
  }
}

/* ---- themes ---- */

.masthead,
.mh-row {
  --mh-fg: var(--ink);
  --mh-bg: var(--paper);
  --mh-muted: var(--ink-muted);
  --mh-hair: var(--hairline);
  --mh-star: var(--star);
  --mh-ring: var(--focus);
  background: var(--mh-bg);
  color: var(--mh-fg);
}

.masthead.night,
.mh-row.night {
  --mh-fg: var(--on-plus);
  --mh-bg: var(--plus);
  --mh-muted: var(--plus-muted);
  --mh-hair: var(--plus-hairline);
  --mh-star: var(--light-inquiry);
  --mh-ring: var(--on-plus);
}

/* pages set --mh-gutter to their own side margin so everything lines up */
.masthead, .mh-row { --gut: var(--mh-gutter, 32px); }

.masthead a, .mh-row a,
.masthead button, .mh-row button { color: inherit; text-decoration: none; }

.masthead :focus-visible,
.mh-row :focus-visible,
.nav-menu :focus-visible,
.masthead .f:focus-visible {
  outline: var(--stroke-rule) solid var(--mh-ring, var(--on-plus));
  outline-offset: 2px;
}

.nav-sym {
  font-family: var(--font-sans);
  font-weight: 700;
  margin-left: 1px;
}

.nav-sym.star { color: var(--mh-star, var(--light-inquiry)); }

.wm-word { fill: var(--mh-fg, var(--on-plus)); }
.wm-mark { fill: var(--mh-fg, var(--on-plus)); }
.wm-mark.star { fill: var(--star); }

/* ---- the band: wordmark + tagline, utility links on the same baseline ----
   The wordmark's baseline sits 22.26% of its height above its bottom edge
   (the p's descender); the tagline and links are pulled down onto it. */

.masthead { --wm-h: clamp(44px, 5vw, 72px); }
.masthead.night { --wm-h: clamp(52px, 7vw, 104px); }

.mh {
  --base: calc(var(--wm-h) * 0.2226);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-8);
  padding: 28px var(--gut) 18px;
}

.mh-id {
  display: flex;
  align-items: flex-end;
  gap: var(--space-6);
  min-width: 0;
}

.mh-wordmark { margin: 0; line-height: 0; font-size: inherit; }

.mh-wordmark svg {
  display: block;
  height: var(--wm-h);
  width: auto;
  max-width: 100%;
  overflow: visible; /* the /read +'s glow spills past the wordmark's box */
}

/* the lens light the + catches; --lt is set on the masthead by the page */
.mh-wordmark feDropShadow {
  flood-color: var(--lt, transparent);
  flood-opacity: 1;
}

.mh-tag {
  font: 400 13px/18px var(--font-mono);
  color: var(--mh-muted);
  max-width: 220px;
  margin: 0 0 calc(var(--base) - 5px);
}

.mh-util {
  display: flex;
  align-items: baseline;
  gap: 22px;
  font: 500 12px/16px var(--font-mono);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.mh .mh-util { margin-bottom: calc(var(--base) - 20px); }

.mh-util a:not(.mh-btn) { display: inline-block; padding: 16px 0; }
.mh-util a:not(.mh-btn):hover .lbl { text-decoration: underline; text-underline-offset: 4px; }

.mh-btn { display: inline-block; padding: 10px 14px; cursor: pointer; }
.day .mh-btn { background: var(--mh-fg); color: var(--mh-bg) !important; }
.night .mh-btn { box-shadow: inset 0 0 0 var(--stroke-hair) var(--mh-fg); }

/* ---- the rule, then the page's own filters as the navigation ---- */

.mh-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--space-6);
  padding: 0 var(--gut);
  border-top: var(--stroke-rule) solid var(--mh-fg);
}

.mh-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 20px;
  padding: 0;
  margin: 0;
  list-style: none;
}

@media (min-width: 900px) {
  .mh-filter-row { column-gap: 18px; }
}

.mh-filters .f,
.mh-chip {
  min-height: 48px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  font: 400 13px/18px var(--font-mono);
  letter-spacing: 0;
  text-transform: none;
  color: var(--mh-muted);
  white-space: nowrap;
  transition-property: color; /* not the focus ring */
}

.mh-filters .f:hover,
.mh-chip:hover { color: var(--mh-fg); }

.mh-filters .f.on,
.mh-filters .f[aria-pressed="true"],
.mh-chip.on {
  color: var(--mh-fg);
  text-decoration: underline;
  text-decoration-thickness: var(--stroke-hair);
  text-underline-offset: 5px;
}

.mh-div {
  width: var(--stroke-hair);
  height: 16px;
  background: var(--mh-hair);
}

/* search takes what's left of the row, and wraps below only when that's
   under 200px */
.mh-filters .search-bar {
  flex: 1 1 200px;
  max-width: 320px;
  margin: 6px 0 6px auto;
  padding: 0;
}

.mh-filters .search-clear { right: 12px; }

/* ---- the 56px row: compact pages in place, front doors on scroll ---- */

.mh-row {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  height: 58px;
  padding: 0 var(--gut);
  border-bottom: var(--stroke-rule) solid var(--mh-fg);
  font: 400 13px/18px var(--font-mono);
  position: sticky;
  top: 0;
  z-index: 90;
}

.mh-row .mh-logo { display: inline-flex; align-items: center; min-height: 48px; flex-shrink: 0; }
.mh-row .mh-logo svg { display: block; height: 22px; width: auto; }

.mh-chips {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
  overflow: hidden;
  margin-left: var(--space-3);
}

.mh-back {
  flex: 1;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: var(--mh-muted) !important;
  white-space: nowrap;
}

.mh-back:hover { color: var(--mh-fg) !important; }

.mh-fixed {
  position: fixed;
  left: 0;
  right: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s cubic-bezier(.42, 0, .58, 1), visibility 0.5s cubic-bezier(.42, 0, .58, 1);
}

.mh-fixed.is-on { opacity: 1; visibility: visible; }

/* ---- phone ---- */

.nav-menu-btn {
  display: none;
  min-height: 48px;
  min-width: 48px;
  padding: 0 0 0 var(--space-4);
  background: none;
  border: 0;
  cursor: pointer;
  font: 500 12px/16px var(--font-mono);
  letter-spacing: 0.06em;
  color: inherit;
}

@media (max-width: 899px) {
  .masthead, .mh-row { --gut: var(--space-4); }
  .masthead { --wm-h: 52px; }
  .masthead.night { --wm-h: 44px; }

  /* wordmark + menu on one row, the tagline under it */
  .mh {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    row-gap: var(--space-2);
    padding: 18px var(--gut) 12px;
  }
  .mh-id { display: contents; }
  .mh-wordmark svg { width: min(100%, calc(var(--wm-h) * 4.87)); height: auto; }
  .mh-tag { grid-column: 1 / -1; grid-row: 2; max-width: none; margin: 0; font-size: 12px; }
  .mh .mh-util, .mh-row .mh-util, .mh-chips { display: none; }
  .nav-menu-btn { display: inline-flex; align-items: flex-end; justify-content: flex-end; padding-bottom: 4px; }
  .mh .nav-menu-btn { grid-column: 2; grid-row: 1; }
  .mh-row { gap: var(--space-4); justify-content: space-between; }
  .mh-row .nav-menu-btn { align-items: center; padding-bottom: 0; }
  .mh-back { flex: 0 1 auto; }

  /* the filters run as one row that scrolls sideways, faded at the right */
  .mh-filters { display: block; padding: 0; }
  .mh-scroll { position: relative; }
  .mh-scroll::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 48px;
    background: linear-gradient(90deg, transparent, var(--mh-bg));
    pointer-events: none;
  }
  .mh-filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    column-gap: 16px;
    padding: 0 48px 0 var(--gut);
  }
  .mh-filter-row::-webkit-scrollbar { display: none; }
  .mh-filters .search-bar { margin: 4px var(--gut) 12px; max-width: none; }
}

@media (max-width: 359px) {
  .mh-back { display: none; }
}

/* ---- full-screen menu: always night ---- */

.nav-menu {
  --nav-fg: var(--on-plus);
  --nav-bg: var(--plus);
  --nav-star: var(--light-inquiry);
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: var(--nav-bg);
  color: var(--nav-fg);
  overflow-y: auto;
}

.nav-menu[hidden] { display: none; }

.nav-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  height: 56px;
  padding: 0 var(--space-4);
  border-bottom: var(--stroke-rule) solid var(--nav-fg);
  font: 500 12px/16px var(--font-mono);
  letter-spacing: 0.06em;
}

.nav-menu-head .nav-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
}

.nav-menu-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-6) var(--space-4);
}

.nav-menu a { color: inherit; text-decoration: none; }

.nav-menu .big {
  display: flex;
  align-items: center;
  min-height: 48px;
  font: 700 44px/1.05 var(--font-sans);
  letter-spacing: -0.03em;
}

.nav-menu .big[aria-current="page"] { text-decoration: underline; text-decoration-thickness: var(--stroke-rule); text-underline-offset: 0.12em; }

.nav-menu .big .nav-sym { margin-left: 2px; }

.nav-menu-rule {
  height: var(--stroke-hair);
  background: var(--plus-hairline);
  margin: 18px 0;
}

.nav-menu .small {
  display: flex;
  align-items: center;
  min-height: 48px;
  font: 400 14px/22px var(--font-mono);
  color: var(--plus-muted);
}

.nav-menu .small:hover { color: var(--on-plus); }

.nav-menu-fill { flex: 1; min-height: var(--space-6); }

.nav-menu .btn-full {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  box-shadow: inset 0 0 0 var(--stroke-hair) var(--nav-fg);
  font: 500 13px/16px var(--font-mono);
  letter-spacing: 0.06em;
}


.nav-menu .mh-logo { display: inline-flex; align-items: center; min-height: 48px; }
.nav-menu .mh-logo svg { display: block; height: 20px; width: auto; }
.nav-menu .wm-mark.star { fill: var(--light-inquiry); }
.nav-menu .nav-sym.star { color: var(--light-inquiry); }
