*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #09090b;
    --bg-secondary: #0f0f11;
    --bg-tertiary: #16161a;
    --bg-hover: #1c1c21;
    --border: #27272a;
    --border-light: #3f3f46;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #3b82f6;
    --accent-dim: #1e40af;
    --negative: #ef4444;
    --neutral: #eab308;
    --positive: #22c55e;
}

html {
    font-size: 15px;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-mark {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.05em;
    padding: 4px 8px;
    background: var(--text-primary);
    color: var(--bg-primary);
}

.logo-text {
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.01em;
}

nav {
    display: flex;
    gap: 8px;
}

nav a {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

nav a:hover,
nav a.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

nav a.contribute-btn {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: var(--text-primary);
}

nav a.contribute-btn:hover {
    background: var(--accent);
}

/* Main */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px 96px;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* Search Bar */
.search-bar {
    position: relative;
    margin-bottom: 24px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-bar input {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 40px 12px 48px;
    transition: all 0.15s ease;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-bar input:hover {
    border-color: var(--border-light);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.clear-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Filters */
.filters {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    min-width: 80px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chip:hover {
    color: var(--text-primary);
    border-color: var(--border-light);
    background: var(--bg-tertiary);
}

.chip.active {
    color: var(--text-primary);
    background: var(--accent-dim);
    border-color: var(--accent);
}

.filter-range {
    gap: 12px;
}

.filter-range .filter-label {
    font-family: 'JetBrains Mono', monospace;
    min-width: auto;
}

.filter-range .filter-label span {
    color: var(--text-primary);
}

.filter-range input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 200px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    cursor: pointer;
}

.filter-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--text-primary);
    border-radius: 50%;
    cursor: grab;
    transition: transform 0.15s ease;
}

.filter-range input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.filter-range input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--text-primary);
    border: none;
    border-radius: 50%;
    cursor: grab;
}

/* Results Bar */
.results-bar {
    margin-bottom: 20px;
}

.results-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
}

.results-count span {
    color: var(--text-primary);
}

/* Declarations Grid */
.declarations-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.loading, .empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Declaration Card */
.declaration-link {
    text-decoration: none;
    color: inherit;
    display: flex;
}

.declaration {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.declaration-link:hover .declaration {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.declaration-link:hover .card-arrow {
    opacity: 1;
    transform: translate(2px, -2px);
}

.declaration-link:hover .card-name {
    color: var(--accent);
}

.card-top {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.card-name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    transition: color 0.15s ease;
}

.card-arrow {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    opacity: 0.5;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.card-country {
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-country::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
}

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.source-link:hover {
    background: var(--accent-dim);
    color: var(--text-primary);
}

.source-link svg {
    width: 12px;
    height: 12px;
}

.card-body {
    padding: 16px 20px;
    flex: 1;
}

.card-description {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.card-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
}

.card-footer {
    padding: 12px 20px;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    gap: 16px;
}

.approval-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 12px;
    border-radius: 4px;
    color: #fff;
}

/* Card Image */
.card-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding: 48px 24px;
    z-index: 200;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 560px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    z-index: 10;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.modal-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
}

.modal-header {
    padding: 24px 24px 16px;
    padding-right: 60px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.modal-country {
    font-size: 13px;
    color: var(--text-muted);
    padding: 4px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.modal-description {
    padding: 20px 24px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.modal-categories {
    padding: 0 24px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quote {
    padding: 16px 24px;
    margin: 0 24px 16px;
    font-style: italic;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent);
    background: var(--bg-primary);
    border-radius: 0 6px 6px 0;
}

.quote::before {
    content: '"';
}

.quote::after {
    content: '"';
}

.card-quote {
    padding: 12px 16px;
    margin: 0 20px 12px;
    font-style: italic;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
    border-left: 2px solid var(--border-light);
    background: var(--bg-primary);
    border-radius: 0 4px 4px 0;
}

.card-quote::before {
    content: '"';
}

.card-quote::after {
    content: '"';
}

.modal-footer {
    padding: 20px 24px;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.modal-source {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    padding: 10px 16px;
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: 8px;
    transition: all 0.15s ease;
}

.modal-source:hover {
    background: var(--accent);
}

.modal-source svg {
    width: 16px;
    height: 16px;
}

/* About Page */
.about-container {
    max-width: 680px;
}

.about-content {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.8;
}

.about-content p {
    margin-bottom: 16px;
}

.about-content h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 32px 0 16px;
}

.about-content ul {
    margin: 0 0 16px 24px;
}

.about-content li {
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    main {
        padding: 32px 16px 64px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .filter-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .filter-label {
        min-width: auto;
    }

    .filter-range input[type="range"] {
        width: 100%;
    }

    .declarations-container {
        grid-template-columns: 1fr;
    }

    .modal-overlay {
        padding: 24px 16px;
    }

    .modal-image {
        height: 200px;
    }

    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .modal-title {
        font-size: 18px;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-source {
        justify-content: center;
    }
}
