/* ==========================================================================
   Shared components — header, footer, buttons, tags, marquee
   ========================================================================== */

/* --------------------------------------------------------------------------
   Page header  (Figma 2001:10066 — 1920×123)
   logo 61×61 @ x58 · vertical rule @ x177 · nav flush right @ 120
   -------------------------------------------------------------------------- */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: var(--z-header);
  height: var(--header-h);
  /* [derived] The header floats over the hero rather than capping it: no
     background, no bottom rule. The glass bar only materialises once the
     page is scrolled — see .is-condensed. */
  background-color: transparent;
  border-bottom: 1px solid transparent;
  transition: transform var(--dur-base) var(--ease-out),
    height var(--dur-base) var(--ease-out),
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out);
}

/* A soft gradient scrim keeps the nav readable over the hero's glow without
   introducing a hard edge. It extends below the header so the fade has room,
   and dissolves the moment the condensed glass bar takes over. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0 0 -60%;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--color-bg) 72%, transparent),
    transparent
  );
  opacity: 1;
  transition: opacity var(--dur-base) var(--ease-out);
}

.site-header.is-condensed::before,
.site-header.is-menu-open::before {
  opacity: 0;
}

/* The header waits for the preloader, then settles in from above with the
   rest of the intro. Without JS (or before it runs) it is simply visible. */
html.js:not(.is-intro) .site-header {
  transform: translate3d(0, -101%, 0);
}

/* Condensed + glassy once the hero is behind us. [derived] */
.site-header.is-condensed {
  height: 84px;
  background-color: color-mix(in srgb, var(--color-navy) 72%, transparent);
  border-bottom-color: var(--color-rule);
  -webkit-backdrop-filter: var(--blur-glass);
  backdrop-filter: var(--blur-glass);
}

.site-header.is-hidden {
  transform: translate3d(0, -100%, 0);
}

/* With the overlay open the header rides above it: the toggle is also the
   close button, so it must stay clickable. */
.site-header.is-menu-open {
  z-index: calc(var(--z-menu) + 1);
  transform: none;
  background-color: transparent;
  border-bottom-color: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.site-header__inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding-inline: clamp(20px, calc(3.02 * var(--vw)), 58px);
}

.site-header__logo {
  display: block;
  flex-shrink: 0;
  width: clamp(40px, calc(3.177 * var(--vw)), 61px);
  height: clamp(40px, calc(3.177 * var(--vw)), 61px);
}

.site-header__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: filter var(--dur-base) var(--ease-out);
}

:root[data-theme="light"] .site-header__logo img {
  filter: brightness(0) saturate(100%);
}

/* Keep the former divider's width and margin as spacing so the clock retains
   its established position, but do not draw a vertical line beside the logo. */
.site-header__rule {
  flex-shrink: 0;
  width: 1px;
  height: 100%;
  margin-left: clamp(20px, calc(3.02 * var(--vw)), 58px);
  background: transparent;
}

/* Live local time for the studio. [derived] */
.site-header__clock {
  margin-left: clamp(20px, calc(3.02 * var(--vw)), 58px);
  font-weight: 700;
  font-size: var(--fs-caps);
  line-height: var(--lh-caps);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.site-header__clock b {
  color: var(--color-text);
  font-weight: 700;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-24);
  margin-left: auto;
  padding-right: calc(var(--gutter) - clamp(20px, calc(3.02 * var(--vw)), 58px));
}

.site-header__nav {
  display: flex;
  gap: var(--sp-40);
}

.site-header__nav a {
  position: relative;
  display: block;
  font-weight: 700;
  font-size: var(--fs-body-strong);
  line-height: var(--lh-body-strong);
  white-space: nowrap;
}

.site-header__nav a span {
  display: block;
  transition: color var(--dur-fast) var(--ease-out);
}

.site-header__nav a:hover span,
.site-header__nav a:focus-visible span {
  color: var(--color-yellow);
}

.site-header__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 100%;
  height: 1px;
  background-color: var(--color-yellow);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--dur-fast) var(--ease-out);
}

.site-header__nav a:hover::after,
.site-header__nav a:focus-visible::after,
.site-header__nav a[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Menu toggle — no mobile frame exists in Figma; derived. Bars are
   centered with flexbox rather than hand-placed offsets so the icon
   stays exactly centered in the circle regardless of size changes. */
.site-header__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--color-rule);
  transition: border-color var(--dur-fast) var(--ease-out);
}

.site-header__toggle:hover,
.site-header__toggle:focus-visible {
  border-color: var(--color-yellow);
}

.site-header__toggle span {
  width: 18px;
  height: 1px;
  background: var(--color-text);
  transition: transform var(--dur-base) var(--ease-spring),
    opacity var(--dur-fast) var(--ease-out);
}

.site-header__toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(3px) rotate(45deg);
}
.site-header__toggle[aria-expanded="true"] span:nth-child(2) {
  transform: translateY(-3px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Marquee  (used by the footer CTA, the 404 heading and featured works)
   -------------------------------------------------------------------------- */

.marquee {
  display: flex;
  width: 100%;
  overflow: hidden;
  user-select: none;
  /* [derived] The ticker leans into the scroll. --scroll-vel is written by
     js/main.js from the frame-to-frame delta, so fast flicks skew the type
     and a resting page sits perfectly upright. */
  transform: skewX(calc(var(--scroll-vel, 0) * -4deg));
  transition: transform 500ms var(--ease-out);
}

.marquee__track {
  display: flex;
  flex-shrink: 0;
  gap: var(--marquee-gap, 0px);
  min-width: 100%;
  will-change: transform;
  animation: marquee-scroll var(--marquee-duration, 40s) linear infinite;
}

.marquee--reverse .marquee__track {
  animation-direction: reverse;
}

/* Hover eases the ticker down to ~40% speed. That is driven from js/main.js
   via the animation's playbackRate: animation-duration is not transitionable
   and changing it mid-run makes the text jump. */

.marquee__item {
  flex-shrink: 0;
  white-space: nowrap;
  padding-right: var(--marquee-gap, 0px);
}

/* The track holds two identical halves, so shifting by half its width loops
   seamlessly. js/main.js clones the item until a half covers the viewport. */
@keyframes marquee-scroll {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-50%, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee__track {
    animation: none;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Page footer  (Figma 2001:10049 — 1920×363)
   CTA rule at y0/y244 · marquee frame y50…194 · bottom row at y295
   -------------------------------------------------------------------------- */

.site-footer {
  --footer-left-gutter: clamp(20px, calc(5.026 * var(--vw)), 96.5px);
  background-color: var(--color-navy);
}

.site-footer__cta {
  position: relative;
  /* Was a hard `height: 245px` + `overflow: hidden` wrapping absolutely
     positioned children. That clips the label/marquee whenever the text
     renders larger than the fixed offsets — exactly what a mobile browser
     does when accessibility font scaling (iOS Dynamic Type / Android font
     size) grows the display marquee past 245px, leaving the band blank on
     phones. Use an in-flow centered column with a min-height instead, so
     the band simply grows to contain its text instead of clipping it out. */
  min-height: 245px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3.2vw, 34px);
  overflow: hidden;
  border-top: 1px solid var(--color-line);
  border-bottom: 1px solid var(--color-line);
  text-align: center;
}

/* [derived] A cream wash follows the pointer across the CTA band. */
.site-footer__cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    36rem 36rem at var(--px, 50%) var(--py, 50%),
    color-mix(in srgb, var(--color-yellow) 16%, transparent),
    transparent 62%
  );
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
  pointer-events: none;
}

.site-footer__cta:hover::before {
  opacity: 1;
}

.site-footer__cta-label {
  z-index: 1;
  width: 100%;
  font-weight: 700;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

.site-footer__cta-link {
  display: block;
  width: 100%;
  color: var(--color-yellow);
  text-decoration: none;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.site-footer__cta-link:hover,
.site-footer__cta-link:focus-visible {
  opacity: 0.65;
}

.site-footer__cta-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -4px;
}

.site-footer__cta .marquee {
  --marquee-duration: 30s;
  position: relative;
}

.site-footer__cta .marquee__item {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: var(--fs-h1);
  line-height: var(--lh-h1);
}

.site-footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: none;
  min-height: 118px;
  padding: 50px var(--gutter) 36px var(--footer-left-gutter);
}

.site-footer__copyright {
  color: var(--color-text);
  white-space: nowrap;
}


/* [derived] Back-to-top, doubling as the footer's keyboard exit. */
.to-top {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  font-weight: 700;
  font-size: var(--fs-caps);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
  transition: color var(--dur-fast) var(--ease-out);
}

.to-top:hover,
.to-top:focus-visible {
  color: var(--color-yellow);
}

.to-top svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  transition: transform var(--dur-base) var(--ease-spring);
}

.to-top:hover svg,
.to-top:focus-visible svg {
  transform: translateY(-4px);
}

.site-footer__social {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 70px;
  width: 70px;
  height: 24px;
}

.site-footer__social li:nth-child(1),
.site-footer__social li:nth-child(1) a {
  width: 18px;
  height: 24px;
}

/* LinkedIn, Pinterest — Behance was removed, so this is the last icon now. */
.site-footer__social li:nth-child(2),
.site-footer__social li:nth-child(2) a {
  width: 16px;
  height: 24px;
}

.site-footer__social a {
  display: grid;
  place-items: center;
  color: var(--color-text);
  transition: opacity var(--dur-fast) var(--ease-out);
}

.site-footer__social a:hover,
.site-footer__social a:focus-visible {
  opacity: 0.6;
}

.site-footer__social img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* The Font Awesome SVG exports use black paths; invert them to the footer's
   white icon color. Their elements fill the measured social-icon slots. */
.site-footer__social img[src$=".svg"] {
  width: 100%;
  height: 100%;
  filter: brightness(0) invert(1);
}

/* Both icon sets ship as black or white raster/vector art; normalise them to
   the current text colour rather than shipping a second set. [derived] */
:root[data-theme="light"] .site-footer__social img[src$=".svg"] {
  filter: brightness(0) invert(0);
}

:root[data-theme="light"] .site-footer__social img[src$=".png"] {
  filter: brightness(0) invert(0.12);
}

@media (hover: none), (pointer: coarse) {
  /* Mobile Safari keeps :hover active after a tap. Neutralise those sticky
     states so controls do not look selected after the menu opens/closes. */
  .site-header.is-condensed {
    background-color: color-mix(in srgb, var(--color-navy) 96%, transparent);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .site-header__toggle:hover {
    border-color: var(--color-rule);
  }

  .site-footer__cta:hover::before {
    opacity: 0;
  }

  .site-footer__cta-link:hover,
  .site-footer__social a:hover {
    opacity: 1;
  }

  .to-top:hover {
    color: var(--color-text-muted);
  }

  .to-top:hover svg {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Password gate — a protected case study (currently /inova/).
   The markup is generated by tools/protect.mjs; the look lives here so it can
   be changed without rebuilding the ciphertext. Echoes the case-study
   masthead: hairline rules, Butler display type, caps labels, one solid action.
   -------------------------------------------------------------------------- */
.gate-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100svh;
}

.gate {
  padding: calc(var(--header-h) + clamp(40px, calc(6 * var(--vw)), 120px)) var(--gutter)
    clamp(64px, calc(5 * var(--vw)), 140px);
}

.gate__inner {
  width: min(100%, 46rem);
  margin-inline: auto;
  display: grid;
  gap: var(--sp-32);
}

.gate__eyebrow,
.gate__label,
.gate__error,
.gate__submit {
  font-family: var(--font-body);
  font-size: var(--fs-caps);
  line-height: var(--lh-caps);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
}

.gate__eyebrow {
  margin: 0;
  color: var(--color-accent);
}

.gate__title {
  margin: 0;
  padding: var(--sp-24) 0;
  border-top: 1px solid var(--color-rule);
  border-bottom: 1px solid var(--color-rule);
  font-family: var(--font-display);
  font-weight: 200;
  font-size: clamp(56px, calc(6.5 * var(--vw)), 132px);
  line-height: 1;
  color: var(--color-cream);
}

.gate__lede {
  margin: 0;
  max-width: 42ch;
  font-size: var(--fs-body-strong);
  line-height: var(--lh-body-strong);
}

.gate__form {
  display: grid;
  gap: var(--sp-16);
}

.gate__label {
  color: var(--color-text-muted);
}

.gate__field {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-16);
  align-items: stretch;
}

.gate__input {
  flex: 1 1 16rem;
  min-width: 0;
  padding: var(--sp-16) 0;
  border: 0;
  border-bottom: 1px solid var(--color-rule);
  border-radius: 0;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body-strong);
  transition: border-color var(--dur-fast) var(--ease-out);
}

.gate__input:focus {
  outline: none;
  border-bottom-color: var(--color-accent);
}

.gate__submit {
  padding: var(--sp-16) var(--sp-32);
  border: 0;
  border-radius: 0;
  background-color: var(--color-invert-surface);
  color: var(--color-invert-text);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out);
}

.gate__submit:hover {
  transform: translateY(-2px);
}

.gate__submit:active {
  transform: none;
}

.gate__error {
  margin: 0;
  min-height: 1em;
  color: var(--color-accent);
}

.gate__note {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--fs-body);
}

.gate.is-denied .gate__field {
  animation: gate-nope 420ms var(--ease-out);
}

@keyframes gate-nope {
  0%,
  100% {
    transform: none;
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gate.is-denied .gate__field {
    animation: none;
  }

  .gate__submit:hover {
    transform: none;
  }
}
