/* =============================================================
   AHPDF System — Stylesheet
   All rules prefixed with .ahpdf- to prevent CSS conflicts.
   Add to your existing external stylesheet.
   Inherits site fonts and base colours by design.
   ============================================================= */

/* -------------------------------------------------------
   Wrapper
------------------------------------------------------- */
.ahpdf-wrapper {
    margin: 1.5rem 0;
}

/* -------------------------------------------------------
   Document grid — 3 columns large, 2 medium, 1 small
------------------------------------------------------- */
.ahpdf-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* -------------------------------------------------------
   Individual item — full card height
------------------------------------------------------- */
.ahpdf-item {
    margin: 0;
    padding: 0;
    display: flex;
}

/* -------------------------------------------------------
   Link card
------------------------------------------------------- */
.ahpdf-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 1rem;
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ahpdf-link:hover,
.ahpdf-link:focus-visible {
    background-color: #f0f4ff;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.2);
    outline: none;
}

/* WCAG 2.4.11 focus ring */
.ahpdf-link:focus-visible {
    outline: 3px solid #4a6cf7;
    outline-offset: 2px;
}

/* -------------------------------------------------------
   PDF icon
------------------------------------------------------- */
.ahpdf-icon {
    font-size: 2rem;
    color: #c0392b;
    line-height: 1;
}

/* -------------------------------------------------------
   Link body
------------------------------------------------------- */
.ahpdf-link-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.ahpdf-title {
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.4;
    color: #1a1a2e;
    word-break: break-word;
}

/* -------------------------------------------------------
   Meta row
------------------------------------------------------- */
.ahpdf-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.75rem;
    font-size: 0.8rem;
    color: #555e6d;
}

.ahpdf-meta-label {
    font-weight: 600;
    margin-right: 0.2em;
}

/* -------------------------------------------------------
   Badges
------------------------------------------------------- */
.ahpdf-badge {
    flex-shrink: 0;
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2em 0.55em;
    border-radius: 4px;
    background-color: #c0392b;
    color: #ffffff;
    line-height: 1.4;
}

.ahpdf-badge--archive {
    background-color: #5a6378;
}

.ahpdf-badge--category {
    background-color: #222222;
}

/* -------------------------------------------------------
   Empty state
------------------------------------------------------- */
.ahpdf-empty {
    font-style: italic;
    color: #6b7280;
    margin: 0.5rem 0;
}

/* -------------------------------------------------------
   Archive section wrapper
------------------------------------------------------- */
.ahpdf-archive-wrapper {
    margin-top: 1.75rem;
    border-top: 2px solid #e5e7eb;
    padding-top: 1rem;
}

/* -------------------------------------------------------
   Archive toggle button
------------------------------------------------------- */
.ahpdf-archive-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    color: #374151;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    line-height: 1.4;
}

.ahpdf-archive-toggle:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}

.ahpdf-archive-toggle:focus-visible {
    outline: 3px solid #4a6cf7;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.2);
}

.ahpdf-archive-toggle-icon {
    color: #5a6378;
    font-size: 1rem;
}

.ahpdf-archive-count {
    font-weight: 400;
    color: #374151;
    font-size: 0.875rem;
}

.ahpdf-toggle-chevron {
    font-size: 0.75rem;
    color: #6b7280;
    margin-left: 0.15rem;
    transition: transform 0.2s ease;
}

.ahpdf-archive-toggle[aria-expanded="true"] .ahpdf-toggle-chevron {
    transform: rotate(180deg);
}

/* -------------------------------------------------------
   Archive panel
------------------------------------------------------- */
.ahpdf-archive-panel {
    margin-top: 1rem;
}

.ahpdf-archive-panel[hidden] {
    display: none !important;
}

.ahpdf-list--archive .ahpdf-link {
    background-color: #f9fafb;
    border-color: #e5e7eb;
}

.ahpdf-list--archive .ahpdf-link:hover,
.ahpdf-list--archive .ahpdf-link:focus-visible {
    background-color: #f0f4ff;
    border-color: #4a6cf7;
}

.ahpdf-list--archive .ahpdf-title {
    color: #374151;
}

/* -------------------------------------------------------
   Responsive — 2 columns at medium
------------------------------------------------------- */
@media (max-width: 900px) {
    .ahpdf-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* -------------------------------------------------------
   Responsive — 1 column at narrow
------------------------------------------------------- */
@media (max-width: 480px) {
    .ahpdf-list {
        grid-template-columns: 1fr;
    }
}