/* Header signature: fixed SPRUS identity, finely spaced DESIGN suffix.
   Text and its full width exist without JS. Motion runs once, with no timers. */
.header .brand { flex: 0 0 auto; white-space: nowrap; }
.header .brand svg { flex: 0 0 auto; }
.header .brand-wordmark { display: inline-flex; align-items: baseline; }
.brand-core { display: inline-block; }
/* Both words share a fixed-width slot: changing context never moves the menu. */
.brand-division {
  display: inline-grid;
  overflow: hidden;
  margin-left: 6px;
  font-size: 18px;
  font-weight: 450;
  letter-spacing: .08em;
  line-height: 1.6;
  color: #646960;
}
.brand-division-word {
  position: relative;
  grid-area: 1 / 1;
  transition: transform .55s cubic-bezier(.22,1,.36,1), opacity .35s ease;
  will-change: auto;
}
.brand-division-design { opacity: 1; transform: translateY(0); }
.brand-division-developer { opacity: 0; transform: translateY(105%); }
.brand[data-division="developer"] .brand-division-design { opacity: 0; transform: translateY(-105%); }
.brand[data-division="developer"] .brand-division-developer { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .brand-division-word { transition: none; }
}
.motion-off .brand-division-word { transition: none; }

/* One entrance on the initially visible word. Its children animate separately
   from the parent so the existing context slide remains independent. */
.brand-entry-letter { display: inline-block; }
.brand-division-word::after {
  content: attr(data-word);
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: transparent;
  opacity: 0;
  background: linear-gradient(110deg, transparent 37%, #b7b8af 46%, #eeece5 50%, #b7b8af 54%, transparent 63%);
  background-size: 300% 100%;
  background-position: 110% 0;
  -webkit-background-clip: text;
  background-clip: text;
}
@media (prefers-reduced-motion: no-preference) {
  :root:not(.motion-off) .brand-entry .brand-entry-letter {
    animation: brand-letter-build .72s cubic-bezier(.16,1,.3,1) both;
    animation-delay: calc(.16s + var(--letter) * 65ms);
  }
  :root:not(.motion-off) .brand-entry::after {
    animation: brand-light-pass 1.25s .85s ease-in-out both;
  }
}
@keyframes brand-letter-build {
  from { opacity: 0; transform: translateY(.8em); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes brand-light-pass {
  0% { opacity: 0; background-position: 110% 0; }
  15%, 75% { opacity: .9; }
  100% { opacity: 0; background-position: -10% 0; }
}
.header-contact { white-space: nowrap; }

/* The suffix must never squeeze navigation or overlap its touch target. */
@media (min-width: 761px) and (max-width: 1280px) {
  .header .brand-caption { display: none; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  .header { gap: 16px; }
  .header .desktop-nav { gap: 18px; }
  .header-contact { margin-left: 0; padding-inline: 12px; }
  .header-contact span { margin-left: 10px; }
  .header .brand-wordmark { font-size: 30px; }
  .brand-division { font-size: 14px; margin-left: 5px; }
}
@media (max-width: 760px), (max-width: 1000px) and (max-height: 500px) {
  .header { gap: 12px; }
  .header .brand { gap: 10px; }
  .brand-division { font-size: 14px; margin-left: 5px; }
}
@media (max-width: 374px) {
  .header .menu-toggle { width: 44px; }
  .header .menu-toggle::before { content: none; }
  .header .menu-toggle span { right: 10px; }
}
@media (min-width: 761px) and (max-width: 880px) {
  .header .header-contact { display: none; }
}

/* The scroll position controls every dimension together. Reserve the original
   flow height so resizing a sticky header cannot feed back into scroll anchoring.
   On the home page the header is fixed, so its margin occupies no document space. */
.header {
  --header-progress: 0;
  --header-open-height: 100px;
  --header-height-change: 36px;
  --brand-open-size: 35px;
  --brand-size-change: 15px;
  --mark-open-size: 30px;
  --mark-size-change: 8px;
  --core-letter-change: 1.2px;
  transition: transform .5s cubic-bezier(.2,.7,.2,1), box-shadow .3s;
}
.header, .header.scrolled {
  height: calc(var(--header-open-height) - var(--header-height-change) * var(--header-progress));
  margin-bottom: calc(var(--header-height-change) * var(--header-progress));
}
.header .brand { min-height: 44px; }
.header .brand-core {
  font-size: calc(var(--brand-open-size) - var(--brand-size-change) * var(--header-progress));
  letter-spacing: calc(-2px + var(--core-letter-change) * var(--header-progress));
  transition: none;
}
.header .brand svg {
  width: calc(var(--mark-open-size) - var(--mark-size-change) * var(--header-progress));
  height: calc(var(--mark-open-size) - var(--mark-size-change) * var(--header-progress));
  transition: none;
}
.header .brand-caption { font-size: calc(14px - 3px * var(--header-progress)); transition: none; }
html { scroll-padding-top: calc(var(--site-header-height, 100px) + 12px); }
.project-subnav { top: var(--site-header-height, 82px); }
.service-sketch.is-enhanced .sketch-pin {
  top: var(--site-header-height, 100px);
  height: calc(100svh - var(--site-header-height, 100px));
}
@media (min-width: 761px) and (max-width: 1000px) {
  .header { --brand-open-size: 30px; --brand-size-change: 14px; --core-letter-change: 1.36px; }
}
@media (max-width: 760px), (max-width: 1000px) and (max-height: 500px) {
  .header {
    --header-open-height: 76px; --header-height-change: 20px;
    --brand-open-size: 30px; --brand-size-change: 14px;
    --mark-open-size: 26px; --mark-size-change: 6px;
    --core-letter-change: 1.36px;
  }
  .mobile-nav, .mobile-nav:not([hidden]) {
    top: var(--site-header-height, 76px);
    height: calc(100dvh - var(--site-header-height, 76px));
    max-height: calc(100dvh - var(--site-header-height, 76px));
  }
}
@media (max-width: 760px) {
  .identity-page-history .history-years { top: var(--site-header-height, 76px); }
}
@media (prefers-reduced-motion: reduce) {
  .header, .header .brand-core, .header .brand svg, .header .brand-caption { transition: none; }
}
.motion-off .header, .motion-off .header .brand-core,
.motion-off .header .brand svg, .motion-off .header .brand-caption { transition: none; }
