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

/* ---------- 1. Tokens ---------- */
:root {
  --accent: #1450E0;
  --accent-soft: #EAF0FE;
  --accent-ink: #0B3391;

  --ink: #0E1B33;
  --ink-2: #465266;
  --ink-3: #767F91;

  --page: #F5F6FA;
  --surface: #FFFFFF;
  --surface-2: #FAFBFD;
  --line: #E0E4EC;
  --line-2: #EDF0F5;

  --ok: #17794B;
  --warn: #9A6100;
  --bad: #C02626;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Space Grotesk", var(--sans);

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --gutter: clamp(16px, 4vw, 32px);
  --shadow: 0 1px 2px rgba(20, 22, 27, .05), 0 12px 32px -18px rgba(20, 22, 27, .3);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #5B8CFF;
    --accent-soft: #16203A;
    --accent-ink: #BBD0FF;
    --ink: #E9ECF2;
    --ink-2: #B0B8C6;
    --ink-3: #838C9C;
    --page: #0D111A;
    --surface: #161B26;
    --surface-2: #1B2130;
    --line: #2A3243;
    --line-2: #222937;
    --ok: #52C08C;
    --warn: #E0A93E;
    --bad: #FF7B7B;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -22px rgba(0, 0, 0, .8);
  }
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; tab-size: 2; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
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 { text-wrap: balance; line-height: 1.12; letter-spacing: -.02em; font-family: var(--display); }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- 3. Utilidades ---------- */
.wrap { width: min(1180px, 100% - var(--gutter) * 2); margin-inline: auto; }
.skip-link {
  position: fixed; top: -100px; left: 16px; z-index: 999;
  padding: .6rem 1rem; background: var(--ink); color: var(--page); border-radius: 8px;
}
.skip-link:focus { top: 16px; }
.small { font-size: .82rem; color: var(--ink-3); }
.hint { font-size: .84rem; color: var(--ink-3); margin-top: .5rem; }
.hint--tight { margin-top: .2rem; margin-bottom: .55rem; }

/* ---------- 4. Cabecera ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header__in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 58px; }
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: "Poppins", var(--display); font-weight: 700;
  font-size: 1.32rem; letter-spacing: -.025em; line-height: 1; color: var(--ink);
}
.brand__logo { width: 27px; height: 36px; flex: 0 0 auto; }
.brand__text em { font-style: normal; color: var(--accent); margin-left: .13em; }
.site-nav { display: none; gap: 1.4rem; font-size: .92rem; color: var(--ink-2); }
.site-nav a:hover { color: var(--accent); }

/* ---------- 5. Hero ---------- */
.hero { padding: clamp(1.6rem, 5vw, 3rem) 0 1.2rem; text-align: center; }
.hero h1 { font-size: clamp(1.65rem, 5.2vw, 2.9rem); }
.hero__sub {
  margin: .9rem auto 0; max-width: 62ch; color: var(--ink-2);
  font-size: clamp(.96rem, 2.1vw, 1.08rem);
}

/* ---------- 6. La herramienta ---------- */
.tool { padding-bottom: 1.6rem; }
.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tool-grid { display: grid; grid-template-columns: 1fr; }
.panel { padding: clamp(1rem, 3vw, 1.5rem); border-bottom: 1px solid var(--line); }
.preview { padding: clamp(1rem, 3vw, 1.5rem); background: var(--surface-2); }

.noscript-note {
  margin-bottom: 1rem; padding: .9rem 1.1rem; border-radius: var(--r);
  background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent);
}

/* Pestañas */
.tabs { display: flex; gap: .35rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--line); }
.tab {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem .55rem .7rem; font-size: .9rem; font-weight: 500; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .2s var(--ease-out);
}
.tab span {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--line-2); color: var(--ink-3); font-size: .72rem; font-weight: 700;
}
.tab { white-space: nowrap; }
@media (max-width: 419px) { .tab { font-size: .82rem; padding-inline: .35rem; } .tabs { gap: .1rem; } }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.tab.is-active span { background: var(--accent); color: #fff; }
.tabpanel[hidden] { display: none; }

/* Campos */
.block { margin-bottom: 1.25rem; }
.block:last-child { margin-bottom: 0; }
.field { display: block; margin-bottom: .85rem; }
.field--inline { display: inline-flex; flex-direction: column; gap: .3rem; margin-bottom: 0; }
.field--grow { flex: 1 1 180px; }
.field__label {
  display: flex; align-items: baseline; justify-content: space-between; gap: .5rem;
  font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: .35rem;
  letter-spacing: .01em;
}
.field__label em { font-style: normal; font-weight: 400; color: var(--ink-3); }
.field__label output { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; }
input[type="url"], input[type="text"], textarea, select {
  width: 100%; padding: .68rem .8rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
input[type="url"]:focus, input[type="text"]:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
textarea { resize: vertical; min-height: 76px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.row { display: flex; gap: .75rem; align-items: flex-end; }
.row--wrap { flex-wrap: wrap; align-items: flex-end; gap: .8rem; }
.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .88rem; color: var(--ink-2); padding-bottom: .7rem; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* Segmentado */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--line-2); border-radius: 10px; margin-bottom: 1rem; }
.seg__b { padding: .42rem .85rem; border-radius: 8px; font-size: .87rem; font-weight: 500; color: var(--ink-2); }
.seg__b.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .6rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .38rem .7rem; font-size: .82rem; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  transition: border-color .15s var(--ease-out), color .15s var(--ease-out);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip--pal i { width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .16); }
.chip--pal i + i { margin-left: -5px; }

/* Estilos de puntos */
.styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; }
.style {
  display: grid; justify-items: center; gap: .3rem; padding: .6rem .2rem .5rem;
  font-size: .75rem; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.style i { width: 22px; height: 22px; color: var(--ink); }
.style[data-style="clasico"] i {
  background-image:
    linear-gradient(45deg, currentColor 25%, transparent 25% 75%, currentColor 75%),
    linear-gradient(45deg, currentColor 25%, transparent 25% 75%, currentColor 75%);
  background-size: 11px 11px; background-position: 0 0, 5.5px 5.5px;
}
.style[data-style="redondeado"] i { background-image: radial-gradient(circle, currentColor 58%, transparent 61%); background-size: 7.4px 7.4px; }
.style[data-style="puntos"] i { background-image: radial-gradient(circle, currentColor 36%, transparent 39%); background-size: 7.4px 7.4px; }
.style[data-style="elegante"] i { background-image: radial-gradient(circle at 30% 30%, currentColor 62%, transparent 65%); background-size: 11px 11px; }
.style.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.style.is-active i { color: var(--accent); }

/* Colores */
.colors { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.color { display: inline-flex; align-items: center; gap: .5rem; font-size: .84rem; color: var(--ink-2); }
.color input[type="color"] {
  width: 42px; height: 34px; padding: 2px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
}

/* Emojis */
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: .3rem; margin-bottom: .7rem; }
.emoji {
  aspect-ratio: 1; display: grid; place-items: center; font-size: 1.15rem; line-height: 1;
  border: 1px solid transparent; border-radius: var(--r-sm); background: var(--surface-2);
  transition: border-color .15s var(--ease-out), transform .15s var(--ease-out);
}
.emoji:hover { border-color: var(--line); transform: translateY(-1px); }
.emoji.is-active { border-color: var(--accent); background: var(--accent-soft); }

/* Formatos 3D */
.formats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.format {
  display: grid; justify-items: center; gap: .12rem; padding: .8rem .35rem .7rem; text-align: center;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.format svg { width: 40px; height: 34px; fill: var(--ink-3); margin-bottom: .25rem; }
.format strong { font-size: .82rem; font-weight: 600; line-height: 1.25; }
.format small { font-size: .72rem; color: var(--ink-3); }
.format.is-active { border-color: var(--accent); background: var(--accent-soft); }
.format.is-active svg { fill: var(--accent); }
.format.is-active strong { color: var(--accent-ink); }

/* Vista previa */
.preview__head { display: flex; align-items: center; gap: .6rem; margin-bottom: .85rem; }
.preview__head h2 { font-size: 1rem; letter-spacing: 0; }
.badge {
  font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: .18rem .5rem; border-radius: 999px; background: var(--line-2); color: var(--ink-3);
}
.pv-wrap { display: grid; gap: .9rem; }
.pv figcaption { font-size: .78rem; color: var(--ink-3); margin-bottom: .35rem; }
.pv__box {
  position: relative; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: .7rem; min-height: 200px;
}
#qr-holder canvas, #qr-holder svg { width: 100%; height: auto; max-width: 260px; border-radius: 6px; }

.viewer { padding: 0; overflow: hidden; aspect-ratio: 1 / 1; min-height: 230px; touch-action: none; }
.viewer canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .4s var(--ease-out); }
.viewer[data-viewer="ready"] canvas { opacity: 1; }
.viewer__msg {
  position: relative; z-index: 1; max-width: 30ch; padding: 0 1rem; text-align: center;
  font-size: .84rem; color: var(--ink-3);
}
.viewer[data-viewer="ready"] .viewer__msg { display: none; }
.viewer[data-viewer="error"] .viewer__msg { color: var(--warn); max-width: 34ch; }
.viewer__hint {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  font-size: .7rem; color: var(--ink-3); background: color-mix(in srgb, var(--surface) 82%, transparent);
  padding: .12rem .5rem; border-radius: 999px; opacity: 0; transition: opacity .3s var(--ease-out);
  pointer-events: none; white-space: nowrap;
}
.viewer[data-viewer="ready"] .viewer__hint { opacity: 1; }

/* Avisos de impresión */
.checks { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .4rem; }
.chk { display: flex; gap: .5rem; font-size: .82rem; line-height: 1.45; color: var(--ink-2); }
.chk span { flex: 0 0 auto; width: 15px; height: 15px; margin-top: .2rem; border-radius: 50%; display: grid; place-items: center; font-size: 10px; color: #fff; }
.chk--ok span { background: var(--ok); }
.chk--ok span::before { content: "✓"; }
.chk--warn span { background: var(--warn); }
.chk--warn span::before { content: "!"; }
.chk--bad span { background: var(--bad); }
.chk--bad span::before { content: "!"; }
.chk--bad { color: var(--bad); font-weight: 500; }
.chk--info span { background: var(--ink-3); }
.chk--info span::before { content: "i"; }

/* Descargas */
.downloads { margin-top: 1.1rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .62rem 1rem; border-radius: 10px; font-weight: 600; font-size: .9rem;
  border: 1px solid transparent;
  transition: transform .15s var(--ease-out), background .15s var(--ease-out), border-color .15s var(--ease-out), opacity .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn--sm { padding: .42rem .75rem; font-size: .82rem; font-weight: 500; }
.btn--big { width: 100%; flex-direction: column; gap: .1rem; padding: .85rem 1rem; }
.btn__t { font-size: 1rem; }
.btn__s { font-size: .74rem; font-weight: 400; opacity: .85; }
.dl-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; margin-top: .5rem; }
.dl-hint { margin-top: .7rem; font-size: .82rem; color: var(--ink-3); text-align: center; }

.privacy {
  margin-top: 1rem; padding: .85rem 1.1rem; font-size: .87rem; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); text-align: center;
}

/* ---------- 7. Secciones ---------- */
.section { padding: clamp(2.2rem, 6vw, 3.8rem) 0; }
.section--alt { background: var(--surface); border-block: 1px solid var(--line); }
.section h2 { font-size: clamp(1.35rem, 3.4vw, 1.95rem); margin-bottom: .5rem; }
.section__sub { color: var(--ink-2); max-width: 62ch; margin-bottom: 1.6rem; }

.steps { list-style: none; padding: 0; margin-top: 1.6rem; display: grid; gap: 1rem; }
.steps li { position: relative; padding: 1.3rem 1.3rem 1.3rem 1.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.steps__n {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: var(--accent); color: #fff; font-family: var(--display); font-weight: 700; margin-bottom: .7rem;
}
.steps h3 { font-size: 1.02rem; margin-bottom: .35rem; }
.steps p { font-size: .9rem; color: var(--ink-2); }

.cards { display: grid; gap: .8rem; grid-template-columns: 1fr; }
.card { padding: 1.1rem; background: var(--page); border: 1px solid var(--line); border-radius: var(--r); }
.card__i { font-size: 1.5rem; display: block; margin-bottom: .5rem; }
.card h3 { font-size: .98rem; margin-bottom: .3rem; }
.card p { font-size: .87rem; color: var(--ink-2); }

.prose { max-width: 74ch; }
.prose h3 { font-size: 1.1rem; margin: 1.9rem 0 .5rem; }
.prose p { margin-bottom: .9rem; color: var(--ink-2); }
.prose strong { color: var(--ink); }

.faq { margin-top: 1.4rem; display: grid; gap: .5rem; max-width: 76ch; }
.faq details { background: var(--page); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.faq summary {
  padding: .95rem 1.1rem; cursor: pointer; font-weight: 600; 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-weight: 700; flex: 0 0 auto; }
.faq details[open] summary::after { content: "−"; }
.faq p { padding: 0 1.1rem 1.05rem; font-size: .9rem; color: var(--ink-2); }

/* ---------- 8. Publicidad (solo huecos marcados) ---------- */
.ad-slot {
  display: grid; place-items: center;
  border: 1px dashed var(--line); border-radius: var(--r);
  background: repeating-linear-gradient(135deg, transparent 0 9px, color-mix(in srgb, var(--line) 40%, transparent) 9px 10px);
  color: var(--ink-3);
}
.ad-slot > span { font-size: .68rem; font-weight: 700; letter-spacing: .18em; }
.ad-slot--leaderboard { min-height: 96px; margin: 1.2rem 0; }
.ad-slot--incontent { min-height: 260px; margin: 0 0 1.2rem; max-width: 340px; margin-inline: auto; }
.ad-slot--modal { width: 100%; min-height: 250px; margin: .9rem 0; }
.ad-slot--corner { width: 100%; min-height: 92px; }

.ad-corner {
  position: fixed; right: 12px; bottom: 12px; z-index: 60; width: min(300px, calc(100vw - 24px));
  padding: .7rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.ad-corner[hidden] { display: none; }
.ad-corner__x {
  position: absolute; top: -9px; right: -9px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: var(--page); font-size: 15px; line-height: 1; display: grid; place-items: center;
}

.ad-modal { border: 0; padding: 0; background: transparent; max-width: min(380px, calc(100vw - 32px)); }
.ad-modal::backdrop { background: rgba(10, 12, 16, .55); backdrop-filter: blur(2px); }
.ad-modal__in {
  position: relative; padding: 1.4rem 1.2rem 1.2rem; text-align: center;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.ad-modal__x {
  position: absolute; top: 8px; right: 10px; width: 30px; height: 30px; border-radius: 50%;
  font-size: 20px; line-height: 1; color: var(--ink-3);
}
.ad-modal__x:hover { background: var(--line-2); color: var(--ink); }
.ad-modal__ok { font-weight: 600; font-size: .95rem; }
.ad-modal .btn { width: 100%; }

/* ---------- 9. Pie ---------- */
.site-footer { padding: 2.2rem 0 2.6rem; border-top: 1px solid var(--line); background: var(--surface); }
.site-footer__in { display: grid; gap: .7rem; font-size: .88rem; color: var(--ink-2); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.site-footer nav a:hover { color: var(--accent); }

/* ---------- 10. Responsive ---------- */
@media (min-width: 540px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .dl-row { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 720px) {
  .site-nav { display: flex; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .pv-wrap { grid-template-columns: 1fr 1fr; align-items: start; }
  .site-footer__in { grid-template-columns: 1fr auto; align-items: center; }
  .site-footer__in .small { grid-column: 1 / -1; }
}
@media (min-width: 960px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr); }
  .panel { border-bottom: 0; border-right: 1px solid var(--line); }
  .cards { grid-template-columns: repeat(4, 1fr); }
  .pv-wrap { grid-template-columns: 1fr; }
  #qr-holder canvas, #qr-holder svg { max-width: 300px; }
}
@media (min-width: 1280px) {
  .pv-wrap { grid-template-columns: 1fr 1fr; }
}

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