/* =============================================================
   Pixora — Suite de imágenes. styles.css
   1. Tokens  2. Reset  3. Utilidades  4. Tipografía
   5. Componentes  6. Herramienta  7. Secciones  8. Anuncios
   9. Responsive  10. Reduced-motion
   ============================================================= */

/* ============================================================= 1. Tokens */
:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f1f2f7;
  --border: #e2e3ee;
  --border-strong: #cdd0e0;
  --text: #1b1c28;
  --text-soft: #565872;
  --text-mute: #8a8ca3;
  --accent: #5b5bef;
  --accent-hover: #4a4ad8;
  --accent-soft: #ecebff;
  --ok: #17936b;
  --ok-soft: #e2f5ee;
  --warn: #b25e00;
  --warn-soft: #fbeede;
  --err: #cc3355;
  --err-soft: #fce8ed;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 45, .06), 0 1px 3px rgba(20, 20, 45, .04);
  --shadow-md: 0 6px 24px rgba(20, 20, 45, .09);
  --shadow-lg: 0 18px 50px rgba(20, 20, 45, .16);
  --maxw: 1080px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101018;
    --surface: #191a24;
    --surface-2: #21222f;
    --border: #2c2d3c;
    --border-strong: #3b3c50;
    --text: #f0f0f6;
    --text-soft: #b6b8ca;
    --text-mute: #85879c;
    --accent: #8f8fff;
    --accent-hover: #a3a3ff;
    --accent-soft: #24243a;
    --ok: #4bd4a4;
    --ok-soft: #16352c;
    --warn: #f0b166;
    --warn-soft: #382c1a;
    --err: #ff7a9c;
    --err-soft: #3a2029;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, .4);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);
  }
}

/* ============================================================= 2. Reset */
*, *::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;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { 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.15; letter-spacing: -.02em; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ============================================================= 3. Utilidades */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--surface); color: var(--text);
  border-radius: 8px; box-shadow: var(--shadow-md); font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.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;
}
[hidden] { display: none !important; }

/* ============================================================= 4. Tipografía */
.eyebrow {
  font-size: .8rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent);
}
.lead { font-size: clamp(1rem, 2.5vw, 1.15rem); color: var(--text-soft); }

/* ============================================================= 5. Componentes */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.3rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .95rem;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
  transition: background .18s var(--ease-out), transform .18s var(--ease-out), border-color .18s var(--ease-out);
}
.btn:hover { background: var(--border); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--primary:disabled { opacity: .5; cursor: not-allowed; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--accent); padding-inline: .5rem; }
.btn--ghost:hover { background: var(--accent-soft); }
.btn--sm { padding: .5rem .8rem; font-size: .85rem; }
.btn--block { width: 100%; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .55rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600;
  background: var(--surface-2); color: var(--text-soft);
  border: 1px solid var(--border);
}
.chip--ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip--save { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.field { display: flex; flex-direction: column; gap: .35rem; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--text-soft); }
select, input[type="number"], input[type="text"] {
  padding: .6rem .7rem; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--text); width: 100%;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
.toggle {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .7rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: .85rem; font-weight: 600; color: var(--text-soft);
  user-select: none;
}
.toggle input { accent-color: var(--accent); }
.toggle--on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ============================================================= 6. Herramienta */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 58px; }
.logo { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; letter-spacing: -.03em; font-size: 1.15rem; }
.logo svg { width: 26px; height: 26px; }
.nav { display: flex; align-items: center; gap: .3rem; }
.nav-menu { position: relative; }
.nav-panel {
  position: absolute; right: 0; top: calc(100% + .5rem); width: 260px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .5rem;
}
.nav-panel a { display: flex; flex-direction: column; gap: .1rem; padding: .55rem .6rem; border-radius: var(--radius-sm); }
.nav-panel a:hover { background: var(--surface-2); }
.nav-panel strong { font-size: .9rem; }
.nav-panel span { font-size: .78rem; color: var(--text-mute); }
.nav-panel .soon { opacity: .6; pointer-events: none; }

.hero { padding: clamp(1.5rem, 5vw, 2.75rem) 0 .5rem; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 5.5vw, 2.9rem); margin: .5rem auto .5rem; max-width: 20ch; }
.hero .lead { max-width: 46ch; margin-inline: auto; }
.hero-formats { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin-top: .9rem; }

.tool {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: clamp(1rem, 3vw, 1.5rem); margin-top: 1.1rem;
}

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  text-align: center; padding: clamp(1.6rem, 6vw, 2.8rem) 1rem;
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer;
  transition: border-color .18s var(--ease-out), background .18s var(--ease-out);
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); }
.dropzone.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 34px; height: 34px; color: var(--accent); }
.dropzone strong { font-size: 1.05rem; }
.dropzone small { color: var(--text-mute); }
.dropzone .btn { margin-top: .3rem; }

.controls {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .8rem; margin-top: 1rem;
}
.controls .field--wide { grid-column: 1 / -1; }
.hint { font-size: .78rem; color: var(--text-mute); }

.advanced { margin-top: .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.advanced > summary {
  list-style: none; cursor: pointer; padding: .7rem .9rem;
  font-weight: 600; font-size: .9rem; color: var(--text-soft);
  display: flex; align-items: center; gap: .5rem; background: var(--surface-2);
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before { content: "＋"; color: var(--accent); font-weight: 700; }
.advanced[open] > summary::before { content: "－"; }
.advanced-body { padding: .9rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; }
.advanced-body .row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.rotor { display: flex; gap: .4rem; align-items: center; }
.rotor output { font-weight: 700; min-width: 3ch; text-align: center; }

.filelist { list-style: none; margin-top: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.file {
  display: grid; grid-template-columns: 64px 1fr auto; gap: .8rem; align-items: center;
  padding: .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface);
}
.file-thumb {
  width: 64px; height: 64px; border-radius: 8px; object-fit: cover;
  background: var(--surface-2); display: grid; place-items: center;
  font-size: .7rem; font-weight: 700; color: var(--text-mute); overflow: hidden;
}
.file-main { min-width: 0; }
.file-name { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { display: flex; flex-wrap: wrap; gap: .35rem .5rem; margin-top: .3rem; font-size: .78rem; color: var(--text-soft); }
.file-meta b { color: var(--text); font-weight: 600; }
.file-arrow { color: var(--text-mute); }
.file-actions { display: flex; align-items: center; gap: .3rem; }
.file-remove {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  color: var(--text-mute); border: 1px solid var(--border);
}
.file-remove:hover { color: var(--err); border-color: var(--err); }
.file[data-fstatus="working"] { border-color: var(--accent); }
.file[data-fstatus="error"] { border-color: var(--err); background: var(--err-soft); }
.file[data-fstatus="done"] { border-color: var(--ok); }
.file-error { grid-column: 1 / -1; font-size: .8rem; color: var(--err); }
.mini-progress { grid-column: 1 / -1; height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.mini-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }

.actionbar { margin-top: 1.1rem; display: flex; flex-direction: column; gap: .7rem; }
.actionbar .row { display: flex; gap: .6rem; flex-wrap: wrap; }
.actionbar .btn { flex: 1 1 auto; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s var(--ease-out); }
.status-line { font-size: .85rem; color: var(--text-soft); text-align: center; min-height: 1.2em; }
.status-line.is-ok { color: var(--ok); font-weight: 600; }

.savings {
  margin-top: .8rem; padding: .8rem 1rem; border-radius: var(--radius-sm);
  background: var(--ok-soft); color: var(--ok); font-weight: 600; text-align: center;
}

.compare {
  margin-top: 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: .8rem;
}
.compare figure { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.compare figcaption { font-size: .78rem; padding: .45rem .6rem; display: flex; justify-content: space-between; }
.compare img { width: 100%; height: 180px; object-fit: contain; background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 18px 18px; }

.privacy-badge {
  margin-top: 1rem; display: flex; align-items: flex-start; gap: .6rem;
  padding: .8rem 1rem; border-radius: var(--radius-sm);
  background: var(--accent-soft); font-size: .86rem; color: var(--text-soft);
}
.privacy-badge svg { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.limits { margin-top: .5rem; font-size: .8rem; color: var(--text-mute); text-align: center; }

.nojs {
  margin-top: 1rem; padding: 1rem; border: 1px solid var(--warn);
  background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm);
  font-size: .9rem; text-align: center;
}

/* ============================================================= 7. Secciones */
.section { padding: clamp(2.5rem, 7vw, 4rem) 0; }
.section h2 { font-size: clamp(1.4rem, 4vw, 2rem); margin-bottom: .4rem; }
.section > .wrap > .lead { margin-bottom: 1.6rem; max-width: 52ch; }
.section--alt { background: var(--surface); border-block: 1px solid var(--border); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.step { padding: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.step .n { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 800; margin-bottom: .7rem; }
.step h3 { font-size: 1.05rem; margin-bottom: .25rem; }
.step p { font-size: .9rem; color: var(--text-soft); }

.prose { max-width: 62ch; }
.prose h3 { font-size: 1.15rem; margin: 1.6rem 0 .4rem; }
.prose p { margin-bottom: .9rem; color: var(--text-soft); }
.prose ul { margin: 0 0 .9rem 1.1rem; color: var(--text-soft); }
.prose li { margin-bottom: .3rem; }

.usecases { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; }
.usecase { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.usecase h3 { font-size: .98rem; margin-bottom: .2rem; }
.usecase p { font-size: .86rem; color: var(--text-soft); }

.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: .55rem; }
.faq summary {
  cursor: pointer; list-style: none; padding: .9rem 1rem; font-weight: 600; font-size: .95rem;
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "⌄"; color: var(--accent); font-size: 1.2rem; transition: transform .2s var(--ease-out); }
.faq details[open] summary::after { transform: rotate(180deg); }
.faq details > div { padding: 0 1rem 1rem; color: var(--text-soft); font-size: .92rem; }

.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; }
.tool-link {
  display: flex; flex-direction: column; gap: .3rem; padding: 1.1rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  transition: border-color .18s var(--ease-out), transform .18s var(--ease-out);
}
.tool-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-link strong { font-size: 1rem; }
.tool-link span { font-size: .85rem; color: var(--text-soft); }
.tool-link[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.tool-link .tag { align-self: flex-start; margin-top: .3rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 2rem 0; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; font-size: .85rem; color: var(--text-mute); }
.site-footer a:hover { color: var(--text); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1rem; }

/* ============================================================= 8. Anuncios */
.ad-slot {
  display: grid; place-items: center; text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text-mute); font-size: .72rem; font-weight: 700; letter-spacing: .18em;
  background: var(--surface-2);
}
.ad-slot span { display: block; }
.ad-slot small { display: block; font-weight: 500; letter-spacing: normal; text-transform: none; opacity: .7; margin-top: .2rem; }
.ad-leaderboard { min-height: 100px; margin: 1.4rem 0; }
.ad-incontent { min-height: 250px; margin: 1.5rem 0; }
.ad-footer { min-height: 90px; margin-top: 1.5rem; }

.ad-popup {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0; max-width: 380px; width: calc(100vw - 2rem);
  box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text);
}
.ad-popup::backdrop { background: rgba(15, 15, 30, .55); }
.ad-popup-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem .9rem; border-bottom: 1px solid var(--border); }
.ad-popup-head strong { font-size: .8rem; letter-spacing: .12em; color: var(--text-mute); }
.ad-popup-close { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 1.1rem; color: var(--text-soft); border: 1px solid var(--border); }
.ad-popup-close:hover { background: var(--surface-2); }
.ad-popup .ad-slot { min-height: 200px; border: 0; border-radius: 0; }
.ad-popup-foot { padding: .8rem .9rem; }

.ad-toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 50;
  width: 240px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
}
.ad-toast-head { display: flex; justify-content: space-between; align-items: center; padding: .45rem .6rem; border-bottom: 1px solid var(--border); }
.ad-toast-head strong { font-size: .7rem; letter-spacing: .14em; color: var(--text-mute); }
.ad-toast-close { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: var(--text-soft); }
.ad-toast .ad-slot { min-height: 120px; border: 0; border-radius: 0; }

/* ============================================================= 9. Responsive */
@media (max-width: 540px) {
  .ad-toast { left: 1rem; right: 1rem; width: auto; bottom: .6rem; }
  .ad-toast .ad-slot { min-height: 68px; }
  .hero { padding-top: 1.1rem; }
  .hero-formats { margin-top: .6rem; }
}
@media (max-width: 760px) {
  .compare { grid-template-columns: 1fr; }
  .file { grid-template-columns: 52px 1fr; }
  .file-thumb { width: 52px; height: 52px; }
  .file-actions { grid-column: 2 / -1; justify-content: flex-start; margin-top: .2rem; }
  .actionbar .btn { flex-basis: 100%; }
}
@media (min-width: 761px) {
  .hero h1 { margin-top: .8rem; }
}

/* ============================================================= 10. Reduced-motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
