.resource-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.resource-page main {
    flex: 1;
}

.resource-hero {
    padding: calc(85px + clamp(2rem, 5vw, 3.5rem)) 0 clamp(2.5rem, 6vw, 4rem);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

.resource-hero h1 {
    color: var(--white);
}

.resource-hero p {
    max-width: 48ch;
    margin-top: var(--space-2);
    color: var(--primary-muted);
}

.resource-page-listing,
.resources-home {
    padding-block: clamp(2.5rem, 6vw, 5rem);
    background: var(--bg-secondary);
}

.resource-page-listing {
    min-height: 20rem;
}

.resource-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6);
}

.resource-panel {
    min-width: 0;
    padding: clamp(1.25rem, 3vw, 2rem);
    background: var(--white);
    border: 1px solid var(--border-light);
    border-top: 3px solid var(--primary-color);
    border-radius: var(--radius-lg);
}

.resource-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.resource-panel-header h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.resource-panel-header a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.resource-list {
    display: grid;
    gap: var(--space-4);
}

.resource-page-listing .resource-list {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
}

.resource-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    min-width: 0;
    padding: var(--space-5);
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.resources-home .resource-card {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: var(--space-4);
    background: var(--bg-secondary);
}

.resource-card-body {
    min-width: 0;
    overflow-wrap: anywhere;
}

.resources-home .resource-card-body {
    flex: 1 1 12rem;
}

.resource-card-title {
    font-size: 1.25rem;
    line-height: 1.35;
}

.resource-card-meta {
    margin-top: var(--space-1);
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 600;
}

.resource-card-description {
    margin-top: var(--space-2);
}

.resource-card-action {
    flex-shrink: 0;
}

.resource-list-message {
    padding: var(--space-4) 0;
}

.resource-reader {
    position: fixed;
    inset: 0;
    width: min(72rem, calc(100% - 2rem));
    height: min(54rem, calc(100% - 2rem));
    max-width: none;
    max-height: none;
    margin: auto;
    padding: 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--white);
    color: var(--text-primary);
    box-shadow: var(--shadow-xl);
}

.resource-reader[open] {
    display: flex;
    flex-direction: column;
}

.resource-reader::backdrop {
    background: rgba(15, 28, 22, 0.75);
}

html:has(.resource-reader[open]) {
    overflow: hidden;
}

.resource-reader-header,
.resource-reader-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.resource-reader-header {
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-light);
}

.resource-reader-header h2 {
    flex: 1 1 14rem;
    min-width: 0;
    font-size: clamp(1.125rem, 2.5vw, 1.5rem);
    overflow-wrap: anywhere;
}

.resource-reader-status {
    padding: var(--space-5);
}

.resource-reader iframe {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 0;
}

.resource-reader [hidden] {
    display: none;
}

@media (max-width: 760px) {
    .resource-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .resource-reader {
        width: calc(100% - 1rem);
        height: calc(100% - 1rem);
    }

    .resource-reader-header {
        padding: var(--space-3);
    }

    .resource-reader-actions .btn {
        padding-inline: var(--space-3);
        white-space: normal;
    }
}
