/* =========================================================
   Image Compressor — Stylesheet
   Design tokens: indigo→cyan gradient, graphite dark surface,
   Space Grotesk display / Inter body / JetBrains Mono data
   ========================================================= */

:root {
  --grad-1: #6366F1;
  --grad-2: #06B6D4;
  --accent-violet: #A855F7;
  --success: #10B981;
  --danger: #EF4444;

  --bg: #F6F7FB;
  --bg-2: #EDEFF7;
  --surface: rgba(255, 255, 255, 0.65);
  --surface-solid: #FFFFFF;
  --border: rgba(15, 23, 42, 0.08);
  --text: #12141C;
  --text-muted: #5B6072;
  --text-faint: #8A8FA3;
  --shadow: 0 8px 30px rgba(31, 41, 76, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0B0E14;
  --bg-2: #0F1320;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-solid: #141826;
  --border: rgba(255, 255, 255, 0.09);
  --text: #E7E9EE;
  --text-muted: #A7ACBC;
  --text-faint: #6B7186;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  transition: background 0.35s ease, color 0.35s ease;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font-family: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--grad-1);
  color: #fff;
  padding: 12px 18px;
  border-radius: 0 0 8px 0;
  z-index: 1000;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grad-2);
  font-weight: 600;
  margin: 0 0 10px;
}
.eyebrow.center { text-align: center; }

.accent-text {
  background: linear-gradient(120deg, var(--grad-1), var(--grad-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Glassmorphism base */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow);
}

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.brand-mark { display: flex; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.main-nav {
  display: flex;
  gap: 28px;
}
.main-nav a {
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease;
}
.main-nav a:hover { color: var(--text); }

.header-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--grad-2); }
.icon-sun, .icon-moon { position: absolute; }
html[data-theme="dark"] .icon-sun,
html:not([data-theme="dark"]) .icon-moon { display: none; }

/* =========================================================
   HERO / TOOL
   ========================================================= */
.hero {
  position: relative;
  padding: 64px 24px 80px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 640px;
  background:
    radial-gradient(600px 320px at 20% 10%, rgba(99, 102, 241, 0.28), transparent 65%),
    radial-gradient(560px 320px at 85% 20%, rgba(6, 182, 212, 0.24), transparent 65%),
    radial-gradient(500px 300px at 50% 60%, rgba(168, 85, 247, 0.14), transparent 65%);
  filter: blur(10px);
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
}

.hero-copy { margin-bottom: 40px; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.hero-sub {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Tool card */
.tool-card {
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: left;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 46px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--grad-2);
  background: rgba(6, 182, 212, 0.05);
}
.dropzone.dragover {
  border-color: var(--grad-1);
  background: rgba(99, 102, 241, 0.09);
  transform: scale(1.005);
}

.dropzone-content { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dropzone-icon {
  color: var(--grad-2);
  margin-bottom: 8px;
  animation: floatY 3.4s ease-in-out infinite;
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.dropzone-title { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; margin: 4px 0 2px; }
.dropzone-sub { color: var(--text-faint); font-size: 0.85rem; margin: 0 0 10px; }
.dropzone-formats { color: var(--text-faint); font-size: 0.8rem; margin-top: 14px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  font-family: var(--font-body);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(120deg, var(--grad-1), var(--grad-2));
  color: #fff;
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.32);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 28px rgba(99, 102, 241, 0.42); transform: translateY(-1px); }

.btn-lg { padding: 13px 28px; font-size: 1rem; }

.btn-secondary {
  background: var(--surface-solid);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--grad-2); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-solid); }

/* Controls */
.controls { margin-top: 26px; display: flex; flex-direction: column; gap: 20px; }

.controls-row { display: flex; flex-direction: column; gap: 8px; }
.quality-label {
  font-weight: 600;
  font-size: 0.92rem;
}
.quality-label span { font-family: var(--font-mono); color: var(--grad-2); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--grad-1), var(--grad-2));
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--grad-1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--grad-1);
  cursor: pointer;
}

.quality-hints { display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--text-faint); }

.controls-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Progress bar */
.progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--grad-1), var(--grad-2));
  border-radius: 999px;
  transition: width 0.3s ease;
  background-size: 200% 100%;
}
.progress-bar.active {
  animation: shimmer 1.6s linear infinite;
}
.progress-bar.done {
  background: linear-gradient(90deg, var(--grad-2), var(--success));
}
@keyframes shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
.progress-label { font-size: 0.82rem; color: var(--text-muted); font-family: var(--font-mono); }
.progress-label.done { color: var(--success); font-weight: 600; }

/* Summary meter — signature element */
.summary-meter {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.summary-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 88px; }
.summary-num { font-family: var(--font-mono); font-weight: 600; font-size: 1.05rem; }
.summary-tag { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }

.meter-visual { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.meter-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(239,68,68,0.25), rgba(16,185,129,0.15));
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}
.meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--grad-1), var(--success));
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.meter-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--success);
}

/* Results grid */
.results-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.result-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: cardIn 0.4s ease both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--bg-2);
}

.result-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.result-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
}
.result-stats .arrow { color: var(--text-faint); }
.result-stats .new-size { color: var(--text-faint); font-style: italic; font-weight: 500; }
.result-stats .new-size.final { color: var(--success); font-weight: 700; font-style: normal; }

.result-success {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-saved {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  color: var(--success);
}
.result-saved.negative {
  background: rgba(239, 68, 68, 0.14);
  color: var(--danger);
}

.result-status {
  font-size: 0.78rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}
.spinner {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--grad-2);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-download {
  margin-top: 4px;
  text-decoration: none;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--grad-1), var(--grad-2));
  color: #fff;
}

/* =========================================================
   GENERIC SECTIONS
   ========================================================= */
.section { padding: 76px 24px; }
.section.alt { background: var(--bg-2); }
.section-inner { max-width: 1100px; margin: 0 auto; }
.section-inner.narrow { max-width: 760px; }

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}
.section-title.center { text-align: center; }
.section-sub {
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 40px;
  line-height: 1.65;
}
.section-sub.center { text-align: center; }

.two-col {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 48px;
  align-items: start;
}
.two-col.reverse { grid-template-columns: 1.1fr 0.9fr; }
.two-col.reverse > *:first-child { order: 2; }

/* Feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.feature-card {
  padding: 24px;
  border-radius: var(--radius-md);
  transition: transform 0.25s ease;
}
.feature-card:hover { transform: translateY(-4px); }
.feature-icon {
  font-size: 1.8rem;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  background: var(--bg-2);
  margin-bottom: 14px;
}
.feature-card h3 { font-family: var(--font-display); margin: 0 0 8px; font-size: 1.08rem; }
.feature-card p { margin: 0; color: var(--text-muted); font-size: 0.92rem; line-height: 1.6; }

/* Benefits */
.benefits-list { display: flex; flex-direction: column; gap: 22px; max-width: 800px; margin: 0 auto; }
.benefit-row {
  padding: 20px 24px;
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  border: 1px solid var(--border);
}
.benefit-row h3 { font-family: var(--font-display); margin: 0 0 6px; font-size: 1.05rem; }
.benefit-row p { margin: 0; color: var(--text-muted); line-height: 1.65; }

/* Steps */
.steps-list {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}
.step-card { padding: 24px; border-radius: var(--radius-md); position: relative; }
.step-num {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(120deg, var(--grad-1), var(--grad-2));
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  margin-bottom: 14px;
}
.step-card h3 { font-family: var(--font-display); margin: 0 0 6px; font-size: 1.02rem; }
.step-card p { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

/* Checklists */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.checklist li {
  padding: 14px 16px 14px 42px;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  position: relative;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.checklist li strong { color: var(--text); }
.checklist li::before {
  content: "✓";
  position: absolute;
  left: 14px; top: 13px;
  color: var(--success);
  font-weight: 700;
}
.checklist.mistakes li::before { content: "✕"; color: var(--danger); }

/* Accordion / FAQ */
.accordion { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  overflow: hidden;
}
.accordion-item h3 { margin: 0; }
.accordion-trigger {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 16px 44px 16px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  position: relative;
}
.accordion-trigger::after {
  content: "+";
  position: absolute;
  right: 18px; top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  color: var(--grad-2);
  transition: transform 0.25s ease;
  font-weight: 400;
}
.accordion-trigger[aria-expanded="true"]::after { transform: translateY(-50%) rotate(45deg); }

.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 18px;
}
.accordion-item:has(.accordion-trigger[aria-expanded="true"]) .accordion-panel {
  max-height: 400px;
  padding: 0 18px 16px;
}
.accordion-panel p { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

/* Related tools */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.related-card {
  padding: 22px;
  border-radius: var(--radius-md);
  transition: transform 0.25s ease, border-color 0.25s ease;
  cursor: default;
}
.related-card:hover { transform: translateY(-3px); border-color: var(--grad-2); }
.related-card h3 { font-family: var(--font-display); margin: 0 0 6px; font-size: 1rem; }
.related-card p { margin: 0; font-size: 0.88rem; color: var(--text-muted); line-height: 1.55; }

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.footer-brand p { margin: 4px 0 0; color: var(--text-faint); font-size: 0.82rem; }
.footer-nav { display: flex; gap: 20px; }
.footer-nav a { text-decoration: none; font-size: 0.85rem; color: var(--text-muted); }
.footer-nav a:hover { color: var(--text); }
.footer-copy { font-size: 0.78rem; color: var(--text-faint); margin: 0; width: 100%; text-align: center; }

@media (min-width: 640px) {
  .footer-copy { width: auto; }
}

/* =========================================================
   TOASTS
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: 90px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  max-width: min(340px, calc(100vw - 40px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  animation: toastIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.toast.leaving { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}
.toast-icon { flex-shrink: 0; font-size: 1.05rem; }
.toast.success { border-color: rgba(16, 185, 129, 0.4); }
.toast.error { border-color: rgba(239, 68, 68, 0.4); }
.toast.info { border-color: rgba(99, 102, 241, 0.4); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 860px) {
  .two-col, .two-col.reverse { grid-template-columns: 1fr; }
  .two-col.reverse > *:first-child { order: 0; }
}

@media (max-width: 720px) {
  .main-nav { display: none; }
  .hero { padding: 44px 16px 56px; }
  .tool-card { padding: 20px; }
  .dropzone { padding: 32px 14px; }
  .section { padding: 56px 16px; }
  .summary-meter { grid-template-columns: 1fr; text-align: center; }
  .header-inner { padding: 12px 16px; }
}

@media (max-width: 420px) {
  .controls-actions { flex-direction: column; }
  .controls-actions .btn { width: 100%; }
}
