/* Current record shell: one caption column, one content column. */
.detail-screen .site-header,.detail-screen .footer,.detail-screen .preview-note,.detail-screen .profile-note{display:none}
.detail-close,.is-preview .preview-actions .preview-close{position:fixed;right:var(--margin);top:12px;width:44px;height:44px;min-height:44px;display:flex;align-items:center;justify-content:center;padding:0;font-size:0;line-height:1;z-index:10;background:none;color:var(--ink)}
.detail-close::before,.detail-close::after{content:"";position:absolute;width:34px;height:1px;background:currentColor;pointer-events:none;transform:rotate(45deg)}
.detail-close::after{transform:rotate(-45deg)}
.preview-close::after{content:"";position:absolute;inset:0;margin:auto;width:14px;height:14px;border-top:1px solid currentColor;border-right:1px solid currentColor;transform:rotate(45deg);pointer-events:none}
.detail-close:hover{text-decoration:none}
.current-design .record-detail{--preview-side:clamp(24px,2.5vw,48px);padding-top:72px;padding-bottom:48px;font-family:Neue,NotoKRDetail,NotoKR,Arial,sans-serif}
.record-layout{display:flex;flex-direction:column;gap:24px;min-width:0}
.record-left,.record-reading,.record-caption{display:contents}
.record-connections{order:3;min-width:0}
.current-design .record-heading{order:0;min-width:0;margin:0;padding:0}
.current-design .record-heading h1{font-size:var(--text-information);line-height:var(--leading-information);letter-spacing:var(--tracking-information,.02em);font-weight:400;max-width:none;margin:0;overflow-wrap:anywhere;word-break:keep-all}
.current-design .record-year,.current-design .record-author,.current-design .caption-facts p,.current-design .record-information .metadata dd{font-size:var(--text-information);line-height:var(--leading-information);letter-spacing:var(--tracking-information,.02em);font-weight:400;color:var(--muted);margin:0}
.record-information{order:2;min-width:0;overflow-wrap:anywhere}
.record-information .record-facts{margin:0}
.current-design .record-information .metadata{display:block;margin:0}
.current-design .record-information .metadata>div{display:block;margin:0}
.record-information .metadata dt{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.current-design .record-detail .related-section{margin:32px 0 0;padding:0}
.current-design .record-detail .related-section .section-heading{margin:0 0 8px}
.current-design .record-detail .related-section :is(h2,h3){font-size:var(--text-caption);line-height:1.125rem;font-weight:400;color:var(--muted);margin:0}
.current-design .record-detail .related-section .related-group-title{margin:0 0 10px}
.related-group+.related-group{margin-top:28px}
.related-count{font-variant-numeric:proportional-nums}
.record-detail .related-section .section-heading+.related-group-title{margin-top:0}
.record-detail .related-list{list-style:none;padding:0;margin:0;display:grid;gap:12px}
.current-design .record-detail .related-entry{display:block;padding:0;min-height:0;text-decoration:none}
.record-detail .related-title{display:block;font-size:0.875rem;line-height:1.5;font-weight:400;color:var(--ink)}
.record-detail :is(.related-meta,.relation-location,.related-sample){display:block;font-size:var(--text-caption);line-height:1.125rem;color:var(--muted);margin:0}
.record-detail a.related-entry:is(:hover,:focus-visible) .related-title{text-decoration:underline;text-underline-offset:3px}
.record-detail .related-entry[aria-current="true"] .related-title{text-decoration:underline;text-underline-offset:3px}
.related-excerpts{display:flex;flex-wrap:wrap;gap:4px 16px}
.related-excerpt-link{display:inline-flex;align-items:center;font-size:var(--text-caption);line-height:1.125rem;min-height:24px;color:var(--muted)}
.related-excerpt-link[aria-current="true"]{color:var(--ink);text-decoration:underline;text-underline-offset:3px}
.related-excerpt-link:focus-visible{outline:1px solid var(--muted);outline-offset:3px}
@media(pointer:coarse){.related-excerpt-link{min-height:44px}}
.record-detail .related-entry:focus-visible,.preview-actions :focus-visible,.record-back:focus-visible{outline:1px solid var(--muted);outline-offset:3px}
.record-back{position:fixed;left:var(--margin);top:12px;min-height:44px;display:flex;align-items:center;z-index:10;background:var(--paper);font-size:var(--text-caption);color:var(--muted)}
.preview-heading{flex-shrink:0;margin:0 0 24px;min-width:0}
.preview-caption{display:flex;align-items:baseline;gap:12px;min-width:0}
.preview-type{flex-shrink:0;font-size:var(--text-caption);line-height:1.125rem;color:var(--muted)}
.current-design .preview-heading h2{font-size:var(--text-information);line-height:var(--leading-information);font-weight:400;letter-spacing:var(--tracking-information,.02em);margin:0;overflow-wrap:anywhere}
.preview-actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px 24px;margin-top:8px;font-size:var(--text-caption);line-height:1.125rem;color:var(--muted)}
.preview-actions :is(a,button){display:inline-flex;align-items:center;font:inherit;color:inherit;padding:0;min-height:28px;background:none;border:0}
.preview-actions :is(a,button):hover{text-decoration:underline;text-underline-offset:3px}
.preview-summary{overflow:auto;min-height:0;font-size:0.875rem;line-height:1.5;overflow-wrap:anywhere}
.preview-summary p{margin:0 0 8px}
.preview-contained{margin-top:32px}
.current-design .preview-contained h3{font-size:var(--text-caption);line-height:1.125rem;font-weight:400;color:var(--muted);margin:0 0 8px}
.preview-unavailable{font-size:0.875rem;line-height:1.5;color:var(--muted)}
.detail-sequence{order:4;display:flex;justify-content:flex-start;flex-wrap:nowrap;gap:24px;align-items:flex-end;margin:0;padding:16px 0 0}
.detail-sequence [data-sequence]{display:flex;min-height:44px;align-items:center;font-size:0.875rem;line-height:1.5;color:var(--muted)}
.detail-sequence [aria-disabled='true']{color:#b3b3b3;cursor:default}
.record-detail .record-content{order:1;position:static;height:auto;max-height:none;min-width:0;min-height:0;display:flex;flex-direction:column;padding:0;overflow:visible}
.record-content .primary-content{min-height:0;min-width:0;display:flex;flex-direction:column;flex:1}
.record-content .viewer-toolbar{flex-shrink:0;padding:0;margin:0 0 12px;justify-content:flex-end;font-size:var(--text-caption);color:var(--muted)}
.record-content .reading-toolbar{width:100%;max-width:52ch;box-sizing:border-box;min-height:18px;margin:0 0 2px;display:flex;justify-content:space-between;align-items:center;gap:16px;font-size:var(--text-reading)}
.reading-toolbar :is(span,button){font-size:var(--text-caption);line-height:1.125rem;font-weight:400;color:var(--muted)}
.record-content .reading-toolbar-actions-only{justify-content:flex-end}
.reading-toolbar button{min-height:28px;padding:0;background:none;border:0}
.record-content .work-visual{position:relative;display:flex;flex:1;min-height:0;height:100%;margin:0;padding:32px 0 24px}
.record-content .work-visual>.image-button{width:100%;height:70svh;max-height:70svh;display:flex;align-items:center;justify-content:center;cursor:default}
.record-content .work-visual>.image-button img{width:100%;height:100%;max-height:100%;object-fit:contain;object-position:center}
.work-view-controls{display:flex;flex-wrap:wrap;align-content:start;gap:0;min-height:32px;flex-shrink:0}
.work-photo-index button{font:inherit;font-size:var(--text-caption);line-height:1.125rem;min-width:28px;min-height:32px;padding:0 8px 0 0;font-weight:400;color:var(--muted);font-variant-numeric:proportional-nums;background:transparent;border:0}
.work-photo-index button[aria-pressed='true']{color:var(--ink);text-decoration:underline;text-underline-offset:3px}
.work-view-controls :focus-visible{outline:1px solid var(--muted);outline-offset:-1px}
.work-photo-note{position:absolute;bottom:0;left:0;right:0;margin:0;font-size:var(--text-caption);line-height:1.125rem;color:var(--muted)}
.work-image-unavailable{display:flex;align-items:flex-end;width:100%;height:100%;font-size:var(--text-caption);color:var(--muted)}
.record-content .source-preview{display:flex;align-items:center;justify-content:center;min-height:0;background:none;padding:0;overflow:hidden}
.record-content .source-page{display:flex;align-items:center;justify-content:center;margin:0;width:100%;height:100%;min-height:0}
.record-content .source-image{display:flex;justify-content:center;align-items:center;width:100%;height:70svh;max-height:70svh;padding:0;min-height:0}
.record-content .source-image img{display:block;width:100%;height:100%;max-height:100%;object-fit:contain}
.record-content .source-pagination{flex-shrink:0;margin:8px 0 0;min-width:0}
.source-linked-pages{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:0 4px;max-height:120px;overflow:auto;font-size:var(--text-caption);line-height:1.125rem;color:var(--muted)}
.source-linked-pages>span{margin-right:8px}
.source-linked-pages button{font:inherit;font-weight:400;font-variant-numeric:proportional-nums;color:inherit;background:none;border:0;min-width:32px;min-height:32px;padding:4px 8px}
.source-linked-pages button[aria-pressed="true"]{color:var(--ink);text-decoration:underline;text-underline-offset:3px}
.source-linked-pages button:hover{text-decoration:underline;text-underline-offset:3px}
.source-linked-pages button:focus-visible{outline:1px solid var(--muted);outline-offset:-2px}
@media(pointer:coarse){.source-linked-pages button{min-width:44px;min-height:44px}}
.record-content .source-thumbnails{display:none}
.record-content .source-controls{display:flex;justify-content:center;align-items:center;gap:16px;margin:0;font-size:var(--text-caption);line-height:1.125rem}
.record-content .source-controls button{min-width:44px;min-height:36px}
.record-content .source-caption{flex-shrink:0;font-size:var(--text-caption);line-height:1.125rem;color:var(--muted);text-align:center;margin:0}
.current-design .record-content .reader-scroll{overflow:visible;height:auto;max-height:none;padding:0;min-width:0}
.current-design .reading-body{width:100%;max-width:52ch;margin:0 auto;padding:0;font-size:var(--text-reading);font-weight:400;line-height:1.65;overflow-wrap:anywhere}
.current-design .record-content .reading-body{margin-inline:0}
.current-design .reading-body p{font-size:var(--text-reading);line-height:1.65;font-weight:400;letter-spacing:0;margin:0 0 1.65em;white-space:normal;text-wrap:pretty;widows:2;orphans:2}
.current-design .reading-body:lang(ko) p{word-break:keep-all}
.current-design .reading-body p.source-lines{white-space:pre-line}
.current-design .reading-body p.small{font-size:var(--text-caption);line-height:1.125rem;color:var(--muted)}
.record-caption:focus-visible,.record-connections:focus-visible,.reader-scroll:focus-visible{outline:1px solid var(--muted);outline-offset:-1px}
@media(min-width:1200px) and (min-height:640px){
 .detail-screen #app{height:100dvh;min-height:0;overflow:hidden;display:flex;flex-direction:column}
 .current-design .record-detail{flex:1;min-height:0;padding-top:72px;padding-bottom:64px;display:flex;flex-direction:column}
 .record-layout{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));grid-template-rows:minmax(0,1fr);gap:0 24px;flex:1;min-height:0;align-items:stretch}
 .record-left{grid-column:1/5;grid-row:1;display:flex;flex-direction:column;min-width:0;min-height:0;height:100%}
 /* Same viewport height = same start for every record type.
    Page top 72px + caption 144–224px + gap 24px:
    related records start at 240px / 280px / 320px for 640px / 720px / 800px+.
    Overflow stays within each region; bottom navigation does not move. */
 .record-reading{--caption-height:clamp(144px,calc(50dvh - 176px),224px);display:grid;grid-template-rows:var(--caption-height) minmax(0,1fr);row-gap:24px;flex:1;min-height:0;overflow:visible}
 .record-caption,.record-connections{display:block;min-width:0;min-height:0;overflow:auto;scrollbar-gutter:stable;padding:2px 12px 16px 2px;overscroll-behavior:contain}
 .record-caption,.record-connections{width:calc(100% - 88px)}
 /* Shared desktop scroll treatment, including origin and preview readers. */
 .record-detail :is(.record-caption,.record-connections,.reader-scroll,.preview-summary,.work-view-controls,.work-photo-note,.source-page-index,.source-linked-pages)::-webkit-scrollbar{width:3px;height:3px}
 .record-detail :is(.record-caption,.record-connections,.reader-scroll,.preview-summary,.work-view-controls,.work-photo-note,.source-page-index,.source-linked-pages)::-webkit-scrollbar-track{background:transparent}
 .record-detail :is(.record-caption,.record-connections,.reader-scroll,.preview-summary,.work-view-controls,.work-photo-note,.source-page-index,.source-linked-pages)::-webkit-scrollbar-thumb{background:#ccc;border-radius:2px}
 .record-detail :is(.record-caption,.record-connections,.reader-scroll,.preview-summary,.work-view-controls,.work-photo-note,.source-page-index,.source-linked-pages):is(:hover,:focus-within)::-webkit-scrollbar-thumb{background:#aaa}
 @supports not selector(::-webkit-scrollbar){
  .record-detail :is(.record-caption,.record-connections,.reader-scroll,.preview-summary,.work-view-controls,.work-photo-note,.source-page-index,.source-linked-pages){scrollbar-width:thin;scrollbar-color:#ccc transparent}
  .record-detail :is(.record-caption,.record-connections,.reader-scroll,.preview-summary,.work-view-controls,.work-photo-note,.source-page-index,.source-linked-pages):is(:hover,:focus-within){scrollbar-color:#aaa transparent}
 }
 .record-caption{grid-row:1}
 .record-connections{grid-row:2;padding-top:0}
 .current-design .record-detail .related-section{margin-top:0}
 .detail-sequence{flex:0 0 64px;box-sizing:border-box;padding-top:12px;align-items:flex-end}
 .record-detail .record-content{grid-column:5/-1;grid-row:1;height:100%;overflow:hidden}
 .record-content .work-visual{display:grid;grid-template-rows:minmax(0,1fr) minmax(32px,max-content);padding:0}
 .work-view-controls{grid-row:2;min-height:0;max-height:96px;overflow:auto}
 .record-content .work-visual>.image-button{grid-row:1;height:100%;max-height:none;min-height:0;flex:1}
 .work-photo-note{position:static;grid-row:3;overflow:auto}
 .record-content .work-visual>.image-button img{width:calc(100% * var(--work-scale,.8));height:calc(100% * var(--work-scale,.8))}
 .record-content .source-preview{flex:1}
 .record-content .source-image{height:100%;max-height:100%}
 .current-design .record-content .reader-scroll{flex:1;height:100%;overflow:auto;scrollbar-gutter:stable;padding:0 16px 12px 0;overscroll-behavior:contain}
 /* The preview panel begins beside the four-column information rail and has a 1px edge.
    Match the full text reader to its content line without moving the artwork plate. */
 .record-content:not(.is-preview)[data-viewer-type="text"] .reader-scroll{padding-left:calc(var(--preview-side) - 11px)}
 /* Keep the origin column stable when a scanless record opens/closes a preview. */
}
@media(max-width:700px){.current-design .record-detail{padding-top:64px}.detail-close,.is-preview .preview-actions .preview-close{top:8px}}
@media(pointer:coarse){.work-photo-index button{min-width:36px;min-height:44px}.record-detail .related-entry{min-height:44px}}
@media(max-width:1199px),(max-height:639px){
 .current-design .record-detail .related-section{margin-top:8px}
 /* Photo controls follow the plate in the same reading order at every width. */
 .record-content .work-visual{flex-direction:column;height:auto;padding:0}
 .work-view-controls,.work-photo-note{position:static}
 .work-view-controls{margin-top:8px}
 .record-content .reading-toolbar{padding-right:0;margin-bottom:2px}
 .reading-toolbar [data-fullscreen="text"]{display:none}
 .record-content .reading-toolbar-actions-only{display:none}
}

/* A source's scan position and printed folio form one quiet footer. */
.source-pagination+.source-caption{margin:0;text-align:center;flex-shrink:0}
.source-controls>span{font-variant-numeric:proportional-nums;white-space:nowrap}

/* Fullscreen reading reuses the same text measure and rhythm as inline reading. */
.current-design .reading-body blockquote{margin:0 0 1.5rem;padding:0;border:0;font:inherit;line-height:1.65;white-space:pre-line;overflow-wrap:anywhere}
.current-design .reading-body>:last-child{margin-bottom:0}

/* Independent related-record panel; origin remains interactive on the left. */
:root{--preview-paper:#f5f3ed;--preview-edge:#e3dfd5}
.record-detail .record-content.is-preview{position:relative;inset:auto;isolation:isolate;background:var(--preview-paper);border-left:1px solid var(--preview-edge);padding:20px;overflow:visible}
.detail-screen:has(.record-content.is-preview) .detail-close{display:none}
.is-preview .preview-heading{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto;align-items:start;row-gap:8px;margin:0;padding:0 0 24px}
.is-preview .preview-caption{display:block;min-width:0}
.is-preview .preview-type{display:block;margin:0 0 4px}
.is-preview .preview-actions{display:contents}
.is-preview .preview-actions [data-related-full]{grid-column:1;grid-row:2;justify-self:start;white-space:nowrap}
.is-preview .preview-actions [data-related-full]:is(:hover,:focus-visible){text-decoration:underline;text-underline-offset:3px}
.is-preview .preview-actions .preview-close:hover{text-decoration:none}
.is-preview .reading-toolbar{max-width:none;margin:0 0 8px;padding:0}
.is-preview .reading-body{margin-inline:0}
.is-preview .primary-content{min-width:0;min-height:0}
.source-pagination .source-page-index{display:flex;flex-wrap:wrap;justify-content:flex-start;align-content:start;gap:0;margin:0;max-height:96px;overflow:auto;min-height:0}
.media-page-index button,.record-content .media-page-index button{font:inherit;font-size:var(--text-caption);line-height:1.125rem;min-width:28px;min-height:32px;padding:0 8px 0 0;font-weight:400;color:var(--muted);font-variant-numeric:proportional-nums;background:none;border:0}
.media-page-index button[aria-pressed='true']{color:var(--ink);text-decoration:underline;text-underline-offset:3px}
.media-page-index button:focus-visible{outline:1px solid var(--muted);outline-offset:-1px}
@media(min-width:1200px) and (min-height:640px){
 .record-detail .record-content.is-preview{
  position:fixed;--preview-left:calc((100vw - min(100vw,var(--page-max))) / 2 + (min(100vw,var(--page-max)) + var(--margin)) / 3 - 4px);inset:0 auto 0 var(--preview-left);
  width:calc(100vw - var(--preview-left));height:100dvh;max-height:none;z-index:5;padding:72px var(--preview-side) 64px;
  display:grid;grid-template-columns:repeat(8,minmax(0,1fr));grid-template-rows:auto minmax(0,1fr);column-gap:24px;row-gap:0;align-self:auto;overflow:visible
 }
 .is-preview .preview-actions .preview-close{position:absolute;left:-58px;right:auto;top:50%;transform:translateY(-50%);width:48px;min-width:48px;height:48px;min-height:48px;padding:0;background:var(--paper);font-size:0;line-height:1;cursor:pointer}
 .is-preview .preview-heading{grid-column:1/-1;grid-row:1;row-gap:6px}
 .is-preview .preview-actions [data-related-full]{min-height:20px}
 .is-preview .primary-content{grid-column:1/-1;grid-row:2;overflow:hidden}
 .is-preview .source-pagination{margin-top:16px}
 .is-preview .work-view-controls{padding-top:0}
}
@media(max-width:700px){
 .is-preview .preview-heading{grid-template-columns:minmax(0,1fr);gap:8px 12px;padding-bottom:20px}
 .is-preview .preview-actions [data-related-full]{grid-column:1;grid-row:2;justify-self:start}
}
@media(pointer:coarse){.media-page-index button,.record-content .media-page-index button{min-width:36px;min-height:44px}}

/* Enter once on explicit opening; replacing a related record stays still. */
@keyframes preview-slide-in{from{left:100vw}to{left:var(--preview-left)}}
@keyframes preview-slide-out{from{left:var(--preview-left)}to{left:100vw}}
@media(min-width:1200px) and (min-height:640px) and (prefers-reduced-motion:no-preference){
 .record-content.is-preview.preview-entering{animation:preview-slide-in 260ms cubic-bezier(.22,.61,.36,1)}
 .record-content.is-preview.preview-leaving{animation:preview-slide-out 260ms cubic-bezier(.64,0,.78,.39) forwards;pointer-events:none}
}

/* Keep the origin plate mounted underneath the independent preview layer. */
.record-content.preview-origin{pointer-events:none}
@media(max-width:1199px),(max-height:639px){.record-content.preview-origin{display:none}}

/* Position-only motion: fixed panel width, no transform on the underlying plate. */
@media(min-width:1200px) and (min-height:640px){
 .detail-screen{overflow:hidden}
 .record-detail .record-content.is-preview.preview-preparing{left:100vw}
 .is-preview .preview-actions .preview-close{position:absolute}
}
@media(prefers-reduced-motion:reduce){.record-detail .record-content.is-preview.preview-preparing{left:var(--preview-left)}}

/* Retain the departed state across asynchronous history restoration. */
.record-detail .record-content.is-preview.preview-exited{visibility:hidden;pointer-events:none;left:100vw}

/* Related records share one type size; tone and spacing carry hierarchy. */
.current-design .record-detail :is(.related-title,.related-meta,.relation-location,.related-sample,.related-group-title,.related-count,.related-excerpt-link,.preview-contained h3){font-size:var(--text-information);line-height:var(--leading-information);font-weight:400}
.record-detail .related-title{overflow-wrap:anywhere;word-break:keep-all}

/* All record captions and preview titles share the 13px scale; reading bodies stay 16px. */

.current-design .preview-heading h2{word-break:keep-all}

/* One bottom rail for record navigation and media selection. Captions sit above it. */
@media(min-width:1200px) and (min-height:640px){
 .record-detail{--detail-rail-height:44px;--detail-caption-height:20px}
 .detail-sequence [data-sequence]{height:var(--detail-rail-height);line-height:1.25rem}
 .record-content .work-visual{grid-template-rows:minmax(0,1fr) var(--detail-rail-height)}
 .record-content .work-view-controls{grid-row:2;height:var(--detail-rail-height);min-height:0;max-height:none;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;align-items:center}
 .record-content .work-photo-note{grid-row:2;position:static;max-height:var(--detail-caption-height);margin:0}
 .record-content[data-viewer-type="source"]>.primary-content{display:grid;grid-template-rows:minmax(0,1fr) var(--detail-caption-height) var(--detail-rail-height);row-gap:0}
 .record-content[data-viewer-type="source"]>.primary-content>.source-preview{grid-row:1;height:100%;min-height:0}
 .record-content[data-viewer-type="source"]>.primary-content>.source-pagination{grid-row:3;position:relative;margin:0;height:var(--detail-rail-height);min-height:0}
 .record-content[data-viewer-type="source"]>.primary-content>.source-caption{grid-row:2;margin:0;max-height:var(--detail-caption-height);overflow:auto}
 .source-pagination .source-linked-pages{position:absolute;bottom:var(--detail-rail-height);left:0;right:0;background:var(--paper)}
 .record-content .media-page-index{height:var(--detail-rail-height);max-height:none;min-height:0;display:flex;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;align-items:center;justify-content:flex-start}
 .record-content .media-page-index button{flex-shrink:0;height:var(--detail-rail-height);min-height:var(--detail-rail-height);line-height:1.25rem}
}
