/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #F4F7FB;
  --surface: #FFFFFF;
  --surface-2: #EAF0F9;
  --text: #172033;
  --text-muted: #5B6B80;
  --border: #DCE5F0;

  --accent: #2C5CE8;
  --accent-ink: #1E43B8;
  --accent-soft: #E3EAFD;
  --accent-contrast: #FFFFFF;

  --positive: #1E9E6B;
  --positive-soft: #E1F5EC;
  --danger: #D23B3B;
  --danger-soft: #FBE7E7;
  --warn: #B4720A;
  --warn-soft: #FCF0DA;

  --shadow-sm: 0 1px 2px rgba(23, 32, 51, 0.08);
  --shadow-md: 0 8px 24px rgba(23, 32, 51, 0.10);
  --shadow-lg: 0 20px 48px rgba(23, 32, 51, 0.16);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Sora", var(--sans);
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  --container: 1080px;
  --gutter: 1.25rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1520;
    --surface: #161E2C;
    --surface-2: #1D2838;
    --text: #EAF1FA;
    --text-muted: #9FB0C6;
    --border: #2A3A4E;

    --accent: #7098FF;
    --accent-ink: #A6C0FF;
    --accent-soft: #1E2C4C;
    --accent-contrast: #0F1520;

    --positive: #5FCB99;
    --positive-soft: #123326;
    --danger: #E4726F;
    --danger-soft: #3A1D1D;
    --warn: #E0AC4F;
    --warn-soft: #3A2E12;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  --bg: #0F1520;
  --surface: #161E2C;
  --surface-2: #1D2838;
  --text: #EAF1FA;
  --text-muted: #9FB0C6;
  --border: #2A3A4E;

  --accent: #7098FF;
  --accent-ink: #A6C0FF;
  --accent-soft: #1E2C4C;
  --accent-contrast: #0F1520;

  --positive: #5FCB99;
  --positive-soft: #123326;
  --danger: #E4726F;
  --danger-soft: #3A1D1D;
  --warn: #E0AC4F;
  --warn-soft: #3A2E12;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%;
  tab-size: 2;
  color-scheme: light dark;
  scroll-behavior: smooth;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; font-family: var(--display); }
::selection { background: var(--accent-soft); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =============================================================
   3. Utilities
   ============================================================= */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.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;
}
.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--text); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.4rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .95rem;
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), background-color .15s var(--ease-out), opacity .15s var(--ease-out);
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); color: var(--accent-contrast);
  box-shadow: var(--shadow-sm);
}
.btn-primary:not(:disabled):hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
.btn-secondary:not(:disabled):hover { background: var(--accent-soft); border-color: var(--accent); }
.btn-ghost { color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; }
.btn-ghost:hover { color: var(--text); }
.btn-lg { padding: 1rem 1.8rem; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* =============================================================
   4. Header / nav
   ============================================================= */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 40;
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: .85rem;
}
.logo {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--display); font-weight: 700; font-size: 1.15rem;
  color: var(--text); flex-shrink: 0;
}
.logo svg { color: var(--accent); }
.site-nav {
  display: flex; gap: .3rem;
  overflow-x: auto; scrollbar-width: none;
  -ms-overflow-style: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav__link {
  padding: .5rem .8rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; color: var(--text-muted);
  white-space: nowrap;
  transition: background-color .15s var(--ease-out), color .15s var(--ease-out);
}
.site-nav__link:hover { color: var(--text); background: var(--surface-2); }
.site-nav__link[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding-block: 2.5rem 1.5rem; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); font-weight: 800; }
.hero-sub {
  margin-top: .7rem; color: var(--text-muted); font-size: 1.05rem;
  max-width: 640px; margin-inline: auto;
}

/* =============================================================
   6. Tool card (shared shell)
   ============================================================= */
.tool-section { padding-bottom: 1.5rem; }
.tool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  padding: 1.5rem; max-width: 720px; margin-inline: auto;
}
@media (min-width: 540px) { .tool-card { padding: 2rem; } }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .6rem; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius-md);
  padding: 2.2rem 1.2rem; cursor: pointer;
  transition: border-color .15s var(--ease-out), background-color .15s var(--ease-out);
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone__icon { color: var(--accent); }
.dropzone__title { font-weight: 700; font-size: 1.05rem; }
.dropzone__hint { color: var(--text-muted); font-size: .88rem; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.tool-card__error {
  margin-top: 1rem; padding: .8rem 1rem; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger); font-size: .92rem; font-weight: 600;
}
.tool-card__error a { text-decoration: underline; }

/* File list (unir) */
.file-list { display: flex; flex-direction: column; gap: .55rem; margin-top: 1.2rem; }
.file-card {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.file-card__order { display: flex; flex-direction: column; gap: 1px; flex-shrink: 0; }
.file-card__order button {
  width: 22px; height: 18px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); border-radius: 4px;
}
.file-card__order button:hover:not(:disabled) { background: var(--border); color: var(--text); }
.file-card__order button:disabled { opacity: .3; cursor: default; }
.file-card__icon { color: var(--accent); flex-shrink: 0; }
.file-card__info { flex: 1; min-width: 0; }
.file-card__name {
  display: block; font-weight: 600; font-size: .92rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-card__meta { display: block; font-size: .8rem; color: var(--text-muted); }
.file-card__meta--error { color: var(--danger); font-weight: 600; }
.file-card__remove {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.file-card__remove:hover { background: var(--danger-soft); color: var(--danger); }

.file-list-actions {
  display: flex; flex-wrap: wrap; gap: .6rem; justify-content: space-between; align-items: center;
  margin-top: 1.1rem;
}
.file-list-hint { font-size: .85rem; color: var(--text-muted); }

/* Loaded single-file summary (dividir / pdf-a-word) */
.file-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem;
  padding: .9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-2); margin-top: 1.2rem;
}
.file-summary__icon { color: var(--accent); flex-shrink: 0; }
.file-summary__info { flex: 1 1 180px; min-width: 0; }
.file-summary__name { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-summary__meta { display: block; font-size: .85rem; color: var(--text-muted); margin-top: 2px; }
.file-summary__change { flex-shrink: 0; font-size: .85rem; }

/* Mode selector (dividir) */
.mode-select { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.3rem; }
.mode-option {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .8rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; transition: border-color .15s var(--ease-out), background-color .15s var(--ease-out);
}
.mode-option:hover { border-color: var(--accent); }
.mode-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode-option input[type="radio"] { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.mode-option__title { font-weight: 700; font-size: .94rem; }
.mode-option__desc { font-size: .84rem; color: var(--text-muted); margin-top: 1px; }

.range-field { margin-top: .9rem; }
.range-field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.range-field input[type="text"] {
  width: 100%; padding: .75rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: .95rem;
}
.range-field input[type="text"]:focus-visible { border-color: var(--accent); }
.range-field__hint { font-size: .8rem; color: var(--text-muted); margin-top: .4rem; }

/* Tier grid (basic vs. enhanced result) */
.tier-grid { display: grid; gap: .9rem; grid-template-columns: 1fr; margin: 1.3rem 0; text-align: left; }
@media (min-width: 540px) { .tier-grid { grid-template-columns: 1fr 1fr; } }
.tier-card { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem; background: var(--surface-2); }
.tier-card--accent { border-color: var(--accent); background: var(--accent-soft); }
.tier-card__label { font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: .4rem; }
.tier-card__badge {
  font-size: .68rem; font-weight: 700; background: var(--positive); color: #fff;
  padding: .1rem .45rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .02em;
}
.tier-card__desc { font-size: .83rem; color: var(--text-muted); margin: .4rem 0 .8rem; }

/* Ad-gate dialog (unlock-after-wait, never a forced ad click) */
.ad-gate {
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 1.5rem; max-width: 380px; width: calc(100% - 2rem);
  background: var(--surface); color: var(--text);
  /* The global `margin: 0` reset strips the UA stylesheet's default
     centering for <dialog> (position: fixed; inset: 0; margin: auto), so
     it has to be restored explicitly here. */
  position: fixed; inset: 0; margin: auto;
}
.ad-gate::backdrop { background: rgba(10, 14, 22, .55); }
.ad-gate__close {
  position: absolute; top: .7rem; right: .7rem; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted);
}
.ad-gate__close:hover { background: var(--surface-2); color: var(--text); }
.ad-gate__title { font-weight: 700; font-size: 1.05rem; padding-right: 2rem; margin-bottom: 1rem; }
.ad-gate .ad-slot--gate { min-height: 120px; margin-bottom: 1rem; }
.ad-gate__status { text-align: center; color: var(--text-muted); font-size: .88rem; margin-bottom: 1rem; }

/* Callout (pdf-to-word disclaimer) */
.callout {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .9rem 1rem; border-radius: var(--radius-md);
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  font-size: .88rem; color: var(--text); margin-top: 1.2rem;
}
.callout__icon { flex-shrink: 0; color: var(--warn); }
.callout strong { color: var(--warn); }
.callout ul { margin: .4rem 0 0 1.1rem; padding: 0; }

/* Progress */
.progress-zone { margin-top: 1.3rem; text-align: center; }
.progress-zone__label { font-size: .9rem; color: var(--text-muted); margin-bottom: .6rem; }
.progress-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-bar__fill {
  height: 100%; width: 35%; border-radius: 999px; background: var(--accent);
  animation: progressPulse 1.3s var(--ease-in-out, ease-in-out) infinite;
}
@keyframes progressPulse {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(340%); }
}

/* Result */
.result-zone { margin-top: 1.4rem; text-align: center; }
.result-zone__icon { color: var(--positive); margin-inline: auto; }
.result-zone__title { font-weight: 700; font-size: 1.1rem; margin-top: .5rem; }
.result-zone__meta { color: var(--text-muted); font-size: .88rem; margin-top: .2rem; margin-bottom: 1.1rem; }
.result-zone .btn-primary { margin-inline: auto; }
.result-zone__reset { display: block; margin-top: .9rem; }

/* Privacy + limits */
.privacy-badge {
  margin-top: 1.3rem; font-size: .85rem; color: var(--text-muted);
  display: flex; align-items: center; gap: .4rem; justify-content: center; text-align: center;
}
.limit-note { margin-top: .4rem; font-size: .8rem; color: var(--text-muted); text-align: center; }

/* =============================================================
   7. Ad slots (live AdSense units — layout/CLS containers only)
   ============================================================= */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 90px; overflow: hidden;
}
.ad-slot--leaderboard { margin: 1.8rem auto; max-width: 970px; }
.ad-slot--incontent { margin-block: 2rem; }

/* =============================================================
   8. Content sections
   ============================================================= */
.content { padding-block: 2.5rem 3rem; display: flex; flex-direction: column; gap: 2.5rem; max-width: 760px; }

.how-it-works h2, .seo-text h2, .faq h2, .more-tools h2 { font-size: 1.4rem; margin-bottom: 1.1rem; }
.steps { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.step { display: flex; gap: 1rem; align-items: flex-start; }
.step__num {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: .9rem;
}
.step h3 { font-size: 1rem; margin-bottom: .2rem; }
.step p { color: var(--text-muted); font-size: .92rem; }

.seo-text p { margin-bottom: 1rem; color: var(--text-muted); }
.seo-text strong { color: var(--text); }
.seo-text h2 + p { margin-top: 0; }

.faq-list { display: flex; flex-direction: column; gap: .6rem; }
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
  padding: .2rem .1rem;
}
.faq-item summary {
  cursor: pointer; list-style: none; padding: .9rem 1rem;
  font-weight: 600; font-size: .95rem; display: flex; justify-content: space-between; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; color: var(--accent); font-size: 1.2rem; font-weight: 400; flex-shrink: 0;
  transition: transform .2s var(--ease-out);
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 1rem 1rem; color: var(--text-muted); font-size: .9rem; }

.tool-cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 540px) { .tool-cards { grid-template-columns: repeat(2, 1fr); } }
.tool-card-link {
  display: flex; flex-direction: column; gap: .5rem;
  padding: 1.1rem 1.2rem; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); transition: border-color .15s var(--ease-out), transform .15s var(--ease-out);
}
.tool-card-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card-link__icon { color: var(--accent); }
.tool-card-link__title { font-weight: 700; font-size: .98rem; }
.tool-card-link__desc { font-size: .85rem; color: var(--text-muted); }

/* =============================================================
   9. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); margin-top: 1rem; }
.site-footer__inner {
  padding-block: 1.6rem; display: flex; flex-wrap: wrap; gap: .8rem 1.5rem;
  justify-content: space-between; align-items: center;
  font-size: .85rem; color: var(--text-muted);
}
.footer-links { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }
.footer-credits { font-size: .75rem; color: var(--text-muted); opacity: .8; }

/* No-JS notice */
.no-js-note {
  display: none; margin-top: 1.2rem; padding: .8rem 1rem; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-muted); font-size: .88rem; text-align: center;
}
html.no-js .no-js-note { display: block; }
html.no-js .js-only { display: none !important; }

/* =============================================================
   10. Legal pages
   ============================================================= */
.legal { padding-block: 2.5rem 3rem; max-width: 760px; }
.legal h1 { font-size: 1.8rem; margin-bottom: 1.2rem; }
.legal h2 { font-size: 1.15rem; margin-top: 1.6rem; margin-bottom: .5rem; }
.legal p, .legal li { color: var(--text-muted); font-size: .95rem; margin-bottom: .6rem; }
.legal ul { padding-left: 1.2rem; }

/* =============================================================
   11. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .site-header__inner { padding-block: 1rem; }
}
@media (min-width: 720px) {
  .content { max-width: 800px; }
}
@media (min-width: 960px) {
  .hero { padding-block: 3.5rem 2rem; }
}

/* =============================================================
   12. Reduced motion (only intrusive effects)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .progress-bar__fill { animation-duration: 2.2s; }
}
html { scroll-behavior: auto; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
