/*
 * /data/instruments/ — the searchable, filterable table of individual
 * loan instruments.
 *
 * Built on the same ref-* tokens as /sources/ and /methodology/, extended
 * with a responsive table and export controls.
 */

/* ── hero ─────────────────────────────────────────────────────────── */

.inst-hero {
    background: #0A0E27;
    padding: 3.5rem 0 2.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.inst-eyebrow {
    margin: 0 0 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #34D399;
}

.inst-title {
    margin: 0 0 0.9rem;
    font-size: clamp(1.9rem, 4vw, 2.9rem);
    line-height: 1.12;
    color: #F1F5F9;
}

.inst-lede {
    max-width: var(--measure);
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-md);
    line-height: 1.65;
    color: #CBD5E1;
}

/* ── disclaimer + glossary ────────────────────────────────────────── */

.inst-disclaimer {
    font-size: 0.9rem;
    color: #94A3B8;
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.inst-glossary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #CBD5E1;
}

.inst-glossary dl {
    margin: 0.5rem 0 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
}

.inst-glossary dt { font-weight: 600; color: #F1F5F9; }
.inst-glossary dd { margin: 0; }

/* ── body ─────────────────────────────────────────────────────────── */

.inst-body {
    background: #0A0E27;
    padding: 2.5rem 0 4rem;
    color: #CBD5E1;
}

/* ── summary bar ──────────────────────────────────────────────────── */

.inst-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.9rem;
    margin: 0 0 1.75rem;
}

.inst-summary-item {
    padding: 0.9rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.055);
}

.inst-summary-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    display: block;
    font-size: var(--t-2xl);
    color: #F1F5F9;
}

.inst-summary-label {
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    color: #94A3B8;
}

/* ── filters ──────────────────────────────────────────────────────── */

.inst-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.7rem;
    margin: 0 0 1.75rem;
}

.inst-filter { display: flex; flex-direction: column; gap: 0.3rem; }

.inst-filter-label {
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #94A3B8;
}

.inst-filter select,
.inst-filter input[type="text"] {
    min-height: 2.5rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: var(--r-control, 8px);
    background: rgba(255, 255, 255, 0.055);
    font-family: 'Inter', sans-serif;
    font-size: var(--t-sm);
    color: #F1F5F9;
}

.inst-filter select option { color: #0A0E27; background: #FFFFFF; }

.inst-filter-apply {
    min-height: 2.5rem;
    padding: 0.35rem 1.1rem;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--r-control, 8px);
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-sm);
    font-weight: 600;
    color: #34D399;
    cursor: pointer;
}

.inst-filter-clear {
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    color: #34D399;
}

/* ── export bar ───────────────────────────────────────────────────── */

.inst-export {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1.25rem;
}

.inst-export-label {
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #94A3B8;
}

.inst-export a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: var(--r-control, 8px);
    font-family: 'Inter', sans-serif;
    font-size: var(--t-xs);
    font-weight: 600;
    color: #F1F5F9;
    text-decoration: none;
}

.inst-export a:hover {
    border-color: rgba(16, 185, 129, 0.3);
    color: #34D399;
}

/* ── table ────────────────────────────────────────────────────────── */

.inst-table-wrap {
    overflow-x: auto;
    margin: 0 0 2rem;
    -webkit-overflow-scrolling: touch;
}

.inst-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-sm);
}

.inst-table th {
    position: sticky;
    top: 0;
    padding: 0.75rem 0.9rem;
    text-align: left;
    font-weight: 700;
    font-size: var(--t-xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94A3B8;
    background: #0A0E27;
    border-bottom: 2px solid rgba(255, 255, 255, 0.13);
    white-space: nowrap;
}

.inst-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #E2E8F0;
    vertical-align: top;
}

.inst-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.inst-table .inst-amount {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.inst-table .inst-year {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.inst-table .inst-project {
    min-width: 200px;
    max-width: 350px;
    color: #F1F5F9;
    font-weight: 500;
}

.inst-sector-badge,
.inst-tier-badge,
.inst-status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: var(--t-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.inst-sector-badge {
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34D399;
}

.inst-tier-badge {
    background: rgba(96, 165, 250, 0.14);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #60A5FA;
}

.inst-status-badge {
    background: rgba(251, 191, 36, 0.14);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #FBBF24;
}

.inst-empty {
    padding: 3rem 0;
    font-family: 'Inter', sans-serif;
    font-size: var(--t-base);
    color: #94A3B8;
    text-align: center;
}

/* ── pagination ──────────────────────────────────────────────────── */

.inst-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 1.5rem 0 0;
}

.inst-page-link {
    font-family: 'Inter', sans-serif;
    font-size: var(--t-sm);
    font-weight: 600;
    color: #34D399;
    text-decoration: none;
}

.inst-page-link:hover { text-decoration: underline; }

.inst-page-info {
    font-family: 'Inter', sans-serif;
    font-size: var(--t-sm);
    color: #94A3B8;
}

/* ── touch ────────────────────────────────────────────────────────── */

@media (pointer: coarse) {
    .inst-filter select,
    .inst-filter input[type="text"],
    .inst-filter-apply { min-height: 2.75rem; }
}

@media (max-width: 640px) {
    .inst-hero { padding: 2.25rem 0 1.5rem; }
    .inst-table { font-size: var(--t-xs); }
    .inst-table th,
    .inst-table td { padding: 0.55rem 0.5rem; }
}
