/* TurboPush demo. Cool slate with a cobalt accent; chunks are the motif. */

:root {
    color-scheme: light dark;
    --bg: #edf0f3;
    --surface: #ffffff;
    --ink: #17212d;
    --muted: #556171;
    --line: #d3d9e0;
    --accent: #2953e8;
    --accent-ink: #ffffff;
    --accent-soft: #e3e9fd;
    --ok: #0b7a53;
    --warn: #9e5c00;
    --bad: #bf3028;
    --cell: #dbe0e7;
    --focus: #2953e8;
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f141b;
        --surface: #171e27;
        --ink: #e5eaf0;
        --muted: #9aa6b4;
        --line: #2b3542;
        --accent: #7d95ff;
        --accent-ink: #0f141b;
        --accent-soft: #1f2a45;
        --ok: #43c793;
        --warn: #efa53e;
        --bad: #ff7065;
        --cell: #27313d;
        --focus: #9bb0ff;
    }
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 1rem/1.55 var(--sans);
}

.page {
    max-width: 44rem;
    margin: 0 auto;
    padding: 2.5rem 16px 3rem;
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

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

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Masthead: a strip of chunks that fills once on load */

.mark {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 4px;
    max-width: 15rem;
    margin-bottom: 1.25rem;
}

.mark i {
    display: block;
    height: 10px;
    border-radius: 2px;
    background: var(--accent);
    animation: fill-in 420ms ease-out both;
}

.mark i:nth-child(1) { animation-delay: 0ms; }
.mark i:nth-child(2) { animation-delay: 70ms; }
.mark i:nth-child(3) { animation-delay: 140ms; }
.mark i:nth-child(4) { animation-delay: 35ms; }
.mark i:nth-child(5) { animation-delay: 210ms; }
.mark i:nth-child(6) { animation-delay: 105ms; }
.mark i:nth-child(7) { animation-delay: 280ms; }
.mark i:nth-child(8) { animation-delay: 175ms; }
.mark i:nth-child(9) { animation-delay: 350ms; }
.mark i:nth-child(10) { animation-delay: 245ms; }
.mark i:nth-child(11) { animation-delay: 420ms; }
.mark i:nth-child(12) { animation-delay: 315ms; background: var(--ok); }

@keyframes fill-in {
    from { background: var(--cell); transform: scaleY(0.4); }
    to { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
    .mark i { animation: none; }
}

h1 {
    margin: 0;
    font-size: clamp(2.5rem, 9vw, 3.75rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.035em;
}

h2 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.lede {
    margin: 1rem 0 0.75rem;
    max-width: 36rem;
    font-size: 1.125rem;
    color: var(--muted);
}

.repo { margin: 0; font-weight: 600; }

/* The privacy promise: the first thing after the title */

.promise {
    margin: 2rem 0;
    padding: 1rem 1.125rem;
    border-left: 4px solid var(--ok);
    background: var(--surface);
    border-radius: 0 6px 6px 0;
}

.promise p { margin: 0; }

/* Upload area */

.try {
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.drop {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-start;
    margin-top: 0.75rem;
    padding: 1.25rem;
    border: 2px dashed var(--line);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 120ms, background-color 120ms;
}

.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop:focus-within { border-color: var(--accent); }

.drop-main { font-weight: 650; }
.drop-sub { font-size: 0.875rem; color: var(--muted); }

.drop input[type="file"] {
    margin-top: 0.5rem;
    max-width: 100%;
    font: inherit;
    font-size: 0.875rem;
    color: var(--muted);
}

.note { margin: 0.5rem 0 0; font-size: 0.875rem; color: var(--warn); }
.note:empty { display: none; }

.options {
    display: grid;
    gap: 0.5rem;
    margin: 1rem 0;
    padding: 0;
    border: 0;
    font-size: 0.9375rem;
}

.options label { display: flex; gap: 0.5rem; align-items: flex-start; cursor: pointer; }
.options input { margin: 0.3rem 0 0; accent-color: var(--accent); }

.controls { display: flex; flex-wrap: wrap; gap: 0.5rem; }

button {
    min-height: 44px;
    padding: 0 1.125rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { filter: brightness(1.08); }

.summary { margin: 1rem 0 0; font-weight: 600; }
.summary:empty { display: none; }

/* Files */

.files { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.75rem; }

.file {
    padding: 0.875rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.file-head { display: flex; gap: 0.75rem; justify-content: space-between; align-items: baseline; }
.file-name { font-weight: 650; overflow-wrap: anywhere; }
.file-size { flex: none; font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.chunks {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 3px;
    margin: 0.625rem 0 0.5rem;
}

.chunks span { height: 12px; border-radius: 2px; background: var(--cell); transition: background-color 160ms; }
.chunks span.got { background: var(--accent); }
.file[data-state="completed"] .chunks span { background: var(--ok); }
.file[data-state="failed"] .chunks span.got { background: var(--bad); }
.file[data-state="paused"] .chunks span.got { background: var(--warn); }

.file-status { margin: 0; font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.file[data-state="failed"] .file-status { color: var(--bad); }
.file[data-state="rejected"] .file-status { color: var(--warn); }

/* Receipt: what the server checked, ending with the deletion */

.receipt {
    margin: 0.875rem 0 0;
    padding-top: 0.75rem;
    border-top: 2px dashed var(--line);
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.375rem 1rem;
    font-size: 0.875rem;
}

.receipt > div { display: contents; }
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; overflow-wrap: anywhere; }
.receipt .hash { font-family: var(--mono); font-size: 0.8125rem; line-height: 1.45; }
.receipt .match { display: block; margin-top: 0.125rem; font-family: var(--sans); font-weight: 600; color: var(--ok); }
.receipt .match.no { color: var(--bad); }
.receipt .match.wait { color: var(--muted); font-weight: 400; }

.receipt .gone dt, .receipt .gone dd { color: var(--ok); font-weight: 700; font-size: 0.9375rem; }

@media (max-width: 26rem) {
    .receipt { grid-template-columns: minmax(0, 1fr); gap: 0.125rem; }
    .receipt dd { margin-bottom: 0.5rem; }
}

/* Event log */

.log { margin-top: 1rem; font-size: 0.875rem; }
.log summary { cursor: pointer; font-weight: 600; color: var(--muted); }
#eventLog {
    margin-top: 0.5rem;
    max-height: 14rem;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 0.75rem;
    line-height: 1.6;
}
#eventLog:empty::before { content: "Nothing yet."; color: var(--muted); font-family: var(--sans); }

.foot { margin-top: 2rem; font-size: 0.875rem; color: var(--muted); }
.foot p { margin: 0 0 0.5rem; }
