/* ==========================================================================
   MX1 article (single post). Builds on blog.css tokens and parts; adds the
   cover hero, the reading column and the sticky contents rail. RTL-first:
   everything aligns to the start (right) edge through logical properties.
   ========================================================================== */
.mx1bs { direction: rtl; }

/* reading progress */
.mx1bs-progress { position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 9999; height: 3px; pointer-events: none; }
.mx1bs-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--bl-glow), var(--bl-blue-2)); transform: scaleX(0); transform-origin: right center; }
body.admin-bar .mx1bs-progress { inset-block-start: 32px; }

/* ---------- hero ---------- */
.mx1bs-hero__grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.mx1bs-hero__grid--solo { grid-template-columns: minmax(0, 1fr); }
.mx1bs-hero__grid--solo .mx1bs-hero__copy { max-width: 56rem; }
.mx1bs-tags { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-block-end: 1rem !important; }
.mx1bl .mx1bs-h1 { font-size: clamp(1.75rem, 1.15rem + 2.3vw, 3.1rem); font-weight: 800; line-height: 1.35; color: #fff; text-wrap: balance; }
.mx1bs-lead { max-width: 44rem; margin-block: 1rem 1.6rem !important; font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem); line-height: 1.95; color: var(--bl-mute); }

.mx1bs-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem 1.5rem; padding-block-start: 1.25rem; border-block-start: 1px solid var(--bl-line); }
.mx1bs-avatar { flex: none; display: grid; place-items: center; width: 48px; height: 48px; background: linear-gradient(140deg, var(--bl-blue-2), var(--bl-navy)); --bl-cut: 10px; clip-path: var(--bl-chamfer); }
.mx1bs-avatar img { width: 30px; height: auto; }
.mx1bs-avatar--lg { width: 72px; height: 72px; --bl-cut: 14px; }
.mx1bs-avatar--lg img { width: 46px; }
.mx1bs-byline__who { display: grid; line-height: 1.45; }
.mx1bs-byline__who strong { font-size: 1rem; font-weight: 700; color: #fff; }
.mx1bs-byline__who span { font-size: 0.84rem; color: var(--bl-faint); }
.mx1bs-byline__meta { margin: 0 !important; padding: 0 !important; }
.mx1bs-byline__meta li, .mx1bs-byline__meta li time { display: inline-flex; align-items: center; gap: 0.4rem; }

.mx1bs-cover { position: relative; margin: 0; }
.mx1bs-cover::before { content: ""; position: absolute; inset: 18px 18px -18px -18px; z-index: -1; background: linear-gradient(140deg, rgba(70, 114, 249, 0.55), rgba(54, 93, 227, 0.08)); --bl-cut: 26px; clip-path: var(--bl-chamfer); }
.mx1bs-cover img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: #dfe5f6; --bl-cut: 26px; clip-path: var(--bl-chamfer); }

/* ---------- body: contents rail + reading column ---------- */
.mx1bs-body { display: grid; grid-template-columns: 300px minmax(0, 860px); justify-content: center; gap: clamp(2rem, 4vw, 4rem); align-items: start; padding-block: clamp(2.5rem, 5vw, 4.5rem); }
.mx1bs-body--notoc { grid-template-columns: 300px minmax(0, 860px); }
.mx1bs-side__sticky { position: sticky; top: 1.5rem; display: grid; gap: 1.1rem; }
.mx1bs-toc details > summary { list-style: none; cursor: pointer; }
.mx1bs-toc details > summary::-webkit-details-marker { display: none; }
.mx1bs-toc summary .mx1bl-box__title { margin: 0; }
.mx1bs-toc details[open] summary { margin-block-end: 0.75rem; }
.mx1bs-toc summary::after { content: ""; display: none; }
.mx1bs-toc__list { max-height: min(60vh, 520px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(95, 152, 253, 0.4) transparent; counter-reset: t; }
.mx1bs-toc__list li { position: relative; }
.mx1bs-toc__list a { display: block; padding: 0.5rem 0.85rem; padding-inline-end: 0.3rem; font-size: 0.92rem; line-height: 1.6; color: var(--bl-mute); border-inline-start: 2px solid var(--bl-line); transition: color 0.25s, border-color 0.25s, background 0.25s; }
.mx1bs-toc__l3 a { padding-inline-start: 1.6rem; font-size: 0.86rem; }
.mx1bs-toc__list a:hover { color: #fff; }
.mx1bs-toc__list a[aria-current] { color: #fff; border-color: var(--bl-glow); background: rgba(70, 114, 249, 0.1); }

.mx1bs-article { min-width: 0; }

/* ---------- article typography ---------- */
.mx1bs-content { font-size: clamp(1.05rem, 1rem + 0.25vw, 1.15rem); line-height: 2.05; color: rgba(242, 244, 255, 0.86); text-align: start; overflow-wrap: anywhere; }
.mx1bs-content > * + * { margin-block-start: 1.15em !important; }
.mx1bs-content p { margin: 0; }
/* Arabic copy always reads from the right, whatever alignment the editor saved inline. */
.mx1bs-content :is(p, li, h2, h3, h4, h5, h6, div, span, strong) { text-align: start !important; direction: rtl; }
.mx1bl .mx1bs-content :is(h2, h3, h4, h5, h6) { color: #fff; font-weight: 800; line-height: 1.5; scroll-margin-top: 1.5rem; }
.mx1bl .mx1bs-content h2 { position: relative; margin-block-start: 2.1em !important; padding-inline-start: 1.1rem; font-size: clamp(1.4rem, 1.15rem + 0.9vw, 1.9rem); }
.mx1bs-content h2::before { content: ""; position: absolute; inset-inline-start: 0; inset-block: 0.35em; width: 5px; background: linear-gradient(180deg, var(--bl-glow), var(--bl-blue)); clip-path: polygon(0 3px, 100% 0, 100% calc(100% - 3px), 0 100%); }
.mx1bl .mx1bs-content h3 { margin-block-start: 1.8em !important; font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.45rem); color: #dce5ff; }
.mx1bl .mx1bs-content :is(h4, h5, h6) { margin-block-start: 1.6em !important; font-size: clamp(1.08rem, 1rem + 0.3vw, 1.22rem); color: #dce5ff; }
.mx1bs-content :is(h2, h3, h4, h5) strong { font-weight: inherit; }
.mx1bs-content strong, .mx1bs-content b { color: #fff; font-weight: 700; }
.mx1bs-content a { color: var(--bl-glow); text-decoration: underline; text-decoration-color: rgba(95, 152, 253, 0.45); text-underline-offset: 0.3em; transition: color 0.2s, text-decoration-color 0.2s; }
.mx1bs-content a:hover { color: #fff; text-decoration-color: currentColor; }
.mx1bs-content :is(ul, ol) { margin-inline: 0 !important; padding: 0 !important; list-style: none; }
.mx1bs-content li { position: relative; padding-inline-start: 1.6rem; }
.mx1bs-content li + li { margin-block-start: 0.55em; }
.mx1bs-content ul > li::before { content: ""; position: absolute; inset-inline-start: 0.2rem; inset-block-start: 0.85em; width: 7px; height: 7px; background: var(--bl-blue-2); transform: rotate(45deg); }
.mx1bs-content ol { counter-reset: li; }
.mx1bs-content ol > li { counter-increment: li; padding-inline-start: 2.4rem; }
.mx1bs-content ol > li::before { content: counter(li); position: absolute; inset-inline-start: 0; inset-block-start: 0.3em; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; font-size: 0.82rem; font-weight: 800; line-height: 1; color: #fff; background: linear-gradient(130deg, var(--bl-blue-2), var(--bl-blue)); clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); }
.mx1bs-content ol[start] { counter-reset: none; }
.mx1bs-content li > :is(h2, h3, h4, h5) { margin-block-start: 0 !important; display: inline; padding: 0; font-size: 1.08em; }
.mx1bs-content li > :is(h2)::before { display: none; }
.mx1bs-content :is(img, figure img) { display: block; max-width: 100%; height: auto; --bl-cut: 16px; clip-path: var(--bl-chamfer); }
.mx1bs-content figure { margin-inline: 0; }
.mx1bs-content figcaption { margin-block-start: 0.6rem; font-size: 0.88rem; color: var(--bl-faint); text-align: center; }
.mx1bs-content blockquote { margin-inline: 0; padding: 1.3rem 1.5rem; font-size: 1.08em; color: #fff; background: rgba(70, 114, 249, 0.1); border-inline-start: 4px solid var(--bl-blue-2); }
.mx1bs-content :is(pre, code) { direction: ltr; text-align: left; font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important; font-size: 0.9em; }
.mx1bs-content pre { overflow-x: auto; padding: 1rem 1.2rem; background: rgba(0, 0, 0, 0.3); box-shadow: inset 0 0 0 1px var(--bl-line); white-space: pre-wrap; }
.mx1bs-content table { width: 100%; border-collapse: collapse; font-size: 0.95em; display: block; overflow-x: auto; }
.mx1bs-content :is(th, td) { padding: 0.7rem 0.9rem; text-align: start; border: 1px solid var(--bl-line); }
.mx1bs-content th { color: #fff; background: rgba(70, 114, 249, 0.14); }
.mx1bs-content hr { height: 1px; border: 0; background: var(--bl-line); }

/* ---------- article footer ---------- */
.mx1bs-foot { display: grid; gap: 1.25rem; margin-block-start: clamp(2.5rem, 5vw, 3.5rem); padding-block-start: 1.75rem; border-block-start: 1px solid var(--bl-line); }
.mx1bs-share { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }
.mx1bs-share__label { font-weight: 700; color: #fff; }
.mx1bs-share ul { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.mx1bs-share :is(a, button) {
	position: relative; display: grid; place-items: center; width: 46px; height: 46px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0;
	color: var(--bl-paper); background: var(--bl-glass); box-shadow: inset 0 0 0 1px var(--bl-line); --bl-cut: 10px; clip-path: var(--bl-chamfer);
	cursor: pointer; transition: background 0.3s, color 0.3s;
}
.mx1bs-share :is(a, button):hover, .mx1bs-share .is-done { background: linear-gradient(120deg, var(--bl-blue-2), var(--bl-blue)); color: #fff; box-shadow: none; }
.mx1bs-copy__done { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mx1bs-author { display: flex; gap: 1.1rem; align-items: flex-start; padding: 1.4rem; background: var(--bl-glass); box-shadow: inset 0 0 0 1px var(--bl-line); clip-path: var(--bl-chamfer); }
.mx1bs-author__kicker { font-size: 0.82rem; color: var(--bl-glow); }
.mx1bs-author__name { margin-block: 0.15rem 0.4rem !important; font-size: 1.08rem; font-weight: 800; color: #fff; }
.mx1bs-author__bio { font-size: 0.94rem; line-height: 1.85; color: var(--bl-mute); }

/* ---------- related ---------- */
.mx1bs-related { position: relative; padding-block: clamp(3rem, 6vw, 5rem); border-block-start: 1px solid var(--bl-line); }
.mx1bs-related__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; margin-block-end: clamp(1.5rem, 3vw, 2.25rem); }
.mx1bs-related__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2vw, 1.5rem); }
.mx1bs-related + .mx1bl-cta { padding-block-start: 0; }
.mx1bs-body + .mx1bl-cta { padding-block-start: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
	.mx1bs-body, .mx1bs-body--notoc { grid-template-columns: 260px minmax(0, 1fr); }
}
@media (max-width: 1024px) {
	.mx1bs-hero__grid { grid-template-columns: minmax(0, 1fr); }
	.mx1bs-cover { max-width: 680px; }
	.mx1bs-body, .mx1bs-body--notoc { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding-block-start: 2rem; }
	.mx1bs-side__sticky { position: static; }
	.mx1bs-promo { display: none; }
	.mx1bs-toc summary { display: flex; align-items: center; justify-content: space-between; }
	.mx1bs-toc summary::after { content: ""; display: block; width: 10px; height: 10px; border-inline-end: 2px solid var(--bl-glow); border-block-end: 2px solid var(--bl-glow); transform: rotate(45deg); transition: transform 0.3s; }
	.mx1bs-toc details[open] summary::after { transform: rotate(-135deg); }
	.mx1bs-toc__list { max-height: none; }
	.mx1bs-article { max-width: none; }
	.mx1bs-related__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
	.mx1bs-related__grid { grid-template-columns: minmax(0, 1fr); }
	.mx1bs-cover::before { inset: 12px 8px -12px -8px; }
	.mx1bs-byline__meta { flex-basis: 100%; }
	.mx1bs-author { flex-direction: column; }
	.mx1bs-related__head .mx1bl-btn { width: 100%; }
}

/* Legacy spacer blocks become a modest gap in the reading column. */
.mx1bs-content .wp-block-spacer { height: 0.5rem !important; }
