/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --ink: #16161d;
  --ink-2: #4a4a57;
  --muted: #7b7b88;
  --line: #e6e2d8;
  --line-2: #d6d1c4;
  --accent: #ff5a1f;
  --accent-ink: #ffffff;
  --accent-soft: #fff0e8;
  --ok: #1f8a4c;
  --warn: #b26a00;
  --warn-bg: #fff6e0;
  --bad: #c7291f;
  --bad-bg: #fdecea;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(22,22,29,.05), 0 8px 28px rgba(22,22,29,.06);
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Bricolage Grotesque", var(--sans);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::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;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; letter-spacing: -0.02em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: min(1180px, 100% - 32px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem; background: var(--ink); color: #fff; z-index: 9999; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.muted { color: var(--muted); font-weight: 500; }
.small { font-size: .85rem; }

/* =============================================================
   4. Header / hero
   ============================================================= */
.site-header { border-bottom: 1px solid var(--line); background: rgba(247,245,240,.9); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { display: flex; align-items: center; gap: .5rem; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.header-nav { display: none; gap: 1.4rem; font-size: .92rem; font-weight: 600; color: var(--ink-2); }
.header-nav a { text-decoration: none; }
.header-nav a:hover { color: var(--accent); }

.hero { padding: 18px 0 14px; }
.hero h1 { font-family: var(--display); font-weight: 800; font-size: clamp(1.5rem, 4.6vw, 2.6rem); }
.hero .sub { color: var(--ink-2); margin-top: .4rem; font-size: clamp(.93rem, 2vw, 1.05rem); max-width: 60ch; }

/* =============================================================
   5. Tool card
   ============================================================= */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "content" "preview" "design" "object";
}
.noscript { padding: 1rem; color: var(--bad); font-weight: 600; }
.panel { padding: 16px; min-width: 0; }
.panel + .panel { border-top: 1px solid var(--line); }
.p-content { grid-area: content; }
.p-preview { grid-area: preview; background: #fbfaf7; }
.p-design { grid-area: design; }
.p-object { grid-area: object; }

.step { font-size: 1.02rem; font-weight: 800; display: flex; align-items: center; gap: .55rem; margin-bottom: .75rem; letter-spacing: -0.01em; }
.step span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; font-size: .8rem; }

.lbl { display: block; font-size: .82rem; font-weight: 700; color: var(--ink-2); margin-bottom: .35rem; }
.group { margin-top: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 + .row2 { margin-top: 10px; }

/* tabs */
.tabs { display: flex; gap: 4px; background: #f1eee7; padding: 4px; border-radius: 12px; margin-bottom: 10px; }
.tab { flex: 1; padding: .5rem .4rem; border-radius: 9px; font-weight: 700; font-size: .9rem; color: var(--ink-2); transition: background .2s var(--ease-out); }
.tab[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* fields */
.field { display: block; min-width: 0; }
.field input, .field select, .field textarea, .range input {
  width: 100%;
}
.field input, .field select, .field textarea {
  border: 1.5px solid var(--line-2);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: .7rem .8rem;
  font-size: 1rem;
  transition: border-color .15s;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); }
#in-link { font-size: 1.05rem; padding: .85rem .9rem; }
.field-prefix { position: relative; }
.field-prefix .prefix { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); font-weight: 800; color: var(--muted); }
.field-prefix input { padding-left: 2rem; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .92rem; align-self: end; padding-bottom: .7rem; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { padding: .38rem .7rem; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: .85rem; font-weight: 600; transition: border-color .15s, background .15s; }
.chip:hover, .chip.is-on { border-color: var(--ink); background: #f5f3ee; }
.hint { margin-top: 8px; font-size: .85rem; color: var(--ink-2); background: #f5f3ee; border-radius: 8px; padding: .5rem .7rem; }

/* style presets */
.styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.style-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: .55rem .2rem .45rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); font-size: .78rem; font-weight: 700; background: #fff; transition: border-color .15s; }
.style-btn svg { width: 30px; height: 30px; fill: var(--ink); }
.style-btn[aria-checked="true"] { border-color: var(--ink); background: #f5f3ee; }

.color-field { display: block; }
.color-field input, .fil-row input[type="color"] { width: 100%; height: 42px; border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); padding: 3px; background: #fff; cursor: pointer; }

.emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 5px; }
.emoji-btn { height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-size: 1.3rem; line-height: 1; transition: border-color .15s, transform .15s var(--ease-out); }
.emoji-btn:hover { transform: translateY(-1px); }
.emoji-btn[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.logo-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.btn-file { position: relative; overflow: hidden; }
.btn-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .62rem 1rem; border-radius: var(--radius-sm); font-weight: 800; font-size: .92rem; transition: transform .15s var(--ease-out), background .15s, box-shadow .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #2a2a35; }
.btn-ghost { border: 1.5px solid var(--line-2); background: #fff; }
.btn-ghost:hover { border-color: var(--ink); }
.btn-accent { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px rgba(255,90,31,.28); }
.btn-accent:hover { background: #f04d12; }
.btn-big { width: 100%; padding: .95rem 1rem; font-size: 1.02rem; border-radius: 12px; }
.btn[disabled] { opacity: .55; cursor: progress; }
.linkish { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; font-size: .88rem; }
.linkish:hover { color: var(--accent); }

/* preview */
.preview-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.pv { min-width: 0; }
.qr2d { width: min(100%, 260px); aspect-ratio: 1; margin-inline: auto; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.qr2d svg, .qr2d canvas { width: 100% !important; height: 100% !important; }
.pv-cap { text-align: center; font-size: .8rem; color: var(--ink-2); font-weight: 600; margin: .45rem 0 .55rem; }
.dl-row { display: flex; gap: 6px; justify-content: center; }
.dl-row select { border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); padding: 0 .4rem; background: #fff; font-weight: 600; font-size: .85rem; }
.viewer { position: relative; width: 100%; aspect-ratio: 4 / 3.2; border-radius: 14px; overflow: hidden; background: radial-gradient(120% 90% at 50% 20%, #ffffff 0%, #ece9e1 70%, #e2ded3 100%); border: 1px solid var(--line); touch-action: none; }
.viewer canvas { display: block; width: 100% !important; height: 100% !important; cursor: grab; }
.viewer canvas:active { cursor: grabbing; }
.viewer-status { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 1rem; font-size: .9rem; font-weight: 600; color: var(--ink-2); pointer-events: none; }
.dl-sub { text-align: center; margin-top: .55rem; }
.busy { text-align: center; font-size: .85rem; color: var(--ink-2); font-weight: 600; margin-top: .3rem; }
.warn-inline { font-size: .8rem; color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: .35rem .6rem; margin: 0 auto .5rem; max-width: 300px; text-align: center; }

/* 3D object */
.formats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.format { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: .6rem .3rem; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .15s; }
.format svg { width: 44px; height: 33px; color: var(--ink); margin-bottom: 2px; }
.format b { font-size: .84rem; line-height: 1.2; }
.format small { font-size: .7rem; color: var(--muted); line-height: 1.25; }
.format[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.format[aria-checked="true"] svg { color: var(--accent); }
.row-text { display: grid; grid-template-columns: 1fr 92px; gap: 10px; }
.fil-row { display: grid; grid-template-columns: 92px 1fr 46px; gap: 8px; align-items: center; margin-top: 6px; }
.fil-name { font-size: .82rem; font-weight: 700; }
.fil-row input[type="color"] { height: 34px; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line-2); transition: box-shadow .15s, transform .15s var(--ease-out); }
.sw:hover { transform: scale(1.08); }
.sw[aria-checked="true"] { box-shadow: 0 0 0 2.5px var(--ink); }
.range output { float: right; color: var(--ink); font-weight: 800; }
.range input { accent-color: var(--accent); height: 28px; }

.warnings { list-style: none; padding: 0; margin-top: 12px; display: grid; gap: 6px; }
.warnings li { font-size: .84rem; border-radius: 9px; padding: .5rem .7rem; line-height: 1.45; }
.warnings .ok { background: #eaf6ef; color: var(--ok); }
.warnings .warn { background: var(--warn-bg); color: var(--warn); }
.warnings .bad { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.warnings .info { background: #f1eee7; color: var(--ink-2); }

.privacy { margin-top: 12px; font-size: .9rem; color: var(--ink-2); }
.limits { margin-top: 4px; font-size: .8rem; color: var(--muted); }

/* =============================================================
   6. Ad slots (placeholders — el dueño pega aquí AdSense)
   ============================================================= */
.ad-slot {
  display: grid; place-items: center;
  border: 1.5px dashed #c9c3b4; border-radius: 12px;
  background: repeating-linear-gradient(-45deg, #f3f0e9 0 10px, #efebe2 10px 20px);
  color: #9a9385; font-weight: 800; font-size: .8rem; letter-spacing: .18em;
}
.ad-leaderboard { min-height: 100px; margin: 26px auto 0; max-width: 970px; }
.ad-incontent { min-height: 250px; margin: 28px 0; }
.ad-pop-slot { min-height: 250px; width: 100%; margin: 12px 0; }
.ad-toast-slot { min-height: 90px; width: 100%; }

.ad-pop {
  border: 0; padding: 22px 20px 20px; border-radius: 18px;
  width: min(360px, calc(100% - 32px));
  box-shadow: 0 24px 80px rgba(0,0,0,.3);
  text-align: center;
}
.ad-pop::backdrop { background: rgba(22,22,29,.5); }
.ad-pop[open] { animation: popIn .3s var(--ease-out); }
.ad-pop .btn { width: 100%; }
.ad-pop-ok { font-weight: 800; }
.ad-close {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%;
  font-size: 1.35rem; line-height: 1; background: #f1eee7; color: var(--ink);
}
.ad-close:hover { background: #e4e0d6; }
.ad-toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  width: min(300px, calc(100% - 32px));
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 30px 10px 10px; box-shadow: 0 12px 40px rgba(0,0,0,.18);
  animation: toastIn .4s var(--ease-out);
}
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* =============================================================
   7. Content sections
   ============================================================= */
.how, .seo, .faq, .more { margin-top: 56px; }
.how h2, .seo h2, .faq h2, .more h2 { font-family: var(--display); font-size: clamp(1.4rem, 3.4vw, 2rem); margin-bottom: 18px; }
.steps3 { list-style: none; padding: 0; display: grid; gap: 14px; counter-reset: s; }
.steps3 li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.steps3 svg { width: 30px; height: 30px; color: var(--accent); margin-bottom: 8px; }
.steps3 h3 { font-size: 1.05rem; margin-bottom: 4px; }
.steps3 p { color: var(--ink-2); font-size: .94rem; }
.seo { max-width: 760px; }
.seo h3 { font-size: 1.15rem; margin: 22px 0 6px; }
.seo p { color: var(--ink-2); }
.faq { max-width: 760px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 800; color: var(--accent); font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding-bottom: 14px; color: var(--ink-2); }
.more-grid { display: grid; gap: 10px; }
.more-card { background: var(--surface); border: 1px dashed var(--line-2); border-radius: 12px; padding: 16px; display: flex; justify-content: space-between; gap: 1rem; }
.more-card span { color: var(--muted); font-size: .85rem; font-weight: 600; }

.site-footer { margin-top: 64px; border-top: 1px solid var(--line); padding: 22px 0 90px; font-size: .88rem; color: var(--ink-2); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.footer-inner nav { display: flex; gap: 16px; }

/* legal pages */
.legal { max-width: 760px; padding: 32px 0; }
.legal h1 { font-family: var(--display); margin-bottom: 16px; }
.legal h2 { font-size: 1.15rem; margin: 22px 0 6px; }
.legal p { color: var(--ink-2); margin-bottom: 8px; }
.todo { background: var(--warn-bg); color: var(--warn); padding: 0 4px; border-radius: 4px; font-weight: 700; }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .preview-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: start; }
  .steps3 { grid-template-columns: repeat(3, 1fr); }
  .more-grid { grid-template-columns: repeat(3, 1fr); }
  .more-card { flex-direction: column; }
}
@media (min-width: 720px) {
  .header-nav { display: flex; }
  .panel { padding: 20px 22px; }
}
@media (min-width: 960px) {
  .hero { padding: 26px 0 18px; }
  .tool-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    grid-template-areas: "content preview" "design preview" "object preview";
    grid-template-rows: auto auto 1fr;
  }
  .p-preview { border-top: 0 !important; border-left: 1px solid var(--line); border-radius: 0 calc(var(--radius) + 4px) calc(var(--radius) + 4px) 0; }
  .p-preview .preview-grid { position: sticky; top: 72px; grid-template-columns: minmax(0, 1fr); }
  .p-design { border-top: 1px solid var(--line); }
  .qr2d { width: 220px; }
  .pv-2d { display: grid; grid-template-columns: 220px 1fr; gap: 6px 16px; align-items: center; }
  .pv-2d .qr2d { grid-row: 1 / span 3; }
  .pv-2d .pv-cap { text-align: left; margin: 0; }
  .pv-2d .warn-inline { margin: 0; }
  .pv-2d .dl-row { justify-content: flex-start; flex-wrap: wrap; }
}

/* =============================================================
   9. Reduced motion (solo lo intrusivo)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .ad-toast, .ad-pop[open] { animation: none; }
}
