/* =============================================================
   midas.css — Midas Timeline  (1rem = 16px browser default)
   ============================================================= */

/* ── Minimal normalize ──────────────────────────────────────── */

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

html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    overflow-x: hidden;
    font-family: system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    font-weight: 600;
    letter-spacing: -0.01em;
}

p { margin-top: 0; }

strong, b { font-weight: 700; }

/* ── Variables ───────────────────────────────────────────────── */

:root {
    /* Base palette — VLGR dark theme */
    --page-bg:          #0d0d17;
    --card-bg:          #13131e;
    --text-main:        #f2f2fc;
    --text-muted:       #9898c8;
    --line:             #232334;
    --border:           #232334;
    --shadow:           0 0.6rem 1.6rem rgba(0, 0, 0, 0.5);
    --shadow-sm:        0 2px 8px rgba(0, 0, 0, 0.4);

    /* Accent — VLGR acid yellow */
    --accent:           #d4ff02;
    --accent-dark:      #bce002;
    --accent-soft:      rgba(212, 255, 2, 0.1);
    --accent-text:      #09090f;   /* text ON acid yellow bg */

    /* Type: Zelensky visits abroad (sky blue) */
    --type-zel-text:    #93c5fd;
    --type-zel-bg:      rgba(147, 197, 253, 0.1);
    --type-zel-border:  rgba(147, 197, 253, 0.35);

    /* Type: Visits to Ukraine (green) */
    --type-visits-text:   #86efac;
    --type-visits-bg:     rgba(134, 239, 172, 0.1);
    --type-visits-border: rgba(134, 239, 172, 0.35);

    /* Type: Pipeline / Energy (amber) */
    --type-pipeline-text:   #fcd34d;
    --type-pipeline-bg:     rgba(252, 211, 77, 0.1);
    --type-pipeline-border: rgba(252, 211, 77, 0.35);
    --type-pipeline-marker: #fbbf24;

    /* Type: Peace talks (slate) */
    --type-peace-text:   #94a3b8;
    --type-peace-bg:     rgba(148, 163, 184, 0.1);
    --type-peace-border: rgba(148, 163, 184, 0.35);

    /* Type: Context / Analysis (cool grey) */
    --type-context-text:   #cbd5e1;
    --type-context-bg:     rgba(203, 213, 225, 0.08);
    --type-context-border: rgba(203, 213, 225, 0.3);

    /* Type: Aid / Finance (cyan) */
    --type-aid-text:   #67e8f9;
    --type-aid-bg:     rgba(103, 232, 249, 0.1);
    --type-aid-border: rgba(103, 232, 249, 0.3);
}

/* ── Layout ──────────────────────────────────────────────────── */

body {
    background: var(--page-bg);
    color: var(--text-main);
}

a { color: #b175ff; text-decoration: underline; }
a:hover { color: var(--accent); }

.page-wrap {
    width: 100%;
    max-width: 65rem;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* ── Hero — compact one-liner inside sticky header ───────────── */

#filter-bar .hero {
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    width: min(65rem, calc(100% - 2rem));
    margin-inline: auto;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

#filter-bar .hero h1 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
    color: var(--accent);
    letter-spacing: 0.01em;
}

#filter-bar .hero p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Timeline ────────────────────────────────────────────────── */

.timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-left: 8.5rem;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 0.4rem;
    bottom: 0.4rem;
    left: 7rem;
    width: 1px;
    background: var(--line);
}

.timeline-item {
    position: relative;
    margin: 0;
}

.timeline-marker {
    position: absolute;
    top: 1rem;
    left: -1.94rem;
    width: 0.875rem;
    height: 0.875rem;
    border: 2px solid var(--accent);
    border-radius: 999rem;
    background: var(--page-bg);
    z-index: 2;
}

.timeline-content {
    position: relative;
    display: grid;
    grid-template-columns: 10.5rem 1fr;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.timeline-date {
    align-self: start;
    display: inline-flex;
    width: fit-content;
    padding: 0.2rem 0.5rem;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999rem;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.4;
}

.timeline-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.timeline-body h2 {
    margin: 0 0 0.3rem;
    font-size: 1.15rem;
    line-height: 1.25;
}

.timeline-body p {
    margin: 0 0 0.15rem;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
}

/* ── Entry type: Zelensky visits abroad ──────────────────────── */

.zel_visit_abroad .timeline-marker {
    border-color: var(--type-zel-text);
    border-style: double;
}

.zel_visit_abroad .timeline-date {
    background: var(--type-zel-bg);
    color: var(--type-zel-text);
}

.zel_visit_abroad .timeline-content {
    border-left: 3px solid var(--type-zel-border);
}

/* ── Entry type: context / analysis ─────────────────────────── */

.context-item .timeline-marker {
    border-color: var(--type-context-border);
}

.context-item .timeline-date {
    background: var(--type-context-bg);
    color: var(--type-context-text);
}

.aid_midas_context .timeline-content,
.aid_midas_summary .timeline-content {
    border-left: 3px solid var(--type-context-border);
}

/* ── Entry type: peace talks ─────────────────────────────────── */

.peace_talks .timeline-marker {
    border-color: var(--type-peace-border);
}

.peace_talks .timeline-date {
    background: var(--type-peace-bg);
    color: var(--type-peace-text);
}

.peace_talks .timeline-content {
    border-left: 3px solid var(--type-peace-border);
}

/* ── Entry type: visits to Ukraine ───────────────────────────── */

.visits_in_u .timeline-marker {
    border-color: var(--type-visits-text);
    border-style: double;
}

.visits_in_u .timeline-date {
    background: var(--type-visits-bg);
    color: var(--type-visits-text);
}

.visits_in_u .timeline-content {
    border-left: 3px solid var(--type-visits-border);
}

/* ── Entry type: pipeline / energy ───────────────────────────── */

.pipeline .timeline-marker {
    border-color: var(--type-pipeline-marker);
    border-style: double;
}

.pipeline .timeline-date {
    background: var(--type-pipeline-bg);
    color: var(--type-pipeline-text);
}

.pipeline .timeline-content {
    border-left: 3px solid var(--type-pipeline-border);
}

/* ── Entry type: corruption potential ────────────────────────── */

.corruption .timeline-marker {
    border-color: #4ade80;
}

.corruption .timeline-content {
    border-left: 3px solid rgba(74, 222, 128, 0.35);
}

/* ── Source note ─────────────────────────────────────────────── */

.source-note {
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── Filter bar ──────────────────────────────────────────────── */

#filter-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.filter-bar__inner {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: min(65rem, calc(100% - 2rem));
    margin: 0 auto;
}

.filter-bar__row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.filter-bar__row + .filter-bar__row {
    padding-top: 0.4rem;
}

.filter-bar__label {
    flex-shrink: 0;
    padding-top: 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    width: 4rem;
}

.filter-bar__types,
.filter-bar__countries {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

/* ── Filter buttons — gradient pill (colours applied via JS) ─── */

.filter-btn {
    padding: 0rem 0.75rem;
    border-radius: 999rem;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    line-height: 1.5;
    transition: filter 0.12s;
    /* border + background + color set inline by midas.js */
}

.filter-btn:hover  { filter: brightness(1.25); }
.filter-btn:active { filter: brightness(1.4); }

/* ── Filter footer ───────────────────────────────────────────── */

.filter-bar__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.filter-bar__count {
    font-size: 0.825rem;
    color: var(--text-muted);
}

.filter-bar__reset {
    padding: 0.2rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 999rem;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.825rem;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.5;
    display: none;
    transition: border-color 0.12s, color 0.12s;
}

.filter-bar__reset:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filter-bar__reset--visible {
    display: inline-block;
}

.timeline-item[hidden] { display: none; }

/* ── Timeline note (extracted date parenthetical, below body) ── */

.timeline-note {
    margin-top: 0.45rem;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(245, 200, 66, 0.55);
}

/* ── Source links ───────────────────────────────────────────── */
.timeline-sources {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem .6rem;
    margin-top: .5rem;
}
.timeline-source-link {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: rgba(255,255,255,.35);
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.15);
    transition: color .15s, border-color .15s;
}
.timeline-source-link:hover {
    color: rgba(255,255,255,.75);
    border-color: rgba(255,255,255,.45);
}

/* ── Donation category chip (inside card, below h2) ─────────── */

.donation-category {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.4rem;
}

.donation-category__chip {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(245, 200, 66, 0.08);
    border: 1px solid rgba(245, 200, 66, 0.25);
    color: #f5c842;
}

/* ── Aid badge (per-card amount indicator) ───────────────────── */

.aid-badge {
    position: absolute;
    top: 0.875rem;
    right: calc(100% + 2rem);
    width: max-content;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.25rem 0.35rem;
    padding: 0.25rem 0.5rem;
    background: rgba(212, 170, 0, 0.08);
    border: 1px solid rgba(212, 170, 0, 0.25);
    border-radius: 0.4rem;
    line-height: 1.4;
}

.aid-badge__icon {
    font-size: 0.9rem;
}

.aid-badge__amount {
    font-size: 0.925rem;
    font-weight: 700;
    color: #f5c842;
    letter-spacing: 0.01em;
}

.aid-badge__by {
    font-size: 0.775rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.04em;
}

.aid-badge__sep {
    color: var(--text-muted);
    opacity: 0.5;
    font-size: 0.8rem;
}

/* ── Scandal badge (per-card corruption indicator) ───────────── */

.scandal-badge {
    position: absolute;
    top: 0.875rem;
    right: calc(100% + 2rem);
    width: max-content;
    max-width: 6rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.25rem 0.35rem;
    padding: 0.25rem 0.5rem;
    background: rgba(74, 222, 128, 0.07);
    border: 1px solid rgba(74, 222, 128, 0.22);
    border-radius: 0.4rem;
    line-height: 1.4;
}

.scandal-badge__icon { font-size: 0.9rem; }

.scandal-badge__amount {
    font-size: 0.925rem;
    font-weight: 700;
    color: #4ade80;
    letter-spacing: 0.01em;
}

.scandal-badge__label {
    font-size: 0.775rem;
    color: var(--text-muted);
    font-weight: 500;
}

.scandal-badge__sep {
    color: var(--text-muted);
    opacity: 0.5;
    font-size: 0.8rem;
}

/* ── Aid total counter (filter bar footer) ───────────────────── */

.aid-total {
    font-size: 0.825rem;
    color: var(--text-muted);
}

.aid-total strong {
    color: #f5c842;
    font-weight: 700;
}

.aid-total__us { color: var(--text-muted); }
.aid-total__estimated { color: var(--text-muted); font-style: italic; cursor: help; }

.aid-total__split {
    opacity: 0.75;
    font-size: 0.775rem;
}

/* ── Corruption potential counter (filter bar footer) ────────── */

.corruption-total {
    font-size: 0.825rem;
    color: var(--text-muted);
    cursor: help;
    position: relative;
}

.corruption-total strong {
    color: #4ade80;
    font-weight: 700;
}

/* CSS tooltip via data-tooltip attribute */
[data-tooltip] { position: relative; }

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 26rem;
    padding: 0.5rem 0.75rem;
    background: #1e1e2e;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    color: var(--text-main);
    font-size: 0.775rem;
    font-weight: 400;
    line-height: 1.5;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 300;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ── Search row (always visible) ────────────────────────────── */

.filter-bar__search-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.filter-bar__search {
    flex: 1;
    min-width: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.875rem;
    padding: 0.3rem 0.65rem;
    outline: none;
    transition: border-color 0.15s;
}

.filter-bar__search::placeholder { color: var(--text-muted); }
.filter-bar__search:focus { border-color: var(--accent); }

/* Clear button inside <input type="search"> */
.filter-bar__search::-webkit-search-cancel-button { cursor: pointer; }

/* ── Sort toggle (segmented control) ────────────────────────── */

.filter-bar__sort-toggle {
    display: flex;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    overflow: hidden;
}

.filter-bar__sort-btn {
    flex: 1;
    background: var(--card-bg);
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.filter-bar__sort-btn:last-child { border-right: none; }

.filter-bar__sort-btn:hover { color: var(--text-main); }

.filter-bar__sort-btn--active {
    background: var(--accent);
    color: #000;
    font-weight: 600;
}

/* ── Search highlight ────────────────────────────────────────── */

mark.search-hl {
    background: rgba(212, 255, 2, 0.28);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* ── Hamburger (mobile only) ─────────────────────────────────── */

.filter-bar__hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    padding: 0.4rem 0.55rem;
    cursor: pointer;
    margin-left: auto;
    margin-top: 0.25rem;
}

.filter-bar__hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.filter-bar__hamburger--open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.filter-bar__hamburger--open span:nth-child(2) { opacity: 0; }
.filter-bar__hamburger--open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 768px) {
    .page-wrap {
        padding: 1rem 0;
    }

    .hero {
        padding: 1rem 1.1rem;
        margin-bottom: 0.9rem;
    }

    .timeline {
        padding-left: 1.5rem;
        gap: 0.5rem;
    }

    .timeline::before { left: 0.35rem; }

    .timeline {
        padding-left: 1.75rem;
    }

    .timeline::before {
        left: 0.4rem;
    }

    .timeline-marker {
        left: -1.35rem;
        top: 0.85rem;
        width: 0.75rem;
        height: 0.75rem;
    }

    .timeline-content {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .timeline-body { width: 100%; }

    .aid-badge,
    .scandal-badge {
        position: static;
        width: auto;
        max-width: none;
        justify-content: flex-start;
        margin-top: 0.4rem;
    }

    #filter-bar { padding: 0.5rem 0.75rem; }

    .filter-bar__inner { width: 100%; max-width: none; }

    .filter-bar__hamburger { display: flex; }

    .filter-bar__rows {
        display: none;
        flex-direction: column;
        gap: 0.6rem;
        padding-top: 0.5rem;
    }

    .filter-bar__rows--open { display: flex; }

    .filter-bar__row {
        flex-direction: column;
        gap: 0.4rem;
    }

    .filter-bar__label {
        padding-top: 0;
        width: auto;
    }
}

/* ── Print ───────────────────────────────────────────────────── */

@media print {
    body { background: #fff; }

    .page-wrap { width: 100%; padding: 0; }

    #filter-bar { display: none; }

    .hero,
    .timeline-content {
        box-shadow: none;
        break-inside: avoid;
    }

    .timeline { gap: 0.5rem; }

    .timeline-item[hidden] { display: none; }
}

/* ── Event submission form ───────────────────────────────────── */

.submit-section {
    max-width: 44rem;
    margin: 0 auto 3rem;
    padding: 0 1rem;
}

.submit-toggle {
    display: block;
    width: 100%;
    padding: 0.65rem 1.1rem;
    background: none;
    border: 1.5px dashed #ccc;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s, color 0.2s;
}
.submit-toggle:hover {
    border-color: #888;
    color: #333;
}

.submit-form-wrap {
    margin-top: 1.2rem;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.submit-intro {
    margin: 0 0 1.2rem;
    font-size: 0.875rem;
    color: #666;
}

.submit-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.9rem;
}

.submit-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #444;
    letter-spacing: 0.01em;
}

.req { color: #e55; }

.submit-field input,
.submit-field textarea,
.submit-field select {
    padding: 0.45rem 0.65rem;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    background: #fafafa;
    color: #1d1d2e;
    transition: border-color 0.15s;
}
.submit-field input:focus,
.submit-field textarea:focus,
.submit-field select:focus {
    outline: none;
    border-color: #888;
    background: #fff;
}

.submit-field textarea { resize: vertical; min-height: 4.5rem; }

.submit-row { display: flex; gap: 1rem; }
.submit-row--2 > * { flex: 1 1 0; min-width: 0; }

.submit-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.4rem;
}

.submit-btn {
    padding: 0.5rem 1.3rem;
    background: #1d1d2e;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.submit-btn:hover  { background: #333; }
.submit-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.submit-status { font-size: 0.85rem; }
.submit-status--ok  { color: #2d8a4e; }
.submit-status--err { color: #cc3333; }

@media (max-width: 600px) {
    .submit-row { flex-direction: column; gap: 0; }
}
