/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f7f8fb;
  --bg-alt: #ffffff;
  --text: #1a1d29;
  --text-muted: #5b6072;
  --border: #e2e4ec;
  --accent: #4b3df6;
  --accent-dark: #372cc9;
  --accent-contrast: #ffffff;
  --success-bg: #eefaf1;
  --success-border: #b6e8c4;
  --success-text: #14532d;
  --error-bg: #fdecec;
  --error-border: #f3b7b7;
  --error-text: #7a1f1f;
  --info-bg: #eef1ff;
  --info-border: #c9cffb;
  --info-text: #2c2a63;
  --ad-bg: #f0f1f5;
  --ad-border: #cdd0dc;
  --ad-text: #8a8fa3;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 2px rgba(20, 20, 43, 0.04), 0 12px 32px -16px rgba(20, 20, 43, 0.16);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --container: 780px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101018;
    --bg-alt: #191924;
    --text: #f2f2f7;
    --text-muted: #a3a6b8;
    --border: #2c2d3c;
    --accent: #8b7bff;
    --accent-dark: #a595ff;
    --accent-contrast: #101018;
    --success-bg: #10261a;
    --success-border: #235c37;
    --success-text: #8fe3ab;
    --error-bg: #2c1414;
    --error-border: #6b2c2c;
    --error-text: #f5a3a3;
    --info-bg: #1c1f3d;
    --info-border: #3a3f7a;
    --info-text: #c3c7ff;
    --ad-bg: #191924;
    --ad-border: #33344a;
    --ad-text: #6b6f85;
  }
}

/* =============================================================
   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;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; }
::selection { background: var(--accent); color: var(--accent-contrast); }
: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(--accent); color: var(--accent-contrast);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 1.25rem; }
.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;
}
.section { padding-block: clamp(2.4rem, 6vw, 4.2rem); }
.section-head { max-width: 62ch; margin-bottom: 1.75rem; }
.section-head h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: .5rem; }
.section-head p { color: var(--text-muted); font-size: 1.02rem; }

/* =============================================================
   4. Typography
   ============================================================= */
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent);
}

/* =============================================================
   5. Components
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.4rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .98rem;
  transition: transform .15s var(--ease-out), background-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.btn-primary {
  background: var(--accent); color: var(--accent-contrast);
  box-shadow: 0 6px 18px -6px rgba(75, 61, 246, 0.55);
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-reset {
  margin-top: 1rem; font-size: .92rem; font-weight: 600; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: .35rem;
}
.btn-reset:hover { color: var(--accent); text-decoration: none; }

.btn-copy {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-alt);
  font-size: .88rem; font-weight: 600; color: var(--text);
  transition: border-color .15s var(--ease-out), color .15s var(--ease-out);
  flex-shrink: 0;
}
.btn-copy:hover { border-color: var(--accent); color: var(--accent); }
.btn-copy.is-copied { border-color: var(--success-border); color: var(--success-text); }

.card {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}

/* Ad slot placeholders */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  background: var(--ad-bg); border: 1px dashed var(--ad-border);
  border-radius: var(--radius-md); color: var(--ad-text);
  font-size: .82rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  margin-inline: auto;
}
.ad-slot--banner { min-height: 90px; width: 100%; max-width: 728px; }
.ad-slot--rect { min-height: 250px; width: 100%; max-width: 336px; }
.ad-slot-label { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.ad-slot-label small { font-weight: 500; text-transform: none; letter-spacing: 0; opacity: .75; }

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding-block: 1.1rem;
}
.faq-item:first-child { padding-top: 0; }
.faq-item summary {
  cursor: pointer; font-weight: 600; font-size: 1.02rem;
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; font-size: 1.4rem; font-weight: 400; color: var(--accent);
  flex-shrink: 0; transition: transform .2s var(--ease-out);
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin-top: .75rem; color: var(--text-muted); }

/* =============================================================
   6. Sections
   ============================================================= */

/* Header */
.site-header {
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.logo { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff;
  font-family: var(--mono); font-size: .68rem; font-weight: 700; letter-spacing: -0.03em;
}
.header-tag { font-size: .85rem; color: var(--text-muted); display: none; }

/* Hero + tool */
.hero { padding-block: clamp(2.2rem, 6vw, 3.4rem) 0; }
.hero h1 { font-size: clamp(1.7rem, 4.4vw, 2.6rem); max-width: 22ch; margin-bottom: .65rem; }
.hero-sub { color: var(--text-muted); font-size: 1.08rem; max-width: 56ch; margin-bottom: 1.75rem; }

.tool-card { padding: clamp(1.25rem, 4vw, 2rem); margin-bottom: 1.1rem; }

.direction-toggle {
  display: flex; gap: .5rem; padding: .3rem; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 1.4rem;
}
.dir-btn {
  flex: 1 1 0; padding: .65rem .5rem; border-radius: calc(var(--radius-md) - 4px);
  font-weight: 700; font-size: .92rem; color: var(--text-muted); text-align: center;
  transition: background-color .18s var(--ease-out), color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.dir-btn.is-active { background: var(--bg-alt); color: var(--accent); box-shadow: var(--shadow-card); }

.tool-label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: .5rem; }
.input-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.input-row input {
  flex: 1 1 220px; min-width: 0;
  padding: .9rem 1rem; font-size: 1.15rem; font-family: var(--mono);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-alt); color: var(--text);
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.input-row input:focus-visible {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.field-hint { margin-top: .55rem; font-size: .85rem; color: var(--text-muted); }

.tool-result { margin-top: 1.3rem; animation: resultIn .25s var(--ease-out); }
@keyframes resultIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.result-box {
  display: flex; align-items: flex-start; gap: .8rem;
  padding: 1.1rem 1.2rem; border-radius: var(--radius-md); border: 1.5px solid;
}
.result-icon { font-size: 1.3rem; line-height: 1; flex-shrink: 0; }

.result-error { background: var(--error-bg); border-color: var(--error-border); color: var(--error-text); }
.result-error p { font-weight: 600; }

.result-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.result-info-title { font-weight: 700; margin-bottom: .3rem; }
.result-info-sub { font-size: .92rem; opacity: .9; }

.result-success {
  background: var(--success-bg); border-color: var(--success-border); color: var(--success-text);
  flex-direction: column; align-items: stretch; gap: .6rem;
}
.result-caption { font-size: .95rem; }
.result-caption strong { font-family: var(--mono); }
.result-number-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.result-number {
  font-family: var(--mono); font-size: clamp(1.5rem, 5vw, 2.1rem); font-weight: 700;
  word-break: break-all; color: var(--text);
}

.privacy-note {
  display: flex; align-items: flex-start; gap: .55rem;
  font-size: .88rem; color: var(--text-muted); max-width: 56ch;
}
.privacy-note strong { color: var(--text); }

/* How it works */
.steps { list-style: none; display: grid; gap: 1.1rem; counter-reset: step; }
.step { display: flex; gap: 1rem; align-items: flex-start; }
.step-num {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  background: var(--info-bg); color: var(--accent); font-weight: 800; font-family: var(--mono);
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.step h3 { font-size: 1.05rem; margin-bottom: .25rem; }
.step p { color: var(--text-muted); font-size: .96rem; }

/* SEO copy */
.seo-copy p { color: var(--text-muted); margin-bottom: 1rem; }
.seo-copy p:last-child { margin-bottom: 0; }
.seo-copy strong { color: var(--text); }

/* Use ideas */
.use-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.use-card {
  padding: 1.25rem; border-radius: var(--radius-md);
  background: var(--bg-alt); border: 1px solid var(--border);
}
.use-card .use-icon { font-size: 1.4rem; margin-bottom: .5rem; display: block; }
.use-card h3 { font-size: 1rem; margin-bottom: .3rem; }
.use-card p { color: var(--text-muted); font-size: .92rem; }

/* FAQ section wrapper */
.faq-list { max-width: 68ch; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding-block: 1.75rem; margin-top: 1rem; }
.footer-inner { display: flex; flex-direction: column; gap: .9rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .88rem; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: .82rem; color: var(--text-muted); }

/* Legal skeleton pages */
.legal-page { padding-block: 2.5rem 4rem; }
.legal-page h1 { font-size: 1.7rem; margin-bottom: 1rem; }
.legal-page h2 { font-size: 1.15rem; margin-top: 1.6rem; margin-bottom: .5rem; }
.legal-page p, .legal-page li { color: var(--text-muted); margin-bottom: .7rem; }
.legal-page .back-link { display: inline-block; margin-bottom: 1.5rem; font-weight: 600; }

/* No-JS notice (only rendered inside <noscript>, so no JS-based toggling needed) */
.no-js-notice {
  padding: 1rem 1.2rem; border-radius: var(--radius-md);
  background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info-text);
  font-size: .92rem; margin-bottom: 1.1rem;
}

/* =============================================================
   7. Effects
   ============================================================= */
.dir-btn, .btn-copy, .btn-primary { will-change: transform; }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .use-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (min-width: 720px) {
  .header-tag { display: block; }
  .use-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
  .hero h1 { max-width: 26ch; }
}

/* =============================================================
   9. Reduced-motion — only the truly intrusive
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .tool-result { animation: none; }
}
