/* ─── Reset & Tokens ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f5f4f0;
  --surface:   #ffffff;
  --border:    #e0ddd6;
  --ink:       #1a1a1a;
  --ink2:      #555550;
  --green:     #2d7a4f;
  --green-lt:  #eaf4ee;
  --blue:      #1a56b0;
  --blue-lt:   #e8f0fc;
  --amber:     #b45309;
  --red:       #c0392b;
  --radius:    14px;
  --shadow:    0 2px 16px rgba(0,0,0,.08);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Site Nav ─── */
.site-nav {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.nav-inner {
  display: flex;
  justify-content: center;
  gap: 0;
  min-width: max-content;
  margin: 0 auto;
  padding: 0 12px;
}
.nav-link {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink2);
  text-decoration: none;
  padding: 9px 14px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav-link:hover     { color: var(--blue); }
.nav-link.active    { color: var(--blue); border-bottom-color: var(--blue); }

/* ─── Ad slots ─── */
.ad-slot {
  width: 100%;
  margin: 24px 0 0;
  text-align: center;
  min-height: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink2);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.72rem;
  overflow: hidden;
}
.ad-slot ins { display: block; width: 100%; }

/* ─── Savings badge ─── */
.savings-badge {
  display: inline-block;
  background: var(--green-lt);
  border: 1px solid #b7dfc7;
  border-radius: 100px;
  padding: 3px 10px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green);
  margin-left: 8px;
}

/* ─── Conversion page intro ─── */
.page-intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.88rem;
  color: var(--ink2);
  line-height: 1.6;
}
.page-intro strong { color: var(--ink); }

/* ─── Header ─── */
header {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 28px 20px 20px;
}

.logo {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.logo span { color: var(--blue); }

.tagline {
  margin-top: 6px;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  color: var(--ink2);
  font-style: italic;
}

/* ─── Privacy badge ─── */
.privacy-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  background: var(--green-lt);
  border: 1px solid #b7dfc7;
  border-radius: 100px;
  padding: 7px 18px;
  font-size: 0.82rem;
  color: var(--green);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 600;
}
.privacy-banner svg { flex-shrink: 0; }

/* ─── Main layout ─── */
main {
  width: 100%;
  max-width: 680px;
  padding: 32px 16px 60px;
  flex: 1;
}

/* ─── Drop zone ─── */
.drop-zone {
  background: var(--surface);
  border: 2.5px dashed #c4c0b8;
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}
.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--blue);
  background: var(--blue-lt);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-icon {
  font-size: 3.2rem;
  line-height: 1;
  margin-bottom: 16px;
  display: block;
}

.drop-title {
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  font-weight: 700;
  margin-bottom: 8px;
}

.drop-sub {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.88rem;
  color: var(--ink2);
  line-height: 1.5;
}

.btn-pick {
  margin-top: 20px;
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 13px 32px;
  border-radius: 100px;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s;
  pointer-events: none; /* input covers it */
}
.drop-zone:hover .btn-pick { background: #1244a0; }

/* ─── Format selector ─── */
.format-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.format-label {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.83rem;
  color: var(--ink2);
  font-weight: 600;
  flex-shrink: 0;
}
.fmt-btn {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 100px;
  padding: 6px 16px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink2);
  transition: border-color .15s, color .15s, background .15s;
}
.fmt-btn:hover  { border-color: var(--blue); color: var(--blue); }
.fmt-btn.active { border-color: var(--blue); background: var(--blue); color: #fff; }
.fmt-note {
  font-size: 0.65rem;
  opacity: 0.75;
  font-weight: 400;
  margin-left: 2px;
}

/* ─── File list ─── */
#file-list {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.file-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  overflow: hidden;
}
.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-info { flex: 1; min-width: 0; }
.file-name {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-size {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  color: var(--ink2);
  margin-top: 2px;
}

.file-status {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.file-status.waiting { color: var(--ink2); }
.file-status.working { color: var(--amber); }
.file-status.done    { color: var(--green); }
.file-status.error   { color: var(--red); }

.btn-dl {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 8px 16px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  flex-shrink: 0;
}
.btn-dl:hover { background: #245f3e; }

/* ─── Convert bar ─── */
#convert-bar {
  margin-top: 20px;
  display: none;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
#convert-bar.visible { display: flex; }

#btn-convert-all {
  width: 100%;
  max-width: 340px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 16px 32px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
#btn-convert-all:hover  { background: #1244a0; }
#btn-convert-all:active { transform: scale(.97); }
#btn-convert-all:disabled { background: #aaa; cursor: not-allowed; }

#btn-dl-all {
  width: 100%;
  max-width: 340px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 14px 32px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: none;
  transition: background .15s;
}
#btn-dl-all.visible { display: block; }
#btn-dl-all:hover   { background: #245f3e; }

/* ─── Progress bar ─── */
.progress-wrap {
  width: 100%;
  max-width: 340px;
  background: #e0ddd6;
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
  display: none;
}
.progress-wrap.visible { display: block; }
.progress-bar {
  height: 100%;
  background: var(--blue);
  border-radius: 100px;
  width: 0%;
  transition: width .3s;
}

/* ─── How it works ─── */
.how-section {
  margin-top: 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
}
.how-section h2 {
  font-size: 1.1rem;
  margin-bottom: 20px;
  text-align: center;
}
.steps {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.step {
  flex: 1;
  min-width: 140px;
  max-width: 180px;
  text-align: center;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue-lt);
  color: var(--blue);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 10px;
}
.step p {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.82rem;
  color: var(--ink2);
  line-height: 1.45;
}

/* ─── Privacy section ─── */
.privacy-section {
  margin-top: 20px;
  background: var(--green-lt);
  border: 1px solid #b7dfc7;
  border-radius: var(--radius);
  padding: 24px;
}
.privacy-section h2 {
  font-size: 1rem;
  color: var(--green);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.privacy-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.privacy-section li {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.84rem;
  color: #1e5c38;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}
.privacy-section li::before {
  content: "✓";
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ─── FAQ ─── */
.faq-section { margin-top: 20px; }
.faq-section h2 {
  font-size: 1rem;
  margin-bottom: 14px;
  padding: 0 4px;
}
details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
summary {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 16px;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--blue);
  flex-shrink: 0;
}
details[open] summary::after { content: "−"; }
.faq-answer {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.84rem;
  color: var(--ink2);
  padding: 0 16px 16px;
  line-height: 1.55;
}

/* ─── Footer ─── */
footer {
  width: 100%;
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 20px 16px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  color: var(--ink2);
  line-height: 1.6;
}

/* ─── Toast ─── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a1a1a;
  color: #fff;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.88rem;
  padding: 12px 24px;
  border-radius: 100px;
  transition: transform .3s;
  z-index: 99;
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ─── Conversion help ─── */
#conversion-help { display: none; margin-top: 20px; }
#conversion-help.visible { display: block; }

/* ─── Focus styles ─── */
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}
button:focus-visible,
.fmt-btn:focus-visible,
.btn-dl:focus-visible,
#btn-convert-all:focus-visible,
#btn-dl-all:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 100px;
}
summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ─── Dark mode ─── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #111110;
    --surface:  #1c1c1b;
    --border:   #2e2d2a;
    --ink:      #f0ede8;
    --ink2:     #9e9b96;
    --green:    #3daa6a;
    --green-lt: #0f2a1a;
    --blue:     #4d8ef0;
    --blue-lt:  #0f1e3a;
    --amber:    #d97706;
    --red:      #e05252;
    --shadow:   0 2px 16px rgba(0,0,0,.4);
  }
  .privacy-banner { border-color: #1e4a30; }
  .privacy-section { border-color: #1e4a30; }
  .privacy-section li { color: #7ecfa0; }
  details { background: var(--surface); }
  summary::after { color: var(--blue); }
}

/* ─── Responsive ─── */
@media (max-width: 400px) {
  .steps { flex-direction: column; align-items: center; }
  .step  { max-width: 100%; }
}
