/* =========================================================
   HEIC → JPG Converter — stylesheet
   Clean, white, blue accent. No decorative animation.
   ========================================================= */

:root {
  --blue: #1a73e8;
  --blue-dark: #1557b0;
  --blue-soft: #e8f0fe;
  --text: #1f2328;
  --muted: #5f6b7a;
  --line: #e3e8ef;
  --line-strong: #cfd6e0;
  --bg-alt: #f7f9fc;
  --green: #0f8a4b;
  --green-soft: #e7f6ee;
  --red: #c62828;
  --red-soft: #fdecec;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 4px 16px rgba(16, 24, 40, .07);
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
ul { margin: 0; padding: 0; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 5px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}
.container.narrow { max-width: 820px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand em { color: var(--blue); font-style: normal; padding: 0 2px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
}
.site-header nav {
  display: flex;
  gap: 22px;
  font-size: 14px;
}
.site-header nav a { color: var(--muted); font-weight: 500; }
.site-header nav a:hover { color: var(--blue); text-decoration: none; }

/* ---------- Hero ---------- */
.hero { padding: 40px 0 32px; }
.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--blue-soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.hero h1 {
  font-size: clamp(30px, 4.6vw, 42px);
  font-weight: 800;
  margin-bottom: 12px;
  text-align: center;
}
.subtitle {
  text-align: center;
  color: var(--muted);
  font-size: clamp(15.5px, 2.2vw, 17px);
  max-width: 560px;
  margin: 0 auto 22px;
}
.hero .eyebrow { display: block; width: max-content; margin-left: auto; margin-right: auto; }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
  padding: 26px 24px;
  text-align: center;
  cursor: pointer;
  position: relative;              /* label 覆盖定位的基准 */
  transition: border-color .15s, background-color .15s;
}

/* 文件选择用的透明 label：铺满 dropzone，
   让浏览器原生唤起文件选择器（iOS 上比 JS 的 input.click() 可靠）。
   注意：不能用 display:none —— 否则 label 不可点击，功能直接失效。 */
.picker-label {
  position: absolute;
  inset: 0;
  cursor: pointer;
  z-index: 1;
  border-radius: inherit;
}
.picker-label input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  padding: 0;
  margin: -1px;
}

/* 底部 CTA 的透明 label：盖在按钮上方，点按钮即由浏览器原生唤起选择器。
   位置由 JS 按按钮实际尺寸校准，避免写死数值。 */
.cta-picker-label {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  cursor: pointer;
  z-index: 2;
  opacity: 0;
}
.cta-picker-label input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  padding: 0;
  margin: -1px;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--blue);
  background: #f4f8ff;
  outline: none;
}
.dropzone.is-drag {
  border-color: var(--blue);
  background: var(--blue-soft);
}
.dropzone.is-busy { pointer-events: none; }
.dz-icon { margin: 0 auto 9px; color: var(--blue); }
.dz-title { font-size: 17px; font-weight: 600; }
.dz-hint { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.dz-meta { color: var(--muted); font-size: 12.5px; margin-top: 11px; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* 下载按钮现在是 <a download>：需要与 disabled 按钮同款视觉与命中行为。
   用 :not(.is-disabled) 而不是 :not(:disabled) —— <a> 没有 disabled 属性。 */
.btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 1px 2px rgba(26, 115, 232, .35);
}
.btn-primary:hover:not(:disabled):not(.is-disabled) { background: var(--blue-dark); }
.btn-lg { font-size: 15.5px; padding: 13px 26px; border-radius: 10px; }
.btn-ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled):not(.is-disabled) { border-color: var(--muted); }
.btn-sm { font-size: 13px; padding: 7px 12px; border-radius: 8px; }
/* 下载反馈态（绿色）。放在 .btn-primary 之后才会覆盖主色。 */
.btn.is-saved,
.btn-primary.is-saved {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 138, 75, .35);
}
.btn.is-saved:hover,
.btn-primary.is-saved:hover { background: #0c7a41; }

/* ---------- Privacy line ---------- */
.privacy {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: center;
  margin-top: 13px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  flex-wrap: wrap;
}
.privacy .shield { color: var(--green); flex: 0 0 auto; margin-top: 1px; }
.privacy strong { color: var(--text); }

/* ---------- Results ---------- */
.results {
  margin-top: 22px;
  scroll-margin-top: 76px;
  transition: box-shadow .25s, border-color .25s;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  text-align: left;
}
.results.is-highlight {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, .12);
}
.results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.results-title { font-size: 17px; font-weight: 700; }
.results-stats { font-size: 13px; color: var(--muted); margin-top: 2px; }
.results-actions { display: flex; gap: 8px; }
.results-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
/* iPhone 专属提示：告诉用户图片存到相册的路径 */
.results-note-ios {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #c8dcfb;
  border-radius: 8px;
  background: var(--blue-soft);
  color: #12457f;
  line-height: 1.55;
}
.results-note-ios strong { color: #0d3a6b; }
.results-note-ios em { font-style: normal; font-weight: 600; }
.results-note-ios b { font-weight: 600; color: #0d3a6b; }
.hint-line { display: block; margin-top: 5px; }
/* 同一块提示里有两套文案：触摸设备看 hint-touch，其余看 hint-desktop。
   JS 检测到触摸设备会给 #iosHint 加 .is-touch。 */
.results-note-ios .hint-touch { display: none; }
.results-note-ios.is-touch .hint-touch { display: block; }
.results-note-ios.is-touch .hint-desktop { display: none; }

.progress-bar-wrap {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--blue);
  border-radius: 999px;
  transition: width .2s linear;
}

/* file rows */
.file-list { list-style: none; display: grid; gap: 8px; }
.file-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.file-thumb {
  width: 48px; height: 48px;
  border-radius: 8px;
  background: var(--bg-alt) center/cover no-repeat;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  overflow: hidden;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb-ph { font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.file-info { min-width: 0; }
.file-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-sub {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}
.file-sub .dot { opacity: .5; }
.file-actions { display: flex; align-items: center; gap: 8px; }
/* View / Download 并列。手机屏幕上两个 110px 按钮 + 间隙 = 236px，
   最窄的 iPhone SE（320px 视口）也放得下，不必换行。 */
.file-actions .btn { white-space: nowrap; }

/* 窄屏：缩略图 + 信息一行，View / Download 移到下一行右对齐。
   两个按钮都是 <a>，不能靠 width:100% 撑满 —— 那样看着像主操作按钮，
   反而让真正的主按钮（Save all as ZIP）失去层级。 */
@media (max-width: 420px) {
  .file-item { grid-template-columns: 40px 1fr; row-gap: 8px; padding: 10px; }
  .file-thumb { width: 40px; height: 40px; }
  .file-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .file-actions .btn { width: auto; min-width: 96px; }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.status-pending { color: var(--muted); background: var(--bg-alt); }
.status-working { color: var(--blue); background: var(--blue-soft); }
.status-done { color: var(--green); background: var(--green-soft); }
.status-error { color: var(--red); background: var(--red-soft); }

.mini-bar {
  height: 3px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.mini-bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue);
  border-radius: 999px;
  transition: width .2s linear;
}

.file-error {
  font-size: 12.5px;
  color: var(--red);
  margin-top: 4px;
}

/* ---------- Toast / notice ---------- */
.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  background: var(--red-soft);
  color: #8a1c1c;
  border: 1px solid #f5c6c6;
}
.notice.info { background: var(--blue-soft); color: #12457f; border-color: #c8dcfb; }

/* ---------- Trust strip ---------- */
.strip { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg-alt); }
.trust {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 20px 0;
}
.trust li {
  text-align: center;
  padding: 4px 8px;
  border-right: 1px solid var(--line);
}
.trust li:last-child { border-right: 0; }
.trust strong { display: block; font-size: 15px; }
.trust span { font-size: 12.5px; color: var(--muted); }

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-title { font-size: clamp(24px, 3.4vw, 32px); font-weight: 800; text-align: center; }
.section-sub {
  text-align: center;
  color: var(--muted);
  margin: 10px auto 36px;
  font-size: 15.5px;
  max-width: 520px;
}

/* ---------- Steps ---------- */
.steps { list-style: none; display: grid; gap: 18px; counter-reset: s; }
.steps li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.step-num {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}
.step-body h3 { font-size: 16.5px; font-weight: 700; margin-bottom: 5px; }
.step-body p { color: var(--muted); font-size: 14.5px; }

.callout {
  margin-top: 22px;
  padding: 14px 16px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  border-radius: 0 10px 10px 0;
  font-size: 14px;
  color: #14395f;
}

/* ---------- Comparison table ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  -webkit-overflow-scrolling: touch;
}
.compare {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
}
.compare th, .compare td {
  text-align: left;
  vertical-align: top;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.compare thead th {
  background: var(--bg-alt);
  font-size: 12.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.compare tbody tr:last-child th,
.compare tbody tr:last-child td { border-bottom: 0; }
.compare tbody th { width: 110px; }
.compare td { color: #404b5a; }
.compare td ul { list-style: none; display: grid; gap: 5px; }
.compare td li { position: relative; padding-left: 14px; }
.compare td li::before {
  content: "";
  position: absolute;
  left: 0; top: .62em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
}
.fmt {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid;
}
.fmt-heic { color: #6b4bb8; background: #f3effd; border-color: #e0d5fa; }
.fmt-jpg { color: #0f6a43; background: var(--green-soft); border-color: #c7ead8; }
.fmt-png { color: #9a5a12; background: #fdf3e4; border-color: #f3ddbc; }
.table-foot {
  margin-top: 16px;
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 10px; }
.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
.faq details[open] { border-color: var(--line-strong); }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 48px 16px 18px;
  position: relative;
  font-weight: 600;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary h3 { display: inline; font-size: 15.5px; font-weight: 600; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 20px; top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .15s;
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq summary:hover { background: var(--bg-alt); }
.faq-body { padding: 0 18px 18px; }
.faq-body p { font-size: 14.5px; color: #404b5a; }

/* ---------- CTA ---------- */
.cta { padding: 64px 0; text-align: center; border-top: 1px solid var(--line); position: relative; }
.cta h2 { font-size: clamp(22px, 3vw, 28px); font-weight: 800; margin-bottom: 8px; }
.cta p { color: var(--muted); margin-bottom: 22px; font-size: 15px; }
.cta-note { font-size: 12.5px !important; margin-top: 16px; margin-bottom: 0 !important; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  padding: 24px 0;
  font-size: 13px;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--blue); }

/* ---------- Focus visibility ---------- */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .trust { grid-template-columns: repeat(2, 1fr); gap: 0; }
  .trust li:nth-child(2) { border-right: 0; }
  .trust li:nth-child(1), .trust li:nth-child(2) { padding-bottom: 14px; }
  .trust li:nth-child(3), .trust li:nth-child(4) { padding-top: 14px; }
}

@media (max-width: 640px) {
  .site-header nav { display: none; }
  .hero { padding: 36px 0 28px; }
  .dropzone { padding: 30px 16px; }
  .section { padding: 52px 0; }
  .results { padding: 16px; }
  .results-actions { width: 100%; flex-wrap: wrap; }
  .results-actions .btn { flex: 1 1 auto; }
  /* 手机上主按钮单独占一行，View all / Clear 平分第二行 */
  .results-actions #downloadAllBtn { flex-basis: 100%; }
  .file-item { grid-template-columns: 40px 1fr; gap: 10px 12px; }
  .file-thumb { width: 40px; height: 40px; }
  .file-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .steps li { grid-template-columns: 1fr; gap: 10px; padding: 16px; }
  .step-num { width: 32px; height: 32px; font-size: 14px; }
  .compare th, .compare td { padding: 13px 14px; }
  .cta { padding: 48px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
