/* =============================================================
   QR3D — hoja de estilos unica
   1 Tokens · 2 Reset · 3 Utilidades · 4 Tipografia · 5 Componentes
   6 Herramienta · 7 Secciones · 8 Anuncios · 9 Responsive
   ============================================================= */

/* ===================== 1. TOKENS ===================== */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --ink: #15161d;
  --ink-2: #3b3f4d;
  --muted: #6b7183;
  --line: #e3e6ef;
  --line-2: #eef0f6;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --warn: #a15c07;
  --warn-soft: #fff8eb;
  --bad: #c72c2c;
  --bad-soft: #fef2f2;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 40, .05);
  --shadow: 0 4px 16px -4px rgba(20, 22, 40, .09), 0 1px 3px rgba(20, 22, 40, .05);
  --shadow-lg: 0 18px 48px -18px rgba(20, 22, 40, .22);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(1rem, 4vw, 2rem);
  --maxw: 1180px;
}

/* ===================== 2. RESET ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; letter-spacing: -.021em; font-weight: 700; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ===================== 3. UTILIDADES ===================== */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--ink); color: #fff;
  border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ===================== 4. CABECERA ===================== */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(246, 247, 251, .88);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; }
.brand-name { font-size: 1.16rem; }
.site-nav { display: none; gap: 1.5rem; font-size: .93rem; font-weight: 500; color: var(--ink-2); }
.site-nav a { padding: .25rem 0; border-bottom: 2px solid transparent; transition: border-color .2s var(--ease-out), color .2s var(--ease-out); }
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
@media (min-width: 720px) { .site-nav { display: flex; } }

/* ===================== 5. HERO ===================== */
.hero { padding-block: clamp(1.75rem, 5vw, 3rem) 1.5rem; }
.hero h1 {
  font-size: clamp(1.85rem, 5.2vw, 3.1rem);
  font-weight: 800; letter-spacing: -.035em;
  max-width: 20ch;
}
.hero-sub {
  margin-top: .85rem; max-width: 62ch;
  font-size: clamp(1rem, 1.9vw, 1.11rem); color: var(--muted);
}
.hero-sub strong { color: var(--ink-2); font-weight: 600; }

/* ===================== 6. LA HERRAMIENTA ===================== */
.tool-card {
  margin-top: 1.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 3vw, 1.75rem);
}
.noscript-note {
  padding: 1rem 1.15rem; border-radius: var(--radius);
  background: var(--warn-soft); border: 1px solid #f2dfb8; color: var(--warn);
}

.tool-grid { display: grid; gap: 1.5rem; }
@media (min-width: 1000px) {
  .tool-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
    column-gap: 2rem; row-gap: 1.75rem;
    grid-template-areas: "input preview" "design preview" "object preview" "downloads preview";
    align-items: start;
  }
  .block--input { grid-area: input; }
  .block--preview { grid-area: preview; }
  .block--design { grid-area: design; }
  .block--object { grid-area: object; }
  .block--downloads { grid-area: downloads; }
  .preview-sticky { position: sticky; top: 76px; }
}

.block { min-width: 0; }
.block + .block { border-top: 1px solid var(--line-2); padding-top: 1.5rem; }
@media (min-width: 1000px) {
  .block--design, .block--object, .block--downloads { border-top: 1px solid var(--line-2); padding-top: 1.75rem; }
  .block--input, .block--preview { border-top: 0; padding-top: 0; }
}

.block-head { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.block-head h2 { font-size: 1.06rem; font-weight: 700; letter-spacing: -.015em; }
.step-dot {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: .8rem; font-weight: 700;
}

/* --- pestanas --- */
.tabs { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 1rem; }
.tab {
  padding: .48rem .95rem; border-radius: 8px; font-size: .9rem; font-weight: 600; color: var(--muted);
  transition: background .18s var(--ease-out), color .18s var(--ease-out);
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* --- campos --- */
.field { display: block; margin-bottom: .9rem; }
.field-label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: .38rem; }
.field input[type="text"], .field select {
  width: 100%; padding: .7rem .85rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.field input[type="text"]:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-hint { font-size: .83rem; color: var(--muted); margin-top: -.3rem; }
.field--inline select { max-width: 100%; }
.field--range input[type="range"] { width: 100%; accent-color: var(--accent); margin-top: .2rem; }
.sub-note { font-weight: 400; color: var(--muted); }

.sub { margin-bottom: 1.15rem; }
.sub-label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: .5rem; }

/* --- chips de estilo --- */
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  padding: .45rem .85rem; border-radius: 999px; font-size: .87rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  transition: all .18s var(--ease-out);
}
.chip:hover { border-color: #c9cde0; }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* --- colores --- */
.sub--colors { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.color-field { display: block; }
.color-input { display: flex; align-items: center; gap: .55rem; }
.color-input input[type="color"] {
  inline-size: 44px; block-size: 34px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 9px; background: none;
}
.color-input input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.color-input input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.color-input output { font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }

/* --- emojis --- */
.emoji-row { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .7rem; }
.emoji-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  font-size: 1.12rem; line-height: 1; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface);
  transition: all .16s var(--ease-out);
}
.emoji-btn:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.emoji-btn.is-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.emoji-row--label { margin-top: -.35rem; }
.center-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.center-status { font-size: .82rem; color: var(--muted); }

/* --- formatos 3D --- */
.formats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1.15rem; }
.format {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  padding: .85rem .4rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  text-align: center; transition: all .18s var(--ease-out);
}
.format svg { color: var(--muted); transition: color .18s var(--ease-out); }
.format strong { font-size: .87rem; font-weight: 650; line-height: 1.2; }
.format small { font-size: .74rem; color: var(--muted); line-height: 1.2; }
.format:hover { border-color: #c9cde0; transform: translateY(-1px); }
.format.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.format.is-active svg { color: var(--accent); }
.format.is-active small { color: var(--accent); opacity: .8; }

/* --- avisos de impresion --- */
.warnings { display: grid; gap: .4rem; margin-top: .3rem; }
.warn-item {
  display: flex; gap: .5rem; align-items: flex-start;
  padding: .55rem .7rem; border-radius: var(--radius-sm);
  font-size: .84rem; line-height: 1.45;
}
.warn-item b { font-weight: 650; }
.warn-item--ok { background: var(--ok-soft); color: var(--ok); }
.warn-item--warn { background: var(--warn-soft); color: var(--warn); }
.warn-item--bad { background: var(--bad-soft); color: var(--bad); }
.warn-ico { flex: 0 0 auto; font-size: .95rem; line-height: 1.4; }

/* --- vistas previas --- */
.preview + .preview { margin-top: 1rem; }
.preview-cap {
  display: flex; align-items: baseline; justify-content: space-between; gap: .5rem;
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin-bottom: .5rem;
}
.preview-hint { font-size: .72rem; font-weight: 500; text-transform: none; letter-spacing: 0; }
.qr-holder {
  display: grid; place-items: center; padding: 1rem;
  min-height: 180px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.qr-holder canvas, .qr-holder svg { width: 100% !important; height: auto !important; max-width: 260px; border-radius: 6px; }
.viewer {
  position: relative; width: 100%; aspect-ratio: 4 / 3; min-height: 200px;
  background: linear-gradient(180deg, #f3f4f9 0%, #e9ebf3 100%);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  touch-action: pan-y;
}
.viewer canvas { width: 100%; height: 100%; display: block; }
.viewer-status {
  position: absolute; inset: 0; display: grid; place-items: center;
  padding: 1.25rem; text-align: center; font-size: .87rem; color: var(--muted); line-height: 1.5;
}
.viewer-legend { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: .5rem; }
.viewer-legend .swatch {
  display: inline-block; width: 13px; height: 13px; border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, .16); vertical-align: -2px;
}
.viewer-legend .swatch:not(:first-child) { margin-left: .7rem; }

/* --- descargas --- */
.dl-group + .dl-group { margin-top: 1.15rem; }
.dl-title { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: .5rem; }
.dl-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.dl-row .btn { flex: 1 1 130px; }
.dl-note { font-size: .82rem; color: var(--muted); margin-top: .5rem; min-height: 1.2em; }

.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .1rem; padding: .72rem 1.1rem; border-radius: var(--radius-sm);
  font-weight: 650; font-size: .93rem; text-align: center;
  border: 1px solid transparent; transition: all .18s var(--ease-out);
}
.btn small { font-size: .74rem; font-weight: 500; opacity: .78; }
.btn--block { display: flex; width: 100%; }
.btn--sm { padding: .45rem .8rem; font-size: .85rem; }
.btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .6); }
.btn--primary:hover { background: #4338ca; transform: translateY(-1px); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn--plain { background: none; color: var(--muted); font-weight: 550; font-size: .86rem; padding: .55rem .8rem; }
.btn--plain:hover { color: var(--accent); background: var(--accent-soft); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: progress; }
.btn--block + .btn--block { margin-top: .5rem; }

.privacy-badge {
  display: flex; align-items: flex-start; gap: .5rem; margin-top: 1.25rem;
  padding: .7rem .85rem; border-radius: var(--radius-sm);
  background: var(--ok-soft); color: var(--ok);
  font-size: .83rem; line-height: 1.45;
}
.privacy-badge svg { flex: 0 0 auto; margin-top: .15rem; }

/* ===================== 7. SECCIONES ===================== */
.section { padding-block: clamp(2.5rem, 6vw, 4rem); }
.section-title { font-size: clamp(1.4rem, 3.4vw, 2rem); font-weight: 750; letter-spacing: -.028em; }
.section-lead { margin-top: .7rem; max-width: 68ch; color: var(--muted); }

.steps { list-style: none; display: grid; gap: 1rem; margin-top: 1.75rem; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow-sm); }
.step-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: .85rem; }
.step h3 { font-size: 1.03rem; margin-bottom: .4rem; }
.step p { font-size: .93rem; color: var(--muted); }

.ideas { display: grid; gap: 1rem; margin-top: 1.75rem; }
.idea { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm); }
.idea-emoji { font-size: 1.5rem; line-height: 1; display: block; margin-bottom: .6rem; }
.idea h3 { font-size: .99rem; margin-bottom: .35rem; }
.idea p { font-size: .9rem; color: var(--muted); }

.prose { margin-top: 1.5rem; max-width: 72ch; }
.prose h3 { font-size: 1.08rem; margin-top: 1.9rem; margin-bottom: .5rem; }
.prose p { margin-bottom: .85rem; color: var(--ink-2); }
.prose strong { font-weight: 650; color: var(--ink); }

.faq { margin-top: 1.5rem; max-width: 72ch; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.faq details { border-bottom: 1px solid var(--line-2); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  padding: 1.05rem 2.6rem 1.05rem 1.25rem; position: relative;
  font-weight: 600; font-size: .96rem; cursor: pointer; list-style: none;
  transition: color .18s var(--ease-out);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 1.25rem; top: 1.35rem;
  width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .22s var(--ease-out);
}
.faq details[open] summary::after { transform: rotate(-135deg); }
.faq summary:hover { color: var(--accent); }
.faq details p { padding: 0 1.25rem 1.15rem; font-size: .93rem; color: var(--muted); }

/* ===================== 8. ANUNCIOS (solo huecos) ===================== */
.ad-slot {
  position: relative; display: grid; place-items: center;
  border: 1px dashed #ccd1e2; border-radius: var(--radius);
  background: repeating-linear-gradient(135deg, #f9fafd 0 10px, #f4f6fb 10px 20px);
  color: #9aa1b7;
}
.ad-tag { font-size: .68rem; font-weight: 700; letter-spacing: .16em; }
.ad-slot--leaderboard { min-height: 100px; margin-block: .5rem 1rem; }
.ad-slot--incontent { min-height: 250px; margin-block: 1rem; }
@media (min-width: 720px) { .ad-slot--leaderboard { min-height: 90px; } .ad-slot--incontent { min-height: 280px; } }

.ad-modal {
  width: min(92vw, 360px); padding: 1.1rem; border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); background: var(--surface); color: var(--ink);
}
.ad-modal::backdrop { background: rgba(16, 18, 32, .5); backdrop-filter: blur(2px); }
.ad-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .85rem; }
.ad-modal-head p { font-weight: 650; font-size: .97rem; }
.ad-modal-close {
  flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 8px; font-size: 1.35rem; line-height: 1; color: var(--muted);
  transition: background .18s var(--ease-out), color .18s var(--ease-out);
}
.ad-modal-close:hover { background: var(--line-2); color: var(--ink); }
.ad-slot--modal { min-height: 250px; width: 100%; margin-bottom: .85rem; }

.ad-toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 70;
  width: min(84vw, 300px); padding: .55rem; padding-top: 1.4rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: toast-in .45s var(--ease-out) both;
}
.ad-toast[hidden] { display: none; }
.ad-toast-close {
  position: absolute; top: .2rem; right: .3rem;
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 7px; font-size: 1.2rem; line-height: 1; color: var(--muted);
}
.ad-toast-close:hover { background: var(--line-2); color: var(--ink); }
.ad-slot--toast { min-height: 100px; width: 100%; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ===================== 9. PIE ===================== */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 2rem; }
.footer-inner { padding-block: 2rem; display: grid; gap: .6rem; }
.footer-brand { font-size: .95rem; }
.footer-nav { display: flex; gap: 1.25rem; font-size: .9rem; color: var(--muted); }
.footer-nav a:hover { color: var(--accent); }
.footer-note { font-size: .8rem; color: var(--muted); max-width: 70ch; }

/* ===================== 10. RESPONSIVE ===================== */
@media (min-width: 720px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .ideas { grid-template-columns: repeat(2, 1fr); }
  .sub--colors { gap: 1.25rem; }
}
@media (min-width: 960px) {
  .ideas { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 400px) {
  .formats { grid-template-columns: 1fr; }
  .format { flex-direction: row; gap: .7rem; text-align: left; padding: .7rem .85rem; }
  .format div { display: block; }
  .sub--colors { grid-template-columns: 1fr; gap: .7rem; }
}

/* ===================== 11. MOVIMIENTO REDUCIDO =====================
   Solo se desactiva lo intrusivo. Las transiciones de interfaz se quedan:
   son respuesta a una accion del usuario, no decoracion. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ad-toast { animation: none; }
}
