/* ============================================================================
   ImgSmush — one clean, modern screen.
   Dark cool charcoal, Archivo + JetBrains Mono, a single acid-lime accent.
   Ported from the Claude Design handoff (imgsmush/project/ImgSmush.html).
   ========================================================================== */

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

:root {
    --bg:      #0b0c0e;
    --bg-1:    #131419;
    --bg-2:    #181a20;
    --bg-3:    #1f222a;
    --line:    rgba(255, 255, 255, 0.075);
    --line-2:  rgba(255, 255, 255, 0.13);
    --text:    #eceef2;
    --dim:     #9499a3;
    --dimmer:  #61656f;
    --accent:  #bef264;
    --danger:  #e0795f;
    --radius:  16px;
    --font: "Archivo", system-ui, -apple-system, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
}

html, body { margin: 0; padding: 0; background: var(--bg); }
body {
    font-family: var(--font);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.45;
}
.mono { font-family: var(--mono); }
::selection { background: var(--accent); color: #0c0d0f; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }

/* subtle ambient glow tinted by accent, kept very faint */
body::before {
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background:
        radial-gradient(900px 480px at 78% -8%, color-mix(in oklch, var(--accent) 9%, transparent), transparent 60%),
        radial-gradient(700px 500px at -5% 8%, rgba(120, 140, 200, 0.05), transparent 60%);
}

/* ---- Boot / WASM loading screen ---------------------------------------- */
.boot {
    position: fixed; inset: 0; z-index: 5;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 1.2rem; background: var(--bg);
}
.boot-mark {
    font-weight: 900; letter-spacing: -0.03em;
    font-size: clamp(2rem, 6vw, 3rem);
}
.boot-mark span { color: var(--accent); }
.boot-bar {
    width: min(240px, 60vw); height: 3px;
    background: var(--line-2); border-radius: 99px; overflow: hidden;
}
.boot-bar i {
    display: block; height: 100%; width: 40%;
    background: var(--accent); border-radius: 99px;
    animation: boot-slide 1.1s ease-in-out infinite;
}
@keyframes boot-slide {
    0%   { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}
.boot-text { color: var(--dimmer); font-family: var(--mono); font-size: 0.8rem; }

/* ---- App shell --------------------------------------------------------- */
.app {
    position: relative; z-index: 1;
    max-width: 1140px; margin: 0 auto;
    padding: clamp(34px, 6vw, 80px) clamp(20px, 5vw, 56px) 120px;
}

/* ---- Hero -------------------------------------------------------------- */
.hero { margin-bottom: 40px; }
.wordmark { font-size: clamp(44px, 8vw, 80px); font-weight: 900; letter-spacing: -0.03em; margin: 0 0 18px; line-height: 0.95; }
.wordmark span { color: var(--accent); }
/* The router focuses <h1> on load for a11y; it isn't interactive, so hide the ring. */
.wordmark:focus, .wordmark:focus-visible { outline: none; }
.tagline { max-width: 540px; color: var(--dim); font-size: 16px; margin: 0 0 22px; }
.tagline strong { color: var(--text); font-weight: 600; }
.privacy {
    display: inline-flex; align-items: center; gap: 9px; font-size: 12px; letter-spacing: 0.02em;
    color: var(--text); padding: 8px 15px; border: 1px solid var(--accent); border-radius: 999px;
    background: color-mix(in oklch, var(--accent) 7%, transparent);
}
.pv-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px 1px var(--accent); }

/* ---- Dropzone ---------------------------------------------------------- */
.drop {
    position: relative;
    border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--bg-1);
    padding: 56px 24px; text-align: center; transition: border-color .16s, background .16s; cursor: pointer; margin-bottom: 26px;
}
.drop:hover { background: var(--bg-2); border-color: rgba(255, 255, 255, 0.22); }
.drop.over { background: color-mix(in oklch, var(--accent) 6%, var(--bg-1)); border-color: var(--accent); }
.drop-compact { padding: 30px 24px; }
.drop-ic { width: 56px; height: 56px; margin: 0 auto 18px; border: 1.5px solid var(--line-2); border-radius: 14px; display: flex; align-items: center; justify-content: center; color: var(--dim); transition: .16s; }
.drop-compact .drop-ic { width: 44px; height: 44px; margin-bottom: 12px; }
.drop:hover .drop-ic { color: var(--text); }
.drop.over .drop-ic { color: var(--accent); border-color: var(--accent); }
.drop-title { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.drop-title span { color: var(--accent); }
.drop-compact .drop-title { font-size: 17px; }
.drop-sub { font-size: 11.5px; color: var(--dimmer); margin-top: 10px; letter-spacing: 0.01em; }
/* the InputFile <input> stretched invisibly over the whole zone */
.drop-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-input:disabled { cursor: progress; }

/* empty-state hint */
.how {
    display: flex; flex-wrap: wrap; gap: 10px 22px; margin: -10px 4px 0;
    color: var(--dimmer); font-size: 12px; font-family: var(--mono); letter-spacing: 0.02em;
}
.how span { display: inline-flex; align-items: center; gap: 8px; }
.how b { color: var(--accent); font-weight: 700; }

/* ---- Summary bar ------------------------------------------------------- */
.summary {
    display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
    background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 24px; margin-bottom: 22px;
}
.sum-stats { display: flex; align-items: center; gap: 22px; }
.sum-stat { display: flex; flex-direction: column; gap: 3px; }
.sum-big { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; line-height: 1; color: var(--accent); }
.sum-big.neutral { color: var(--text); }
.sum-of { color: var(--dimmer); font-size: 16px; }
.sum-lbl { font-size: 10px; letter-spacing: 0.14em; color: var(--dimmer); }
.sum-sep { width: 1px; height: 34px; background: var(--line); }
.sum-actions { display: flex; gap: 10px; align-items: center; }
.btn-ghost { padding: 11px 20px; border-radius: 999px; background: var(--bg-3); font-weight: 600; font-size: 14px; transition: background .15s; }
.btn-ghost:hover:not(:disabled) { background: #2a2e38; }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-solid { padding: 11px 22px; border-radius: 999px; background: var(--accent); color: #0c0d0f; font-weight: 700; font-size: 14px; transition: filter .15s, opacity .15s; }
.btn-solid:hover:not(:disabled) { filter: brightness(1.08); }
.btn-solid:disabled { opacity: 0.5; cursor: progress; }

.progress {
    flex-basis: 100%; height: 4px; border-radius: 999px; background: var(--line-2); overflow: hidden;
}
.progress i {
    display: block; height: 100%; border-radius: 999px; background: var(--accent);
    transition: width .3s ease; box-shadow: 0 0 12px color-mix(in oklch, var(--accent) 50%, transparent);
}

/* ---- Result grid ------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 16px; }
.card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .16s, transform .16s; }
.card:hover { border-color: var(--line-2); }

.card-img {
    position: relative; aspect-ratio: 16/10; overflow: hidden;
    background-color: #15171c;
    background-image:
        linear-gradient(45deg, #1c1f26 25%, transparent 25%), linear-gradient(-45deg, #1c1f26 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1c1f26 75%), linear-gradient(-45deg, transparent 75%, #1c1f26 75%);
    background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.ci-before { opacity: 0; transition: opacity .18s; }
.card-img:hover .ci-before { opacity: 1; }
.ci-tag { position: absolute; left: 9px; top: 9px; font-size: 9.5px; letter-spacing: 0.08em; color: var(--dim); background: rgba(8, 9, 11, 0.72); padding: 4px 8px; border-radius: 6px; opacity: 0; transition: opacity .18s; backdrop-filter: blur(4px); }
.card-img:hover .ci-tag { opacity: 1; }
.ci-zoom { position: absolute; right: 9px; bottom: 9px; width: 34px; height: 34px; border-radius: 9px; background: rgba(8, 9, 11, 0.72); color: var(--text); display: flex; align-items: center; justify-content: center; opacity: 0; transform: translateY(4px); transition: .18s; backdrop-filter: blur(4px); }
.card-img:hover .ci-zoom { opacity: 1; transform: none; }
.ci-zoom:hover { background: var(--accent); color: #0c0d0f; }
.card-img.loading { display: flex; align-items: center; justify-content: center; }
.card-img.error { display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem; color: var(--danger); font-size: 12px; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* The palette ImgSmush distilled — the signature strip. */
.strip { display: flex; height: 7px; }
.strip span { flex: 1; }

.card-body { padding: 14px 16px 4px; }
.card-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: 11px; color: var(--dim); margin-top: 4px; }
.card-size { display: flex; align-items: center; gap: 8px; margin-top: 11px; }
.sz-old { font-size: 12px; color: var(--dimmer); text-decoration: line-through; }
.sz-arrow { color: var(--dimmer); font-size: 12px; }
.sz-new { font-size: 14px; font-weight: 600; color: var(--text); }
.sz-pct { margin-left: auto; font-size: 11px; font-weight: 600; border: 1px solid var(--accent); color: var(--accent); padding: 2px 7px; border-radius: 6px; }
.sz-pct.grew { border-color: var(--danger); color: var(--danger); }
.sz-pct.optimal { border-color: var(--line-2); color: var(--dim); letter-spacing: 0.04em; }

.card-actions { display: flex; gap: 8px; padding: 12px 16px 16px; align-items: center; }
.ca-btn { flex: 1; padding: 8px; border-radius: 9px; background: var(--bg-3); font-size: 12.5px; font-weight: 600; text-align: center; transition: background .15s; color: var(--text); }
.ca-btn:hover { background: #2a2e38; }
.ca-x { width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--bg-3); color: var(--dim); font-size: 12px; transition: .15s; }
.ca-x:hover { background: #3a2326; color: var(--danger); }

/* ---- Footnote ---------------------------------------------------------- */
.footnote {
    margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line);
    color: var(--dimmer); font-size: 12.5px; line-height: 1.7; max-width: 720px;
}
.footnote .mono { font-family: var(--mono); color: var(--dim); }
.footnote a { color: var(--dim); border-bottom: 1px solid var(--line-2); }
.footnote a:hover { color: var(--accent); }

/* ---- Compare modal ----------------------------------------------------- */
.cmp-backdrop {
    position: fixed; inset: 0; z-index: 100; background: rgba(6, 7, 9, 0.86); backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: center; padding: 24px; animation: cmp-fade .18s ease;
}
@keyframes cmp-fade { from { opacity: 0; } }
.cmp-shell { width: min(1160px, 96vw); height: min(880px, 92vh); background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.8); }
.cmp-head { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.cmp-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cmp-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--accent); }
.cmp-fname { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-meta { font-size: 12px; color: var(--dim); margin-left: auto; white-space: nowrap; }
.cmp-meta .struck { text-decoration: line-through; opacity: 0.5; }
.cmp-meta .gain { color: var(--accent); }
.cmp-x { width: 36px; height: 36px; border-radius: 9px; background: var(--bg-3); color: var(--dim); font-size: 13px; flex: none; transition: .15s; }
.cmp-x:hover { background: #3a2326; color: var(--danger); }
.cmp-stage { position: relative; flex: 1; overflow: hidden; background: #0e0f12; touch-action: none; }
.cmp-layer {
    position: absolute; inset: 0; overflow: hidden; will-change: clip-path;
    background-image:
        linear-gradient(45deg, #1a1d22 25%, transparent 25%), linear-gradient(-45deg, #1a1d22 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1a1d22 75%), linear-gradient(-45deg, transparent 75%, #1a1d22 75%);
    background-size: 22px 22px; background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
.cmp-layer img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: center center; user-select: none; -webkit-user-drag: none; }
.cmp-tag { position: absolute; top: 14px; font-size: 10px; letter-spacing: 0.12em; padding: 5px 10px; border-radius: 7px; background: rgba(8, 9, 11, 0.75); backdrop-filter: blur(5px); transition: opacity .15s; pointer-events: none; border: 1px solid var(--line-2); color: var(--dim); }
.cmp-tag-l { left: 14px; }
.cmp-tag-r { right: 14px; border-color: var(--accent); color: var(--accent); }
.cmp-divider { position: absolute; top: 0; bottom: 0; width: 40px; transform: translateX(-50%); cursor: ew-resize; display: flex; align-items: center; justify-content: center; touch-action: none; }
.cmp-divline { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3); }
.cmp-handle { width: 38px; height: 38px; border-radius: 50%; background: rgba(12, 13, 15, 0.85); border: 2px solid var(--accent); display: flex; align-items: center; justify-content: center; gap: 1px; color: #fff; font-size: 16px; backdrop-filter: blur(6px); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); }
.cmp-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.cmp-hint { font-size: 11px; color: var(--dimmer); letter-spacing: 0.01em; }
.cmp-zoom { display: flex; align-items: center; gap: 6px; }
.cmp-zoom button { width: 32px; height: 32px; border-radius: 8px; background: var(--bg-3); font-size: 17px; color: var(--text); transition: .15s; }
.cmp-zoom button:hover:not(:disabled) { background: #2a2e38; }
.cmp-zval { min-width: 54px; text-align: center; font-size: 13px; color: var(--dim); }
.cmp-reset { width: auto !important; padding: 0 12px; font-size: 11px !important; letter-spacing: 0.06em; color: var(--dim) !important; }
.cmp-reset:disabled { opacity: 0.35; cursor: default; }

/* ---- Blazor error UI (restyled to match) ------------------------------- */
#blazor-error-ui {
    color-scheme: dark only;
    background: var(--bg-3); color: var(--text);
    border-top: 1px solid var(--danger);
    bottom: 0; left: 0; width: 100%;
    box-sizing: border-box; display: none; position: fixed; z-index: 1000;
    padding: 0.7rem 1.25rem; font-size: 0.9rem;
}
#blazor-error-ui .reload { color: var(--accent); }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: 0.55rem; color: var(--dim); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
