/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --text: #1a1d1f;
  --text-muted: #5b6166;
  --border: #e4e1da;
  --accent: #6d28d9;
  --accent-contrast: #ffffff;
  --lvl1: #c0392b;
  --lvl2: #d97a3f;
  --lvl3: #d9a441;
  --lvl4: #6fa85e;
  --lvl5: #2f8f4e;
  --radius: 14px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --display: "Manrope", var(--sans);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181a;
    --surface: #1b2124;
    --text: #eef1f0;
    --text-muted: #a3aaad;
    --border: #2c3336;
    --accent: #a78bfa;
    --accent-contrast: #14101f;
    --lvl1: #e05c4d;
    --lvl2: #e59a5e;
    --lvl3: #e2bd6a;
    --lvl4: #8fc47c;
    --lvl5: #4cb571;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; font-family: var(--display); letter-spacing: -0.01em; }
code { font-family: var(--mono); background: var(--border); padding: .1em .35em; border-radius: 5px; font-size: .9em; }
::selection { background: var(--accent); color: var(--accent-contrast); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
input, select { accent-color: var(--accent); }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 760px; margin-inline: auto; padding-inline: 1.25rem; }
.muted { color: var(--text-muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--surface); color: var(--text);
  z-index: 9999; border-radius: 8px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   4. Header / Footer
   ============================================================= */
.site-header { border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; justify-content: space-between; padding-block: 1rem; }
.logo { font-family: var(--display); font-weight: 800; font-size: 1.15rem; color: var(--accent); }
.header-row nav a { font-size: .9rem; font-weight: 600; }

.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding-block: 1.5rem; }
.footer-row { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between; color: var(--text-muted); font-size: .875rem; }
.footer-row nav { display: flex; gap: 1rem; }

/* =============================================================
   5. Hero + tool card
   ============================================================= */
.hero { padding-block: 2.25rem 1rem; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 4.4vw, 2.5rem); max-width: 22ch; margin-inline: auto; }
.hero-sub { color: var(--text-muted); max-width: 46ch; margin: .75rem auto 1.75rem; font-size: 1.02rem; }

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: left;
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 12px 32px -16px rgba(0,0,0,.12);
}

.mode-tabs { display: flex; gap: .4rem; margin-bottom: 1.25rem; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .25rem; }
.mode-tabs button {
  flex: 1 1 0; padding: .55rem .5rem; border-radius: 8px; font-weight: 600; font-size: .88rem;
  color: var(--text-muted); transition: background .15s var(--ease-out), color .15s var(--ease-out);
}
.mode-tabs button.is-active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.mode-fields { border: 0; padding: 0; margin: 0 0 .9rem; }

.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.field-row { display: flex; gap: .75rem; margin-bottom: .9rem; }
.field-row .field { flex: 1 1 0; min-width: 0; margin-bottom: 0; }
.field-narrow { flex: 0 1 50%; }
.field label { font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.field input[type="number"], .field select {
  font: inherit; font-size: 1rem; padding: .65rem .75rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); width: 100%;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field input[type="range"] { width: 100%; }
.field output { font-weight: 700; color: var(--accent); }
.field-cantidad input { max-width: 8rem; }

.checkbox-row { display: flex; flex-wrap: wrap; gap: .6rem 1.1rem; margin-bottom: .9rem; }
.field-checkbox { display: flex; align-items: center; gap: .45rem; font-size: .9rem; font-weight: 500; color: var(--text); cursor: pointer; }
.field-checkbox input { width: 17px; height: 17px; }
.field-checkbox-inline { justify-content: flex-end; padding-top: 1.6rem; }

.btn-primary {
  width: 100%; margin-top: .4rem;
  background: var(--accent); color: var(--accent-contrast);
  font-weight: 700; font-size: 1.02rem;
  padding: .85rem 1rem; border-radius: 10px;
  transition: transform .2s var(--ease-out), filter .2s var(--ease-out);
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(.98); }

.btn-text { font-weight: 600; color: var(--accent); font-size: .9rem; margin-top: 1rem; margin-right: 1rem; }

.tool-error { display: none; color: var(--lvl1); font-weight: 600; margin-top: .75rem; }
.tool-card[data-state="error"] .tool-error { display: block; }
.tool-card[data-state="error"] .tool-result { display: none; }

.tool-result { display: none; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.tool-card[data-state="done"] .tool-result { display: block; }

.strength-meter { margin-bottom: 1.25rem; }
.strength-bar { --pct: 0%; height: 10px; border-radius: 999px; overflow: hidden; background: var(--border); }
.strength-bar span, .strength-bar::after { content: ""; display: block; height: 100%; width: var(--pct); border-radius: 999px; transition: width .25s var(--ease-out); }
.strength-bar { position: relative; }
.strength-bar::after { position: absolute; top: 0; left: 0; }
.strength-bar.nivel-1::after { background: var(--lvl1); }
.strength-bar.nivel-2::after { background: var(--lvl2); }
.strength-bar.nivel-3::after { background: var(--lvl3); }
.strength-bar.nivel-4::after { background: var(--lvl4); }
.strength-bar.nivel-5::after { background: var(--lvl5); }
.strength-label { display: flex; justify-content: space-between; align-items: baseline; margin-top: .5rem; font-size: .9rem; }
.strength-label span:first-child { font-weight: 700; }
.strength-bits { color: var(--text-muted); font-size: .8rem; }

.password-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.password-item { display: flex; gap: .5rem; }
.password-output {
  flex: 1 1 0; min-width: 0; font: 1rem/1.4 var(--mono);
  padding: .65rem .75rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); letter-spacing: .02em;
}
.btn-copy {
  flex: 0 0 auto; padding: .6rem 1rem; border-radius: 10px;
  background: var(--border); color: var(--text); font-weight: 600; font-size: .85rem;
  white-space: nowrap; transition: background .15s var(--ease-out);
}
.btn-copy:hover { background: var(--accent); color: var(--accent-contrast); }

.privacy-badge { margin-top: 1.25rem; font-size: .85rem; color: var(--text-muted); }
.limits-note { margin-top: .4rem; font-size: .78rem; color: var(--text-muted); }

.js-off-note { padding: 1rem 1.25rem; background: #fff3cd; color: #664d03; border-radius: 10px; margin: 1rem auto; }

/* =============================================================
   6. Ad slots
   ============================================================= */
.ad-slot {
  min-height: 90px; margin-block: 2rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: 10px;
  color: var(--text-muted); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase;
}

/* =============================================================
   7. Content sections
   ============================================================= */
.content-block { padding-block: 1.75rem; }
.content-block h2 { font-size: 1.35rem; margin-bottom: .75rem; }
.content-block p { margin-bottom: 1rem; color: var(--text); }
.content-block + .content-block { border-top: 1px solid var(--border); }

.steps { padding-left: 1.2rem; display: flex; flex-direction: column; gap: .6rem; }

.faq-list { display: flex; flex-direction: column; gap: .5rem; }
.faq-item { border: 1px solid var(--border); border-radius: 10px; padding: .2rem .9rem; background: var(--surface); }
.faq-item summary { cursor: pointer; font-weight: 600; padding-block: .75rem; }
.faq-item p { color: var(--text-muted); padding-bottom: .85rem; margin: 0; }

.tools-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.tools-list a { font-weight: 600; color: var(--accent); }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .field-row { gap: 1rem; }
}
@media (min-width: 720px) {
  .hero { padding-block: 3.5rem 1.5rem; }
}
@media (max-width: 539px) {
  .field-row { flex-direction: column; }
  .field-narrow { flex: 1 1 auto; }
  .field-checkbox-inline { justify-content: flex-start; padding-top: 0; }
  .password-item { flex-direction: column; }
}

/* =============================================================
   9. Reduced motion — solo lo intrusivo
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .btn-primary { transition: none; }
  .strength-bar::after { transition: none; }
}
