:root {
  --ink: #111827;
  --muted: #5b6472;
  --line: #e5e7eb;
  --soft: #f7f8fb;
  --soft-2: #eef5ff;
  --brand: #dc2626;
  --brand-2: #0f766e;
  --accent: #2563eb;
  --warning: #b45309;
  --surface: #ffffff;
  --shadow: 0 18px 50px rgba(17, 24, 39, .08);
}

/* UI refinement pass: typography scale, header/footer systems, icons, and theme modes. */
:root {
  --panel: #ffffff;
  --header-bg: rgba(255, 255, 255, .94);
  --font-xs: 12px;
  --font-sm: 14px;
  --font-md: 16px;
  --font-lg: 18px;
  --font-xl: 24px;
  --font-2xl: 36px;
  --font-hero: clamp(44px, 7vw, 74px);
  --weight-regular: 450;
  --weight-medium: 650;
  --weight-bold: 780;
  --weight-heavy: 880;
}

[data-theme="dark"] {
  --ink: #f8fafc;
  --muted: #aab4c3;
  --line: #263244;
  --soft: #111827;
  --soft-2: #172033;
  --brand: #f05252;
  --brand-2: #2dd4bf;
  --accent: #60a5fa;
  --warning: #fbbf24;
  --surface: #0b1020;
  --panel: #111827;
  --header-bg: rgba(11, 16, 32, .92);
  --shadow: 0 18px 50px rgba(0, 0, 0, .36);
}

body {
  font-size: var(--font-md);
  font-weight: var(--weight-regular);
}

h1 {
  font-size: var(--font-hero);
  font-weight: var(--weight-heavy);
}

h2 {
  font-size: var(--font-2xl);
  font-weight: var(--weight-heavy);
}

h3 {
  font-size: var(--font-lg);
  font-weight: var(--weight-bold);
}

.site-header {
  background: var(--header-bg);
}

.brand {
  font-weight: var(--weight-heavy);
}

.brand small,
.pill {
  font-size: var(--font-xs);
}

.nav {
  gap: 6px;
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
}

.nav-link:hover {
  color: var(--brand);
  background: var(--soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-toggle,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
  cursor: pointer;
}

.nav-toggle {
  display: none;
  width: 42px;
  padding: 0;
}

.language-select,
.button,
.quick-tools a,
.tool-card,
.category-tabs button,
.trust-item,
.step,
.language-grid a,
.blog-card,
.info-box {
  background: var(--panel);
}

.language-select,
.category-tabs button {
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
}

.eyebrow {
  font-size: var(--font-sm);
  font-weight: var(--weight-heavy);
}

.button,
.quick-tools a,
.pill {
  font-weight: var(--weight-bold);
}

.tool-card p {
  font-size: var(--font-sm);
}

.hero {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 10%, transparent), transparent 38%),
    linear-gradient(225deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 40%),
    var(--surface);
}

.dropzone {
  background: color-mix(in srgb, var(--brand) 7%, var(--panel));
}

.footer-links {
  gap: 20px;
}

.footer-column {
  display: grid;
  align-content: start;
  gap: 8px;
}

.footer-column h3 {
  margin: 0 0 6px;
  color: #fff;
  font-size: var(--font-sm);
}

.footer-column a {
  color: #cbd5e1;
  font-size: var(--font-sm);
}

.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;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05em;
  height: 1.05em;
  color: currentColor;
  font-weight: var(--weight-heavy);
  line-height: 1;
}

.icon::before {
  display: block;
}

.icon-file::before { content: "▣"; }
.icon-grid::before { content: "▦"; }
.icon-menu::before { content: "☰"; }
.icon-sun::before { content: "☀"; }
.icon-moon::before { content: "☾"; }
.icon-merge::before { content: "⇄"; }
.icon-split::before { content: "⊘"; }
.icon-compress::before { content: "⇲"; }
.icon-convert::before { content: "⇅"; }
.icon-file-text::before { content: "¶"; }
.icon-edit::before { content: "✎"; }
.icon-lock::before { content: "⌂"; }
.icon-unlock::before { content: "◇"; }
.icon-sign::before { content: "✓"; }
.icon-scan::before { content: "⌗"; }
.icon-chat::before { content: "?"; }
.icon-spark::before { content: "✦"; }

[data-theme="dark"] .tool-finder,
[data-theme="dark"] .cookie {
  background: rgba(17, 24, 39, .92);
}

[data-theme="dark"] .brand-mark {
  box-shadow: 0 10px 24px rgba(240, 82, 82, .18);
}

@media (max-width: 980px) {
  .nav {
    position: absolute;
    top: 70px;
    right: 16px;
    left: 16px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
  }

  .nav.is-open {
    display: flex;
  }

  .nav-link {
    justify-content: flex-start;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .header-actions {
    margin-left: auto;
  }
}

@media (max-width: 640px) {
  h2 {
    font-size: 28px;
  }

  .theme-toggle span[data-theme-label] {
    display: none;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 10px 24px rgba(220, 38, 38, .22);
}

.brand small {
  display: block;
  color: var(--brand);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #374151;
  font-size: 15px;
}

.nav a:hover,
.footer a:hover {
  color: var(--brand);
}

.language-select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.hero {
  padding: 72px clamp(16px, 4vw, 56px) 34px;
  background:
    linear-gradient(135deg, rgba(220, 38, 38, .08), transparent 38%),
    linear-gradient(225deg, rgba(37, 99, 235, .08), transparent 40%),
    #fff;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: clamp(28px, 6vw, 72px);
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
}

.eyebrow {
  color: var(--brand);
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  max-width: 880px;
  margin-top: 14px;
  font-size: clamp(42px, 8vw, 76px);
  letter-spacing: 0;
}

.hero p {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(18px, 3vw, 22px);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 900;
}

.button.primary {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.tool-finder {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow);
}

.finder-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  font-weight: 900;
}

.search {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.quick-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.quick-tools a,
.tool-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.quick-tools a {
  padding: 12px;
  font-weight: 800;
}

.quick-tools a:hover,
.tool-card:hover {
  transform: translateY(-2px);
  border-color: rgba(220, 38, 38, .42);
  box-shadow: var(--shadow);
}

.section {
  padding: 56px clamp(16px, 4vw, 56px);
}

.section.alt {
  background: var(--soft);
}

.section-inner {
  max-width: 1180px;
  margin: 0 auto;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-head p {
  max-width: 720px;
  color: var(--muted);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 24px;
}

.category-tabs button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.category-tabs button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  min-height: 206px;
  padding: 18px;
}

.tool-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 8px;
  background: var(--soft-2);
  color: var(--accent);
  font-weight: 900;
}

.tool-card p {
  color: var(--muted);
  font-size: 14px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 12px;
  font-weight: 800;
}

.pill.local {
  background: #dcfce7;
  color: #166534;
}

.pill.beta {
  background: #fef3c7;
  color: var(--warning);
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr);
  gap: 24px;
  align-items: stretch;
}

.dropzone {
  display: grid;
  min-height: 270px;
  place-items: center;
  padding: 28px;
  border: 2px dashed #f1b5b5;
  border-radius: 8px;
  background: #fff8f8;
  text-align: center;
}

.dropzone input {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
}

.dropzone label {
  cursor: pointer;
}

.file-note {
  margin-top: 12px;
  color: var(--muted);
}

.trust-list,
.step-list,
.language-grid,
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.trust-item,
.step,
.language-grid a,
.blog-card,
.info-box {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.footer {
  padding: 44px clamp(16px, 4vw, 56px);
  background: #101827;
  color: #d1d5db;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 2fr;
  gap: 32px;
  max-width: 1180px;
  margin: 0 auto;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.cookie {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 520px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.cookie p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.cookie button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

[dir="rtl"] .brand,
[dir="rtl"] .actions,
[dir="rtl"] .meta-row {
  flex-direction: row-reverse;
}

@media (max-width: 980px) {
  .hero-grid,
  .upload-panel,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav {
    display: none;
  }
}

@media (max-width: 640px) {
  .site-header {
    min-height: 70px;
  }

  .hero {
    padding-top: 48px;
  }

  h1 {
    font-size: clamp(40px, 12vw, 54px);
  }

  .actions,
  .actions .button,
  .cookie {
    width: 100%;
  }

  .button,
  .cookie button {
    width: 100%;
  }

  .quick-tools,
  .tool-grid,
  .trust-list,
  .step-list,
  .language-grid,
  .blog-grid,
  .footer-links {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: block;
  }

  .cookie {
    right: 10px;
    bottom: 10px;
    left: 10px;
    display: block;
  }

  .cookie button {
    margin-top: 10px;
  }
}

/* Final cascade for the refined UI system. */
[data-theme="dark"] {
  --ink: #f8fafc;
  --muted: #aab4c3;
  --line: #263244;
  --soft: #111827;
  --soft-2: #172033;
  --brand: #f05252;
  --brand-2: #2dd4bf;
  --accent: #60a5fa;
  --warning: #fbbf24;
  --surface: #0b1020;
  --panel: #111827;
  --header-bg: rgba(11, 16, 32, .92);
  --shadow: 0 18px 50px rgba(0, 0, 0, .36);
}

body {
  font-size: var(--font-md);
  font-weight: var(--weight-regular);
}

h1 {
  font-size: var(--font-hero);
  font-weight: var(--weight-heavy);
}

h2 {
  font-size: var(--font-2xl);
  font-weight: var(--weight-heavy);
}

h3 {
  font-size: var(--font-lg);
  font-weight: var(--weight-bold);
}

.site-header {
  background: var(--header-bg);
}

.nav {
  gap: 6px;
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
}

.nav-link:hover {
  color: var(--brand);
  background: var(--soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-toggle,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
  cursor: pointer;
}

.nav-toggle {
  display: none;
  width: 42px;
  padding: 0;
}

.language-select,
.button,
.quick-tools a,
.tool-card,
.category-tabs button,
.trust-item,
.step,
.language-grid a,
.blog-card,
.info-box {
  background: var(--panel);
}

.hero {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 10%, transparent), transparent 38%),
    linear-gradient(225deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 40%),
    var(--surface);
}

.dropzone {
  background: color-mix(in srgb, var(--brand) 7%, var(--panel));
}

.footer-column {
  display: grid;
  align-content: start;
  gap: 8px;
}

.footer-column h3 {
  margin: 0 0 6px;
  color: #fff;
  font-size: var(--font-sm);
}

.footer-column a {
  color: #cbd5e1;
  font-size: var(--font-sm);
}

.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;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05em;
  height: 1.05em;
  color: currentColor;
  font-weight: var(--weight-heavy);
  line-height: 1;
}

.icon::before {
  display: block;
}

.icon-file::before { content: "▣"; }
.icon-grid::before { content: "▦"; }
.icon-menu::before { content: "☰"; }
.icon-sun::before { content: "☀"; }
.icon-moon::before { content: "☾"; }
.icon-merge::before { content: "⇄"; }
.icon-split::before { content: "⊘"; }
.icon-compress::before { content: "⇲"; }
.icon-convert::before { content: "⇅"; }
.icon-file-text::before { content: "¶"; }
.icon-edit::before { content: "✎"; }
.icon-lock::before { content: "⌂"; }
.icon-unlock::before { content: "◇"; }
.icon-sign::before { content: "✓"; }
.icon-scan::before { content: "⌗"; }
.icon-chat::before { content: "?"; }
.icon-spark::before { content: "✦"; }

@media (max-width: 980px) {
  .nav {
    position: absolute;
    top: 70px;
    right: 16px;
    left: 16px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
  }

  .nav.is-open {
    display: flex;
  }

  .nav-link {
    justify-content: flex-start;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .header-actions {
    margin-left: auto;
  }
}

@media (max-width: 640px) {
  h2 {
    font-size: 28px;
  }

  .theme-toggle span[data-theme-label] {
    display: none;
  }
}
