/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --ink: #14161f;
  --ink-soft: #4b5163;
  --border: #dde1ea;
  --accent: #2f5fff;
  --accent-ink: #ffffff;
  --accent-soft: #e8edff;
  --good: #1a8a5b;
  --warn: #b5730a;
  --bad: #d0392b;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 22, 31, 0.04), 0 8px 24px rgba(20, 22, 31, 0.06);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", var(--sans);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --container: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101219;
    --surface: #171a24;
    --surface-2: #1e2230;
    --ink: #f2f3f7;
    --ink-soft: #a9aec2;
    --border: #2a2e3d;
    --accent: #6d8dff;
    --accent-ink: #0b0d14;
    --accent-soft: #202844;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  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; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.1; letter-spacing: -0.01em; font-family: var(--display); }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }

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

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--accent); color: var(--accent-ink);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { max-width: var(--container); margin-inline: auto; padding-inline: 1.25rem; }
.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;
}
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-weight: 600; letter-spacing: .02em;
  color: var(--accent); text-transform: uppercase;
}

/* =============================================================
   4. Typography
   ============================================================= */
h1 { font-size: clamp(1.9rem, 4vw + 1rem, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 2vw + 1rem, 2rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
.subtitle { color: var(--ink-soft); font-size: 1.05rem; max-width: 60ch; }

/* =============================================================
   5. Components
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.4rem; border-radius: 999px; font-weight: 600; font-size: .95rem;
  transition: transform .2s var(--ease-out), background .2s var(--ease-out), box-shadow .2s var(--ease-out);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-ghost { background: var(--surface-2); color: var(--ink); }
.btn-ghost:hover { background: var(--border); }
.btn-lg { padding: 1rem 1.9rem; font-size: 1.05rem; }
.btn-block { width: 100%; }

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

/* nav */
.site-nav { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .9rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.brand-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-size: .85rem; font-weight: 700;
}
.nav-links { display: none; align-items: center; gap: 1.6rem; font-weight: 500; font-size: .95rem; color: var(--ink-soft); }
.nav-links a:hover, .nav-links a[aria-current] { color: var(--ink); }
.nav-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; }
.nav-toggle:hover { background: var(--surface-2); }
.nav-toggle svg { width: 22px; height: 22px; }

.mobile-nav { position: fixed; inset: 0; z-index: 50; background: var(--bg); transform: translateX(100%); transition: transform .35s var(--ease-out); display: flex; flex-direction: column; }
.mobile-nav.is-open { transform: translateX(0); }
.mobile-nav-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
.mobile-nav-links { display: flex; flex-direction: column; padding: 1.25rem; gap: .25rem; }
.mobile-nav-links a { padding: .9rem .5rem; font-size: 1.1rem; font-weight: 600; border-bottom: 1px solid var(--border); }

/* Icons */
.icon { width: 22px; height: 22px; flex-shrink: 0; }

/* Tool grid (hub + más herramientas) */
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1.75rem; }
.tool-card-link {
  display: flex; gap: 1rem; padding: 1.35rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .2s var(--ease-out), border-color .2s var(--ease-out);
}
.tool-card-link:hover { transform: translateY(-2px); border-color: var(--accent); }
.tool-card-icon {
  display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); flex-shrink: 0;
}
.tool-card-link h3 { margin-bottom: .25rem; }
.tool-card-link p { color: var(--ink-soft); font-size: .92rem; }

/* =============================================================
   6. The tool card (drives everything)
   ============================================================= */
.hero { padding-block: clamp(2rem, 5vw, 3.25rem) 1rem; }
.hero-head { max-width: 68ch; margin-bottom: 1.75rem; }
.hero-head h1 { margin-bottom: .6rem; }

.tool-card {
  padding: clamp(1.25rem, 3vw, 2rem);
  display: flex; flex-direction: column; gap: 1.1rem;
}

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .65rem;
  text-align: center; padding: clamp(1.8rem, 5vw, 3rem) 1.25rem;
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer;
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone-icon { width: 46px; height: 46px; color: var(--accent); }
.dropzone-title { font-weight: 600; font-size: 1.05rem; }
.dropzone-hint { color: var(--ink-soft); font-size: .88rem; }

.file-list { display: flex; flex-direction: column; gap: .55rem; }
.file-row {
  display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: grab;
}
.file-row[draggable="true"]:active { cursor: grabbing; }
.file-row.is-dragging { opacity: .4; }
.file-row-thumb {
  width: 40px; height: 52px; border-radius: 4px; background: var(--surface); border: 1px solid var(--border);
  object-fit: cover; flex-shrink: 0;
}
.file-row-info { flex: 1; min-width: 0; }
.file-row-name { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row-meta { color: var(--ink-soft); font-size: .8rem; }
.file-row-remove { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--ink-soft); flex-shrink: 0; }
.file-row-remove:hover { background: var(--border); color: var(--bad); }
.file-row-drag { color: var(--ink-soft); flex-shrink: 0; }

.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-weight: 600; font-size: .9rem; }
.field input[type="text"], .field input[type="number"] {
  padding: .7rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; width: 100%;
}
.field input:focus-visible { border-color: var(--accent); }
.field-hint { color: var(--ink-soft); font-size: .82rem; }

.radio-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.radio-chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .55rem .95rem;
  border: 1px solid var(--border); border-radius: 999px; font-size: .88rem; font-weight: 500;
  background: var(--surface); cursor: pointer;
}
.radio-chip input { accent-color: var(--accent); }
.radio-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.progress-wrap { display: none; flex-direction: column; gap: .5rem; }
[data-state="loading-engine"] .progress-wrap,
[data-state="working"] .progress-wrap { display: flex; }
.progress-label { display: flex; justify-content: space-between; font-size: .85rem; color: var(--ink-soft); }
.progress-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width .25s var(--ease-out); }

.result-panel { display: none; flex-direction: column; gap: 1rem; text-align: center; padding: 1.5rem; background: var(--accent-soft); border-radius: var(--radius-sm); }
[data-state="done"] .result-panel { display: flex; }
.result-icon { width: 44px; height: 44px; color: var(--good); margin-inline: auto; }
.result-meta { color: var(--ink-soft); font-size: .9rem; }
.result-note { font-size: .85rem; color: var(--ink-soft); }
.reset-link { font-size: .88rem; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }
.reset-link:hover { color: var(--accent); }

.error-panel { display: none; flex-direction: column; gap: .75rem; padding: 1.25rem; background: color-mix(in srgb, var(--bad) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--border)); border-radius: var(--radius-sm); }
[data-state="error"] .error-panel { display: flex; }
.error-title { font-weight: 600; color: var(--bad); }

.warn-panel { display: none; gap: .6rem; padding: .9rem 1rem; background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border)); border-radius: var(--radius-sm); font-size: .88rem; }
.warn-panel.is-visible { display: flex; }

[data-state="idle"] .file-list,
[data-state="idle"] .progress-wrap,
[data-state="idle"] .result-panel { display: none; }
[data-state="working"] .dropzone, [data-state="loading-engine"] .dropzone { pointer-events: none; opacity: .55; }

.badge-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .25rem; }
.privacy-badge {
  display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .9rem;
  background: var(--surface-2); border-radius: 999px; font-size: .85rem; color: var(--ink-soft);
}
.privacy-badge svg { width: 16px; height: 16px; color: var(--good); }

/* Ad slots */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 90px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase;
  background: var(--surface-2);
}

/* How it works */
.steps { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin-top: 1.5rem; }
.step { display: flex; gap: 1rem; }
.step-num { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; flex-shrink: 0; }
.step p { color: var(--ink-soft); font-size: .93rem; margin-top: .2rem; }

/* SEO text */
.prose { max-width: 72ch; color: var(--ink-soft); }
.prose p { margin-bottom: 1rem; }
.prose h2 { color: var(--ink); margin-top: 2rem; margin-bottom: .6rem; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.25rem; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .2rem .3rem; }
.faq-item summary {
  cursor: pointer; padding: .9rem 1rem; font-weight: 600; font-size: .96rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--ink-soft); 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(--ink-soft); font-size: .92rem; }

/* footer */
.site-footer { border-top: 1px solid var(--border); padding-block: 2.5rem; margin-top: 3rem; color: var(--ink-soft); font-size: .88rem; }
.footer-inner { display: flex; flex-direction: column; gap: 1.25rem; align-items: flex-start; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-links a:hover { color: var(--ink); }
.footer-credits { font-size: .8rem; opacity: .8; }

.legal-page .prose { max-width: 80ch; }
.legal-page h2 { margin-top: 1.75rem; }

/* =============================================================
   7. Effects
   ============================================================= */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 720px) {
  .nav-links { display: flex; }
  .nav-toggle { display: none; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .footer-inner { flex-direction: row; align-items: center; }
}
@media (min-width: 960px) {
  .tool-grid.tool-grid-hub { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1280px) {
  .container { padding-inline: 2rem; }
}

/* =============================================================
   9. Reduced motion — only intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .spin { animation-duration: 1.6s; }
  html { scroll-behavior: auto; }
}
