/* Keep each worksheet and its answer guide in one compact download group. */
body.math-pdf-previews .pdf-preview-files:has(>.math-resource-card),
body.math-compact.math-pdf-previews .pdf-preview-files:has(>.math-resource-card){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;gap:10px;width:100%;max-width:660px;min-width:0}
body .math-resource-pair,
body.math-pdf-previews :is(.level-files,.unitdl).math-resource-pair,
body.math-compact.math-pdf-previews :is(.level-files,.unitdl).math-resource-pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;gap:8px;width:100%;max-width:660px;min-width:0;box-sizing:border-box;padding:8px;border:1px solid var(--line,#dce1f0);border-radius:10px;background:#fafbfe;break-inside:avoid}
body .pdf-preview-files>.math-resource-pair{grid-column:1/-1}
body .math-resource-pair:not(:has(>:nth-child(2))){grid-template-columns:minmax(0,1fr);max-width:330px}
body .math-resource-pair>.math-resource-pair-heading{grid-column:1/-1;padding:0;min-width:0}
body .math-resource-pair>.math-resource-pair-heading .math-resource-title{font-size:13px}
body .math-resource-files,
body.math-pdf-previews .level-files.math-resource-files,
body.math-compact.math-pdf-previews .level-files.math-resource-files{display:grid;grid-template-columns:minmax(0,1fr);align-items:start;gap:8px;min-width:0;width:100%;max-width:660px}
body .math-resource-files>.math-resource-card,body .math-resource-files>a.pdf-preview-link{max-width:330px}
body .math-resource-pair .math-resource-card .math-resource-details{padding-top:3px}
.math-resource-card{display:flex;flex-direction:column;align-items:stretch;width:100%;max-width:100%;min-width:0}
body.math-pdf-previews .math-resource-card>a.pdf-preview-link,
body.math-compact.math-pdf-previews .math-resource-card>a.pdf-preview-link,
body.math-pdf-previews .math-resource-pair>a.pdf-preview-link,
body.math-compact.math-pdf-previews .math-resource-pair>a.pdf-preview-link{display:flex;flex-direction:column;align-items:stretch;width:100%;max-width:100%;min-width:0;padding:0}
.math-resource-card>.dl{max-width:100%;box-sizing:border-box}
body.math-pdf-previews :is(.math-resource-card,.math-resource-pair) .math-pdf-preview{height:120px;aspect-ratio:auto}
body.math-pdf-previews .math-resource-pair .pdf-preview-label,
body.math-compact.math-pdf-previews .math-resource-pair .pdf-preview-label{width:100%;min-height:44px;padding:6px 8px;font-size:12px;line-height:1.4}
body .math-resource-pair .dl:not(.pdf-preview-link){min-height:44px;padding:6px 8px;font-size:12px;line-height:1.4;white-space:normal}
.math-resource-details{font-size:12px;line-height:1.45;color:#465570;padding:5px 2px 0;overflow-wrap:anywhere;min-width:0}
.math-resource-details .math-resource-title{font-family:var(--body);font-size:12px;line-height:1.4;font-weight:750;color:#293d59;margin:0 0 2px}
.math-resource-details .math-resource-description{font-family:var(--body);font-size:12px;line-height:1.45;font-weight:600;color:#52617b;margin:0 0 2px}
.math-resource-details .math-resource-meta{display:flex;flex-wrap:wrap;gap:0 8px;list-style:none;padding:0;margin:0;color:#52617b;font-size:12px;line-height:1.45}
.math-resource-details .math-resource-meta li{font-family:var(--body);font-size:12px;line-height:1.45;font-weight:600;color:inherit;margin:0;padding:0}
.math-resource-meta li+li::before{content:'·';padding-inline-end:6px;color:#657692}
.math-search-result-meta .math-resource-search-stats{display:block;margin-top:3px}
body .wsgroup:has(.math-resource-pair){gap:8px 14px;padding:10px 0}
body .wsgroup:has(.math-resource-pair)>.resource-level{flex-basis:150px}
body .wsgroup:has(.math-resource-pair) .resource-hint{margin-top:3px;font-size:12px;line-height:1.45}
body .level-sheets:has(.math-resource-pair){gap:8px;min-width:0}
body .sheet:has(>.math-resource-pair){gap:4px;width:100%;min-width:0}
body .sheet:has(>.math-resource-pair)>.sheet-num{flex-basis:100%;max-width:none;padding:0;font-size:12px;line-height:1.4;text-transform:none;letter-spacing:0}
body :is(#math-printables,#math-topic-printables)>.resource-note{margin-bottom:10px}
@media(max-width:800px){body .wsgroup:has(.math-resource-pair)>.resource-level{flex-basis:100%}body .wsgroup:has(.math-resource-pair)>:is(.level-files,.level-sheets){flex-basis:100%}}
@media(max-width:480px){
 body .math-resource-pair,
 body.math-pdf-previews :is(.level-files,.unitdl).math-resource-pair,
 body.math-compact.math-pdf-previews :is(.level-files,.unitdl).math-resource-pair{padding:6px;gap:6px}
 body.math-pdf-previews :is(.math-resource-card,.math-resource-pair) .math-pdf-preview{height:100px}
}
@media print{.math-resource-card,.math-resource-pair{break-inside:avoid}.math-resource-details{color:#222}.math-resource-card .math-pdf-preview{height:100px}}

/* Match download symbols to the existing Unit / Concept / Practice / Advanced labels. */
a[data-resource-theme]{--download-color:#8C86A8;--download-soft:#F1EFF7;--download-ink:#554D70}
a[data-resource-theme=concept]{--download-color:#3F9E6E;--download-soft:#EDF7F1;--download-ink:#24623F}
a[data-resource-theme=practice]{--download-color:#5A6CC2;--download-soft:#EAECFB;--download-ink:#35458E}
a[data-resource-theme=advanced]{--download-color:#C1662E;--download-soft:#FFF0E5;--download-ink:#884015}
body .math-download-icon{display:inline-block;width:22px;height:22px;min-width:22px;flex:0 0 22px;vertical-align:middle;color:var(--download-color);margin:0}
body a.dl[data-resource-theme]:not(.pdf-preview-link),
body.math-pdf-previews a.pdf-preview-link[data-resource-theme] .pdf-preview-label{display:flex;align-items:center;gap:.5rem;background:var(--download-soft);color:var(--download-ink);text-align:start}
body a.dl[data-resource-theme]:not(.pdf-preview-link){box-shadow:none;border:1px solid var(--line)}
body.math-pdf-previews a.pdf-preview-link[data-resource-theme]:hover{border-color:var(--download-color)}
body a.dl[data-resource-theme]:focus-visible{outline-color:var(--download-color)}

@media(max-width:480px){
 body .math-resource-pair .math-download-icon{width:18px;height:18px;min-width:18px;flex-basis:18px}
 body.math-pdf-previews .math-resource-pair a.pdf-preview-link[data-resource-theme] .pdf-preview-label{gap:6px;padding:6px}
 body .math-resource-pair a.dl[data-resource-theme]:not(.pdf-preview-link){gap:6px;padding:6px}
}
