/* Page-only viewport constraint. Shared banner, navigation and footer retain their styles. */
html, body { height: 100%; overflow: hidden; }
.materials-main { height: var(--materials-height, calc(100dvh - 180px)); min-width: 0; display: flex; flex-direction: column; }
.materials-heading { text-align: center; flex-shrink: 0; margin: 4px 0 8px; }
.materials-heading h1 { display: inline-block; font-size: 1.05rem; font-weight: 700; margin: 2px auto 6px; padding: 2px 14px; color: #1e4620; background: rgba(46,125,50,.15); border: 1px solid rgba(46,125,50,.3); border-radius: 30px; backdrop-filter: blur(5px); }
.materials-panel { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; width: 100%; max-width: 800px; margin: 0 auto 10px; padding: 12px; background: #fff; border-radius: 15px; border: 1px solid rgba(0,0,0,.07); box-shadow: 0 10px 25px rgba(0,0,0,.05), 0 3px 10px rgba(0,0,0,.03); }
.library-intro { text-align: center; flex-shrink: 0; }
.library-intro h2 { font-size: 1.3rem; font-weight: 600; color: #2c3e50; margin: 0 0 3px; }
.library-intro p { font-size: .82rem; color: #666; margin: 0 0 14px; }
.resource-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); grid-template-rows: repeat(2,auto); gap: 10px; flex: 0 1 auto; min-height: 0; }
.resource-card { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 12px; background: #fcfefb; border: 1px solid #a9c5aa; border-radius: 12px; box-shadow: 0 2px 5px rgba(30,70,32,.07); transition: border-color .2s, box-shadow .2s; }
.resource-card:hover { border-color: #2e7d32; box-shadow: 0 4px 12px rgba(30,70,32,.12); }
.resource-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.resource-icon { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; background: #eaf5eb; color: #2e7d32; font-size: 22px; }
.resource-type { font-size: 9px; letter-spacing: .5px; color: #707b73; font-weight: 600; }
.resource-card h2 { font-size: 1rem; line-height: 1.35; color: #333; font-weight: 600; margin: 0 0 8px; }
.resource-card p { font-size: .78rem; line-height: 1.4; color: #666; margin: 0 0 10px; }
.resource-card h3 { font-size: .75rem; line-height: 1.4; font-weight: 500; color: #444; margin: 0 0 6px; }
.resource-card > .resource-actions, .resource-action { margin-top: auto; }
.resource-actions { display: flex; gap: 6px; }
.resource-actions > * { flex: 1; }
.resource-actions button, .resource-actions a, .resource-action { display: flex; align-items: center; justify-content: center; min-height: 32px; padding: 5px 8px; border-radius: 6px; border: 1px solid #d0e7d2; background: #eaf5eb; color: #1e4620; text-decoration: none; font-size: .72rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.resource-actions a, .resource-action.primary { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.resource-actions button:hover { background: #d0e7d2; }
.resource-actions a:hover, .resource-action.primary:hover { background: #1e4620; color: #fff; }
.resource-action.primary { gap: 12px; }
.resource-item { margin-top: 4px; padding-top: 0; }
.resource-item + .resource-item { border-top: 1px solid #d0dfd0; margin-top: 8px; padding-top: 8px; }
.edition-badge { display: inline-block; padding: 1px 5px; margin-left: 4px; border-radius: 4px; background: #eaf5eb; color: #2e7d32; font-size: 9px; }
.publications-card { grid-column: span 2; }
.library-note { flex-shrink: 0; padding-top: 10px; color: #777; font-size: .68rem; text-align: center; }
.resource-pager { display: none; }
.materials-main :where(a,button):focus-visible, #pdfPreview :where(a,button):focus-visible { outline: 3px solid #76a978; outline-offset: 2px; }
.materials-main.is-compact .resource-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
.materials-main.is-compact .resource-card { display: none; }
.materials-main.is-compact .resource-card.is-current { display: flex; grid-column: auto; }
.materials-main.is-compact .resource-pager { display: flex; justify-content: center; align-items: center; gap: 18px; padding-top: 8px; font-size: 12px; color: #1e4620; }
.resource-pager button { width: 36px; height: 30px; border: 1px solid #d0e7d2; border-radius: 6px; background: #eaf5eb; color: #1e4620; cursor: pointer; }
.resource-pager button:disabled { opacity: .35; cursor: default; }
.materials-main.is-short .library-intro, .materials-main.is-short .library-note, .materials-main.is-short .resource-top, .materials-main.is-short .resource-card > p { display: none; }
.materials-main.is-short .materials-panel { padding: 10px; }
.materials-main.is-short .resource-card { padding: 8px; }
.materials-main.is-short .resource-card h2 { font-size: .9rem; margin-bottom: 4px; }
#pdfPreview { width: min(1100px,96vw); height: 94vh; height: 94dvh; max-height: 94dvh; padding: 0; border: 1px solid #d0e7d2; border-radius: 14px; overflow: hidden; color: #1e4620; }
#pdfPreview[open] { display: flex; flex-direction: column; }
#pdfPreview::backdrop { background: rgba(0,0,0,.65); }
.preview-header, .preview-footer { display: flex; align-items: center; gap: 14px; padding: 12px 18px; flex-shrink: 0; }
.preview-header h2 { font-size: 16px; margin: 0; flex: 1; }
.preview-header button { border: none; background: #eaf5eb; border-radius: 6px; width: 36px; height: 36px; font-size: 24px; }
#pdfIframe { flex: 1; min-height: 0; width: 100%; border: 0; background: #f8fafc; }
.preview-footer { font-size: 12px; }
.preview-footer span { flex: 1; }
.preview-footer a { color: #2e7d32; text-decoration: underline; white-space: nowrap; }
@media (max-width: 767px) {
.materials-panel { padding: 12px; }
.preview-footer { flex-wrap: wrap; gap: 8px; }
.preview-footer span { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .resource-card { transition: none; } }
