/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --ink: #14151a;
  --muted: #666b78;
  --border: #e6e7eb;
  --accent: #3d5afe;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --ok: #1f9d55;
  --warn: #b5790a;
  --danger: #d33a3a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(20, 21, 26, 0.06);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Manrope", var(--sans);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1013;
    --surface: #17181d;
    --ink: #eef0f5;
    --muted: #9aa0ae;
    --border: #262832;
    --accent: #7d94ff;
    --accent-ink: #0f1013;
    --accent-soft: #1c2140;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  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, h4 { font-family: var(--display); text-wrap: balance; line-height: 1.12; letter-spacing: -0.02em; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--ink); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-s { gap: .5rem; } .gap-m { gap: 1rem; } .gap-l { gap: 2rem; }

/* =============================================================
   4. Typography
   ============================================================= */
.eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.lead { color: var(--muted); font-size: 1.1rem; max-width: 60ch; }
.muted { color: var(--muted); }

/* =============================================================
   5. Components
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.5rem; border-radius: 999px; font-weight: 700; font-size: .95rem;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out), opacity .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px rgba(61,90,254,.3); }
.btn-primary:hover { box-shadow: 0 10px 26px rgba(61,90,254,.4); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-block { width: 100%; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.75rem; box-shadow: var(--shadow);
}

.badge {
  display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 700;
  padding: .3rem .7rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}
.badge-demo {
  background: #fff3d6; color: #8a5a00; border: 1px solid #f0d28f;
}
@media (prefers-color-scheme: dark) { .badge-demo { background: #3a2c05; color: #f0c65f; border-color: #55420c; } }

.input, .textarea {
  width: 100%; padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg); color: var(--ink); font: inherit;
}
.input:focus, .textarea:focus { border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--muted); }

.toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.toast {
  background: var(--ink); color: var(--bg); padding: .8rem 1.2rem; border-radius: 999px; font-size: .9rem;
  box-shadow: var(--shadow); animation: toast-in .25s var(--ease-out);
}
.toast.error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,10,14,.55); display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 1000;
}
.modal { background: var(--surface); border-radius: var(--radius); max-width: 460px; width: 100%; padding: 1.75rem; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal-close { position: absolute; top: 1rem; right: 1rem; }
.modal { position: relative; }

/* =============================================================
   6. Sections — shared shell
   ============================================================= */
.topbar {
  position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; padding-block: .9rem; }
.logo { font-family: var(--display); font-weight: 800; font-size: 1.2rem; display: flex; align-items: center; gap: .5rem; }
.logo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { font-weight: 600; font-size: .92rem; color: var(--muted); }
.nav-links a:hover { color: var(--ink); }

.credits-pill {
  display: inline-flex; align-items: center; gap: .4rem; background: var(--accent-soft); color: var(--accent);
  font-weight: 700; padding: .5rem 1rem; border-radius: 999px; font-size: .9rem;
}

.footer { border-top: 1px solid var(--border); padding-block: 2.5rem; margin-top: 4rem; color: var(--muted); font-size: .9rem; }
.footer .container { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--ink); }

/* Landing hero */
.hero { padding-block: 4rem 3rem; }
.hero-grid { display: grid; gap: 2.5rem; align-items: center; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); margin-block: .8rem 1rem; }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.6rem; }
.hero-visual {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow);
}
.before-after { position: relative; display: grid; grid-template-columns: 1fr 1fr; }
.before-after figure { margin: 0; position: relative; }
.before-after figcaption {
  position: absolute; bottom: .6rem; left: .6rem; background: rgba(0,0,0,.55); color: #fff;
  font-size: .72rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em;
}
.before-after img { aspect-ratio: 3/4; object-fit: cover; width: 100%; }

.trust-row { display: flex; flex-wrap: wrap; gap: .6rem 1.6rem; margin-top: 2rem; color: var(--muted); font-size: .85rem; }

/* Style gallery (landing sample) */
.section { padding-block: 3.5rem; }
.section-head { max-width: 640px; margin-bottom: 2.2rem; }
.style-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 720px) { .style-grid { grid-template-columns: repeat(4, 1fr); } }
.style-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; text-align: center; background: var(--surface); }
.style-card .swatch { width: 100%; aspect-ratio: 1; border-radius: var(--radius-sm); margin-bottom: .7rem; background: linear-gradient(135deg, var(--accent-soft), var(--border)); display: grid; place-items: center; color: var(--accent); font-size: 1.6rem; }
.style-card h4 { font-size: .95rem; margin-bottom: .2rem; }
.style-card p { font-size: .8rem; color: var(--muted); }

/* Pricing */
.pricing-grid { display: grid; gap: 1.2rem; }
@media (min-width: 860px) { .pricing-grid { grid-template-columns: repeat(3, 1fr); } }
.plan-card { display: flex; flex-direction: column; gap: 1rem; position: relative; }
.plan-card.featured { border-color: var(--accent); box-shadow: 0 10px 34px rgba(61,90,254,.18); }
.plan-tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 800;
  padding: .3rem .8rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em;
}
.plan-price { font-family: var(--display); font-size: 2.4rem; font-weight: 800; }
.plan-price span { font-size: 1rem; font-weight: 600; color: var(--muted); }
.plan-features { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .55rem; font-size: .92rem; color: var(--muted); }
.plan-features li::before { content: "✓ "; color: var(--ok); font-weight: 800; }
.demo-banner {
  display: flex; align-items: center; justify-content: center; gap: .5rem; text-align: center;
  background: var(--accent-soft); color: var(--accent); border-radius: var(--radius-sm); padding: .7rem 1rem;
  font-size: .85rem; font-weight: 600; margin-bottom: 1.5rem;
}

/* FAQ */
.faq { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: .7rem; overflow: hidden; background: var(--surface); }
.faq summary { padding: 1rem 1.2rem; font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; color: var(--muted); }
.faq[open] summary::after { content: "–"; }
.faq p { padding: 0 1.2rem 1.1rem; color: var(--muted); }

/* =============================================================
   7. App shell (app.html / cuenta.html) — calmado, sin florituras
   ============================================================= */
.app-body { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1; padding-block: 2rem 3rem; }
.tool-grid { display: grid; gap: 1.5rem; }
@media (min-width: 960px) { .tool-grid { grid-template-columns: 320px 1fr; align-items: start; } }

.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center;
  cursor: pointer; transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone img { max-height: 220px; margin-inline: auto; border-radius: var(--radius-sm); }
.dropzone .hint { color: var(--muted); font-size: .85rem; margin-top: .6rem; }

.estilo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin-block: 1rem; }
@media (min-width: 480px) and (max-width: 959px) { .estilo-grid { grid-template-columns: repeat(4, 1fr); } }
.estilo-opt {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: .7rem; text-align: center;
  font-size: .82rem; font-weight: 600; transition: border-color .15s, background .15s;
}
.estilo-opt.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.estilo-opt small { display: block; font-weight: 500; color: var(--muted); margin-top: .2rem; }

.cost-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 1rem; }

.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.result-card { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.result-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; }
.result-card .meta { padding: .7rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.result-card .meta span { font-size: .8rem; font-weight: 700; }
.result-card .fail { padding: .9rem; color: var(--danger); font-size: .85rem; }

.state-idle, .state-working, .state-error { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 1s linear infinite; margin: 0 auto 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }

.history-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.history-table th, .history-table td { text-align: left; padding: .6rem .4rem; border-bottom: 1px solid var(--border); }
.history-table th { color: var(--muted); font-weight: 600; }

/* =============================================================
   8. Responsive helpers
   ============================================================= */
@media (min-width: 720px) { .hero-grid { grid-template-columns: 1.1fr 1fr; } }

/* =============================================================
   9. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
