/* ============ Images in Constant Flux — Design System ============ */
:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --brand1: #1d4ed8;
  --brand2: #0891b2;
  --brand-soft: #eff6ff;
  --ok: #12b76a;
  --err-bg: #fef3f2;
  --err-ink: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .07);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .14);
}

* { 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;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

.hidden { display: none !important; }

a { color: var(--brand1); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 17px; color: var(--ink); letter-spacing: -.2px;
}
.brand:hover { text-decoration: none; }
.brand-dot {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--brand1), var(--brand2));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px;
}
.nav-links { display: flex; gap: 20px; flex-wrap: wrap; }
.nav-links a { color: var(--muted); font-size: 14.5px; font-weight: 600; }
.nav-links a:hover { color: var(--brand1); text-decoration: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 420px at 85% -20%, rgba(255, 255, 255, .16), transparent),
    linear-gradient(135deg, #1e40af, #0369a1 55%, #0e7490);
  color: #fff;
  padding: 72px 0 64px;
}
.hero--tool { padding: 48px 0 44px; }
.hero::after {
  content: ""; position: absolute; inset: auto -80px -140px auto;
  width: 340px; height: 340px; border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.hero h1 {
  font-size: clamp(30px, 5vw, 46px); line-height: 1.15;
  letter-spacing: -.8px; margin-bottom: 16px; font-weight: 850;
}
.hero-sub {
  font-size: clamp(16px, 2.4vw, 19px); color: rgba(255, 255, 255, .88);
  max-width: 640px; margin-bottom: 28px;
}
.crumb { font-size: 13.5px; color: rgba(255, 255, 255, .75); margin-bottom: 14px; }
.crumb a { color: rgba(255, 255, 255, .92); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 11px; border: 0; cursor: pointer;
  font-size: 15.5px; font-weight: 700; font-family: inherit;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: #fff; color: var(--brand1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.btn-gradient, .btn-sm.btn-primary {
  background: linear-gradient(135deg, var(--brand1), var(--brand2)); color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}
.btn-ghost {
  background: rgba(255, 255, 255, .12); color: #fff;
  border: 1px solid rgba(255, 255, 255, .35);
}
.btn-sm { padding: 9px 16px; font-size: 14px; border-radius: 9px; }

.hero-stats {
  display: flex; gap: 34px; flex-wrap: wrap; margin-top: 34px;
}
.hero-stat strong { display: block; font-size: 22px; letter-spacing: -.4px; }
.hero-stat span { font-size: 13.5px; color: rgba(255, 255, 255, .75); }

/* ---------- Sections ---------- */
section { padding: 56px 0; }
.section-alt { background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
h2 {
  font-size: clamp(22px, 3.4vw, 30px); letter-spacing: -.5px;
  margin-bottom: 14px; font-weight: 800;
}
.section-lead { color: var(--muted); max-width: 660px; margin-bottom: 34px; font-size: 16.5px; }

/* ---------- Tool grid ---------- */
.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 18px;
}
.tool-card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
  color: inherit;
}
.tool-card:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-lg);
  border-color: #93c5fd; text-decoration: none;
}
.tool-chip {
  display: inline-block; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px; font-weight: 700; letter-spacing: .3px;
  background: linear-gradient(135deg, var(--brand1), var(--brand2));
  color: #fff; padding: 4px 10px; border-radius: 999px; margin-bottom: 12px;
}
.tool-card h3 { font-size: 17px; margin-bottom: 6px; letter-spacing: -.3px; }
.tool-card p { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.tool-go { font-size: 14px; font-weight: 700; color: var(--brand1); }

/* ---------- Features ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.feature-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.feature-icon {
  width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px;
  background: var(--brand-soft); display: flex; align-items: center; justify-content: center; font-size: 21px;
}
.feature-card h3 { font-size: 16.5px; margin-bottom: 6px; }
.feature-card p { font-size: 14.5px; color: var(--muted); }

/* ---------- Tool panel / dropzone ---------- */
.tool-panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow); padding: 28px; margin-top: -34px;
  position: relative; z-index: 2;
}
.dropzone {
  border: 2px dashed #93c5fd; border-radius: var(--radius);
  background: #fbfbff; min-height: 190px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center; padding: 28px 20px; outline: none;
  transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand1); background: var(--brand-soft); }
.dropzone.dragging {
  border-color: var(--brand1); background: var(--brand-soft);
  transform: scale(1.012); border-style: solid;
}
.dz-icon { font-size: 34px; margin-bottom: 4px; }
.dz-title { font-weight: 800; font-size: 17px; }
.dz-sub { color: var(--muted); font-size: 14px; }

.quality-row {
  display: flex; align-items: center; gap: 14px; margin-top: 18px;
  font-size: 14.5px; color: var(--muted); flex-wrap: wrap;
}
.quality-row input[type="range"] { flex: 1; min-width: 160px; accent-color: var(--brand1); }
.quality-row strong { color: var(--ink); min-width: 44px; text-align: right; }

.status-line { margin-top: 14px; font-size: 14.5px; color: var(--muted); min-height: 22px; }

#results { display: grid; gap: 12px; margin-top: 14px; }
.result-card {
  display: flex; align-items: center; gap: 14px;
  background: #fbfbff; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
.result-card--error { background: var(--err-bg); border-color: #fecdca; }
.result-thumb {
  width: 56px; height: 56px; object-fit: contain; border-radius: 8px;
  background: #f2f4f7; border: 1px solid var(--line); flex: none;
}
.result-info { flex: 1; min-width: 0; }
.result-name { font-weight: 700; font-size: 14.5px; word-break: break-all; }
.result-meta { font-size: 13px; color: var(--muted); word-break: break-all; }
.result-card--error .result-name { color: var(--err-ink); }
#downloadAll { margin-top: 16px; }

/* ---------- Content / copy blocks ---------- */
.content { max-width: 780px; }
.content h2 { margin-top: 8px; }
.content p { margin-bottom: 14px; color: #344054; font-size: 16px; }
.content em { font-style: normal; background: var(--brand-soft); padding: 1px 5px; border-radius: 5px; }

.steps { list-style: none; counter-reset: step; margin: 18px 0 6px; }
.steps li {
  counter-increment: step; position: relative; padding: 0 0 18px 56px; color: #344054;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand1), var(--brand2));
  color: #fff; font-weight: 800; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.steps strong { color: var(--ink); }

.faq-list details {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 20px; margin-bottom: 12px;
}
.faq-list summary {
  cursor: pointer; font-weight: 700; font-size: 15.5px; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; font-size: 20px; color: var(--brand1); font-weight: 700; transition: transform .2s; }
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list details p { margin-top: 10px; color: #475467; font-size: 15px; }

.tips-list { list-style: none; display: grid; gap: 12px; margin-top: 18px; }
.tips-list li {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--brand1); border-radius: 10px;
  padding: 13px 16px; font-size: 15px; color: #344054;
}

/* ---------- CTA band ---------- */
.cta-band {
  background: linear-gradient(135deg, #1d4ed8, #0891b2);
  border-radius: 20px; color: #fff; text-align: center; padding: 46px 28px;
  box-shadow: var(--shadow-lg);
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .85); max-width: 560px; margin: 0 auto 24px; }

/* ---------- Footer ---------- */
footer { background: #101828; color: #98a2b3; margin-top: 56px; }
.footer-inner {
  max-width: 1080px; margin: 0 auto; padding: 48px 20px 28px;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 36px;
}
.footer-brand .brand { color: #fff; margin-bottom: 12px; }
.footer-brand p { font-size: 14px; max-width: 340px; }
.footer-col h4 { color: #fff; font-size: 14px; margin-bottom: 12px; letter-spacing: .3px; }
.footer-col ul { list-style: none; display: grid; gap: 8px; }
.footer-col a { color: #98a2b3; font-size: 14px; }
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .08); padding: 18px 20px;
  text-align: center; font-size: 13px; color: #667085;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .hero { padding: 52px 0 46px; }
  .footer-inner { grid-template-columns: 1fr; }
  .tool-panel { padding: 20px; }
  section { padding: 44px 0; }
  .hero-stats { gap: 22px; }
}

/* ============ v2: multi-tool hub components ============ */
.footer-inner {
  grid-template-columns: 1.4fr 1fr 1fr !important;
  gap: 24px 22px !important;
  align-items: start;
}
@media (max-width: 960px) {
  .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) { .footer-inner { grid-template-columns: 1fr !important; } }

.cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.cat-icon {
  width: 40px; height: 40px; border-radius: 11px; font-size: 19px;
  background: linear-gradient(135deg, var(--brand1), var(--brand2));
  display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none;
}
.cat-count {
  font-size: 12.5px; font-weight: 700; color: var(--brand1);
  background: var(--brand-soft); border-radius: 999px; padding: 3px 10px;
}

/* --- options grid & inputs --- */
.opt-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 18px; margin-top: 18px;
}
.opt { display: flex; flex-direction: column; gap: 6px; }
.opt > label {
  font-size: 12px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.opt input[type="number"], .opt input[type="text"], .opt select, .opt input[type="color"] {
  font: inherit; font-size: 14.5px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: #fff;
  width: 100%;
}
.opt input[type="color"] { padding: 3px; height: 40px; cursor: pointer; }
.opt input:focus, .opt select:focus { outline: 2px solid #93c5fd; border-color: var(--brand1); }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14.5px; color: #344054; }
.check-row input { width: 17px; height: 17px; accent-color: var(--brand1); }
.slider-val { font-weight: 800; color: var(--brand1); }
input[type="range"] { accent-color: var(--brand1); width: 100%; }

/* --- segmented buttons & button rows --- */
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: #344054;
  border-radius: 9px; padding: 9px 14px; transition: all .15s;
}
.seg button:hover { border-color: var(--brand1); color: var(--brand1); }
.seg button.active { background: var(--brand1); border-color: var(--brand1); color: #fff; }

/* --- position 3x3 grid picker --- */
.pos-grid { display: grid; grid-template-columns: repeat(3, 38px); gap: 5px; }
.pos-grid button {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; cursor: pointer; padding: 0; transition: all .12s;
}
.pos-grid button:hover { border-color: var(--brand1); }
.pos-grid button.active { background: var(--brand1); border-color: var(--brand1); box-shadow: inset 0 0 0 3px #fff; }

/* --- canvas preview stage (checkerboard shows transparency) --- */
.canvas-wrap {
  margin-top: 18px; border: 1px solid var(--line); border-radius: 12px;
  background:
    linear-gradient(45deg, #f0f1f5 25%, transparent 25%, transparent 75%, #f0f1f5 75%) 0 0 / 18px 18px,
    linear-gradient(45deg, #f0f1f5 25%, transparent 25%, transparent 75%, #f0f1f5 75%) 9px 9px / 18px 18px,
    #fbfbff;
  display: flex; align-items: center; justify-content: center;
  padding: 14px; min-height: 180px; max-height: 520px; overflow: auto;
}
.canvas-wrap:empty { display: none; }
.canvas-wrap canvas { max-width: 100%; max-height: 480px; border-radius: 6px; }
.crop-stage { position: relative; display: inline-block; line-height: 0; }
.crop-stage canvas { display: block; }
.crop-box {
  position: absolute; border: 2px solid var(--brand1);
  box-shadow: 0 0 0 9999px rgba(16, 24, 40, .45);
  cursor: move; pointer-events: none;
}
.crop-stage.grabbing { cursor: crosshair; }

/* --- misc --- */
.textarea {
  width: 100%; min-height: 130px; resize: vertical;
  font: 12.5px ui-monospace, Menlo, Consolas, monospace; color: #344054;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fbfbff;
}
.textarea:focus { outline: 2px solid #93c5fd; }
.b64-box { flex: 1; min-width: 0; }
.badge-save {
  display: inline-block; font-size: 12px; font-weight: 800; color: #067647;
  background: #ecfdf3; border: 1px solid #abefc6; border-radius: 999px; padding: 2px 9px;
}
.warn-note {
  margin-top: 14px; font-size: 14px; color: #92400e;
  background: #fffaeb; border: 1px solid #fedf89; border-radius: 10px; padding: 11px 14px;
}
.exif-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.exif-table th, .exif-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.exif-table th { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; width: 42%; }
.hint { font-size: 13.5px; color: var(--muted); margin-top: 8px; }
.canvas-wrap img { max-width: 100%; max-height: 480px; border-radius: 6px; }
