/* Signature mast: the room starts at y=0, with genuine projected ceiling/walls
   behind this translucent layer. No blank mast-height spacer is introduced. */
:root {
  --signature-mast-height:86px;
  --viewing-footer-height:54px;
}
.mast {
  position:sticky; top:0; z-index:40;
  height:var(--signature-mast-height);
  margin-bottom:calc(-1 * var(--signature-mast-height));
  display:flex; justify-content:center; align-items:center;
  padding:0 18px; gap:0;
  background:rgba(210,210,210,.32);
  border-bottom:1px solid rgba(110,110,110,.14);
  backdrop-filter:blur(5px); -webkit-backdrop-filter:blur(5px);
}
.phone-tool-icon { display:none; }
.signature-mark {
  display:flex; align-items:center; justify-content:center;
  pointer-events:none; transform:translateX(3px);
}
.mast .signature-logo {
  display:block; height:68px; width:auto; max-width:none;
  object-fit:contain;
}
.room#viewing-room {
  min-height:calc(100dvh - var(--viewing-footer-height));
  border-bottom:0; background:#fff;
}
.exhibition-screen {
  height:calc(100dvh - var(--viewing-footer-height)); min-height:320px;
  background:#e9e6df;
}
.exhibition-tabs { top:calc(var(--signature-mast-height) + 16px); }
.room-tools { top:calc(var(--signature-mast-height) + 16px); }
.room-bottom { bottom:24px; }
.room-hints { bottom:92px; }
.entrance { top:30%; }
.viewer-popover { max-height:calc(100dvh - var(--signature-mast-height) - 140px); overflow:auto; }
.catalogue-panel,.about-panel {
  padding-top:calc(var(--signature-mast-height) + 106px);
  min-height:calc(100dvh - var(--viewing-footer-height));
}
footer.viewing-footer {
  display:flex; align-items:center; justify-content:center;
  min-height:var(--viewing-footer-height); padding:12px var(--gutter);
  padding-bottom:max(12px,env(safe-area-inset-bottom));
  background:#fff; border-top:1px solid #ecece7;
}
footer.viewing-footer .copyright { color:#65665f; }
/* Both existing actions retain their IDs and behavior, without unequal icons. */
#detail .detail-actions { flex-direction:row; flex-wrap:wrap; gap:10px; }
#detail #detail-enquiry,#detail #detail-share {
  display:inline-flex; align-items:center; justify-content:center;
  width:auto; min-width:78px; min-height:40px;
  margin:0; padding:10px 16px !important;
  border:1px solid #252620; border-radius:4px;
  background:#252620; color:#fff;
  font:400 12px/1.2 var(--sans); text-decoration:none;
  gap:0; box-shadow:none;
}
#detail #detail-enquiry:hover,#detail #detail-share:hover { background:#3c3e35; color:#fff; border-color:#3c3e35; }
#detail #share-status { flex-basis:100%; }
/* Fixed motion-study controls clear the shared footer at the home position. */
#viewing-room[data-wall-motion] .wall-motion-controls {
  bottom:calc(var(--viewing-footer-height) + 24px);
}
@media(max-width:650px) {
  :root { --signature-mast-height:80px; --viewing-footer-height:66px; }
  .mast .signature-logo { height:58px; }
  .exhibition-tabs { top:calc(var(--signature-mast-height) + 12px); }
  .room-tools { top:calc(var(--signature-mast-height) + 69px); }
  .room-bottom { bottom:18px; }
  .room-hints { bottom:126px; }
  .entrance { top:34%; }
  .catalogue-panel,.about-panel { padding-top:calc(var(--signature-mast-height) + 92px); }
  footer.viewing-footer { padding-inline:20px; }
  #detail #detail-enquiry,#detail #detail-share { min-height:40px !important; }
}
@media(max-height:560px) and (orientation:landscape) {
  :root { --signature-mast-height:64px; --viewing-footer-height:48px; }
  .mast .signature-logo { height:52px; }
  .exhibition-screen { height:calc(100dvh - var(--viewing-footer-height)); min-height:240px; }
  .exhibition-tabs,.room-tools { top:calc(var(--signature-mast-height) + 10px); }
  .room-bottom { bottom:16px; }
  .room-hints { display:none; }
  .entrance { top:38%; }
  #viewing-room[data-wall-motion] .wall-motion-controls { bottom:calc(var(--viewing-footer-height) + 12px); }
}
@media(max-height:560px) and (orientation:landscape) and (max-width:650px) {
  .room-tools { top:calc(var(--signature-mast-height) + 66px); }
}

/* Below the notice's 313px single-line width plus 40px side padding, reserve
   both natural 16.5px lines, 16px vertical padding and the 1px footer border.
   The explicit root selector keeps this narrow exception above the base below. */
@media (max-width:352px) and (orientation:portrait) {
  html:root { --viewing-footer-height:calc(50px + env(safe-area-inset-bottom,0px)); }
}

/* Keep the viewing controls in a single row, not stacked above the paintings.
   Top/bottom insets matter in standalone Safari and a notched embedded viewer. */
@media (max-width:650px) and (orientation:portrait) {
  :root {
    --signature-mast-height:calc(clamp(58px,9svh,70px) + env(safe-area-inset-top,0px));
    --viewing-footer-height:calc(42px + env(safe-area-inset-bottom,0px));
    --tour-nav-top:calc(var(--signature-mast-height) + 8px);
  }
  .mast { padding-top:env(safe-area-inset-top,0px); }
  .mast .signature-logo { height:clamp(49px,7.5svh,57px); }
  .exhibition-tabs,.room-tools { top:var(--tour-nav-top); }
  .exhibition-tabs { padding:2px; }
  .exhibition-tabs button { min-height:44px; padding-inline:clamp(10px,3.6vw,16px); }
  .room-tools,.room-bottom { left:max(10px,env(safe-area-inset-left,0px)); right:max(10px,env(safe-area-inset-right,0px)); }
  .room-tools { align-items:center; height:50px; }
  .room-tools :is(#mode-toggle,#art-list-toggle) { min-height:44px; width:44px; min-width:44px; padding:0; justify-content:center; }
  .room-tools .tool-label { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
  .room-tools .tool-chevron { display:none; }
  .room-tools .phone-tool-icon { display:block; width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
  .room-bottom { bottom:10px; }
  .room-bottom :is(.viewer-pill,.room-thumbnail) { min-height:44px; }
  .travel-controls .viewer-pill { width:44px; }
  .room-hints { bottom:70px; }
  .catalogue-panel,.about-panel { padding-top:calc(var(--signature-mast-height) + 84px); }
  footer.viewing-footer { padding-block:8px calc(8px + env(safe-area-inset-bottom,0px)); }
  .room-tools .viewer-popover { max-height:calc(100dvh - var(--viewing-footer-height) - var(--tour-nav-top) - 62px); overflow:auto; }
  .room-bottom .room-menu { max-height:calc(100dvh - var(--viewing-footer-height) - var(--tour-nav-top) - 66px); }
  .room-bottom:has(.walk-turns.is-walk) .room-thumbnail span { display:none; }
  .room-bottom:has(.walk-turns.is-walk) { gap:4px; }
  .room-bottom:has(.walk-turns.is-walk) #travel-progress { display:none; }
  .room-bottom:has(.walk-turns.is-walk) :is(.walk-turns,.travel-controls) { gap:4px; margin:0; }
  .room-bottom:has(.walk-turns.is-walk) .walk-turns button { min-width:44px; }
}
@media (orientation:landscape) and (max-height:560px) and (pointer:coarse) {
  :root { --signature-mast-height:calc(46px + env(safe-area-inset-top,0px)); --viewing-footer-height:calc(34px + env(safe-area-inset-bottom,0px)); }
  .mast { padding-top:env(safe-area-inset-top,0px); }
  .mast .signature-logo { height:42px; }
  .exhibition-tabs,.room-tools { top:calc(var(--signature-mast-height) + 5px); }
  .room-tools,.room-bottom { left:max(10px,env(safe-area-inset-left,0px)); right:max(10px,env(safe-area-inset-right,0px)); }
  .exhibition-tabs { padding:2px; }
  .exhibition-tabs button { min-height:40px; padding-inline:12px; }
  .room-bottom { bottom:6px; }
  .room-thumbnail { min-height:44px; padding:3px 6px; }
  .room-thumbnail>gp-art { height:32px; width:32px; flex-basis:32px; }
  footer.viewing-footer { padding-block:6px calc(6px + env(safe-area-inset-bottom,0px)); }
  .viewer-popover,.art-list:not([hidden]) { max-height:calc(100dvh - var(--signature-mast-height) - var(--viewing-footer-height) - 65px); overflow:auto; }
}

/* Short touch viewports: keep floating menus between the two control bars.
   JS measures the actual bars, including the wrapped Walk controls. */
@media (max-height:560px) and (pointer:coarse) {
  #room-menu,#art-list:not([hidden]) {
    max-height:var(--short-menu-height,120px);
    overflow:auto;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }
  #room-menu { box-sizing:border-box; }
  #art-list:not([hidden]) {
    box-sizing:border-box;
    display:block;
    padding:8px;
  }
  #art-list>p { padding:0 4px 6px; }
  #art-list .art-list-preview {
    display:grid;
    grid-template-columns:48px minmax(0,1fr) auto;
    gap:8px;
    padding:6px;
    margin-bottom:6px;
  }
  #art-list .art-list-preview>gp-art {
    grid-row:auto;
    width:48px;
    height:48px;
  }
  #art-list .art-list-preview h3 { font-size:16px; text-align:left; }
  #art-list .art-list-preview .viewer-pill {
    min-height:44px;
    padding:6px 8px;
    font-size:11px;
  }
  #art-list #art-list-items { max-height:none; overflow:visible; }
}

/* A catalogue title and its two actions share one header; no empty detail sidebar. */
#detail .detail-body { display:flex; flex-direction:column; align-items:stretch; overflow:auto; background:#f8f7f3; }
#detail .detail-info { order:-1; position:static; flex:none; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:0 clamp(10px,2vw,26px); box-sizing:border-box; width:min(100%,980px); margin:0 auto; padding:clamp(14px,1.6vw,24px) clamp(14px,3.5vw,50px); border:0; border-bottom:1px solid #dedbd2; background:transparent; }
#detail .detail-info #detail-title { margin:0; font-size:clamp(26px,3vw,43px); line-height:1.08; text-wrap:balance; }
#detail .detail-info .detail-actions { display:flex; flex-flow:row nowrap; align-items:center; justify-content:flex-end; width:auto; gap:8px; margin:0; padding:0; }
#detail .detail-info #share-status { grid-column:1/-1; justify-self:end; margin:.4em 0 0; }
#detail .detail-info #share-status:empty { display:none; }
#detail .detail-image.study-view { width:100%; flex:none; }
#detail.detail-studies-focus .detail-body { overflow:hidden; }
@media(max-width:700px) {
  #detail .detail-info { padding:13px 12px; }
  #detail .detail-info #detail-title { font-size:clamp(24px,6.1vw,29px); }
  #detail .detail-info .detail-actions { gap:5px; }
  #detail .detail-info :is(#detail-enquiry,#detail-share) { min-height:44px !important; min-width:57px; padding:8px 9px !important; }
}

/* Editorial pages keep their first heading clear of the floating exhibition tabs. */
#panel-about.about-panel { padding-top:calc(var(--signature-mast-height) + 92px); }
#panel-about > #biography { scroll-margin-top:calc(var(--signature-mast-height) + 92px); }
@media (max-width:650px) {
  #panel-about.about-panel { padding-top:calc(var(--signature-mast-height) + 80px); }
}
@media (orientation:landscape) and (max-height:560px) {
  #panel-about.about-panel { padding-top:calc(var(--signature-mast-height) + 67px); }
}
/* Budget for the sticky mast, both 14px frame edges, and the section spacing. */
#panel-works #films { scroll-margin-top:var(--signature-mast-height); }
#panel-works .film { width:calc((100svh - var(--signature-mast-height) - 90px) * .5625); max-width:100%; }
@media (max-width:1000px) and (orientation:portrait) {
  #panel-works .film { width:calc((100svh - var(--signature-mast-height) - 154px) * .5625); max-width:100%; }
}
@media (max-height:560px) and (orientation:landscape) {
  #panel-works .film { width:calc((100svh - var(--signature-mast-height) - 65px) * .5625); max-width:100%; }
}
