/* The four transparent materials are shared with the home page. A nine-slice
   border paints the perimeter without adding an overlay over text or controls. */
.element-site {
    --section-gap: clamp(16px, 1.85vw, 28px);
    --panel-inset: clamp(14px, 1.8vw, 26px);
    --section-edge: clamp(3.5px, .32vw, 4.5px);
    --section-material: url('home-frames/earth-inset.webp');
}
.element-site[data-page-facet='air'] { --section-material: url('home-frames/air-inset.webp'); }
.element-site[data-page-facet='fire'] { --section-material: url('home-frames/fire-inset.webp'); }
.element-site[data-page-facet='water'] { --section-material: url('home-frames/water-inset.webp'); }

body.element-site.element-unified:not(.page-home) .site-wrap > #content {
    padding-block: var(--section-gap) calc(var(--section-gap) * 1.5);
}
body.element-site.element-unified:not(.page-home)[data-hero-theme] #content > :is(
    .help-page, .armory-page, .tool-page, .power-page, .knowledge-page, .spirit-tool, .news-landing
) { padding-block-end: 0; margin-block-end: 0; }

/* Page titles and independent work areas share a rim. Rows, map cells,
   in-game items and controls keep their original borders and hit areas. */
body.element-site.element-unified:not(.page-home)[data-hero-theme] #content :is(
    .element-community-title, .element-library-intro, .clan-roster-masthead,
    .page-hero, .help-page > header:has(h1), .armory-page > header:has(h1),
    .safe-tool-hero, .knowledge-intro, .power-title, .spirit-header, .pillar-heading,
    .news-detail-heading, .topic-heading, .admin-heading, .auth-shell, .error-page,
    .panel:not(.panel .panel), .power-card, .power-simulator, .power-note,
    .pillar-controls, .pillar-report, .pillar-subscription, .spirit-section,
    .clan-roster-register, .clan-roster-guide-section, .join-part, .join-entry,
    .catalog-group, .armory-detail, .armory-filters, .move-filters,
    .help-page > :is(.twilight-section, .map-extension-section, .dg-section, .level-overview, .pq-section, .ac-section)
) {
    border-image: var(--section-material) 64 / var(--section-edge) / 1px stretch;
}

/* Use one rhythm for successive, independent sections. Preserve the tighter
   grouping between breadcrumbs, labels, filter controls and their results. */
body.element-site.element-unified:not(.page-home)[data-hero-theme] #content :is(
    .element-community-title, .element-library-intro, .power-title, .spirit-header,
    .help-page > header:has(h1), .armory-page > header:has(h1), .tool-page > :is(.page-hero, .safe-tool-hero, .pillar-heading),
    .topic-heading, .news-detail-heading, .admin-heading
) { margin-block: 0 var(--section-gap); }

body.element-site.element-unified:not(.page-home)[data-hero-theme] #content :is(
    .help-page, .power-page, .tool-page, .spirit-tool
) > :is(section, aside, details) + :is(section, aside, details) {
    margin-block-start: var(--section-gap);
}
body.element-site.element-unified:not(.page-home) #content :is(
    .clan-roster-page, .clan-roster-layout, .clan-roster-guide, .account-grid,
    .community-chat-grid, .community-forum-grid, .safe-tool-grid, .charms-workbench
) { gap: var(--section-gap); }
body.element-site.element-unified:not(.page-home)[data-hero-theme] #content :is(
    .power-simulator, .power-note, .join-part, .safe-instructions, .article-narrow
) { padding: var(--panel-inset); }

/* The scene can be clearer on wide screens: its caption sits on its own
   surface, while the title and description stay on the solid half. */
@media (min-width: 900px) {
    html[data-element-theme='light'] .element-site[data-hero-theme='combat'] {
        --unified-hero-veil: linear-gradient(94deg, #f9f3e7 29%, #f9f3e7f7 43%, #f9f3e79c 62%, #f9f3e720 87%);
    }
}
body.element-site.element-unified #content .power-page > .power-title .power-title-date {
    padding: 3px 7px;
    background: #25333a;
    color: #fcf4e4;
    border-radius: 2px;
}
html[data-element-theme='light'] body.element-site.element-unified #content .power-page > .power-title .power-title-date {
    background: #f9f3e7;
    color: #30424b;
}
body.element-site.element-unified:not(.page-home)[data-hero-theme] #content .charms-tool .charms-hero::after {
    background-image: none;
}

/* Apply decoration to both link and label: a decoration set on an ancestor
   propagates to descendants even when they declare text-decoration: none. */
body.element-site.element-unified :is(.site-header nav, nav.mobile-bottom) :is(a, summary, span) {
    text-decoration: none !important;
}
body.element-site.element-unified .site-header .element-primary-nav .element-nav-group::before {
    content: none;
}
body.element-site .site-header .element-community-nav a[aria-current='page'],
body.element-site.element-unified .mobile-bottom .active {
    background-color: var(--menu-current, #a7854f30);
}
body.element-site.element-unified :is(.site-header nav, nav.mobile-bottom) :is(a, summary):focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -3px;
}
@media (forced-colors: active) {
    body.element-site .site-header nav :is([aria-current='page'], [data-current] > details > summary),
    body.element-site .mobile-bottom [aria-current='page'] { outline: 1px solid Highlight; }
}
