/* ===== QR-Gen base styles ===== */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #111827;
  --ink-soft: #4b5563;
  --line: #e5e7eb;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(17, 24, 39, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
}

.container {
  width: min(1080px, 100% - 2rem);
  margin-inline: auto;
}

a { color: var(--brand); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--brand);
  color: #fff;
  padding: .5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ===== Header ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: .85rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  font-size: .95rem;
}
.nav a {
  color: var(--ink-soft);
  text-decoration: none;
}
.nav a:hover { color: var(--brand); }

/* ===== Hero ===== */
.hero {
  padding: 2.4rem 0 1.2rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.25;
  margin: 0 0 .7rem;
}
.hero-sub {
  max-width: 720px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* ===== Tool card ===== */
.tool-section { padding: 1.2rem 0 .5rem; }

.tool-card {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.8rem;
}

.field-label {
  display: block;
  font-weight: 600;
  margin-bottom: .4rem;
}

.input-row {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}

.input-row input {
  flex: 1 1 240px;
  min-width: 0;
  padding: .75rem .9rem;
  font-size: 1rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.input-row input:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}
.input-row input.invalid { border-color: #dc2626; }

.options-row {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.opt {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .9rem;
  color: var(--ink-soft);
}
.opt select {
  padding: .5rem .6rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: .95rem;
  color: var(--ink);
}

.samples {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
  font-size: .9rem;
  color: var(--ink-soft);
}
.chip {
  border: 1px solid var(--line);
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: .25rem .8rem;
  font-size: .85rem;
  cursor: pointer;
}
.chip:hover { background: #e0e7ff; }

/* ===== Preview ===== */
.tool-preview-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .7rem;
}

.preview-frame {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .8rem;
  width: min(280px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.preview-frame canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.preview-caption {
  margin: 0;
  font-size: .85rem;
  color: var(--ink-soft);
  max-width: 320px;
  text-align: center;
  word-break: break-all;
}

.downloads {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
  justify-content: center;
}

.status {
  min-height: 1.3em;
  margin: 0;
  font-size: .9rem;
  color: #dc2626;
}
.status.ok { color: #16a34a; }

.privacy-note {
  margin: 0;
  font-size: .82rem;
  color: var(--ink-soft);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .7rem 1.15rem;
  font-size: .95rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.btn:hover:not(:disabled) { background: var(--brand-soft); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }

/* ===== Ad slots: reserved height avoids CLS, hidden until approved ===== */
.ad-slot {
  min-height: 100px;
  margin: 1.6rem 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  overflow: hidden;
}
.ad-slot ins { width: 100%; }

/* Placeholder state (no real AdSense ID yet): js/app.js adds the ads-preview
   class so the reserved slots show as dashed boxes — sizes stay visible while
   the AdSense script itself is never loaded. */
body.ads-preview .ad-slot {
  border: 2px dashed #c7cbd6;
  background: repeating-linear-gradient(45deg, #fafbff, #fafbff 10px, #f1f3f9 10px, #f1f3f9 20px);
}
body.ads-preview .ad-slot::before {
  content: 'Ad slot — reserved space (placeholder). Set your AdSense IDs to serve real ads.';
  font-size: .85rem;
  color: #6b7280;
  text-align: center;
  padding: 0 1rem;
  max-width: 34ch;
}

/* ===== Content sections ===== */
.features, .howto, .faq, .seo-blurb {
  padding: 2.2rem 0 .4rem;
}
.features h2, .howto h2, .faq h2, .seo-blurb h2 {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  margin: 0 0 1.1rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
}
.feature-card h3 {
  margin: 0 0 .5rem;
  font-size: 1.05rem;
}
.feature-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: .95rem;
}

.steps {
  margin: 0;
  padding-left: 1.3rem;
}
.steps li { margin-bottom: .7rem; }

.faq h3 {
  font-size: 1.08rem;
  margin: 1.4rem 0 .4rem;
}
.faq p {
  margin: 0;
  color: var(--ink-soft);
}

.seo-blurb p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 820px;
}

/* ===== Footer ===== */
.site-footer {
  margin-top: 2.4rem;
  background: var(--ink);
  color: #d1d5db;
  padding: 1.6rem 0;
  font-size: .9rem;
}
.site-footer a { color: #c7d2fe; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.footer-inner p { margin: 0; }
.footer-nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-nav a { text-decoration: none; }

/* ===== Responsive ===== */
@media (max-width: 820px) {
  .tool-card {
    grid-template-columns: 1fr;
    padding: 1.3rem;
  }
  .tool-preview-area { order: -1; }
  .header-inner { flex-direction: column; align-items: flex-start; gap: .4rem; }
}

@media (max-width: 480px) {
  .downloads .btn { flex: 1 1 100%; }
  .hero { padding-top: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}

