:root {
  /* Header and footer geometry must not inherit a page's content gutter. */
  --site-shell-gutter: clamp(16px, 3.4vw, 52px);
}

body {
  font-family: var(--rounded, "M PLUS Rounded 1c", ui-rounded, "Hiragino Maru Gothic ProN", system-ui, sans-serif);
}

/* The navigation is the room's fixed reference point; page content changes with
   a short photographic dissolve around it. Cross-document View Transitions are
   progressive enhancement, so unsupported browsers keep instant navigation. */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
  animation-timing-function: cubic-bezier(.2, 0, 0, 1);
  mix-blend-mode: normal;
}

::view-transition-old(root) { animation-name: room307-page-out; }
::view-transition-new(root) { animation-name: room307-page-in; }

@keyframes room307-page-out {
  to { opacity: 0; }
}

@keyframes room307-page-in {
  from { opacity: 0; }
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.top {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(18px, 3vw, 44px);
  padding: var(--site-shell-gutter);
  padding-right: max(var(--site-shell-gutter), env(safe-area-inset-right));
  padding-left: max(var(--site-shell-gutter), env(safe-area-inset-left));
  padding-top: calc(clamp(14px, 2vw, 28px) + env(safe-area-inset-top));
  background: transparent;
  view-transition-name: room307-header;
}

::view-transition-old(room307-header),
::view-transition-new(room307-header) {
  animation: none;
  mix-blend-mode: normal;
}

.top .home { display: block; grid-column: 2; grid-row: 1; line-height: 0; }
.top .home img { width: clamp(112px, 12vw, 160px); height: auto; }

.top .home .wordmark-logo {
  display: block;
  width: clamp(112px, 12vw, 160px);
  height: auto;
}

.site-menu-toggle { display: none; }

.primary-nav { display: contents; }

.site-nav,
.utility-nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.2vw, 30px);
  translate: 0 -.12em;
}

.site-nav { grid-column: 1; grid-row: 1; justify-content: flex-start; justify-self: start; }
.utility-nav { grid-column: 3; grid-row: 1; justify-content: flex-end; justify-self: end; }
.social-nav { display: none; }
.social-nav__icon { display: none; width: 20px; height: 20px; flex: none; }

.site-nav a,
.utility-nav a,
.social-nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin-block: -14px;
  color: var(--ink, #16181c);
  font: 600 clamp(.76rem, 1.15vw, .98rem)/1 var(--rounded, "M PLUS Rounded 1c", ui-rounded, system-ui, sans-serif);
  letter-spacing: .02em;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(27, 79, 216, .14);
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.utility-nav a:hover,
.utility-nav a:focus-visible,
.social-nav a:hover,
.social-nav a:focus-visible { color: var(--blue-deep, #113c9f); }
.site-nav a[aria-current="page"],
.utility-nav a[aria-current="page"] { color: var(--blue-deep, #113c9f); text-decoration: underline; text-underline-offset: .35em; }
.site-nav a:active,
.utility-nav a:active,
.social-nav a:active { color: var(--blue-deep, #113c9f); opacity: .68; }

body:not(.home-page) {
  padding-bottom: clamp(150px, 14vw, 210px);
}

@media (min-width: 56.0625rem) {
  body.about-page { padding-bottom: 0; }
}

.site-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  display: flex;
  width: 100%;
  max-width: none;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 32px;
  margin: 0;
  padding: 34px max(var(--site-shell-gutter), env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(var(--site-shell-gutter), env(safe-area-inset-left));
  border: 0;
  background: transparent;
  color: var(--soft, #59616e);
  font-family: var(--rounded, "M PLUS Rounded 1c", ui-rounded, "Hiragino Maru Gothic ProN", system-ui, sans-serif);
  font-size: clamp(.72rem, .8vw, .8rem);
  font-weight: 300;
  line-height: 1.45;
  letter-spacing: .015em;
  pointer-events: none;
}

.site-footer p { margin: 0; white-space: nowrap; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px clamp(14px, 1.6vw, 24px); pointer-events: auto; }
.site-footer a { display: inline-flex; min-height: 44px; align-items: center; color: inherit; text-decoration: none; touch-action: manipulation; -webkit-tap-highlight-color: rgba(27, 79, 216, .14); pointer-events: auto; }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--ink, #16181c); text-decoration: underline; text-underline-offset: .25em; }
.site-footer a:active { color: var(--ink, #16181c); opacity: .68; }
.footer-label-mobile { display: none; }
.home-page .site-footer { background: transparent; }

/* The experimental instrument/art pages keep their original desktop chrome.
   On phones they opt into the same compact shell as the rest of the site. */
.art-page .top,
.art-page .site-footer { display: none; }

@media (max-width: 42rem) {
  :root {
    --brand: #113c9f;
    --blue: #113c9f;
    --blue-deep: #113c9f;
    --ink: #16181c;
    --paper: #f4f6fa;
    --gutter: 16px;
  }

  .top {
    position: relative;
    z-index: 20;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-rows: 44px;
    gap: 0;
    padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
    overflow: hidden;
    border: 0;
    background: transparent;
    isolation: isolate;
    transition: background-color 220ms cubic-bezier(.2, 0, 0, 1), backdrop-filter 220ms cubic-bezier(.2, 0, 0, 1);
  }

  .home-page .top,
  .art-page .top {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
  }

  .top.is-menu-open {
    position: fixed;
    inset: 0;
    z-index: 30;
    height: 100svh;
    background: rgba(244, 246, 250, .94);
    backdrop-filter: blur(18px) saturate(115%);
  }

  .top .home {
    z-index: 2;
    grid-column: 2;
    grid-row: 1;
    display: grid;
    min-height: 44px;
    place-items: center;
    justify-self: center;
  }

  .top .home img,
  .top .home .wordmark-logo { width: clamp(112px, 30vw, 120px); }

  .site-menu-toggle {
    position: relative;
    z-index: 2;
    grid-column: 1;
    grid-row: 1;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .site-menu-toggle span,
  .site-menu-toggle span::before,
  .site-menu-toggle span::after {
    display: block;
    width: 19px;
    height: 1.25px;
    background: currentColor;
    content: "";
    transition: transform 220ms cubic-bezier(.2, 0, 0, 1), background-color 120ms linear;
  }

  .site-menu-toggle span { position: relative; }
  .site-menu-toggle span::before { position: absolute; transform: translateY(-6px); }
  .site-menu-toggle span::after { position: absolute; transform: translateY(6px); }
  .site-menu-toggle[aria-expanded="true"] span { background: transparent; }
  .site-menu-toggle[aria-expanded="true"] span::before { transform: rotate(45deg); }
  .site-menu-toggle[aria-expanded="true"] span::after { transform: rotate(-45deg); }
  .site-menu-toggle:active { transform: scale(.94); }

  .top .primary-nav {
    position: fixed;
    grid-column: 1 / -1;
    grid-row: 1;
    top: calc(68px + env(safe-area-inset-top));
    right: max(28px, env(safe-area-inset-right));
    bottom: calc(72px + env(safe-area-inset-bottom));
    left: max(28px, env(safe-area-inset-left));
    display: flex;
    width: auto;
    max-width: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    justify-self: stretch;
    gap: 0;
    overflow-y: auto;
    translate: none;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    visibility: hidden;
    transition: opacity 180ms cubic-bezier(.2, 0, 0, 1), transform 220ms cubic-bezier(.2, 0, 0, 1), visibility 0s linear 220ms;
  }

  .top .primary-nav .site-nav,
  .top .primary-nav .utility-nav { display: contents; }

  .top .primary-nav a {
    width: min(100%, 20rem);
    min-height: 56px;
    justify-content: center;
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.45rem, 7vw, 1.8rem);
    font-weight: 400;
    letter-spacing: -.02em;
    text-align: center;
  }

  .top .primary-nav a[aria-current="page"] {
    color: var(--brand);
    text-decoration-thickness: 1px;
    text-underline-offset: .3em;
  }

  .top > .social-nav {
    position: fixed;
    grid-column: 1 / -1;
    grid-row: 1;
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: max(16px, env(safe-area-inset-left));
    display: flex;
    justify-content: center;
    justify-self: stretch;
    gap: clamp(8px, 3vw, 18px);
    translate: none;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    visibility: hidden;
    transition: opacity 180ms cubic-bezier(.2, 0, 0, 1), transform 220ms cubic-bezier(.2, 0, 0, 1), visibility 0s linear 220ms;
  }

  .top > .social-nav a {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    margin: 0;
    padding-inline: 6px;
    color: var(--ink);
    font-size: .72rem;
    text-align: center;
  }

  .top > .social-nav .social-nav__icon { display: block; }
  .top > .social-nav .social-nav__label { display: none; }

  .top.is-menu-open .primary-nav,
  .top.is-menu-open > .social-nav {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transition-delay: 40ms, 0ms, 0s;
  }

  .top.is-menu-open .primary-nav { transform: translateY(0); }
  .top.is-menu-open > .social-nav { transform: translateY(0); }
  .site-menu-open #cursor { opacity: 0 !important; }

  body:not(.home-page) { padding-bottom: 0; }

  .site-footer {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    align-items: stretch;
    gap: 0;
    padding: 6px max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border-top: 0;
    background: var(--paper);
    color: var(--ink);
    font-size: .7rem;
    pointer-events: auto;
  }

  .site-footer .footer-legal-nav {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    justify-content: stretch;
    gap: 0;
  }

  .site-footer .footer-legal-nav a {
    min-width: 0;
    min-height: 44px;
    justify-content: center;
    padding-inline: 3px;
    color: var(--ink);
    font-size: .7rem;
    font-weight: 300;
    text-align: center;
  }

  .footer-label-desktop { display: none; }
  .footer-label-mobile { display: inline; }

  .site-footer p {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
    padding-top: 0;
    white-space: normal;
    font-size: .66rem;
    text-align: center;
  }

  .home-page .site-footer {
    position: fixed;
    padding: 6px max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border: 0;
    background: transparent;
    color: rgba(22, 24, 28, .62);
  }

  .art-page .top { display: grid; }

  .art-page .site-footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
  }

  .art-page > .mark,
  .art-page > .corners { display: none; }

  .art-page > .strip {
    bottom: calc(70px + max(14px, env(safe-area-inset-bottom)));
  }

  .memoryboy-page {
    min-height: 100svh;
    height: 100svh;
    justify-content: center;
    gap: 12px;
    padding: calc(76px + env(safe-area-inset-top)) 16px calc(88px + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .legal-page {
    display: flex;
    min-height: 100svh;
    flex-direction: column;
  }

  .legal-page main { flex: 1; }
}

@media (max-width: 42rem) and (max-height: 36rem) {
  .top .primary-nav a {
    min-height: 44px;
    font-size: clamp(1.12rem, 5vw, 1.32rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) { animation-duration: 1ms; }

  .top,
  .top .primary-nav,
  .top > .social-nav,
  .site-menu-toggle span,
  .site-menu-toggle span::before,
  .site-menu-toggle span::after { transition: none; }
}

@media (prefers-reduced-transparency: reduce) and (max-width: 42rem) {
  .top.is-menu-open {
    background: var(--paper);
    backdrop-filter: none;
  }
}
