@import url("site-video-controls.css");

/* One continuous push: the menu enters as the current page exits left. */
:root {
  --menu-slide-time: 760ms;
  --menu-slide-ease: cubic-bezier(.76, 0, .24, 1);
  --site-logo-height: clamp(38px, 4.5vw, 58px);
  --site-logo-top: 26px;
  --site-logo-left: clamp(14px, 1.5vw, 24px);
}
/* Match home placement independently of each page's content gutter. */
body > .site-name {
  position: fixed;
  top: var(--site-logo-top);
  left: var(--site-logo-left);
}
/* Use the home page's W dimensions everywhere, including its 10% reduction. */
.site-name .flat-logo {
  height: var(--site-logo-height);
  width: auto;
  transform: scale(0.9);
  transform-origin: top left;
}
#menu {
  background: #eae6de;
  transform: translate3d(100%, 0, 0);
  transform-origin: center;
  border-radius: 0;
  visibility: hidden;
  transition: transform var(--menu-slide-time) var(--menu-slide-ease),
    visibility 0s linear var(--menu-slide-time);
}
#menu.open {
  transform: translate3d(0, 0, 0);
  border-radius: 0;
  visibility: visible;
  transition: transform var(--menu-slide-time) var(--menu-slide-ease), visibility 0s;
}
/* Keep the small count inside the link's vertical reveal mask. */
#menu .lkm { padding-left: 28px; }
.menu-label-window { display: block; height: 19px; overflow: hidden; }
@media (pointer: coarse) {
  body > #menu-btn {
    height: 44px;
    min-width: 44px;
    margin-top: -12.5px;
    padding: 0;
    display: grid;
    align-content: center;
    justify-content: end;
  }
}
/* Keep all five destinations between the top control and the footer on
   widescreen laptops with browser chrome, or a shallow desktop window. */
@media (max-height: 800px) {
  #menu .m-links a.m-link { font-size: min(clamp(32px, 8vw, 110px), 12svh); }
}
body > #page,
body > #page-wrap,
body > main#top,
body > footer {
  translate: none;
  transition: translate var(--menu-slide-time) var(--menu-slide-ease);
}
body.menu-open > #page,
body.menu-open > #page-wrap,
body.menu-open > main#top,
body.menu-open > footer {
  translate: -100vw 0;
  pointer-events: none;
}
/* On a menu navigation, the destination starts behind the open menu. */
html.menu-arriving #menu {
  transform: translate3d(0, 0, 0);
  visibility: visible;
  transition: none;
}
html.menu-arriving body > #page,
html.menu-arriving body > #page-wrap,
html.menu-arriving body > main#top,
html.menu-arriving body > footer {
  translate: -100vw 0;
  transition: none;
}
html.menu-arriving #menu a.m-link { transform: translateY(0) !important; }
html.menu-arriving #menu .m-foot { opacity: 1 !important; }
html.menu-arriving .menu-btn .mb-stack { transform: translateY(-19px) !important; }
html.menu-arriving .site-name { mix-blend-mode: normal; opacity: 1 !important; }
html.menu-arriving .flat-logo { filter: invert(1); }
html.menu-arriving .menu-btn { opacity: 1 !important; }
html.menu-arriving body { overflow: hidden; }
/* The outgoing palette survives the destination load AND its complete slide.
   It is removed only once the panel is off-screen, leaving local menus intact. */
html[data-menu-arrival-theme="dark"] {
  --menu-arrival-bg: #080808;
  --menu-arrival-ink: #ebe7de;
  --menu-arrival-muted: #8a857a;
  --menu-arrival-dim: #777165;
}
html[data-menu-arrival-theme="light"] {
  --menu-arrival-bg: #eae6de;
  --menu-arrival-ink: #000;
  --menu-arrival-muted: rgba(0, 0, 0, .55);
  --menu-arrival-dim: rgba(0, 0, 0, .3);
}
html[data-menu-arrival-theme] #menu {
  background: var(--menu-arrival-bg);
  color: var(--menu-arrival-ink);
}
html[data-menu-arrival-theme] #menu a.m-link { color: var(--menu-arrival-ink); }
html[data-menu-arrival-theme] #menu .m-links:is(:hover, :focus-within) a.m-link { color: var(--menu-arrival-dim); }
html[data-menu-arrival-theme] #menu .m-links a.m-link:is(:hover, :focus-visible) { color: var(--menu-arrival-ink); }
html[data-menu-arrival-theme] #menu :is(.m-kick, .m-link .ct, .m-foot) { color: var(--menu-arrival-muted); }
html[data-menu-arrival-theme] #menu .m-foot a { color: inherit; }
html[data-menu-arrival-theme] #menu .m-foot a:hover { color: var(--menu-arrival-ink); }
html.menu-arriving[data-menu-arrival-theme="dark"] .flat-logo { filter: none; }
html.menu-arriving[data-menu-arrival-theme="light"] .flat-logo { filter: invert(1); }
@media (prefers-reduced-motion: reduce) {
  :root { --menu-slide-time: 0ms; }
  #menu a.m-link, #menu .m-foot { transition: none !important; }
}
/* A quiet route back to the Catalog beneath the next case-study title. */
.next-proj { position: relative; }
.next-proj a.all-projects {
  position: absolute;
  bottom: clamp(24px, 4vh, 48px);
  left: 50%;
  transform: translateX(-50%);
  display: inline-block;
  padding: 12px 0;
  color: var(--muted, #8a857a);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -.01em;
  text-transform: none;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
  white-space: nowrap;
  transition: color .2s;
}
.next-proj a.all-projects:hover {
  color: var(--ink, #ebe7de);
  opacity: 1;
  letter-spacing: -.01em;
}
.next-proj a.all-projects:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 5px;
}
