/* ============================================================
   TT BLOG — LinkMasr layout for the blog index and articles.
   Palette follows LinkMasr (Tailwind slate/indigo/violet values)
   so the two sites read the same; typography: Poppins display
   (LTR) / IBM Plex Sans Arabic (RTL). RTL-safe via logical props.
   ============================================================ */
:root {
    --lm-blue: #1a6ff5; --lm-indigo: #4f46e5; --lm-violet: #8b5cf6; --lm-pink: #ec4899; --lm-cyan: #22d3ee;
    --lm-s50: #f8fafc; --lm-s100: #f1f5f9; --lm-s200: #e2e8f0; --lm-s300: #cbd5e1; --lm-s400: #94a3b8;
    --lm-s500: #64748b; --lm-s600: #475569; --lm-s700: #334155; --lm-s800: #1e293b; --lm-s900: #0f172a; --lm-s950: #020617;
    --lm-radius-card: 2.5rem;
    --lm-shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
    --lm-shadow-premium: 0 25px 50px -12px rgba(0,0,0,.08);
}
.lm-container { max-width: 1280px; margin-inline: auto; padding-inline: 1.5rem; }
.lm-container-narrow { max-width: 1024px; }
.lm-section { padding: 6rem 0; }
.lm-section-white { background: #fff; }
.lm-section-muted { background: var(--lm-s100); position: relative; overflow: hidden; }
.lm-display { font-family: 'Poppins', 'Inter', sans-serif; font-weight: 700; letter-spacing: -0.01em; }
[dir="rtl"] .lm-display { font-family: var(--tt-font-ar, 'IBM Plex Sans Arabic', sans-serif); letter-spacing: 0; }
.lm-gradient-text { color: transparent; background: linear-gradient(90deg, var(--lm-indigo), var(--lm-violet)); -webkit-background-clip: text; background-clip: text; }
.lm-gradient-text-cool { color: transparent; background: linear-gradient(90deg, #818cf8, var(--lm-cyan)); -webkit-background-clip: text; background-clip: text; }

/* buttons */
.lm-btn { height: 54px; padding: 0 2rem; border-radius: 16px; font-weight: 600; font-size: .95rem; display: inline-flex; align-items: center; justify-content: center; gap: 12px; text-decoration: none; border: 0; cursor: pointer; transition: all .4s cubic-bezier(.175,.885,.32,1.275); }
.lm-btn-sm { height: 48px; padding: 0 1.5rem; font-size: .875rem; }
.lm-btn-premium { background: linear-gradient(135deg, var(--lm-blue), var(--lm-violet)); color: #fff; box-shadow: 0 10px 20px -5px rgba(26,111,245,.3); }
.lm-btn-premium:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 20px 30px -10px rgba(26,111,245,.4); color: #fff; }
.lm-btn-ghost { background: rgba(255,255,255,.06); color: #fff; border: 1px solid rgba(255,255,255,.15); }
.lm-btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.lm-btn-white { background: #fff; color: var(--lm-blue); }
.lm-btn-white:hover { background: var(--lm-s100); color: var(--lm-blue); transform: translateY(-2px); }

/* ---------- index hero ---------- */
.lm-mesh { background:
    radial-gradient(at 0% 0%, rgba(26,111,245,.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(139,92,246,.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(236,72,153,.10) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(34,211,238,.10) 0px, transparent 50%), #fff; }
.lm-hero { position: relative; overflow: hidden; padding: 6rem 0 8rem; }
.lm-hero-inner { max-width: 896px; margin-inline: auto; text-align: center; position: relative; z-index: 1; }
.lm-pill { display: inline-flex; align-items: center; gap: .75rem; padding: .5rem 1.25rem; border-radius: 9999px; background: rgba(255,255,255,.8); border: 1px solid #fff; box-shadow: var(--lm-shadow-xl); margin-bottom: 2rem; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--lm-s600); }
[dir="rtl"] .lm-pill { letter-spacing: 0; text-transform: none; }
.lm-pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lm-indigo); animation: lm-pulse 2s cubic-bezier(.4,0,.6,1) infinite; }
.lm-float { animation: lm-float 6s ease-in-out infinite; }
.lm-hero-title { font-size: clamp(2.75rem, 7vw, 4.5rem); line-height: 1.1; color: var(--lm-s900); margin: 0 0 2rem; }
.lm-hero-lead { font-size: 1.25rem; color: #111; max-width: 42rem; margin: 0 auto 3rem; line-height: 1.7; }
.lm-search { position: relative; max-width: 42rem; margin-inline: auto; }
.lm-search-glow { position: absolute; inset: -1rem; border-radius: 2.5rem; background: linear-gradient(90deg, rgba(99,102,241,.1), rgba(139,92,246,.1)); filter: blur(24px); opacity: 0; transition: opacity .4s; }
.lm-search:hover .lm-search-glow { opacity: 1; }
.lm-search-box { position: relative; display: flex; align-items: center; gap: .5rem; background: #fff; border-radius: 1rem; box-shadow: var(--lm-shadow-premium); border: 1px solid var(--lm-s100); padding: .5rem; }
.lm-search-icon { position: absolute; inset-inline-start: 1.5rem; color: var(--lm-s400); display: flex; }
.lm-search-box input { flex: 1 1 auto; min-width: 0; padding: 1rem 1.5rem; padding-inline-start: 3.5rem; border: 0; outline: 0; border-radius: .75rem; font: inherit; font-weight: 300; font-size: 1rem; color: var(--lm-s800); background: transparent; }
.lm-search-box input:focus { box-shadow: inset 0 0 0 2px rgba(79,70,229,.25); }

/* filters */
.lm-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-bottom: 5rem; }
.lm-filter { padding: .75rem 2rem; border-radius: 1rem; background: var(--lm-s50); color: var(--lm-s600); font-weight: 700; text-decoration: none; transition: all .3s; }
.lm-filter:hover { background: var(--lm-s100); }
.lm-filter.is-active { background: var(--lm-indigo); color: #fff; box-shadow: 0 20px 25px -5px rgba(224,231,255,1), 0 8px 10px -6px rgba(224,231,255,1); }

/* cards */
.lm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; }
.lm-card { display: flex; flex-direction: column; border-radius: var(--lm-radius-card); overflow: hidden; background: #fff; border: 1px solid var(--lm-s200); box-shadow: var(--lm-shadow-xl); transition: all .6s cubic-bezier(.23,1,.32,1); }
.lm-card:hover { transform: translateY(-12px) scale(1.02); box-shadow: 0 30px 60px -15px rgba(15,23,42,.15); border-color: var(--lm-blue); }
.lm-card-media { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--lm-s100); }
.lm-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 1.2s cubic-bezier(.23,1,.32,1); }
.lm-card:hover .lm-card-media img { transform: scale(1.1) rotate(1deg); }
.lm-card-placeholder { display: grid; place-items: center; width: 100%; height: 100%; background: linear-gradient(135deg, #eef2ff, #e0f2fe); }
.lm-card-placeholder img { width: 55%; height: auto; object-fit: contain; opacity: .9; }
.lm-card-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(15,23,42,.6), transparent); opacity: 0; transition: opacity .5s; }
.lm-card:hover .lm-card-shade { opacity: 1; }
.lm-card-pill { position: absolute; top: 1.5rem; inset-inline-start: 1.5rem; padding: .375rem 1rem; border-radius: 9999px; background: rgba(255,255,255,.2); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.2); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
[dir="rtl"] .lm-card-pill { letter-spacing: 0; text-transform: none; font-size: 12px; }
.lm-card-body { display: flex; flex-direction: column; padding: 2.5rem; flex: 1 1 auto; }
.lm-card-meta { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; font-size: 12px; font-weight: 700; color: var(--lm-s400); letter-spacing: .1em; text-transform: uppercase; }
[dir="rtl"] .lm-card-meta { letter-spacing: 0; text-transform: none; }
.lm-avatar { display: inline-grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; background: var(--lm-blue); color: #fff; font-weight: 700; font-size: 1.1rem; flex: 0 0 auto; }
.lm-avatar-sm { width: 2rem; height: 2rem; font-size: 10px; background: var(--lm-s100); color: var(--lm-s700); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--lm-s200); }
.lm-card-title { margin: 0 0 1.5rem; font-size: 1.5rem; line-height: 1.25; font-weight: 700; }
.lm-card-title a { color: var(--lm-s900); text-decoration: none; transition: color .3s; }
.lm-card:hover .lm-card-title a { color: var(--lm-indigo); }
.lm-card-excerpt { margin: 0 0 2rem; color: #111; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lm-card-link { margin-top: auto; display: inline-flex; align-items: center; gap: .75rem; font-size: .875rem; font-weight: 700; color: var(--lm-s900); text-decoration: none; }
.lm-card-arrow { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--lm-s50); transition: all .3s; }
[dir="rtl"] .lm-card-arrow { transform: scaleX(-1); }
.lm-card-link:hover .lm-card-arrow { background: var(--lm-indigo); color: #fff; }
.lm-empty { text-align: center; padding: 3rem; color: var(--lm-s500); }

/* pagination */
.lm-pagination { display: flex; justify-content: center; align-items: center; gap: .75rem; margin-top: 5rem; }
.lm-pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 3rem; height: 3rem; padding: 0 .75rem; border-radius: 1rem; background: var(--lm-s50); color: var(--lm-s600); font-weight: 700; text-decoration: none; transition: all .3s; }
.lm-pagination .page-numbers:hover, .lm-pagination .page-numbers.current { background: var(--lm-indigo); color: #fff; }
.lm-pagination .page-numbers.dots { background: transparent; }

/* index CTA */
.lm-cta-panel { position: relative; overflow: hidden; max-width: 1024px; margin-inline: auto; border-radius: 4rem; padding: clamp(3rem, 6vw, 5rem); text-align: center; background: linear-gradient(135deg, rgba(15,23,42,.95), rgba(30,41,59,.95)); border: 1px solid rgba(255,255,255,.1); box-shadow: 0 40px 100px -20px rgba(0,0,0,.3); }
.lm-cta-blob { position: absolute; width: 16rem; height: 16rem; border-radius: 50%; filter: blur(80px); }
.lm-cta-blob-a { top: -6rem; inset-inline-end: -6rem; background: rgba(99,102,241,.3); }
.lm-cta-blob-b { bottom: -6rem; inset-inline-start: -6rem; background: rgba(6,182,212,.2); }
.lm-cta-inner { position: relative; z-index: 1; }
.lm-pill-dark { background: rgba(79,70,229,.2); border: 1px solid rgba(99,102,241,.3); color: #a5b4fc; box-shadow: none; margin-bottom: 2.5rem; font-size: 14px; text-transform: none; letter-spacing: 0; }
.lm-cta-title { font-size: clamp(2.25rem, 6vw, 4.5rem); color: #fff; line-height: 1.1; margin: 0 0 2.5rem; }
.lm-cta-lead { font-size: 1.25rem; color: var(--lm-s300); max-width: 42rem; margin: 0 auto 4rem; line-height: 1.7; }
.lm-cta-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; }

/* ---------- article hero ---------- */
.lm-article-hero { position: relative; overflow: hidden; background: var(--lm-s900); padding: 5rem 0 4rem; color: #fff; }
.lm-article-hero-glow { position: absolute; inset: 0; background: linear-gradient(to bottom right, rgba(37,99,235,.2), transparent 50%, rgba(16,185,129,.1)); pointer-events: none; }
.lm-dots { position: absolute; inset: 0; opacity: .1; background-image: radial-gradient(rgba(26,111,245,.9) 1px, transparent 1px); background-size: 20px 20px; pointer-events: none; }
.lm-article-hero-inner { position: relative; z-index: 1; max-width: 896px; }
.lm-article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 1.5rem; color: var(--lm-s400); font-size: .875rem; }
.lm-meta-item { display: inline-flex; align-items: center; gap: .4rem; }
.lm-topic-pill { padding: .375rem 1rem; border-radius: 9999px; background: rgba(59,130,246,.2); color: #93c5fd; font-size: .875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; text-decoration: none; }
[dir="rtl"] .lm-topic-pill { text-transform: none; letter-spacing: 0; }
.lm-article-title { font-size: clamp(1.9rem, 4.5vw, 3rem); line-height: 1.2; margin: 0 0 1.5rem; color: #fff; }
.lm-article-lead { font-size: 1.25rem; line-height: 1.7; color: var(--lm-s300); max-width: 48rem; margin: 0; }
.lm-author { display: flex; align-items: center; gap: 1rem; margin-top: 2rem; }
.lm-author-name { margin: 0; font-weight: 600; color: #fff; }
.lm-author-role { margin: 0; font-size: .875rem; color: var(--lm-s400); }

/* ---------- article body ---------- */
.lm-article-body { padding: 5rem 0; background: #fff; }
.lm-article-layout { display: flex; align-items: flex-start; gap: 3rem; max-width: 1100px; }
.lm-sidebar { flex: 0 0 16rem; width: 16rem; align-self: stretch; }   /* full row height: sticky needs room to travel */
.lm-sticky { position: sticky; top: 2rem; }
.admin-bar .lm-sticky { top: calc(2rem + 32px); }
@media (max-width: 782px) { .admin-bar .lm-sticky { top: calc(2rem + 46px); } }
.lm-side-card { background: var(--lm-s50); border-radius: 1rem; padding: 1.5rem; margin-bottom: 2rem; }
.lm-side-heading { margin: 0 0 1rem; font-size: .875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #9ca3af; }
[dir="rtl"] .lm-side-heading { text-transform: none; letter-spacing: 0; }
.lm-toc { display: flex; flex-direction: column; gap: .75rem; font-size: .875rem; }
.lm-toc-link { display: block; color: #111; text-decoration: none; border-inline-start: 3px solid transparent; padding-inline-start: 12px; transition: all .2s ease; line-height: 1.45; }
.lm-toc-l3 { padding-inline-start: 24px; font-size: .8125rem; color: var(--lm-s500); }
.lm-toc-link:hover { color: var(--lm-blue); }
.lm-toc-link.is-active { color: var(--lm-blue); font-weight: 600; border-inline-start-color: var(--lm-blue); background: #eef7ff; padding-block: 4px; margin-inline-start: -12px; padding-inline-start: 21px; border-start-end-radius: 8px; border-end-end-radius: 8px; }
.lm-toc-l3.is-active { padding-inline-start: 33px; }
.lm-share { display: flex; gap: .5rem; flex-wrap: wrap; }
.lm-share-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #fff; transition: transform .2s, opacity .2s; }
.lm-share-btn:hover { transform: translateY(-2px); opacity: .9; color: #fff; }

.lm-article { flex: 1 1 auto; min-width: 0; max-width: 760px; }
.lm-article-content h2 { font-family: 'Poppins', 'Inter', sans-serif; font-size: 1.75rem; font-weight: 700; color: var(--lm-s900); margin: 3rem 0 1.25rem; line-height: 1.3; scroll-margin-top: 2rem; }
[dir="rtl"] .lm-article-content h2 { font-family: var(--tt-font-ar, 'IBM Plex Sans Arabic', sans-serif); }
.lm-article-content > h2:first-child, .lm-article-content > div:first-child > h2:first-child { margin-top: 0; }
.lm-article-content h3 { font-size: 1.3rem; font-weight: 700; color: var(--lm-s900); margin: 2.25rem 0 1rem; scroll-margin-top: 2rem; }
.lm-article-content h4 { font-size: 1.1rem; font-weight: 700; color: var(--lm-s800); margin: 1.75rem 0 .75rem; }
.lm-article-content p, .lm-article-content li { color: #000; line-height: 1.9; font-size: 1.075rem; }
.lm-article-content p { margin: 0 0 1.25rem; }
.lm-article-content ul, .lm-article-content ol { margin: 0 0 1.5rem; padding-inline-start: 1.25rem; }
.lm-article-content li { margin-bottom: .5rem; }
.lm-article-content a { color: var(--lm-blue); }
.lm-article-content img { max-width: 100%; height: auto; border-radius: 1rem; margin: 1.5rem 0; }
.lm-article-content blockquote { margin: 2rem 0; padding: 1.25rem 1.5rem; border-inline-start: 4px solid var(--lm-blue); background: var(--lm-s50); border-radius: .75rem; color: var(--lm-s700); }
.lm-article-content table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: .95rem; }
.lm-article-content th, .lm-article-content td { border: 1px solid var(--lm-s200); padding: .75rem; text-align: start; }
.lm-article-content th { background: var(--lm-s50); }

.lm-article-cta { margin-top: 4rem; padding: 2.5rem; border-radius: 1rem; text-align: center; color: #fff; background: linear-gradient(90deg, #2563eb, #1d4ed8); }
.lm-article-cta h3 { margin: 0 0 1rem; font-size: 1.5rem; font-weight: 700; color: #fff; }
.lm-article-cta p { margin: 0 0 2rem; font-size: 1.125rem; color: rgba(255,255,255,.8); }
.lm-tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2.5rem; }
.lm-tag { padding: .5rem 1rem; border-radius: 9999px; background: #f3f4f6; color: var(--lm-s700); font-size: .875rem; font-weight: 500; text-decoration: none; }
.lm-tag:hover { background: var(--lm-s200); }

/* related */
.lm-section-related { background: rgba(249,250,251,.5); padding: 5rem 0; }
.lm-related-title { text-align: center; font-size: 1.875rem; margin: 0 0 3rem; color: var(--lm-s900); }
.lm-related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.lm-related-card { display: flex; flex-direction: column; background: #fff; border-radius: 1rem; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.05); border: 1px solid #f3f4f6; text-decoration: none; transition: transform .3s, box-shadow .3s; }
.lm-related-card:hover { transform: translateY(-4px); box-shadow: var(--lm-shadow-xl); }
.lm-related-media { display: block; aspect-ratio: 16 / 10; overflow: hidden; }
.lm-related-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lm-related-body { display: block; padding: 1.5rem; }
.lm-related-topic { display: block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #16a34a; }
[dir="rtl"] .lm-related-topic { text-transform: none; letter-spacing: 0; }
.lm-related-heading { display: block; margin: .5rem 0; font-weight: 700; color: var(--lm-s900); line-height: 1.4; }
.lm-related-text { display: block; font-size: .875rem; color: var(--lm-s600); line-height: 1.6; }

@keyframes lm-pulse { 50% { opacity: .5; } }
@keyframes lm-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .lm-float, .lm-pill-dot { animation: none; } }

@media (max-width: 1024px) {
    .lm-grid, .lm-related-grid { grid-template-columns: repeat(2, 1fr); }
    .lm-sidebar { display: none; }
}
@media (max-width: 640px) {
    .lm-grid, .lm-related-grid { grid-template-columns: 1fr; }
    .lm-section { padding: 4rem 0; }
    .lm-hero { padding: 4rem 0 5rem; }
    .lm-card-body { padding: 1.75rem; }
    .lm-cta-panel { border-radius: 2rem; }
    .lm-search-box { flex-wrap: wrap; }
    .lm-search-box .lm-btn { width: 100%; }
}

/* ---------- infinite scroll ---------- */
.lm-js .lm-pagination { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); margin: 0; }
.lm-infinite { display: flex; flex-direction: column; align-items: center; gap: 1.25rem; margin-top: 4rem; min-height: 3.5rem; }
.lm-infinite .lm-load-more { display: none; }
.lm-infinite.is-manual .lm-load-more { display: inline-flex; }
.lm-btn-ghost-dark { background: var(--lm-s50); color: var(--lm-s700); border: 1px solid var(--lm-s200); }
.lm-btn-ghost-dark:hover { background: var(--lm-indigo); color: #fff; border-color: var(--lm-indigo); }
.lm-spinner { display: none; width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 3px solid var(--lm-s200); border-top-color: var(--lm-indigo); animation: lm-spin .8s linear infinite; }
.lm-infinite.is-loading .lm-spinner { display: block; }
.lm-infinite-end { margin: 0; color: var(--lm-s400); font-size: .875rem; font-weight: 600; }
.lm-card-enter { animation: lm-rise .5s cubic-bezier(.23,1,.32,1) both; }
@keyframes lm-spin { to { transform: rotate(360deg); } }
@keyframes lm-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .lm-card-enter { animation: none; } .lm-spinner { animation-duration: 2s; } }
