@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

/*
 * Promptaria — "paper and ink".
 * Light by default: warm paper, ink text, the logo's violet as the one accent
 * and saffron for highlights. Dark follows the system, or the header toggle
 * (html[data-theme]). Admin and kit pages pin data-theme="dark".
 * The prompt box stays dark in both themes: it is the "code" on the page.
 */
:root {
  color-scheme: light;
  --bg: #f7f3ec;
  --bg-soft: #fbf8f3;
  --card-solid: #ffffff;
  --surface: #f2ece2;
  --surface-2: #ebe3d6;
  --border: #e2d9ca;
  --border-soft: #ebe4d8;
  --text: #1f1a2e;
  --muted: #5b546c;
  --dim: #8a8398;
  --accent: #6a47f5;
  --accent-ink: #5534e0;
  --accent-soft: rgba(106, 71, 245, 0.08);
  --accent-line: rgba(106, 71, 245, 0.28);
  --accent-2: #0b8f9c;
  --accent-2-soft: rgba(11, 143, 156, 0.08);
  --accent-3: #d23f74;
  --accent-3-soft: rgba(210, 63, 116, 0.08);
  --gold: #c98a06;
  --gold-soft: rgba(232, 163, 23, 0.12);
  --saffron: #e8a317;
  --green: #17875c;
  --green-soft: rgba(23, 135, 92, 0.09);
  --code-bg: #1c1929;
  --code-text: #ece8fb;
  --header-bg: rgba(247, 243, 236, 0.86);
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(31, 26, 46, 0.05);
  --shadow: 0 1px 2px rgba(31, 26, 46, 0.04), 0 10px 30px -14px rgba(31, 26, 46, 0.2);
  --shadow-lg: 0 2px 4px rgba(31, 26, 46, 0.04), 0 24px 60px -24px rgba(31, 26, 46, 0.3);
  --pattern-opacity: 0.55;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #14121c;
    --bg-soft: #191623;
    --card-solid: #1d1a28;
    --surface: #242031;
    --surface-2: #2c2739;
    --border: #353047;
    --border-soft: #2a2638;
    --text: #efeaf8;
    --muted: #aca5c0;
    --dim: #7f7892;
    --accent: #9179ff;
    --accent-ink: #a893ff;
    --accent-soft: rgba(145, 121, 255, 0.12);
    --accent-line: rgba(145, 121, 255, 0.35);
    --accent-2: #45c7d3;
    --accent-2-soft: rgba(69, 199, 211, 0.1);
    --accent-3: #f06d9b;
    --accent-3-soft: rgba(240, 109, 155, 0.1);
    --gold: #f2b83a;
    --gold-soft: rgba(242, 184, 58, 0.12);
    --saffron: #f2b83a;
    --green: #3ccf92;
    --green-soft: rgba(60, 207, 146, 0.1);
    --code-bg: #0f0d17;
    --code-text: #e4e0f7;
    --header-bg: rgba(20, 18, 28, 0.84);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -16px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
    --pattern-opacity: 0.35;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #14121c;
  --bg-soft: #191623;
  --card-solid: #1d1a28;
  --surface: #242031;
  --surface-2: #2c2739;
  --border: #353047;
  --border-soft: #2a2638;
  --text: #efeaf8;
  --muted: #aca5c0;
  --dim: #7f7892;
  --accent: #9179ff;
  --accent-ink: #a893ff;
  --accent-soft: rgba(145, 121, 255, 0.12);
  --accent-line: rgba(145, 121, 255, 0.35);
  --accent-2: #45c7d3;
  --accent-2-soft: rgba(69, 199, 211, 0.1);
  --accent-3: #f06d9b;
  --accent-3-soft: rgba(240, 109, 155, 0.1);
  --gold: #f2b83a;
  --gold-soft: rgba(242, 184, 58, 0.12);
  --saffron: #f2b83a;
  --green: #3ccf92;
  --green-soft: rgba(60, 207, 146, 0.1);
  --code-bg: #0f0d17;
  --code-text: #e4e0f7;
  --header-bg: rgba(20, 18, 28, 0.84);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -16px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
  --pattern-opacity: 0.35;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Vazirmatn, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.85;
  direction: rtl;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s, color 0.25s;
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
code, pre, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; direction: ltr; }
h1, h2, h3 { line-height: 1.5; }
img { max-width: 100%; }

.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;
}
/* Parked above the viewport rather than at -9999px sideways: in RTL a negative
   inline-start lands on the right and widens the page. */
.skip {
  position: absolute; inset-inline-start: 20px; top: 8px; z-index: 200;
  background: var(--accent); color: #fff; padding: 10px 18px; border-radius: 10px;
  transform: translateY(-160%); transition: transform 0.2s;
}
.skip:focus { transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent-line); }

/* ---------- header ---------- */
header.site {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-soft);
}
.hdr { display: flex; align-items: center; gap: 14px; height: 66px; }
.logo { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 19px; letter-spacing: -0.3px; }
.logo .mark {
  width: 36px; height: 36px; border-radius: 11px; color: #fff;
  background: linear-gradient(135deg, #7b5cff, #4f35d8);
  display: grid; place-items: center; font-size: 18px; position: relative;
  box-shadow: 0 6px 16px -8px #5534e0;
  transition: transform 0.25s;
}
.logo .mark::after {
  content: ''; position: absolute; top: 5px; inset-inline-start: 5px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--saffron);
}
.logo:hover .mark { transform: rotate(-8deg) scale(1.05); }
.logo small { display: block; font-size: 10.5px; font-weight: 500; color: var(--dim); letter-spacing: 1px; line-height: 1; margin-top: 3px; }
.hdr nav { display: flex; gap: 2px; margin-inline-start: auto; align-items: center; }
.hdr nav a {
  padding: 7px 13px; border-radius: 10px; font-size: 13.5px; font-weight: 500; color: var(--muted);
  transition: background-color 0.18s, color 0.18s;
}
.hdr nav a:hover { color: var(--text); background: var(--surface); }
.hdr nav a[aria-current] { color: var(--accent); background: var(--accent-soft); }
.hdr nav a.cta { color: var(--accent); }

.theme-btn {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  border: 1px solid var(--border); background: var(--card-solid); color: var(--muted);
  display: grid; place-items: center; font-size: 16px; line-height: 1;
  transition: 0.18s;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent-line); }
.theme-btn .sun { display: none; }
:root[data-theme='dark'] .theme-btn .sun { display: inline; }
:root[data-theme='dark'] .theme-btn .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-btn .sun { display: inline; }
  :root:not([data-theme='light']) .theme-btn .moon { display: none; }
}

/* ---------- hero ---------- */
.hero { padding: 64px 0 30px; text-align: center; position: relative; }
/* eight-point star lattice, the girih motif, faded out towards the edges */
.hero::before {
  content: ''; position: absolute; inset: -10px 0 0; z-index: -1; pointer-events: none;
  opacity: var(--pattern-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%236a47f5' stroke-opacity='.16' stroke-width='1'%3E%3Cpath d='M36 14l6.4 15.6L58 36l-15.6 6.4L36 58l-6.4-15.6L14 36l15.6-6.4z'/%3E%3Cpath d='M20.4 20.4h31.2v31.2H20.4z' transform='rotate(45 36 36)'/%3E%3Cpath d='M0 0l14 14M72 0L58 14M0 72l14-14M72 72L58 58'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-image: radial-gradient(ellipse 70% 75% at 50% 35%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 75% at 50% 35%, #000 20%, transparent 75%);
}
.orbs { display: none; }

.hero .badge {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 20px;
  padding: 5px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--green);
  background: var(--card-solid); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  animation: rise-in 0.7s cubic-bezier(0.2, 1, 0.3, 1) both;
}
.hero .badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  animation: blink 2.2s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.hero h1 {
  font-size: clamp(32px, 5.4vw, 56px); font-weight: 900; margin: 0 0 18px;
  line-height: 1.4; letter-spacing: -1px;
}
.hero h1 .grad {
  color: var(--accent); position: relative; white-space: nowrap;
  background: linear-gradient(transparent 68%, var(--gold-soft) 68%, var(--gold-soft) 92%, transparent 92%);
  padding: 0 6px;
}

.lede { max-width: 660px; margin: 0 auto 28px; color: var(--muted); font-size: 16px; }

/* entrance animations */
.reveal { animation: rise-in 0.7s cubic-bezier(0.2, 1, 0.3, 1) both; }
.reveal.d1 { animation-delay: 0.08s; }
.reveal.d2 { animation-delay: 0.16s; }
.reveal.d3 { animation-delay: 0.24s; }
@keyframes rise-in { from { opacity: 0; transform: translateY(16px); } }

.searchbar { max-width: 640px; margin: 0 auto; position: relative; display: flex; align-items: center; }
.searchbar input {
  flex: 1; width: 100%; padding: 17px 52px 17px 124px; font-size: 15px; font-family: inherit;
  background: var(--card-solid); border: 1px solid var(--border); border-radius: 16px; color: var(--text);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s; box-shadow: var(--shadow);
}
.searchbar input::placeholder { color: var(--dim); }
.searchbar input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.searchbar .icon {
  position: absolute; inset-inline-start: 19px; top: 50%; transform: translateY(-50%);
  color: var(--dim); pointer-events: none; font-size: 18px;
}

.stats-row {
  display: inline-flex; justify-content: center; gap: 0; flex-wrap: wrap; margin-top: 32px;
  background: var(--card-solid); border: 1px solid var(--border-soft); border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.stat { padding: 12px 30px; }
.stat + .stat { border-inline-start: 1px solid var(--border-soft); }
.stat b { display: block; font-size: 23px; font-weight: 800; color: var(--text); line-height: 1.35; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--dim); }

/* ---------- category chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 30px auto 8px; }
.chip {
  padding: 7px 14px; border-radius: 999px; background: var(--card-solid);
  border: 1px solid var(--border); color: var(--muted); font-size: 13.5px; font-weight: 500;
  transition: 0.18s cubic-bezier(0.2, 1, 0.3, 1); display: inline-flex; align-items: center; gap: 7px;
}
.chip:hover { border-color: var(--accent-line); color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow); }
.chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip .n { font-size: 11px; opacity: 0.6; }

/* ---------- image-prompt gallery strip (home) ---------- */
.gallery-sec { margin-top: 34px; }
.sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.sec-head h2 { margin: 0; font-size: 19px; font-weight: 800; }
.sec-head h2 span { display: block; font-size: 12.5px; font-weight: 400; color: var(--dim); }
.sec-head .more { margin-inline-start: auto; font-size: 13px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.sec-head .more:hover { text-decoration: underline; }
.gallery {
  display: grid; grid-auto-flow: column; grid-auto-columns: 196px; gap: 12px;
  overflow-x: auto; padding: 4px 2px 14px; scroll-snap-type: x mandatory;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.g-item {
  position: relative; display: block; aspect-ratio: 4 / 5; border-radius: 16px; overflow: hidden;
  background: var(--surface); scroll-snap-align: start; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
}
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s cubic-bezier(0.2, 1, 0.3, 1); }
.g-item span {
  position: absolute; inset: auto 0 0; padding: 32px 12px 11px; color: #fff;
  font-size: 13px; font-weight: 600; line-height: 1.6;
  background: linear-gradient(transparent, rgba(12, 10, 20, 0.82));
}
.g-item:hover img { transform: scale(1.06); }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 26px 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.toolbar .count { color: var(--muted); font-size: 13.5px; margin: 0; margin-inline-end: auto; }
.toolbar .count b { color: var(--text); }
select.sel {
  background: var(--card-solid); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 10px; font-size: 13px; font-family: inherit; outline: none;
  transition: 0.18s;
}
select.sel:hover, select.sel:focus { border-color: var(--accent); }

/* ---------- grid + cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.card {
  position: relative; background: var(--card-solid); border: 1px solid var(--border-soft);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.2, 1, 0.3, 1), box-shadow 0.25s, border-color 0.25s;
}
.card-link { display: flex; flex-direction: column; gap: 10px; padding: 19px; height: 100%; }
.card:hover { transform: translateY(-4px); border-color: var(--accent-line); box-shadow: var(--shadow); }
.card.feat { border-color: var(--gold-soft); }
.card.feat::before {
  content: ''; position: absolute; inset-inline: 0; top: 0; height: 3px; background: var(--saffron);
}

.card .thumb {
  margin: -19px -19px 4px; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s cubic-bezier(0.2, 1, 0.3, 1); }
.card:hover .thumb img { transform: scale(1.05); }
.card.has-img .cat-ico { display: none; }

/* staggered entrance for grids */
.stagger > * { animation: card-in 0.5s cubic-bezier(0.2, 1, 0.3, 1) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(12px); } }
.stagger > *:nth-child(1) { animation-delay: .02s } .stagger > *:nth-child(2) { animation-delay: .05s }
.stagger > *:nth-child(3) { animation-delay: .08s } .stagger > *:nth-child(4) { animation-delay: .11s }
.stagger > *:nth-child(5) { animation-delay: .14s } .stagger > *:nth-child(6) { animation-delay: .17s }
.stagger > *:nth-child(7) { animation-delay: .20s } .stagger > *:nth-child(8) { animation-delay: .23s }
.stagger > *:nth-child(9) { animation-delay: .26s } .stagger > *:nth-child(10) { animation-delay: .29s }
.stagger > *:nth-child(n+11) { animation-delay: .32s }

.card .top { display: flex; align-items: flex-start; gap: 11px; }
.card .tw { min-width: 0; }
.card .cat-ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); font-size: 19px; flex-shrink: 0; transition: 0.25s;
}
.card:hover .cat-ico { background: var(--accent-soft); transform: rotate(-6deg); }
.card h3, .card .h3 { margin: 0; font-size: 15.5px; font-weight: 700; line-height: 1.65; }
.card .cat-name { font-size: 11.5px; color: var(--dim); }
.card p.sum {
  margin: 0; font-size: 13px; color: var(--muted); line-height: 1.95;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card .meta { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--border-soft); }
.pill {
  font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 999px;
  background: var(--surface); border: 1px solid transparent; color: var(--muted);
  display: inline-block;
}
a.pill:hover { border-color: var(--accent-line); color: var(--text); }
.pill.easy { color: var(--green); background: var(--green-soft); }
.pill.medium { color: var(--accent-2); background: var(--accent-2-soft); }
.pill.advanced { color: var(--accent-3); background: var(--accent-3-soft); }
.pill.gold { color: var(--gold); background: var(--gold-soft); }
.pill.fa { color: var(--green); background: var(--green-soft); }
.card .stat-mini { margin-inline-start: auto; font-size: 11.5px; color: var(--dim); }

/* ---------- breadcrumbs / page heads ---------- */
.crumbs { font-size: 12.5px; color: var(--dim); padding: 20px 0 4px; }
.crumbs a:hover { color: var(--accent); }
.cat-head { padding: 18px 0 8px; }
.cat-head h1 { font-size: clamp(26px, 4vw, 38px); font-weight: 900; margin: 0 0 10px; letter-spacing: -0.6px; }
.cat-head .lede { margin-inline: 0; max-width: 720px; }

/* ---------- pager ---------- */
.pager { display: flex; justify-content: center; gap: 6px; margin: 36px 0 60px; flex-wrap: wrap; }
.pager button, .pager a, .pager span {
  min-width: 40px; height: 40px; padding: 0 14px; border-radius: 11px;
  background: var(--card-solid); border: 1px solid var(--border); color: var(--muted);
  font-size: 13.5px; transition: 0.16s; display: inline-flex; align-items: center; justify-content: center;
}
.pager button:hover:not(:disabled), .pager a:hover { border-color: var(--accent); color: var(--text); }
.pager .on { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 700; }
.pager button:disabled { opacity: 0.35; cursor: default; }

/* ---------- article / detail ---------- */
.article { padding-bottom: 20px; }
.sheet {
  max-width: 860px; margin: 12px auto 60px; background: var(--card-solid);
  border: 1px solid var(--border-soft); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden;
}
.sheet.static { animation: rise-in 0.45s cubic-bezier(0.2, 1, 0.3, 1) both; }

.sheet .sh-head {
  padding: 30px 32px 24px; border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, var(--accent-soft), transparent 85%);
  position: relative;
}
.sheet .sh-head h1, .sheet .sh-head h2 { margin: 0 0 12px; font-size: 26px; font-weight: 900; line-height: 1.5; padding-inline-end: 40px; letter-spacing: -0.4px; }
.sheet .sh-head .lede { margin: 14px 0 0; text-align: right; max-width: none; font-size: 14px; }
.close-x {
  position: absolute; top: 20px; inset-inline-end: 22px; width: 34px; height: 34px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 17px; line-height: 1;
}
.close-x:hover { color: var(--text); }

.sh-body { padding: 26px 32px 34px; }
.sec { margin-bottom: 30px; }
.sec > h2, .sec > h4 {
  margin: 0 0 12px; font-size: 15.5px; font-weight: 800; display: flex; align-items: center; gap: 9px;
}
.sec > h2 .ic, .sec > h4 .ic {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: 13px;
  background: var(--accent-soft); color: var(--accent); flex-shrink: 0;
}

/* image prompts: the picture the prompt produced, and what to upload first */
.result-fig { margin: 0 0 22px; }
.result-fig img {
  display: block; width: 100%; max-height: 560px; object-fit: contain;
  background: var(--surface); border-radius: 16px; border: 1px solid var(--border-soft);
}
.result-fig figcaption { margin-top: 8px; font-size: 12px; color: var(--dim); text-align: center; }
.need-input {
  display: flex; gap: 8px; align-items: baseline; margin: 0 0 24px; padding: 12px 16px;
  background: var(--gold-soft); border-radius: 12px; font-size: 13.5px; color: var(--text);
}
.need-input span { color: var(--gold); font-weight: 700; }

.prompt-box { position: relative; }
.prompt-box pre {
  /* extra headroom so the floating copy button never lands on the first line */
  margin: 0; padding: 62px 20px 20px; background: var(--code-bg); border: 1px solid var(--code-bg);
  border-radius: 14px; white-space: pre-wrap; word-break: break-word; direction: ltr; text-align: left;
  font-size: 12.8px; line-height: 1.95; max-height: 440px; overflow-y: auto; color: var(--code-text);
  scrollbar-width: thin; scrollbar-color: #3a3550 transparent;
}
.prompt-box::before {
  /* window dots on the side the copy button (inline-end) is not */
  content: ''; position: absolute; top: 22px; inset-inline-start: 20px; width: 44px; height: 10px; pointer-events: none;
  background:
    radial-gradient(circle at 5px 5px, #ff6b6b 4px, transparent 4.5px),
    radial-gradient(circle at 22px 5px, #f6c343 4px, transparent 4.5px),
    radial-gradient(circle at 39px 5px, #3ccf92 4px, transparent 4.5px);
  opacity: 0.85;
}
.copybtn {
  position: absolute; top: 12px; inset-inline-end: 12px;
  padding: 9px 18px; border-radius: 10px; font-size: 12.5px; font-weight: 700;
  background: var(--accent); border: none; color: #fff;
  box-shadow: 0 6px 18px -8px var(--accent); transition: 0.18s;
}
.copybtn:hover { background: var(--accent-ink); transform: translateY(-1px); }
.copybtn.done { background: var(--green); animation: pop 0.32s ease; }
@keyframes pop { 50% { transform: scale(1.08); } }

.howto { font-size: 14px; color: var(--muted); }
.howto p { margin: 0 0 13px; }
.howto strong { color: var(--text); font-weight: 700; }
.howto code { background: var(--accent-soft); color: var(--accent); padding: 1px 7px; border-radius: 6px; font-size: 12px; }
.howto em { color: var(--accent-2); font-style: normal; }

ul.tips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
ul.tips li {
  padding: 12px 16px; background: var(--bg-soft); border: 1px solid var(--border-soft);
  border-inline-start: 3px solid var(--saffron); border-radius: 12px; font-size: 13.4px; color: var(--muted);
}

.varbox { display: flex; flex-direction: column; gap: 9px; }
.varbox .v {
  display: flex; align-items: center; gap: 12px; padding: 11px 15px;
  background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 12px; font-size: 13px;
}
.varbox .v code { background: var(--accent-2-soft); color: var(--accent-2); padding: 2px 9px; border-radius: 7px; font-size: 12px; }
.varbox .v span { color: var(--muted); font-size: 12.5px; }

.note {
  padding: 15px 18px; border-radius: 13px; font-size: 13.4px; color: var(--muted);
  background: var(--accent-2-soft); white-space: pre-wrap;
}
.note.out { background: var(--green-soft); }

.kv { display: flex; gap: 8px; flex-wrap: wrap; }

.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.rel {
  display: block; padding: 13px 15px; background: var(--bg-soft); border: 1px solid var(--border-soft);
  border-radius: 12px; font-size: 13px; transition: 0.18s; line-height: 1.7; color: var(--muted);
}
.rel:hover { border-color: var(--accent-line); color: var(--text); transform: translateY(-2px); }

/* FAQ */
.faq details {
  border: 1px solid var(--border-soft); border-radius: 12px; padding: 4px 16px;
  margin-bottom: 9px; background: var(--card-solid); transition: 0.18s;
}
.faq details[open] { border-color: var(--accent-line); }
.faq summary { cursor: pointer; padding: 11px 0; font-weight: 600; font-size: 13.8px; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: '＋'; color: var(--accent); margin-inline-end: 9px; }
.faq details[open] summary::before { content: '－'; }
.faq p { margin: 0 0 14px; color: var(--muted); font-size: 13.4px; }

/* SEO copy block */
.seo-block { max-width: 820px; margin: 20px auto 40px; }
.seo-block h2 { font-size: 18px; margin: 28px 0 10px; font-weight: 800; }
.seo-block p { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 70px 20px; color: var(--dim); grid-column: 1 / -1; }
.empty .big { font-size: 46px; margin-bottom: 14px; }
.empty h1 { font-size: 22px; color: var(--text); }
.btn-link {
  display: inline-block; margin-top: 10px; padding: 11px 22px; border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 13.5px; transition: 0.18s;
}
.btn-link:hover { background: var(--accent-ink); transform: translateY(-1px); }

.skeleton {
  height: 186px; border-radius: var(--radius); border: 1px solid var(--border-soft);
  background: linear-gradient(100deg, var(--surface) 30%, var(--bg-soft) 50%, var(--surface) 70%);
  background-size: 200% 100%; animation: sk 1.4s infinite;
}
@keyframes sk { to { background-position: -200% 0; } }

footer.site {
  border-top: 1px solid var(--border); padding: 36px 0; margin-top: 40px; background: var(--bg-soft);
  color: var(--dim); font-size: 13px; text-align: center; position: relative; z-index: 1;
}
footer.site a { color: var(--muted); }
footer.site a:hover { color: var(--accent); }
.foot-cats { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; margin-bottom: 22px; font-size: 12.5px; }
footer.site .dim { opacity: 0.8; }

.toast {
  position: fixed; bottom: 26px; inset-inline-start: 50%; transform: translateX(50%) translateY(90px);
  background: var(--text); color: var(--bg);
  padding: 12px 22px; border-radius: 13px; font-size: 13.5px; font-weight: 600; z-index: 200;
  box-shadow: var(--shadow-lg); transition: transform 0.32s cubic-bezier(0.2, 1, 0.3, 1);
}
.toast.show { transform: translateX(50%) translateY(0); }

/* scroll progress bar on article pages */
.progress {
  position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 60;
  background: linear-gradient(90deg, var(--saffron), var(--accent));
  transform-origin: right; transform: scaleX(0);
}

@media (max-width: 720px) {
  .hdr nav a:not(.cta) { display: none; }
  .hero { padding: 40px 0 24px; }
  .hero h1 .grad { white-space: normal; }
  .sheet { margin: 8px auto 40px; border-radius: 16px; }
  .sh-body, .sheet .sh-head { padding-left: 18px; padding-right: 18px; }
  .stat { padding: 10px 18px; }
  .grid { grid-template-columns: 1fr; }
  .gallery { grid-auto-columns: 160px; }
}

/* Users who ask for less motion get a static, equally usable page. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- پرامپت‌یار: the search assistant ---------- */
.ask-btn {
  position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%);
  padding: 10px 20px; border: none; border-radius: 11px; font-size: 13px; font-weight: 700;
  color: #fff; background: var(--accent);
  box-shadow: 0 6px 16px -8px var(--accent); transition: 0.18s; white-space: nowrap;
}
.ask-btn:hover { background: var(--accent-ink); }
.ask-hint { color: var(--dim); font-size: 12.5px; margin: 12px auto 0; max-width: 620px; }

.assist { max-width: 820px; margin: 26px auto 0; text-align: right; }
.assist-card {
  background: var(--card-solid); border: 1px solid var(--border);
  border-radius: 18px; padding: 22px 24px; box-shadow: var(--shadow);
  animation: rise-in 0.45s cubic-bezier(0.2, 1, 0.3, 1) both;
}
.assist-head { display: flex; align-items: center; margin-bottom: 14px; }
.assist-badge {
  font-size: 12px; font-weight: 700; padding: 5px 14px; border-radius: 999px;
  color: var(--accent); background: var(--accent-soft);
}
.assist-close {
  margin-inline-start: auto; width: 30px; height: 30px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 14px;
}
.assist-close:hover { color: var(--text); }
.assist-chips { margin-bottom: 14px; }
.assist-chips .pill b { color: var(--accent); font-weight: 700; }
.assist-say { font-size: 13.8px; color: var(--muted); line-height: 2; }
.assist-say p { margin: 0 0 10px; }
.assist-say strong { color: var(--text); }
.assist-label {
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  margin: 20px 0 10px; display: flex; align-items: center; gap: 8px;
}
.assist-label::before { content: ''; width: 3px; height: 14px; border-radius: 2px; background: var(--saffron); }
/* Unlike the library's English prompts, the generated one is Persian — the
   shared <pre> rule forces LTR monospace, which reads badly for it. */
.assist-prompt .prompt-box pre {
  max-height: 320px; font-size: 13.4px; line-height: 2.05;
  direction: rtl; text-align: right;
  font-family: Vazirmatn, system-ui, sans-serif;
}
.assist-matches { display: grid; gap: 9px; }
.assist-match {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 12px; transition: 0.18s;
}
.assist-match:hover { border-color: var(--accent-line); transform: translateX(-3px); }
.am-ico {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface); font-size: 15px; flex: 0 0 auto;
}
.am-body { min-width: 0; }
.am-body b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.6; }
.am-body small { display: block; font-size: 12px; color: var(--muted); line-height: 1.85; margin-top: 2px; }

@media (max-width: 640px) {
  .searchbar input { padding-inline-end: 104px; font-size: 14px; }
  .ask-btn { padding: 9px 13px; font-size: 12px; }
  .assist-card { padding: 18px 16px; }
}

/* ---------- authored content: articles, collections, builder ---------- */
.prose { font-size: 15px; line-height: 2.15; color: var(--muted); }
.prose h2 { font-size: 21px; font-weight: 900; color: var(--text); margin: 36px 0 12px; letter-spacing: -0.3px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 16.5px; font-weight: 800; color: var(--text); margin: 24px 0 8px; }
.prose p { margin: 0 0 15px; }
.prose strong { color: var(--text); font-weight: 700; }
.prose code { background: var(--accent-soft); color: var(--accent); padding: 1px 7px; border-radius: 6px; font-size: 12.5px; }
.prose ul { margin: 0 0 16px; padding-inline-start: 22px; }
.prose li { margin-bottom: 8px; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 4px; }
.prose a:hover { text-decoration-color: var(--accent); }

.table-wrap { overflow-x: auto; margin: 0 0 20px; border-radius: 13px; border: 1px solid var(--border); }
table.cmp { width: 100%; border-collapse: collapse; font-size: 13.4px; min-width: 480px; }
table.cmp th {
  background: var(--surface); color: var(--text); font-weight: 700; text-align: right;
  padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.cmp td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); color: var(--muted); }
table.cmp tr:last-child td { border-bottom: none; }
table.cmp tbody tr:hover td { background: var(--bg-soft); }
table.cmp td:first-child { color: var(--text); font-weight: 600; }

.cta-box {
  margin: 32px 0; padding: 22px 24px; border-radius: 16px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.cta-box b { display: block; font-size: 15.5px; margin-bottom: 6px; color: var(--text); }
.cta-box p { margin: 0 0 14px; color: var(--muted); font-size: 13.6px; }

.col-intro { margin: 0 0 22px; line-height: 2.05; }

/* builder */
.builder { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: start; margin-bottom: 40px; }
.builder-form { display: flex; flex-direction: column; gap: 16px; }
.bf { display: block; }
.bf > span { display: block; font-size: 13.4px; font-weight: 700; margin-bottom: 7px; color: var(--text); }
.bf > span b { color: var(--accent-3); }
.bf small { display: block; color: var(--dim); font-size: 12px; margin-top: 5px; }
.bf input, .bf select, .bf textarea {
  width: 100%; padding: 12px 14px; font-family: inherit; font-size: 13.8px; line-height: 1.9;
  background: var(--card-solid); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); outline: none; transition: 0.18s; resize: vertical;
}
.bf input:focus, .bf select:focus, .bf textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bf-check { display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--muted); }
.bf-check label { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.bf-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.btn-plain {
  padding: 11px 20px; border-radius: 12px; font-size: 13.5px;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
}
.btn-plain:hover { border-color: var(--accent); color: var(--text); }
.builder-out { position: sticky; top: 90px; }
pre.fa-pre {
  direction: rtl !important; text-align: right !important;
  font-family: Vazirmatn, system-ui, sans-serif !important;
  font-size: 13.6px; line-height: 2.05; min-height: 240px;
}

@media (max-width: 900px) {
  .builder { grid-template-columns: 1fr; }
  .builder-out { position: static; }
  .bf-row { grid-template-columns: 1fr; }
}

/* original English name under a translated prompt title */
.title-en { margin: -6px 0 14px; color: var(--dim); font-size: 13.5px; font-family: inherit; text-align: right; }
