/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --text: #1b1b22;
  --text-muted: #5c5a66;
  --border: #e4e2da;
  --accent: #2d6a4f;
  --accent-ink: #ffffff;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --radius: 14px;
  --radius-sm: 8px;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --container: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14141a;
    --surface: #1d1d25;
    --text: #f2f1ec;
    --text-muted: #a6a4b3;
    --border: #2c2b36;
    --accent: #4caf82;
    --accent-ink: #0d1210;
    --danger-bg: #3a1a18;
  }
}

/* =============================================================
   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 {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
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, h4 { text-wrap: balance; line-height: 1.1; letter-spacing: -0.01em; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 1.25rem; }

.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;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* =============================================================
   4. Header / footer
   ============================================================= */
.site-header { border-bottom: 1px solid var(--border); }
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 1rem;
}
.brand {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em;
}
.brand-mark { color: var(--accent); font-size: 1.3rem; }
.header-nav { display: flex; gap: 1.5rem; font-size: .92rem; font-weight: 500; }
.header-nav a { color: var(--text-muted); transition: color .2s var(--ease-out); }
.header-nav a:hover { color: var(--text); }

.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding-block: 1.5rem; }
.footer-row {
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between;
  font-size: .88rem; color: var(--text-muted);
}
.footer-row nav { display: flex; gap: 1.25rem; }
.footer-row a { text-decoration: underline; text-underline-offset: 3px; }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding-block: 2.25rem 1.25rem; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 4.2vw, 2.6rem); max-width: 22ch; margin-inline: auto; }
.hero-sub { margin-top: .75rem; color: var(--text-muted); font-size: 1.05rem; max-width: 46ch; margin-inline: auto; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-wrap { padding-block: .5rem 1.5rem; }

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px -20px rgba(0,0,0,.25);
}

.tool-noscript { display: none; }
body:not(.is-ready) .tool-noscript {
  display: block; padding: 1rem; border-radius: var(--radius-sm);
  background: var(--danger-bg); color: var(--danger); font-weight: 600; margin-bottom: 1rem;
}
body:not(.is-ready) .tool-grid { display: none; }

.tool-grid { display: grid; gap: 1.75rem; }

.field-group { margin-bottom: 1.1rem; }
.field-group:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-muted); margin-bottom: .4rem; }

.seg-control { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg-btn {
  padding: .5rem .85rem; border: 1px solid var(--border); border-radius: 999px;
  font-size: .86rem; font-weight: 600; color: var(--text-muted);
  background: var(--bg); transition: all .18s var(--ease-out);
}
.seg-btn:hover { color: var(--text); border-color: var(--accent); }
.seg-btn.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.mode-panel { display: none; margin-top: 1rem; }
.mode-panel.is-active { display: grid; gap: .8rem; }

.field { display: block; }
.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field select {
  width: 100%; margin-top: .35rem; padding: .65rem .8rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-size: .95rem;
  transition: border-color .18s var(--ease-out);
}
.field input:focus, .field select:focus { border-color: var(--accent); }

.field-row { display: flex; gap: 1rem; margin-top: 1.1rem; }
.field--color { flex: 1; }
.field--color input[type="color"] {
  width: 100%; height: 42px; margin-top: .35rem; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
  cursor: pointer;
}

.logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.emoji-picker { display: flex; gap: .3rem; flex-wrap: wrap; }
.emoji-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); transition: all .18s var(--ease-out);
}
.emoji-btn:hover { border-color: var(--accent); }
.emoji-btn.is-active { border-color: var(--accent); background: var(--accent); }

.contrast-warning {
  margin-top: 1rem; padding: .65rem .8rem; border-radius: var(--radius-sm);
  background: var(--danger-bg); color: var(--danger); font-size: .85rem; font-weight: 600;
}

.tool-result { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; }
.qr-preview {
  width: min(260px, 100%); aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--bg); overflow: hidden;
}
.qr-preview canvas, .qr-preview img { display: block; max-width: 100%; max-height: 100%; }
.qr-empty-hint { color: var(--text-muted); font-size: .88rem; max-width: 26ch; }

.result-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.download-feedback { font-size: .85rem; font-weight: 600; color: var(--accent); min-height: 1.2em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .75rem 1.3rem; border-radius: var(--radius-sm); font-weight: 700; font-size: .95rem;
  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--secondary { background: var(--text); color: var(--bg); }
.btn--ghost { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn--sm { padding: .5rem .9rem; font-size: .85rem; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.privacy-badge { margin-top: 1.4rem; font-size: .88rem; color: var(--text-muted); text-align: center; }
.tool-limits { margin-top: .4rem; font-size: .8rem; color: var(--text-muted); text-align: center; }

@media (min-width: 720px) {
  .tool-grid { grid-template-columns: 1.1fr 0.9fr; align-items: start; }
  .tool-result { position: sticky; top: 1.5rem; }
}

/* =============================================================
   7. Ad slots
   ============================================================= */
.ad-slot {
  margin-block: 1.5rem; min-height: 90px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: .8rem;
}
.ad-slot-label { text-transform: uppercase; letter-spacing: .08em; }

/* =============================================================
   8. Content sections
   ============================================================= */
.content-block { padding-block: 2rem; max-width: 74ch; margin-inline: auto; }
.content-block h2 { font-size: clamp(1.25rem, 2.6vw, 1.55rem); margin-top: 2rem; margin-bottom: .8rem; }
.content-block h2:first-child { margin-top: 0; }
.content-block p { margin-bottom: .9rem; color: var(--text-muted); }

.steps { list-style: none; display: grid; gap: 1rem; padding: 0; }
.steps li { display: flex; gap: .9rem; align-items: flex-start; }
.step-num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem;
}
.steps strong { color: var(--text); }

.tips-list { padding-left: 1.2rem; color: var(--text-muted); display: grid; gap: .5rem; }

.faq-list { display: grid; gap: .6rem; }
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); padding: .2rem .9rem;
}
.faq-item summary {
  cursor: pointer; padding: .8rem 0; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.2rem; color: var(--text-muted); flex: none; }
.faq-item[open] summary::after { content: "–"; }
.faq-item p { padding-bottom: .9rem; color: var(--text-muted); margin: 0; }

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