/* SACRALIB V2.16 — unified OWNER-ONLY pages/articles.
   Inspired by supplied desktop/mobile article Figma exports, matched to live V2 home.
   Apply to real content without overriding game data, tables, canvas or editors. */
body.sv216-page-theme {
 --sv216-paper:#f7f0e5;
 --sv216-ink:#30251b;
 --sv216-bronze:#a47b4d;
 --sv216-line:#d6c3a6;
 --sv216-shadow:0 2px 5px rgba(61,39,18,.045),0 7px 17px rgba(65,44,20,.11);
 --sv216-gutter:clamp(18px,5.55vw,110px);
 color:var(--sv216-ink)!important;
 background-color:#eee6d8!important;
 background-image:url('/assets/codex-v27-figma/side-left.webp'),url('/assets/codex-v27-figma/side-right.webp'),url('/assets/codex-v27-figma/parchment.webp')!important;
 background-position:left top,right top,center top!important;
 background-repeat:no-repeat,no-repeat,repeat!important;
 background-size:clamp(72px,5.3vw,110px) auto,clamp(72px,5.3vw,110px) auto,1024px auto!important;
 font-family:Georgia, 'EB Garamond', serif;
}
/* Figma banners are already inside the side mural art — don't double-draw SVG flags. */
body.sv216-page-theme .cv2-banners,body.sv216-page-theme .cv2-banner{display:none!important;}
body.sv216-page-theme .codex-navbar{
 min-height:71px!important;
 padding:7px var(--sv216-gutter)!important;
 border-bottom:1px solid #c7b08f!important;
 background:linear-gradient(180deg,#fffaf2f9,#f5ecdef7)!important;
 box-shadow:0 3px 13px rgba(60,43,24,.15)!important;
}
body.sv216-page-theme .codex-navbar .brand-mark{width:51px!important;height:51px!important;min-width:51px!important;}
body.sv216-page-theme .codex-navbar .brand-text::before{font:500 clamp(23px,1.9vw,32px)/1.0 Georgia,serif!important;}
body.sv216-page-theme .codex-navbar .brand-text::after{font:500 10px/1.2 Georgia,serif!important;}
body.sv216-page-theme .page-shell{
 width:100%!important;max-width:none!important;
 padding:20px var(--sv216-gutter) 24px!important;
 margin:0 auto!important;background:transparent!important;box-shadow:none!important;
}
body.sv216-page-theme .content-stage{
 width:100%!important;max-width:1900px!important;min-width:0!important;
 padding:0!important;margin:0 auto!important;background:transparent!important;box-shadow:none!important;
}
body.sv216-page-theme :is(.site-footer,#siteFooter){
 width:calc(100% - 2 * var(--sv216-gutter))!important;
 max-width:1900px!important;margin:0 auto 14px!important;
 padding:14px 18px!important;
 color:#675847!important;
 background:#f5eddfdf!important;
 border:0!important;border-top:1px solid #c9b48f!important;
 box-shadow:none!important;
}
body.sv216-page-theme :is(a,summary,button):focus-visible{outline:2px solid #875b35;outline-offset:3px;}

/* PUBLIC LIST / SECTION ROUTES: common typography + cards, no restructuring of tools. */
body.sv216-inner-page :is(#hero,.home-top-panels){display:none!important;}
body.sv216-inner-page .content-stage>.toolbar{
 margin:0 0 12px!important;padding:17px 22px!important;
 border:1px solid var(--sv216-line)!important;border-radius:4px!important;
 background:linear-gradient(150deg,#fdf9f1,#f3e9da)!important;
 box-shadow:var(--sv216-shadow)!important;
}
body.sv216-inner-page .content-stage>.toolbar::before{display:none!important;}
body.sv216-inner-page .content-stage>.toolbar h1{
 font:600 clamp(25px,2vw,35px)/1.2 Georgia,serif!important;
 letter-spacing:.01em!important;text-transform:none!important;color:#2e241d!important;
}
body.sv216-inner-page .content-stage>.toolbar .eyebrow{
 color:#986e42!important;font:500 11px/1.3 Georgia,serif!important;letter-spacing:.11em!important;
}
body.sv216-inner-page #subgroupTabs:not(:empty){
 margin:0 0 12px!important;padding:9px 12px!important;
 background:#f7efe2!important;border:1px solid var(--sv216-line)!important;
 border-radius:4px!important;
}
body.sv216-inner-page .view.active{min-width:0!important;}
body.sv216-inner-page .view.active :is(.article-card,.guide-card,.map-showcase,.set-compare-heading,.rating-heading,.rating-table-wrap){
 background:linear-gradient(155deg,#fdf9f1,#f5ecdd)!important;
 border-color:var(--sv216-line)!important;
 border-radius:4px!important;
 box-shadow:var(--sv216-shadow)!important;
}
body.sv216-inner-page .view.active :is(.article-card h2,.article-card h3,.map-showcase h2,.set-compare-heading h2,.rating-heading h2){
 color:#31261d!important;font-family:Georgia,serif!important;
}
body.sv216-inner-page .view.active :is(.article-card,.guide-card){overflow-wrap:anywhere;min-width:0;}
body.sv216-inner-page .view.active .article-card :is(img,video){max-width:100%;height:auto;}

/* Shared headings for other game areas. Only their OUTER heading panels are themed;
   calculators, markets, inventory, tables and inputs retain their working styles. */
body.sv216-inner-page .view.active :is(.armory-heading,.market-heading,.game-chat-heading,.bugs-hero){
 border:1px solid var(--sv216-line)!important;
 border-radius:4px!important;
 background:linear-gradient(155deg,#fdf9f1,#f4eada)!important;
 box-shadow:var(--sv216-shadow)!important;
}
body.sv216-inner-page .view.active :is(.armory-heading,.market-heading,.game-chat-heading,.bugs-hero) h2{
 font:600 clamp(22px,2vw,32px)/1.17 Georgia,serif!important;
 color:#30251b!important;
}
body.sv216-inner-page .view.active :is(.armory-heading,.market-heading,.game-chat-heading,.bugs-hero) .eyebrow{
 color:#926636!important;
}
/* Library and guides use real saved categories and sections, never Figma demo articles. */
body.sv216-inner-page #libraryView.sv216-directory,
body.sv216-inner-page #guidesView.sv216-directory{
 display:grid!important;grid-template-columns:minmax(205px,245px) minmax(0,1fr)!important;
 align-items:start!important;gap:14px!important;
}
body.sv216-inner-page :is(#libraryView,#guidesView).sv216-directory>.sv216-directory-panel{
 grid-column:1!important;grid-row:1!important;
 position:sticky;top:82px;max-height:calc(100vh - 98px);overflow:auto;
 scrollbar-width:thin;min-width:0;
}
body.sv216-inner-page #libraryView.sv216-directory>#libraryList,
body.sv216-inner-page #guidesView.sv216-directory>.guide-layout{
 grid-column:2!important;grid-row:1!important;min-width:0!important;
}
body.sv216-inner-page #guidesView .guide-layout :is(#guidesList,.article-list){min-width:0;}
.sv216-directory-panel{display:grid;gap:0;align-content:start;}
.sv216-directory-panel .sv216-directory-heading{
 display:flex;align-items:center;gap:9px;
 margin:0!important;padding:13px 12px!important;
 font:600 17px/1.2 Georgia,serif!important;
 border:1px solid var(--sv216-line);border-radius:4px 4px 0 0;
 background:linear-gradient(155deg,#fffaf2,#f3e8d7);color:#31251b!important;
}
.sv216-icon,.sv216-heading-icon{display:inline-block;flex:0 0 auto;object-fit:contain!important;width:28px;height:30px;background:transparent!important;}
.sv216-directory-panel .sv216-directory-heading>.sv216-icon{width:34px;height:36px;}
.sv216-directory-panel .sv216-directory-group{
 margin:0;border:1px solid var(--sv216-line);border-top:0;
 background:linear-gradient(155deg,#fdf9f1,#f5ecdd);
}
.sv216-directory-panel .sv216-directory-group>summary{
 display:flex;align-items:center;gap:8px;
 padding:10px 12px;cursor:pointer;list-style:none;
 color:#4a3223;font:600 14px/1.2 Georgia,serif;
}
.sv216-directory-panel .sv216-directory-group>summary::-webkit-details-marker{display:none;}
.sv216-directory-panel .sv216-directory-group>summary:after{content:'⌄';margin-left:auto;color:#947047;}
.sv216-directory-panel .sv216-directory-group[open]>summary{background:#eadcc5;}
.sv216-directory-panel .sv216-directory-links{display:grid;padding:5px 7px 9px;gap:1px;}
.sv216-directory-panel .sv216-directory-link{
 display:block;position:relative;padding:7px 6px 7px 17px;
 border-bottom:1px solid #e6d8c4;color:#513727!important;
 font:400 13px/1.25 Georgia,serif;text-decoration:none!important;overflow-wrap:anywhere;
}
.sv216-directory-panel .sv216-directory-link:before{content:'›';position:absolute;left:5px;color:#987043;}
.sv216-directory-panel .sv216-directory-link:hover{background:#eaddc8;}
.sv216-directory-panel .sv216-world-card{
 display:block;min-height:202px;margin-top:12px;
 border:1px solid #bfa680;border-radius:3px;
 box-shadow:var(--sv216-shadow);
 background:#223140 url('/assets/codex-v216/atlas-card.webp') center / cover no-repeat;
}
.sv216-directory-panel .sv216-world-card:hover{filter:brightness(1.07);}

/* ARTICLE — reuse V2's living article renderer and the same border/paper/typography as HOME. */
body.sv216-page-theme.codex-article-v2-active .content-stage>.toolbar{display:none!important;}
body.sv216-page-theme.codex-article-v2-active #articleFull.cv2-layout{
 grid-template-columns:minmax(205px,245px) minmax(0,1fr) minmax(220px,265px)!important;
 gap:14px!important;align-items:start!important;
 width:100%!important;max-width:1900px!important;
 border:0!important;background:transparent!important;
}
body.sv216-page-theme.codex-article-v2-active #articleFull.cv2-layout.cv2-layout--no-right{
 grid-template-columns:minmax(205px,245px) minmax(0,1fr)!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout :is(.cv2-main,.cv2-side-panel){
 min-width:0!important;
 border:1px solid var(--sv216-line)!important;
 border-radius:4px!important;
 background:linear-gradient(155deg,#fdf9f1,#f5ecdd)!important;
 box-shadow:var(--sv216-shadow),inset 0 0 0 1px rgba(255,255,255,.55)!important;
 color:var(--sv216-ink)!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-main{
 padding:clamp(15px,1.5vw,24px)!important;gap:12px!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-left,
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-right{
 gap:12px!important;top:86px;max-height:calc(100vh - 102px);
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-side-panel{
 padding:14px 12px!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-side-title{
 display:flex!important;align-items:center!important;gap:9px!important;
 margin:0 0 10px!important;padding-bottom:10px!important;
 border-bottom:1px solid #deccb1!important;
 color:#30251b!important;font:600 clamp(15px,1.1vw,18px)/1.2 Georgia,serif!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-side-title.sv216-decorated-heading>svg{display:none!important;}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-side-title .sv216-heading-icon{width:28px!important;height:31px!important;}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-nav-group>summary{
 font:600 14px/1.24 Georgia,serif!important;color:#342b22!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-article-link-small{
 font:400 13px/1.3 Georgia,serif!important;padding:8px 9px 8px 17px!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-article-link-small.is-current{
 background:#e7d9c2!important;border-inline-start-color:#956832!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-breadcrumbs{
 font:13px/1.35 Georgia,serif!important;overflow-wrap:anywhere;
 border-bottom:1px solid #ddccb2!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-main>h2{
 color:#2d231d!important;
 font:500 clamp(29px,2.6vw,43px)/1.09 Georgia,serif!important;
 text-transform:none!important;letter-spacing:normal!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-main>.article-lead{
 font:400 clamp(16px,1.4vw,20px)/1.45 Georgia,serif!important;color:#5d4837!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-main>.cv2-hero-image{
 width:100%!important;max-width:100%!important;max-height:none!important;height:auto!important;
 object-fit:contain!important;border-radius:3px!important;
 border:1px solid #cdbb9d!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .article-body{
 min-width:0!important;max-width:100%!important;
 color:#30271f!important;font:400 16px/1.55 Georgia,serif!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .article-body :is(h2,h3,h4,h5){
 color:#523921!important;font-family:Georgia,serif!important;scroll-margin-top:95px;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .article-body :is(h2,h3){
 border-bottom:1px solid #dcc9ae;padding:7px 0 9px;letter-spacing:normal!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .article-body :is(img,video,iframe){max-width:100%!important;}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .article-body>img,
body.sv216-page-theme.codex-article-v2-active .cv2-layout .article-body>figure img,
body.sv216-page-theme.codex-article-v2-active .cv2-layout .article-body .content-image img{max-width:100%;height:auto;object-fit:contain;}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .article-body :is(.content-table-wrap,.content-world-map,.content-columns){
 max-width:100%!important;min-width:0!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .article-body :is(.content-table-wrap,.table-wrap){overflow-x:auto;}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-map-card{
 border-radius:4px!important;
 background:linear-gradient(0deg,rgba(7,19,30,.92),rgba(7,19,30,0) 75%),url('/assets/codex-v27-figma/category-world.webp') center/cover!important;
 box-shadow:var(--sv216-shadow)!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-toc-link.is-active{
 color:#543d28!important;background:#e9ddc8!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-related-panel .cv2-article-link{
 padding:10px 5px!important;color:#38291f!important;
}
body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-related-thumb{
 border:1px solid #d0bc9d!important;border-radius:3px!important;
}

/* Tablet: keep article readable, put the supplementary column beneath it. */
@media (max-width:1280px){
 body.sv216-page-theme{--sv216-gutter:clamp(15px,3vw,45px);}
 body.sv216-page-theme.codex-article-v2-active #articleFull.cv2-layout,
 body.sv216-page-theme.codex-article-v2-active #articleFull.cv2-layout.cv2-layout--no-right{
  grid-template-columns:minmax(185px,225px) minmax(0,1fr)!important;
 }
 body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-left{grid-column:1;grid-row:1 / span 2;}
 body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-right{grid-column:2;grid-row:2;position:static;overflow:visible;max-height:none;}
 body.sv216-inner-page #libraryView.sv216-directory,
 body.sv216-inner-page #guidesView.sv216-directory{grid-template-columns:minmax(180px,210px) minmax(0,1fr)!important;}
}
/* MOBILE: content first, then related articles, and then the category tree. */
@media (max-width:840px){
 body.sv216-page-theme{
  --sv216-gutter:clamp(10px,3vw,18px);
  background-image:url('/assets/codex-v27-figma/parchment.webp')!important;
  background-size:700px auto!important;background-repeat:repeat!important;
 }
 body.sv216-page-theme .codex-navbar{padding:7px 12px!important;min-height:59px!important;}
 body.sv216-page-theme .codex-navbar .brand-mark{width:40px!important;height:40px!important;min-width:40px!important;}
 body.sv216-page-theme .page-shell{padding:11px var(--sv216-gutter) 18px!important;}
 body.sv216-page-theme.codex-article-v2-active #articleFull.cv2-layout,
 body.sv216-page-theme.codex-article-v2-active #articleFull.cv2-layout.cv2-layout--no-right{
  display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:12px!important;
 }
 body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-main{grid-column:1!important;grid-row:1!important;padding:14px!important;}
 body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-right{
  grid-column:1!important;grid-row:2!important;display:grid!important;
  position:static!important;max-height:none!important;overflow:visible!important;
  grid-template-columns:minmax(0,1fr)!important;
 }
 body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-right[hidden]{display:none!important;}
 body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-toc-panel{display:none!important;}
 body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-left{
  grid-column:1!important;grid-row:3!important;position:static!important;
  max-height:none!important;overflow:visible!important;grid-template-columns:minmax(0,1fr)!important;
 }
 body.sv216-inner-page #libraryView.sv216-directory,
 body.sv216-inner-page #guidesView.sv216-directory{display:flex!important;flex-direction:column!important;gap:12px!important;}
 body.sv216-inner-page #libraryView.sv216-directory>#libraryList,
 body.sv216-inner-page #guidesView.sv216-directory>.guide-layout{order:1!important;width:100%!important;}
 body.sv216-inner-page :is(#libraryView,#guidesView).sv216-directory>.sv216-directory-panel{
  order:2!important;position:static!important;width:100%!important;
  max-height:none!important;overflow:visible!important;
 }
 body.sv216-page-theme :is(.site-footer,#siteFooter){width:calc(100% - 2 * var(--sv216-gutter))!important;}
}
@media (max-width:480px){
 body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-main>h2{font-size:29px!important;}
 body.sv216-page-theme.codex-article-v2-active .cv2-layout .cv2-main{padding:12px!important;}
 body.sv216-inner-page .content-stage>.toolbar{padding:12px 13px!important;}
 body.sv216-inner-page .content-stage>.toolbar h1{font-size:24px!important;}
 body.sv216-page-theme .codex-navbar .brand-text::before{font-size:20px!important;}
 body.sv216-page-theme .codex-navbar .brand-text::after{font-size:8px!important;}
}
@media(prefers-reduced-motion:reduce){
 body.sv216-page-theme :is(a,button,summary){transition:none!important;}
}
