/* ═══════════════════════════════════════════════════════════════
   ریلزی — قالب مشترک صفحات ابزار (Tools Template)
   دو تم روشن/تیره · RTL · بدون وابستگی خارجی · بهینه برای سرعت
   نسخه: 1.0.0  (برای تغییر: نسخه‌ی query در HTML را هم ببر)
   ═══════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}

/* ─── توکن‌های تم تیره (پیش‌فرض برند) ─── */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0914;
  --bg-soft: #100d1d;
  --surface: #151126;
  --surface-2: #1c1732;
  --surface-3: #241d40;
  --line: rgba(244, 241, 255, 0.09);
  --line-strong: rgba(244, 241, 255, 0.16);
  --text: #f5f2ff;
  --text-2: #cfc9e8;
  --muted: #9b94bc;
  --purple: #8a3dff;
  --pink: #e934ac;
  --orange: #ff8a3c;
  --ok: #3ddc97;
  --danger: #ff5c7a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.3);
  --glass: rgba(21, 17, 38, 0.72);
  --focus: rgba(138, 61, 255, 0.55);
}

/* ─── توکن‌های تم روشن ─── */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #faf9ff;
  --bg-soft: #f2effe;
  --surface: #ffffff;
  --surface-2: #f5f2fd;
  --surface-3: #ede9fb;
  --line: rgba(23, 18, 43, 0.1);
  --line-strong: rgba(23, 18, 43, 0.2);
  --text: #17122b;
  --text-2: #3d3560;
  --muted: #5f5787;
  --purple: #7325e8;
  --pink: #d11f95;
  --orange: #e56a1f;
  --ok: #0e9f6e;
  --danger: #e0244c;
  --shadow: 0 24px 60px rgba(52, 33, 110, 0.14);
  --shadow-sm: 0 6px 20px rgba(52, 33, 110, 0.09);
  --glass: rgba(255, 255, 255, 0.82);
  --focus: rgba(115, 37, 232, 0.45);
  --grad: linear-gradient(120deg, #7325e8, #d11f95 50%, #e56a1f);
}

:root {
  --grad: linear-gradient(120deg, var(--purple), var(--pink) 50%, var(--orange));
  --font: "Vazirmatn", ui-sans-serif, system-ui, "Segoe UI", Tahoma, sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --wrap: 1140px;
}

/* ─── ریست و پایه ─── */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.9;
  font-size: 16px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(700px 420px at 88% -8%, rgba(138, 61, 255, 0.16), transparent 62%),
    radial-gradient(620px 380px at 6% 4%, rgba(233, 52, 172, 0.1), transparent 60%),
    radial-gradient(760px 500px at 50% 108%, rgba(255, 138, 60, 0.07), transparent 62%);
}
:root[data-theme="light"] body::before {
  background:
    radial-gradient(700px 420px at 88% -8%, rgba(115, 37, 232, 0.09), transparent 62%),
    radial-gradient(620px 380px at 6% 4%, rgba(209, 31, 149, 0.06), transparent 60%),
    radial-gradient(760px 500px at 50% 108%, rgba(229, 106, 31, 0.05), transparent 62%);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: rgba(138, 61, 255, 0.35); color: var(--text); }

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

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 22px; }

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ─── هدر ─── */
.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--glass);
  border-bottom: 1px solid var(--line);
}
.nav-in {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 66px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.15rem; letter-spacing: -0.01em; }
.logo svg { width: 30px; height: 30px; flex: none; }
.nav-links { display: flex; gap: 26px; margin-inline-start: auto; }
.nav-links a {
  font-size: 0.92rem;
  color: var(--muted);
  position: relative;
  padding-block: 4px;
  transition: color 0.25s;
}
.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  inset-inline-start: 0;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
  transition: width 0.3s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after { width: 100%; }
.nav-links a[aria-current="page"] { color: var(--text); font-weight: 700; }

.nav-actions { display: flex; align-items: center; gap: 10px; }

/* دکمه تم */
.theme-btn {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.25s, background 0.25s;
}
.theme-btn:hover { transform: rotate(-18deg) scale(1.06); border-color: var(--purple); }
.theme-btn svg { width: 19px; height: 19px; stroke: var(--text-2); }
:root[data-theme="dark"] .theme-btn .icon-sun { display: block; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: none; }
:root[data-theme="light"] .theme-btn .icon-sun { display: none; }
:root[data-theme="light"] .theme-btn .icon-moon { display: block; }

/* ─── دکمه‌ها ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 999px;
  padding: 13px 30px;
  font-weight: 800;
  font-size: 0.98rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.25s, filter 0.25s, background 0.25s, opacity 0.2s;
  white-space: nowrap;
}
.btn-solid {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 12px 34px rgba(138, 61, 255, 0.32);
}
.btn-solid:hover { transform: translateY(-2px); filter: brightness(1.07); }
.btn-solid:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--purple); }
.btn-sm { padding: 9px 20px; font-size: 0.88rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; filter: none; }

/* ─── هیرو ─── */
.hero { padding: clamp(46px, 7vw, 84px) 0 clamp(26px, 4vw, 44px); text-align: center; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 22px;
}
.badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 0 4px rgba(138, 61, 255, 0.2);
}
.hero h1 {
  font-size: clamp(1.85rem, 4.6vw, 3.2rem);
  line-height: 1.45;
  font-weight: 900;
  letter-spacing: -0.02em;
  max-width: 880px;
  margin-inline: auto;
}
.hero .sub {
  color: var(--muted);
  font-size: clamp(0.98rem, 1.7vw, 1.14rem);
  max-width: 660px;
  margin: 18px auto 0;
  line-height: 2.1;
}
.hero-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  margin-top: 24px;
  color: var(--text-2);
  font-size: 0.88rem;
}
.hero-facts span { display: inline-flex; align-items: center; gap: 7px; }
.hero-facts b { color: var(--ok); font-size: 1.05rem; }

/* ─── کارت ابزار ─── */
.tool {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-block: 18px 46px;
  position: relative;
}
.tool::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 3px;
  background: var(--grad);
}
.tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.tool-head h2 { font-size: 1.05rem; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.counter {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 15px;
  white-space: nowrap;
}
.counter b { color: var(--purple); }
:root[data-theme="light"] .counter b { color: var(--purple); }
.tool-body { padding: 26px; }

.field-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-2);
  margin-bottom: 9px;
}
.field-hint { font-weight: 500; color: var(--muted); font-size: 0.8rem; }

.input,
.textarea,
.select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 1rem;
  line-height: 1.9;
  transition: border-color 0.22s, box-shadow 0.22s, background 0.22s;
}
:root[data-theme="light"] .input,
:root[data-theme="light"] .textarea,
:root[data-theme="light"] .select { background: var(--surface-2); }
.input::placeholder,
.textarea::placeholder { color: var(--muted); opacity: 0.75; }
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 4px var(--focus);
}
.textarea { resize: vertical; min-height: 96px; }

.tone-chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 8px; }
.chip {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: 8px 17px;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { border-color: var(--purple); color: var(--text); transform: translateY(-1px); }
.chip[aria-pressed="true"] {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(138, 61, 255, 0.3);
}

.tool-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
.tool-note { color: var(--muted); font-size: 0.8rem; }

/* ─── وضعیت‌ها ─── */
.state {
  display: none;
  margin-top: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 26px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}
.state.show { display: block; }
.state strong { color: var(--text); }

.spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid var(--line-strong);
  border-top-color: var(--purple);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── نتایج ─── */
.results { display: grid; gap: 16px; margin-top: 26px; }
.results:empty { display: none; }
.result-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.result-card:nth-child(2) { animation-delay: 0.08s; }
.result-card:nth-child(3) { animation-delay: 0.16s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.result-num {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--purple);
  background: rgba(138, 61, 255, 0.13);
  border: 1px solid rgba(138, 61, 255, 0.3);
  border-radius: 999px;
  padding: 3px 12px;
}
:root[data-theme="light"] .result-num { background: rgba(115, 37, 232, 0.08); border-color: rgba(115, 37, 232, 0.25); }
.copy-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--text-2);
  border-radius: 999px;
  padding: 6px 15px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover { border-color: var(--purple); color: var(--text); }
.copy-btn.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.result-text {
  font-size: 0.96rem;
  line-height: 2.25;
  white-space: pre-wrap;
  color: var(--text);
}
.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
}
.result-tags span {
  font-size: 0.78rem;
  color: var(--purple);
  background: rgba(138, 61, 255, 0.1);
  border-radius: 8px;
  padding: 3px 10px;
  font-weight: 700;
}
:root[data-theme="light"] .result-tags span { color: var(--purple); background: rgba(115, 37, 232, 0.07); }

/* ─── بنر سقف (CTA ثبت‌نام) ─── */
.limit-cta {
  display: none;
  margin-top: 24px;
  border: 1px solid rgba(233, 52, 172, 0.35);
  background: linear-gradient(135deg, rgba(138, 61, 255, 0.12), rgba(233, 52, 172, 0.1));
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
:root[data-theme="light"] .limit-cta {
  background: linear-gradient(135deg, rgba(115, 37, 232, 0.07), rgba(209, 31, 149, 0.06));
}
.limit-cta.show { display: block; }
.limit-cta h3 { font-size: 1.08rem; font-weight: 900; margin-bottom: 8px; }
.limit-cta p { color: var(--text-2); font-size: 0.9rem; margin-bottom: 16px; line-height: 2; }

/* ─── بخش محتوا (سئو) ─── */
.section { padding: clamp(34px, 5vw, 58px) 0; }
.section-alt { background: var(--bg-soft); border-block: 1px solid var(--line); }
.section h2 {
  font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  font-weight: 900;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}
.section .lead { color: var(--muted); max-width: 720px; margin-bottom: 30px; line-height: 2.2; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform 0.28s, border-color 0.28s, box-shadow 0.28s;
}
.card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.card .ico {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--grad);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  margin-bottom: 15px;
  box-shadow: 0 10px 24px rgba(138, 61, 255, 0.28);
}
.card h3 { font-size: 1.03rem; font-weight: 800; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 0.9rem; line-height: 2.1; }

/* مراحل */
.steps { counter-reset: step; display: grid; gap: 16px; }
.step {
  display: flex;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  align-items: flex-start;
}
.step::before {
  counter-increment: step;
  content: counter(step);
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-weight: 900;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  box-shadow: 0 10px 22px rgba(138, 61, 255, 0.3);
}
.step h3 { font-size: 1rem; font-weight: 800; margin-bottom: 5px; }
.step p { color: var(--muted); font-size: 0.9rem; line-height: 2.05; }

/* نمونه کپشن */
.sample {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.sample .sample-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--orange);
  background: rgba(255, 138, 60, 0.12);
  border: 1px solid rgba(255, 138, 60, 0.3);
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 12px;
}
.sample p { font-size: 0.93rem; line-height: 2.3; white-space: pre-wrap; }

/* ─── FAQ ─── */
.faq { display: grid; gap: 12px; max-width: 840px; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.25s;
}
.faq details[open] { border-color: var(--line-strong); }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 22px;
  font-weight: 800;
  font-size: 0.97rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: color 0.2s;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--purple); }
.faq summary::after {
  content: "+";
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--purple);
  transition: transform 0.28s;
  flex: none;
  line-height: 1;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .faq-a { padding: 0 22px 20px; color: var(--muted); font-size: 0.91rem; line-height: 2.2; }

/* ─── CTA پایانی ─── */
.cta-band {
  background: var(--grad);
  border-radius: calc(var(--radius) + 8px);
  padding: clamp(34px, 5vw, 56px) clamp(24px, 4vw, 48px);
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 26px 70px rgba(138, 61, 255, 0.35);
}
.cta-band::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(500px 260px at 80% 0%, rgba(255, 255, 255, 0.22), transparent 65%);
  pointer-events: none;
}
.cta-band h2 { font-size: clamp(1.35rem, 3vw, 2rem); font-weight: 900; margin-bottom: 12px; position: relative; }
.cta-band p { opacity: 0.94; max-width: 620px; margin: 0 auto 26px; font-size: 0.98rem; line-height: 2.1; position: relative; }
.cta-band .btn { position: relative; background: #fff; color: #17122b; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24); }
.cta-band .btn:hover { transform: translateY(-2px); filter: none; background: #f5f2ff; }
.cta-band .cta-sub { display: block; margin-top: 14px; font-size: 0.83rem; opacity: 0.9; }

/* ─── لینک‌های داخلی ─── */
.inner-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}
.inner-links a {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 9px 19px;
  transition: all 0.22s;
}
.inner-links a:hover { border-color: var(--purple); color: var(--text); transform: translateY(-2px); }

/* ─── فوتر ─── */
footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 34px 0 26px;
  margin-top: 20px;
}
.foot-in {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: center;
  justify-content: space-between;
}
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.foot-links a { color: var(--muted); font-size: 0.86rem; transition: color 0.22s; }
.foot-links a:hover { color: var(--purple); }
.copy { color: var(--muted); font-size: 0.8rem; }

/* ─── ریسپانسیو ─── */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-actions { margin-inline-start: auto; }
  .tool-body { padding: 20px 16px; }
  .tool-head { padding: 16px 18px; }
  .step { padding: 18px 16px; gap: 14px; }
  .hero-facts { gap: 8px 16px; font-size: 0.82rem; }
}
@media (max-width: 480px) {
  body { font-size: 15px; }
  .btn { padding: 12px 22px; font-size: 0.92rem; width: 100%; }
  .tool-actions .btn { width: 100%; }
  .hero h1 { font-size: 1.62rem; }
  .result-card { padding: 16px 15px; }

  /* هدر: دکمه‌ها را از قانون width:100% معاف کن تا فشرده نشوند */
  .nav-in { gap: 10px; height: 62px; }
  .nav-actions { gap: 8px; }
  .nav-actions .btn { width: auto; }
  .nav-actions .btn-sm { padding: 9px 14px; font-size: 0.84rem; }
  .logo { font-size: 1.02rem; gap: 7px; }
  .logo svg { width: 26px; height: 26px; }
  .theme-btn { width: 44px; height: 44px; flex: none; }
  .theme-btn svg { width: 21px; height: 21px; }
}

/* ─── ظاهر شدن هنگام اسکرول ─── */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-reveal].revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* اسکرول‌بار */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--purple), var(--pink));
  border-radius: 8px;
  border: 2px solid var(--bg);
}
