/* Compatibility hubs (.ch-*) + «قارنّي» invite loop (.inv-*) — "Astrolabe & Folio" */
.ch, .inv-ui {
	--el: var(--gold);
}

/* seal */
.ch-seal { display: block; flex: none; color: var(--gold); overflow: visible; }
.ch-ring__o { stroke: var(--el); stroke-width: 1; }
.ch-ring__i { stroke: var(--gold); stroke-width: .75; opacity: .7; }
.ch-ring__t { stroke: var(--gold); stroke-width: .75; opacity: .7; fill: none; }
.ch-seal__g { fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.ch-seal--xs { width: 28px; height: 28px; } .ch-seal--sm { width: 36px; height: 36px; } .ch-seal--md { width: 48px; height: 48px; } .ch-seal--lg { width: 72px; height: 72px; }

/* ---------- hub ---------- */
.ch { color: var(--ink); font-family: var(--f-body); padding-bottom: 48px; }
.ch a { color: inherit; text-decoration: none; }
.ch-head { display: flex; align-items: center; gap: 16px; margin: 20px 0 12px; }
.ch-head h1 { font-family: var(--f-display); font-weight: 700; font-size: 32px; line-height: 44px; margin: 0; color: var(--ink); }
.ch-meta { margin: 4px 0 0; font-size: 14px; line-height: 22px; font-weight: 500; color: var(--ink-2); }
.ch-ticks { height: 9px; border-top: 1px solid var(--el); opacity: .8;
	background: repeating-linear-gradient(to left, var(--el) 0 1px, transparent 1px 8px) top / 100% 4px no-repeat,
		repeating-linear-gradient(to left, var(--el) 0 1px, transparent 1px 40px) top / 100% 8px no-repeat; }
.ch-lede { font-size: 16px; line-height: 28px; color: var(--ink-2); margin: 16px 0 24px; max-width: 37.2em; }
.ch-h2 { font-family: var(--f-display); font-weight: 700; font-size: 24px; line-height: 36px; margin: 0 0 12px; padding-top: 12px; border-top: 1px solid var(--rule); }
.ch-p { font-size: 16px; line-height: 28px; color: var(--ink-2); margin: 0 0 16px; max-width: 37.2em; }
.ch-empty { padding: 24px; border: 1px solid var(--rule); border-radius: 14px; background: var(--night-2); }

.ch-layout { display: grid; gap: 48px; grid-template-areas: "sum" "main" "side"; grid-template-columns: minmax(0, 1fr); }
.ch-main { grid-area: main; min-width: 0; }
.ch-sums { grid-area: sum; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ch-sums__h { grid-column: 1 / -1; font-family: var(--f-display); font-weight: 700; font-size: 24px; line-height: 36px; margin: 0 0 4px; }
.ch-sums .ch-sum__p { grid-column: 1 / -1; margin: 4px 0 0; }

/* rows */
.ch-list { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--rule); }
.ch-list li + li { border-top: 1px solid var(--rule); }
.ch-row { display: grid; grid-template-columns: 20px 48px 1fr; gap: 12px; align-items: start; padding: 16px 4px; min-height: 44px; transition: background-color .15s; border-radius: 4px; }
.ch-row:hover { background: var(--night-2); }
.ch-row:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.ch-row__rank { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; color: var(--ink-3); padding-top: 14px; text-align: center; }
.ch-row__body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ch-row__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ch-row__name { font-family: var(--f-display); font-weight: 600; font-size: 19px; line-height: 30px; }
.ch-row__name small { display: block; font-family: var(--f-body); font-weight: 400; font-size: 13px; line-height: 20px; color: var(--ink-3); }
.ch-row__score { font-variant-numeric: tabular-nums; color: var(--gold-hi); white-space: nowrap; }
.ch-row__score b { font-weight: 600; font-size: 28px; line-height: 1; }
.ch-row__score small { font-size: 14px; color: var(--ink-3); margin-inline-start: 2px; }
.ch-row__mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ch-mini { display: grid; grid-template-columns: 1fr auto; gap: 4px 6px; font-size: 13px; line-height: 20px; }
.ch-mini__l { color: var(--ink-2); }
.ch-mini__v { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.ch-mini__bar { grid-column: 1 / -1; height: 3px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.ch-mini__bar i { display: block; height: 100%; background: var(--gold); }
.ch-row__first { font-size: 15px; line-height: 26px; color: var(--ink-2); }
.ch-row__more { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--gold-hi); }
.ch-row__more::after { content: " ‹"; }
.ch-row:hover .ch-row__more { text-decoration: underline; text-underline-offset: 4px; }

/* elements */
.ch-sec { margin-top: 48px; }
.ch-els { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.ch-el { padding: 16px 0; border-bottom: 1px solid var(--rule); }
.ch-el__h { font-family: var(--f-display); font-weight: 600; font-size: 19px; line-height: 30px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.ch-el__h::before { content: ""; width: 8px; height: 8px; transform: rotate(45deg); border: 1px solid var(--el); flex: none; }
.ch-el p { margin: 0; font-size: 16px; line-height: 28px; color: var(--ink-2); }
.ch-el__signs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px !important; }
.ch-el__signs a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px 0 8px; border: 1px solid var(--rule); border-radius: 999px; font-size: 14px; color: var(--ink); transition: border-color .15s; }
.ch-el__signs a:hover, .ch-el__signs a:focus-visible { border-color: var(--rule-strong); }

/* FAQ */
.ch-faq details { border-bottom: 1px solid var(--rule); }
.ch-faq summary { cursor: pointer; list-style: none; padding: 14px 0; min-height: 44px; font-weight: 600; font-size: 16px; line-height: 28px; display: flex; justify-content: space-between; gap: 12px; }
.ch-faq summary::-webkit-details-marker { display: none; }
.ch-faq summary::after { content: "+"; color: var(--gold); font-weight: 400; font-size: 20px; }
.ch-faq details[open] summary::after { content: "−"; }
.ch-faq details p { margin: 0 0 16px; font-size: 16px; line-height: 28px; color: var(--ink-2); }

/* side: summary, invite, links */
.ch-side { grid-area: side; display: flex; flex-direction: column; gap: 24px; }
.ch-sum { background: var(--night-2); border: 1px solid var(--rule); border-radius: 14px; padding: 12px; min-width: 0; }
.ch-sum__h { font-family: var(--f-display); font-weight: 600; font-size: 19px; line-height: 30px; margin: 0; color: var(--gold-hi); }
.ch-sum + .ch-sum .ch-sum__h { color: var(--rubric); }
.ch-sum__h { font-size: 17px; line-height: 28px; }
.ch-sum__p { margin: 4px 0 8px; font-size: 14px; line-height: 22px; color: var(--ink-2); }
.ch-sum__list { list-style: none; margin: 0; padding: 0; }
.ch-sum__list li + li { border-top: 1px solid var(--rule); }
.ch-sum__list a { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 2px 0; }
.ch-sum__list a:hover .ch-sum__n { color: var(--gold-hi); }
.ch-sum__n { flex: 1; min-width: 0; font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-sum__v { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 16px; color: var(--ink); direction: ltr; unicode-bidi: isolate; }
.ch-invite { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 16px 0; }
.ch-invite__p { margin: 0 0 12px; font-size: 14px; line-height: 22px; color: var(--ink-2); }
.ch-links { display: flex; flex-direction: column; }
.ch-links a { display: flex; justify-content: space-between; align-items: center; min-height: 48px; border-bottom: 1px solid var(--rule); color: var(--gold-hi); font-weight: 500; transition: border-color .15s; }
.ch-links a:hover { border-color: var(--rule-strong); }
.ch-note { margin: 32px 0 0; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: 13px; line-height: 20px; color: var(--ink-3); }

/* nav ring of hubs */
.ch-ring { margin-top: 48px; }
.ch-ring__h { font-family: var(--f-display); font-weight: 600; font-size: 19px; line-height: 30px; margin: 0 0 12px; }
.ch-ring ul { list-style: none; margin: 0; padding: 0 0 4px; display: flex; gap: 4px; overflow-x: auto; scroll-snap-type: x proximity; }
.ch-ring li { flex: none; scroll-snap-align: center; }
.ch-ring a { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; padding: 8px 0; border-radius: 10px; font-size: 13px; line-height: 20px; color: var(--ink-2); }
.ch-ring a:hover { background: var(--night-2); color: var(--ink); }
.ch-ring a[aria-current="page"] { color: var(--gold-hi); background: var(--night-3); }

.ch a:focus-visible, .inv-ui :focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }

@media (min-width: 960px) {
	.ch-head h1 { font-size: 44px; line-height: 60px; }
	.ch-h2 { font-size: 30px; line-height: 44px; }
	.ch-layout { grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "main sum" "main side"; grid-template-rows: auto 1fr; gap: 24px 64px; align-items: start; }
	.ch-sums { grid-template-columns: 1fr; gap: 16px; }
	.ch-sum { padding: 16px; }
	.ch-sums .ch-seal--xs { width: 36px; height: 36px; }
	.ch-side { position: sticky; top: 88px; }
	.ch-row { grid-template-columns: 24px 48px 1fr; padding: 20px 8px; }
	.ch-row__mini { max-width: 420px; }
	.ch-els { grid-template-columns: 1fr 1fr; column-gap: 32px; }
	.ch-ring ul { flex-wrap: wrap; overflow: visible; }
}

/* ---------- invite button ---------- */
.inv-btn { min-height: 48px; }
.inv-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.inv-btn--block { width: 100%; }
.inv-slot { margin: 16px 0; }
.ch-invite .inv-slot { margin: 0; }
.ch-invite .inv-btn { width: 100%; }

/* ---------- dialog ---------- */
.inv-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; background: rgba(5, 7, 18, .78); }
.inv-dialog { position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--night-2); color: var(--ink); font-family: var(--f-body);
	border: 1px solid var(--rule-strong); border-bottom: 0; border-radius: 14px 14px 0 0; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.inv-dialog:focus { outline: none; }
.inv-dialog__x { position: absolute; top: 8px; inset-inline-end: 8px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; border-radius: 10px; }
.inv-dialog__x:hover { color: var(--ink); background: var(--night-3); }
.inv-dialog__x svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; }
.inv-dialog__seal { margin: 0 auto 8px; }
.inv-dialog h2 { font-family: var(--f-display); font-weight: 700; font-size: 24px; line-height: 36px; margin: 0 40px 4px; text-align: center; }
.inv-dialog__sub { margin: 0 0 16px; text-align: center; font-size: 15px; line-height: 26px; color: var(--ink-2); }
.inv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0 0 16px; padding: 0; list-style: none; }
.inv-grid button { width: 100%; min-height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 2px;
	border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--ink); font: 500 14px/20px var(--f-body); cursor: pointer; transition: border-color .15s, background-color .15s; }
.inv-grid button:hover { border-color: var(--rule-strong); background: var(--night-3); }
.inv-grid button.is-mine { border-color: var(--rule-strong); }
.inv-grid button.is-mine::after { content: "برجك"; font-size: 13px; line-height: 16px; color: var(--rubric); }
.inv-field { display: block; margin: 0 0 16px; }
.inv-field span { display: block; font-size: 14px; line-height: 22px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.inv-field input { width: 100%; box-sizing: border-box; height: 48px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--rule-strong); background: var(--night); color: var(--ink); font: 400 16px var(--f-body); }
.inv-field input:focus { outline: 2px solid var(--gold-hi); outline-offset: 1px; }
.inv-field small { display: block; margin-top: 6px; font-size: 13px; line-height: 20px; color: var(--ink-3); }
.inv-actions { display: flex; flex-direction: column; gap: 8px; }
.inv-link { display: flex; align-items: center; justify-content: center; min-height: 44px; color: var(--gold-hi); font-weight: 500; text-decoration: underline; text-underline-offset: 4px; }
.inv-preview { margin: 0 0 16px; padding: 12px 14px; border-inline-start: 2px solid var(--gold); background: var(--night); font-size: 15px; line-height: 26px; color: var(--ink-2); border-radius: 4px; }
@media (min-width: 640px) {
	.inv-overlay { align-items: center; padding: 24px; }
	.inv-dialog { border-radius: 14px; border-bottom: 1px solid var(--rule-strong); padding: 32px 24px; }
	.inv-grid { grid-template-columns: repeat(6, 1fr); }
}
html.inv-lock { overflow: hidden; }

/* ---------- pair banner ---------- */
.inv-banner { display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; align-items: center; margin: 16px 0; padding: 16px; position: relative;
	background: var(--night-2); border: 1px solid var(--rule-strong); border-radius: 14px; color: var(--ink); font-family: var(--f-body); }
.inv-banner__seals { display: flex; align-items: center; }
.inv-banner__seals .ch-seal + .ch-seal { margin-inline-start: -10px; }
.inv-banner__t { margin: 0; padding-inline-end: 36px; font-family: var(--f-display); font-weight: 600; font-size: 19px; line-height: 30px; }
.inv-banner__t b { direction: ltr; unicode-bidi: isolate; display: inline-block; font-family: var(--f-body); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--gold-hi); }
.inv-banner .inv-btn { grid-column: 1 / -1; }
.inv-banner .inv-dialog__x { top: 6px; inset-inline-end: 6px; }
@media (min-width: 640px) { .inv-banner { grid-template-columns: auto 1fr auto; } .inv-banner .inv-btn { grid-column: auto; } .inv-banner__t { padding-inline-end: 0; } .inv-banner { padding-inline-end: 56px; } }

@media (prefers-reduced-motion: reduce) { .ch *, .inv-ui * { transition: none !important; } }
