/* ==========================================================================
   Temp-Upload — shared design system
   One stylesheet for every page: tokens, layout, components.
   ========================================================================== */

/* ─── Tokens ─────────────────────────────────────────────────────────────── */
:root {
    color-scheme: dark;

    --bg:            #0b0e0d;
    --surface:       #121715;
    --surface-2:     #18201c;
    --border:        #25302b;
    --border-strong: #34433c;

    --text:          #ecf2ee;
    --text-muted:    #a3b1a9;   /* 8.4:1 on --bg */
    --text-faint:    #7f8d85;   /* 5.3:1 on --bg, for secondary hints only */

    --accent:        #4ade80;   /* links, icons, focus */
    --accent-bg:     #22c55e;   /* primary buttons */
    --accent-bg-hover: #16a34a;
    --on-accent:     #04210f;
    --accent-soft:   rgba(74, 222, 128, 0.10);
    --accent-line:   rgba(74, 222, 128, 0.32);

    --danger:        #f87171;
    --danger-soft:   rgba(248, 113, 113, 0.10);
    --danger-line:   rgba(248, 113, 113, 0.35);
    --warning:       #fbbf24;
    --warning-soft:  rgba(251, 191, 36, 0.10);
    --warning-line:  rgba(251, 191, 36, 0.35);

    --shadow:        0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.35);
    --radius-sm:     8px;
    --radius:        12px;
    --radius-lg:     16px;

    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
    :root {
        color-scheme: light;
        --bg:            #f5f7f6;
        --surface:       #ffffff;
        --surface-2:     #f0f4f2;
        --border:        #dde4e0;
        --border-strong: #c5d0ca;
        --text:          #0f1a14;
        --text-muted:    #4a5850;
        --text-faint:    #63716a;
        --accent:        #15803d;
        --accent-bg:     #15803d;
        --accent-bg-hover: #166534;
        --on-accent:     #ffffff;
        --accent-soft:   rgba(21, 128, 61, 0.08);
        --accent-line:   rgba(21, 128, 61, 0.35);
        --danger:        #b91c1c;
        --danger-soft:   rgba(185, 28, 28, 0.06);
        --danger-line:   rgba(185, 28, 28, 0.30);
        --warning:       #92400e;
        --warning-soft:  rgba(217, 119, 6, 0.08);
        --warning-line:  rgba(217, 119, 6, 0.35);
        --shadow:        0 1px 2px rgba(15,26,20,.06), 0 12px 32px rgba(15,26,20,.08);
    }
}

/* ─── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'cv11', 'ss01';
}
img, svg { display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code, pre, kbd { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }
.icon    { width: 20px; height: 20px; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; flex-shrink: 0; }
.skip-link {
    position: absolute; left: 12px; top: -48px; z-index: 1000;
    background: var(--accent-bg); color: var(--on-accent);
    padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ─── Header / footer ────────────────────────────────────────────────────── */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1080px; margin: 0 auto; padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
    display: inline-flex; align-items: center; gap: 10px;
    color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
}
.brand-mark { width: 30px; height: 30px; border-radius: 8px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
    color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 500;
    padding: 8px 12px; border-radius: var(--radius-sm); transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav .btn { margin-left: 8px; }
.nav a.btn-primary { color: var(--on-accent); }
.nav a.btn-primary:hover { color: var(--on-accent); background: var(--accent-bg-hover); }

.site-footer { border-top: 1px solid var(--border); margin-top: auto; }
.footer-inner {
    max-width: 1080px; margin: 0 auto; padding: 24px;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
    font-size: 14px; color: var(--text-faint);
}
.footer-links { display: flex; gap: 20px; list-style: none; }
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }

main { flex: 1; width: 100%; }
.container   { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.narrow      { max-width: 640px;  margin: 0 auto; padding: 0 20px; }
.page-center { display: flex; flex-direction: column; align-items: center; padding: 56px 20px 72px; }

/* ─── Type ───────────────────────────────────────────────────────────────── */
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.2; }
.display { font-size: clamp(2.1rem, 5.2vw, 3.4rem); font-weight: 700; letter-spacing: -0.035em; line-height: 1.08; }
.display .accent { color: var(--accent); }
.lead  { font-size: clamp(1.02rem, 1.6vw, 1.15rem); color: var(--text-muted); line-height: 1.65; }
.h1    { font-size: clamp(1.6rem, 3.4vw, 2rem); font-weight: 700; }
.h2    { font-size: clamp(1.4rem, 2.8vw, 1.75rem); font-weight: 700; }
.h3    { font-size: 1.05rem; font-weight: 600; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 14px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: 0.02em; }
.center { text-align: center; }

/* ─── Card ───────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px;
    width: 100%;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 10px 18px;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    font-size: 15px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent-bg); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-bg-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.btn-sm    { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn-lg    { min-height: 52px; padding: 14px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn.is-done { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field + .field, .fieldset + .field, .field + .fieldset { margin-top: 20px; }
.label { font-size: 14px; font-weight: 600; color: var(--text); }
.label .opt { font-weight: 400; color: var(--text-faint); }
.hint  { font-size: 13px; color: var(--text-faint); }
.input, .textarea {
    width: 100%; padding: 12px 14px;
    background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { min-height: 180px; resize: vertical; font-family: var(--mono); font-size: 14px; line-height: 1.6; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 76px; }
.input-wrap .reveal {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: 0; color: var(--text-muted);
    font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 6px;
}
.input-wrap .reveal:hover { color: var(--text); background: var(--surface-2); }

/* Choice chips (radio group) */
.fieldset { border: 0; }
.fieldset legend { margin-bottom: 8px; }
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.chip { position: relative; }
.chip.wide { grid-column: span 2; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span {
    display: flex; align-items: center; justify-content: center; gap: 6px; height: 100%;
    min-height: 42px; padding: 8px 10px; white-space: nowrap;
    border: 1px solid var(--border-strong); border-radius: 999px;
    font-size: 14px; font-weight: 500; color: var(--text-muted); background: var(--bg);
    transition: all .15s;
}
.chip:hover span { color: var(--text); border-color: var(--text-faint); }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── Segmented tabs ─────────────────────────────────────────────────────── */
.segmented {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
    padding: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 22px;
}
.segmented [role="tab"] {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; border: 0; border-radius: var(--radius-sm); background: transparent;
    color: var(--text-muted); font-size: 15px; font-weight: 600; transition: all .15s;
}
.segmented [role="tab"]:hover { color: var(--text); }
.segmented [role="tab"][aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.2); }

/* ─── Drop zone ──────────────────────────────────────────────────────────── */
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    width: 100%; padding: 40px 20px; text-align: center;
    border: 2px dashed var(--border-strong); border-radius: var(--radius);
    background: var(--bg); color: var(--text-muted); transition: all .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-icon {
    width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent);
}
.dropzone strong { color: var(--text); font-size: 16px; }
.dropzone .link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.file-pill {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 12px 12px 14px; border: 1px solid var(--accent-line); background: var(--accent-soft);
    border-radius: var(--radius);
}
.file-pill .meta { flex: 1; min-width: 0; }
.file-pill .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pill .size { font-size: 13px; color: var(--text-muted); }

/* ─── Badge / file type tile ─────────────────────────────────────────────── */
.ftype {
    width: 56px; height: 64px; border-radius: 10px; flex-shrink: 0;
    display: grid; place-items: end center; padding-bottom: 10px;
    background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent);
    font-family: var(--mono); font-size: 11px; font-weight: 500; text-transform: uppercase;
    position: relative;
}
.ftype svg { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 22px; height: 22px; }

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 500;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
}
.pill.warn { background: var(--warning-soft); border-color: var(--warning-line); color: var(--warning); }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; line-height: 1.5;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
}
.alert .icon-sm { margin-top: 2px; }
.alert strong { color: var(--text); }
.alert-error   { background: var(--danger-soft);  border-color: var(--danger-line);  color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: var(--warning-line); color: var(--text); }
.alert-warning .icon-sm { color: var(--warning); }
.alert-info .icon-sm { color: var(--accent); }

/* ─── Progress ───────────────────────────────────────────────────────────── */
.progress { margin-top: 18px; }
.progress-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-fill  { height: 100%; width: 0; background: var(--accent-bg); border-radius: inherit; transition: width .2s; }
.progress-text  { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ─── Spinner ────────────────────────────────────────────────────────────── */
.spinner {
    width: 40px; height: 40px; border-radius: 50%;
    border: 3px solid var(--border); border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Status icon (success / error / gone) ───────────────────────────────── */
.status-icon {
    width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 20px;
    background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line);
}
.status-icon svg { width: 30px; height: 30px; }
.status-icon.is-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.status-icon.is-muted { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* ─── Definition list (link details) ─────────────────────────────────────── */
.details-list { display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.details-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 16px; font-size: 14px; }
.details-list > div + div { border-top: 1px solid var(--border); }
.details-list dt { color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.details-list dd { font-weight: 600; text-align: right; }
.details-list dd .faint { font-weight: 400; display: block; font-size: 13px; }

/* ─── Share link box ─────────────────────────────────────────────────────── */
.linkbox {
    font-family: var(--mono); font-size: 14px; line-height: 1.55; word-break: break-all;
    padding: 14px 16px; background: var(--bg); border: 1px solid var(--accent-line); border-radius: var(--radius-sm);
    color: var(--accent); user-select: all; cursor: text;
}

/* ─── Code ───────────────────────────────────────────────────────────────── */
.code {
    position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 20px; overflow-x: auto;
}
.code pre { font-size: 13px; line-height: 1.7; color: var(--text); white-space: pre; }
.code .c { color: var(--text-faint); }
.code .k { color: var(--accent); }
.code .copy { position: absolute; top: 10px; right: 10px; }

/* ─── Text viewer ────────────────────────────────────────────────────────── */
.textview {
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 16px 18px; font-family: var(--mono); font-size: 14px; line-height: 1.7;
    white-space: pre-wrap; word-wrap: break-word; max-height: 60vh; overflow: auto;
}

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 300;
    transform: translate(-50%, 140%); opacity: 0;
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px;
    font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
    transition: transform .25s ease, opacity .25s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ─── Disclosure ─────────────────────────────────────────────────────────── */
details.disclosure { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
details.disclosure > summary {
    list-style: none; cursor: pointer; padding: 18px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary .chev { transition: transform .2s; color: var(--text-muted); }
details.disclosure[open] > summary .chev { transform: rotate(180deg); }
details.disclosure > .disclosure-body { padding: 0 20px 20px; }

/* ─── Motion preferences ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ─── Small screens ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .header-inner { padding: 12px 16px; }
    .nav a:not(.btn) { display: none; }
    .card { padding: 20px; border-radius: var(--radius); }
    .container { padding: 0 16px; }
    .narrow { padding: 0 16px; }
    .page-center { padding: 36px 16px 56px; }
    .footer-inner { padding: 20px 16px; flex-direction: column; align-items: flex-start; }
    .btn-row > .btn { flex: 1 1 auto; }
}
