/* DoItSwift Design System */
:root {
  --blue: #0066ff;
  --blue-dark: #0052cc;
  --blue-light: #e8f0ff;
  --green: #10b981;
  --orange: #f97316;
  --red: #ef4444;
  --gray-50: #fafafa;
  --gray-100: #f1f3f5;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --bg: var(--gray-50);
  --card: #ffffff;
  --text: var(--gray-900);
  --text-muted: var(--gray-500);
  --border: var(--gray-200);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, .08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --max-width: 1100px;
  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --card: #171717;
  --text: #fafafa;
  --text-muted: #a3a3a3;
  --border: #262626;
  --gray-100: #262626;
  --gray-200: #404040;
  --shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}
body {
  overflow-x: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; }
img { max-width: 100%; display: block; }

/* Container */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
@media (max-width: 480px) {
  .container { padding: 0 16px; }
}

/* Buttons */
.btn {
  background: var(--blue);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  display: inline-block;
  transition: all .15s;
}
.btn:hover { background: var(--blue-dark); transform: translateY(-1px); }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-secondary { background: var(--gray-100); color: var(--text); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-orange { background: var(--orange); }
.btn-orange:hover { background: #ea580c; }

/* Headings */
h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 18px;
}
h2 { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
h3 { font-size: 18px; font-weight: 700; }

/* Hero badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-light);
  color: var(--blue);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}
[data-theme="dark"] .badge { background: rgba(0, 102, 255, .15); }

/* Trust signals */
.trust {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}
.trust span { display: flex; align-items: center; gap: 6px; }
.trust .check { color: var(--green); font-weight: bold; font-size: 16px; }

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Mobile */
@media (max-width: 768px) {
  h1 { font-size: 34px; }
  h2 { font-size: 26px; }
}

/* Simple content pages (about, contact, blog, pro) */
.content-page {
  padding: 48px 0 80px;
}
.content-page h1 {
  margin-bottom: 12px;
}
.content-page .lead {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 42rem;
  margin-bottom: 24px;
  line-height: 1.65;
}
.content-page p {
  color: var(--text-muted);
  margin-bottom: 16px;
  max-width: 42rem;
  line-height: 1.65;
}
.content-page h2 {
  font-size: 22px;
  font-weight: 800;
  margin-top: 36px;
  margin-bottom: 12px;
  color: var(--text);
  letter-spacing: -0.02em;
}
.content-page h3 {
  font-size: 17px;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--text);
}
.content-page ul,
.content-page ol {
  margin: 0 0 16px 1.25rem;
  color: var(--text-muted);
  max-width: 42rem;
  line-height: 1.65;
}
.content-page li {
  margin-bottom: 8px;
}
.content-page .meta {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.content-page .section-tail {
  margin-top: 36px;
}
.link-back {
  color: var(--blue);
  font-weight: 600;
}
.link-back:hover {
  text-decoration: underline;
}

/* Legal documents */
.legal-doc {
  padding: 48px 0 80px;
}
.legal-doc h1 {
  margin-bottom: 8px;
}
.legal-doc .meta {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.legal-doc h2 {
  font-size: 20px;
  font-weight: 800;
  margin-top: 32px;
  margin-bottom: 10px;
  color: var(--text);
  letter-spacing: -0.02em;
}
.legal-doc p,
.legal-doc li {
  color: var(--text-muted);
  line-height: 1.65;
}
.legal-doc p {
  margin-bottom: 14px;
  max-width: 42rem;
}
.legal-doc ul {
  margin: 0 0 16px 1.25rem;
  max-width: 42rem;
}
.legal-doc li {
  margin-bottom: 8px;
}
.legal-doc .disclaimer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  max-width: 42rem;
}
.legal-doc code {
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--gray-100);
  color: var(--text);
}
[data-theme='dark'] .legal-doc code {
  background: var(--gray-200);
}

/* Blog topic cards */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 28px;
  max-width: 900px;
}
.topic-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.topic-card h3 {
  font-size: 16px;
  margin-bottom: 6px;
  color: var(--text);
}
.topic-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* Contact */
.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--blue);
  margin: 8px 0 24px;
}
.contact-email:hover {
  text-decoration: underline;
}

/* ── Converter tool: status banner & file results output ── */
section.converter-section .banner {
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow-sm);
}
section.converter-section .banner-info {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: rgba(37, 99, 235, 0.2);
  color: #1e3a8a;
}
section.converter-section .banner-success {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: rgba(16, 185, 129, 0.25);
  color: #065f46;
}
[data-theme='dark'] section.converter-section .banner-info {
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.35) 0%, rgba(30, 58, 138, 0.25) 100%);
  border-color: rgba(96, 165, 250, 0.25);
  color: #bfdbfe;
}
[data-theme='dark'] section.converter-section .banner-success {
  background: linear-gradient(135deg, rgba(6, 95, 70, 0.35) 0%, rgba(4, 120, 87, 0.2) 100%);
  border-color: rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
}

/* Section title above the results stack */
section.converter-section .results-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 28px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
section.converter-section .results-header #fileCount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--gray-100);
  color: var(--text);
}
[data-theme='dark'] section.converter-section .results-header #fileCount {
  background: var(--gray-200);
}

#fileResultsRoot {
  margin-top: 0;
}

#fileResultsRoot .results-toolbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card) 0%, var(--gray-50) 100%);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
}
[data-theme='dark'] #fileResultsRoot .results-toolbar {
  background: linear-gradient(180deg, var(--card) 0%, rgba(255, 255, 255, 0.03) 100%);
}

#fileResultsRoot .gallery-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  user-select: none;
}
#fileResultsRoot .gallery-toggle input[type='checkbox'] {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  accent-color: var(--blue);
  cursor: pointer;
}
#fileResultsRoot .gallery-toggle:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

#fileResultsRoot .toolbar-note {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--blue);
  background: var(--blue-light);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
[data-theme='dark'] #fileResultsRoot .toolbar-note {
  background: rgba(0, 102, 255, 0.12);
  border-left-color: #60a5fa;
}

#fileResultsRoot .results {
  margin-top: 0;
}

#fileResultsRoot .results-more-block {
  margin-top: 12px;
}

#fileResultsRoot .more-files-btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: var(--shadow-sm);
}
#fileResultsRoot .more-files-btn:hover {
  border-color: var(--blue);
  background: var(--blue-light);
  box-shadow: var(--shadow);
}
[data-theme='dark'] #fileResultsRoot .more-files-btn:hover {
  background: rgba(0, 102, 255, 0.12);
}

#fileResultsRoot .results-more-inner {
  margin-top: 12px;
}

#fileResultsRoot .file-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}
[data-theme='dark'] #fileResultsRoot .file-item {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.25);
}
#fileResultsRoot .file-item:hover {
  border-color: rgba(0, 102, 255, 0.22);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 8px 20px rgba(0, 102, 255, 0.08);
}
[data-theme='dark'] #fileResultsRoot .file-item:hover {
  border-color: rgba(96, 165, 250, 0.35);
}

#fileResultsRoot .file-item-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
}

#fileResultsRoot .file-thumb {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--gray-100) 0%, var(--gray-50) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
[data-theme='dark'] #fileResultsRoot .file-thumb {
  background: linear-gradient(145deg, #262626 0%, #1a1a1a 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

#fileResultsRoot .file-thumb--gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#fileResultsRoot .file-info {
  flex: 1;
  min-width: 0;
}

#fileResultsRoot .file-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

#fileResultsRoot .file-status {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}
#fileResultsRoot .file-status.done {
  color: var(--green);
  font-weight: 500;
}
#fileResultsRoot .file-status.error {
  color: var(--red);
  font-weight: 500;
}

#fileResultsRoot .progress-bar {
  height: 4px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--gray-100);
  overflow: hidden;
}
[data-theme='dark'] #fileResultsRoot .progress-bar {
  background: var(--gray-200);
}
#fileResultsRoot .progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue) 0%, #38bdf8 100%);
  width: 0%;
  transition: width 0.35s ease;
}

#fileResultsRoot .file-actions-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  flex-shrink: 0;
}

#fileResultsRoot .file-actions-col .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 102, 255, 0.15);
  transition: transform 0.15s, box-shadow 0.15s;
}
#fileResultsRoot .file-actions-col .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.25);
}

#fileResultsRoot .btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
#fileResultsRoot .btn-text:hover:not(:disabled) {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}
[data-theme='dark'] #fileResultsRoot .btn-text:hover:not(:disabled) {
  background: rgba(0, 102, 255, 0.12);
}
#fileResultsRoot .btn-text:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#fileResultsRoot .file-preview-panel {
  margin-top: 14px;
  padding: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  width: 100%;
  border-radius: 0 0 12px 12px;
}

#fileResultsRoot .file-preview-panel img {
  display: block;
  max-width: 100%;
  max-height: min(320px, 52vh);
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 12px;
  object-fit: contain;
  background: repeating-conic-gradient(var(--gray-100) 0% 25%, var(--gray-50) 0% 50%) 50% / 16px 16px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
[data-theme='dark'] #fileResultsRoot .file-preview-panel img {
  background: repeating-conic-gradient(#262626 0% 25%, #1f1f1f 0% 50%) 50% / 16px 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

#fileResultsRoot textarea.b64-out {
  margin-top: 14px;
  width: 100%;
  min-height: 96px;
  max-height: 220px;
  padding: 12px 14px;
  font-size: 11px;
  line-height: 1.45;
  font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--gray-50);
  color: var(--text);
  resize: vertical;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}
[data-theme='dark'] #fileResultsRoot textarea.b64-out {
  background: #141414;
  border-color: var(--border);
}

section.converter-section #fileResultsRoot + .actions {
  margin-top: 28px;
  padding-top: 8px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
section.converter-section #fileResultsRoot + .actions .btn-lg {
  border-radius: 12px;
  padding: 14px 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow-sm);
}
section.converter-section #fileResultsRoot + .actions .btn-secondary.btn-lg {
  box-shadow: none;
  border: 1px solid var(--border);
}
