/* Detail-only overrides, loaded after viewer-ui.css. Tile and room surfaces are untouched. */
#detail { overflow: hidden; }
#detail .detail-top, #detail .detail-bottom { flex: none; position: relative; }
#detail .detail-body { flex: 1 1 0; min-height: 0; overflow: auto; overscroll-behavior: contain; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 28%); align-items: start; scrollbar-gutter: stable; }
#detail .detail-info { position: sticky; top: 0; overflow: visible; gap: 24px; padding: 32px 28px; }
#detail .detail-info h2 { margin-top: 0; }
#detail .detail-info .detail-actions { gap: 8px; }
#detail .study-view { display: flex; flex-direction: column; align-items: center; gap: 44px; height: auto; min-height: 0; min-width: 0; overflow: visible; padding: 24px clamp(18px, 3.5vw, 54px) 38px; background: #f8f7f3; }
#detail .study-section { position: relative; display: flex; flex-direction: column; width: min(100%, 880px); min-width: 0; gap: 14px; }
#detail .study-section + .study-section { padding-top: 26px; border-top: 1px solid #dedbd2; }
#detail .study-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: none; }
#detail .study-section-title { font: 400 24px/1.2 var(--serif, Georgia, serif); letter-spacing: -.025em; margin: 0 auto 0 0; color: #33372e; }
#detail .study-toolbar button { min-height: 40px; padding: 8px 10px; border: 1px solid #d7d5cc; border-radius: 3px; background: #ffffff80; font: 12px/1.3 var(--sans, Arial, sans-serif); color: #4e5547; white-space: nowrap; }
#detail .study-toolbar button:hover { background: #fff; border-color: #a7ab9b; }
#detail .study-toolbar .study-focus { margin-left: 0; }
/* The brush-tip mark is decorative; the native button keeps its accessible name. */
#detail .study-toolbar .study-inspect { display:inline-flex; align-items:center; gap:6px; min-height:44px; padding-inline:8px; border-color:transparent; background:transparent; color:#514a3d; font:italic 16px/1.1 'Iowan Old Style','Palatino Linotype',Palatino,Georgia,serif; }
#detail .study-toolbar .study-inspect::before { content:''; width:23px; height:23px; flex:none; background:center / contain no-repeat url('/brand/brush-tip.webp'); }
#detail .study-toolbar .study-inspect:hover { border-color:#c3bbac; background:#fffdf8; }
#detail .study-zoom { display: flex; gap: 4px; margin-left: 0; }
#detail .study-zoom button { min-width: 40px; }
#detail .study-zoom button:disabled { opacity: .4; }
#detail .study-viewport { position: relative; flex: none; height: auto; min-height: 0; min-width: 0; overflow: visible; touch-action: pan-x pan-y pinch-zoom; outline-offset: 4px; }
#detail .study-canvas { position: relative; display: block; width: 100%; height: auto; min-height: 0; }
/* Mat is outside the art rectangle. The slim pencil edge never crops the image. */
#detail .study-frame { position: relative; box-sizing: border-box; width: 100%; height: auto; padding: clamp(12px, 1.8vw, 24px); background: #f2eee4; border: 3px solid #988673; border-color: #b5a18a #81705f #897664 #bca990; box-shadow: inset 0 0 0 1px #d6c5aa, 0 0 0 1px #72624d50, 0 7px 16px #342b2014, 0 2px 4px #342b2012; }
#detail .study-stage, #detail .study-stage.is-comparison { position: relative; display: block; inset: auto; top: auto; left: auto; transform: none; width: 100%; height: auto; min-height: 0; max-width: none; max-height: none; margin: 0; aspect-ratio: auto; flex: none; background: #ede7da; overflow: visible; }
#detail .study-stage > gp-art { position: absolute; display: block; inset: 0; width: 100%; height: 100%; min-height: 0; pointer-events: none; }
/* Equal original-aspect hosts, contain only. Opaque paper covers native sketch
   ratio differences without stretching, cropping, or colored underlayer slivers. */
#detail .study-stage .study-reveal-layer { background: #eee9dd; clip-path: inset(0 calc(100% - var(--reveal, 100%)) 0 0); }
#detail .study-stage.is-comparison { cursor: ew-resize; touch-action: pan-y pinch-zoom; }
#detail .study-section[data-zoom]:not([data-zoom="1"]) .study-stage.is-comparison { cursor: grab; touch-action: pan-x pan-y pinch-zoom; }
#detail .study-reveal-line { position: absolute; left: clamp(0px, var(--reveal, 100%), calc(100% - 1px)); top: 0; bottom: 0; width: 1px; background: #fffdf6; box-shadow: 0 0 0 1px #493e2e40; pointer-events: auto; cursor: ew-resize; touch-action: none; }
#detail .study-reveal-line::after { content: '↔'; position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%); display: grid; place-items: center; width: 30px; height: 42px; border-radius: 18px; background: #fffdf5f2; border: 1px solid #b9b09e; color: #5b5d4f; font: 16px/1 Arial, sans-serif; box-shadow: 0 2px 7px #342b2026; }
#detail .study-comparison { flex: none; width: min(100%, 600px); align-self: center; }
#detail .study-reveal-labels { display: flex; justify-content: space-between; margin: 0 0 5px; font-size: 11px; line-height: 1.4; color: #696b5e; }
#detail .study-range-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#detail .study-reveal { display: block; width: 100%; height: 36px; margin: 0; accent-color: #626b54; cursor: ew-resize; touch-action: pan-y pinch-zoom; }
#detail .study-help { margin: 3px 0 0; font: 11px/1.5 var(--sans, Arial, sans-serif); color: #6c7062; }
#detail .study-loading { display: flex; flex: none; align-items: center; gap: 8px; min-height: 0; font-size: 11px; color: #6c7062; }
#detail .study-loading:has(.study-status:empty) { display: none; }
#detail .study-retry { min-height: 38px; padding: 6px 10px; font-size: 11px; }
#detail .study-stage.is-inspecting { cursor: crosshair; touch-action: none; }
#detail .study-toolbar .study-inspect[aria-pressed="true"] { border-color: #a7ab9b; background: #fff; color: #414a38; }
#detail .study-brush-inset { position: absolute; z-index: 2; box-sizing: border-box; margin: 0; padding: 0; border: 3px solid #655e50; border-radius: 50%; overflow: hidden; background: #f2eee4; box-shadow: 0 0 0 1px #fffdf5, 0 4px 18px #352b2040; pointer-events: none; }
#detail .study-brush-surface { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 50%; background: #f2eee4; pointer-events: none; }
#detail .study-brush-surface > gp-art.study-lens-art { position: absolute; display: block; inset: auto; max-width: none; max-height: none; min-width: 0; min-height: 0; pointer-events: none; }
#detail .study-view [hidden] { display: none !important; }
/* Each permanent section enters focus in place: no third viewer/image copy. */
#detail .study-section.study-fullscreen, #detail .study-section:fullscreen { position: fixed; inset: 0; z-index: 20; box-sizing: border-box; width: 100%; height: 100vh; height: 100dvh; max-width: none; max-height: none; display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: max(12px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); border: 0; background: #f8f7f3; gap: 10px; }
#detail .study-section:-webkit-full-screen { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; background: #f8f7f3; }
#detail.detail-studies-focus .detail-body { overflow: hidden; }
#detail .study-section.study-fullscreen .study-viewport { flex: 1 1 0; height: auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
#detail .study-section.study-fullscreen .study-canvas { width: 100%; height: 100%; min-height: 100%; }
#detail .study-section.study-fullscreen .study-frame { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 16px; max-width: none; max-height: none; }
#detail .study-section.study-fullscreen .study-toolbar { flex-wrap: wrap; }
#detail .study-section.study-fullscreen .study-comparison, #detail .study-section.study-fullscreen .study-loading { flex: none; }
#detail .study-view :is(button, input):focus-visible, #detail .study-viewport:focus-visible { outline: 2px solid #626b54; outline-offset: 3px; }
@media (min-width: 701px) and (min-height: 561px) {
  /* Same width for both sections; a portrait composition fits on first opening. */
  #detail .study-section:not(.study-fullscreen) { width: min(100%, 880px, calc((100dvh - 300px) * var(--study-ratio, 1))); }
}
@media (max-width: 700px) {
  #detail .detail-top { min-height: 54px; padding: 5px 14px; }
  #detail .detail-top .detail-counter { margin-right: 4px; }
  #detail .detail-body { display: flex; flex-direction: column; flex: 1 1 0; overflow: auto; min-height: 0; scrollbar-gutter: auto; }
  #detail .detail-info { order: -1; position: static; width: 100%; border: 0; border-bottom: 1px solid #e8e5dd; padding: 16px 18px 14px; gap: 12px; flex: none; }
  #detail .detail-info h2 { font-size: 30px; line-height: 1.1; margin: 0; }
  #detail .detail-info p { margin-top: 5px; font-size: 11px; }
  #detail .detail-actions { flex-direction: row; flex-wrap: wrap; align-items: center; max-width: none; gap: 8px 16px; }
  #detail .detail-actions .enquiry-link { width: auto; max-width: none; min-height: 38px; padding: 9px 12px; font-size: 11px; gap: 10px; }
  #detail .detail-actions .text-link { min-height: 38px !important; padding: 7px 0 !important; font-size: 11px; }
  #detail #share-status:empty { display: none; }
  #detail #share-status:not(:empty) { flex-basis: 100%; }
  #detail .study-view { width: 100%; flex: none; height: auto; min-height: 0; padding: 18px 12px 28px; gap: 32px; }
  #detail .study-section { width: 100%; gap: 12px; }
  #detail .study-section + .study-section { padding-top: 22px; }
  #detail .study-toolbar { gap: 4px; }
  #detail .study-section-title { font-size: 22px; }
  #detail .study-toolbar button { font-size: 11px; min-height: 40px; padding: 7px 8px; }
  #detail .study-toolbar .study-inspect { font-size:15px; padding-inline:5px; gap:4px; }
  #detail .study-frame { padding: 11px; }
  #detail .study-viewport { flex: none; height: auto; min-height: 0; overflow: visible; }
  #detail .study-help { font-size: 10px; }
  #detail .detail-bottom { min-height: 50px; padding: 3px 14px; position: relative; }
  #detail .detail-bottom button { min-height: 42px; font-size: 11px; }
  #detail .study-section.study-fullscreen { padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right)); }
  #detail .study-section.study-fullscreen .study-zoom { width: 100%; justify-content: center; }
  #detail .study-section.study-fullscreen .study-frame { padding: 11px; }
}
@media (max-width: 370px) {
  #detail .study-section-title { font-size: 20px; }
  #detail .study-toolbar .study-inspect { font-size:14px; }
  #detail .study-toolbar .study-inspect::before { width:18px; height:18px; }
  #detail .study-toolbar .study-focus { font-size: 10px; padding-inline: 5px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  #detail .study-section.study-fullscreen { gap: 5px; padding-block: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-bottom)); }
  #detail .study-section.study-fullscreen .study-toolbar { flex-wrap: nowrap; }
  #detail .study-section.study-fullscreen .study-zoom { width: auto; margin-left: auto; }
  #detail .study-section.study-fullscreen .study-section-title { font-size: 20px; }
  #detail .study-section.study-fullscreen .study-toolbar button { min-height: 36px; font-size: 11px; padding: 6px; }
  #detail .study-section.study-fullscreen .study-frame { padding: 8px; }
  #detail .study-section.study-fullscreen .study-reveal { height: 28px; }
  #detail .study-section.study-fullscreen .study-help { display: none; }
}
@media (prefers-reduced-motion: reduce) { #detail .study-view * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* The standalone moving-image work uses the same mat and content rectangle as paintings. */
#detail .study-stage > .wall-motion-film { position:absolute; top:0; left:0; overflow:hidden; opacity:0; z-index:1; pointer-events:none; }
#detail .study-stage > .wall-motion-film.on { opacity:1; }
#detail .study-stage > .wall-motion-decoder { position:absolute; width:1px; height:1px; top:0; left:0; opacity:0; clip-path:inset(50%); pointer-events:none; }
#detail .detail-film-status { color:#595b52; font:12px/1.5 var(--sans,Arial,sans-serif); }
#detail .detail-film-status:empty { display:none; }

/* One pencil note shared by all painting details; no second button or tab stop. */
#detail .study-brush-pair { display: inline-flex; align-items: center; flex: none; gap: 5px; }
#detail .study-brush-pair:has(.study-inspect[hidden]) { display: none; }
#detail .study-explore-note { display: inline-block; width: 78px; height: 30px; flex: none; overflow: hidden; font-size: 0; pointer-events: none; user-select: none; background: center / contain no-repeat url('/brand/explore-note.svg'); }
#detail .study-brush-pair:has(.study-inspect[aria-pressed="true"]) .study-explore-note { visibility: hidden; }
#detail .study-toolbar .study-inspect[aria-pressed="false"] { border: 1px dashed #b19376; border-radius: 8px; background: #fffaf340; }
#detail .study-toolbar .study-inspect[aria-pressed="false"]:hover { border-color: #87694e; background: #fffbf4; }
#detail .study-toolbar .study-inspect:focus-visible { outline: 2px solid #79614d; outline-offset: 2px; }
@media (max-width: 650px) { #detail .study-explore-note { width: 65px; height: 26px; } #detail .study-brush-pair { gap: 3px; } }
@media (max-width: 370px) { #detail .study-explore-note { width: 58px; height: 25px; } }
