/* =============================================================
   QRForge — 3D-printable QR generator
   Single stylesheet, sectioned. Light + dark (prefers-color-scheme).
   ============================================================= */

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --accent:        #ff6a2b;   /* filament orange */
  --accent-600:    #e8551a;
  --accent-tint:   #fff1ea;

  --bg:            #f6f7f9;
  --surface:       #ffffff;
  --surface-2:     #f0f2f5;
  --ink:           #14181f;
  --ink-soft:      #4a5462;
  --ink-faint:     #79828f;
  --line:          #e2e6ec;
  --line-strong:   #cfd5de;
  --ok:            #1f9d55;
  --warn:          #c9720b;
  --danger:        #d33a2c;
  --danger-tint:   #fdecea;

  --radius:        16px;
  --radius-sm:     10px;
  --shadow:        0 1px 2px rgba(20,24,31,.05), 0 8px 30px rgba(20,24,31,.06);
  --shadow-lg:     0 12px 40px rgba(20,24,31,.14);

  --sans: "Manrope", "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: "Fraunces", Georgia, serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --container: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0e1116;
    --surface:     #171b22;
    --surface-2:   #1f242d;
    --ink:         #eef1f5;
    --ink-soft:    #b3bdca;
    --ink-faint:   #7f8a99;
    --line:        #2a313c;
    --line-strong: #3a424f;
    --accent-tint: #2a1a10;
    --danger-tint: #2c1613;
    --shadow:      0 1px 2px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.35);
    --shadow-lg:   0 12px 40px rgba(0,0,0,.5);
  }
}

/* =============================================================
   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;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
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, h4 { text-wrap: balance; line-height: 1.08; letter-spacing: -0.02em; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

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

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =============================================================
   3. Header
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar {
  display: flex; align-items: center; gap: 16px;
  height: 62px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.03em; font-size: 1.15rem; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-600));
  display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 900;
  box-shadow: 0 2px 8px rgba(255,106,43,.35);
}
.brand .logo svg { width: 18px; height: 18px; }
.header-spacer { flex: 1; }
.header-links { display: flex; align-items: center; gap: 6px; }
.header-links a {
  padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: .92rem; color: var(--ink-soft);
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.header-links a:hover { background: var(--surface-2); color: var(--ink); }
.lang-switch { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 999px; border: 1px solid var(--line); }
.lang-switch a { padding: 5px 11px; border-radius: 999px; font-size: .85rem; font-weight: 700; color: var(--ink-faint); }
.lang-switch a.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* =============================================================
   4. Hero + tool
   ============================================================= */
.hero { padding: 40px 0 8px; text-align: center; }
.hero .eyebrow {
  display: inline-block; font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-600); background: var(--accent-tint);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin-bottom: 12px; }
.hero h1 .grad { background: linear-gradient(120deg, var(--accent), var(--accent-600)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .sub { max-width: 620px; margin: 0 auto; color: var(--ink-soft); font-size: clamp(1rem, 2.4vw, 1.15rem); }

.tool-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-top: 28px; overflow: clip;
}
.tool-grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 960px) { .tool-grid { grid-template-columns: minmax(0,1.05fr) minmax(0,.95fr); } }

/* Controls column */
.controls { padding: 22px; border-bottom: 1px solid var(--line); }
@media (min-width: 960px) { .controls { border-bottom: 0; border-right: 1px solid var(--line); } }
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field-label { display: block; font-weight: 700; font-size: .82rem; letter-spacing: .01em; margin-bottom: 8px; color: var(--ink); }
.field-label .hint { font-weight: 500; color: var(--ink-faint); }

.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.seg button {
  padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: .9rem; color: var(--ink-soft);
  transition: background .18s var(--ease-out), color .18s var(--ease-out);
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

input[type="text"], input[type="url"], input[type="password"], textarea, select {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,106,43,.18); }
textarea { resize: vertical; min-height: 52px; }
.input-row { display: grid; gap: 10px; }
@media (min-width: 540px) { .input-row.two { grid-template-columns: 1fr 1fr; } }

/* style presets */
.style-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.style-grid button {
  padding: 10px 4px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface);
  display: grid; gap: 6px; justify-items: center; font-size: .74rem; font-weight: 600; color: var(--ink-soft);
  transition: border-color .18s var(--ease-out), transform .18s var(--ease-out);
}
.style-grid button:hover { transform: translateY(-2px); }
.style-grid button[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); }
.style-grid button svg { width: 34px; height: 34px; }

/* color pickers */
.colors-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); }
.color-pick input[type="color"] { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.color-pick input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-pick input[type="color"]::-webkit-color-swatch { border: 1px solid var(--line-strong); border-radius: 8px; }
.color-pick .cp-meta { display: flex; flex-direction: column; line-height: 1.15; }
.color-pick .cp-meta b { font-size: .82rem; }
.color-pick .cp-meta span { font-size: .72rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* center emoji / logo */
.emoji-row { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-row button { width: 40px; height: 40px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 20px; background: var(--surface); transition: border-color .15s var(--ease-out), transform .15s var(--ease-out); }
.emoji-row button:hover { transform: translateY(-2px); }
.emoji-row button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-tint); }
.center-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.btn-ghost { padding: 9px 14px; border: 1.5px solid var(--line-strong); border-radius: 10px; font-weight: 600; font-size: .86rem; color: var(--ink-soft); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--ink); }
.center-hint { font-size: .78rem; color: var(--ink-faint); }

/* Preview column */
.preview { padding: 22px; display: flex; flex-direction: column; gap: 18px; background: var(--surface-2); }
.preview-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; }
.preview-block h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin-bottom: 12px; font-weight: 700; }
.qr-holder { display: grid; place-items: center; min-height: 220px; }
.qr-holder canvas, .qr-holder svg { border-radius: 8px; }
.viewer-wrap { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; overflow: clip; background:
  radial-gradient(120% 120% at 50% 0%, var(--surface-2), var(--surface)); border: 1px dashed var(--line); }
.viewer-wrap canvas { width: 100%; height: 100%; }
.viewer-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--ink-faint); font-size: .9rem; }
.viewer-hint { text-align: center; font-size: .76rem; color: var(--ink-faint); margin-top: 8px; }

.dl-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 12px; font-weight: 700; font-size: .95rem;
  background: var(--ink); color: var(--surface); transition: transform .16s var(--ease-out), background .16s var(--ease-out), opacity .16s;
}
.btn:hover { transform: translateY(-2px); }
.btn svg { width: 18px; height: 18px; }
.btn.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-600)); color: #fff; box-shadow: 0 6px 20px rgba(255,106,43,.35); }
.btn.btn-lg { padding: 15px 22px; font-size: 1.02rem; width: 100%; }
.btn.btn-secondary { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line-strong); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-small { padding: 9px 14px; font-size: .88rem; border-radius: 10px; }

/* 3D export panel */
.export-panel { border-top: 1px solid var(--line); padding: 22px; }
.export-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.export-head h2 { font-size: 1.25rem; letter-spacing: -.02em; }
.export-head .tag { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-600)); padding: 4px 10px; border-radius: 999px; }
.export-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .export-grid { grid-template-columns: 1fr 1fr; } }

.format-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.format-grid button {
  padding: 14px 6px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface);
  display: grid; gap: 8px; justify-items: center; font-size: .78rem; font-weight: 700; color: var(--ink-soft);
  transition: border-color .18s var(--ease-out), transform .18s var(--ease-out);
}
.format-grid button:hover { transform: translateY(-2px); }
.format-grid button[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: var(--accent-tint); }
.format-grid button svg { width: 40px; height: 40px; color: var(--ink); }

.warn-list { display: grid; gap: 8px; margin: 4px 0 2px; }
.warn-item { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border-radius: 10px; font-size: .85rem; line-height: 1.4; }
.warn-item svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.warn-item.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.warn-item.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.warn-item.bad { background: var(--danger-tint); color: var(--danger); }
.metric-row { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .82rem; color: var(--ink-soft); margin-top: 6px; }
.metric-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stl-line { margin-top: 12px; font-size: .82rem; color: var(--ink-faint); text-align: center; }
.stl-line a { color: var(--accent-600); font-weight: 700; border-bottom: 1px solid currentColor; }

.privacy-badge {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 14px; font-size: .86rem; color: var(--ink-soft);
}
.privacy-badge svg { width: 16px; height: 16px; color: var(--ok); }

/* =============================================================
   5. Ad slots (placeholders only)
   ============================================================= */
.ad-slot {
  display: grid; place-items: center; text-align: center;
  border: 1.5px dashed var(--line-strong); border-radius: 12px;
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, color-mix(in srgb, var(--line) 40%, transparent) 10px, color-mix(in srgb, var(--line) 40%, transparent) 20px);
  color: var(--ink-faint); font-size: .74rem; font-weight: 700; letter-spacing: .14em;
  margin: 28px 0;
}
.ad-leaderboard { min-height: 100px; }
.ad-incontent { min-height: 250px; }
.ad-slot span { background: var(--bg); padding: 4px 12px; border-radius: 6px; }

/* corner toast ad */
.ad-toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 400;
  width: 260px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 14px 14px 14px 16px;
  transform: translateY(20px); opacity: 0; pointer-events: none;
  transition: transform .3s var(--ease-out), opacity .3s var(--ease-out);
}
.ad-toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.ad-toast .ad-mini {
  min-height: 60px; display: grid; place-items: center; border: 1.5px dashed var(--line-strong); border-radius: 10px;
  color: var(--ink-faint); font-size: .7rem; font-weight: 700; letter-spacing: .12em; margin-bottom: 4px;
}
.ad-toast .toast-label { font-size: .68rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .1em; }
.ad-toast .toast-close { position: absolute; top: 6px; right: 8px; width: 26px; height: 26px; border-radius: 8px; font-size: 18px; color: var(--ink-faint); display: grid; place-items: center; }
.ad-toast .toast-close:hover { background: var(--surface-2); color: var(--ink); }

/* download interstitial */
dialog.ad-modal {
  border: 0; border-radius: 18px; padding: 0; max-width: 460px; width: calc(100vw - 32px);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog.ad-modal::backdrop { background: rgba(10,12,16,.55); backdrop-filter: blur(2px); }
.ad-modal .modal-inner { padding: 24px; text-align: center; position: relative; }
.ad-modal h3 { font-size: 1.2rem; margin-bottom: 6px; }
.ad-modal p { color: var(--ink-soft); font-size: .92rem; margin-bottom: 16px; }
.ad-modal .ad-rect { min-height: 250px; display: grid; place-items: center; border: 1.5px dashed var(--line-strong); border-radius: 12px; color: var(--ink-faint); font-size: .74rem; font-weight: 700; letter-spacing: .14em; margin-bottom: 18px; }
.ad-modal .modal-close-x { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border-radius: 10px; font-size: 22px; color: var(--ink-faint); display: grid; place-items: center; }
.ad-modal .modal-close-x:hover { background: var(--surface-2); color: var(--ink); }

/* =============================================================
   6. Content sections
   ============================================================= */
section.block { padding: 34px 0; }
.section-title { font-size: clamp(1.5rem, 3.5vw, 2rem); text-align: center; margin-bottom: 8px; }
.section-lead { text-align: center; color: var(--ink-soft); max-width: 620px; margin: 0 auto 30px; }

.steps { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.step .num { width: 38px; height: 38px; border-radius: 11px; background: var(--accent-tint); color: var(--accent-600); display: grid; place-items: center; font-weight: 900; margin-bottom: 14px; }
.step h3 { font-size: 1.08rem; margin-bottom: 6px; }
.step p { color: var(--ink-soft); font-size: .93rem; }

.uses { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 540px) { .uses { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .uses { grid-template-columns: repeat(4, 1fr); } }
.use { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.use .ico { font-size: 26px; margin-bottom: 10px; }
.use h3 { font-size: 1rem; margin-bottom: 4px; }
.use p { color: var(--ink-soft); font-size: .88rem; }

.seo-copy { max-width: 760px; margin: 0 auto; }
.seo-copy h2 { font-size: 1.5rem; margin: 28px 0 10px; }
.seo-copy h3 { font-size: 1.15rem; margin: 22px 0 8px; }
.seo-copy p { color: var(--ink-soft); margin-bottom: 12px; }
.seo-copy ul { color: var(--ink-soft); margin: 0 0 12px 20px; }
.seo-copy li { margin-bottom: 6px; }

.faq { max-width: 760px; margin: 0 auto; display: grid; gap: 12px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 18px; }
.faq summary { list-style: none; cursor: pointer; font-weight: 700; padding: 14px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--accent-600); font-weight: 400; transition: transform .2s var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--ink-soft); padding: 0 0 16px; }

/* =============================================================
   7. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--line); padding: 30px 0; margin-top: 20px; color: var(--ink-faint); font-size: .88rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a:hover { color: var(--ink); }
.footer-note { width: 100%; margin-top: 12px; font-size: .8rem; }

/* =============================================================
   8. No-JS notice
   ============================================================= */
.nojs-note { display: none; padding: 14px 16px; border-radius: 12px; background: var(--accent-tint); color: var(--accent-600); font-weight: 600; text-align: center; margin: 16px 0; }
html.no-js .nojs-note { display: block; }
html.no-js .needs-js { opacity: .4; pointer-events: none; }

/* =============================================================
   9. Reduced motion (only intrusive)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ad-toast { transition: opacity .2s linear; transform: none; }
}
