/* ===================================================================
   BG Leaks Archive — visual system
   A quiet, editorial reading of an Apple-style interface: system type,
   generous whitespace, a single blue accent for interaction, and a
   single red accent reserved for "live" / public-sector signals.
   =================================================================== */

:root {
    --bg: #ffffff;
    --bg-alt: #f5f5f7;
    --surface: #ffffff;
    --ink: #1d1d1f;
    --ink-soft: #6e6e73;
    --ink-faint: #a1a1a6;
    --line: #d2d2d7;
    --line-soft: #e8e8ed;
    --accent: #0071e3;
    --accent-dark: #0058b0;
    --alert: #ff3b30;
    --alert-soft: #fff1f0;
    --radius-s: 8px;
    --radius-m: 14px;
    --radius-l: 22px;
    --max-width: 1120px;
    --nav-height: 56px;
}

/* Midnight blue dark theme */
:root[data-theme="dark"] {
    --bg: #0a0e1a;
    --bg-alt: #0e1424;
    --surface: #161e38;
    --ink: #e8eaf2;
    --ink-soft: #97a1c2;
    --ink-faint: #596288;
    --line: #29335a;
    --line-soft: #1b2340;
    --accent: #4da8ff;
    --accent-dark: #8fcbff;
    --alert: #ff6b5f;
    --alert-soft: rgba(255, 107, 95, 0.14);
}

html {
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

body,
.nav,
.leak-card,
.source-chip {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-height) + 16px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
        "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

.wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------------------------------------------------------------
   Navigation
   --------------------------------------------------------------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 500;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line-soft);
}

html[data-theme="dark"] .nav {
    background: rgba(10, 14, 26, 0.72);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--ink);
    white-space: nowrap;
}

.nav-brand .brand-logo {
    height: 36px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
    list-style: none;
}

.nav-links a {
    font-size: 13px;
    color: var(--ink-soft);
    text-decoration: none;
    transition: color 0.15s ease;
}

.nav-links a:hover {
    color: var(--ink);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border: none;
    background: var(--bg-alt);
    border-radius: 50%;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
    color: var(--ink);
}

.theme-toggle svg {
    width: 15px;
    height: 15px;
}

.theme-toggle .icon-moon {
    display: none;
}

html[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}

html[data-theme="dark"] .theme-toggle .icon-moon {
    display: block;
}

.lang-toggle {
    display: flex;
    background: var(--bg-alt);
    border-radius: 100px;
    padding: 2px;
    gap: 2px;
}

.lang-btn {
    border: none;
    background: transparent;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 100px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.lang-btn.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

html[data-theme="dark"] .lang-btn.active {
    box-shadow: 0 0 0 1px var(--line);
}

.nav-toggle {
    display: none;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 1.5px;
    background: var(--ink);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.open span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

.nav-mobile {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--line-soft);
    z-index: 499;
    padding: 8px 24px 24px;
    flex-direction: column;
    gap: 4px;
}

html[data-theme="dark"] .nav-mobile {
    background: rgba(10, 14, 26, 0.97);
}

.nav-mobile.open {
    display: flex;
}

.nav-mobile a {
    padding: 12px 4px;
    font-size: 17px;
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1px solid var(--line-soft);
}

@media (max-width: 780px) {
    .nav-links {
        display: none;
    }
    .nav-toggle {
        display: flex;
    }
}

/* ---------------------------------------------------------------
   Hero
   --------------------------------------------------------------- */
.hero {
    padding: 96px 0 64px;
    text-align: center;
}

.hero h1 {
    font-size: clamp(2.4rem, 5vw, 3.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--ink);
    max-width: 780px;
    margin: 0 auto 20px;
}

.hero p.lede {
    font-size: clamp(1.05rem, 1.6vw, 1.25rem);
    color: var(--ink-soft);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.5;
}

.hero-meta {
    margin-top: 28px;
    font-size: 13px;
    color: var(--ink-faint);
}

/* Stats */
.stats {
    display: flex;
    justify-content: center;
    gap: clamp(32px, 8vw, 88px);
    padding: 56px 0 8px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-num {
    display: block;
    font-size: clamp(2.1rem, 4vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--ink-soft);
    margin-top: 4px;
}

/* ---------------------------------------------------------------
   Section scaffolding
   --------------------------------------------------------------- */
section {
    padding: 72px 0;
}

section + section {
    border-top: 1px solid var(--line-soft);
}

.section-head {
    margin-bottom: 32px;
}

.section-head h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.section-head p {
    font-size: 15px;
    color: var(--ink-soft);
    max-width: 620px;
}

/* ---------------------------------------------------------------
   Filter / search
   --------------------------------------------------------------- */
.controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.search-box {
    flex: 1 1 260px;
    position: relative;
}

#search-input {
    width: 100%;
    padding: 11px 16px;
    background: var(--bg-alt);
    border: 1px solid transparent;
    border-radius: var(--radius-s);
    color: var(--ink);
    font: 14px/1.4 inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
}

#search-input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--accent);
}

#search-input::placeholder {
    color: var(--ink-faint);
}

.filter-buttons {
    display: flex;
    gap: 6px;
    background: var(--bg-alt);
    padding: 3px;
    border-radius: var(--radius-s);
}

.filter-btn {
    border: none;
    background: transparent;
    color: var(--ink-soft);
    font: 500 13px inherit;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.filter-btn.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

html[data-theme="dark"] .filter-btn.active {
    box-shadow: 0 0 0 1px var(--line);
}

/* ---------------------------------------------------------------
   Archive grid
   --------------------------------------------------------------- */
.leaks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.leak-card {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-m);
    padding: 20px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.leak-card:hover {
    border-color: var(--line);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

html[data-theme="dark"] .leak-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

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

.leak-org {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    word-break: break-word;
}

.leak-type {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 100px;
    white-space: nowrap;
}

.leak-type.public {
    background: var(--alert-soft);
    color: var(--alert);
}

.leak-type.private {
    background: var(--bg-alt);
    color: var(--ink-soft);
}

.leak-description {
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.55;
    margin-bottom: 14px;
}

.leak-images {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.leak-image-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--line-soft);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.leak-image-thumb:hover {
    transform: scale(1.06);
    border-color: var(--accent);
}

.leak-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
}

.leak-source:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

/* ---------------------------------------------------------------
   Sources section
   --------------------------------------------------------------- */
.sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.source-chip {
    font-size: 13px;
    color: var(--ink);
    background: var(--bg-alt);
    border-radius: 100px;
    padding: 7px 14px;
    font-variant-ligatures: none;
    word-break: break-all;
}

.source-chip.onion {
    color: var(--ink-soft);
    font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    font-size: 11.5px;
}

/* ---------------------------------------------------------------
   Live feed section
   --------------------------------------------------------------- */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    color: var(--alert);
    margin-bottom: 10px;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--alert);
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.5);
    animation: livepulse 2s infinite;
}

@keyframes livepulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.45); }
    70% { box-shadow: 0 0 0 8px rgba(255, 59, 48, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}

.feed-list {
    display: flex;
    flex-direction: column;
}

.feed-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--line-soft);
}

.feed-item:first-child {
    border-top: none;
}

.feed-victim {
    font-size: 14.5px;
    font-weight: 600;
}

.feed-meta {
    font-size: 12.5px;
    color: var(--ink-soft);
    margin-top: 2px;
}

.feed-group {
    font-size: 12px;
    color: var(--ink-soft);
    background: var(--bg-alt);
    padding: 4px 10px;
    border-radius: 100px;
    white-space: nowrap;
}

.feed-date {
    font-size: 12.5px;
    color: var(--ink-faint);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.feed-empty,
.feed-loading,
.feed-error {
    font-size: 13.5px;
    color: var(--ink-soft);
    padding: 24px 0;
}

.feed-footnote {
    margin-top: 20px;
    font-size: 12px;
    color: var(--ink-faint);
}

@media (max-width: 560px) {
    .feed-item {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

/* ---------------------------------------------------------------
   Modal
   --------------------------------------------------------------- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.modal-content img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-m);
    display: block;
}

.close-btn {
    position: absolute;
    top: -38px;
    right: 0;
    color: #fff;
    font-size: 30px;
    line-height: 1;
    font-weight: 300;
    cursor: pointer;
}

.modal-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    padding: 0 -8px;
}

.modal-nav-btn {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s ease;
}

.modal-nav-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.modal-nav-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* ---------------------------------------------------------------
   Footer
   --------------------------------------------------------------- */
footer {
    padding: 48px 0 64px;
}

footer p {
    font-size: 12.5px;
    color: var(--ink-faint);
    line-height: 1.6;
    max-width: 760px;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 0;
    color: var(--ink-soft);
    font-size: 14px;
}

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */
@media (max-width: 600px) {
    .hero {
        padding: 64px 0 40px;
    }
    section {
        padding: 48px 0;
    }
    .stats {
        gap: 32px;
        padding: 40px 0 0;
    }
}

/* Scrollbar (webkit) */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--ink-faint);
}

/* ---------------------------------------------------------------
   Back to top
   --------------------------------------------------------------- */
.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 400;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--ink);
    color: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.2s ease;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.26);
}

.back-to-top svg {
    width: 15px;
    height: 15px;
}

html[data-theme="dark"] .back-to-top {
    box-shadow: 0 0 0 1px var(--line);
}

html[data-theme="dark"] .back-to-top:hover {
    box-shadow: 0 0 0 1px var(--line-soft), 0 4px 14px rgba(0, 0, 0, 0.4);
}

@media (max-width: 600px) {
    .back-to-top {
        right: 14px;
        bottom: 14px;
        width: 34px;
        height: 34px;
    }
}

/* ---------------------------------------------------------------
   Risks section
   --------------------------------------------------------------- */
.risk-group-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--ink);
    margin: 40px 0 16px;
}

.risk-group-title:first-of-type {
    margin-top: 8px;
}

.risk-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}

.risk-item {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-m);
    padding: 18px 20px;
}

.risk-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.risk-org {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.risk-meta {
    font-size: 12px;
    color: var(--ink-faint);
    white-space: nowrap;
}

.risk-line {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--ink-soft);
    margin-top: 8px;
}

.risk-line strong {
    color: var(--ink);
    font-weight: 600;
}
