/* =============================================================
   CVFácil — hoja de estilos única
   1. Tokens · 2. Reset · 3. Utilidades · 4. Tipografía
   5. Componentes · 6. Secciones · 7. Vista previa (papel)
   8. Responsive · 9. Reduced-motion
   ============================================================= */

/* ============================ 1. Tokens ===================== */
:root {
  --accent: #0d7c66;
  --accent-ink: #075f4d;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f0f2ef;
  --ink: #14201d;
  --ink-soft: #4d5a56;
  --line: #dfe4e0;
  --danger: #b3261e;

  --sans: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Poppins", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 14px;
  --radius-sm: 9px;
  --gutter: clamp(1rem, 3vw, 2rem);
  --maxw: 1180px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 1px 2px rgba(20, 32, 29, .06), 0 10px 30px rgba(20, 32, 29, .07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161a;
    --surface: #161e22;
    --surface-2: #1c262b;
    --ink: #e8eeec;
    --ink-soft: #9fb0ab;
    --line: #2a363c;
    --accent: #35b295;
    --accent-ink: #7fd9c2;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  }
}

/* ============================ 2. Reset ====================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; 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;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
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 { text-wrap: balance; line-height: 1.12; letter-spacing: -0.02em; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ============================ 3. Utilidades ================= */
.wrap { width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--ink); color: var(--bg);
  border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ============================ 4. Tipografía ================= */
h1 {
  font-family: var(--display);
  font-size: clamp(1.65rem, 1.1rem + 2.4vw, 2.6rem);
  font-weight: 700;
  margin-block: .2em .3em;
}
h2 { font-family: var(--display); font-size: clamp(1.35rem, 1rem + 1.4vw, 1.9rem); font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 700; }
.lede { color: var(--ink-soft); max-width: 62ch; margin-bottom: 1.1rem; }

/* ============================ 5. Componentes ================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.1rem; border-radius: 999px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface);
  transition: transform .18s var(--ease-out), background .18s var(--ease-out), border-color .18s var(--ease-out);
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn--ghost { background: transparent; }
.btn--sm { padding: .45rem .8rem; font-size: .88rem; }
.btn--big { width: 100%; padding: .95rem 1.2rem; font-size: 1.05rem; margin-top: .9rem; }
/* En móvil el botón principal viaja fijo abajo: siempre a un toque de distancia. */
[data-download] {
  position: fixed; left: 12px; right: 12px; bottom: 12px; width: auto; z-index: 30;
  margin-top: 0; box-shadow: 0 6px 22px rgba(13, 124, 102, .35);
}
body { padding-bottom: 84px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.linkish {
  background: none; border: 0; padding: .15rem 0; font-size: .88rem; font-weight: 600;
  color: var(--accent); border-bottom: 1px solid currentColor; cursor: pointer;
}
.linkish--danger { color: var(--danger); }

.field { display: grid; gap: .3rem; margin-bottom: .7rem; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.field em { font-style: normal; font-weight: 400; opacity: .8; }
.field input, .field select, .field textarea {
  font: inherit; font-size: .95rem; color: var(--ink);
  padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); width: 100%;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.field--inline { display: flex; align-items: center; gap: .5rem; margin: 0; }
.field--inline > span { white-space: nowrap; }
.row { display: grid; gap: .6rem; }
.check { display: flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--ink-soft); }
.check--tall { align-self: end; padding-bottom: .55rem; }
.hint { font-size: .82rem; color: var(--ink-soft); margin-top: .35rem; }

/* Barra superior de la herramienta */
.tool-bar {
  display: flex; flex-wrap: wrap; gap: .9rem 1.4rem; align-items: center;
  padding: .85rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.tool-bar fieldset { border: 0; padding: 0; display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.tool-bar legend { float: left; font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin-right: .5rem; }
.tpl-picker label { position: relative; }
.tpl-picker input { position: absolute; opacity: 0; inset: 0; }
.tpl-picker span {
  display: inline-block; padding: .35rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); font-size: .85rem; font-weight: 600; background: var(--surface);
}
.tpl-picker input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.tpl-picker input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent;
  box-shadow: 0 0 0 1px var(--line);
}
.swatch[aria-pressed="true"] { border-color: var(--surface); box-shadow: 0 0 0 2px var(--ink); }

/* Tarjeta de herramienta */
.tool-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.tool-grid { display: grid; gap: 1.2rem; padding: 1rem; }

.step { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: .6rem; background: var(--surface); }
.step > summary {
  list-style: none; cursor: pointer; padding: .75rem .9rem;
  font-weight: 700; display: flex; align-items: center; gap: .6rem;
}
.step > summary::-webkit-details-marker { display: none; }
.step > summary::after { content: "＋"; margin-left: auto; color: var(--ink-soft); font-weight: 400; }
.step[open] > summary::after { content: "－"; }
.step-n {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: .78rem; font-weight: 700;
}
.step-body { padding: 0 .9rem .9rem; }

.rep-item { border-top: 1px dashed var(--line); padding-top: .7rem; margin-top: .7rem; }
.rep-item:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.rep-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.rep-title { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }

.photo-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-top: .4rem; }
.photo-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.form-utils { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; padding-top: .4rem; }

.tool-status { font-size: .88rem; color: var(--ink-soft); min-height: 1.3em; margin-top: .5rem; }
.tool-status[data-kind="error"] { color: var(--danger); font-weight: 600; }
.tool-status[data-kind="ok"] { color: var(--accent); font-weight: 600; }

.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: .5rem; }
.progress-bar { height: 100%; width: 30%; background: var(--accent); border-radius: 999px; animation: slide 1.1s var(--ease-out) infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }

.privacy-badge { font-size: .88rem; font-weight: 600; margin-top: .8rem; }
.limits { font-size: .82rem; color: var(--ink-soft); margin-top: .3rem; }

/* Publicidad — huecos marcados y VACÍOS. El dueño pega aquí su código.
   Cada hueco reserva su altura para que la página no dé saltos al cargar. */
.ad-slot {
  display: grid; place-items: center; margin: 1.6rem 0;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  background: repeating-linear-gradient(45deg, transparent, transparent 9px, color-mix(in srgb, var(--ink) 4%, transparent) 9px, color-mix(in srgb, var(--ink) 4%, transparent) 18px);
  color: var(--ink-soft); font-size: .72rem; font-weight: 700; letter-spacing: .18em;
}
.ad-slot--leaderboard { min-height: 100px; }        /* banner horizontal */
.ad-slot--rect { min-height: 250px; }               /* rectángulo a mitad de contenido */
.ad-slot--modal { min-height: 250px; width: 100%; margin: 0; }
.ad-slot--toast { min-height: 90px; width: 100%; margin: 0; border-style: dashed; }

/* Pop-up tras la descarga */
.ad-modal {
  border: 0; padding: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink);
  width: min(92vw, 380px); box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.ad-modal::backdrop { background: rgba(10, 20, 18, .55); }
.ad-modal[open] { animation: adPop .22s var(--ease-out) both; }
@keyframes adPop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.ad-modal-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .85rem 1rem .6rem; }
.ad-modal-head p { font-weight: 700; }
.ad-modal-x, .ad-toast-x {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  font-size: 1.25rem; line-height: 1; color: var(--ink-soft); background: var(--surface-2);
}
.ad-modal-x:hover, .ad-toast-x:hover { color: var(--ink); }
.ad-modal .ad-slot { margin: 0 1rem; width: auto; }
.ad-modal-ok { margin: .9rem 1rem 1rem; width: calc(100% - 2rem); }

/* Notificación de esquina */
.ad-toast {
  /* En móvil sube por encima del botón fijo de descarga para no taparlo. */
  position: fixed; right: 14px; bottom: 86px; z-index: 40; width: min(88vw, 320px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .55rem; animation: adSlide .3s var(--ease-out) both;
}
.ad-toast[hidden] { display: none; }
.ad-toast-x { position: absolute; top: -12px; right: -8px; background: var(--surface); border: 1px solid var(--line); }
@keyframes adSlide { from { opacity: 0; transform: translateY(14px); } }

/* ============================ 6. Secciones ================== */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; }
.logo { display: inline-flex; align-items: center; gap: .45rem; font-weight: 800; letter-spacing: -.02em; color: var(--accent); }
.header-nav { display: flex; gap: 1rem; font-size: .9rem; font-weight: 600; color: var(--ink-soft); }
.header-nav a:hover { color: var(--accent); }

.tool-section { padding: 1.1rem 0 .4rem; }
.block { padding: 2.2rem 0; }
.block h2 { margin-bottom: 1rem; }

.steps-3 { list-style: none; padding: 0; display: grid; gap: 1rem; }
.steps-3 li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.steps-3 svg { width: 26px; height: 26px; color: var(--accent); margin-bottom: .5rem; }
.steps-3 h3 { margin-bottom: .25rem; }
.steps-3 p { font-size: .93rem; color: var(--ink-soft); }

/* Guía en tarjetas */
.guia-intro { max-width: 72ch; color: var(--ink-soft); margin-bottom: 1.3rem; }
.guia-grid { display: grid; gap: .9rem; }
.guia-card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.1rem 1rem;
  transition: transform .2s var(--ease-out), border-color .2s var(--ease-out);
}
.guia-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.guia-num {
  display: inline-block; font-family: var(--display); font-size: 1.5rem; font-weight: 700;
  color: color-mix(in srgb, var(--accent) 55%, transparent); line-height: 1; margin-bottom: .35rem;
}
.guia-card h3 { margin-bottom: .5rem; font-size: 1.02rem; }
.guia-card p { font-size: .93rem; color: var(--ink-soft); margin-bottom: .55rem; }
.guia-card p:last-child { margin-bottom: 0; }
.guia-ej {
  border-left: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  padding-left: .7rem; font-style: italic;
}
.guia-ej strong { font-style: normal; color: var(--ink); }

.prose { max-width: 72ch; }
.prose h3 { margin: 1.4rem 0 .35rem; font-size: 1.08rem; }
.prose p { margin-bottom: .8rem; color: var(--ink-soft); }

.faq details {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .75rem .9rem; margin-bottom: .5rem; background: var(--surface);
}
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { margin-top: .5rem; color: var(--ink-soft); font-size: .95rem; }

.tools-grid { list-style: none; padding: 0; display: grid; gap: .7rem; }
.tool-chip {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem .9rem;
  background: var(--surface);
}
.tool-chip span { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 1.2rem 0; margin-top: 1.5rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; justify-content: space-between; font-size: .88rem; color: var(--ink-soft); }
.footer-inner nav { display: flex; gap: 1rem; }
.footer-inner a:hover { color: var(--accent); }

/* ============================ 7. Vista previa (papel) ======= */
.preview-sticky { position: sticky; top: 4.2rem; }
.preview-frame {
  position: relative; width: 100%; aspect-ratio: 210 / 297; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
  box-shadow: var(--shadow);
}
.paper {
  position: absolute; top: 0; left: 0;
  width: 210mm; height: 297mm; transform-origin: top left; transform: scale(var(--s, .38));
  background: #fff; color: #16211f; font-size: 3.2mm; line-height: 1.42;
  padding: 14mm 16mm; overflow: hidden;
}
.paper-empty { color: #8a938f; font-size: 4mm; }

.paper .p-name { font-size: 7.4mm; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.paper .p-role { font-size: 3.9mm; font-weight: 600; color: var(--pc, #0d7c66); margin-top: 1mm; }
.paper .p-contact { font-size: 3mm; color: #55605c; margin-top: 2mm; }
.paper .p-rule { height: .5mm; background: var(--pc, #0d7c66); opacity: .35; margin: 4mm 0 3mm; }
.paper .p-h { font-size: 3.3mm; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--pc, #0d7c66); margin: 4mm 0 1.5mm; }
.paper .p-item { margin-bottom: 2.6mm; }
.paper .p-item-top { display: flex; justify-content: space-between; gap: 4mm; align-items: baseline; }
.paper .p-item-title { font-weight: 700; }
.paper .p-item-dates { font-size: 2.9mm; color: #6b7671; white-space: nowrap; }
.paper .p-item-sub { font-size: 3.05mm; color: #55605c; }
.paper .p-list { margin: 1mm 0 0 4mm; padding: 0; }
.paper .p-list li { margin-bottom: .6mm; }
.paper .p-photo { width: 26mm; height: 26mm; object-fit: cover; border-radius: 1.5mm; }
.paper .p-head { display: flex; gap: 6mm; align-items: flex-start; justify-content: space-between; }
.paper .p-cols { display: grid; grid-template-columns: 1fr; }

/* Plantilla moderna: barra lateral */
.paper[data-tpl="moderno"] { padding: 0; display: grid; grid-template-columns: 62mm 1fr; }
.paper[data-tpl="moderno"] .p-side { background: var(--pc, #0d7c66); color: #fff; padding: 12mm 8mm; }
.paper[data-tpl="moderno"] .p-side .p-h { color: #fff; opacity: .85; }
.paper[data-tpl="moderno"] .p-side .p-contact { color: rgba(255,255,255,.9); }
.paper[data-tpl="moderno"] .p-main { padding: 12mm 12mm 12mm 9mm; }
.paper[data-tpl="moderno"] .p-photo { width: 34mm; height: 34mm; border-radius: 50%; margin-bottom: 5mm; }

/* Plantilla ATS: sin color */
.paper[data-tpl="ats"] .p-role,
.paper[data-tpl="ats"] .p-h { color: #16211f; }
.paper[data-tpl="ats"] .p-rule { background: #16211f; opacity: .25; }

.preview-note { font-size: .78rem; color: var(--ink-soft); margin-top: .4rem; text-align: center; }

/* ============================ 8. Responsive ================= */
@media (min-width: 540px) {
  .row { grid-template-columns: 1fr 1fr; }
  .row--3 { grid-template-columns: 1fr 1fr auto; }
  .steps-3 { grid-template-columns: repeat(3, 1fr); }
  .tools-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .guia-grid { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
}
@media (min-width: 960px) {
  .tool-grid { grid-template-columns: 1.05fr .95fr; padding: 1.2rem; gap: 1.6rem; }
  .tool-section { padding: 1.6rem 0 .6rem; }
  body { padding-bottom: 0; }
  [data-download] { position: static; width: 100%; margin-top: .9rem; box-shadow: none; }
  .ad-toast { bottom: 14px; }
}

/* ============================ 9. Reduced-motion ============= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .progress-bar { animation: none; width: 100%; }
  .ad-modal[open], .ad-toast { animation: none; }
  .guia-card:hover { transform: none; }
}
