/* =============================================================
   Utilísimo — hoja de estilos compartida por todas las herramientas
   ============================================================= */

/* 1. Tokens ---------------------------------------------------- */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --ink: #17161a;
  --ink-2: #4a4852;
  --ink-3: #7a7784;
  --line: #e4e1d9;
  --accent: #1f7a5c;          /* cada herramienta lo sobreescribe */
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --ok: #1f7a5c;
  --warn: #b26b00;
  --bad: #b3261e;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20,18,30,.04), 0 8px 30px rgba(20,18,30,.06);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --wrap: 1080px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121116;
    --surface: #1b1a20;
    --surface-2: #24232a;
    --ink: #f2f0ea;
    --ink-2: #c3c0c9;
    --ink-3: #8f8c99;
    --line: #2f2d36;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

/* 2. Reset & base ---------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; letter-spacing: -0.02em; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

/* 3. Utilities ------------------------------------------------- */
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 9999;
  padding: .6rem 1rem; background: var(--ink); color: var(--bg); border-radius: 8px;
}
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.mono { font-family: var(--mono); }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 auto; }

/* 4. Header / footer ------------------------------------------- */
.site-header { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); position: sticky; top: 0; z-index: 50; backdrop-filter: blur(8px); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; gap: 1rem; }
.logo { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 700; font-size: 1.15rem; text-decoration: none; letter-spacing: -0.02em; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: .95rem; }
.nav-link { text-decoration: none; font-weight: 600; font-size: .92rem; padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.nav-link:hover { border-color: var(--ink-3); }

.site-footer { margin-top: 4rem; border-top: 1px solid var(--line); padding: 2.5rem 0 3rem; color: var(--ink-3); font-size: .9rem; }
.site-footer .wrap { display: grid; gap: 1rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

/* 5. Hero + tool card ------------------------------------------ */
.tool-hero { padding: 1.75rem 0 .75rem; }
.tool-hero h1 { font-family: var(--display); font-size: clamp(1.7rem, 4.5vw, 2.6rem); font-weight: 700; }
.tool-hero .sub { color: var(--ink-2); margin-top: .4rem; max-width: 60ch; }
.eyebrow { display: inline-flex; gap: .4rem; align-items: center; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: .5rem; }

.tool-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(1rem, 3vw, 1.75rem); margin-top: 1rem;
}
.privacy {
  display: flex; gap: .6rem; align-items: flex-start; margin-top: .9rem;
  font-size: .88rem; color: var(--ink-2);
}
.privacy svg { flex: none; color: var(--accent); margin-top: 2px; }

.noscript-msg { padding: 1rem; border-radius: var(--radius-sm); background: var(--surface-2); }

/* Dropzone */
.dropzone {
  display: grid; place-items: center; text-align: center; gap: .5rem;
  border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--accent-soft); border-radius: var(--radius);
  padding: 2.2rem 1rem; cursor: pointer; transition: background .2s var(--ease-out), border-color .2s;
}
.dropzone:hover, .dropzone.is-over { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); }
.dropzone strong { font-size: 1.1rem; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dz-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.25rem; border-radius: 12px; font-weight: 700; text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--line); transition: transform .15s var(--ease-out), background .2s, border-color .2s;
  min-height: 46px;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); border-color: transparent; }
.btn-big { font-size: 1.08rem; padding: 1rem 1.5rem; min-height: 56px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Forms */
.field { display: grid; gap: .35rem; }
.field > span, .field > label { font-weight: 600; font-size: .9rem; }
.field .hint { font-size: .8rem; color: var(--ink-3); font-weight: 400; }
.input, select.input, textarea.input {
  width: 100%; padding: .7rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg); min-height: 46px;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.grid-2 { display: grid; gap: .9rem; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: .9rem; grid-template-columns: 1fr; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; flex-wrap: wrap; }
.seg button { padding: .5rem .85rem; border-radius: 9px; font-weight: 600; font-size: .9rem; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); color: var(--accent); }
input[type=range] { accent-color: var(--accent); width: 100%; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }
input[type=color] { width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--bg); cursor: pointer; }

/* States */
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width .25s var(--ease-out); }
.status { font-size: .92rem; color: var(--ink-2); margin-top: .5rem; }
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: .92rem; }
.alert-warn { background: color-mix(in srgb, var(--warn) 12%, transparent); color: color-mix(in srgb, var(--warn) 80%, var(--ink)); }
.alert-bad  { background: color-mix(in srgb, var(--bad) 10%, transparent); color: color-mix(in srgb, var(--bad) 85%, var(--ink)); }
.alert-ok   { background: color-mix(in srgb, var(--ok) 12%, transparent); color: color-mix(in srgb, var(--ok) 85%, var(--ink)); }

/* Result numbers */
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); }
.kpi { background: var(--surface-2); border-radius: 14px; padding: .9rem 1rem; }
.kpi b { display: block; font-family: var(--display); font-size: clamp(1.3rem, 4vw, 1.8rem); line-height: 1.15; }
.kpi span { font-size: .82rem; color: var(--ink-3); }
.kpi.hl { background: var(--accent); color: var(--accent-ink); }
.kpi.hl span { color: color-mix(in srgb, var(--accent-ink) 80%, transparent); }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 6. Content sections ------------------------------------------ */
.ad-slot {
  min-height: 120px; margin: 2rem 0; border: 1px dashed var(--line); border-radius: 12px;
  display: grid; place-items: center; color: var(--ink-3); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase;
}
.section { margin-top: 3rem; }
.section h2 { font-family: var(--display); font-size: clamp(1.35rem, 3vw, 1.8rem); margin-bottom: 1rem; }
.section h3 { font-size: 1.1rem; margin: 1.4rem 0 .4rem; }
.prose { max-width: 70ch; color: var(--ink-2); }
.prose p + p { margin-top: .9rem; }
.prose ul { padding-left: 1.2rem; margin-top: .6rem; }
.prose li + li { margin-top: .3rem; }
.prose strong { color: var(--ink); }
.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; counter-reset: s; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.step::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; margin-bottom: .6rem; }
.step h3 { margin: 0 0 .25rem; font-size: 1rem; }
.step p { font-size: .92rem; color: var(--ink-2); }
.faq details { border-bottom: 1px solid var(--line); padding: .9rem 0; }
.faq summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin-top: .5rem; color: var(--ink-2); max-width: 70ch; }

.tools-grid { display: grid; gap: .9rem; grid-template-columns: 1fr; }
.tool-link {
  display: flex; gap: .9rem; align-items: flex-start; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem;
  transition: border-color .2s, transform .2s var(--ease-out);
}
.tool-link:hover { border-color: var(--tc, var(--accent)); transform: translateY(-2px); }
.tool-link .ti { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--tc, var(--accent)) 14%, transparent); color: var(--tc, var(--accent)); font-size: 1.35rem; }
.tool-link b { display: block; font-size: 1rem; line-height: 1.3; }
.tool-link span { display: block; font-size: .86rem; color: var(--ink-3); margin-top: .15rem; }

.credits { font-size: .8rem; }

/* 7. Effects --------------------------------------------------- */
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.pop { animation: pop .35s var(--ease-out); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 8. Responsive ------------------------------------------------ */
@media (min-width: 540px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 720px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .tools-grid { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 960px) {
  .tools-grid.hub { grid-template-columns: repeat(3, 1fr); }
}

/* 9. Reduced motion (solo lo intrusivo) ------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* 10. Print ---------------------------------------------------- */
@media print {
  .site-header, .site-footer, .ad-slot, .section.more, .faq { display: none !important; }
  body { background: #fff; color: #000; }
}
.tool-link b { color: var(--ink); }
.tool-link .cat { display: block; font-style: normal; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--tc, var(--accent)); margin-bottom: .15rem; }
