/* ============================================================
   reduceimagequality.com — homepage styles
   Design system: warm stone neutrals + burnt orange accent.
   Zero dependencies, no web fonts (LCP budget), system stack.
   Shape contract: panels/cards 16px · buttons/inputs 10px · chips 8px.
   ============================================================ */

:root {
  color-scheme: light;

  --accent: #c2410c;          /* burnt orange 700 — text-safe on light */
  --accent-strong: #9a3412;   /* hover / pressed */
  --accent-bright: #ea580c;   /* fills on dark surfaces */
  --accent-soft: #fff7ed;     /* tinted wash */
  --accent-border: #fdba74;

  --ink: #1c1917;             /* stone 900 */
  --text: #1c1917;
  --text-muted: #57534e;      /* stone 600 */
  --border: #e7e5e4;          /* stone 200 */
  --bg: #fafaf9;              /* stone 50 */
  --bg-alt: #f5f5f4;          /* stone 100 */
  --surface: #ffffff;
  --checker-a: #eceae6;
  --checker-b: #f5f5f4;
  --danger: #b91c1c;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-chip: 8px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.05), 0 6px 20px rgba(28, 25, 23, 0.05);
  --shadow-lg: 0 2px 6px rgba(28, 25, 23, 0.06), 0 16px 44px rgba(28, 25, 23, 0.10);
  --shadow-accent: 0 8px 24px rgba(194, 65, 12, 0.22);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --accent: #ea580c;
  --accent-strong: #f97316;
  --accent-soft: rgba(234, 88, 12, 0.10);
  --accent-border: rgba(249, 115, 22, 0.35);

  --text: #fafaf9;
  --text-muted: #a8a29e;
  --border: #3f3a36;
  --bg: #191715;
  --bg-alt: #211e1b;
  --surface: #262220;
  --checker-a: #2c2926;
  --checker-b: #211e1b;
  --danger: #f87171;
  --warn-bg: rgba(251, 191, 36, 0.12);
  --warn-text: #fcd34d;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.35), 0 16px 44px rgba(0, 0, 0, 0.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

img { max-width: 100%; display: block; }

::selection { background: var(--accent-border); color: var(--ink); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ---------- Scroll reveal (JS-gated; static under reduced motion / no-JS) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
    transition-delay: var(--rd, 0ms);
  }
  .js [data-reveal].is-revealed { opacity: 1; transform: none; }
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  display: inline-flex;
  align-items: center;
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.02em;
  padding: 8px 2px; /* lifts the tap target to 44px (iOS HIG) */
}

.logo span { color: var(--accent); }

.header-nav { display: flex; gap: 22px; }

.header-nav a {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 10px 6px; /* 44px tap target */
  transition: color 0.15s ease;
}

.header-nav a:hover { color: var(--accent); }

/* ---------- Hero ---------- */

.hero {
  background: radial-gradient(1100px 380px at 50% -80px, var(--accent-soft), transparent);
  padding: 60px 0 44px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.06;
}

.hero-sub {
  max-width: 620px;
  margin: 16px auto 0;
  font-size: 1.12rem;
  color: var(--text-muted);
}

.trust-badges {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px auto 0;
}

.trust-badges li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  padding: 9px 16px;
  font-size: 0.88rem;
}

.trust-badges strong { font-size: 0.92rem; }

.trust-badges span { color: var(--text-muted); }

/* ---------- Tool panel ---------- */

.tool-panel {
  max-width: 900px;
  margin: 34px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  text-align: left;
}

.dropzone {
  border: 2px dashed var(--accent-border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s var(--ease-out);
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
  transform: translateY(-1px);
}

.dropzone-icon { font-size: 2.4rem; }

.dropzone-title { font-weight: 600; font-size: 1.05rem; margin-top: 8px; }

.dropzone-hint { color: var(--text-muted); font-size: 0.88rem; margin-top: 4px; }

.dropzone-error {
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 10px;
}

.sample-row { text-align: center; margin-top: 14px; }

/* ---------- Preview ---------- */

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.preview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-alt);
}

.preview-card figcaption {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.preview-img-box {
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background-image:
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%),
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  background-color: var(--checker-b);
}

.preview-img-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-meta {
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
  min-height: 2.4em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Controls ---------- */

.controls { margin-top: 22px; }

.control-row { margin-top: 16px; }

.control-row:first-child { margin-top: 0; }

.control-row-split {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.slider-label { font-weight: 700; font-size: 1rem; display: block; margin-bottom: 8px; }

.slider-label output { color: var(--accent); font-variant-numeric: tabular-nums; }

input[type="range"] {
  width: 100%;
  height: 8px;
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(90deg, var(--accent), var(--accent-border));
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: 0 1px 4px rgba(28, 25, 23, 0.3);
  cursor: grab;
  transition: transform 0.15s var(--ease-out);
}

input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); cursor: grabbing; }

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: 0 1px 4px rgba(28, 25, 23, 0.3);
  cursor: grab;
}

.slider-ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.format-label { font-size: 0.92rem; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }

.format-label select {
  font: inherit;
  font-weight: 500;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.format-note { font-size: 0.82rem; color: var(--text-muted); }

.status-line {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 2.4em;
  font-variant-numeric: tabular-nums;
}

.status-line.status-warning { background: var(--warn-bg); color: var(--warn-text); }

.action-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.replace-hint {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* swap the replacement tip per input model: drag & paste on desktop, file picker on touch */
.hint-touch { display: none; }

@media (hover: none), (pointer: coarse) {
  .hint-desktop { display: none; }
  .hint-touch { display: inline; }
}

/* ---------- Page-wide drop overlay (replace/load image from anywhere) ---------- */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

.drop-overlay.is-active { opacity: 1; }

.drop-overlay-card {
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 44px 72px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
  text-align: center;
}

@media (prefers-reduced-motion: no-preference) {
  .drop-overlay { transition: opacity 0.15s ease; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 26px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform 0.12s var(--ease-out), background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn:focus-visible,
.dropzone:focus-visible,
input[type="range"]:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover { background: var(--accent-strong); transform: translateY(-1px); }

.btn-primary:disabled {
  background: var(--accent-border);
  cursor: not-allowed;
  box-shadow: none;
}

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

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-lg { font-size: 1.1rem; padding: 16px 34px; }

/* ---------- Ad slots ---------- */

/* hidden until AdSense is approved: restore `display:flex` (and drop this line)
   when the real <ins> tags are uncommented in index.html */
.ad-slot { display: none; }

.ad-slot-live {
  min-height: 110px;
  margin: 28px 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.55;
}

.ad-slot-live::after { content: "Advertisement"; }

/* ---------- Sections ---------- */

.section { padding: 72px 0; }

.section-alt { background: var(--bg-alt); }

.section > .container > h2,
.section > .container > .prose > h2 {
  font-size: clamp(1.45rem, 3.2vw, 1.95rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 36px;
}

.prose { max-width: 780px; }

.prose h3 { font-size: 1.15rem; margin: 28px 0 8px; }

.prose p { margin-bottom: 14px; color: var(--text-muted); }

.prose ul, .prose ol { margin: 0 0 14px 22px; color: var(--text-muted); }

.prose li { margin-bottom: 6px; }

/* ---------- Cards (Key Features) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 20px;
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

/* one tinted cell breaks the uniform grid */
.card.card-tinted {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.card-icon { font-size: 1.8rem; margin-bottom: 10px; }

.card h3 { font-size: 1.05rem; margin-bottom: 6px; }

.card p { font-size: 0.9rem; color: var(--text-muted); }

/* ---------- Index list (Why Choose — different family from cards) ---------- */

.index-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 48px;
}

.index-item {
  display: flex;
  gap: 16px;
  padding: 22px 0;
  border-top: 1px solid var(--border);
}

.index-item:nth-last-child(-n + 2) { padding-bottom: 0; }

.index-icon { font-size: 1.5rem; line-height: 1.4; }

.index-item h3 { font-size: 1.02rem; margin-bottom: 4px; }

.index-item p { font-size: 0.92rem; color: var(--text-muted); }

/* ---------- Use cases ---------- */

.use-case-list {
  list-style: none !important;
  margin: 0 !important;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.use-case-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  padding: 12px 14px;
  font-size: 0.9rem;
  margin-bottom: 0 !important;
  color: var(--text-muted);
}

.use-case-list strong { color: var(--text); }

/* ---------- Steps ---------- */

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px 22px;
  box-shadow: var(--shadow);
}

.step::after {
  /* connector between numbered steps — organizes the sequence */
  content: "";
  position: absolute;
  top: 44px;
  left: calc(100% - 4px);
  width: 26px;
  height: 1px;
  background: var(--accent-border);
}

.step:last-child::after { display: none; }

.step-num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.step h3 { font-size: 1.08rem; margin-bottom: 8px; }

.step p { font-size: 0.93rem; color: var(--text-muted); }

/* ---------- CTA ---------- */

.cta {
  background: var(--ink);
  text-align: center;
}

[data-theme="dark"] .cta { background: #000; }

.cta h2 { color: #fafaf9; }

.cta p { color: #d6d3d1; margin-bottom: 26px; }

.cta .btn-primary { background: var(--accent-bright); box-shadow: 0 8px 24px rgba(234, 88, 12, 0.4); }

.cta .btn-primary:hover { background: #f97316; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 36px 0 24px;
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-logo { font-weight: 800; }

.footer-logo span { color: var(--accent); }

.footer-tagline {
  color: var(--text-muted);
  max-width: 420px;
  margin-top: 6px;
}

.site-footer nav { display: flex; gap: 18px; }

.site-footer nav a {
  display: inline-flex;
  align-items: center;
  padding: 10px 0; /* 44px tap target */
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer nav a:hover { color: var(--accent); }

.footer-copyright {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.84rem;
}

/* ---------- Privacy page ---------- */

.page-article { padding: 48px 0 64px; }

.page-article h1 { margin-bottom: 18px; letter-spacing: -0.02em; }

.page-article h2 { font-size: 1.2rem; margin: 24px 0 8px; text-align: left; }

.page-article p, .page-article li { color: var(--text-muted); margin-bottom: 10px; }

.page-article ul { margin-left: 22px; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .index-list { grid-template-columns: 1fr; }
  .index-item:nth-last-child(-n + 2) { padding-bottom: 22px; }
  .index-item:last-child { padding-bottom: 0; }
  .use-case-list { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .hero { padding-top: 42px; }
  .tool-panel { padding: 18px; }
  .preview-grid { grid-template-columns: 1fr; }
  .preview-img-box { height: 220px; }
  .use-case-list { grid-template-columns: 1fr; }
  .header-nav { display: none; }
  .action-row .btn { width: 100%; }
  .steps { grid-template-columns: 1fr; }
  .step::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .btn, .dropzone, input[type="range"]::-webkit-slider-thumb { transition: none; }
}
