/* =============================================================
   QR3D - hoja de estilos unica
   1 Tokens | 2 Reset | 3 Utilidades | 4 Tipografia | 5 Componentes
   6 Secciones | 7 Anuncios | 8 Responsive | 9 Reduced-motion
   ============================================================= */

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg:        #f6f7f9;
  --surface:   #ffffff;
  --surface-2: #eef0f4;
  --ink:       #12151c;
  --ink-soft:  #545c6b;
  --ink-mute:  #7d8593;
  --line:      #e2e6ec;
  --line-soft: #eef1f5;

  --accent:      #ff5a1f;
  --accent-dark: #e04409;
  --accent-soft: #fff1ea;
  --deep:        #151b2b;

  --ok:      #12805c;
  --ok-soft: #e6f5ef;
  --warn:      #a35a00;
  --warn-soft: #fff4e0;
  --bad:      #b3261e;
  --bad-soft: #fdeceb;

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

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(18,21,28,.06), 0 2px 6px rgba(18,21,28,.04);
  --shadow:    0 2px 6px rgba(18,21,28,.05), 0 12px 30px rgba(18,21,28,.07);
  --shadow-lg: 0 4px 12px rgba(18,21,28,.06), 0 28px 60px rgba(18,21,28,.11);

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --maxw: 1240px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* =============================================================
   2. Reset y base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; 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;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
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, h4 { text-wrap: balance; line-height: 1.12; letter-spacing: -0.02em; font-family: var(--display); font-weight: 700; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilidades
   ============================================================= */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.wrap--narrow { max-width: 880px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 9999;
  padding: .6rem 1rem; background: var(--ink); color: #fff; border-radius: var(--r-sm); font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.center { text-align: center; }

/* =============================================================
   4. Tipografia
   ============================================================= */
h1 { font-size: clamp(1.85rem, 1.2rem + 2.6vw, 3.05rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2.1rem); }
h3 { font-size: clamp(1.05rem, .95rem + .5vw, 1.25rem); }
.lead { font-size: clamp(1rem, .95rem + .4vw, 1.16rem); color: var(--ink-soft); }
.eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: .38rem .7rem; border-radius: 100px;
}
.prose p { color: var(--ink-soft); margin-bottom: 1rem; }
.prose h3 { margin: 1.8rem 0 .6rem; color: var(--ink); }
.prose ul { color: var(--ink-soft); padding-left: 1.15rem; margin-bottom: 1rem; }
.prose li { margin-bottom: .35rem; }
.prose strong { color: var(--ink); font-weight: 600; }

/* =============================================================
   5. Componentes
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .8rem 1.25rem; border-radius: var(--r-sm);
  font-weight: 600; font-size: .95rem; line-height: 1.2;
  border: 1px solid transparent; background: var(--surface-2); color: var(--ink);
  transition: background .25s var(--ease-out), transform .25s var(--ease-out), box-shadow .25s var(--ease-out), border-color .25s var(--ease-out);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(255,90,31,.28); }
.btn--primary:hover { background: var(--accent-dark); box-shadow: 0 10px 24px rgba(255,90,31,.34); }
.btn--dark { background: var(--deep); color: #fff; }
.btn--dark:hover { background: #0c1120; }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink-mute); background: var(--surface); }
.btn--big { padding: 1rem 1.4rem; font-size: 1.02rem; width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { flex: none; }

.field { display: block; margin-bottom: 1rem; }
.field > .label {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .4rem;
}
.input, .select {
  width: 100%; padding: .72rem .85rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,90,31,.14); }
.hint { font-size: .78rem; color: var(--ink-mute); margin-top: .35rem; }

.seg { display: flex; gap: .3rem; padding: .28rem; background: var(--surface-2); border-radius: 10px; }
.seg button {
  flex: 1; padding: .5rem .6rem; border-radius: 7px;
  font-size: .86rem; font-weight: 600; color: var(--ink-soft);
  transition: background .2s var(--ease-out), color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  padding: .48rem .8rem; border-radius: 100px; border: 1px solid var(--line);
  background: var(--surface); font-size: .85rem; font-weight: 600; color: var(--ink-soft);
  transition: background .2s var(--ease-out), color .2s var(--ease-out), border-color .2s var(--ease-out);
}
.chip:hover { border-color: var(--ink-mute); }
.chip[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: #fff; }

.swatches { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch {
  width: 34px; height: 26px; border-radius: 6px; border: 1px solid var(--line);
  position: relative; overflow: hidden; transition: transform .2s var(--ease-out);
}
.swatch:hover { transform: scale(1.07); }
.swatch i { position: absolute; inset: 0; display: block; }
.swatch i:first-child { right: 50%; }
.swatch i:last-child { left: 50%; }

.color-row { display: flex; gap: .6rem; align-items: flex-end; }
.color-row .field { flex: 1; margin-bottom: 0; }
.color-field { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--line); border-radius: var(--r-sm); padding: .34rem .5rem; background: var(--surface); }
.color-field input[type="color"] { width: 34px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.color-field input[type="text"] { border: 0; width: 100%; padding: 0; background: none; font-size: .86rem; font-variant-numeric: tabular-nums; text-transform: uppercase; }
.color-field input[type="text"]:focus { outline: none; }
.swap-btn {
  width: 38px; height: 38px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; color: var(--ink-soft);
  transition: border-color .2s var(--ease-out), color .2s var(--ease-out);
}
.swap-btn:hover { border-color: var(--ink-mute); color: var(--ink); }

.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: .35rem; }
.emoji-grid button {
  aspect-ratio: 1; display: grid; place-items: center; font-size: 1.3rem;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface);
  transition: border-color .18s var(--ease-out), transform .18s var(--ease-out), background .18s var(--ease-out);
}
.emoji-grid button:hover { border-color: var(--ink-mute); transform: translateY(-1px); }
.emoji-grid button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(255,90,31,.18); }

.slider { width: 100%; accent-color: var(--accent); }

details.acc { border-bottom: 1px solid var(--line); }
details.acc > summary {
  list-style: none; cursor: pointer; padding: 1.05rem 2rem 1.05rem 0; position: relative;
  font-weight: 600; font-size: 1.02rem;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after {
  content: ""; position: absolute; right: .35rem; top: 50%; width: 10px; height: 10px;
  border-right: 2px solid var(--ink-mute); border-bottom: 2px solid var(--ink-mute);
  transform: translateY(-70%) rotate(45deg); transition: transform .25s var(--ease-out);
}
details.acc[open] > summary::after { transform: translateY(-30%) rotate(-135deg); }
details.acc > div { padding: 0 0 1.15rem; color: var(--ink-soft); }
details.acc > div p + p { margin-top: .7rem; }

.note {
  display: flex; gap: .6rem; align-items: flex-start;
  padding: .68rem .8rem; border-radius: var(--r-sm); font-size: .85rem; line-height: 1.45;
}
.note--ok   { background: var(--ok-soft);   color: var(--ok); }
.note--warn { background: var(--warn-soft); color: var(--warn); }
.note--bad  { background: var(--bad-soft);  color: var(--bad); }
.note b { font-weight: 700; }
.note svg { flex: none; margin-top: 2px; }

/* =============================================================
   6. Secciones
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(246,247,249,.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 62px; }
.logo { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 700; font-size: 1.12rem; letter-spacing: -.02em; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--deep); color: #fff; display: grid; place-items: center; font-size: .72rem; font-weight: 700; letter-spacing: -.03em; }
.nav-links { display: none; gap: 1.35rem; font-size: .9rem; font-weight: 500; color: var(--ink-soft); }
.nav-links a:hover { color: var(--ink); }

.hero { padding: clamp(1.8rem, 4vw, 3rem) 0 0; }
.hero-head { max-width: 780px; }
.hero h1 { margin: .85rem 0 .7rem; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.05rem; }
.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-weight: 600; color: var(--ink-soft);
  background: var(--surface); border: 1px solid var(--line);
  padding: .4rem .75rem; border-radius: 100px;
}
.pill svg { color: var(--ok); }

/* --- La tarjeta de la herramienta --- */
.tool {
  margin-top: clamp(1.3rem, 3vw, 2rem);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.tool-grid { display: grid; grid-template-columns: 1fr; }
.tool-controls { padding: clamp(1.1rem, 2.4vw, 1.7rem); }
.tool-preview {
  padding: clamp(1.1rem, 2.4vw, 1.7rem);
  background: linear-gradient(180deg, #fbfbfd, #f1f3f7);
  border-top: 1px solid var(--line);
}
.panel + .panel { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line-soft); }
.panel-title {
  display: flex; align-items: center; gap: .55rem;
  font-family: var(--display); font-size: .95rem; font-weight: 700; margin-bottom: .9rem;
}
.panel-title .num {
  width: 22px; height: 22px; border-radius: 6px; background: var(--deep); color: #fff;
  display: grid; place-items: center; font-size: .72rem; flex: none;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.qr-stage {
  display: grid; place-items: center; padding: 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  min-height: 290px;
}
.qr-stage canvas, .qr-stage svg { max-width: 100%; height: auto; border-radius: 6px; }
.stage-label {
  font-size: .78rem; font-weight: 600; color: var(--ink-mute); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: .55rem; display: flex; justify-content: space-between; align-items: center;
}
.stage-block + .stage-block { margin-top: 1.4rem; }

.viewer-3d {
  position: relative; border: 1px solid var(--line); border-radius: var(--r);
  background: linear-gradient(170deg, #ffffff, #e9edf3);
  min-height: 300px; overflow: hidden;
}
.viewer-3d canvas { display: block; touch-action: none; }
.viewer-msg {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .5rem;
  padding: 1.2rem; text-align: center; font-size: .88rem; color: var(--ink-soft);
  background: rgba(255,255,255,.75);
}
.viewer-msg[hidden] { display: none; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.viewer-hint {
  position: absolute; left: 10px; bottom: 10px; font-size: .74rem; color: var(--ink-mute);
  background: rgba(255,255,255,.82); padding: .25rem .55rem; border-radius: 100px; pointer-events: none;
}

.dl-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .9rem; }
.dl-secondary { display: flex; justify-content: center; margin-top: .6rem; }
.dl-secondary button { font-size: .84rem; color: var(--ink-mute); text-decoration: underline; text-underline-offset: 3px; }
.dl-secondary button:hover { color: var(--ink); }

.specs { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; margin-top: .9rem; font-size: .82rem; color: var(--ink-soft); }
.specs b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.checks { display: grid; gap: .45rem; margin-top: .9rem; }

.privacy-badge {
  display: flex; align-items: center; gap: .55rem; justify-content: center;
  margin-top: 1rem; font-size: .86rem; color: var(--ink-soft); text-align: center;
}
.privacy-badge svg { color: var(--ok); flex: none; }

.section { padding: clamp(2.6rem, 6vw, 4.4rem) 0; }
.section-head { max-width: 720px; margin-bottom: clamp(1.6rem, 3vw, 2.4rem); }
.section-head h2 { margin: .7rem 0 .55rem; }

.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.step {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.4rem; box-shadow: var(--shadow-sm);
}
.step-num {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; margin-bottom: .85rem;
}
.step h3 { margin-bottom: .4rem; }
.step p { color: var(--ink-soft); font-size: .93rem; }

.uses { display: grid; gap: .9rem; grid-template-columns: 1fr; }
.use {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.2rem; display: flex; gap: .9rem; align-items: flex-start;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.use:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.use .ico { font-size: 1.5rem; line-height: 1; flex: none; }
.use h3 { font-size: 1rem; margin-bottom: .3rem; }
.use p { font-size: .89rem; color: var(--ink-soft); }

.faq { max-width: 820px; }

.site-footer { background: var(--deep); color: #cfd5e2; padding: 2.6rem 0 2rem; margin-top: 2rem; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--accent); }
.footer-grid { display: grid; gap: 1.6rem; grid-template-columns: 1fr; }
.footer-grid h4 { font-family: var(--display); font-size: .9rem; color: #fff; margin-bottom: .6rem; }
.footer-grid ul { list-style: none; padding: 0; font-size: .88rem; display: grid; gap: .35rem; }
.footer-grid p { font-size: .88rem; }
.footer-bottom {
  margin-top: 1.8rem; padding-top: 1.2rem; border-top: 1px solid rgba(255,255,255,.12);
  font-size: .8rem; color: #9aa3b5; display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; justify-content: space-between;
}

/* =============================================================
   7. Huecos de anuncios (placeholders, sin codigo de terceros)
   ============================================================= */
.ad-slot {
  display: grid; place-items: center; gap: .3rem;
  border: 1px dashed #c9cfda; border-radius: var(--r);
  background: repeating-linear-gradient(135deg, #fafbfc, #fafbfc 10px, #f3f5f8 10px, #f3f5f8 20px);
  color: #9aa3b3; text-align: center;
}
.ad-slot .ad-tag { font-size: .68rem; font-weight: 700; letter-spacing: .18em; }
.ad-slot .ad-size { font-size: .68rem; color: #b3bac6; }
.ad-slot--leaderboard { min-height: 110px; margin: 1.6rem 0 0; }
.ad-slot--incontent { min-height: 260px; margin: 2rem 0; }
.ad-slot--modal { min-height: 250px; width: 100%; }

dialog.ad-modal {
  border: 0; border-radius: var(--r-lg); padding: 0; max-width: 380px; width: calc(100% - 2rem);
  box-shadow: var(--shadow-lg); color: var(--ink); background: var(--surface);
}
dialog.ad-modal::backdrop { background: rgba(18,21,28,.55); }
.ad-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem .6rem; border-bottom: 1px solid var(--line-soft); }
.ad-modal-head strong { font-size: .84rem; font-weight: 700; letter-spacing: .1em; color: var(--ink-mute); }
.ad-close { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 1.1rem; line-height: 1; color: var(--ink-soft); }
.ad-close:hover { background: var(--line); color: var(--ink); }
.ad-modal-body { padding: 1rem; }
.ad-modal-foot { padding: 0 1rem 1rem; }
.ad-modal-note { font-size: .82rem; color: var(--ink-soft); margin-bottom: .8rem; text-align: center; }

.ad-toast {
  position: fixed; right: 14px; bottom: 14px; z-index: 70;
  width: 260px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-lg); overflow: hidden;
  transform: translateY(150%); transition: transform .45s var(--ease-out);
}
.ad-toast.is-open { transform: translateY(0); }
.ad-toast .ad-toast-head { display: flex; align-items: center; justify-content: space-between; padding: .4rem .5rem .4rem .7rem; border-bottom: 1px solid var(--line-soft); }
.ad-toast .ad-toast-head strong { font-size: .64rem; font-weight: 700; letter-spacing: .16em; color: var(--ink-mute); }
.ad-toast .ad-slot { border: 0; border-radius: 0; min-height: 100px; }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .uses { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 720px) {
  .nav-links { display: flex; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
  .ad-slot--leaderboard { min-height: 120px; }
}
@media (min-width: 960px) {
  .tool-grid { grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); }
  .tool-preview { border-top: 0; border-left: 1px solid var(--line); }
  .uses { grid-template-columns: repeat(3, 1fr); }
  .qr-stage { min-height: 320px; }
  .viewer-3d { min-height: 340px; }
}
@media (min-width: 1280px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
}

/* =============================================================
   9. Reduced-motion - solo lo intrusivo
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spinner { animation-duration: 2.2s; }
}
