/* =====================================================================
   feghh14.com design system
   Light "paper" theme by default, dark theme via [data-theme="dark"].
   Written with logical properties so RTL (fa) and LTR (en) share one stylesheet.
   ===================================================================== */

@font-face {
    font-family: 'BKoodak';
    src: url('../fonts/BKoodakBold.woff') format('woff'), url('../fonts/BKoodakBold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    color-scheme: light;
    --bg: #f6f5f0;
    --bg-2: #efede5;
    --surface: #ffffff;
    --surface-2: #f0f2eb;
    --surface-3: #e6eae1;
    --glass: rgba(246, 245, 240, .74);
    --line: rgba(23, 45, 32, .10);
    --line-2: rgba(23, 45, 32, .18);
    --text: #17231b;
    --text-2: #33433a;
    --muted: #5d6b62;
    --faint: #89958d;
    --primary: #2f6b4f;
    --primary-2: #4f8a6a;
    --primary-3: #8fb39a;
    --primary-ink: #ffffff;
    --primary-soft: rgba(47, 107, 79, .085);
    --primary-line: rgba(47, 107, 79, .26);
    --accent: #9c7c42;
    --accent-soft: rgba(168, 134, 74, .13);
    --danger: #b0463d;
    --danger-soft: rgba(176, 70, 61, .1);
    --warn: #9a6a12;
    --warn-soft: rgba(176, 124, 26, .12);
    --grad: linear-gradient(135deg, #1f4d3a 0%, #3b7658 55%, #6f9e7f 100%);
    --grad-text: linear-gradient(120deg, #1f4d3a 0%, #3f7a5c 45%, #8a7442 100%);
    --glow: rgba(79, 138, 106, .30);
    --glow-2: rgba(168, 134, 74, .16);
    --pattern-ink: rgba(47, 107, 79, .11);
    --mark: rgba(168, 134, 74, .26);
    --shadow-sm: 0 1px 2px rgba(18, 38, 26, .06), 0 1px 1px rgba(18, 38, 26, .04);
    --shadow: 0 14px 34px -16px rgba(18, 38, 26, .22), 0 2px 6px -2px rgba(18, 38, 26, .06);
    --shadow-lg: 0 34px 90px -34px rgba(18, 38, 26, .40);

    --font-fa: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
    --font-en: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-en-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
    --font-en-read: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-arabic: 'Amiri', 'Noto Naskh Arabic', 'Traditional Arabic', serif;
    --font-brand: 'BKoodak', var(--font-fa);

    --font-body: var(--font-fa);
    --font-display: var(--font-fa);
    --font-read: var(--font-fa);
    --track-display: 0;
    --track-caps: 0;
    --read-size: 1.14rem;
    --read-lh: 2.05;

    --radius-sm: 10px;
    --radius: 18px;
    --radius-lg: 26px;
    --ease: cubic-bezier(.2, .8, .2, 1);
    --header-h: 68px;
    --container: 1200px;
}

html[lang="en"] {
    --font-body: var(--font-en);
    --font-display: var(--font-en-display);
    --font-read: var(--font-en-read);
    --track-display: -.026em;
    --track-caps: .16em;
    --read-size: 1.16rem;
    --read-lh: 1.75;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0a100c;
    --bg-2: #0e1611;
    --surface: #121b15;
    --surface-2: #17221b;
    --surface-3: #1d2a22;
    --glass: rgba(10, 16, 12, .72);
    --line: rgba(214, 236, 221, .085);
    --line-2: rgba(214, 236, 221, .16);
    --text: #e8eee9;
    --text-2: #c7d2ca;
    --muted: #95a399;
    --faint: #6c7a70;
    --primary: #7fb894;
    --primary-2: #a3d0b2;
    --primary-3: #4f8a6a;
    --primary-ink: #0a1a10;
    --primary-soft: rgba(127, 184, 148, .1);
    --primary-line: rgba(127, 184, 148, .3);
    --accent: #d2b67e;
    --accent-soft: rgba(210, 182, 126, .12);
    --danger: #e48a80;
    --danger-soft: rgba(228, 138, 128, .12);
    --warn: #e2b55c;
    --warn-soft: rgba(226, 181, 92, .12);
    --grad: linear-gradient(135deg, #5f9a77 0%, #84b896 55%, #b9d8c2 100%);
    --grad-text: linear-gradient(120deg, #a3d0b2 0%, #7fb894 45%, #d2b67e 100%);
    --glow: rgba(111, 165, 133, .20);
    --glow-2: rgba(210, 182, 126, .08);
    --pattern-ink: rgba(163, 208, 178, .07);
    --mark: rgba(210, 182, 126, .28);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .02);
    --shadow-lg: 0 40px 100px -40px rgba(0, 0, 0, .9);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 20px);
    -webkit-text-size-adjust: 100%;
    background: var(--bg);
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
}
body > main { flex: 1; }

/* paper grain: very subtle, gives the flat background some depth */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    opacity: .035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
html[data-theme="dark"] body::before { opacity: .05; }

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
::selection { background: var(--primary); color: var(--primary-ink); }
:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }

.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; inset-inline-start: 16px; top: -60px; z-index: 200;
    background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
}
.skip-link:focus { top: 12px; }

.container { width: min(var(--container), 100% - 40px); margin-inline: auto; }
.narrow { width: min(860px, 100% - 40px); margin-inline: auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------- icons ---------- */
.icon {
    width: 20px; height: 20px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 26px; height: 26px; }
.icon-fill { fill: currentColor; stroke: none; }
[dir="rtl"] .icon-flip { transform: scaleX(-1); }

/* ---------- type ---------- */
.display {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.4rem, 6.2vw, 4.8rem);
    line-height: 1.12;
    letter-spacing: var(--track-display);
    text-wrap: balance;
}
html[lang="en"] .display { line-height: 1.02; }
.h1 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2rem, 4.4vw, 3.3rem);
    line-height: 1.25;
    letter-spacing: var(--track-display);
    text-wrap: balance;
}
.h2 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.7rem, 3.4vw, 2.6rem);
    line-height: 1.3;
    letter-spacing: var(--track-display);
    text-wrap: balance;
}
html[lang="en"] .h1, html[lang="en"] .h2 { line-height: 1.1; }
.h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; line-height: 1.5; letter-spacing: var(--track-display); }
.lead { font-size: clamp(1.04rem, 1.5vw, 1.2rem); color: var(--muted); max-width: 40em; text-wrap: pretty; }
.center .lead { margin-inline: auto; }
.kicker {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: .85rem; font-weight: 600; letter-spacing: var(--track-caps);
    color: var(--accent); margin-bottom: 14px;
}
html[lang="en"] .kicker { text-transform: uppercase; font-size: .76rem; }
.kicker::before { content: ""; width: 22px; height: 1.5px; background: currentColor; opacity: .7; }
.center .kicker::after { content: ""; width: 22px; height: 1.5px; background: currentColor; opacity: .7; }
.text-gradient {
    background: var(--grad-text);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}

/* ---------- buttons ---------- */
.btn {
    --mx: 0px; --my: 0px;
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    padding: 13px 22px;
    border: 1px solid transparent; border-radius: 999px;
    font-family: var(--font-body); font-weight: 600; font-size: .96rem; line-height: 1.2;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    overflow: hidden; isolation: isolate;
    transform: translate(var(--mx), var(--my));
    transition: transform .25s var(--ease), box-shadow .3s var(--ease), background-color .25s, border-color .25s, color .25s, opacity .2s;
}
.btn-primary {
    background: var(--grad); color: var(--primary-ink);
    box-shadow: 0 10px 28px -12px var(--glow), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover { box-shadow: 0 16px 40px -14px var(--glow), 0 0 0 4px var(--primary-soft), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-primary::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform .8s var(--ease);
}
.btn-primary:hover::after { transform: translateX(120%); }
.btn .icon { transition: transform .3s var(--ease); }
.btn-primary:hover .icon-flip, .btn-ghost:hover .icon-flip { transform: translateX(3px); }
[dir="rtl"] .btn-primary:hover .icon-flip, [dir="rtl"] .btn-ghost:hover .icon-flip { transform: scaleX(-1) translateX(3px); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--primary-line); background: var(--surface-2); }
.btn-soft { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.btn-soft:hover { background: var(--primary); color: var(--primary-ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.btn-warn:hover { background: var(--warn); color: #fff; }
.btn-link { padding: 0; border-radius: 4px; color: var(--primary); background: none; overflow: visible; }
.btn-link:hover { color: var(--text); }
.btn-sm { padding: 9px 15px; font-size: .88rem; gap: 7px; }
.btn-xs { padding: 6px 11px; font-size: .8rem; gap: 6px; }
.btn-lg { padding: 16px 28px; font-size: 1.04rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .65; cursor: progress; pointer-events: none; }
.btn-icon {
    width: 40px; height: 40px; padding: 0; border-radius: 50%;
    display: inline-grid; place-items: center;
    color: var(--muted); background: transparent; border: 1px solid transparent;
    transition: color .2s, background-color .2s, border-color .2s;
}
.btn-icon:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.btn-icon.is-on { color: var(--primary); background: var(--primary-soft); border-color: var(--primary-line); }

.link-arrow {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--primary); font-weight: 600;
    background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat;
    transition: background-size .35s var(--ease), color .2s;
}
[dir="rtl"] .link-arrow { background-position: 100% 100%; }
.link-arrow:hover { background-size: 100% 1.5px; }
.link-arrow .icon { width: 16px; height: 16px; transition: translate .3s var(--ease); }
.link-arrow:hover .icon { translate: 3px 0; }
[dir="rtl"] .link-arrow:hover .icon { translate: -3px 0; }

kbd {
    display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
    font: 600 .72rem/1 var(--font-en); color: var(--muted);
    border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--surface);
}

/* ---------- badges & chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    font-size: .78rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
    color: var(--muted); background: var(--surface-2); border: 1px solid var(--line);
}
.badge .icon { width: 14px; height: 14px; }
.badge-primary { color: var(--primary); background: var(--primary-soft); border-color: var(--primary-line); }
.badge-accent { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.badge-danger { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.badge-warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.center .chips { justify-content: center; }
.chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 14px; border-radius: 999px;
    font-size: .9rem; color: var(--text-2);
    background: var(--glass); border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    transition: border-color .25s, color .25s, background-color .25s, translate .25s var(--ease);
}
.chip:hover { color: var(--primary); border-color: var(--primary-line); translate: 0 -2px; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tone, var(--primary-2)); }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; color: var(--muted); font-size: .88rem; }
.meta > span { display: inline-flex; align-items: center; gap: 6px; }
.meta .icon { width: 15px; height: 15px; opacity: .8; }

/* ---------- header ---------- */
.scroll-progress {
    position: fixed; inset: 0 0 auto; height: 2.5px; z-index: 70;
    background: var(--grad); transform-origin: 0 50%; transform: scaleX(var(--progress, 0));
    pointer-events: none;
}
[dir="rtl"] .scroll-progress { transform-origin: 100% 50%; }
@supports (animation-timeline: scroll()) {
    .scroll-progress { animation: progress linear both; animation-timeline: scroll(root); }
    @keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

.site-header {
    position: fixed; inset: 0 0 auto; z-index: 60; height: var(--header-h);
    display: flex; align-items: center;
    border-bottom: 1px solid transparent;
    transition: background-color .35s, border-color .35s, box-shadow .35s;
    view-transition-name: site-header;
}
.site-header.is-scrolled, .site-header.is-solid {
    background: var(--glass);
    -webkit-backdrop-filter: saturate(170%) blur(18px); backdrop-filter: saturate(170%) blur(18px);
    border-color: var(--line);
}
.header-inner { display: flex; align-items: center; gap: 22px; }

.brand { display: inline-flex; align-items: center; gap: 11px; flex: none; color: var(--text); }
.brand-mark {
    width: 38px; height: 38px; border-radius: 12px; flex: none;
    display: grid; place-items: center;
    background: var(--grad); color: var(--primary-ink);
    box-shadow: 0 8px 20px -10px var(--glow), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-mark svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.brand-name { font-family: var(--font-brand); font-size: 1.42rem; line-height: 1; font-weight: 700; padding-top: 4px; }
html[lang="en"] .brand-name { font-family: var(--font-en-display); font-size: 1.12rem; letter-spacing: -.02em; padding-top: 0; }
.brand-name small { display: block; font-family: var(--font-body); font-size: .68rem; font-weight: 500; color: var(--muted); letter-spacing: var(--track-caps); margin-top: 5px; }
html[lang="en"] .brand-name small { text-transform: uppercase; font-size: .6rem; }

.header-nav { display: flex; align-items: center; gap: 4px; margin-inline-start: 18px; }
.nav-link {
    position: relative; display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 13px; border-radius: 999px;
    font-size: .94rem; font-weight: 500; color: var(--muted);
    transition: color .2s, background-color .2s;
    cursor: pointer; list-style: none;
}
.nav-link::-webkit-details-marker { display: none; }
.nav-link:hover, .nav-link[aria-current="page"], details[open] > .nav-link { color: var(--text); background: var(--surface-2); }
.nav-link[aria-current="page"]::after {
    content: ""; position: absolute; inset-inline: 14px; bottom: 3px; height: 2px; border-radius: 2px; background: var(--primary-2);
}
.nav-link .icon-sm { transition: rotate .3s var(--ease); }
details[open] > .nav-link .icon-sm { rotate: 180deg; }

.nav-drop { position: relative; }
.nav-drop-panel {
    position: absolute; inset-inline-start: -12px; top: calc(100% + 12px);
    width: min(560px, 90vw);
    padding: 14px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    animation: pop-in .28s var(--ease);
}
@keyframes pop-in { from { opacity: 0; translate: 0 -6px; scale: .98; } }
.nav-drop-panel a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 12px; font-size: .94rem; color: var(--text-2);
    transition: background-color .2s, color .2s;
}
.nav-drop-panel a:hover { background: var(--surface-2); color: var(--primary); }
.nav-drop-panel .tone-dot { width: 30px; height: 30px; border-radius: 9px; flex: none; background: var(--tone-bg); position: relative; overflow: hidden; }
.nav-drop-panel .tone-dot::after { content: ""; position: absolute; inset: 0; background: var(--tone); -webkit-mask: url('../img/pattern.svg') 0 0 / 30px; mask: url('../img/pattern.svg') 0 0 / 30px; opacity: .55; }
.nav-drop-panel .all {
    grid-column: 1 / -1; justify-content: space-between; margin-top: 6px;
    border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; padding-top: 14px; color: var(--primary); font-weight: 600;
}

.header-actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.search-trigger {
    display: inline-flex; align-items: center; gap: 10px;
    height: 40px; padding-inline: 14px 8px; border-radius: 999px;
    color: var(--muted); font-size: .9rem;
    background: var(--surface); border: 1px solid var(--line-2);
    transition: border-color .2s, color .2s, box-shadow .2s;
    min-width: 210px;
}
.search-trigger:hover { border-color: var(--primary-line); color: var(--text); box-shadow: 0 0 0 4px var(--primary-soft); }
.search-trigger kbd { margin-inline-start: auto; }
.lang-switch {
    display: inline-flex; align-items: center; gap: 7px; height: 40px; padding-inline: 14px;
    border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--text-2);
    border: 1px solid var(--line-2); background: var(--surface);
    transition: border-color .2s, color .2s;
}
.lang-switch:hover { border-color: var(--primary-line); color: var(--primary); }
.lang-switch .fa { font-family: var(--font-fa); }
.lang-switch .en { font-family: var(--font-en); }
.theme-toggle .i-sun { display: none; }
html[data-theme="dark"] .theme-toggle .i-sun { display: block; }
html[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.menu-toggle { display: none; }

@media (max-width: 1060px) {
    .search-trigger { min-width: 0; padding-inline: 11px; width: 40px; justify-content: center; }
    .search-trigger .label, .search-trigger kbd { display: none; }
}
@media (max-width: 880px) {
    .header-nav { display: none; }
    .menu-toggle { display: inline-grid; }
    .brand-name small { display: none; }
}
@media (max-width: 420px) {
    .lang-switch { padding-inline: 11px; }
    .brand-name { font-size: 1.2rem; }
}

/* ---------- drawer (mobile nav) & dialogs ---------- */
dialog { color: var(--text); }
dialog::backdrop { background: rgba(8, 14, 10, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.drawer {
    margin: 0; margin-inline-start: auto; height: 100dvh; max-height: none; width: min(380px, 88vw);
    padding: 22px; border: 0; background: var(--surface); box-shadow: var(--shadow-lg);
    border-start-start-radius: var(--radius-lg); border-end-start-radius: var(--radius-lg);
}
.drawer[open] { display: flex; flex-direction: column; gap: 6px; animation: drawer-in .38s var(--ease); }
@keyframes drawer-in { from { translate: 30px 0; opacity: 0; } }
[dir="rtl"] .drawer[open] { animation-name: drawer-in-rtl; }
@keyframes drawer-in-rtl { from { translate: -30px 0; opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.drawer a.drawer-link { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 14px; font-weight: 500; color: var(--text-2); }
.drawer a.drawer-link:hover, .drawer a.drawer-link[aria-current="page"] { background: var(--surface-2); color: var(--primary); }
.drawer-label { margin: 16px 14px 6px; font-size: .78rem; font-weight: 600; color: var(--faint); letter-spacing: var(--track-caps); }
html[lang="en"] .drawer-label { text-transform: uppercase; }
.drawer-topics { display: flex; flex-wrap: wrap; gap: 8px; padding-inline: 10px; }
.drawer-foot { margin-top: auto; display: flex; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }

.dialog {
    margin: auto; width: min(560px, 100% - 32px); max-height: min(88vh, 900px);
    padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden;
}
.dialog-lg { width: min(860px, 100% - 32px); }
.dialog[open] { display: flex; flex-direction: column; animation: dialog-in .32s var(--ease); }
@keyframes dialog-in { from { opacity: 0; translate: 0 14px; scale: .98; } }
.dialog-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.dialog-head h2, .dialog-head h3 { font-family: var(--font-display); font-size: 1.12rem; font-weight: 700; flex: 1; display: flex; align-items: center; gap: 10px; }
.dialog-head h2 .icon, .dialog-head h3 .icon { color: var(--primary); }
.dialog-body { padding: 22px; overflow: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); background: var(--bg-2); }

/* command palette */
.cmdk { width: min(640px, 100% - 24px); margin-top: 12vh; margin-bottom: auto; }
.cmdk-field { display: flex; align-items: center; gap: 12px; padding: 6px 18px; border-bottom: 1px solid var(--line); }
.cmdk-field .icon { color: var(--primary); }
.cmdk-field input { flex: 1; min-width: 0; height: 58px; border: 0; outline: 0; background: transparent; font-size: 1.08rem; }
.cmdk-list { max-height: 52vh; overflow: auto; padding: 8px; }
.cmdk-hint { padding: 12px 22px 16px; color: var(--faint); font-size: .84rem; display: flex; flex-wrap: wrap; gap: 6px 18px; border-top: 1px solid var(--line); }
.cmdk-hint span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- suggestions (shared by hero search and palette) ---------- */
.search-wrap { position: relative; }
.suggest {
    position: absolute; inset-inline: 0; top: calc(100% + 10px); z-index: 40;
    padding: 8px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
    max-height: 420px; overflow: auto; text-align: start;
    animation: pop-in .25s var(--ease);
}
.cmdk .suggest, .suggest.is-static { position: static; box-shadow: none; border: 0; padding: 0; animation: none; max-height: none; }
.suggest-item {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 14px;
    padding: 11px 12px; border-radius: 12px; cursor: pointer; color: var(--text);
}
.suggest-item[aria-selected="true"], .suggest-item:hover { background: var(--surface-2); }
.suggest-item .s-icon { grid-row: span 2; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.suggest-item .s-title { font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .s-hl { grid-column: 2; font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .s-type { grid-row: 1 / span 2; grid-column: 3; }
.suggest-empty { padding: 18px; text-align: center; color: var(--muted); font-size: .92rem; }
.suggest-all { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; color: var(--primary); font-weight: 600; }
.suggest-all:hover, .suggest-all[aria-selected="true"] { background: var(--primary-soft); }

/* ---------- search box ---------- */
.search-box {
    display: flex; align-items: center; gap: 6px; padding: 7px;
    border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2);
    box-shadow: var(--shadow);
    transition: border-color .3s, box-shadow .3s;
}
.search-box:focus-within { border-color: var(--primary-line); box-shadow: var(--shadow), 0 0 0 5px var(--primary-soft); }
.search-box > .icon { margin-inline-start: 14px; color: var(--primary); flex: none; }
.search-box input {
    flex: 1; min-width: 0; height: 48px; padding-inline: 8px;
    background: transparent; border: 0; outline: 0; font-size: 1.05rem; color: var(--text);
}
.search-box input::placeholder { color: var(--faint); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box .btn { flex: none; }
.search-box-lg input { height: 56px; font-size: 1.12rem; }
@media (max-width: 520px) {
    .search-box .btn .label { display: none; }
    .search-box .btn { padding: 13px; }
}

/* ---------- geometric pattern & emblem ---------- */
.pattern-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.pattern-bg::before {
    content: ""; position: absolute; inset: -2px;
    background: var(--pattern-ink);
    -webkit-mask: url('../img/pattern.svg') 0 0 / 120px; mask: url('../img/pattern.svg') 0 0 / 120px;
    -webkit-mask-composite: source-in;
}
.pattern-bg::after {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(ellipse 70% 60% at 50% 40%, transparent 0%, var(--bg) 78%);
}
.glow {
    position: absolute; z-index: -1; pointer-events: none;
    width: 900px; height: 720px; inset-inline-end: -220px; top: 46%; translate: 0 -50%;
    background:
        radial-gradient(closest-side, var(--glow), transparent 70%),
        radial-gradient(closest-side at 70% 70%, var(--glow-2), transparent 70%);
    filter: blur(30px);
    animation: breathe 8s ease-in-out infinite alternate;
}
@keyframes breathe { from { opacity: .7; scale: .95; } to { opacity: 1; scale: 1.05; } }

.emblem { width: 100%; height: auto; overflow: visible; color: var(--primary); }
.emblem .e-line { fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; opacity: .55; }
.emblem .e-strong { stroke-width: 1.8; opacity: .9; }
.emblem .e-accent { stroke: var(--accent); opacity: .75; }
.emblem .e-fill { fill: var(--primary-soft); stroke: none; }
.emblem .e-spin { transform-origin: 300px 300px; animation: spin 140s linear infinite; }
.emblem .e-spin-rev { transform-origin: 300px 300px; animation: spin 200s linear infinite reverse; }
@keyframes spin { to { rotate: 360deg; } }
.js .emblem .e-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.6s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 120ms + 200ms); }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- hero (home) ---------- */
.hero {
    position: relative; isolation: isolate; overflow: hidden;
    min-height: min(84svh, 820px);
    display: flex; align-items: center;
    padding: calc(var(--header-h) + 48px) 0 80px;
}
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(28px, 5vw, 72px); align-items: center; }
.hero-copy > * + * { margin-top: 22px; }
.hero-copy .display { margin-top: 18px; }
.hero-copy .search-wrap { max-width: 640px; margin-top: 34px; }
.hero-chips { margin-top: 20px !important; }
.hero-chips .label { font-size: .85rem; color: var(--faint); margin-inline-end: 4px; align-self: center; }
.hero-visual { position: relative; max-width: 520px; justify-self: center; width: 100%; }
.hero-visual .emblem-card {
    position: absolute; padding: 14px 16px; border-radius: 16px; max-width: 250px;
    background: var(--glass); border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
    animation: float 7s ease-in-out infinite;
    font-size: .88rem;
}
.hero-visual .emblem-card b { display: block; font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; color: var(--primary); }
.hero-visual .emblem-card span { color: var(--muted); }
.emblem-card.c1 { inset-inline-start: -8%; bottom: 16%; }
.emblem-card.c2 { inset-inline-end: -4%; top: 10%; animation-delay: -3.5s; }
@keyframes float { 50% { translate: 0 -10px; } }

.eyebrow {
    display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
    padding: 7px 16px 7px 8px; border-radius: 999px;
    background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
    font-size: .86rem; font-weight: 500; color: var(--accent);
}
[dir="rtl"] .eyebrow { padding: 7px 8px 7px 16px; }
.eyebrow-tag { padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--surface); font-size: .76rem; font-weight: 700; white-space: nowrap; }
.pulse-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.pulse-dot::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: inherit; animation: ping 1.9s var(--ease) infinite; }
@keyframes ping { to { transform: scale(3); opacity: 0; } }

.ticker { position: relative; display: grid; min-width: 0; overflow: hidden; }
.ticker > a {
    grid-area: 1 / 1; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: opacity .5s var(--ease), translate .5s var(--ease);
}
.ticker > a:hover { color: var(--primary); }
.js .ticker > a:not(.is-active) { opacity: 0; translate: 0 100%; pointer-events: none; }
.js .ticker > a.is-leaving { opacity: 0; translate: 0 -100%; }

#pwa-install-btn.d-none { display: none; }

@media (max-width: 960px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero-visual { display: none; }
    .hero { min-height: auto; padding-top: calc(var(--header-h) + 36px); }
    .glow { inset-inline-end: -40%; }
}

/* ---------- page hero (inner pages) ---------- */
.page-hero {
    position: relative; isolation: isolate; overflow: hidden;
    padding: calc(var(--header-h) + clamp(44px, 7vw, 84px)) 0 clamp(36px, 5vw, 56px);
    border-bottom: 1px solid var(--line);
}
.page-hero .glow { width: 700px; height: 520px; top: 30%; }
.page-hero .pattern-bg::after { background: radial-gradient(ellipse 80% 90% at 50% 0%, transparent 0%, var(--bg) 70%); }
.page-hero-grid { display: grid; grid-template-columns: 1fr minmax(320px, 460px); gap: 28px 56px; align-items: end; }
.page-hero-grid > :only-child { grid-column: 1 / -1; }
.page-hero .lead { margin-top: 14px; }
.page-hero .meta { margin-top: 18px; }
@media (max-width: 900px) { .page-hero-grid { grid-template-columns: 1fr; } }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 18px; font-size: .88rem; color: var(--faint); }
.crumbs a { color: var(--muted); transition: color .2s; }
.crumbs a:hover { color: var(--primary); }
.crumbs .icon { width: 14px; height: 14px; opacity: .6; }

/* ---------- sections ---------- */
.section { position: relative; padding: clamp(64px, 8vw, 112px) 0; }
.section-tight { padding: clamp(40px, 5vw, 64px) 0; }
.section-alt { background: var(--bg-2); border-block: 1px solid var(--line); }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 32px; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head > div { max-width: 720px; }
.section-head .lead { margin-top: 10px; }
.section-head.center { flex-direction: column; align-items: center; text-align: center; }

/* ---------- tones (per topic / card) ---------- */
.tone-0 { --tone: #2f6b4f; --tone-bg: #dfeae2; }
.tone-1 { --tone: #3c6e70; --tone-bg: #dde9e8; }
.tone-2 { --tone: #6b7a3a; --tone-bg: #e8ebd9; }
.tone-3 { --tone: #8a6d3b; --tone-bg: #efe7d8; }
.tone-4 { --tone: #4b6a55; --tone-bg: #e2e8e2; }
.tone-5 { --tone: #2d5c5f; --tone-bg: #dbe6e6; }
html[data-theme="dark"] .tone-0 { --tone: #8cc4a0; --tone-bg: #16251c; }
html[data-theme="dark"] .tone-1 { --tone: #8cc2c3; --tone-bg: #142324; }
html[data-theme="dark"] .tone-2 { --tone: #bccb8a; --tone-bg: #1f2316; }
html[data-theme="dark"] .tone-3 { --tone: #d6b986; --tone-bg: #251f15; }
html[data-theme="dark"] .tone-4 { --tone: #a3c2ad; --tone-bg: #19221c; }
html[data-theme="dark"] .tone-5 { --tone: #85babd; --tone-bg: #132122; }

/* ---------- cards ---------- */
.card {
    --x: 50%; --y: 50%;
    position: relative; overflow: hidden; isolation: isolate;
    border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    transition: border-color .35s, box-shadow .4s var(--ease), translate .4s var(--ease);
}
.card::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .4s;
    background: radial-gradient(380px circle at var(--x) var(--y), var(--primary-soft), transparent 65%);
}
a.card:hover, .card.is-link:hover { border-color: var(--primary-line); box-shadow: var(--shadow); translate: 0 -3px; }
.card:hover::before { opacity: 1; }
.card-pad { padding: clamp(20px, 2.4vw, 28px); }

.q-card { display: flex; flex-direction: column; min-height: 100%; }
.q-cover {
    position: relative; height: 92px; flex: none;
    background: var(--tone-bg, var(--surface-2));
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}
.q-cover::before {
    content: ""; position: absolute; inset: 0;
    background: var(--tone, var(--primary));
    -webkit-mask: url('../img/pattern.svg') var(--px, 0) 0 / 84px; mask: url('../img/pattern.svg') var(--px, 0) 0 / 84px;
    opacity: .2; transition: opacity .4s, scale 1.2s var(--ease);
}
.q-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 30%, var(--surface) 140%); }
.q-card:hover .q-cover::before { opacity: .45; scale: 1.08; }
.q-cover .badge { position: absolute; inset-inline-end: 14px; bottom: 12px; z-index: 1; background: var(--surface); }
.q-cover .q-topic { position: absolute; inset-inline-start: 16px; bottom: 13px; z-index: 1; font-size: .8rem; font-weight: 600; color: var(--tone); }
.q-body { display: flex; flex-direction: column; gap: 14px; flex: 1; padding: 18px 20px 20px; }
.q-title { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; line-height: 1.6; color: var(--text); text-wrap: pretty; }
html[lang="en"] .q-title { line-height: 1.38; letter-spacing: -.01em; }
.q-excerpt { color: var(--muted); font-size: .94rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.q-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--faint); font-size: .84rem; }
.q-foot .go {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    color: var(--primary); background: var(--primary-soft);
    transition: background-color .3s, color .3s, translate .3s var(--ease);
}
.q-card:hover .go { background: var(--primary); color: var(--primary-ink); translate: 3px 0; }
[dir="rtl"] .q-card:hover .go { translate: -3px 0; }
.q-card-feature .q-cover { height: 150px; }
.q-card-feature .q-title { font-size: clamp(1.25rem, 2vw, 1.6rem); line-height: 1.5; }
html[lang="en"] .q-card-feature .q-title { line-height: 1.25; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }
.bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.bento > .q-card-feature { grid-column: span 2; grid-row: span 2; }
@media (max-width: 960px) { .bento { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .bento { grid-template-columns: 1fr; } .bento > .q-card-feature { grid-column: auto; grid-row: auto; } }

/* topic card */
.t-card { display: flex; flex-direction: column; gap: 14px; padding: 24px; min-height: 210px; }
.t-card .t-icon {
    position: relative; overflow: hidden;
    width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
    background: var(--tone-bg); color: var(--tone); border: 1px solid var(--line);
}
.t-card .t-icon::before { content: ""; position: absolute; inset: 0; background: var(--tone); -webkit-mask: url('../img/pattern.svg') 0 0 / 52px; mask: url('../img/pattern.svg') 0 0 / 52px; opacity: .2; }
.t-card .t-icon svg { position: relative; width: 26px; height: 26px; }
.t-card h3 { font-family: var(--font-display); font-size: 1.22rem; font-weight: 700; line-height: 1.45; }
.t-card p { color: var(--muted); font-size: .95rem; }
.t-card .link-arrow { margin-top: auto; }
.t-card-art { position: absolute; inset-inline-end: -40px; top: -40px; width: 180px; height: 180px; color: var(--tone); opacity: .1; z-index: -1; transition: rotate 1.4s var(--ease), opacity .4s; }
.t-card:hover .t-card-art { rotate: 45deg; opacity: .2; }

/* ---------- tabs ---------- */
.tabs {
    position: relative; display: flex; gap: 6px; padding: 6px;
    width: max-content; max-width: 100%; margin-inline: auto; margin-bottom: 34px;
    overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
    background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
    box-shadow: var(--shadow-sm);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    position: relative; z-index: 1; flex: none; scroll-snap-align: center;
    padding: 9px 18px; border-radius: 999px;
    font-size: .94rem; font-weight: 500; color: var(--muted); white-space: nowrap;
    transition: color .3s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--primary-ink); }
.tabs-ink {
    position: absolute; z-index: 0; top: 6px; bottom: 6px; inset-inline-start: 0;
    border-radius: 999px; background: var(--grad);
    box-shadow: 0 8px 20px -10px var(--glow);
    transition: translate .45s var(--ease), width .45s var(--ease);
}
html:not(.js) .tab[aria-selected="true"], .tabs:not(.has-ink) .tab[aria-selected="true"] { background: var(--grad); }
.tab-panel[hidden] { display: none; }
.tab-panel.is-entering > * { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; translate: 0 14px; } }
.panel-foot { margin-top: 30px; text-align: center; }

/* ---------- ranked list (most popular) ---------- */
.rank-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(28px, 6vw, 88px); align-items: start; }
.rank-aside { position: sticky; top: calc(var(--header-h) + 40px); }
.rank-aside .lead { margin-top: 14px; }
.rank-aside .btn { margin-top: 26px; }
.rank-list { list-style: none; counter-reset: rank; position: relative; }
.rank-list::before { content: ""; position: absolute; inset-block: 30px; inset-inline-start: 27px; width: 1.5px; background: linear-gradient(var(--primary-line), var(--line) 80%, transparent); }
.rank-item { position: relative; counter-increment: rank; display: grid; grid-template-columns: 56px 1fr; gap: 20px; padding-block: 22px; }
.rank-item + .rank-item { border-top: 1px dashed var(--line); }
.rank-num {
    position: relative; width: 56px; height: 56px; border-radius: 50%;
    display: grid; place-items: center;
    font-family: var(--font-en-display); font-weight: 800; font-size: 1.15rem;
    background: var(--surface); border: 1px solid var(--line-2); color: var(--primary);
    box-shadow: var(--shadow-sm);
    transition: background-color .35s, color .35s, border-color .35s, box-shadow .35s;
}
.rank-num::before { content: counter(rank, decimal-leading-zero); }
html[lang="fa"] .rank-num::before { content: counter(rank, persian); font-family: var(--font-fa); font-size: 1.3rem; }
.rank-item:hover .rank-num, .rank-item.is-visible:first-child .rank-num { background: var(--grad); color: var(--primary-ink); border-color: transparent; box-shadow: 0 10px 26px -12px var(--glow); }
.rank-item h3 { font-family: var(--font-display); font-size: 1.16rem; font-weight: 700; line-height: 1.6; }
html[lang="en"] .rank-item h3 { line-height: 1.35; }
.rank-item h3 a { background: linear-gradient(var(--primary-line), var(--primary-line)) 0 100% / 0 2px no-repeat; transition: background-size .45s var(--ease), color .2s; }
[dir="rtl"] .rank-item h3 a { background-position: 100% 100%; }
.rank-item h3 a:hover { background-size: 100% 2px; color: var(--primary); }
.rank-item p { margin-top: 8px; color: var(--muted); font-size: .95rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.rank-item .meta { margin-top: 12px; }
@media (max-width: 900px) { .rank-grid { grid-template-columns: 1fr; } .rank-aside { position: static; } }

/* ---------- FAQ / latest ---------- */
.faq-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: clamp(28px, 5vw, 64px); align-items: start; }
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
    display: flex; align-items: center; gap: 18px;
    padding: 22px 4px; cursor: pointer; list-style: none;
    font-family: var(--font-display); font-weight: 700; font-size: clamp(1.02rem, 1.6vw, 1.16rem); line-height: 1.6;
    transition: color .2s;
}
html[lang="en"] .faq summary { line-height: 1.4; }
.faq summary:hover { color: var(--primary); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: ""; flex: none; width: 30px; height: 30px; margin-inline-start: auto; border-radius: 50%;
    background:
        linear-gradient(var(--primary), var(--primary)) center / 12px 1.8px no-repeat,
        linear-gradient(var(--primary), var(--primary)) center / 1.8px 12px no-repeat,
        var(--primary-soft);
    transition: rotate .35s var(--ease), background-color .3s;
}
.faq details[open] summary::after { rotate: 135deg; }
.faq .faq-body { padding: 0 4px 24px; color: var(--muted); }
.faq .faq-body p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.faq .faq-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: .88rem; }
@supports (interpolate-size: allow-keywords) {
    .faq { interpolate-size: allow-keywords; }
    .faq details::details-content { block-size: 0; overflow: hidden; transition: block-size .4s var(--ease), content-visibility .4s allow-discrete; }
    .faq details[open]::details-content { block-size: auto; }
}
.faq-side { position: sticky; top: calc(var(--header-h) + 40px); padding: 30px; }
.faq-side .emblem { width: 120px; margin-bottom: 18px; }
.faq-side h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; line-height: 1.4; }
.faq-side p { color: var(--muted); margin: 10px 0 22px; }
@media (max-width: 900px) { .faq-grid { grid-template-columns: 1fr; } .faq-side { position: static; } }

/* ---------- CTA band ---------- */
.cta {
    position: relative; isolation: isolate; overflow: hidden;
    padding: clamp(44px, 7vw, 84px) clamp(22px, 5vw, 72px);
    border-radius: var(--radius-lg);
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
    text-align: center;
}
.cta .glow { inset-inline: auto; left: 50%; translate: -50% -50%; width: 760px; height: 520px; top: 60%; }
.cta .lead { margin: 14px auto 0; }
.cta .search-wrap { max-width: 580px; margin: 30px auto 0; }
.cta-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 22px; }

/* ---------- footer ---------- */
.site-footer { margin-top: auto; border-top: 1px solid var(--line); background: var(--bg-2); padding: 56px 0 calc(32px + env(safe-area-inset-bottom)); }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 32px 40px; }
.footer-brand p { margin-top: 16px; color: var(--muted); font-size: .94rem; max-width: 30em; }
.footer-col h3 { font-size: .8rem; font-weight: 700; letter-spacing: var(--track-caps); color: var(--faint); margin-bottom: 14px; }
html[lang="en"] .footer-col h3 { text-transform: uppercase; }
.footer-col ul { list-style: none; display: grid; gap: 9px; }
.footer-col a { color: var(--text-2); font-size: .95rem; transition: color .2s; display: inline-flex; align-items: center; gap: 8px; }
.footer-col a:hover { color: var(--primary); }
.footer-tg {
    display: inline-flex !important; align-items: center; gap: 12px; padding: 10px 16px 10px 10px !important;
    border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
}
[dir="rtl"] .footer-tg { padding: 10px 10px 10px 16px !important; }
.footer-tg .tg { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #2aa3d8; color: #fff; }
.footer-tg small { display: block; color: var(--muted); font-size: .78rem; }
.footer-bottom { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--faint); font-size: .86rem; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

/* ---------- article (question detail) ---------- */
.article-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 48px; justify-content: center; }
.article-wrap > article { max-width: 760px; width: 100%; margin-inline: auto; }
.article-rail { position: sticky; top: calc(var(--header-h) + 40px); align-self: start; display: grid; gap: 8px; justify-items: center; }
.article-rail .rail-label { font-size: .72rem; color: var(--faint); writing-mode: vertical-rl; margin-bottom: 4px; letter-spacing: var(--track-caps); }
@media (max-width: 1100px) { .article-wrap { grid-template-columns: minmax(0, 1fr); } .article-rail { display: none; } }

.reader-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 30px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.reader-tools .group { display: flex; align-items: center; gap: 4px; }
.reader-tools .sep { width: 1px; height: 22px; background: var(--line-2); margin-inline: 6px; }
.reader-tools .size-label { font-size: .82rem; color: var(--faint); margin-inline: 4px; }

.prose { font-family: var(--font-read); font-size: calc(var(--read-size) * var(--reader-scale, 1)); line-height: var(--read-lh); color: var(--text-2); overflow-wrap: anywhere; }
.prose > * + * { margin-top: 1.05em; }
.prose p { text-wrap: pretty; }
.prose a { color: var(--primary); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: var(--primary-line); }
.prose a:hover { text-decoration-color: currentColor; }
.prose b, .prose strong { color: var(--text); font-weight: 700; }
.prose h4, .prose h3 {
    display: flex; align-items: center; gap: 12px;
    margin-top: 2em; margin-bottom: .2em;
    font-family: var(--font-display); font-size: 1.18em; font-weight: 800; line-height: 1.5; color: var(--text);
}
.prose h4::after, .prose h3::after { content: ""; flex: 1; height: 1px; background: linear-gradient(to var(--fade-end, right), var(--line-2), transparent); }
[dir="rtl"] .prose { --fade-end: left; }
.prose > :first-child { margin-top: 0; }
.prose .arabic-text {
    position: relative;
    margin-block: 1.5em; padding: 1.1em 1.4em 1.1em 1.4em;
    font-family: var(--font-arabic); font-size: 1.3em; line-height: 2.05; font-weight: 400; color: var(--text);
    direction: rtl; text-align: right;
    background: linear-gradient(to left, var(--primary-soft), transparent 95%);
    border-right: 3px solid var(--primary-2);
    border-radius: 4px 14px 14px 4px;
}
.prose .arabic-text::before {
    content: "“"; position: absolute; top: -.18em; left: .3em; font-family: Georgia, serif; font-size: 3.4em; line-height: 1; color: var(--primary-2); opacity: .18;
}
.prose .text-muted.small, .prose .small {
    display: flex; align-items: baseline; gap: 8px;
    margin-top: -.4em; font-family: var(--font-body); font-size: .8em; line-height: 1.7; color: var(--accent);
}
.prose ul, .prose ol { padding-inline-start: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose .text-primary { color: var(--text); }
.prose img { border-radius: 14px; }
.prose mark { background: var(--mark); color: inherit; border-radius: 4px; padding: 0 .15em; }

.article-end { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; }
.share { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.share-label { font-size: .88rem; color: var(--muted); margin-inline-end: 6px; }
.share .btn-icon { border-color: var(--line); background: var(--surface); }
.share .btn-icon:hover { color: var(--primary); border-color: var(--primary-line); }

.mobile-share {
    position: fixed; inset-inline: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 55;
    display: none; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 8px 8px 16px; border-radius: 999px;
    background: var(--glass); border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
    box-shadow: var(--shadow-lg);
    transition: translate .45s var(--ease), opacity .3s;
}
[dir="rtl"] .mobile-share { padding: 8px 16px 8px 8px; }
.mobile-share.is-hidden { translate: 0 140%; opacity: 0; }
.mobile-share .progress-text { font-size: .82rem; color: var(--muted); }
@media (max-width: 1100px) { .mobile-share { display: flex; } .has-mobile-share .site-footer { padding-bottom: 110px; } }

.sel-pop {
    position: fixed; z-index: 90; translate: -50% calc(-100% - 10px);
    display: inline-flex; gap: 4px; padding: 5px; border-radius: 999px;
    background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
    animation: pop-in .2s var(--ease);
}
.sel-pop button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; font-size: .86rem; font-weight: 600; color: inherit; }
.sel-pop button:hover { background: color-mix(in srgb, var(--bg) 16%, transparent); }
.sel-pop .icon { width: 15px; height: 15px; }

.toast-stack { position: fixed; z-index: 120; inset-inline: 0; bottom: calc(24px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast {
    display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px;
    background: var(--text); color: var(--bg); font-size: .92rem; font-weight: 500;
    box-shadow: var(--shadow-lg); pointer-events: auto;
    animation: toast-in .4s var(--ease);
}
.toast .icon { width: 18px; height: 18px; color: var(--primary-3); }
.toast.is-error .icon { color: #f0a49b; }
.toast.is-leaving { animation: toast-out .3s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; translate: 0 16px; scale: .96; } }
@keyframes toast-out { to { opacity: 0; translate: 0 10px; } }

.next-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 40px; }
.next-steps .card { padding: 22px; display: flex; gap: 16px; align-items: flex-start; }
.next-steps .n-icon { width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.next-steps h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; }
.next-steps p { font-size: .9rem; color: var(--muted); margin-top: 4px; }

/* ---------- search results ---------- */
.results-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; color: var(--muted); }
.results-meta strong { color: var(--text); }
.results { display: grid; gap: 14px; }
.result { display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; padding: 22px 24px; }
.result h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; line-height: 1.6; color: var(--text); }
html[lang="en"] .result h3 { line-height: 1.38; }
.result p { grid-column: 1; color: var(--muted); font-size: .95rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.result .go { grid-row: 1 / span 2; grid-column: 2; align-self: center; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); transition: background-color .3s, color .3s; }
.result:hover .go { background: var(--primary); color: var(--primary-ink); }
mark { background: var(--mark); color: inherit; border-radius: 4px; padding: 0 .12em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

.ai-card {
    position: relative; padding: 26px 28px; margin-bottom: 28px; border-radius: var(--radius-lg);
    background:
        linear-gradient(var(--surface), var(--surface)) padding-box,
        linear-gradient(135deg, var(--primary-2), var(--accent) 60%, var(--primary-line)) border-box;
    border: 1.5px solid transparent;
    box-shadow: 0 24px 60px -30px var(--glow);
    animation: rise .6s var(--ease);
}
.ai-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ai-head .ai-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--grad); color: var(--primary-ink); }
.ai-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; }
.ai-head .badge { margin-inline-start: auto; }
.ai-answer { font-family: var(--font-read); font-size: 1.12rem; line-height: var(--read-lh); color: var(--text-2); }
.ai-answer p + p { margin-top: .8em; }
.ai-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-2); }
.ai-sources .label { font-size: .86rem; color: var(--muted); margin-inline-end: 4px; }
.ai-note { margin-top: 14px; font-size: .8rem; color: var(--faint); }

.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; }
.skeleton::after {
    content: ""; position: absolute; inset: 0; translate: -100% 0;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
    animation: shimmer 1.4s ease-in-out infinite;
}
[dir="rtl"] .skeleton::after { animation-name: shimmer-rtl; }
@keyframes shimmer { to { translate: 100% 0; } }
@keyframes shimmer-rtl { from { translate: 100% 0; } to { translate: -100% 0; } }
.sk-line { height: 14px; margin-top: 12px; }
.sk-line.w-90 { width: 90%; } .sk-line.w-75 { width: 75%; } .sk-line.w-60 { width: 60%; } .sk-line.w-40 { width: 40%; }
.sk-card { min-height: 220px; }
.sk-card .sk-cover { height: 92px; border-radius: 0; }

.empty { text-align: center; padding: clamp(36px, 6vw, 72px) 20px; }
.empty .emblem { width: 140px; margin: 0 auto 22px; }
.empty h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; }
.empty p { color: var(--muted); margin: 10px auto 0; max-width: 34em; }
.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 30px; text-align: start; }
.tips .card { padding: 20px; display: flex; gap: 14px; align-items: flex-start; }
.tips .icon { color: var(--primary); margin-top: 3px; }
.tips p { color: var(--text-2); font-size: .95rem; margin: 0; }

.load-more { display: grid; justify-items: center; gap: 14px; margin-top: 30px; color: var(--muted); font-size: .9rem; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--primary); animation: spin .8s linear infinite; }

.to-top {
    position: fixed; inset-inline-end: 22px; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 50;
    width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface); border: 1px solid var(--line-2); color: var(--primary); box-shadow: var(--shadow);
    opacity: 0; translate: 0 14px; pointer-events: none; transition: opacity .3s, translate .4s var(--ease), background-color .2s;
}
.to-top.is-visible { opacity: 1; translate: 0 0; pointer-events: auto; }
.to-top:hover { background: var(--primary); color: var(--primary-ink); }
.has-mobile-share .to-top { bottom: calc(86px + env(safe-area-inset-bottom)); }

/* ---------- prose pages (about / privacy / contact / 404) ---------- */
.page-body { padding: clamp(40px, 6vw, 72px) 0 clamp(64px, 8vw, 110px); }
.page-prose { font-family: var(--font-body); font-size: 1.06rem; line-height: 1.95; color: var(--text-2); }
html[lang="en"] .page-prose { line-height: 1.75; }
.page-prose > * + * { margin-top: 1.1em; }
.page-prose h2 { margin-top: 2em; font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; color: var(--text); line-height: 1.45; }
.page-prose ul { padding-inline-start: 1.3em; display: grid; gap: .5em; }
.page-prose a { color: var(--primary); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--primary-line); }
.page-prose .note { padding: 18px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: .95rem; color: var(--muted); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-block: 34px; }
.feature-grid .card { padding: 24px; }
.feature-grid .f-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 16px; background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-line); }
.feature-grid h3 { font-family: var(--font-display); font-size: 1.08rem; font-weight: 700; }
.feature-grid p { font-size: .94rem; color: var(--muted); margin-top: 6px; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 30px; }
.contact-card { padding: 26px; display: flex; flex-direction: column; gap: 10px; }
.contact-card .c-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: #2aa3d8; margin-bottom: 6px; }
.contact-card .c-icon.alt { background: var(--grad); color: var(--primary-ink); }
.contact-card h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.contact-card p { color: var(--muted); font-size: .95rem; }
.contact-card .btn { margin-top: auto; align-self: flex-start; }

.notfound { min-height: 78svh; display: grid; place-items: center; text-align: center; padding: calc(var(--header-h) + 40px) 0 60px; position: relative; isolation: isolate; overflow: hidden; }
.notfound-code { font-family: var(--font-en-display); font-weight: 800; font-size: clamp(6rem, 20vw, 13rem); line-height: .9; letter-spacing: -.05em; }
.notfound .search-wrap { max-width: 520px; margin: 30px auto 0; }
.notfound .chips { margin-top: 26px; }

/* ---------- forms (shared with admin) ---------- */
.field { display: grid; gap: 7px; }
.field + .field, .field-row + .field, .field + .field-row { margin-top: 16px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.field > label, .field-label, .label { font-size: .88rem; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 7px; }
.field .hint { font-size: .8rem; color: var(--faint); }
.input, .select, .textarea {
    width: 100%; padding: 12px 15px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--line-2); color: var(--text);
    font-size: .98rem; line-height: 1.5;
    transition: border-color .25s, box-shadow .25s, background-color .25s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--primary-2); box-shadow: 0 0 0 4px var(--primary-soft); }
.input[readonly], .textarea[readonly] { background: var(--surface-2); color: var(--muted); }
.textarea { resize: vertical; min-height: 120px; }
.select { appearance: none; padding-inline-end: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c7a70' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 18px; background-position: right 12px center; }
[dir="rtl"] .select { background-position: left 12px center; }
.input-lg { padding: 15px 18px; font-size: 1.04rem; }
.input-group { position: relative; }
.input-group > .icon { position: absolute; inset-inline-start: 14px; top: 50%; translate: 0 -50%; color: var(--faint); pointer-events: none; }
.input-group > .input { padding-inline-start: 44px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; color: var(--text-2); user-select: none; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; cursor: pointer; transition: background-color .25s, border-color .25s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); transition: translate .3s var(--ease); }
.switch input:checked { background: var(--primary); border-color: var(--primary); }
.switch input:checked::after { translate: 18px 0; }
[dir="rtl"] .switch input:checked::after { translate: -18px 0; }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.alert {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px; border-radius: 14px; margin-bottom: 20px;
    border: 1px solid var(--line); background: var(--surface); font-size: .95rem;
    animation: rise .45s var(--ease);
}
.alert > .icon { margin-top: 2px; }
.alert-body { flex: 1; }
.alert-success { color: var(--primary); background: var(--primary-soft); border-color: var(--primary-line); }
.alert-error { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert-info { color: var(--text-2); }
.alert .btn-icon { width: 28px; height: 28px; margin: -3px; color: inherit; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: 14px 16px; text-align: start; vertical-align: middle; border-bottom: 1px solid var(--line); }
.table thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-2); font-size: .78rem; font-weight: 700; color: var(--muted); letter-spacing: var(--track-caps); white-space: nowrap; }
.table tbody tr { transition: background-color .2s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table .cell-title { font-weight: 600; color: var(--text); max-width: 46ch; }
.table .cell-sub { font-size: .82rem; color: var(--faint); margin-top: 2px; }
.table .num { font-variant-numeric: tabular-nums; }

/* ---------- reveal animation (only when JS runs) ---------- */
.js [data-reveal] {
    opacity: 0; translate: 0 24px; filter: blur(6px);
    transition: opacity .9s var(--ease), translate .9s var(--ease), filter .9s var(--ease);
    transition-delay: calc(var(--d, 0) * 90ms);
}
.js [data-reveal].is-visible { opacity: 1; translate: 0 0; filter: none; }
.js [data-split] .w {
    display: inline-block; opacity: 0; translate: 0 .45em; filter: blur(8px);
    transition: opacity .8s var(--ease), translate .8s var(--ease), filter .8s var(--ease);
    transition-delay: calc(var(--i) * 70ms + 120ms);
}
.js .text-gradient .w, .js [data-split] .text-gradient .w { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.js [data-split].is-split .w { opacity: 1; translate: 0 0; filter: none; }

/* ---------- view transitions ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .22s ease both; }
::view-transition-new(root) { animation: vt-in .34s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; translate: 0 8px; } }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
    .js [data-reveal], .js [data-split] .w { opacity: 1; translate: none; filter: none; }
    .js .emblem .e-draw { stroke-dashoffset: 0; }
    @view-transition { navigation: none; }
}

@media print {
    .site-header, .site-footer, .scroll-progress, .reader-tools, .article-rail, .mobile-share, .to-top, .article-end .share, .next-steps, .page-hero .glow, .pattern-bg { display: none !important; }
    body { background: #fff; color: #000; }
    body::before { display: none; }
    .page-hero { padding-top: 0; border: 0; }
    .prose { font-size: 12pt; color: #000; }
}

/* text labels inside buttons/triggers inherit their parent's colour */
.btn .label, .chips > .label, .ai-sources .label { color: inherit; font-weight: inherit; font-size: inherit; display: inline; }
.search-trigger .label { color: inherit; font-weight: inherit; font-size: inherit; }
@media (max-width: 1060px) { .search-trigger .label { display: none; } }
@media (max-width: 560px) {
    .header-actions > .theme-toggle, .header-actions > .lang-switch { display: none; }
    .header-inner { gap: 12px; }
}
.chips > .label { color: var(--faint); font-size: .85rem; }
.ai-sources .label { color: var(--muted); font-size: .86rem; }
.field-row > .field + .field { margin-top: 0; }
.field { align-content: start; }
