/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #faf8f4;
  --bg-alt: #f1ede4;
  --surface: #ffffff;
  --text: #201f1c;
  --text-soft: #58554e;
  --border: #e4dfd3;
  --accent: #c65a2e;
  --accent-ink: #ffffff;
  --ok: #2f7a4f;
  --bad: #b8422f;
  --warn: #a5710f;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(30, 25, 15, .08);
  --shadow-md: 0 8px 28px rgba(30, 25, 15, .10);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171613;
    --bg-alt: #1f1e1a;
    --surface: #232220;
    --text: #f2efe8;
    --text-soft: #b3ada0;
    --border: #37352f;
    --accent: #e07a4c;
    --accent-ink: #1b1109;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.12; letter-spacing: -0.01em; font-weight: 800; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--text); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 1.1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* =============================================================
   4. Typography
   ============================================================= */
h1 { font-size: clamp(1.9rem, 4.4vw, 2.9rem); max-width: 20ch; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 1.4rem; }
h3 { font-size: 1.08rem; }
.eyebrow { font-family: var(--mono); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: .6rem; }
.hero-sub { color: var(--text-soft); font-size: 1.06rem; max-width: 56ch; margin-block: .9rem 1.8rem; }

/* =============================================================
   5. Components
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .78rem 1.2rem; border-radius: 10px; font-weight: 700; font-size: .94rem;
  transition: transform .15s var(--ease-out), background .15s var(--ease-out), opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { opacity: .92; }
.btn-secondary { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; border: 1px dashed var(--border); color: var(--text-soft); font-size: .84rem; padding: .5rem .8rem; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-lg { padding: 1rem 1.8rem; font-size: 1.02rem; }
.btn-file { position: relative; overflow: hidden; }

.field-group { margin-bottom: 1.15rem; }
.field-label { display: block; font-size: .82rem; font-weight: 700; margin-bottom: .4rem; color: var(--text-soft); }
.field-input {
  width: 100%; padding: .68rem .8rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .95rem;
}
.field-input:focus { border-color: var(--accent); }
.field-input-emoji { max-width: 8rem; }
.field-hint { font-size: .8rem; color: var(--text-soft); margin-top: .4rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.field-check { display: flex; align-items: center; gap: .5rem; font-size: .88rem; margin-top: .6rem; color: var(--text-soft); }

.segmented { display: inline-flex; flex-wrap: wrap; gap: .35rem; background: var(--bg-alt); padding: .3rem; border-radius: 10px; margin-bottom: .8rem; }
.segmented button {
  padding: .5rem .9rem; border-radius: 7px; font-weight: 600; font-size: .88rem; color: var(--text-soft);
  transition: background .15s, color .15s;
}
.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented-4 button { flex: 1 1 auto; text-align: center; }

.color-row { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.color-pick { display: flex; align-items: center; gap: .6rem; font-size: .88rem; color: var(--text-soft); cursor: pointer; }
.color-pick input[type=color] { width: 42px; height: 42px; border-radius: 9px; border: 1px solid var(--border); padding: 2px; background: var(--surface); cursor: pointer; }

.emoji-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.emoji-btn { width: 42px; height: 42px; font-size: 1.25rem; border-radius: 9px; background: var(--bg-alt); border: 1px solid transparent; display: flex; align-items: center; justify-content: center; transition: border-color .15s; }
.emoji-btn.is-active { border-color: var(--accent); }
.emoji-btn:hover { border-color: var(--border); }
.center-extra-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.format-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.format-card {
  display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center;
  padding: .9rem .5rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  transition: border-color .15s, transform .15s var(--ease-out);
}
.format-card svg { width: 30px; height: 30px; color: var(--text-soft); }
.format-card span { font-weight: 700; font-size: .84rem; }
.format-card small { color: var(--text-soft); font-size: .7rem; line-height: 1.3; }
.format-card.is-active { border-color: var(--accent); }
.format-card.is-active svg { color: var(--accent); }
.format-card:hover { transform: translateY(-2px); }

.download-row { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: .4rem; }
.privacy-badge { font-size: .82rem; color: var(--text-soft); margin-top: .9rem; }

.print-warnings { margin: 1rem 0; }
.warn-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.badge { font-family: var(--mono); font-size: .72rem; font-weight: 600; padding: .3rem .55rem; border-radius: 999px; border: 1px solid var(--border); }
.badge-ok { color: var(--ok); border-color: currentColor; }
.badge-bad { color: var(--bad); border-color: currentColor; }
.warn-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.warn-item { font-size: .82rem; padding: .55rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.warn-item.warn-error { color: var(--bad); border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.warn-item.warn-warn { color: var(--warn); border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.warn-item.warn-info { color: var(--text-soft); }
.warn-ok { font-size: .82rem; color: var(--ok); font-weight: 600; }

/* =============================================================
   6. Sections
   ============================================================= */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding-block: .8rem; }
.brand { display: flex; align-items: center; gap: .5rem; }
.brand-mark { color: var(--accent); display: flex; }
.brand-name { font-weight: 800; font-size: 1.05rem; }
.brand-name span { color: var(--accent); }
.nav-toggle { display: flex; padding: .4rem; }
.site-nav { display: none; }
.site-nav a { font-size: .9rem; font-weight: 600; color: var(--text-soft); padding: .5rem; }
.site-nav a:hover { color: var(--accent); }

.hero { padding-block: 2.4rem 2.6rem; }

.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem; box-shadow: var(--shadow-md);
}
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 1.6rem; }
.tool-grid-3d { grid-template-columns: 1fr; }
.tool-col-preview { display: flex; flex-direction: column; align-items: center; }
.preview-2d-wrap { width: 100%; display: flex; justify-content: center; padding: 1rem; background: var(--bg-alt); border-radius: var(--radius-sm); }
.qr-preview { line-height: 0; }
.qr-preview canvas, .qr-preview svg { max-width: 100%; height: auto; border-radius: 6px; }
.tool-divider { border: none; border-top: 1px solid var(--border); margin: 1.8rem 0; }
.tool-3d-title { font-size: 1.15rem; margin-bottom: 1rem; }

.viewer-3d-wrap {
  position: relative; width: 100%; aspect-ratio: 4/3; border-radius: var(--radius-sm);
  background: linear-gradient(160deg, var(--bg-alt), var(--bg)); border: 1px solid var(--border); overflow: hidden;
}
.viewer-3d { position: absolute; inset: 0; touch-action: none; }
.viewer-hint, .viewer-loading { position: absolute; bottom: .6rem; left: 50%; transform: translateX(-50%); font-size: .74rem; color: var(--text-soft); background: color-mix(in srgb, var(--surface) 80%, transparent); padding: .3rem .7rem; border-radius: 999px; pointer-events: none; }
.viewer-hint { display: none; }
.viewer-loading { display: none; }
.viewer-3d-wrap[data-state="loading"] .viewer-loading { display: block; }
.viewer-3d-wrap[data-state="done"] .viewer-hint { display: block; }
.qr3d-preview-error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 1.2rem; text-align: center; font-size: .85rem; color: var(--text-soft); }

.ad-slot {
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  color: var(--text-soft); background: var(--bg-alt);
}
.ad-slot-label { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.ad-slot-banner { min-height: 90px; margin-top: 1.6rem; }
.ad-slot-incontent { min-height: 250px; margin-block: 2rem; }
.ad-slot-modal { min-height: 200px; width: 100%; margin-block: .9rem; }
.ad-slot-toast { min-height: 60px; width: 100%; }

.section { padding-block: 3rem; }
.section-alt { background: var(--bg-alt); }
.steps { display: grid; gap: 1.4rem; margin-bottom: 2.4rem; }
.step { padding: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .9rem; margin-bottom: .7rem; }
.step p { color: var(--text-soft); font-size: .92rem; margin-top: .4rem; }

.content-copy { max-width: 68ch; display: flex; flex-direction: column; gap: 1rem; color: var(--text-soft); }

.idea-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
.idea-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.2rem; }
.idea-emoji { font-size: 1.6rem; display: block; margin-bottom: .6rem; }
.idea-card p { color: var(--text-soft); font-size: .9rem; margin-top: .35rem; }

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

.cta-band { padding-block: 3.2rem; text-align: center; background: linear-gradient(160deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, black) 100%); color: #fff; }
.cta-band h2 { color: #fff; }
.cta-band p { color: color-mix(in srgb, #fff 85%, transparent); margin-block: .6rem 1.4rem; }
.cta-band .btn-primary { background: #fff; color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); padding-block: 2.2rem; background: var(--bg-alt); }
.footer-inner { display: flex; flex-direction: column; gap: 1.2rem; }
.footer-inner p { color: var(--text-soft); font-size: .85rem; margin-top: .3rem; }
.footer-nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.footer-nav a { font-size: .85rem; color: var(--text-soft); }
.footer-nav a:hover { color: var(--accent); }

/* Dialog / toast */
.ad-dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; max-width: 420px; width: calc(100% - 2rem); background: var(--surface); color: var(--text); box-shadow: var(--shadow-md); }
.ad-dialog::backdrop { background: rgba(10, 8, 5, .55); }
.ad-dialog-close { position: absolute; top: .6rem; right: .7rem; font-size: 1.3rem; width: 32px; height: 32px; border-radius: 50%; }
.ad-dialog-close:hover { background: var(--bg-alt); }
.ad-dialog .btn { width: 100%; }

.ad-toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60; width: min(260px, calc(100vw - 2rem));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .8rem; box-shadow: var(--shadow-md);
  transform: translateY(16px); opacity: 0; pointer-events: none; transition: transform .3s var(--ease-out), opacity .3s var(--ease-out);
}
.ad-toast.is-visible { transform: translateY(0); opacity: 1; pointer-events: auto; }
.ad-toast-close { position: absolute; top: .3rem; right: .4rem; font-size: 1.05rem; width: 24px; height: 24px; border-radius: 50%; }
.ad-toast-close:hover { background: var(--bg-alt); }

/* =============================================================
   7. Effects
   ============================================================= */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .idea-grid { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 720px) {
  .site-nav { display: flex; gap: .2rem; }
  .nav-toggle { display: none; }
  .field-row { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  .tool-grid { grid-template-columns: 1.15fr 1fr; align-items: start; }
  .tool-grid-3d { grid-template-columns: 1fr 1fr; }
  .idea-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-inner { flex-direction: row; justify-content: space-between; align-items: center; }
}
@media (min-width: 1280px) {
  .hero { padding-block: 3.4rem 3rem; }
}

/* Mobile nav overlay (only relevant below 720px) */
@media (max-width: 719px) {
  .site-nav {
    position: fixed; inset: 0 0 0 auto; width: min(78vw, 320px); background: var(--surface);
    flex-direction: column; padding: 5rem 1.4rem 2rem; gap: .3rem; box-shadow: var(--shadow-md);
    transform: translateX(100%); transition: transform .28s var(--ease-out); z-index: 60;
  }
  .site-nav.is-open { display: flex; transform: translateX(0); }
  .site-nav a { padding: .8rem .2rem; border-bottom: 1px solid var(--border); }
}

/* =============================================================
   9. Reduced-motion — solo lo intrusivo
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .ad-toast { transition-duration: .01s; }
}
