@font-face {
    font-family: 'Geist';
    src: url('fonts/Geist-Variable.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: 'Geist';
    src: url('fonts/Geist-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Geist';
    src: url('fonts/Geist-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: 'Geist';
    src: url('fonts/Geist-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: 'Geist';
    src: url('fonts/Geist-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

:root {
    --color-gray-90: #111315;
    --color-green-100: #2debab;
    --color-gray-30: #959697;
    --color-white: #ffffff;
    --color-error: #f63f45;
    --color-green-hover: #1fc494;
    --color-card-bg: #1a1c1e;
    --color-card-border: #222527;
    --color-header-bg: #191b1d;
}

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

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-gray-90);
    color: var(--color-white);
    min-height: 100vh;
    min-height: 100dvh;
}

.container {
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    transition: max-width 0.3s ease;
}

/* Wider layout for report views: gives the 9-column stats table room to breathe */
.container--wide {
    max-width: 1080px;
}

h1 {
    font-size: 2.15rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--color-white);
    margin-bottom: 6px;
}

.subtitle {
    color: var(--color-gray-30);
    font-size: 0.9rem;
    line-height: 1.6;
    letter-spacing: 0.005em;
}

.subtitle a {
    text-decoration: underline;
    color: var(--color-green-100);
}

.subtitle a:hover {
    color: #000;
    background-color: var(--color-green-100);
}

/* Header with logo */
.site-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding-top: 24px;
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.site-logo {
    height: 34px;
    width: auto;
}

.site-header h1 { margin-bottom: 0; }

.header-divider {
    width: 120px;
    height: 1px;
    border: none;
    background: var(--color-card-border);
    margin-top: 12px;
}

/* Hero: how it works */
.hero-tagline {
    max-width: 520px;
    margin: 0 auto;
    font-size: 0.95rem;
}

.hero-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    margin-top: 18px;
    text-align: left;
}

.hero-step {
    background: var(--color-card-bg);
    border: 1px solid var(--color-card-border);
    border-radius: 10px;
    padding: 16px;
}

.hero-step-num {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(45, 235, 171, 0.15);
    color: var(--color-green-100);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.hero-step-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-white);
    margin-bottom: 6px;
}

.hero-step-text {
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--color-gray-30);
}

.hero-step-text a {
    color: var(--color-green-100);
    text-decoration: underline;
}

.hero-step-text a:hover {
    color: #000;
    background-color: var(--color-green-100);
}

@media (max-width: 620px) {
    .hero-steps {
        grid-template-columns: 1fr;
    }
}

/* Position badges */
.pos-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.pos-btn { background: rgba(45, 235, 171, 0.15); color: #2debab; }
.pos-co { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.pos-mp { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.pos-ep { background: rgba(239, 68, 68, 0.15);  color: #f87171; }
.pos-sb { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.pos-bb { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

/* Buttons */
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    padding-top: 16px;
    padding-bottom: 16px;
    padding-left: 32px;
    padding-right: 32px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    transition-property: background-color, color;
    transition-duration: 300ms;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--color-green-100);
    color: var(--color-gray-90);
}

.btn-primary:hover {
    background-color: var(--color-green-hover);
}

.btn-primary:disabled {
    color: var(--color-gray-30);
    background-color: #2c2f32;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--color-card-bg);
    color: var(--color-white);
}

.btn-secondary:hover {
    background-color: var(--color-card-border);
}

.btn-download {
    padding: 14px 36px;
    font-size: 1.05rem;
    color: var(--color-gray-90);
    background: var(--color-green-100);
}

.btn-download:hover {
    background: var(--color-green-hover);
}

/* After the first download: stays clickable for re-downloads, but recedes */
.btn-download.is-downloaded,
.btn-download.is-downloaded:hover {
    background: #0d2420;
    box-shadow: inset 0 0 0 1px var(--color-green-100);
    color: var(--color-green-100);
}

/* Cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-card-bg);
    border-radius: 10px;
    padding: 16px;
    border-top: 3px solid var(--color-green-100);
}

.stat-card .label {
    color: var(--color-gray-30);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.stat-card .value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-white);
}

.stat-delta {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-green-100);
    margin-left: 8px;
}

.report-delta {
    color: var(--color-green-100);
    font-weight: 600;
}

/* Table */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-card-bg);
    min-width: 560px;
}

th {
    background: var(--color-header-bg);
    padding: 10px 14px;
    text-align: center;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-gray-30);
    font-weight: 600;
    white-space: nowrap;
}

th:first-child { text-align: left; }

td {
    padding: 9px 14px;
    text-align: center;
    font-size: 0.88rem;
    border-top: 1px solid var(--color-card-border);
    font-variant-numeric: tabular-nums;
}

td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--color-white);
}

tr:hover td { background: var(--color-header-bg); }

.tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--color-card-bg);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--color-gray-30);
    margin-right: 4px;
}

/* Next step callout */
.next-step {
    margin-top: 24px;
    padding: 16px 20px;
    background: #0d2420;
    border: 1px solid #1a4a3e;
    border-radius: 10px;
}

.next-step-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-green-100);
    margin-bottom: 6px;
}

.next-step-text {
    font-size: 0.88rem;
    color: #a8e8d8;
    line-height: 1.5;
}

.ns-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-top: 14px;
    opacity: 0.4;
    transition: opacity 300ms;
}

.ns-step.is-active,
.ns-step.is-done {
    opacity: 1;
}

.ns-step-num {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--color-green-100);
    border-radius: 50%;
    color: var(--color-green-100);
    font-size: 0.8rem;
    font-weight: 700;
}

.ns-step.is-done .ns-step-num {
    background: var(--color-green-100);
    color: var(--color-gray-90);
}

.ns-step-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-white);
    margin-bottom: 2px;
}

/* The Leak Finder CTA stays hidden until its step unlocks */
.ns-step:not(.is-active) .next-step-link {
    display: none;
}

.next-step-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 9px 18px;
    border: 1px solid var(--color-green-100);
    border-radius: 8px;
    background: transparent;
    color: var(--color-green-100);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition-property: background-color, color;
    transition-duration: 300ms;
}

.next-step-link:hover {
    background-color: var(--color-green-100);
    color: var(--color-gray-90);
}

/* Upload area */
.upload-area {
    border: 2px dashed #2c2f32;
    border-radius: 12px;
    padding: 52px 40px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    background: var(--color-card-bg);
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--color-green-100);
    background: #161a18;
}

.upload-area.has-files {
    border-color: var(--color-green-100);
    border-style: solid;
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.7;
}

.upload-text {
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.upload-hint {
    color: var(--color-gray-30);
    font-size: 0.85rem;
    line-height: 1.5;
}

.upload-formats {
    color: var(--color-gray-30);
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: center;
    margin-top: 12px;
}

.report-disclaimer {
    color: var(--color-gray-30);
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 12px 0 16px;
}

input[type="file"] { display: none; }

/* File list */
.file-summary {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--color-card-bg);
    border-radius: 8px;
    display: none;
}

.file-summary.visible { display: block; }

@keyframes summary-flash {
    0%   { background-color: rgba(45, 235, 171, 0.2); }
    45%  { background-color: rgba(45, 235, 171, 0.14); }
    100% { background-color: var(--color-card-bg); }
}

.file-summary.flash { animation: summary-flash 1.2s ease-out; }

@keyframes status-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.18); }
    70%  { transform: scale(0.96); }
    100% { transform: scale(1); }
}

.file-summary-status.pop { animation: status-pop 0.55s ease; }

.file-summary-text {
    font-size: 0.9rem;
    color: var(--color-white);
}

.file-summary-detail {
    font-size: 0.8rem;
    color: var(--color-gray-30);
    margin-top: 4px;
}

.file-summary-status {
    font-size: 0.8rem;
    color: var(--color-green-100);
    margin-top: 4px;
    width: fit-content;
    transform-origin: left center;
}

.file-summary-clear {
    background: none;
    border: none;
    padding: 0;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--color-gray-30);
    text-decoration: underline;
    cursor: pointer;
}

.file-summary-clear:hover {
    color: var(--color-white);
}

/* Mode toggle */
.mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    justify-content: center;
}

.mode-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #2c2f32;
    background: transparent;
    color: var(--color-gray-30);
    font-size: 1rem;
    transition-property: border, color;
    transition-duration: 300ms;
    cursor: pointer;
}

.mode-btn:hover {
    border-color: #444749;
    color: var(--color-white);
}

.mode-btn.active {
    color: var(--color-green-100);
    border-color: var(--color-green-100);
    background: rgba(45, 235, 171, 0.12);
}

/* Progress */
.progress-section {
    display: none;
    margin-top: 28px;
}

.progress-section.active { display: block; }

.progress-bar-track {
    height: 6px;
    background: #1e2020;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--color-green-100);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-stages {
    display: flex;
    justify-content: space-between;
}

.stage {
    font-size: 0.8rem;
    color: #444749;
    transition: color 0.2s;
}

.stage.active { color: var(--color-green-100); font-weight: 600; }

.stage.done { color: var(--color-green-100); opacity: 0.6; }

/* Error */
.error-msg {
    display: none;
    padding: 12px 20px;
    background: #2a1214;
    border: 1px solid var(--color-error);
    border-radius: 8px;
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--color-error);
}

.error-msg.visible { display: block; }

/* Report section (index inline view) */
.report-section { display: none; margin-top: 32px; }

.report-section.active { display: block; }

.report-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

.report-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-white);
}

.report-section .subtitle { text-align: center; }

/* Report view: the how-it-works onboarding has done its job — hide it to keep
   the focus on the results */
.report-view .hero-steps { display: none; }
