/* =============================================================
   CreaQR — hoja de estilos única
   1 Tokens · 2 Reset · 3 Utilidades · 4 Tipografía · 5 Componentes
   6 Secciones · 7 Anuncios · 8 Responsive · 9 Reduced-motion
   ============================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #fbfbf9;
  --surface: #ffffff;
  --surface-2: #f4f4f1;
  --ink: #16181d;
  --muted: #5d6472;
  --line: #e4e4de;
  --line-strong: #d2d2ca;
  --accent: #e0552a;
  --accent-soft: #fdefe9;
  --ok: #1f7a4d;
  --warn: #a35a00;
  --danger: #b3261e;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--sans);
  --radius: 14px;
  --radius-sm: 10px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --maxw: 1180px;
  --shadow: 0 1px 2px rgba(16, 18, 24, .05), 0 12px 32px -18px rgba(16, 18, 24, .28);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101116;
    --surface: #171920;
    --surface-2: #1e2028;
    --ink: #f1f1ef;
    --muted: #a2a8b6;
    --line: #272a33;
    --line-strong: #363a46;
    --accent: #ff7448;
    --accent-soft: #2a1a13;
    --ok: #4ec38a;
    --warn: #e0a13c;
    --danger: #ff7b6e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -20px rgba(0, 0, 0, .8);
  }
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
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, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; }
::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: var(--gutter); }
.is-hidden { display: none !important; }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--ink); color: var(--bg); border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

/* ---------- 4. Cabecera ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 62px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; fill: var(--ink); }
.brand-mark rect:nth-child(2) { fill: var(--accent); }
.brand-name { font-family: var(--display); font-weight: 600; font-size: 1.15rem; letter-spacing: -.02em; }
.brand-name strong { color: var(--accent); font-weight: 700; }
.site-nav { display: none; gap: 1.4rem; font-size: .93rem; color: var(--muted); }
.site-nav a { text-decoration: none; }
.site-nav a:hover { color: var(--ink); }

/* ---------- 5. Hero ---------- */
.hero { padding: clamp(1.1rem, 4vw, 2.8rem) var(--gutter) 1rem; text-align: center; }
.eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 500; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-soft); padding: .3rem .7rem; border-radius: 100px;
}
h1 { font-size: clamp(1.7rem, 5.2vw, 3rem); margin: .55rem 0 .5rem; }
.hero-sub { max-width: 62ch; margin-inline: auto; color: var(--muted); font-size: clamp(.94rem, 1.6vw, 1.09rem); }
.hero-sub strong { color: var(--ink); font-weight: 600; }

/* ---------- 6. Tarjeta de herramienta ---------- */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 3vw, 1.8rem);
}
.tool-grid { display: grid; gap: clamp(1.5rem, 3vw, 2.4rem); }

.step-head { display: flex; align-items: center; gap: .6rem; margin: 1.6rem 0 .9rem; }
.step-head:first-child { margin-top: 0; }
.step-num {
  display: grid; place-items: center; width: 24px; height: 24px; flex: none;
  border-radius: 50%; background: var(--ink); color: var(--bg);
  font-size: .78rem; font-weight: 600;
}
.step-head h2 { font-size: 1.06rem; letter-spacing: -.01em; }

.field { margin-bottom: 1.05rem; }
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
label, .label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .35rem; }
.opt { color: var(--muted); font-weight: 400; }
.hint { font-size: .8rem; color: var(--muted); margin-top: .4rem; line-height: 1.45; }

input[type="text"], input[type="url"], select {
  width: 100%; padding: .65rem .8rem;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); outline: none;
  transition: border-color .18s var(--ease-out), background .18s var(--ease-out);
}
input[type="text"]:focus, select:focus { border-color: var(--accent); background: var(--surface); }
input[type="text"] + label { margin-top: .7rem; }
input[type="color"] {
  width: 100%; height: 42px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
output { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Segmentado enlace / wifi */
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 100px; margin-bottom: .9rem; }
.seg-btn { padding: .42rem .95rem; border-radius: 100px; font-size: .87rem; font-weight: 500; color: var(--muted); }
.seg-btn.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Chips de estilo */
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  padding: .45rem .85rem; font-size: .87rem; border-radius: 100px;
  border: 1px solid var(--line-strong); color: var(--muted);
  transition: all .18s var(--ease-out);
}
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* Emojis */
.emoji-row { display: flex; flex-wrap: wrap; gap: .3rem; }
.emoji-btn {
  width: 38px; height: 38px; font-size: 1.15rem; line-height: 1;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: transform .16s var(--ease-out), border-color .16s var(--ease-out);
}
.emoji-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.emoji-btn.is-active { border-color: var(--accent); background: var(--accent-soft); }
.emoji-row-text { margin-top: .45rem; }
.center-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .55rem; }

/* Formatos 3D */
.formats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.fmt {
  display: grid; gap: .18rem; justify-items: center; text-align: center;
  padding: .75rem .4rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: all .18s var(--ease-out);
}
.fmt svg { width: 40px; height: 32px; fill: var(--muted); stroke: none; }
.fmt svg .hole { fill: var(--surface); }
.fmt:hover { border-color: var(--accent); }
.fmt.is-active { border-color: var(--accent); background: var(--accent-soft); }
.fmt.is-active svg { fill: var(--accent); }
.fmt.is-active svg .hole { fill: var(--accent-soft); }
.fmt-name { font-size: .82rem; font-weight: 600; }
.fmt-note { font-size: .72rem; color: var(--muted); }

/* Combinaciones de color */
.combos { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.3rem 0 1.05rem; }
.combo {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .6rem .3rem .35rem; border: 1px solid var(--line); border-radius: 100px;
  font-size: .78rem; color: var(--muted);
}
.combo:hover { border-color: var(--accent); color: var(--ink); }
.combo i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line-strong); display: inline-block; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .62rem 1rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500; text-align: center;
  transition: transform .16s var(--ease-out), background .18s var(--ease-out), border-color .18s var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn-ghost { border: 1px solid var(--line-strong); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-file { cursor: pointer; }
.btn-primary {
  flex-direction: column; gap: .1rem; width: 100%;
  padding: .85rem 1.1rem; background: var(--accent); color: #fff;
  font-family: var(--display); font-weight: 600; font-size: 1.02rem;
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }
.btn-primary .btn-sub { font-family: var(--sans); font-size: .76rem; font-weight: 400; opacity: .9; }
.btn-primary[disabled] { opacity: .55; cursor: progress; }
.btn-link {
  display: block; width: 100%; margin-top: .55rem; padding: .35rem;
  font-size: .82rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
}
.btn-link:hover { color: var(--ink); }
.dl-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.dl-row .btn-ghost { flex: 1 1 140px; }
.sep { border: 0; border-top: 1px dashed var(--line-strong); margin: 1.6rem 0 0; }

/* Avisos de impresión */
.warnings { display: grid; gap: .4rem; margin-bottom: 1rem; }
.note {
  display: flex; gap: .5rem; align-items: flex-start;
  padding: .55rem .7rem; border-radius: var(--radius-sm);
  font-size: .82rem; line-height: 1.45;
  background: var(--surface-2); border: 1px solid var(--line);
}
.note b { font-weight: 600; }
.note-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.note-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.note-bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

/* ---------- Vistas previas ---------- */
.preview-col { display: grid; gap: 1.2rem; align-content: start; position: relative; }
.preview-block { display: grid; gap: .5rem; }
.preview-title { font-size: .92rem; display: flex; align-items: baseline; gap: .5rem; }
.preview-hint { font-family: var(--sans); font-size: .76rem; font-weight: 400; color: var(--muted); }
.qr-stage {
  display: grid; place-items: center; padding: 1rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  min-height: 240px;
}
.qr-stage canvas, .qr-stage svg { width: min(100%, 300px) !important; height: auto !important; border-radius: 6px; }
.viewer {
  position: relative; aspect-ratio: 4 / 3; min-height: 240px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; touch-action: none;
}
.viewer canvas { width: 100% !important; height: 100% !important; }
.viewer-msg {
  position: absolute; inset: 0; display: grid; place-items: center;
  padding: 1.5rem; text-align: center; font-size: .85rem; color: var(--muted);
}
.viewer[data-viewer-state="ready"] .viewer-msg { display: none; }
.preview-meta { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.privacy {
  font-size: .82rem; color: var(--muted); line-height: 1.5;
  padding: .7rem .85rem; background: var(--surface-2); border-radius: var(--radius-sm);
}
.privacy strong { color: var(--ink); }
.noscript { margin-top: 1rem; padding: .8rem; border: 1px solid var(--danger); border-radius: var(--radius-sm); color: var(--danger); }

/* ---------- 6. Secciones ---------- */
.section { padding: clamp(2.4rem, 6vw, 4rem) var(--gutter) 0; }
.section > h2 { font-size: clamp(1.4rem, 3.4vw, 2rem); margin-bottom: .5rem; }
.section-sub { color: var(--muted); margin-bottom: 1.5rem; max-width: 60ch; }

.steps { list-style: none; padding: 0; display: grid; gap: 1.1rem; margin-top: 1.4rem; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.step-ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); margin-bottom: .7rem; }
.step-ico svg { width: 19px; height: 19px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.steps h3 { font-size: 1.02rem; margin-bottom: .35rem; }
.steps p { font-size: .9rem; color: var(--muted); }

.ideas { display: grid; gap: 1rem; }
.idea { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem; }
.idea-emoji { font-size: 1.5rem; line-height: 1; display: block; margin-bottom: .5rem; }
.idea h3 { font-size: .99rem; margin-bottom: .3rem; }
.idea p { font-size: .88rem; color: var(--muted); }

.prose { max-width: 74ch; }
.prose h2 { margin-bottom: .8rem; }
.prose h3 { font-size: 1.13rem; margin: 1.6rem 0 .5rem; }
.prose p { color: var(--muted); margin-bottom: .9rem; }
.prose strong { color: var(--ink); font-weight: 600; }

.faq { display: grid; gap: .55rem; margin-top: 1.3rem; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .85rem 1rem; }
.faq summary { cursor: pointer; font-weight: 500; font-size: .95rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq p { margin-top: .6rem; font-size: .9rem; color: var(--muted); }

/* ---------- 7. Huecos de anuncio ---------- */
.ad-slot {
  display: grid; place-items: center;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted); font-size: .72rem; letter-spacing: .16em; font-weight: 500;
}
.ad-leaderboard { min-height: 100px; margin-top: 2.2rem; }
.ad-incontent { min-height: 250px; margin-top: 2.4rem; }
.ad-modal {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem;
  max-width: min(92vw, 360px); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow); position: relative;
}
.ad-modal::backdrop { background: rgba(10, 11, 15, .55); }
.ad-modal-x { position: absolute; top: .45rem; right: .6rem; font-size: 1.5rem; line-height: 1; color: var(--muted); padding: .2rem .35rem; }
.ad-modal-x:hover { color: var(--ink); }
.ad-modal-title { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.ad-modal-sub { font-size: .84rem; color: var(--muted); margin-bottom: .9rem; }
.ad-modal-slot { min-height: 250px; margin-bottom: .9rem; }
.ad-modal .btn-ghost { width: 100%; }
.ad-toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  padding: .55rem; padding-top: 1.1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.ad-toast[hidden] { display: none; }
.ad-toast-x { position: absolute; top: .1rem; right: .35rem; font-size: 1.15rem; line-height: 1; color: var(--muted); }
.ad-toast-slot { width: 240px; min-height: 90px; }

/* ---------- 8. Pie ---------- */
.site-footer { margin-top: clamp(3rem, 8vw, 5rem); border-top: 1px solid var(--line); padding: 1.8rem 0 2.4rem; }
.footer-inner { display: grid; gap: .7rem; font-size: .85rem; color: var(--muted); }
.footer-inner strong { color: var(--ink); }
.footer-inner nav { display: flex; gap: 1.1rem; }
.footer-inner a { text-decoration: underline; text-underline-offset: 3px; }
.credits { font-size: .76rem; }

/* ---------- 9. Responsive ---------- */
@media (min-width: 720px) {
  .site-nav { display: flex; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .ideas { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr auto; align-items: center; }
  .credits { grid-column: 1 / -1; }
}
@media (min-width: 960px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); }
  .preview-col { position: sticky; top: 78px; }
  .ideas { grid-template-columns: repeat(3, 1fr); }
  .hero { text-align: left; padding-bottom: 1.6rem; }
  .hero-sub { margin-inline: 0; }
}

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