:root {
  --outer: #cfd9d9;
  --paper: #ecebe8;
  --ink: #1f2725;
  --ink-soft: #4a5452;
  --dark: #25302d;
  --dark-2: #2d3936;
  --dark-line: rgba(236, 235, 232, .1);
  --on-dark: #ecebe8;
  --on-dark-soft: rgba(236, 235, 232, .62);
  --pink: #d8a6c8;
  --ok: #a8d5b8;
  --bad: #f2a08f;
  --serif: "Iowan Old Style", Charter, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

/* Self-hosted Material Symbols subset (deblur only) — avoids sending visitor IPs to Google */
@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 100 700;
  font-display: block;
  src: url(./fonts/material-symbols-deblur.woff2) format('woff2');
}
/* Subset contains only the glyphs of "CompressPics" */
@font-face {
  font-family: 'Grechen Fuemen';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/grechen-fuemen-brand.woff2) format('woff2');
  unicode-range: U+43, U+50, U+63, U+65, U+69, U+6d, U+6f-70, U+72-73;
}
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
body { margin: 0; padding: 10px; background: var(--outer); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
.sprite { position: absolute; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
a { color: inherit; }

.frame { background: var(--paper); border-radius: 18px; overflow: hidden; min-height: calc(100vh - 20px); display: flex; flex-direction: column; }

/* Nav */
.nav { display: flex; justify-content: space-between; align-items: center; padding: 1.4rem 2rem; }
.brand { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em; text-decoration: none; }
.brand-icon { font-size: 26px; font-weight: 400; }
.brand-name { font: 500 1.77rem/1 'Grechen Fuemen', var(--serif); letter-spacing: 0; }
.nav-note { font-size: .8rem; color: var(--ink-soft); }

/* Hero */
.hero { text-align: center; padding: 3.5rem 1.5rem 4rem; }
.hero h1 { font: 400 clamp(2.4rem, 6vw, 4.1rem)/1.05 var(--serif); letter-spacing: -.025em; margin: 0 0 1rem; color: var(--ink); }
.lede { margin: 0 0 3rem; font-size: 1rem; color: var(--ink-soft); }

/* Tool card */
.tool {
  max-width: 560px; margin: 0 auto; text-align: left;
  background: var(--dark); color: var(--on-dark);
  border-radius: 14px; padding: 1.1rem 1.1rem .8rem;
  box-shadow: 0 30px 60px -20px rgba(31, 39, 37, .45), 0 2px 6px rgba(31, 39, 37, .15);
}
.tool-top { display: flex; justify-content: flex-start; margin-bottom: .6rem; }
#dropzone { min-height: 80px; padding: .3rem .25rem 1rem; border-radius: 10px; cursor: pointer; outline: none; transition: background .2s, box-shadow .2s; }
#dropzone:hover { background: rgba(255, 255, 255, .025); }
#dropzone.dragover, #dropzone:focus-visible { background: rgba(216, 166, 200, .08); box-shadow: inset 0 0 0 1px rgba(216, 166, 200, .5); }
#dropzone.busy { pointer-events: none; opacity: .6; }
.tool-title { margin: 0; font-size: .95rem; }
.tool-sub { margin: 0; font-size: .72rem; color: var(--on-dark-soft); letter-spacing: .02em; }

.chips { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  height: 30px; padding: 0 .7rem; border-radius: 999px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--dark-line);
  font-size: .75rem; color: var(--on-dark); transition: border-color .15s;
}
.chip:hover, .chip:focus-within { border-color: rgba(236, 235, 232, .3); }
.chip .icon { width: 13px; height: 13px; opacity: .75; }
.chip output { font-variant-numeric: tabular-nums; min-width: 2.2em; }
.chip select {
  -webkit-appearance: none; appearance: none; border: 0; background: transparent;
  color: inherit; font: inherit; cursor: pointer; padding: 0; outline: none;
}
.chip option { background: var(--dark); }

.send {
  margin-left: auto; width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 7px; background: var(--paper); color: var(--ink); cursor: pointer;
  transition: transform .15s, background .15s;
}
.send:hover { transform: translateY(-1px); background: #fff; }
.send:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

.progress { height: 2px; margin-top: .9rem; background: rgba(236, 235, 232, .08); border-radius: 2px; overflow: hidden; }
.progress > div { width: 0; height: 100%; background: linear-gradient(90deg, #8e86c9, var(--pink), #e9b48a); transition: width .25s ease; }
.status { display: flex; justify-content: space-between; gap: 1rem; min-height: 1.2em; margin-top: .4rem; font-size: .72rem; color: var(--on-dark-soft); }
#error { color: var(--bad); }

/* Pixel band */
.pixels { display: block; width: 100%; height: 150px; margin-top: auto; }

/* Dark section */
.dark { background: var(--dark); color: var(--on-dark); padding: 3rem clamp(1.5rem, 6vw, 4.5rem) 2rem; }
.dark h2 { font: 400 clamp(1.8rem, 3.6vw, 2.6rem)/1.1 var(--serif); letter-spacing: -.02em; margin: 0; }

.intro { display: grid; grid-template-columns: 1.2fr 1fr; gap: 3rem; align-items: end; padding-bottom: 2.5rem; border-bottom: 1px solid var(--dark-line); }
.intro p { margin: 0; color: var(--on-dark-soft); max-width: 34ch; font-size: .95rem; justify-self: end; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2rem; }
.card { background: var(--dark-2); border-radius: 12px; padding: 1.5rem; }
.card .icon { width: 22px; height: 22px; color: var(--pink); }
.card h3 { font: 400 1.35rem/1.2 var(--serif); margin: 1.25rem 0 .5rem; }
.card p { margin: 0; color: var(--on-dark-soft); font-size: .88rem; }
.card code { display: inline-block; margin-top: 1rem; font: .8rem ui-monospace, SFMono-Regular, Menlo, monospace; background: rgba(0, 0, 0, .25); padding: .35rem .6rem; border-radius: 6px; }
.badge { display: inline-block; vertical-align: middle; margin-left: .4rem; padding: .15rem .5rem; border-radius: 999px; font: 500 .65rem/1.4 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--dark); background: var(--pink); }
.card-soon code { opacity: .45; user-select: none; }

/* Result */
.result[hidden] { display: none; }
.result { padding-bottom: 3rem; margin-bottom: 3rem; border-bottom: 1px solid var(--dark-line); animation: rise .5s cubic-bezier(.2, .8, .2, 1); scroll-margin-top: 1rem; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; margin-bottom: 1.75rem; }
#reduction { font-style: italic; }
#reduction.pass { color: var(--pink); }
#reduction.fail { color: var(--bad); }
.btn-light {
  display: inline-flex; align-items: center; gap: .5rem; flex-shrink: 0;
  background: var(--paper); color: var(--ink); text-decoration: none;
  font-size: .85rem; font-weight: 500; padding: .6rem 1rem; border-radius: 8px; transition: background .15s;
}
.btn-light:hover { background: #fff; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--dark-line); border-bottom: 1px solid var(--dark-line); margin-bottom: 1.5rem; }
.stat { display: flex; flex-direction: column; padding: 1rem 0; }
.stat + .stat { padding-left: 1.5rem; border-left: 1px solid var(--dark-line); }
.stat span { font-size: .75rem; color: var(--on-dark-soft); }
.stat strong { font: 400 1.6rem/1.2 var(--serif); font-variant-numeric: tabular-nums; }
.stat small { font-size: .75rem; color: var(--on-dark-soft); }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.compare figure { margin: 0; }
.compare figcaption { font-size: .75rem; color: var(--on-dark-soft); margin-bottom: .5rem; }
.viewport { height: 380px; overflow: auto; border-radius: 12px; background: #1b2321; cursor: zoom-in; }
.viewport img { display: block; width: 100%; height: 100%; object-fit: contain; }
.compare.zoomed .viewport { cursor: zoom-out; }
.compare.zoomed .viewport img { width: auto; height: auto; max-width: none; object-fit: none; }
.hint { display: flex; align-items: center; gap: .4rem; margin: .9rem 0 0; font-size: .75rem; color: var(--on-dark-soft); }
.hint .icon { width: 13px; height: 13px; }

.footer { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--dark-line); font-size: .78rem; color: var(--on-dark-soft); }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--on-dark); }
.host { margin-left: auto; display: inline-flex; align-items: baseline; gap: .4rem; }
.s96 { font: italic 800 1.05rem/1 var(--sans); letter-spacing: -.02em; color: var(--on-dark); }
.s96 b { font-weight: 800; color: #f5821f; }

@media (max-width: 820px) {
  .nav { padding: 1.1rem 1.25rem; }
  .hero { padding: 2.25rem 1rem 3rem; }
  .lede { margin-bottom: 2rem; }
  .intro { grid-template-columns: 1fr; gap: 1rem; }
  .intro p { justify-self: start; }
  .cards { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: stretch; }
  .btn-light { justify-content: center; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat + .stat { padding-left: .75rem; }
  .stat strong { font-size: 1.15rem; }
  .compare { grid-template-columns: 1fr; }
  .viewport { height: 260px; }
  .pixels { height: 110px; }
}
@media (max-width: 420px) {
  .nav-note { display: none; }
}
