/* Shared preview and manual sidebar-ad geometry. */
.ad-banner-row { padding-block: 28px; }
.ad-banner-row--page-bottom { margin-block: 16px 0; }
.ad-slot { container-type: inline-size; min-width: 0; color: var(--muted); text-align: center; }
.ad-slot--banner { width: min(728px,100%); margin-inline: auto; }
.ad-slot--rectangle { width: min(300px,100%); margin-inline: auto; flex: none; }
.ad-slot-label { display: block; margin-bottom: 8px; font: 400 10px/14px var(--body-font); letter-spacing: .08em; text-transform: uppercase; }
.ad-placeholder { box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; margin-inline: auto; border: 1px dashed var(--border); background: color-mix(in srgb,var(--raised) 65%,var(--surface)); color: var(--muted); font: 400 12px/18px var(--body-font); }
.ad-placeholder-size { font-size: 11px; font-variant-numeric: tabular-nums; }
.ad-slot--banner .ad-placeholder { width: 234px; height: 60px; }
.ad-slot--banner .ad-placeholder-size::after { content: "234 × 60"; }
.ad-slot--rectangle .ad-placeholder { width: 250px; height: 250px; }
.ad-slot--rectangle .ad-placeholder-size::after { content: "250 × 250"; }
@container (min-width: 300px) {
  .ad-slot--banner .ad-placeholder { width: 300px; height: 100px; }
  .ad-slot--banner .ad-placeholder-size::after { content: "300 × 100"; }
  .ad-slot--rectangle .ad-placeholder { width: 300px; height: 250px; }
  .ad-slot--rectangle .ad-placeholder-size::after { content: "300 × 250"; }
}
@container (min-width: 320px) {
  .ad-slot--banner .ad-placeholder { width: 320px; height: 100px; }
  .ad-slot--banner .ad-placeholder-size::after { content: "320 × 100"; }
}
@container (min-width: 468px) {
  .ad-slot--banner .ad-placeholder { width: 468px; height: 60px; }
  .ad-slot--banner .ad-placeholder-size::after { content: "468 × 60"; }
}
@container (min-width: 728px) {
  .ad-slot--banner .ad-placeholder { width: 728px; height: 90px; }
  .ad-slot--banner .ad-placeholder-size::after { content: "728 × 90"; }
}

/* Reserve a real 300px rail, outside the card padding. */
.forum-index-layout,.forum-thread-layout { grid-template-columns: minmax(0,1fr) 300px; gap: 32px; }
.forum-sidebar-rail { grid-column: 2; grid-row: 1; }
.forum-sidebar-rail,.forum-thread-layout>.thread-sidebar { display: flex; flex-direction: column; align-self: start; gap: 32px; min-width: 0; position: static; max-height: none; overflow: visible; }
.forum-sidebar-rail>.forum-sidebar { flex: 0 1 auto; position: static; max-height: none; width: 100%; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; }
.thread-sidebar-controls { min-width: 0; min-height: 0; flex: 0 1 auto; }
.thread-sidebar-controls>.forum-sidebar-note:last-child { margin-bottom: 0; }
.thread-sidebar-controls>.subscription-form:last-child { padding-bottom: 0; }
.detail-layout { grid-template-columns: 150px minmax(0,1fr) 300px; }
.reference-sidebar>.ad-slot { margin-top: 32px; }

/* Only the controls scroll. A sticky ad remains fully visible and unclipped. */
@media (min-width: 1101px) and (min-height: 600px) and (hover: hover) and (pointer: fine) {
  .forum-sidebar-rail,.forum-thread-layout>.thread-sidebar { position: sticky; top: 24px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); }
  .thread-sidebar-controls { overflow-y: auto; overscroll-behavior-y: contain; }
}
@media (max-width: 1100px) {
  .detail-layout { grid-template-columns: minmax(0,1fr) 300px; gap: 28px; }
  .detail-layout>.contents { display: none; }
  .forum-index-layout { grid-template-columns: minmax(0,1fr); gap: 20px; }
  .forum-sidebar-rail { display: contents; }
  .forum-sidebar-rail>.forum-sidebar { display: flex; grid-column: 1; grid-row: 1; gap: 6px; border: 0; padding: 0 0 6px; background: transparent; overflow-x: auto; }
  .forum-sidebar .forum-category-link { white-space: nowrap; flex: none; margin: 0; }
  .forum-topic-panel { grid-column: 1; grid-row: 2; }
  .forum-sidebar-rail>.ad-slot { grid-column: 1; grid-row: 3; margin-top: 16px; }
  .forum-thread-layout { grid-template-columns: minmax(0,1fr); }
  .forum-thread-layout>.thread-sidebar { display: grid; grid-template-columns: minmax(0,1fr) 300px; align-items: start; gap: 32px; }
}
@media (max-width: 1000px) {
  .detail-layout { display: flex; flex-direction: column; gap: 28px; }
  .reference-sidebar { display: contents; }
  .entry-reference-details { order: -1; width: 100%; }
  .entry-reference-details>.reference-infobox,.entry-reference-details>.source-card { max-width: 360px; margin-inline: auto; }
  .detail-layout>.article-body { order: 1; }
  .reference-sidebar>.ad-slot { order: 2; margin-block: 8px 16px; }
}
@media (max-width: 760px) {
  .ad-banner-row { padding-block: 24px; }
  .forum-thread-layout>.thread-sidebar { grid-template-columns: minmax(0,1fr); }
  .thread-sidebar-controls { display: grid; gap: 24px; }
  .thread-sidebar-controls>.forum-sidebar-note { margin: 0; }
  .thread-sidebar-controls>.subscription-form { padding: 0; }
  .forum-sidebar .forum-category-link { padding-inline: 12px; }
}

.ad-slot[hidden],.ad-slot--live:has(ins[data-ad-status="unfilled"]) { display:none; }
.tool-sidebar-layout { display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:32px; align-items:start; }
.tool-page-main { min-width:0; }
.tool-ad-sidebar { min-width:0; padding-top:8px; }
@media (max-width:1100px) {
  .tool-sidebar-layout { grid-template-columns:minmax(0,1fr); }
  .tool-ad-sidebar { padding-top:0; }
}
