/* Mad Funnel Labs v2: header, footer, hairline section frames. */

/* ---------- Header: a floating glass capsule ----------
   On the home page (with JS) it stays hidden over the hero and slides in, expanding, once the visitor scrolls.
   Everywhere else it is always visible. Keyboard focus always reveals it. */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding-top: 12px;
  pointer-events: none;
  transition: opacity 0.5s var(--ease), transform 0.7s var(--ease);
}
.header-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  width: min(100% - 2 * var(--gutter), 30rem);
  margin-inline: auto;
  padding: 7px 8px 7px 16px;
  border-radius: 28px;
  background: rgba(16, 16, 16, 0.55);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), inset 0 -1px 0 rgba(255, 255, 255, 0.04), 0 16px 48px -16px rgba(0, 0, 0, 0.85);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark { flex: none; color: var(--text); }
.brand-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Nav: no-JS baseline is a stacked list under the brand */
.site-nav { width: 100%; }
.site-nav ul { list-style: none; margin: 0; padding: 0 0 var(--space-2); display: flex; flex-direction: column; }
.site-nav a:not(.btn) {
  display: block;
  padding: 0.7rem 0.5rem;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:not(.btn):hover { color: #fff; }
.site-nav a[aria-current="page"]:not(.btn) { color: #fff; }
.nav-cta { padding-top: var(--space-2); }
.nav-cta .btn { width: 100%; }

/* Toggle is only shown when JS is running */
.nav-toggle { display: none; }
.js .nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.5rem;
  padding: 0 var(--space-4);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-chip);
  font: 500 0.9375rem var(--font-body);
  cursor: pointer;
}
.nav-toggle-icon { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; }
.nav-toggle-icon .cross { display: none; }
.nav-toggle[aria-expanded="true"] .bars { display: none; }
.nav-toggle[aria-expanded="true"] .cross { display: inline; }
.js .site-nav { display: none; }
.js.nav-open .site-nav {
  display: block;
  max-height: calc(100vh - var(--header-h) - 24px);
  max-height: calc(100dvh - var(--header-h) - 24px);
  overflow-x: hidden;
  overflow-y: auto;
  padding-inline: 4px; /* room for the glass rim, which draws a few px outside the button */
}

/* Hidden over the home hero until the first scroll */
.js body.page-home .site-header { opacity: 0; transform: translateY(-1.5rem); }
.js body.page-home .header-inner { pointer-events: none; }
.js.header-on body.page-home .site-header,
.js body.page-home .site-header:focus-within,
.js.nav-open body.page-home .site-header { opacity: 1; transform: none; }
.js.header-on body.page-home .header-inner,
.js body.page-home .site-header:focus-within .header-inner,
.js.nav-open body.page-home .header-inner { pointer-events: auto; }

/* Open mobile menu: nearly opaque, so the page does not show through the links */
.js.nav-open .header-inner { background: rgba(14, 14, 14, 0.95); }

/* Pages other than home: the capsule floats over the top of the page, so give the content room */
body:not(.page-home) main { padding-top: calc(var(--header-h) + 8px); }

@media (min-width: 62rem) {
  .header-inner { flex-wrap: nowrap; width: fit-content; max-width: calc(100% - 2 * var(--gutter)); border-radius: 999px; gap: var(--space-5); padding: 7px 8px 7px 20px; }
  .js .nav-toggle { display: none; }
  .site-nav, .js .site-nav, .js.nav-open .site-nav {
    display: block;
    width: auto;
    max-width: 40rem;
    max-height: none;
    overflow: hidden;
    padding-inline: 0;
    white-space: nowrap;
    transition: max-width 0.9s var(--ease), opacity 0.5s var(--ease) 0.12s;
  }
  .site-nav ul { flex-direction: row; align-items: center; gap: 2px; padding: 4px; }
  .site-nav a:not(.btn) { padding: 0.5rem 0.95rem; border-radius: var(--radius-chip); color: var(--text-muted); font-size: 0.9375rem; }
  .site-nav a:not(.btn):hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
  .site-nav a[aria-current="page"]:not(.btn) { color: #fff; background: rgba(255, 255, 255, 0.1); }
  .nav-cta { padding: 0 0 0 var(--space-2); }
  .nav-cta .btn { width: auto; }
  /* Home, before the first scroll: the nav is folded away, then unfolds as the capsule arrives */
  .js:not(.header-on) body.page-home .site-header:not(:focus-within) .site-nav { max-width: 0; opacity: 0; }
}

/* ---------- Hairline section frames: a rule across the page with "+" marks where it meets the rails ---------- */
.sx { position: relative; border-top: 1px solid var(--line); }
@media (min-width: 40rem) {
  .sx::before, .sx::after {
    content: "+";
    position: absolute;
    top: -0.55em;
    padding: 0 1px;
    background: var(--bg);
    color: var(--edge);
    font: 300 1.25rem/1 var(--font-body);
    pointer-events: none;
  }
  .sx::before { left: calc(max(var(--gutter), (100% - var(--container)) / 2) - 0.34em); }
  .sx::after { right: calc(max(var(--gutter), (100% - var(--container)) / 2) - 0.34em); }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: var(--space-9);
  position: relative;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.footer-lede { padding-block: clamp(var(--space-7), 7vw, var(--space-9)) var(--space-6); }
.footer-lede h2 { font-size: var(--step-4); max-width: 16ch; margin-bottom: var(--space-5); }
.footer-lede a.mail { font-family: var(--font-display); font-size: var(--step-2); letter-spacing: -0.02em; color: var(--text); text-decoration-color: var(--line-strong); }
.footer-lede a.mail:hover { text-decoration-color: #fff; }
.footer-grid { display: grid; gap: var(--space-6); padding-block: var(--space-6); border-top: 1px solid var(--line); }
.footer-brand { font-family: var(--font-display); font-weight: 400; font-size: 1.3rem; letter-spacing: -0.02em; margin: 0 0 var(--space-2); }
.footer-line { color: var(--text-muted); max-width: 32em; margin: 0; font-size: var(--step--1); }
.footer-heading { font-family: var(--font-body); font-weight: 500; font-size: 0.875rem; letter-spacing: 0.01em; color: var(--text-muted); margin: 0 0 var(--space-3); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li a { display: inline-flex; align-items: center; min-height: 2.25rem; color: var(--text); text-decoration: none; font-size: 0.9375rem; }
.site-footer li a:hover { color: #fff; text-decoration: underline; text-underline-offset: 0.3em; text-decoration-thickness: 1px; }
.footer-base { padding-block: var(--space-5) var(--space-7); color: var(--text-muted); font-size: 0.875rem; border-top: 1px solid var(--line); }
.footer-base p { margin: 0; }

@media (min-width: 48rem) {
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: var(--space-6); }
}
