/* iKral Platform — افزونه «سئوی پروژه‌ها»: نقشه فناوری‌ها (صفحه /tech و برنامه میز کار) و دکمه مطالعه موردی پنجره پروژه
   متغیرها هم با پوسته صفحه‌های عمومی (site.css) و هم با میز کار (os.css) کار می‌کنند. */
.tm {
  --tm-ink: var(--text, var(--ink, #23252f)); --tm-ink2: var(--text-2, var(--ink2, #555867)); --tm-mut: var(--text-3, var(--mut, #8a8c99));
  --tm-line: var(--line, #e6e2da); --tm-card: var(--card, #fff); --tm-soft: var(--bg2, #efece6); --tm-halo: var(--card, #fff);
  --tm-edge: rgba(60, 66, 90, .2); --tm-ui: #2563eb; --tm-server: #d97706; --tm-data: #059669; --tm-other: #9333ea; --tm-focus: #2563eb;
  position: relative; display: none; flex-direction: column; min-width: 0; color: var(--tm-ink); font-family: 'Vazirmatn', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tm { --tm-edge: rgba(200, 210, 235, .17); --tm-ui: #60a5fa; --tm-server: #fbbf24; --tm-data: #34d399; --tm-other: #c084fc; --tm-focus: #7cb7ff; --tm-cnt: #10131c; } }
:root[data-theme="dark"] .tm { --tm-edge: rgba(200, 210, 235, .17); --tm-ui: #60a5fa; --tm-server: #fbbf24; --tm-data: #34d399; --tm-other: #c084fc; --tm-focus: #7cb7ff; --tm-cnt: #10131c; }
.tm.on { display: flex; }
.tm-page { border: 1px solid var(--tm-line); border-radius: var(--r, 18px); background: var(--tm-card); box-shadow: var(--sh, none); overflow: hidden; margin: 6px 0 10px; }
.tm-win { height: 100%; --tm-card: transparent; --tm-soft: var(--panel, rgba(255,255,255,.05)); --tm-halo: rgba(13, 19, 33, .92); }
:root[data-theme="light"] .tm-win { --tm-halo: rgba(250, 251, 253, .95); }

/* نوار ابزار */
.tm-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--tm-line); }
.tm-q { display: flex; align-items: center; gap: 6px; flex: 1 1 200px; max-width: 320px; min-height: 36px; padding: 0 10px; border: 1px solid var(--tm-line); border-radius: 11px; background: var(--tm-soft); color: var(--tm-mut); }
.tm-q:focus-within { border-color: var(--tm-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tm-focus) 20%, transparent); }
.tm-q input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--tm-ink); outline: none; padding: 6px 0; }
.tm-leg { display: flex; gap: 4px 12px; flex-wrap: wrap; font-size: 12px; color: var(--tm-ink2); flex: 1 1 auto; }
.tm-leg span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tm-leg i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.tm-leg i.tm-lp, .tm-sw.tm-lp { border-radius: 3px; background: linear-gradient(135deg, #19aefc, #7b2ff7); }
.g-ui { --g: var(--tm-ui); } .g-server { --g: var(--tm-server); } .g-data { --g: var(--tm-data); } .g-other { --g: var(--tm-other); }
.tm-leg i[class^="g-"], .tm-sw[class*="g-"] { background: var(--g); }
.tm-zoom { display: flex; gap: 4px; margin-inline-start: auto; }
.tm-zoom button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--tm-line); background: var(--tm-soft); color: var(--tm-ink); border-radius: 10px; cursor: pointer; padding: 0; }
.tm-zoom button:hover { border-color: var(--tm-mut); }
.tm-zoom button:focus-visible, .tm-a:focus-visible, .tm-li:focus-visible, .tm-x:focus-visible { outline: 2px solid var(--tm-focus); outline-offset: 2px; }

/* صحنه و پنل */
.tm-main { display: grid; grid-template-columns: 1fr 280px; flex: 1; min-height: 0; }
.tm-page .tm-main { flex: none; height: clamp(460px, 68vh, 720px); }
.tm-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; touch-action: none; }
.tm-svg { display: block; cursor: grab; user-select: none; -webkit-user-select: none; }
.tm-svg.panning { cursor: grabbing; }
.tm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
.tm-info { border-inline-start: 1px solid var(--tm-line); padding: 14px; overflow: auto; font-size: 13.5px; background: color-mix(in srgb, var(--tm-soft) 60%, transparent); }
.tm-hint { color: var(--tm-ink2); margin: 0 0 8px; line-height: 1.9; }
.tm-sum { color: var(--tm-mut); font-size: 12.5px; margin: 0; }
.tm-ih { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tm-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tm-mut); }
.tm-sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; flex: none; }
.tm-sw[class*="g-"] { border-radius: 50%; }
.tm-x { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; color: var(--tm-mut); border-radius: 8px; cursor: pointer; }
.tm-x:hover { background: var(--tm-soft); color: var(--tm-ink); }
.tm-info h3 { margin: 6px 0 2px; font-size: 18px; line-height: 1.5; font-weight: 800; }
.tm-sub { margin: 0 0 8px; color: var(--tm-ink2); font-size: 12.5px; line-height: 1.8; }
.tm-list, .tm-chips { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; }
.tm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-li { display: flex; align-items: center; gap: 8px; width: 100%; text-align: start; font: inherit; font-size: 13px; color: var(--tm-ink); background: var(--tm-card); border: 1px solid var(--tm-line); border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.tm-win .tm-li { background: var(--panel-2, rgba(255,255,255,.06)); }
.tm-chips .tm-li { width: auto; border-radius: 99px; padding: 3px 10px; font-size: 12.5px; }
.tm-li:hover { border-color: var(--tm-mut); }
.tm-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-a { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 700; text-decoration: none; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--tm-line); color: var(--tm-ink); background: transparent; cursor: pointer; }
.tm-a.pri { background: var(--acc, var(--accent, #23252f)); border-color: transparent; color: var(--acc-ink, #fff); }

/* گره‌ها و یال‌ها */
.tm-e { stroke: var(--tm-edge); stroke-width: 1.2; transition: stroke .25s, stroke-width .25s, opacity .25s; }
.tm-e.on { stroke: var(--ec); stroke-width: 2.4; opacity: .95; }
.tm-n { cursor: pointer; outline: none; transition: opacity .25s; }
.tm-dot { fill: var(--g); stroke: var(--tm-halo); stroke-width: 2; }
.tm-ring { fill: none; stroke: transparent; stroke-width: 2.5; }
.tm-box { stroke: var(--tm-halo); stroke-width: 2; }
.tm-cnt { fill: var(--tm-cnt, #fff); font-size: 11px; font-weight: 800; text-anchor: middle; pointer-events: none; }
.tm-lbl { fill: var(--tm-ink); font-size: 11.5px; font-weight: 600; text-anchor: middle; paint-order: stroke; stroke: var(--tm-halo); stroke-width: 3.5px; stroke-linejoin: round; pointer-events: none; }
.tm-plbl { font-weight: 700; font-size: 12px; }
.tm-svg.has-hi .tm-n:not(.lit) { opacity: .16; }
.tm-svg.has-hi .tm-e:not(.on) { opacity: .25; }
.tm-n.lit .tm-ring, .tm-n.sel .tm-ring { stroke: color-mix(in srgb, var(--tm-ink) 35%, transparent); }
.tm-n.cur .tm-ring { stroke: var(--tm-ink); }
.tm-n:focus-visible .tm-ring { stroke: var(--tm-focus); stroke-width: 3; }
.tm-n.sel .tm-lbl { font-weight: 800; }

/* صفحه /tech: فهرست بدون JS */
.tm-all { margin-top: 10px; }
.tm-card h3 { font-size: 16px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.tm-card h3 a { text-decoration: none; }
.tm-card .tm-g { margin: -4px 0 6px; font-size: 12.5px; }
.tm-card ul { margin: 0; padding-inline-start: 18px; font-size: 14px; }
.tm-card[data-g] { border-top: 3px solid var(--g, var(--line)); }
.tm-card[data-g="ui"] { --g: #2563eb; } .tm-card[data-g="server"] { --g: #d97706; } .tm-card[data-g="data"] { --g: #059669; } .tm-card[data-g="other"] { --g: #9333ea; }

@media (max-width: 860px) {
  .tm-main { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .tm-info { border-inline-start: 0; border-top: 1px solid var(--tm-line); max-height: 42%; }
  .tm-page .tm-main { height: auto; grid-template-rows: 540px auto; }
  .tm-page .tm-info { max-height: none; }
  .tm-leg { order: 3; flex-basis: 100%; }
  .tm-q { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .tm-e, .tm-n { transition: none; } }

/* پنجره پروژه: نسخه کامل مطالعه موردی */
.pjs-case { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding: 14px 16px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--pc, var(--accent)) 35%, var(--line)); background: linear-gradient(120deg, color-mix(in srgb, var(--pc, var(--accent)) 12%, transparent), transparent 70%); }
.pjs-case > div:not(.pjs-acts) { flex: 1 1 260px; display: grid; gap: 2px; }
.pjs-case b { font-size: 14px; }
.pjs-case small { color: var(--text-2); font-size: 12.5px; line-height: 1.8; }
.pjs-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--pc, var(--accent)), var(--pc2, var(--accent-2))); flex: none; }
.pjs-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.pjs-tmlink { margin-top: 10px; }
@media (pointer: coarse) { .tm-hint { display: none; } }
