/* =============================================================
   0. Fuentes locales (Manrope, Sora — SIL OFL 1.1)
   Servidas desde el propio dominio, sin peticiones a Google Fonts.
   ============================================================= */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("lib/fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("lib/fonts/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url("lib/fonts/sora-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url("lib/fonts/sora-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #FAF9F6;
  --surface: #FFFFFF;
  --ink: #17171C;
  --ink-soft: #4B4B55;
  --border: #E6E3DA;
  --accent: #C05B2E;
  --accent-ink: #FFFFFF;
  --accent-soft: #FCE7DB;
  --ok: #1E7B4F;
  --warn: #B4471B;
  --sans: "Manrope", system-ui, -apple-system, sans-serif;
  --display: "Sora", var(--sans);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px -12px rgba(23,23,28,.14);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121216;
    --surface: #1B1B22;
    --ink: #F4F3EF;
    --ink-soft: #B6B4C4;
    --border: #303038;
    --accent: #E37A45;
    --accent-ink: #17171C;
    --accent-soft: #3A2A22;
  }
}

/* =============================================================
   2. Reset & 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;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
input, select { font: inherit; color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; line-height: 1.12; letter-spacing: -0.01em; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 780px; }
.skip-link {
  position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem;
  background: var(--ink); color: var(--bg); z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.hint { font-size: .85rem; color: var(--ink-soft); }

/* =============================================================
   4. Header
   ============================================================= */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 40; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: .5rem; font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.logo em { font-style: normal; color: var(--accent); }
.header-nav { display: none; gap: 1.6rem; font-weight: 600; font-size: .92rem; }
.header-nav a { opacity: .8; transition: opacity .2s var(--ease-out); }
.header-nav a:hover { opacity: 1; }
@media (min-width: 720px) { .header-nav { display: flex; } }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding: 2.4rem 20px 1.4rem; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); max-width: 900px; margin: 0 auto .7rem; }
.hero-sub { color: var(--ink-soft); max-width: 620px; margin: 0 auto; font-size: 1.05rem; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-card { padding: 1rem 0 2.4rem; }
.tool-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 960px) {
  .tool-grid { grid-template-columns: 1.05fr 1fr 1.05fr; align-items: start; }
}
.tool-col {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 1.1rem;
}
.tool-col-preview { gap: 1rem; position: sticky; top: 80px; }
@media (max-width: 959px) { .tool-col-preview { position: static; } }

.field-group { display: flex; flex-direction: column; gap: .45rem; }
.field-label { font-weight: 700; font-size: .88rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
label { font-weight: 600; font-size: .85rem; color: var(--ink-soft); }
input[type="text"], select {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); font-size: .95rem;
}
input[type="text"]:focus, select:focus { border-color: var(--accent); }
input[type="color"] { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; background: var(--bg); cursor: pointer; }

.tabs { display: flex; gap: .4rem; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.tab { flex: 1; padding: .5rem .8rem; border-radius: 999px; font-weight: 700; font-size: .85rem; color: var(--ink-soft); transition: all .2s var(--ease-out); }
.tab.is-active { background: var(--ink); color: var(--bg); }

.style-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.style-opt {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .3rem;
  text-align: center; font-weight: 700; font-size: .82rem; background: var(--bg); transition: all .18s var(--ease-out);
}
.style-opt.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: .3rem; }
.emoji-opt { font-size: 1.2rem; padding: .35rem 0; border-radius: var(--radius-sm); border: 1px solid transparent; }
.emoji-opt.is-active { border-color: var(--accent); background: var(--accent-soft); }
.logo-upload-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

.format-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.format-opt {
  display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .7rem .3rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .78rem; font-weight: 700; background: var(--bg);
}
.format-opt.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.format-icon { font-size: 1.3rem; }

.color-presets { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .3rem; }
.color-preset { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); position: relative; overflow: hidden; }
.color-preset::before, .color-preset::after { content: ""; position: absolute; inset: 0; }
.color-preset::before { clip-path: polygon(0 0, 100% 0, 0 100%); }
.color-preset::after { clip-path: polygon(100% 0, 100% 100%, 0 100%); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .75rem 1.1rem; border-radius: var(--radius-sm); font-weight: 700; font-size: .92rem; transition: transform .15s var(--ease-out), opacity .15s var(--ease-out); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { opacity: .92; }
.btn-secondary { background: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--border); }
.btn-small { padding: .5rem .8rem; font-size: .82rem; }
.btn-big { width: 100%; padding: .95rem; font-size: 1rem; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 140px; }

.privacy-badge { font-size: .82rem; color: var(--ink-soft); background: var(--bg); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: .6rem .7rem; }

.preview-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem; }
.preview-label { display: block; font-size: .78rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .5rem; }
.qr-preview { display: flex; align-items: center; justify-content: center; min-height: 240px; }
.qr-preview canvas, .qr-preview img { max-width: 100%; height: auto; border-radius: 6px; }

.qr3d-preview { position: relative; min-height: 260px; border-radius: 6px; overflow: hidden; background: linear-gradient(180deg, #e9e5da, #d8d3c4); }
@media (prefers-color-scheme: dark) { .qr3d-preview { background: linear-gradient(180deg, #24242c, #16161b); } }
.qr3d-preview canvas { width: 100%; height: 100%; touch-action: none; cursor: grab; }
.qr3d-preview canvas:active { cursor: grabbing; }
.qr3d-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .85rem; color: var(--ink-soft); text-align: center; padding: 1rem; }
.qr3d-placeholder[hidden] { display: none; }

.print-warnings { margin-top: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.warning-line { font-size: .82rem; padding: .5rem .65rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); }
.warning-line.is-ok { color: var(--ok); border-color: var(--ok); }
.warning-line.is-bad { color: var(--warn); border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--bg)); }

/* =============================================================
   7. Ad slots
   ============================================================= */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  color: var(--ink-soft); font-weight: 700; font-size: .8rem; letter-spacing: .08em;
  background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 10px, var(--bg) 10px, var(--bg) 20px);
}
.ad-slot-banner { min-height: 90px; margin: 1.6rem 0; }
.ad-slot-incontent { min-height: 250px; max-width: 728px; margin: 2rem auto; }
.ad-slot-popup { min-height: 200px; margin: 1rem 0; }
.ad-slot-corner { min-height: 100px; width: 260px; }

.corner-toast { position: fixed; bottom: 16px; right: 16px; z-index: 60; }
.corner-toast-close {
  position: absolute; top: -10px; right: -10px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); color: var(--bg); font-size: 1rem; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}

.download-dialog {
  border: none; border-radius: var(--radius); padding: 1.4rem; max-width: 380px; width: 92vw;
  box-shadow: var(--shadow); position: relative; background: var(--surface); color: var(--ink);
}
.download-dialog::backdrop { background: rgba(0,0,0,.5); }
.dialog-eyebrow { font-weight: 700; margin-bottom: .8rem; }
.dialog-close { position: absolute; top: .6rem; right: .6rem; width: 30px; height: 30px; border-radius: 50%; font-size: 1.1rem; }
#dialog-continue { width: 100%; margin-top: 1rem; }

/* =============================================================
   8. Content sections
   ============================================================= */
.section { padding: 2.6rem 0; }
.section h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 1.4rem; text-align: center; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-seo p { color: var(--ink-soft); margin-bottom: 1rem; }
.section-seo p:last-child { margin-bottom: 0; }

/* Páginas legales (aviso legal, privacidad, cookies) */
.legal-content { padding-top: .4rem; }
.legal-content h1 { margin-bottom: .4rem; }
.legal-content > .hint { margin-bottom: 1.6rem; }
.legal-content h2 { font-size: 1.15rem; margin: 2rem 0 .7rem; text-align: left; }
.legal-content h2:first-of-type { margin-top: 1.6rem; }
.legal-content p { color: var(--ink-soft); margin-bottom: .9rem; line-height: 1.65; }
.legal-content ul { color: var(--ink-soft); margin: 0 0 .9rem 1.3rem; padding: 0; line-height: 1.65; }
.legal-content li { margin-bottom: .35rem; }
.legal-content strong { color: var(--ink); }
.legal-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.legal-content .legal-address { color: var(--ink-soft); font-style: normal; margin-bottom: 1.4rem; }

.steps-grid { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; margin-bottom: .8rem; }
.step-card h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.step-card p { color: var(--ink-soft); font-size: .92rem; }

.ideas-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .ideas-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .ideas-grid { grid-template-columns: repeat(3, 1fr); } }
.idea-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.idea-emoji { font-size: 1.6rem; margin-bottom: .5rem; display: block; }
.idea-card h3 { font-size: 1rem; margin-bottom: .35rem; }
.idea-card p { color: var(--ink-soft); font-size: .88rem; }

details.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1rem; margin-bottom: .6rem; }
details.faq-item summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::after { content: "+"; font-size: 1.2rem; color: var(--accent); flex-shrink: 0; }
details.faq-item[open] summary::after { content: "–"; }
details.faq-item p { margin-top: .6rem; color: var(--ink-soft); font-size: .92rem; }

/* =============================================================
   9. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); padding: 1.6rem 0 2.4rem; background: var(--surface); }
.footer-inner { display: flex; flex-direction: column; gap: .5rem; align-items: center; text-align: center; font-size: .85rem; color: var(--ink-soft); }
.footer-links { display: flex; gap: 1rem; font-weight: 600; }
.footer-credits { font-size: .75rem; opacity: .7; }

/* =============================================================
   10. Reduced motion — only intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
