/* Shared chrome only. Page scenery, layout and reader controls retain their own contracts. */
.arcana-shell .site-header {
    display: block; position: relative; z-index: 40; isolation: isolate;
    max-width: none; margin: 0; padding: 12px max(16px, calc((100% - 1280px) / 2));
    color: var(--arcana-ink); font: 17px/1.5 var(--arcana-font);
    background: linear-gradient(#0c0b08bd, #0c0b08d9), url('/images/arcana/v1/login/walnut-grain.webp') center/150px 25px;
    border: 0; border-bottom: 2px solid var(--arcana-brass); box-shadow: 0 3px 12px #0006;
}
.arcana-shell .shell-frame {
    position: relative; isolation:isolate; min-width: 0; padding: 12px 24px; border: 1px solid #987845;
    box-shadow: inset 0 0 0 4px #080e12, inset 0 0 0 5px #6e5635;
    background: linear-gradient(#0d1a23d4, #0d1a23d4), url('/images/arcana/v1/login/leather-grain.webp') center/150px 250px;
}
.arcana-shell .shell-masthead { display:flex; align-items:center; justify-content:center; gap:12px; min-width:0; min-height:44px; padding:0 48px; }
.arcana-shell .shell-frame::before, .arcana-shell .shell-frame::after {
    content: ''; position: absolute; z-index:-1; top: 0; width: 64px; height: 58px; pointer-events: none;
    background-image: url('/images/arcana/v1/identity/ornamenti-palinsesto.svg'); background-size: 360px 120px;
}
.arcana-shell .shell-frame::before { left: 0; background-position: left top; }
.arcana-shell .shell-frame::after { right: 0; background-position: right top; }
.arcana-shell .site-header .brand {
    display: flex; align-items: center; justify-content: center; gap: 12px; min-width: 0; min-height: 44px;
    color: var(--arcana-ink); font: 32px/1.25 var(--arcana-font); letter-spacing: .12em;
    text-transform: none; text-decoration: none; white-space: nowrap;
}
.arcana-shell .site-header .brand-mark { display: block; width: 44px; height: 44px; flex: none; }
.arcana-shell .shell-menu { position: static; min-width: 0; margin: 0; border: 0; }
.arcana-shell .shell-menu > summary { display: none; }
.arcana-shell .shell-menu-panel {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 12px 0 0; min-width: 0;
}
.arcana-shell .site-header .shell-menu-panel > * { grid-area: auto; order: initial; }
.arcana-shell .site-header .archive-navigation {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
    flex: 1; gap: 4px 12px; width: auto; min-width: 0; margin: 0; padding: 0; border: 0;
}
.arcana-shell .site-header .archive-navigation a {
    display: flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px;
    margin: 0; padding: 8px 12px; color: var(--arcana-ink); font: 17px/1.5 var(--arcana-font);
    text-decoration: none; text-underline-offset: .22em; background: none; border: 0; border-radius: 0; box-shadow: none;
    overflow-wrap: anywhere; white-space: normal;
}
.arcana-shell .site-header .archive-navigation a:hover { text-decoration: underline; }
.arcana-shell .site-header .administration-menu, .arcana-shell .site-header .profile-menu {
    position: relative; flex: none; min-width: 0; margin: 0; width: auto; order: initial; font: 17px/1.5 var(--arcana-font);
}
.arcana-shell .site-header :is(.shell-menu, .administration-menu, .profile-menu) > summary {
    min-height: 44px; padding: 9px 14px; color: var(--arcana-ink); font: 17px/24px var(--arcana-font);
    border: 1px solid var(--arcana-brass); border-radius: 0; box-shadow: inset 0 0 0 3px #0b1218;
    background: linear-gradient(#101e29d9, #101e29d9), url('/images/arcana/v1/login/leather-grain.webp') center/150px 250px;
    cursor: pointer; list-style: none; white-space: normal; overflow-wrap: anywhere;
}
.arcana-shell .site-header summary::-webkit-details-marker { display: none; }
.arcana-shell .administration-label { display: inline; }
.arcana-shell .administration-short { display: none; }
.arcana-shell .site-header .administration-links, .arcana-shell .site-header .profile-menu > div {
    position: absolute; top: calc(100% + 6px); right: 0; left: auto; z-index: 50;
    width: 288px; min-width: 0; max-width: calc(100vw - 32px); max-height: min(70svh, 32rem);
    overflow: auto; overscroll-behavior: contain; display: grid; gap: 0; margin: 0; padding: 8px;
    background: linear-gradient(#0d1a23f2, #0d1a23f2), url('/images/arcana/v1/login/leather-grain.webp') center/150px 250px;
    border: 1px solid var(--arcana-brass); border-radius: 0; box-shadow: 0 8px 18px #0009;
}
.arcana-shell .site-header :is(.administration-links, .profile-menu > div) > a,
.arcana-shell .site-header .profile-menu button {
    display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 44px;
    padding: 10px 12px; margin: 0; border: 0; border-bottom: 1px solid #b9945259;
    border-radius: 0; box-shadow: none; background: none; color: var(--arcana-ink);
    font: 17px/1.5 var(--arcana-font); text-align: left; text-decoration: none; white-space: normal; overflow-wrap: anywhere;
}
.arcana-shell .site-header :is(.administration-links, .profile-menu > div) > a:hover,
.arcana-shell .site-header .profile-menu button:hover { background: #b9945226; text-decoration: underline; }
.arcana-shell .site-header .profile-menu form { max-width: none; margin: 0; }
.arcana-shell .site-header .archive-search {
    display: flex; flex: 1; gap: 0; min-width: 180px; max-width: 300px; margin: 0; padding: 3px;
    border: 1px solid var(--arcana-brass); border-radius: 0; background: #0b151d; box-shadow: none;
}
.arcana-shell .site-header .archive-search input {
    flex: 1; width: 100%; min-width: 0; min-height: 44px; margin: 0; padding: 8px;
    color: var(--arcana-ink); background: #0b151d; box-shadow: none; font: 17px/1.5 var(--arcana-font);
}
.arcana-shell .site-header .archive-search button {
    flex: none; min-width: 44px; min-height: 44px; height: auto; margin: 0; padding: 8px;
    border: 0; border-radius: 0; background: #172a33; color: var(--arcana-ink); font: 19px/1.5 var(--arcana-font);
}
.arcana-shell .site-header .archive-note { margin: 10px auto 0; text-align: center; color: var(--arcana-muted); font: 16px/1.5 var(--arcana-font); }
.arcana-shell .site-footer {
    position: relative; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px;
    max-width: none; margin: 0; padding: 40px max(16px, calc((100% - 1280px) / 2)) 20px;
    color: var(--arcana-muted); font: 16px/1.6 var(--arcana-font); border: 0; border-top: 1px solid var(--arcana-brass);
    background: linear-gradient(#0c0b08eb, #0c0b08eb), url('/images/arcana/v1/login/walnut-grain.webp') center/150px 25px;
}
.arcana-shell .site-footer::before {
    content: ''; position: absolute; top: 4px; left: 50%; width: min(240px, 80%); height: 30px; transform: translateX(-50%);
    background: url('/images/arcana/v1/identity/ornamenti-palinsesto.svg') center -20px/360px 120px no-repeat; pointer-events: none;
}
.arcana-shell .site-footer > span:nth-child(2) { display: inline; }
.arcana-shell .site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.arcana-shell .site-footer a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 0; color: var(--arcana-ink); text-underline-offset: .22em; }
.arcana-shell :is(.site-header, .site-footer) :is(a, button, summary, input):focus-visible,
.arcana-shell .skip-link:focus-visible { outline: 3px solid var(--arcana-ring); outline-offset: 3px; }
.arcana-shell .skip-link { z-index: 100; background: #0b151d; color: var(--arcana-ink); border: 1px solid var(--arcana-brass); min-height: 44px; }
/* Reader chrome remains compact; its page, pagination and data hooks are untouched. */
.arcana-shell.paginated-reader-page .site-header { padding: 8px 12px; z-index: 20; }
.arcana-shell.paginated-reader-page .shell-masthead { min-height: 60px; padding: 4px 84px 4px 8px; justify-content: space-between; }
.arcana-shell.paginated-reader-page .shell-frame::before, .arcana-shell.paginated-reader-page .shell-frame::after { display: none; }
.arcana-shell.paginated-reader-page .site-header .brand { font-size: 22px; letter-spacing: .02em; }
.arcana-shell.paginated-reader-page .site-header .brand-mark { display: none; }
.arcana-shell.paginated-reader-page .reader-header-back { color: var(--arcana-ink); font: 16px/1.5 var(--arcana-font); min-height: 44px; }
.arcana-shell.paginated-reader-page .shell-menu > summary {
    display: flex; position: absolute; top: 16px; right: 20px; align-items: center; justify-content: center; gap: 8px;
}
@media (max-width: 64rem) {
    .arcana-shell .site-header { padding: 12px; }
    .arcana-shell .shell-frame { padding:12px; }
    .arcana-shell .shell-masthead { min-height: 44px; padding: 0 78px 0 32px; }
    .arcana-shell .site-header .brand { font-size: clamp(18px, 5.64vw, 28px); letter-spacing: .02em; }
    .arcana-shell .site-header .brand-mark { display: none; }
    .arcana-shell .shell-menu > summary { display: flex; position: absolute; top: 12px; right: 12px; align-items: center; justify-content: center; gap: 8px; }
    .arcana-shell .shell-menu-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding-top: 12px; }
    .arcana-shell .site-header .archive-navigation { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; width: 100%; }
    .arcana-shell .site-header .archive-navigation a { padding: 10px; border-bottom: 1px solid #b9945259; }
    .arcana-shell .site-header .archive-search { width: 100%; min-width: 0; max-width: none; }
    .arcana-shell .site-header :is(.administration-menu,.profile-menu) > summary { justify-content: space-between; }
    .arcana-shell .site-header :is(.administration-links,.profile-menu > div) { position: static; width: 100%; max-width: none; max-height: none; box-shadow: none; margin-top: 6px; }
    .arcana-shell .shell-public .shell-masthead { padding-inline: 48px; }
    .arcana-shell .site-footer { align-items: flex-start; flex-direction: column; }
    .arcana-shell.paginated-reader-page .site-header .brand { font-size: 18px; }
}
@media (forced-colors: active) {
    .arcana-shell .shell-frame::before, .arcana-shell .shell-frame::after, .arcana-shell .site-footer::before { display: none; }
    .arcana-shell .shell-frame, .arcana-shell .shell-masthead, .arcana-shell .site-header, .arcana-shell .site-footer { background: Canvas; border-color: CanvasText; box-shadow: none; }
    .arcana-shell :is(.site-header,.site-footer) :is(a,button,summary,input):focus-visible { outline-color: Highlight; }
}
