/* Public page composition. Loaded after theme and page styles. */
body[data-theme-area="frontend"].route-home .dfb-page > .dfb-container {
    width: 100%;
    max-width: 1600px;
    padding-inline: clamp(20px, 3vw, 48px);
    margin-inline: auto;
}
body[data-theme-area="frontend"].route-home .df-hero {
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: clamp(28px, 4vw, 64px);
    justify-content: stretch;
    padding: clamp(48px, 6vw, 88px) 0 48px;
}
body[data-theme-area="frontend"].route-home :is(.df-hero-copy, .df-hero-visual, .df-hero-logo-live, .df-typewriter-panel) {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    justify-self: stretch;
}
body[data-theme-area="frontend"].route-home .df-hero-copy { padding: 0; }
body[data-theme-area="frontend"].route-home :is(.df-typewriter-word, .df-typewriter-word-ghost) {
    font-size: clamp(2rem, 3.35vw, 3.7rem);
}
body[data-theme-area="frontend"].route-home :is(.df-hero-entries, .home-content-layout) { width: 100%; max-width: 100%; margin-inline: 0; }
body[data-theme-area="frontend"] .document-prose { width: 100%; min-width: 0; }
body[data-theme-area="frontend"] .document-prose > :first-child { margin-top: 0; }
body[data-theme-area="frontend"] .document-prose :is(h1,h2,h3,h4) { scroll-margin-top: calc(var(--df-header-total, 64px) + 24px); }
body[data-theme-area="frontend"] .document-prose h1 { margin: 2em 0 .85em; font-size: 1.8rem; line-height: 1.4; }
body[data-theme-area="frontend"] :is(.writeup-doc-layout, .download-detail-layout) { align-items: start; gap: clamp(24px, 3vw, 48px); }
body[data-theme-area="frontend"].route-writeups-show .writeup-doc-layout {
    grid-template-columns: minmax(0, 820px) minmax(210px, 280px);
    justify-content: center;
}
body[data-theme-area="frontend"] .writeup-reading-document { padding: clamp(22px, 3vw, 40px); border-radius: 10px; }
body[data-theme-area="frontend"] .writeup-hero { margin-bottom: 30px; padding: 26px 0 30px; border: 0; border-bottom: 1px solid var(--border, #dbe3ee); border-radius: 0; background: transparent; box-shadow: none; }
body[data-theme-area="frontend"] .writeup-page-title { max-width: 32ch; font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.35; text-wrap: pretty; }
body[data-theme-area="frontend"] .writeup-page-lead { max-width: 64ch; font-size: 15px; line-height: 1.8; }
body[data-theme-area="frontend"] .doc-outline-panel { padding: 18px; background: transparent; border: 0; }
body[data-theme-area="frontend"] .content-outline-link.is-active { border-left-color: var(--link, #2563eb); color: var(--link, #2563eb); font-weight: 650; }
body[data-theme-area="frontend"] .download-detail-layout { grid-template-columns: minmax(0, 820px) minmax(240px, 300px); justify-content: center; }
body[data-theme-area="frontend"] .download-reading-column { min-width: 0; }
body[data-theme-area="frontend"] :is(.download-description-panel, .download-delivery-notes-panel, .download-metadata-panel) { padding: clamp(20px, 2.8vw, 34px); border-radius: 10px; }
body[data-theme-area="frontend"] .download-reading-column .section-head { margin-bottom: 24px; }
body[data-theme-area="frontend"] .download-metadata-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 28px; }
body[data-theme-area="frontend"] .download-metadata-grid .info-item { min-width: 0; padding-block: 14px; border-bottom: 1px solid var(--border, #dbe3ee); }
body[data-theme-area="frontend"] .download-action-stack { position: sticky; top: calc(var(--df-header-total, 64px) + 24px); }
body[data-theme-area="frontend"] .download-action-panel { padding: 24px; border-radius: 10px; }
body[data-theme-area="frontend"] :is(.resource-ledger, .contest-archive, .writeup-archive) :is(.catalog-title,.package-title) { line-height: 1.5; text-wrap: pretty; }
body[data-theme-area="frontend"] :is(.resource-ledger, .contest-archive, .writeup-archive) :is(.catalog-summary,.package-summary) { max-width: 72ch; line-height: 1.8; }
body[data-theme-area="frontend"] .contest-detail-page .contest-hero { grid-template-columns: minmax(0,1fr) minmax(240px,300px); gap: clamp(28px,4vw,56px); align-items: start; }
body[data-theme-area="frontend"] .contest-detail-page .df-title { max-width: 32ch; line-height: 1.35; text-wrap: pretty; }
body[data-theme-area="frontend"] .contest-detail-page .df-subtitle { max-width: 66ch; line-height: 1.8; }
body[data-theme-area="frontend"] .contest-detail-page .df-content-grid { grid-template-columns: minmax(0,1fr) minmax(240px,300px); gap: clamp(28px,4vw,56px); }
body[data-theme-area="frontend"] .contest-detail-page .document-prose { max-width: 100%; padding: 24px 28px 30px; }
body[data-theme-area="frontend"] .contest-detail-page .df-panel-head h2 { font-size: 1.3rem; line-height: 1.5; }
@media (max-width: 1100px) {
    body[data-theme-area="frontend"].route-home .df-hero { grid-template-columns: 1fr; gap: 28px; padding-top: 40px; }
    body[data-theme-area="frontend"].route-home .df-hero-visual { order: 0; }
    body[data-theme-area="frontend"].route-home :is(.df-typewriter-word, .df-typewriter-word-ghost) { font-size: clamp(2rem, 5.5vw, 3.7rem); }
    body[data-theme-area="frontend"].route-writeups-show .writeup-doc-layout,
    body[data-theme-area="frontend"] .download-detail-layout,
    body[data-theme-area="frontend"] .contest-detail-page :is(.contest-hero, .df-content-grid) { grid-template-columns: minmax(0,1fr); }
    body[data-theme-area="frontend"] .download-action-stack { position: static; }
}
@media (max-width: 760px) {
    body[data-theme-area="frontend"].route-home .dfb-page > .dfb-container { padding-inline: 16px; }
    body[data-theme-area="frontend"].route-home .df-hero { padding: 28px 0 32px; gap: 24px; }
    body[data-theme-area="frontend"] .writeup-hero { padding: 14px 0 22px; margin-bottom: 20px; }
    body[data-theme-area="frontend"] .writeup-reading-document { padding: 22px 18px; }
    body[data-theme-area="frontend"] .download-metadata-grid { grid-template-columns: minmax(0,1fr); }
    body[data-theme-area="frontend"] .contest-detail-page .document-prose { padding: 20px 18px; }
}
body[data-theme-area="frontend"].route-writeups-show .writeup-reading-document {
    display: block;
    min-width: 0;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #dbe3ee);
}
body[data-theme-area="frontend"].route-writeups-show .writeup-reading-document > .notice-bar {
    padding: 13px 16px;
    font-size: 13px;
    line-height: 1.7;
    border-radius: 7px;
    box-shadow: none;
}
/* Retire the theme's old three-column article placements. */
body[data-theme-area="frontend"].route-writeups-show .doc-index.wiki-doc-layout.writeup-doc-layout {
    display: grid !important;
    grid-template-columns: minmax(0,820px) minmax(210px,280px) !important;
}
body[data-theme-area="frontend"].route-writeups-show .writeup-doc-layout .writeup-reading-document {
    grid-column: 1 !important;
    grid-row: 1 !important;
    order: 0 !important;
    padding: clamp(22px,3vw,40px) !important;
    background: var(--surface,#fff) !important;
    border: 1px solid var(--border,#dbe3ee) !important;
}
body[data-theme-area="frontend"].route-writeups-show .writeup-reading-rail {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: calc(var(--df-header-total,64px) + 24px);
    max-height: calc(100dvh - var(--df-header-total,64px) - 48px);
    overflow: auto;
    scrollbar-width: thin;
}
body[data-theme-area="frontend"].route-writeups-show .writeup-reading-rail :is(.wiki-doc-outline-rail,.writeup-meta-side) {
    position: static !important;
    grid-template-columns: minmax(0,1fr);
    max-height: none !important;
    overflow: visible !important;
    margin: 0 0 24px;
}
body[data-theme-area="frontend"] .contest-detail-page .contest-hero { display: grid; }
body[data-theme-area="frontend"] .contest-detail-page .contest-action-panel { width: 100%; min-width: 0; max-width: 100%; }
@media (max-width: 1100px) {
    body[data-theme-area="frontend"].route-writeups-show .doc-index.wiki-doc-layout.writeup-doc-layout { grid-template-columns: minmax(0,1fr) !important; }
    body[data-theme-area="frontend"].route-writeups-show .writeup-reading-rail { grid-column: 1; grid-row: 2; position: static; max-height: none; overflow: visible; }
}
@media (max-width: 760px) {
    body[data-theme-area="frontend"].route-writeups-show .writeup-doc-layout .writeup-reading-document { padding: 22px 18px !important; }
}

@media (max-width: 1100px) {
    body[data-theme-area="frontend"].route-writeups-show .writeup-reading-rail { display: contents; }
    body[data-theme-area="frontend"].route-writeups-show .writeup-doc-layout .writeup-reading-document { grid-row: 2 !important; }
    body[data-theme-area="frontend"].route-writeups-show .writeup-reading-rail > .wiki-doc-outline-rail { grid-column: 1 !important; grid-row: 1 !important; margin-bottom: 0; }
    body[data-theme-area="frontend"].route-writeups-show .writeup-reading-rail > .writeup-meta-side { grid-column: 1 !important; grid-row: 3 !important; }
}
