.wordmark, h1.living-logo { position: relative; }
.wordmark { color: #fff; }
.logo-emission { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; dynamic-range-limit: no-limit; }
.hdr-engraving, .hdr-ink .logo-ink { display: none; }
.hdr-ink .hdr-engraving { display: inline; }
.living-logo.hdr-ink > svg { position: relative; }
.wordmark.hdr-ink > svg { opacity: 0; }

/* The compact header leaves the drawing clear until the main title gives way
   to the small wordmark. The same controls live in the tray at this size. */
@media (max-width: 760px), (max-width: 950px) and (max-height: 500px) and (pointer: coarse) {
 .has-tray header {
  inset: 0 0 auto; height: clamp(62px, 11svh, 84px);
  padding-inline: max(12px, env(safe-area-inset-left));
  align-items: center; justify-content: center; pointer-events: none;
 }
 .has-tray .header-right, .has-tray footer { display: none; }
 #projects, .reading-copy > [href="#projects"] { display: none; }
 .has-tray header .wordmark {
  width: clamp(124px, 35vw, 160px); height: auto; aspect-ratio: 960/150;
  opacity: 0; visibility: hidden; transition: opacity .45s, visibility 0s .45s;
 }
 .has-tray .past-opening header::before {
  content: ""; position: absolute; inset: 0 0 -12px; z-index: -1;
  background: linear-gradient(var(--ink) 55%, transparent);
 }
 .has-tray .past-opening header .wordmark {
  visibility: visible; opacity: 1; pointer-events: auto; transition-delay: 0s;
 }
 .menu-launch, .menu-close {
  position: absolute; left: max(12px, env(safe-area-inset-left)); top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; display: grid; place-items: center; padding: 0;
  color: #f0ede8; pointer-events: auto;
 }
 .menu-launch i, .menu-launch i::before, .menu-launch i::after, .menu-close i::before, .menu-close i::after {
  display: block; width: 30px; height: 1.5px; background: currentColor;
 }
 .menu-launch i, .menu-close i { position: relative; }
 .menu-launch i::before, .menu-launch i::after, .menu-close i::before, .menu-close i::after {
  content: ''; position: absolute; left: 0;
 }
 .menu-launch i::before { top: -10px; }
 .menu-launch i::after { top: 10px; }
 #mobile-menu {
  position: fixed; inset: 0 auto 0 0; margin: 0;
  width: min(345px, 89vw); max-width: none; height: 100%; height: 100dvh; max-height: 100%;
  border: 0; border-right: 1px solid #35302b; border-radius: 0;
  padding: clamp(74px, 13svh, 100px) 26px max(24px, env(safe-area-inset-bottom));
  background: #080807; box-shadow: none; overflow-y: auto; overscroll-behavior: contain;
 }
 #mobile-menu[open] { animation: enter-tray .22s ease-out; }
 @keyframes enter-tray { from { transform: translateX(-18px); opacity: .35; } }
 #mobile-menu::backdrop { background: rgb(0 0 0 / 70%); backdrop-filter: none; }
 html:has(#mobile-menu[open]) { overflow: hidden; }
 .menu-close { top: clamp(31px, 5.5svh, 42px); }
 .menu-close i { width: 30px; }
 .menu-close i::before { transform: rotate(45deg); }
 .menu-close i::after { transform: rotate(-45deg); }
 .tray-nav { display: grid; }
 .tray-nav > * {
  display: flex; align-items: center; min-height: 47px;
  border-bottom: 1px solid #282520; font: 22px/1.25 Baskerville, Georgia, serif;
 }
 .tray-nav > button { padding: 0; text-align: left; }
 .tray-nav .tray-games { display: block; }
 .tray-games summary, .tray-games button {
  display: flex; align-items: center; width: 100%; min-height: 47px; cursor: pointer;
 }
 .tray-games summary { justify-content: space-between; list-style: none; }
 .tray-games summary::-webkit-details-marker { display: none; }
 .tray-games summary::after { content: '+'; font: 14px ui-monospace, monospace; color: var(--red); }
 .tray-games[open] summary::after { content: '−'; }
 .tray-games button { padding: 0 0 0 17px; color: #dbd5cc; font-size: 18px; }
 .tray-games summary:focus-visible { outline: 1px solid var(--red); }
 .tray-nav > span { color: #877e70; }
 .tray-nav [aria-current]::after { content: ''; width: 14px; height: 1px; background: #b9382e; margin-left: 13px; }
 .tray-tools { margin: 18px 0 10px; }
 .tray-tools > button, .tray-contact {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 0; font: 10px/1.5 ui-monospace, monospace; letter-spacing: .15em; text-transform: uppercase;
 }
 .tray-contact { color: #b9afa2; }
 #mobile-menu #controls {
  position: static; width: 100%; max-height: none; padding: 16px 0;
  border-width: 1px 0; box-shadow: none; background: transparent; backdrop-filter: none; overflow: visible;
 }
 #mobile-menu .pose-buttons button { min-height: 44px; }
 .still-site .tray-tools { display: none; }
}
@media (prefers-reduced-motion: reduce) {
 #mobile-menu[open] { animation: none; }
 .has-tray header .wordmark { transition: none; }
}

@media (max-width: 760px) and (orientation: portrait) {
 :root {
  --masthead-inset: clamp(62px, 10svh, 84px);
  --portal-top: 15.1svh;
  --portal-height: min(62vw, 37svh);
  --studio-copy-top: calc(var(--portal-top) + var(--portal-height) + 7svh - var(--masthead-inset));
 }
 html { scroll-padding-top: var(--masthead-inset); scroll-padding-bottom: 0; }
 .opening-frame { height: 100svh; }
 .opening { height: 130svh; }
 .opening-plate img {
  width: min(149.074074vw, 85svh); top: 10.5svh;
  transform: translate(-1.552795%, -12.280702%);
 }
 .title-block {
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  left: 0; top: 60.4svh; width: 100%; height: 39.6svh; transform-origin: center center;
  text-align: center;
 }
 h1.living-logo { width: min(37vw, 20.6svh, 180px); margin: 0; }
 .invitation {
  align-self: center; margin: 0; color: #b6a998; font-size: clamp(9px, 1.55svh, 12px);
  line-height: 1.75; letter-spacing: .27em;
 }
 .invitation span { display: block; }
 .scroll-link {
  position: relative; align-self: center; width: 48px; height: 44px; min-height: 36px;
  padding: 0; font-size: 0; line-height: 0; letter-spacing: 0;
 }
 .scroll-link span { display: none; }
 .scroll-link::before, .scroll-link::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%); color: #ae3a32;
 }
 .scroll-link::before { bottom: 16px; height: 12px; border-left: 1px solid currentColor; }
 .scroll-link::after { bottom: 4px; width: 11px; height: 11px; border: 1.5px solid currentColor; border-radius: 50%; }
 .progress-rail { top: 63svh; height: 9svh; }
 .studio-chapter {
  min-height: 108svh; padding: var(--studio-copy-top) 9% max(10svh, calc(env(safe-area-inset-bottom) + 32px));
  isolation: isolate;
 }
 .studio-chapter::before {
  content: ''; position: absolute; z-index: -1;
  inset: calc(var(--studio-copy-top) - 8.5svh) 0 0;
  background: linear-gradient(to bottom, transparent, var(--ink) 2.5svh);
 }
 .reading-shade {
  background: linear-gradient(180deg, rgb(0 0 0 / 20%), rgb(0 0 0 / 24%) 8%, rgb(0 0 0 / 88%) 30%, rgb(0 0 0 / 97%) 56%);
 }
 .reading-copy { margin: 0; max-width: 36rem; }
 .studio-chapter h2 { font-size: clamp(39px, 10.6vw, 60px); margin-bottom: 26px; }
 .reading-copy > .chapter-lead { margin: 0 0 30px; font-size: clamp(20px, 5.25vw, 26px); }
 .chapter-label { margin-bottom: 23px; }
 .still-site .studio-chapter { padding-top: 12svh; }
}
