/* ===== Constitution pages ===== */

.const-hero {
    min-height: 0;
    padding: 6rem 0 2rem;
    text-align: center;
}

.const-section {
    padding: 2.5rem 0 5rem;
}

.const-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* ---- Filters sidebar ---- */
.const-filters {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
}

.const-filters-card {
    background: var(--card, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.const-search-input {
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    border: 1.5px solid var(--border, #e2e8f0);
    font-size: 0.9rem;
    margin-bottom: 0.85rem;
}

.const-search-input:focus {
    outline: none;
    border-color: #2563eb;
}

#const-section-filters select {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    border: 1.5px solid var(--border, #e2e8f0);
    font-size: 0.86rem;
    margin-bottom: 0.65rem;
    background: #fff;
}

.const-clear-btn {
    width: 100%;
    padding: 0.55rem;
    border-radius: 10px;
    border: 1.5px solid var(--border, #e2e8f0);
    background: transparent;
    color: var(--text-muted, #64748b);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.const-clear-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

/* ---- Wide article cards ---- */
.const-main {
    flex: 1;
    min-width: 0;
    background: var(--card, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 16px;
    padding: 1.25rem;
    min-height: 320px;
}

.const-cards {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.const-card {
    display: block;
    background: var(--card, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.const-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    border-color: #2563eb;
}

.const-card-number {
    font-weight: 800;
    font-size: 1.05rem;
    color: #2563eb;
    margin-bottom: 0.35rem;
}

.const-card-path {
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
    margin-bottom: 0.65rem;
}

.const-card-text {
    font-size: 0.95rem;
    line-height: 1.85;
    color: var(--text, #1e293b);
    margin: 0 0 0.75rem;
}

.const-card-more {
    font-size: 0.82rem;
    font-weight: 600;
    color: #2563eb;
}

.const-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted, #64748b);
}

/* Infinite-scroll sentinel */
.const-sentinel {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

.const-spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid var(--border, #e2e8f0);
    border-top-color: #2563eb;
    animation: const-spin 0.8s linear infinite;
}

@keyframes const-spin {
    to { transform: rotate(360deg); }
}

/* ---- Article detail page ---- */
.const-article-section { padding-top: 3rem; }

.const-breadcrumb {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    margin-bottom: 1.5rem;
}

.const-breadcrumb a { color: #2563eb; text-decoration: none; }

.const-article-card {
    background: var(--card, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 820px;
}

.const-article-number { font-size: 1.4rem; }

.const-article-text {
    font-size: 1.1rem;
    line-height: 2.1;
    color: var(--text, #1e293b);
    white-space: pre-line;
    margin-top: 1rem;
}

.const-article-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 820px;
    margin-top: 1.5rem;
}

.const-article-nav-link {
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    border: 1.5px solid var(--border, #e2e8f0);
    text-decoration: none;
    color: var(--text, #1e293b);
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.const-article-nav-link:hover { border-color: #2563eb; color: #2563eb; }
.const-article-nav-all { background: #2563eb; color: #fff; border-color: #2563eb; }
.const-article-nav-all:hover { color: #fff; opacity: 0.9; }

@media (max-width: 860px) {
    .const-layout { flex-direction: column; }
    .const-filters { width: 100%; position: static; }
    .const-article-card { padding: 1.5rem; }
}

/* Tablet: search + the dynamically-built باب/فصل/فرع <select>s + the clear
   button sit in one row instead of stacked full-width blocks (the default
   set above, still used on phones) - there's enough width on a tablet to
   not spend a big chunk of vertical space on the filter bar alone. */
@media (min-width: 601px) and (max-width: 860px) {
    .const-filters-card {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.6rem;
    }

    .const-search-input {
        flex: 1 1 220px;
        margin-bottom: 0;
    }

    #const-section-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 0.6rem;
        flex: 2 1 320px;
    }

    #const-section-filters select {
        width: auto;
        flex: 1 1 140px;
        margin-bottom: 0;
    }

    .const-clear-btn {
        width: auto;
        flex-shrink: 0;
    }
}
