/* بوم — سیستم طراحی
   لاجوردِ نگارگری به‌عنوان زمینه، زرِ تذهیب برای اکسنت، کاغذِ سرد برای فضای کار. */

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

:root {
  --lajvard: #1D2B8F;
  --lajvard-2: #2A3AA8;
  --shab: #0E1550;
  --shab-2: #151E66;
  --kaghaz: #EEF0F7;
  --kaghaz-2: #E3E6F2;
  --white: #FFFFFF;
  --zar: #E7A92B;
  --zar-2: #F2C25A;
  --firouzeh: #2BB3A6;
  --shangarf: #D9473B;
  --ink: #141A45;
  --ink-2: #4A5185;
  --line: #D3D7EA;
  --line-dark: rgba(238, 240, 247, .14);

  --r-s: 8px;
  --r-m: 14px;
  --r-l: 22px;

  --fs-xs: .8125rem;
  --fs-s: .9375rem;
  --fs-m: 1.0625rem;
  --fs-l: 1.375rem;
  --fs-xl: 2rem;

  /* رنگ‌های معنایی (در حالت تاریک عوض می‌شوند) */
  --on-accent: #FFFFFF;          /* متن روی دکمه‌ی لاجوردی */
  --accent-text: #1D2B8F;        /* لینک و متن تأکیدی */
  --accent-line: #1D2B8F;        /* حاشیه‌ی فوکوس */
  --hover: var(--hover);
  --bubble: #E3E7FA;             /* حباب پیام کاربر */
  --bad-bg: var(--bad-bg); --bad-fg: var(--bad-fg);
  --good-bg: var(--good-bg); --good-fg: var(--good-fg);
  --warn-bg: var(--warn-bg);
  --shadow-1: 0 1px 0 var(--line), 0 18px 40px -28px rgba(20, 26, 69, .35);
  --shadow-2: 0 12px 36px -12px rgba(14, 21, 80, .28);
  color-scheme: light;

  --ease: cubic-bezier(.2, .7, .2, 1);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-feature-settings: "ss01";
  color: var(--ink);
  background: var(--kaghaz);
  -webkit-font-smoothing: antialiased;
}

/* حالت تاریک: خودکار با تنظیم دستگاه، یا انتخاب کاربر (data-theme روی html) */
:root[data-theme="dark"] {
  --kaghaz: #0B0E26; --kaghaz-2: #1A1F47; --white: #13173A;
  --ink: #E7E9F6; --ink-2: #9EA4CC; --line: #282E60; --line-dark: rgba(238, 240, 247, .1);
  --lajvard: #3445C8; --lajvard-2: #4456D8; --shab: #070A1F; --shab-2: #0E1236;
  --accent-text: #A6B2FF; --accent-line: #7484F5; --hover: rgba(166, 178, 255, .08); --bubble: #252B66;
  --bad-bg: #3B1A20; --bad-fg: #FFB4AB; --good-bg: #0E3330; --good-fg: #82E3D6; --warn-bg: #3A2F14;
  --shadow-1: 0 0 0 1px var(--line); --shadow-2: 0 14px 40px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --kaghaz: #0B0E26; --kaghaz-2: #1A1F47; --white: #13173A;
    --ink: #E7E9F6; --ink-2: #9EA4CC; --line: #282E60; --line-dark: rgba(238, 240, 247, .1);
    --lajvard: #3445C8; --lajvard-2: #4456D8; --shab: #070A1F; --shab-2: #0E1236;
    --accent-text: #A6B2FF; --accent-line: #7484F5; --hover: rgba(166, 178, 255, .08); --bubble: #252B66;
    --bad-bg: #3B1A20; --bad-fg: #FFB4AB; --good-bg: #0E3330; --good-fg: #82E3D6; --warn-bg: #3A2F14;
    --shadow-1: 0 0 0 1px var(--line); --shadow-2: 0 14px 40px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: var(--fs-m); line-height: 1.75; background: var(--kaghaz); }
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- دکمه‌ها ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 0 1.4em; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 700; font-size: var(--fs-m); text-decoration: none; white-space: nowrap;
  transition: transform .15s var(--ease), background-color .15s, box-shadow .15s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-zar { background: var(--zar); color: var(--shab); }
.btn-zar:hover:not([disabled]) { background: var(--zar-2); }
.btn-lajvard { background: var(--lajvard); color: var(--on-accent); }
.btn-lajvard:hover:not([disabled]) { background: var(--lajvard-2); }
.btn-ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 1.5px currentColor; }
.btn-ghost:hover:not([disabled]) { background: rgba(127, 135, 190, .12); }
.btn-s { min-height: 38px; padding: 0 1em; font-size: var(--fs-s); }
.btn-block { width: 100%; }
.btn .spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-left-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- فرم ---------- */
.field { display: grid; gap: .4rem; }
.field > label, .label { font-size: var(--fs-s); font-weight: 600; color: var(--ink-2); }
.input, .textarea {
  width: 100%; border: 1.5px solid var(--line); background: var(--white); border-radius: var(--r-m);
  padding: .75rem 1rem; font-size: var(--fs-m); line-height: 1.7; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 4px rgba(29, 43, 143, .12); }
.textarea { resize: vertical; min-height: 120px; }
.input-ltr { direction: ltr; text-align: center; letter-spacing: .08em; }
.hint { font-size: var(--fs-xs); color: var(--ink-2); }
.err { font-size: var(--fs-s); color: var(--shangarf); font-weight: 600; }

/* انتخاب‌گرهای تراشه‌ای (سبک، نسبت، صدا) */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  border: 1.5px solid var(--line); background: var(--white); border-radius: 999px; padding: .4rem 1rem;
  font-size: var(--fs-s); font-weight: 600; cursor: pointer; color: var(--ink-2);
  transition: border-color .15s, background-color .15s, color .15s;
}
.chip:hover { border-color: var(--accent-line); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--lajvard); border-color: var(--lajvard); color: var(--on-accent); }

/* ---------- پیام کوتاه ---------- */
.toast-wrap { position: fixed; inset-inline: 0; bottom: 24px; display: grid; justify-items: center; gap: 8px; z-index: 100; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; background: var(--shab); color: #EEF0F7; padding: .8rem 1.25rem; border-radius: var(--r-m);
  font-size: var(--fs-s); font-weight: 600; box-shadow: 0 12px 32px -12px rgba(14, 21, 80, .6);
  border-inline-start: 4px solid var(--zar); max-width: 520px; animation: toast-in .25s var(--ease);
}
.toast.bad { border-inline-start-color: var(--shangarf); }
.toast.good { border-inline-start-color: var(--firouzeh); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- لوگو ---------- */
.logo { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; font-weight: 900; font-size: 1.6rem; letter-spacing: -.02em; line-height: 1; }
.logo-mark { width: 30px; height: 30px; flex: none; }

.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
