@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ══════════════════════════════════════════════════════
   ADSSU e-Governing Board Management System — Public Articles Pages
   Brand palette: Green #067a43 · Gold #d4a31b
   ══════════════════════════════════════════════════════ */

:root {
    --pa-green: #067a43;
    --pa-green-deep: #035a31;
    --pa-green-soft: #e8f5ec;
    --pa-green-mid: #0d8e4f;
    --pa-gold: #d4a31b;
    --pa-gold-soft: #f6ebc7;
    --pa-ink: #1a1a2e;
    --pa-muted: #5a6275;
    --pa-surface: #ffffff;
    --pa-page-bg: #f4f5f7;
    --pa-border: rgba(0, 0, 0, 0.08);
    --pa-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --pa-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --pa-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.1);
    --pa-radius: 12px;
    --pa-radius-lg: 16px;
}

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--pa-ink);
    background: var(--pa-page-bg);
    -webkit-font-smoothing: antialiased;
}

/* ── Top navigation bar (green theme) ────────────────── */
.pa-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0 2rem;
    height: 60px;
    background: var(--pa-green);
    box-shadow: 0 4px 20px rgba(6, 122, 67, 0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

.pa-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    flex-shrink: 1;
    min-width: 0;
}

.pa-brand-logo {
    width: 50.4px;
    height: 50.4px;
    border-radius: 0;
    object-fit: contain; filter: drop-shadow(1px 0 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 1px 0 #fff) drop-shadow(0 -1px 0 #fff);
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.pa-brand-name {
    max-width: clamp(18rem, 34vw, 28rem);
    font-size: 0.88rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1.15;
}

.pa-nav {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
    margin-left: auto;
}

.pa-nav-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    height: 100%;
    padding: 0 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88rem;
    position: relative;
    transition: color 0.2s ease, background 0.2s ease;
}

.pa-nav-link:hover,
.pa-nav-link.is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.pa-nav-link.is-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0.5rem;
    right: 0.5rem;
    height: 3px;
    background: var(--pa-gold);
    border-radius: 3px 3px 0 0;
}

.pa-nav-link svg { width: 16px; height: 16px; opacity: 0.8; }

/* ── Articles dropdown ────────────────────────────────── */
.pa-dropdown { position: relative; height: 100%; }
.pa-dropdown-toggle { cursor: pointer; }

.pa-dropdown-toggle::before {
    content: '';
    display: inline-block;
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    margin-left: 0.35rem;
    vertical-align: middle;
    opacity: 0.7;
}

.pa-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 210px;
    background: #fff;
    border-radius: 0 0 var(--pa-radius) var(--pa-radius);
    box-shadow: var(--pa-shadow-lg);
    border: 1px solid var(--pa-border);
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    z-index: 200;
}

.pa-dropdown:hover .pa-dropdown-menu,
.pa-dropdown:focus-within .pa-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pa-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.15rem;
    color: var(--pa-ink);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.15s ease;
}

.pa-dropdown-item:hover {
    background: rgba(6, 122, 67, 0.06);
    color: var(--pa-green);
}

.pa-dropdown-item svg { width: 16px; height: 16px; opacity: 0.5; flex-shrink: 0; }

/* Category with nothing published: visible but inert. pointer-events:none
   keeps the :hover rule above from matching and lets the pointer fall through
   to .pa-dropdown-menu, so crossing a disabled row never closes the menu. */
.pa-dropdown-item.is-disabled {
    color: var(--pa-muted);
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.pa-dropdown-hint {
    margin-left: auto;
    padding-left: 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    font-style: italic;
    white-space: nowrap;
}

.pa-dropdown-divider {
    height: 1px;
    background: var(--pa-border);
    margin: 0.35rem 0;
}

/* ── Nav right actions ────────────────────────────────── */
.pa-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pa-nav-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: #fff;
    text-decoration: none;
}

.pa-nav-user-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.pa-nav-user:hover .pa-nav-user-circle {
    background: rgba(255, 255, 255, 0.28);
}

.pa-nav-user-circle svg { width: 17px; height: 17px; }

.pa-nav-user-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
}

.pa-nav-user:hover .pa-nav-user-label { color: #fff; }

/* ── Page layout ─────────────────────────────────────── */
.pa-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.pa-page-header { margin-bottom: 1.75rem; }

.pa-page-header h1 {
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--pa-ink);
    margin: 0 0 1.25rem;
    letter-spacing: -0.04em;
    line-height: 1;
}

/* ── Filter pills ────────────────────────────────────── */
.pa-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pa-filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--pa-muted);
    margin-right: 0.25rem;
}

.pa-filter-pill {
    border: 1.5px solid var(--pa-border);
    border-radius: 999px;
    padding: 0.45rem 1.1rem;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--pa-muted);
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pa-filter-pill:hover {
    color: var(--pa-green);
    border-color: var(--pa-green);
    background: rgba(6, 122, 67, 0.04);
}

.pa-filter-pill.is-active {
    color: #fff;
    background: var(--pa-green);
    border-color: var(--pa-green);
    box-shadow: 0 4px 12px rgba(6, 122, 67, 0.3);
}

/* Must stay after :hover and .is-active — same specificity, so source order
   decides. Keeps the pill dimmed even at /articles?category=<empty one>. */
.pa-filter-pill:disabled {
    color: var(--pa-muted);
    background: #fff;
    border-color: var(--pa-border);
    opacity: 0.5;
    box-shadow: none;
    cursor: default;
}

/* ── Article grid ────────────────────────────────────── */
.pa-article-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
    margin-top: 0.5rem;
}

/* ── Article card ────────────────────────────────────── */
.pa-card {
    background: #fff;
    border-radius: var(--pa-radius-lg);
    overflow: hidden;
    border: 1px solid var(--pa-border);
    box-shadow: var(--pa-shadow-sm);
    display: flex;
    flex-direction: column;
    min-width: 0; /* allow the grid item to shrink below its content width */
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.pa-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--pa-shadow-lg);
}

.pa-card-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, var(--pa-green-soft) 0%, var(--pa-gold-soft) 50%, #e8f0fe 100%);
}

.pa-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.pa-card:hover .pa-card-image { transform: scale(1.06); }

.pa-card-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, rgba(6,122,67,0.08) 0%, rgba(212,163,27,0.06) 50%, rgba(25,58,122,0.04) 100%);
}

/* Category badge */
.pa-category {
    position: absolute;
    bottom: 0;
    left: 0;
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 1rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
}

.pa-category--announcements { background: var(--pa-green); }
.pa-category--news { background: #c42b2b; }
.pa-category--memoranda { background: var(--pa-gold); }
.pa-category--events { background: #0d7a8e; }
.pa-category--general { background: #5f6f89; }

/* Card body */
.pa-card-body {
    padding: 1.1rem 1.25rem 0.85rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pa-card-title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.02em;
    color: var(--pa-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pa-card-summary {
    margin: 0;
    color: var(--pa-muted);
    font-size: 0.88rem;
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pa-card-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.85rem;
    color: var(--pa-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.pa-card-meta svg { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.5; }

/* Card CTA button — brand green */
.pa-card-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.8rem 1rem;
    margin: 0.25rem 1rem 1rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 800;
    color: #fff;
    background: var(--pa-green);
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(6, 122, 67, 0.2);
}

.pa-card-cta:hover {
    color: #fff;
    background: var(--pa-green-deep);
    box-shadow: 0 6px 20px rgba(6, 122, 67, 0.35);
}

/* ── Empty state ─────────────────────────────────────── */
.pa-empty {
    padding: 3rem 1.5rem;
    border-radius: var(--pa-radius-lg);
    border: 2px dashed rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.7);
    color: var(--pa-muted);
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
}

/* ── Article detail ──────────────────────────────────── */
.pa-detail {
    max-width: 860px;
    margin: 0 auto;
    background: #fff;
    border-radius: var(--pa-radius-lg);
    border: 1px solid var(--pa-border);
    box-shadow: var(--pa-shadow-md);
    padding: 2rem;
}

.pa-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--pa-green);
    text-decoration: none;
    margin-bottom: 1.25rem;
    transition: color 0.2s ease;
}

.pa-detail-back:hover { color: var(--pa-green-deep); }

.pa-detail-hero {
    border-radius: var(--pa-radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.pa-detail-hero img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    display: block;
}

.pa-detail-header { margin-bottom: 1.75rem; }

.pa-detail-header h1 {
    margin: 0.75rem 0 0.65rem;
    font-size: 1.85rem;
    font-weight: 900;
    line-height: 1.25;
    letter-spacing: -0.03em;
    color: var(--pa-ink);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pa-detail-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--pa-muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.pa-detail-meta svg { width: 14px; height: 14px; opacity: 0.5; }

.pa-detail-body {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--pa-ink);
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ── Related articles ─────────────────────────────────── */
.pa-related-section {
    max-width: 1200px;
    margin: 2rem auto 0;
}

.pa-related-heading { margin-bottom: 1rem; }

.pa-related-heading .pa-section-kicker {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--pa-green);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.pa-related-heading h3 {
    margin: 0.25rem 0 0;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* ── Footer ──────────────────────────────────────────── */
.pa-footer {
    text-align: center;
    padding: 2rem 0 1rem;
    color: var(--pa-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

/* ── Mobile bottom tab bar (shared by all public pages) ──
   Hidden on desktop; revealed in the phone media query below. */
.lp-tabbar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: #fff;
    border-top: 1px solid var(--pa-border);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom));
}

.lp-tab {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.4rem 0;
    color: var(--pa-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
}

.lp-tab svg { width: 22px; height: 22px; }

.lp-tab.is-active { color: var(--pa-green); }

.lp-tab.is-active::before {
    content: "";
    position: absolute;
    top: 0;
    width: 34px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--pa-green);
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 991.98px) {
    .pa-article-grid { grid-template-columns: minmax(0, 1fr); }
    .pa-page-header h1 { font-size: 1.8rem; }
}

@media (max-width: 767.98px) {
    .pa-topbar { padding: 0.45rem 1rem; min-height: 58px; height: auto; }
    .pa-brand { min-width: 0; }
    .pa-brand-name {
        max-width: calc(100vw - 5.75rem);
        font-size: 0.78rem;
    }

    /* App-mode: brand-only header; navigation moves to the bottom tab bar. */
    .pa-nav,
    .pa-nav-actions { display: none; }

    .pa-main { padding: 1.25rem 1rem 2rem; }
    .pa-page-header h1 { font-size: 1.5rem; }
    .pa-detail { padding: 1.25rem; }
    .pa-detail-header h1 { font-size: 1.4rem; }

    /* Reveal the shared bottom tab bar; reserve space so content clears it. */
    .lp-tabbar { display: flex; }
    body { padding-bottom: 72px; }
}

@media (max-width: 575.98px) {
    .pa-brand { flex-shrink: 1; }
    .pa-brand-name {
        display: block;
        max-width: calc(100vw - 5.5rem);
        white-space: normal;
    }
    .pa-nav-link {
        padding: 0 0.45rem;
        font-size: 0.76rem;
        white-space: nowrap;
    }
    .pa-nav-link svg { width: 14px; height: 14px; }
    .pa-nav-actions { gap: 0.25rem; }
    .pa-nav-user {
        width: 32px;
        height: 32px;
        gap: 0;
    }
    .pa-nav-user-circle {
        width: 32px;
        height: 32px;
    }
    .pa-nav-user-label { display: none; }
    .pa-dropdown-menu { position: fixed; top: 54px; left: 0; right: 0; border-radius: 0 0 var(--pa-radius) var(--pa-radius); }
    .pa-filter-bar { gap: 0.35rem; }
    .pa-filter-pill { padding: 0.38rem 0.85rem; font-size: 0.78rem; }
}
