/* =========================================================
   normativ.css — KIU Rasmiy hujjatlar sahifasi
   Подключается через functions.php: wp_enqueue_style()
   ========================================================= */

/* ─── TOKENS ─────────────────────────────────────────────── */
:root {
    --nd-green:       #1D9E75;
    --nd-green-dark:  #0F6E56;
    --nd-green-bg:    #E1F5EE;
    --nd-dark:        #0F2C2C;
    --nd-text:        #2C2C2A;
    --nd-muted:       #5F5E5A;
    --nd-subtle:      #888780;
    --nd-border:      #E8E6DE;
    --nd-border-soft: #F1EFE8;
    --nd-bg:          #F7F6F2;
    --nd-white:       #ffffff;

    --nd-pdf-bg:      #FCEBEB;
    --nd-pdf-color:   #791F1F;
    --nd-pdf-border:  rgba(163, 45, 45, 0.2);

    --nd-sidebar-w:   220px;
    --nd-radius:      10px;
    --nd-radius-lg:   14px;
    --nd-radius-xl:   18px;
}

/* ─── LAYOUT ─────────────────────────────────────────────── */
.nd-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.nd-page {
    background: var(--nd-bg);
    padding: 48px 0 72px;
}

.nd-layout {
    display: grid;
    grid-template-columns: var(--nd-sidebar-w) 1fr;
    gap: 28px;
    align-items: start;
}

/* ─── BANNER ─────────────────────────────────────────────── */
.page-banner-area {
  background: url("../images/banner/1.webp") no-repeat 50% 50%;
  background-size: cover;
}
.nd-banner__overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 35, 30, 0.65);
}

.nd-banner__inner {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
}

.nd-banner__title {
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    font-weight: 700;
    color: #fff;
    margin: 0 0 10px;
    line-height: 1.25;
}

.nd-banner__sub {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.05em;
    margin: 0;
}

/* ─── SIDEBAR ────────────────────────────────────────────── */
.nd-sidebar {
    background: var(--nd-white);
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius-lg);
    overflow: hidden;
    position: sticky;
    top: 24px;
}

.nd-sidebar__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--nd-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--nd-text);
}

.nd-sidebar__icon {
    width: 16px;
    height: 16px;
    color: var(--nd-green);
    flex-shrink: 0;
}

.nd-sidebar__nav {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 2px;
}

/* Filter buttons */
.nd-filter-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: var(--nd-radius);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.nd-filter-btn:hover { background: var(--nd-green-bg); }

.nd-filter-btn.is-active { background: var(--nd-green); }

.nd-filter-btn__label {
    font-size: 13px;
    color: var(--nd-text);
    flex: 1;
    line-height: 1.35;
    transition: color 0.15s;
}

.nd-filter-btn.is-active .nd-filter-btn__label {
    color: #fff;
    font-weight: 500;
}

.nd-filter-btn__count {
    font-size: 11px;
    font-weight: 600;
    color: var(--nd-subtle);
    background: var(--nd-bg);
    border-radius: 20px;
    padding: 1px 7px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.nd-filter-btn.is-active .nd-filter-btn__count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Sort block */
.nd-sidebar__sort {
    border-top: 1px solid var(--nd-border);
    padding: 10px 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nd-sidebar__sort-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--nd-subtle);
    padding: 2px 4px;
    margin: 0 0 2px;
}

.nd-sort-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 7px 10px;
    background: transparent;
    border: none;
    border-radius: var(--nd-radius);
    cursor: pointer;
    font-size: 13px;
    color: var(--nd-muted);
    text-align: left;
    transition: background 0.15s, color 0.15s;
}

.nd-sort-btn:hover { background: var(--nd-bg); color: var(--nd-text); }

.nd-sort-btn.is-active {
    background: var(--nd-green-bg);
    color: var(--nd-green-dark);
    font-weight: 500;
}

/* ─── MAIN ───────────────────────────────────────────────── */
.nd-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header row */
.nd-main__header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nd-main__title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.nd-main__title {
    font-size: 17px;
    font-weight: 600;
    color: var(--nd-text);
    margin: 0;
    line-height: 1.35;
}

.nd-main__count {
    font-size: 13px;
    color: var(--nd-subtle);
    white-space: nowrap;
}

/* Search */
.nd-main__search { position: relative; }

.nd-search__icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--nd-subtle);
    pointer-events: none;
}

.nd-search__input {
    width: 100%;
    padding: 9px 14px 9px 34px;
    font-size: 13px;
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius);
    background: var(--nd-white);
    color: var(--nd-text);
    outline: none;
    transition: border-color 0.18s;
}

.nd-search__input:focus { border-color: var(--nd-green); }

/* ─── GRID ───────────────────────────────────────────────── */
.nd-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ─── CARD ───────────────────────────────────────────────── */
.nd-card {
    background: var(--nd-white);
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.nd-card:hover {
    border-color: var(--nd-green);
    box-shadow: 0 4px 18px rgba(29, 158, 117, 0.08);
}

/* Preview zone */
.nd-card__preview {
    position: relative;
    height: 140px;
    background: var(--nd-border-soft);
    overflow: hidden;
    flex-shrink: 0;
}

.nd-card__thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
    transition: transform 0.3s;
}

.nd-card:hover .nd-card__thumb { transform: scale(1.04); }

/* PDF icon placeholder */
.nd-card__icon-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F5F3EE;
}

.nd-card__icon-wrap svg {
    width: 52px;
    height: 52px;
    color: #C0BDB4;
}

/* Category badge */
.nd-card__cat-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    background: rgba(15, 44, 44, 0.72);
    color: #fff;
    letter-spacing: 0.02em;
    backdrop-filter: blur(4px);
}

/* Card body */
.nd-card__body {
    padding: 12px 14px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nd-card__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--nd-text);
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nd-card__title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.18s;
}

.nd-card__title a:hover { color: var(--nd-green); }

.nd-card__excerpt {
    font-size: 12px;
    color: var(--nd-muted);
    line-height: 1.55;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nd-card__date {
    font-size: 11px;
    color: var(--nd-subtle);
    display: block;
    margin-top: auto;
    padding-top: 4px;
}

/* Card footer */
.nd-card__footer {
    padding: 10px 14px;
    border-top: 1px solid var(--nd-border-soft);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* PDF button */
.nd-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    background: var(--nd-pdf-bg);
    color: var(--nd-pdf-color);
    border: 1px solid var(--nd-pdf-border);
    border-radius: var(--nd-radius);
    text-decoration: none;
    transition: opacity 0.18s;
    white-space: nowrap;
    justify-content: center;
}

.nd-pdf-btn:hover { opacity: 0.8; }

.nd-pdf-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* QR button */
.nd-qr-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 10px;
    background: var(--nd-bg);
    color: var(--nd-subtle);
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius);
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s;
    white-space: nowrap;
}

.nd-qr-btn:hover,
.nd-qr-btn[aria-expanded="true"] {
    border-color: var(--nd-green);
    color: var(--nd-green);
}

.nd-qr-btn svg {
    width: 15px;
    height: 15px;
}

/* QR panel */
.nd-qr-panel {
    width: 100%;
    padding: 12px 14px;
    border-top: 1px solid var(--nd-border-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--nd-bg);
}

.nd-qr-img {
    width: 120px;
    height: 120px;
    display: block;
    border-radius: 8px;
    border: 1px solid var(--nd-border);
}

.nd-qr-hint {
    font-size: 11px;
    color: var(--nd-subtle);
}

/* No PDF */
.nd-no-pdf {
    font-size: 12px;
    color: var(--nd-subtle);
    font-style: italic;
}

/* ─── EMPTY STATE ────────────────────────────────────────── */
.nd-empty {
    text-align: center;
    padding: 56px 20px;
    background: var(--nd-white);
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius-lg);
    color: var(--nd-muted);
}

.nd-empty svg {
    width: 44px;
    height: 44px;
    opacity: 0.3;
    display: block;
    margin: 0 auto 14px;
}

.nd-empty p {
    font-size: 15px;
    margin-bottom: 16px;
}

.nd-empty button {
    font-size: 13px;
    font-weight: 500;
    color: var(--nd-green);
    background: var(--nd-green-bg);
    border: 1px solid rgba(29, 158, 117, 0.25);
    border-radius: var(--nd-radius);
    padding: 8px 18px;
    cursor: pointer;
    transition: background 0.18s;
}

.nd-empty button:hover { background: #c8eddf; }

/* ─── EXTRA CONTENT ──────────────────────────────────────── */
.nd-extra {
    padding-top: 40px;
    padding-bottom: 60px;
}

.nd-extra > * + * { margin-top: 1rem; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */

/* 1024px: сетка 2 col */
@media (max-width: 1024px) {
    .nd-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 860px: боковой бар горизонтально наверху */
@media (max-width: 860px) {
    .nd-layout { grid-template-columns: 1fr; }

    .nd-sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: start;
        border-radius: var(--nd-radius-lg);
    }

    .nd-sidebar__header { grid-column: 1 / -1; }

    .nd-sidebar__nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 10px;
        gap: 6px;
    }

    .nd-filter-btn {
        width: auto;
        padding: 6px 12px;
        border-radius: 20px;
        border: 1px solid var(--nd-border);
    }

    .nd-filter-btn.is-active { border-color: var(--nd-green); }

    .nd-filter-btn__count { display: none; }

    .nd-sidebar__sort {
        border-top: none;
        border-left: 1px solid var(--nd-border);
        padding: 10px 12px;
        justify-content: center;
    }
}

/* 600px: сетка 1 col, QR меньше */
@media (max-width: 600px) {
    .nd-grid { grid-template-columns: 1fr; }

    .nd-sidebar { grid-template-columns: 1fr; }
    .nd-sidebar__sort { border-left: none; border-top: 1px solid var(--nd-border); flex-direction: row; flex-wrap: wrap; align-items: center; }
    .nd-sidebar__sort-label { margin: 0 6px 0 0; }

    .nd-card__preview { height: 120px; }

    .nd-banner { padding: 60px 20px; }
    .nd-container { padding: 0 16px; }
    .nd-page { padding: 32px 0 56px; }
}

/* 400px */
@media (max-width: 400px) {
    .nd-pdf-btn { flex: none; width: 100%; }
    .nd-qr-btn  { width: 100%; justify-content: center; }
    .nd-card__footer { flex-direction: column; }
}