/* Image Converter Hub — shared stylesheet
 * Design: modern clean / Linear-Vercel inspired. White surfaces, subtle borders.
 * No gradients-for-decoration, restrained accent (indigo), system font stack.
 * Accessibility: 4.5:1 min contrast, 44px touch targets, focus rings, reduced-motion.
 */
:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --border: #e5e7eb;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #4f46e5;        /* indigo-600, 4.59:1 on white */
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08);
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

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

body {
  font-family: var(--font);
  font-size: 16px;              /* ≥16px body for mobile */
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 64px;
}
.logo { font-weight: 700; font-size: 1.1rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: .95rem; font-weight: 800;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--text-muted); font-weight: 500; font-size: .95rem;
  padding: 8px 12px; border-radius: 8px; min-height: 40px; display: inline-flex; align-items: center;
}
.nav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }

/* ---------- hero ---------- */
.hero { padding: 64px 0 40px; text-align: center; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--text-muted); font-size: 1.125rem; max-width: 640px; margin: 16px auto 0; }
.hero-img { width: 100%; max-width: 760px; height: auto; margin: 2rem auto 0; display: block; border-radius: 14px; border: 1px solid var(--border); box-shadow: 0 12px 32px rgba(15,23,42,.06); }

/* ---------- converter card ---------- */
.converter-card {
  max-width: 760px; margin: 32px auto 0;
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--bg); box-shadow: var(--shadow-md);
  padding: 32px;
}
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 48px 24px; text-align: center; cursor: pointer;
  background: var(--bg-soft); transition: border-color .2s, background .2s;
  min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon { width: 56px; height: 56px; color: var(--accent); }
.dropzone p { color: var(--text-muted); font-size: .95rem; }
.dropzone strong { color: var(--text); font-weight: 600; }
.dropzone .btn-secondary { pointer-events: auto; }

.controls {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-top: 20px; justify-content: center;
}
.controls label { font-size: .9rem; color: var(--text-muted); font-weight: 500; }

select, input[type="range"] { min-height: 40px; }
select {
  padding: 8px 32px 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: .95rem; background: var(--bg); color: var(--text); cursor: pointer;
  appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6l3.5 4 3.5-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input[type="range"] { accent-color: var(--accent); width: 140px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 24px; border-radius: 10px;
  font-size: .95rem; font-weight: 600; cursor: pointer;
  border: none; transition: background .2s, transform .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:disabled { background: #a5b4fc; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f1f5f9; }

/* ---------- file list ---------- */
.file-list { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  background: var(--bg); font-size: .9rem;
}
.file-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { color: var(--text-muted); font-size: .8rem; }
.file-status { font-size: .8rem; font-weight: 600; }
.file-status.done { color: var(--green); }
.file-status.error { color: var(--red); }
.remove-file { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 8px; border-radius: 6px; min-width: 40px; min-height: 40px; display: grid; place-items: center; }
.remove-file:hover { color: var(--red); background: var(--red-soft); }

/* progress bar */
.progress-wrap { margin-top: 20px; }
.progress-label { display: flex; justify-content: space-between; font-size: .85rem; color: var(--text-muted); margin-bottom: 6px; }
.progress-bar { height: 8px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; width: 0; transition: width .2s; }

/* results */
.results { margin-top: 24px; display: grid; gap: 12px; }
.result-item {
  display: flex; align-items: center; gap: 12px; border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; background: var(--bg);
}
.result-size { color: var(--text-muted); font-size: .8rem; }
.download-link { margin-left: auto; color: var(--accent); font-weight: 600; font-size: .9rem; }

/* ---------- privacy badge ---------- */
.privacy-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green-soft); color: var(--green);
  border: 1px solid #bbf7d0; border-radius: 99px;
  padding: 6px 16px; font-size: .85rem; font-weight: 600;
  margin-top: 20px;
}
.privacy-badge svg { width: 16px; height: 16px; }

/* ---------- feature grid ---------- */
.features { padding: 64px 0; }
.features h2, .guide-grid h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; text-align: center; margin-bottom: 40px; letter-spacing: -.01em; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.feature-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; background: var(--bg); transition: box-shadow .2s, border-color .2s;
}
.feature-card:hover { box-shadow: var(--shadow-md); border-color: #c7d2fe; }
.feature-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 14px; }
.feature-card h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 8px; }
.feature-card p { color: var(--text-muted); font-size: .92rem; }

/* ---------- format grid ---------- */
.format-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.format-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 16px; text-align: center; background: var(--bg);
  transition: box-shadow .2s, border-color .2s, transform .15s;
  min-height: 44px; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.format-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-2px); text-decoration: none; }
.format-card .f-icon { color: var(--accent); }
.format-card .f-name { font-weight: 600; font-size: .95rem; color: var(--text); }
.format-card .f-desc { font-size: .78rem; color: var(--text-muted); }

/* ---------- guides ---------- */
.guide-grid { padding: 40px 0 64px; }
.guide-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.guide-card img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 12px; }
.guide-card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  display: block; background: var(--bg); transition: box-shadow .2s, border-color .2s;
}
.guide-card:hover { box-shadow: var(--shadow-md); border-color: #c7d2fe; text-decoration: none; }
.guide-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.guide-card p { font-size: .88rem; color: var(--text-muted); }

/* ---------- content pages ---------- */
.page { padding: 48px 0 64px; }
.page h1 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: 12px; }
.page .lead { color: var(--text-muted); font-size: 1.1rem; max-width: 720px; margin-bottom: 32px; }
.page h2 { font-size: 1.3rem; font-weight: 700; margin: 32px 0 12px; }
.page h3 { font-size: 1.1rem; font-weight: 600; margin: 24px 0 8px; }
.page p, .page li { color: #334155; }
.page ul, .page ol { padding-left: 24px; margin: 12px 0; }
.page li { margin-bottom: 6px; }
.page table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .92rem; }
.page th, .page td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.page th { background: var(--bg-soft); font-weight: 600; }
.page code { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; font-size: .85em; }
.page .note {
  background: var(--accent-soft); border-left: 4px solid var(--accent);
  padding: 14px 18px; border-radius: 0 8px 8px 0; margin: 20px 0; font-size: .95rem;
}
.page .warn {
  background: var(--red-soft); border-left: 4px solid var(--red);
  padding: 14px 18px; border-radius: 0 8px 8px 0; margin: 20px 0; font-size: .95rem;
}

/* inline mini-converter on format pages */
.mini-converter {
  max-width: 640px; margin: 32px auto; border: 1px solid var(--border);
  border-radius: 16px; padding: 24px; text-align: center; background: var(--bg); box-shadow: var(--shadow-md);
}
.mini-converter .dropzone { min-height: 140px; padding: 28px 20px; }

/* ---------- FAQ ---------- */
.faq { max-width: 720px; margin: 40px auto 0; }
.faq details { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: var(--bg); }
.faq summary {
  padding: 16px 20px; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 1.2rem; color: var(--text-muted); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 20px 16px; color: var(--text-muted); font-size: .95rem; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); background: var(--bg-soft);
  margin-top: auto; padding: 40px 0 24px;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; }
.footer-col h4 { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 12px; }
.footer-col a { display: block; color: #475569; font-size: .92rem; padding: 4px 0; }
.footer-col a:hover { color: var(--text); }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 32px; padding-top: 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .82rem; color: var(--text-muted); }

/* ---------- ad slots ---------- */
.ad-slot {
  border: 1px dashed #d1d5db; border-radius: 10px; background: var(--bg-soft);
  min-height: 100px; display: flex; align-items: center; justify-content: center;
  color: #9ca3af; font-size: .8rem; margin: 24px 0; text-align: center; padding: 12px;
}
.ad-slot-leaderboard { min-height: 90px; }
.ad-slot-rect { min-height: 250px; max-width: 300px; margin-inline: auto; }
.ad-slot-inline { min-height: 200px; }
.ad-slot-bottom { min-height: 90px; width: 100%; max-width: 728px; margin-inline: auto; }
.ad-slot-sidebar { min-height: 600px; max-width: 300px; margin-inline: auto; }
.ad-label { position: absolute; top: 4px; left: 8px; font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(15,23,42,.35); }

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  .hero { padding: 40px 0 24px; }
  .converter-card { padding: 20px; margin-top: 20px; }
  .dropzone { padding: 32px 16px; }
  .header-inner { flex-wrap: wrap; padding-block: 8px; }
  .nav { width: 100%; overflow-x: auto; padding-bottom: 4px; }
  .controls { flex-direction: column; align-items: stretch; }
  .controls .btn { width: 100%; }
  .footer-grid { gap: 20px; }
}

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