/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --ink: #17181c;
  --ink-soft: #55575f;
  --line: #e7e4dc;
  --accent: #c05621;
  --accent-ink: #ffffff;
  --accent-soft: #f4e3d3;
  --cream: #f4f1ea;
  --radius: 14px;
  --radius-sm: 8px;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Sora", var(--sans);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 3px rgba(20, 18, 10, 0.08);
  --shadow-md: 0 10px 30px rgba(20, 18, 10, 0.10);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15141a;
    --surface: #1d1c23;
    --ink: #f3f1ec;
    --ink-soft: #b6b3ad;
    --line: #322f37;
    --accent: #e08a4f;
    --accent-ink: #1a1408;
    --accent-soft: #3a2a1c;
    --cream: #232028;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
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, canvas { display: block; max-width: 100%; }
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.15; letter-spacing: -0.01em; font-weight: 700; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
label { font-weight: 600; font-size: 0.92rem; display: block; margin-bottom: 0.35rem; }
input, select { font: inherit; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container--prose { max-width: 760px; }
.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--accent); color: var(--accent-ink);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.85rem 1.4rem; border-radius: 999px; font-weight: 700;
  font-size: 0.98rem; transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.btn-text { font-weight: 600; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }
.field-hint { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.4rem; }

/* =============================================================
   4. Header / Footer
   ============================================================= */
.site-header { padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 0.5rem; font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.header-nav { display: flex; gap: 1.6rem; font-weight: 600; font-size: 0.94rem; }
.header-nav a { color: var(--ink-soft); }
.header-nav a:hover { color: var(--ink); }
@media (max-width: 720px) { .header-nav { display: none; } }

.site-footer { border-top: 1px solid var(--line); padding: 2rem 0; margin-top: 2rem; color: var(--ink-soft); }
.footer-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; font-size: 0.9rem; }
.footer-row nav { display: flex; gap: 1.2rem; }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding: 3rem 0 1.6rem; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); max-width: 820px; margin: 0 auto; }
.hero-sub { max-width: 620px; margin: 1rem auto 0; color: var(--ink-soft); font-size: 1.08rem; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-section { padding-bottom: 1.5rem; }
.tool-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: clamp(1.2rem, 3vw, 2.2rem); box-shadow: var(--shadow-md);
}
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 960px) { .tool-grid { grid-template-columns: 1fr 1fr; gap: 2.6rem; } }

.field-group { margin-bottom: 1.3rem; }
.field-group.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-group input[type="text"],
.field-group select {
  width: 100%; padding: 0.75rem 0.9rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink);
}
.field-group input[type="color"] {
  width: 100%; height: 44px; padding: 3px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); cursor: pointer;
}
.field-group input[type="range"] { width: 100%; accent-color: var(--accent); }

.segmented { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; padding: 3px; }
.segmented-btn { padding: 0.5rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: 0.9rem; color: var(--ink-soft); }
.segmented-btn.is-active { background: var(--accent); color: var(--accent-ink); }

.style-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.style-grid.three-col { grid-template-columns: 1fr; }
@media (min-width: 540px) { .style-grid.three-col { grid-template-columns: repeat(3, 1fr); } }
.style-opt {
  padding: 0.65rem 0.8rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.88rem; text-align: center; background: var(--bg);
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.style-opt.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

.emoji-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.emoji-btn {
  width: 42px; height: 42px; font-size: 1.3rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); display: flex; align-items: center; justify-content: center;
}
.emoji-btn.is-active { border-color: var(--accent); background: var(--accent-soft); }
#customEmoji { width: 58px; text-align: center; padding: 0.6rem 0.3rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.upload-btn {
  display: inline-flex; align-items: center; padding: 0.6rem 0.9rem; border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm); font-weight: 600; font-size: 0.85rem; cursor: pointer; color: var(--ink-soft);
}
.upload-btn:hover { border-color: var(--accent); color: var(--ink); }

.tool-col-preview { display: flex; flex-direction: column; }
.preview-box {
  position: relative; background: var(--cream); border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
}
.preview-box canvas { width: 100%; height: 100%; }
.preview-box--3d canvas { cursor: grab; touch-action: none; }
.preview-box--3d canvas:active { cursor: grabbing; }
.preview-label {
  position: absolute; bottom: 0.6rem; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.55); color: #fff; font-size: 0.78rem; padding: 0.3rem 0.7rem; border-radius: 999px;
  pointer-events: none;
}
.download-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1rem; }
.privacy-badge { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.9rem; }

/* Estado sin JavaScript: el bloque <noscript> del HTML fuerza su visibilidad */
.no-js-message { display: none; padding: 1.5rem; text-align: center; color: var(--ink-soft); }

/* Sección 3D dentro de la misma tarjeta */
.section-3d { margin-top: 2.4rem; padding-top: 2.2rem; border-top: 1px dashed var(--line); }
.section-3d-title { font-size: 1.5rem; }
.section-3d-sub { color: var(--ink-soft); margin: 0.5rem 0 1.6rem; max-width: 640px; }

.quality-panel { background: var(--cream); border-radius: var(--radius-sm); padding: 0.9rem 1rem; font-size: 0.88rem; }
.quality-row { padding: 0.25rem 0; display: flex; justify-content: space-between; gap: 1rem; }
.quality-row.is-warn { color: #b3441c; font-weight: 700; }
.quality-row.is-ok { color: #1c7a44; }

/* =============================================================
   7. Ad slots (placeholders)
   ============================================================= */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--line); border-radius: var(--radius-sm);
  color: var(--ink-soft); font-weight: 700; letter-spacing: 0.08em; font-size: 0.8rem;
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.02) 10px, rgba(0,0,0,0.02) 20px);
}
/* PEGA AQUÍ TU CÓDIGO DE ADSENSE (o el de tu red publicitaria) en cada .ad-slot */
.ad-slot--inline { margin-top: 1.6rem; min-height: 100px; }
.ad-slot--banner { max-width: 1180px; margin: 2rem auto; min-height: 120px; }
.ad-slot--popup { min-height: 220px; margin-bottom: 1rem; }

.download-dialog {
  border: none; border-radius: var(--radius); padding: 1.4rem; max-width: 380px; width: calc(100% - 2rem);
  box-shadow: var(--shadow-md); background: var(--surface); color: var(--ink);
}
.download-dialog::backdrop { background: rgba(10,8,4,0.5); }
.dialog-close { position: absolute; top: 0.7rem; right: 0.9rem; font-size: 1.1rem; color: var(--ink-soft); }
.dialog-text { text-align: center; margin-bottom: 1rem; font-weight: 600; }
.download-dialog .btn { width: 100%; }

.corner-toast {
  position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 500;
  background: var(--surface); border: 1.5px dashed var(--line); border-radius: var(--radius-sm);
  padding: 0.9rem 2.2rem 0.9rem 1.1rem; box-shadow: var(--shadow-md); font-weight: 700; font-size: 0.8rem;
  color: var(--ink-soft); letter-spacing: 0.08em; min-width: 160px; text-align: center;
}
.corner-toast-close { position: absolute; top: 0.3rem; right: 0.5rem; font-size: 0.9rem; color: var(--ink-soft); }

/* =============================================================
   8. Content sections
   ============================================================= */
.content-section { padding: 3.2rem 0; }
.content-section--alt { background: var(--cream); }
.content-section h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 1.8rem; text-align: center; }
#seo-text h2 { text-align: left; }
#seo-text p { color: var(--ink-soft); margin-bottom: 1rem; }
#seo-text p:last-child { margin-bottom: 0; }

.steps-grid, .usos-grid { display: grid; grid-template-columns: 1fr; gap: 1.4rem; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } .usos-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card, .uso-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; position: relative;
}
.step-card .step-num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: 0.9rem;
}
.step-card h3, .uso-card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.step-card p, .uso-card p { color: var(--ink-soft); font-size: 0.94rem; }
.uso-card .uso-icon { font-size: 1.6rem; margin-bottom: 0.7rem; display: block; }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--line); padding: 1rem 0; }
.faq-item summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--accent); flex-shrink: 0; }
.faq-item[open] summary::after { content: "–"; }
.faq-item p { color: var(--ink-soft); margin-top: 0.7rem; }

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