/* Important layer outranks old page-specific important rules without ID overrides. */
@layer nasabu-heading-hierarchy {
 :root{--reading-body-size:18px;--heading-major:clamp(30px,4vw,40px);--heading-middle:clamp(26px,3vw,32px);--heading-minor:22px;--heading-gold:#FFD76A;--heading-weight:800}
 html body main :is(h1,h2,h3,h4,h5):not(:where(.approved-chart *, .chart-zoom-dialog *, button *, [role="button"] *)){
  min-width:0!important;max-width:100%!important;box-sizing:border-box!important;height:auto!important;white-space:normal!important;word-break:keep-all!important;overflow-wrap:break-word!important;line-height:1.45!important;font-weight:var(--heading-weight)!important;letter-spacing:normal!important;
 }
 html body main h1:not(:where(.approved-chart *)){font-size:var(--heading-major)!important;margin-block:0 16px!important}
 html body main h2:not(:where(.approved-chart *)){font-size:var(--heading-middle)!important;margin-block:18px 12px!important}
 html body main :is(h3,h4,h5):not(:where(.approved-chart *, .chart-zoom-dialog *, button *, [role="button"] *)){
  font-size:var(--heading-minor)!important;color:var(--heading-gold)!important;-webkit-text-fill-color:var(--heading-gold)!important;margin-block:20px 10px!important;padding:0 0 0 10px!important;border-left:3px solid var(--heading-gold)!important;
 }
 html body main .organ-illness-title{font-size:var(--heading-middle)!important;margin-block:12px!important}
 /* The same gold remains readable on the information pages' ivory background. */
 html body:not(.premium-dark) main :is(h3,h4,h5):not(:where(.approved-chart *, .chart-zoom-dialog *, button *, [role="button"] *)){
  background:#173240!important;border-radius:0 6px 6px 0!important;padding:8px 10px!important;
 }
 @media(max-width:760px){html body main :is(h3,h4,h5):not(:where(.approved-chart *, .chart-zoom-dialog *, button *, [role="button"] *)){margin-block:18px 8px!important}}
}

/* Shared footer layout, including pages that do not load site-info.css. */
body footer.site-footer.wrap {
 width:min(1180px,calc(100% - 32px))!important;
 max-width:calc(100% - 32px)!important;
 min-width:0!important;
 margin-inline:auto!important;
 padding:20px 0!important;
 box-sizing:border-box;
 display:grid!important;
 grid-template-columns:minmax(0,2fr) minmax(0,1fr)!important;
 gap:16px 28px!important;
 color:inherit;
 text-align:left;
}
body footer.site-footer.wrap * {box-sizing:border-box;min-width:0;max-width:100%;}
body footer.site-footer.wrap :is(p,li,dt,dd,a,summary) {overflow-wrap:anywhere;word-break:keep-all;}
body footer.site-footer.wrap p {margin:0 0 8px;line-height:1.65;}
body footer.site-footer.wrap .brand {display:inline-flex;white-space:normal;color:inherit;}
body footer.site-footer.wrap a {color:inherit;text-underline-offset:3px;}
body footer.site-footer.wrap .footer-operations {margin:0;padding:0;}
body footer.site-footer.wrap .footer-operations > div {
 display:grid;grid-template-columns:4.5em minmax(0,1fr);gap:10px;margin-bottom:8px;
}
body footer.site-footer.wrap .footer-operations dt {font-weight:700;}
body footer.site-footer.wrap .footer-operations dd {margin:0!important;}
body footer.site-footer.wrap .footer-menu {
 grid-column:1/-1;display:flex;flex-wrap:wrap;justify-content:flex-start;
 gap:4px 18px;width:100%;margin:0;padding:8px 0;
 border-block:1px solid #9b895a66;
}
body footer.site-footer.wrap .footer-menu a {display:inline-flex;align-items:center;min-height:44px;}
body footer.site-footer.wrap :is(.footer-content-notice,.copyright) {grid-column:1/-1;}
body footer.site-footer.wrap .footer-content-notice h2 {font-size:17px;margin:0 0 8px;line-height:1.5;}
body footer.site-footer.wrap ul {padding-inline-start:20px;margin:0;}
body footer.site-footer.wrap .copyright {margin:0;}
@media(max-width:760px) {
 body footer.site-footer.wrap {grid-template-columns:minmax(0,1fr)!important;gap:12px!important;padding-block:16px!important;}
 body footer.site-footer.wrap .footer-menu {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 12px;}
 body footer.site-footer.wrap .footer-menu a {width:100%;}
}

/* Original art is never cropped or covered. The two existing painted entry areas are interactive. */
.official-gateway{margin:0;min-height:0;background:radial-gradient(ellipse at top,#754820,#3e2818);color:#ffe7a6;font-family:system-ui,sans-serif}.official-gate{width:min(100%,600px);margin:auto}.gate-site-name{font-size:17px;line-height:1.4;text-align:center;margin:0;padding:8px;color:#fbe3b0;letter-spacing:.15em}.gate-art{position:relative}.gate-art>img{display:block;width:100%;height:auto}.gate-links{position:absolute;inset:0;pointer-events:none}.gate-enter{position:absolute;top:52.6%;height:9.2%;width:47.5%;border-radius:10px;pointer-events:auto;box-sizing:border-box;outline-offset:3px;min-height:44px}.gate-palace{left:1.4%}.gate-school{right:1.4%}.gate-enter span{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.gate-enter:focus-visible{outline:4px solid #fff;box-shadow:0 0 0 8px #062d38}.gate-enter:hover{box-shadow:inset 0 0 0 3px #fff8}.official-home-label{display:block;font-size:12px;line-height:1.3;color:inherit}
body:has(.palace-catalog){background:radial-gradient(ellipse at top,#4b291a,#161514 75%)!important}.palace-page-title{text-align:center!important;font-size:clamp(30px,4vw,42px)!important;color:#f1d49a!important;line-height:1.3!important;margin:10px 0!important}.palace-catalog{color:#f8eedc;background:linear-gradient(130deg,#40281e,#1d292b);border:1px solid #ba985b;border-radius:14px;padding:20px;margin:12px 0}.palace-catalog :is(h2,h3,p,a,summary,dt,dd){color:inherit!important;-webkit-text-fill-color:currentColor!important}.palace-catalog h2{font-size:30px!important;line-height:1.4;margin:5px 0}.palace-catalog p{font-size:17px!important;line-height:1.6;margin:8px 0}.palace-catalog .space-eyebrow{color:#efc984!important;font-size:16px!important}.palace-catalog .palace-lead{font-size:21px!important;font-weight:750}.palace-catalog .palace-promise{font-size:19px!important;color:#f3d496!important}.palace-products{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:18px 0}.palace-product{min-width:0;border:1px solid #c4a15f;border-radius:10px;background:#2b2320;align-self:start;overflow-wrap:anywhere}.palace-product summary{cursor:pointer;list-style:none;display:grid;grid-template-columns:1fr auto;gap:6px;align-items:center;padding:15px 12px;min-height:78px;box-sizing:border-box}.palace-product summary::-webkit-details-marker{display:none}.palace-product summary span{font-size:20px!important;font-weight:800}.palace-product summary small{grid-row:2;font-size:15px!important;color:#eddbb9!important}.palace-product summary b{grid-column:2;grid-row:1/3;font-size:22px}.palace-product[open]{grid-column:1/-1}.palace-product[open] summary{border-bottom:1px solid #977643;background:#64432b}.palace-product[open] summary b{transform:rotate(45deg)}.product-content{padding:16px}.product-content h3{font-size:20px!important;margin:12px 0 6px}.product-content dl{margin:8px 0}.product-content dl>div{display:grid;grid-template-columns:150px 1fr;gap:10px;padding:8px;border-bottom:1px solid #ffffff25}.product-content dt{font-weight:700}.product-content dd{margin:0}.product-content :is(a,button){font-size:17px!important;min-height:44px;display:inline-flex;align-items:center;padding:9px 12px;border-radius:8px;box-sizing:border-box;white-space:normal}.product-content a{color:#f9e4ae!important;text-decoration:underline;outline-offset:3px}.product-actions{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}.product-actions a{background:#d9ba7c;color:#102735!important;font-weight:700}.product-actions button:disabled{background:#3d4342;color:#d9e0db!important;border:1px solid #9fa8a1;opacity:1}.palace-legacy{margin:16px 0;border:1px solid #b99c65;border-radius:10px}.palace-legacy>summary{padding:14px;color:#f9e3b3;font-size:18px;cursor:pointer;min-height:44px}.palace-legacy>.saju-room,.palace-legacy>.saju-guide{margin:12px!important}.space-note{font-size:16px!important;line-height:1.6!important}.seowon-welcome{display:grid!important;grid-template-columns:1fr 155px;gap:20px;align-items:center;padding:24px!important;border:1px solid #aa9973;background:linear-gradient(135deg,#21473b,#142b29)!important;border-radius:12px;margin:14px auto!important}.seowon-welcome h1{font-size:clamp(28px,4vw,40px)!important;line-height:1.4!important;color:#f9ecd2!important}.seowon-welcome p{font-size:18px!important;line-height:1.6;color:#f2e6ce!important}.seowon-welcome img{width:100%;height:215px;object-fit:cover;object-position:top;border:1px solid #b69f76;border-radius:8px}.seowon-site{background:radial-gradient(ellipse at top,#253c31,#141e1d 75%)!important}.seowon-entrances>a{background:#25463d!important;grid-template-columns:1fr!important;padding:16px!important;min-height:80px!important;color:#f8efd9!important}.seowon-entrances .entrance-copy>span{font-size:16px!important;color:#eee5d1!important}.seowon-entrances .entrance-label{font-size:22px!important;color:#f4d99b!important}.seowon-site main .seowon-entrances{grid-template-columns:repeat(3,minmax(0,1fr))!important}.seowon-site .brand-header{border-color:#b2a078!important}.seowon-site .home-entrances{scroll-margin-top:80px}summary:focus-visible,.product-content a:focus-visible{outline:3px solid #ffe4a6}
@media(max-width:760px){.palace-products{grid-template-columns:repeat(2,minmax(0,1fr))}.palace-catalog{padding:14px}.palace-catalog h2{font-size:26px!important}.palace-product summary{padding:12px 10px;min-height:85px}.palace-product summary span{font-size:19px!important}.seowon-welcome{grid-template-columns:1fr 105px;padding:16px!important;gap:12px}.seowon-welcome img{height:170px}.seowon-site main .seowon-entrances{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(max-width:480px){.product-content dl>div{grid-template-columns:1fr;gap:3px}.product-content{padding:12px}.product-actions a,.product-actions button{width:100%}.palace-catalog .palace-lead{font-size:19px!important}.palace-product summary span{font-size:18px!important}.seowon-welcome h1{font-size:27px!important}.seowon-welcome{grid-template-columns:1fr 88px}.seowon-welcome p{font-size:17px!important}.seowon-entrances>a{padding:12px!important}.seowon-entrances .entrance-label{font-size:20px!important}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto!important}}
/* Public QA: keep new space themes above retained legacy !important rules. */
body.premium-dark .palace-catalog .palace-product{background:linear-gradient(145deg,#3d2b20,#211d18)!important;border:1px solid #bd9a5d!important;margin:0!important;border-radius:10px!important}
body.premium-dark .palace-catalog .palace-product summary{display:grid!important;grid-template-columns:1fr auto!important;gap:6px!important;padding:15px 12px!important;min-height:85px!important;color:#f7e5bb!important;background:transparent!important}
body.premium-dark .palace-catalog .palace-product summary::before,body.premium-dark .palace-catalog .palace-product summary::after{content:none!important;display:none!important}
body.premium-dark .palace-catalog .palace-product summary span{font-size:20px!important;line-height:1.4!important;color:#f7e5bb!important}
body.premium-dark .palace-catalog .palace-product[open] summary{background:#63432c!important}
body.premium-dark.seowon-site{background:radial-gradient(ellipse at top,#34473c,#131e1c 75%)!important}
body.premium-dark.seowon-site main .seowon-entrances>a{background:linear-gradient(135deg,#2e4b3f,#1a342e)!important;border-color:#b3a17b!important;grid-template-columns:1fr!important}
body.premium-dark.seowon-site .brand-header{background:#1c332c!important;border-bottom:1px solid #b3a17b!important}
body.premium-dark.seowon-site .seowon-welcome{border-top:5px double #b3a17b!important;box-shadow:inset 0 0 0 5px #ead9aa08}
@media(max-width:480px){body.premium-dark .palace-catalog .palace-product summary{padding:12px 10px!important}body.premium-dark .palace-catalog .palace-product summary span{font-size:18px!important}}

/* Confined to the existing floor diagram; upper portrait, signs and two entry regions untouched. */
.official-gateway .gate-diagram{position:absolute;left:0;top:64.3229167%;width:100%;height:30.5989583%;padding:0;margin:0;border:0;border-radius:0;background:transparent;cursor:zoom-in;z-index:1;clip-path:ellipse(47.66% 47.87% at 50% 48.72%)}
.gate-diagram img{display:block;width:100%;height:100%;pointer-events:none}
.gate-diagram:focus-visible{outline:4px solid #fff4ac;outline-offset:-5px}
.official-gateway .gate-links{z-index:2}
#gate-diagram-dialog{padding:16px;width:min(1000px,calc(100vw - 32px));max-height:calc(100svh - 28px);box-sizing:border-box;overflow:auto;background:#2b2017;color:#fff0ce;border:2px solid #d9b674;border-radius:12px;font-family:system-ui,sans-serif}
#gate-diagram-dialog::backdrop{background:#000b}.gate-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.gate-dialog-head h2{font-size:22px;margin:0 0 10px}.gate-dialog-head button{font-size:18px;min-width:64px;min-height:44px;background:#efd297;color:#172a32;border:0;border-radius:8px;padding:8px 12px;cursor:pointer}.gate-diagram-scroll{overflow:auto;overscroll-behavior:contain}.gate-diagram-scroll img{display:block;width:100%;height:auto;min-width:620px}#gate-diagram-dialog p{font-size:18px;line-height:1.6;margin:9px 0}.gate-zoom-note{color:#e2cdaa}

/* Academy gallery only: preserve original assets and other page layouts. */
body.seowon-site #home-artworks .artwork-catalog {
 display:block; width:100%; max-width:100%; min-width:0; box-sizing:border-box;
 padding:0 16px 16px;
}
body.seowon-site #home-artworks .artwork-shortcuts {
 display:grid; grid-template-columns:minmax(0,1fr); gap:18px;
 width:100%; max-width:100%; min-width:0; padding:0; box-sizing:border-box;
}
body.seowon-site #home-artworks .seowon-content-card {
 display:flex; flex-direction:column; align-items:stretch; gap:12px;
 min-width:0; max-width:100%; margin:0; padding:16px; box-sizing:border-box;
 border:1px solid #ad976d; border-radius:12px; background:#193644;
 color:#f4ebdd; text-align:center;
}
body.seowon-site #home-artworks .seowon-card-media {
 position:relative; width:100%; min-width:0; aspect-ratio:4/3;
 background:#102b3a; border-radius:8px;
}
body.seowon-site #home-artworks .seowon-card-media img {
 position:absolute; inset:0; display:block; width:100%!important; max-width:100%; height:100%!important; min-width:0;
 object-fit:contain; border-radius:8px; margin:0; transform:none;
}
body.seowon-site #home-artworks .seowon-card-title {
 margin:0; font-size:20px!important; line-height:1.5; word-break:keep-all; overflow-wrap:anywhere;
}
body.seowon-site #home-artworks .seowon-card-description {
 margin:0 0 4px; font-size:15px!important; line-height:1.6;
 word-break:keep-all; overflow-wrap:anywhere;
}
body.seowon-site #home-artworks a.seowon-card-button {
 display:flex; align-items:center; justify-content:center; align-self:stretch;
 width:100%; max-width:100%; min-width:0; min-height:48px; box-sizing:border-box;
 margin:auto 0 0; padding:10px 16px; border:1px solid #cfad61; border-radius:8px;
 background:#ead08d; color:#102b3a!important; -webkit-text-fill-color:currentColor!important;
 font-size:16px!important; font-weight:700; line-height:1.5; white-space:nowrap;
 text-decoration:none; touch-action:manipulation;
}
body.seowon-site #home-artworks a.seowon-card-button:focus-visible {outline:3px solid #fff; outline-offset:3px;}
body.seowon-site #home-artworks a.seowon-card-button:active {background:#d7b766;}
@media(min-width:768px) {
 body.seowon-site #home-artworks .artwork-shortcuts {grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media(max-width:480px) {
 body.seowon-site #home-artworks .artwork-catalog {padding:0 12px 12px;}
 body.seowon-site #home-artworks .seowon-content-card {padding:12px; gap:10px;}
 body.seowon-site #home-artworks .seowon-card-title {font-size:18px!important;}
}
