/* =========================================================================
   Pasafoto — estilos únicos del sitio
   1. Tokens · 2. Base · 3. Cabecera · 4. Layout · 5. Herramienta
   6. Resultados · 7. Contenido SEO · 8. Anuncios · 9. Tarjetas
   10. Pie · 11. Cookies · 12. Utilidades
   ========================================================================= */

/* 1. Tokens ------------------------------------------------------------- */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --text: #121722;
  --muted: #566074;
  --border: #e1e6ee;
  --border-strong: #c9d1de;
  --accent: #2350d4;
  --accent-hover: #1c41ad;
  --accent-ink: #ffffff;
  --accent-soft: #e9effd;
  --ok: #157f3d;
  --ok-soft: #e5f5eb;
  --err: #b42318;
  --err-soft: #fdecea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 14px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1017; --surface: #151a23; --surface-2: #1b212c; --text: #e8ecf3;
    --muted: #9aa4b6; --border: #252c39; --border-strong: #36404f;
    --accent: #7096ff; --accent-hover: #8daaff; --accent-ink: #0b1020; --accent-soft: #1a2442;
    --ok: #4ade80; --ok-soft: #10261a; --err: #ff8a80; --err-soft: #2c1414;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1017; --surface: #151a23; --surface-2: #1b212c; --text: #e8ecf3;
  --muted: #9aa4b6; --border: #252c39; --border-strong: #36404f;
  --accent: #7096ff; --accent-hover: #8daaff; --accent-ink: #0b1020; --accent-soft: #1a2442;
  --ok: #4ade80; --ok-soft: #10261a; --err: #ff8a80; --err-soft: #2c1414;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

/* 2. Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased;
}
img, svg, canvas { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 3. Cabecera ----------------------------------------------------------- */
.site-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.site-header .container { display: flex; align-items: center; gap: 12px; min-height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 750; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.brand svg { width: 30px; height: 30px; }
.brand:hover { color: var(--text); }
.header-nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.header-nav a { color: var(--muted); text-decoration: none; font-weight: 550; font-size: .95rem; padding: 8px 10px; border-radius: 8px; }
.header-nav a:hover { color: var(--text); background: var(--surface-2); }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: block; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-dark { display: block; }
  :root:not([data-theme="light"]) .theme-icon-light { display: none; }
}
@media (max-width: 560px) { .header-nav .hide-sm { display: none; } }

/* 4. Layout ------------------------------------------------------------- */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 20px 0 48px; }
@media (min-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; padding-top: 28px; }
}
.sidebar { display: none; }
@media (min-width: 1100px) { .sidebar { display: block; } .sidebar .ad-slot { position: sticky; top: 82px; } }
.breadcrumbs { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; }
.page-head h1 { font-size: clamp(1.55rem, 1.1rem + 2vw, 2.25rem); font-weight: 780; }
.page-head .lead { color: var(--muted); font-size: 1.05rem; margin-bottom: 16px; max-width: 62ch; }

/* 5. Herramienta -------------------------------------------------------- */
.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
@media (min-width: 700px) { .tool-card { padding: 22px; } }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 8px; min-height: 200px; padding: 26px 16px;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2);
  cursor: pointer; transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { border-color: var(--accent); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.dropzone-icon { width: 48px; height: 48px; color: var(--accent); }
.dropzone-title { font-weight: 700; font-size: 1.08rem; margin: 0; }
.dropzone-sub { color: var(--muted); font-size: .9rem; margin: 0; }
.dropzone .btn { pointer-events: none; margin-top: 6px; }
.tool-card.is-compact .dropzone { min-height: 96px; padding: 14px; flex-direction: row; gap: 12px; }
.tool-card.is-compact .dropzone-icon { width: 30px; height: 30px; }
.tool-card.is-compact .dropzone-sub, .tool-card.is-compact .dropzone .btn { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 650;
  text-decoration: none; cursor: pointer; transition: background-color .15s, transform .05s;
}
.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn svg { width: 18px; height: 18px; }

.tool-options { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-top: 16px; align-items: flex-end; }
.tool-options fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.opt { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; min-width: 0; }
.opt > span, .opt legend { font-weight: 600; color: var(--muted); font-size: .85rem; padding: 0; }
.opt select, .opt input[type="number"], .opt input[type="text"] {
  min-height: 40px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit;
}
.opt input[type="number"] { width: 110px; }
.opt-range { display: flex; align-items: center; gap: 10px; }
.opt-range input { width: 170px; accent-color: var(--accent); }
.opt-range output { font-variant-numeric: tabular-nums; min-width: 3.2em; font-weight: 650; }
.opt-check { flex-direction: row; align-items: center; gap: 8px; min-height: 40px; }
.opt-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); }
.seg label + label span { border-left: 1px solid var(--border-strong); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: -3px; }
.swatches-opt { display: flex; align-items: center; gap: 8px; }
.swatches-opt label { position: relative; }
.swatches-opt input[type="radio"] { position: absolute; opacity: 0; }
.swatch-dot { display: block; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border-strong); cursor: pointer; }
.swatches-opt input:checked + .swatch-dot { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatches-opt input:focus-visible + .swatch-dot { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatches-opt input[type="color"] { width: 34px; height: 34px; padding: 0; border: 0; background: none; cursor: pointer; }
.checker { background-color: #fff; background-image: linear-gradient(45deg,#ccd 25%,transparent 25%,transparent 75%,#ccd 75%), linear-gradient(45deg,#ccd 25%,transparent 25%,transparent 75%,#ccd 75%); background-size: 12px 12px; background-position: 0 0, 6px 6px; }
.opt-note { font-size: .8rem; color: var(--muted); margin: 0; }
.rerun { margin-top: 14px; }

.privacy-note {
  display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0; padding: 11px 14px;
  border-radius: var(--radius-sm); background: var(--ok-soft); color: var(--text); font-size: .92rem;
}
.privacy-note svg { width: 20px; height: 20px; flex: none; color: var(--ok); margin-top: 2px; }
.privacy-note strong { color: var(--ok); }
.limits { font-size: .82rem; color: var(--muted); margin: 8px 2px 0; }
.notice { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--err-soft); color: var(--err); font-size: .92rem; margin-top: 12px; }

/* 6. Resultados --------------------------------------------------------- */
.results { margin-top: 16px; }
.progress-wrap { margin-bottom: 12px; }
.progress-label { display: flex; justify-content: space-between; font-size: .88rem; color: var(--muted); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .25s; }
.bar.is-indeterminate > span { width: 35%; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .bar.is-indeterminate > span { animation: none; width: 100%; opacity: .5; } }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file-row {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.file-thumb { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb a { display: block; width: 100%; height: 100%; }
.file-name { margin: 0; font-weight: 600; font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { margin: 2px 0 0; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.file-meta b { color: var(--text); }
.file-row .bar { margin-top: 6px; height: 5px; }
.file-row[data-status="done"] .bar, .file-row[data-status="error"] .bar { display: none; }
.file-row[data-status="error"] .file-meta { color: var(--err); }
.file-actions { display: flex; gap: 6px; align-items: center; }
.file-row:not([data-status="done"]) .dl { display: none; }
.saving { display: inline-block; padding: 1px 7px; border-radius: 99px; background: var(--ok-soft); color: var(--ok); font-weight: 700; font-size: .78rem; }
.results-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: center; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: .9rem; padding: 6px; }
.link-btn:hover { color: var(--text); }
@media (max-width: 480px) {
  .file-row { grid-template-columns: 52px minmax(0, 1fr); }
  .file-thumb { width: 52px; height: 52px; }
  .file-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .file-row:not([data-status="done"]) .file-actions { display: none; }
}

/* PDF: orden de páginas */
.pdf-list .file-row { grid-template-columns: 34px 64px minmax(0, 1fr) auto; }
.pdf-num { font-weight: 750; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .pdf-list .file-row { grid-template-columns: 26px 52px minmax(0, 1fr); } }

/* Paleta */
.palette-view { display: grid; gap: 18px; margin-top: 16px; }
@media (min-width: 760px) { .palette-view { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.palette-canvas-wrap { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.palette-canvas-wrap canvas { width: 100%; height: auto; cursor: crosshair; }
.palette-hint { font-size: .82rem; color: var(--muted); margin: 6px 0 0; }
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.swatch {
  display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--surface); cursor: pointer; text-align: left; padding: 0; font: inherit; color: var(--text);
}
.swatch-color { height: 72px; display: flex; align-items: flex-end; justify-content: flex-end; padding: 6px; font-size: .72rem; font-weight: 700; }
.swatch-info { padding: 7px 9px; }
.swatch-hex { font-family: var(--mono); font-weight: 700; font-size: .9rem; }
.swatch-rgb { font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.swatch:hover { border-color: var(--accent); }
.picked { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-family: var(--mono); font-size: .9rem; }
.picked i { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border-strong); display: inline-block; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: .92rem;
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 60;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 7. Contenido SEO ------------------------------------------------------ */
.prose { max-width: 72ch; }
.prose h2 { font-size: 1.45rem; margin-top: 1.6em; }
.prose h3 { font-size: 1.12rem; margin-top: 1.3em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1.2em; font-size: .93rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.table-scroll { overflow-x: auto; }
.steps { list-style: none; padding: 0; margin: 28px 0 8px; display: grid; gap: 12px; counter-reset: step; }
@media (min-width: 700px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; margin-bottom: 6px; }
.steps strong { display: block; }
.steps span { color: var(--muted); font-size: .92rem; }
.faq { margin-top: 2em; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 8px; }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 700; color: var(--accent); font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding: 0 16px 14px; color: var(--muted); }
.faq details > div p:last-child { margin: 0; }

/* 8. Anuncios ----------------------------------------------------------- */
.ad-slot {
  display: grid; place-items: center; min-height: 100px; margin: 24px 0;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  color: var(--muted); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; background: transparent;
}
.ad-slot--side { min-height: 600px; margin: 0; }
.ad-slot--after { min-height: 120px; margin: 18px 0 0; }
.ad-slot[hidden] { display: none; }

/* 9. Tarjetas de herramientas ------------------------------------------- */
.section-title { font-size: 1.35rem; margin: 2.2em 0 .8em; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tool-link {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.tool-link:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.tool-link .tl-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: .7rem; letter-spacing: .02em; }
.tool-link strong { display: block; font-size: .98rem; }
.tool-link span { display: block; color: var(--muted); font-size: .85rem; line-height: 1.4; margin-top: 2px; }
.cat-block { margin-bottom: 26px; }
.cat-block h3 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 10px; }
.trust-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 20px 0 0; }
.trust-row div { padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .92rem; color: var(--muted); }
.trust-row strong { display: block; color: var(--text); }

/* 10. Pie --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 32px 0 22px; font-size: .9rem; color: var(--muted); }
.footer-grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.site-footer h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text); margin-bottom: 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.footer-bottom { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; font-size: .82rem; }
.footer-bottom .link-btn { padding: 0; font-size: .82rem; }

/* 11. Banner de cookies ------------------------------------------------- */
.cookie-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; max-width: 560px; margin-left: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.18);
  padding: 16px 18px; font-size: .9rem;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0 0 12px; color: var(--muted); }
.cookie-banner strong { color: var(--text); display: block; margin-bottom: 4px; font-size: 1rem; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cookie-actions .btn { flex: 1 1 140px; }

/* 12. Utilidades / páginas legales -------------------------------------- */
.legal { max-width: 75ch; padding: 28px 0 56px; }
.legal h1 { font-size: 2rem; }
.legal h2 { font-size: 1.25rem; margin-top: 1.6em; }
.todo { background: #fff4c2; color: #5a4400; padding: 0 4px; border-radius: 4px; }
.contact-form { display: grid; gap: 12px; max-width: 520px; margin-top: 16px; }
.contact-form label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
.contact-form input, .contact-form textarea, .contact-form select {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit;
}
.hero-home { padding: 8px 0 0; }

/* Huecos de anuncio: se ocultan mientras no contengan un bloque real de
   AdSense (<ins class="adsbygoogle">). Al pegar el bloque, aparecen solos. */
.ad-slot:not(:has(ins)) { display: none; }
@media (min-width: 1100px) {
  .layout:not(:has(.sidebar ins)) { grid-template-columns: minmax(0, 1fr); }
  .layout:not(:has(.sidebar ins)) .sidebar { display: none; }
}
