/* ── Palette ─────────────────────────────────────────── */
:root {
  --bg:           #FAF6F0;
  --bg-subtle:    #F0EAE0;
  --fg:           #2D2A26;
  --muted:        #8A8279;
  --accent:       #C4553D;
  --accent-hover: #A8432F;
  --accent-soft:  #C4553D18;
  --border:       #DDD5CA;
  --panel:        #FFFFFF;
  --ok:           #2D7A4F;
  --ok-soft:      #2D7A4F12;
  --warn:         #B54B00;
  --trust:        #1B6B6D;
}

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

body {
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Page shell ──────────────────────────────────────── */
.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

/* ── Hero ─────────────────────────────────────────────── */
.hero {
  padding: 3rem 0 2.5rem;
  text-align: center;
  animation: fadeUp 0.6s ease-out both;
}

.hero h1 {
  font-family: "Young Serif", Georgia, serif;
  font-size: clamp(2.2rem, 5vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin: 0.5rem 0 0.6rem;
  line-height: 1.1;
}

.title-sep {
  color: var(--border);
  font-weight: 400;
  margin: 0 0.05em;
}

.tagline {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 1rem;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--trust);
  background: #1B6B6D0D;
  border: 1px solid #1B6B6D20;
}

.pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: "DM Sans", system-ui, sans-serif;
  text-transform: uppercase;
}

/* ── Font Mapper ─────────────────────────────────────── */
.font-mapper {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem 1.5rem;
  margin-bottom: 2rem;
  animation: fadeUp 0.6s 0.1s ease-out both;
}

.mapper-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.mapper-title-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.font-mapper h2 {
  font-family: "Young Serif", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--fg);
  margin: 0;
}

.mode-select {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.label-text {
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.mode-select select,
.manual-target select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s;
}
.mode-select select:hover,
.manual-target select:hover { border-color: var(--accent); }

/* Toggle */
.mapper-toggle {
  display: flex;
  position: relative;
  background: var(--bg-subtle);
  border-radius: 6px;
  padding: 3px;
}

.toggle-btn {
  position: relative;
  z-index: 1;
  padding: 0.3rem 0.9rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.2s;
  white-space: nowrap;
}
.toggle-btn.active { color: var(--fg); }
.toggle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.toggle-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: var(--panel);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle-indicator.right {
  transform: translateX(100%);
}

/* Mapper body */
.mapper-body { position: relative; }

.map-mode {
  display: none;
}
.map-mode.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

.map-description {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

/* Map list — the visual mapping rows */
.map-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.map-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--bg-subtle);
  animation: fadeIn 0.25s ease-out both;
}
.map-row:last-child { border-bottom: none; }

.map-row .font-from,
.map-row .font-to {
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  white-space: nowrap;
}

.map-row .font-from {
  background: var(--bg-subtle);
  color: var(--fg);
  min-width: 120px;
}

.map-row .font-to {
  background: var(--accent-soft);
  color: var(--accent);
  min-width: 120px;
}

.map-row .font-to.fallback {
  background: var(--ok-soft);
  color: var(--ok);
}

.map-row .map-arrow {
  color: var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.map-row .map-arrow svg {
  width: 16px;
  height: 16px;
}

.map-row .map-note {
  font-size: 0.72rem;
  color: var(--muted);
  margin-left: auto;
  font-style: italic;
}

/* Manual mode picker */
.manual-pick {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border-radius: 8px;
}

.manual-source .map-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg);
}

.map-arrow-icon {
  color: var(--accent);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.manual-target select {
  font-weight: 500;
}

/* More/less toggle */
.map-expand {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.35rem;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
}
.map-expand:hover { color: var(--accent); }
.map-expand svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s;
}
.map-expand.expanded svg { transform: rotate(180deg); }

/* ── Sections ────────────────────────────────────────── */
.section {
  animation: fadeUp 0.6s calc(0.15s + var(--delay, 0) * 0.1s) ease-out both;
}

.section h2 {
  font-family: "Young Serif", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 400;
  margin: 0 0 0.75rem;
  color: var(--fg);
}

/* ── Ornament divider ────────────────────────────────── */
.ornament {
  text-align: center;
  margin: 2.5rem 0;
  line-height: 0;
}
.ornament span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 1px;
  transform: rotate(45deg);
  position: relative;
}
.ornament span::before,
.ornament span::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40px;
  height: 1px;
  background: var(--border);
}
.ornament span::before { right: 16px; }
.ornament span::after  { left: 16px; }

/* ── Dropzone ────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  text-align: center;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, var(--accent-soft) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: #FDF8F6;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.dropzone.dragover::before { opacity: 1; }

.dropzone-icon {
  color: var(--muted);
  margin-bottom: 0.75rem;
  transition: color 0.2s, transform 0.2s;
}
.dropzone.dragover .dropzone-icon {
  color: var(--accent);
  transform: scale(1.08);
}

.dropzone-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.dropzone-formats {
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

.dropzone-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.filebtn {
  display: inline-block;
  padding: 0.55rem 1.4rem;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
  position: relative;
  z-index: 1;
}
.filebtn:hover { background: var(--accent-hover); }
.filebtn:active { transform: scale(0.97); }
.filebtn input { display: none; }

.filebtn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.filebtn-secondary:hover {
  background: var(--accent-soft);
}

/* ── File status ─────────────────────────────────────── */
.status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.5;
}

.status.animate-in {
  animation: slideIn 0.35s ease-out;
}

.status.ok {
  border-color: var(--ok);
  background: var(--ok-soft);
}
.status.err {
  border-color: var(--warn);
  color: var(--warn);
}

.status .meta {
  display: block;
  margin-top: 0.25rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ── Batch results list ─────────────────────────────── */
.results-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}
.results-list li {
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.results-list li:last-child { border-bottom: none; }
.results-list .r-icon { flex-shrink: 0; font-size: 0.75rem; }
.results-list .r-icon.ok { color: var(--ok); }
.results-list .r-icon.skip { color: var(--muted); }
.results-list .r-icon.err { color: var(--warn); }
.results-list .r-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results-list .r-detail { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }

.batch-summary {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.progress-bar {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 3px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s ease-out;
}

/* ── Conversion row (text input/output) ──────────────── */
.conversion-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: start;
}

.conversion-panel label[for] {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.conversion-arrow {
  padding-top: 6rem;
  color: var(--border);
  transition: color 0.2s;
}

textarea {
  width: 100%;
  min-height: 14rem;
  font: 14px/1.5 "DM Sans", system-ui, sans-serif;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg);
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.out {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-subtle);
  padding: 0.75rem;
  border-radius: 8px;
  min-height: 14rem;
  font: 15px/1.5 "Kalpurush", "Nikosh", "SolaimanLipi", "Noto Sans Bengali", system-ui, sans-serif;
  border: 1px solid var(--border);
  color: var(--fg);
}

/* ── Footer ──────────────────────────────────────────── */
footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}
footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
footer a:hover { text-decoration: underline; }
.footer-sep { margin: 0 0.4rem; opacity: 0.4; }

/* ── Prose (privacy policy, etc.) ────────────────────── */
.prose {
  max-width: 640px;
  animation: fadeUp 0.6s ease-out both;
}
.prose h2 {
  font-family: "Young Serif", Georgia, serif;
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0 0 0.25rem;
}
.prose h3 {
  font-family: "Young Serif", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 400;
  margin: 1.75rem 0 0.4rem;
}
.prose p { margin: 0.5rem 0; }
.prose ul {
  margin: 0.4rem 0;
  padding-left: 1.25rem;
}
.prose li { margin: 0.2rem 0; }
.prose code {
  font-size: 0.85em;
  background: var(--bg-subtle);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}
.prose a { color: var(--accent); }
.prose a:hover { text-decoration: underline; }
.prose .meta-date {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* ── Animations ──────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
  .page { padding: 0 1rem 2rem; }
  .hero { padding: 2rem 0 1.5rem; }
  .hero h1 { font-size: 2rem; }

  .mapper-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .mapper-title-row {
    width: 100%;
    justify-content: space-between;
  }
  .manual-pick {
    flex-wrap: wrap;
  }
  .map-row .font-from,
  .map-row .font-to {
    min-width: 90px;
    font-size: 0.78rem;
  }

  .conversion-row {
    grid-template-columns: 1fr;
  }
  .conversion-arrow {
    padding-top: 0;
    text-align: center;
    transform: rotate(90deg);
  }
}

/* ── Reduced motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
