:root {
    --bg: #030712;
    --surface: rgba(15, 23, 42, 0.82);
    --glass: rgba(255, 255, 255, 0.05);
    --glass-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.1);
    --border-bright: rgba(255, 255, 255, 0.18);
    --ink: #e8eff7;
            --text: #c3cfde;
    --muted: rgba(148, 163, 184, 0.92);
    --faint: rgba(100, 116, 139, 0.8);
    --cyan: #06b6d4;
    --violet: #8b5cf6;
    --indigo: #6366f1;
    --max-w: 1120px;
}

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

body {
    min-height: 100vh;
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    background:
        radial-gradient(circle at 15% 10%, rgba(6, 182, 212, 0.18), transparent 34%),
        radial-gradient(circle at 85% 15%, rgba(139, 92, 246, 0.18), transparent 32%),
        var(--bg);
    color: var(--text);
    line-height: 1.7;
}

[lang="ar"] body,
[lang="ar"] {
    font-family: "Tajawal", "Segoe UI", system-ui, sans-serif;
}

/* Headings opt into the bright colour; body text no longer inherits it.
   Before this, everything on the page was as bright as the headline, so
   nothing stood out by being bright. */
h1, h2, h3, h4,
.card h2, .post-lead-body h2, .related-card strong {
    color: var(--ink);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

.wrap {
    width: min(var(--max-w), calc(100% - 32px));
    margin: 0 auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--cyan) 0%, var(--violet) 100%);
    color: #fff;
    box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
}

.btn-primary::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(6, 182, 212, 0.45), 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-bright);
    color: var(--ink);
    backdrop-filter: blur(8px);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
}

/* Wordmark is ~2.06:1, so width is the binding constraint on narrow
   viewports — size by width and let height follow the aspect ratio. */

.mobile-menu a:hover,

.hero {
    padding: 86px 0 42px;
    text-align: center;
}

.eyebrow {
    display: inline-flex;
    color: #a5f3fc;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.24);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 18px;
}

h1 {
    font-size: clamp(36px, 6vw, 68px);
    line-height: 1.05;
    letter-spacing: -0.05em;
    margin-bottom: 18px;
}

.grad {
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lead {
    max-width: 700px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 18px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    padding: 42px 0 90px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    min-height: 100%;
    transition: transform 0.18s, border-color 0.18s;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(6, 182, 212, 0.35);
}

.cover {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(139, 92, 246, 0.18));
    border-bottom: 1px solid var(--border);
    object-fit: cover;
    width: 100%;
}

.card-body {
    padding: 22px;
}

.meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    color: var(--faint);
    font-size: 13px;
    margin-bottom: 10px;
}

.meta-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
}

.article-meta { margin: 26px 0 0; }

.card h2 {
    font-size: 22px;
    line-height: 1.25;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.excerpt {
    color: var(--muted);
    font-size: 15px;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 18px;
    color: #67e8f9;
    font-weight: 700;
}

.arrow-end {
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[dir="rtl"] .arrow-end { transform: scaleX(-1); }

.card:hover .arrow-end,
.post-lead:hover .arrow-end,
.related-card:hover .arrow-end { transform: translateX(3px); }

[dir="rtl"] .card:hover .arrow-end,
[dir="rtl"] .post-lead:hover .arrow-end,
[dir="rtl"] .related-card:hover .arrow-end { transform: scaleX(-1) translateX(3px); }

.article {
    max-width: 820px;
    padding: 72px 0 90px;
}

.article h1 {
    text-align: left;
    margin-bottom: 14px;
}

[dir="rtl"] .article h1 {
    text-align: right;
}

.article-cover {
    border-radius: 28px;
    margin: 34px 0;
    width: 100%;
    max-height: 460px;
    object-fit: cover;
    border: 1px solid var(--border);
}

/* Long-form reading: a measure of about 68 characters, and type sized for
   a body of text rather than for a UI label. Without the max-width an Arabic
   paragraph runs the full 820px and the eye loses the line it is on. */
.article-body {
    max-width: 68ch;
    font-size: 18px;
    line-height: 1.95;
    color: #cbd5e1;
}

.article-body > p:first-of-type {
    font-size: 20px;
    line-height: 1.85;
    color: #e2e8f0;
}

.article-body a {
    color: #67e8f9;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(103, 232, 249, 0.4);
    transition: text-decoration-color 0.15s;
}

.article-body a:hover { text-decoration-color: #67e8f9; }

.article-body blockquote {
    margin: 34px 0;
    padding: 4px 22px;
    border-inline-start: 3px solid var(--cyan);
    color: #e2e8f0;
    font-size: 20px;
    line-height: 1.8;
    font-style: italic;
}

.article-body img {
    width: 100%;
    height: auto;
    border-radius: 16px;
    border: 1px solid var(--border);
    margin: 30px 0;
}

.article-body {
    color: rgba(226, 232, 240, 0.94);
    font-size: 18px;
    line-height: 1.85;
}

.article-body>*+* {
    margin-top: 1.15em;
}

.article-body h2,
.article-body h3 {
    color: var(--ink);
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-top: 1.8em;
}

.article-body h2 {
    font-size: clamp(26px, 3vw, 34px);
}

.article-body h3 {
    font-size: clamp(22px, 2.4vw, 28px);
}

.article-body p {
    margin: 0;
}

.article-body ul,
.article-body ol {
    padding-inline-start: 1.35em;
    margin-top: 1em;
}

.article-body li+li {
    margin-top: 0.55em;
}

.article-body strong {
    color: var(--ink);
}

.article-body code {
    color: #a5f3fc;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.18);
    border-radius: 8px;
    padding: 0.12em 0.38em;
    font-size: 0.9em;
    white-space: normal;
}

.article-body pre {
    overflow-x: auto;
    background: rgba(2, 6, 23, 0.72);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    white-space: pre;
}

.article-body pre code {
    display: block;
    color: rgba(226, 232, 240, 0.94);
    background: transparent;
    border: 0;
    padding: 0;
    white-space: pre;
}

.tag-list,
.share-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-list {
    margin: 22px 0 0;
}

.tag-chip {
    color: #a5f3fc;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.24);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 700;
}

.share-box {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(139, 92, 246, 0.12)),
        rgba(255, 255, 255, 0.045);
    border: 1px solid var(--border);
    border-radius: 18px;
    margin: 28px 0;
    padding: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}

.share-box::before {
    content: "";
    position: absolute;
    inset: -60% auto auto -12%;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: rgba(6, 182, 212, 0.18);
    filter: blur(50px);
    pointer-events: none;
}

.share-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.share-title {
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.share-subtitle {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.share-mini-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    color: #67e8f9;
    font-weight: 900;
    flex-shrink: 0;
}

.share-link {
    --share-accent: #67e8f9;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    background: rgba(255, 255, 255, 0.075);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    padding: 7px 12px 7px 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: transform 0.18s, border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

[dir="rtl"] .share-link {
    padding: 7px 8px 7px 12px;
}

.share-link::before {
    content: none;
}

.share-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--share-accent);
    color: #020617;
    font-size: 14px;
    line-height: 1;
    font-weight: 900;
    flex-shrink: 0;
}

.share-icon svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: currentColor;
}

.share-link:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--share-accent) 60%, transparent);
    background: rgba(255, 255, 255, 0.11);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
}

.share-facebook {
    --share-accent: #60a5fa;
}

.share-x {
    --share-accent: #f8fafc;
}

.share-linkedin {
    --share-accent: #38bdf8;
}

.share-whatsapp {
    --share-accent: #34d399;
}

.related {
    border-top: 1px solid var(--border);
    padding-top: 34px;
    margin-top: 54px;
}

.related-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.related-card {
    padding: 16px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.empty {
    padding: 40px 0 90px;
    text-align: center;
    color: var(--muted);
}

.pagination {
    padding-bottom: 90px;
}

.pagination nav {
    display: flex;
    justify-content: center;
}

/* Copyright sits on its own row, centred across the full footer width. */

@media (max-width: 1024px) {

}

@media (max-width: 900px) {

    .grid,
    .related-list {
        grid-template-columns: 1fr;
    }

    .hero {
        padding-top: 58px;
    }
}

@media (max-width: 768px) {

}

@media (max-width: 640px) {
    .article {
        padding-top: 50px;
    }
}

@media (max-width: 480px) {

}

/* ─── Generated covers ───────────────────────────────────────────────────
   A post without an image still gets a cover, tinted from its slug so the
   same post is the same colour wherever it appears. */
.cover-generated {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        radial-gradient(120% 120% at 20% 0%, hsl(var(--cover-hue) 70% 42% / 0.55), transparent 62%),
        radial-gradient(120% 120% at 85% 100%, hsl(calc(var(--cover-hue) + 55) 70% 45% / 0.5), transparent 60%),
        #0b1220;
}

.cover-generated::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 34px 34px;
}

.cover-glyph {
    position: relative;
    font-size: 62px;
    font-weight: 800;
    line-height: 1;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
}

.cover-tag {
    position: absolute;
    inset-block-end: 14px;
    inset-inline-start: 14px;
    z-index: 1;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(3, 7, 18, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
    font-size: 12px;
    font-weight: 700;
    color: #e2e8f0;
}

/* ─── Lead post ──────────────────────────────────────────────────────────
   The newest post gets the width the rest share between three of them. */
.post-lead {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    align-items: stretch;
    margin-top: 42px;
    border: 1px solid var(--border);
    border-radius: 26px;
    overflow: hidden;
    background: var(--surface);
    transition: transform 0.18s, border-color 0.18s;
}

.post-lead:hover {
    transform: translateY(-4px);
    border-color: rgba(6, 182, 212, 0.35);
}

.post-lead-cover {
    aspect-ratio: auto;
    min-height: 320px;
    border-bottom: 0;
    border-inline-end: 1px solid var(--border);
}

.post-lead-cover .cover-glyph { font-size: 96px; }

.post-lead-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
}

.post-lead-body h2 {
    font-size: clamp(26px, 2.6vw, 36px);
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 14px;
}

.post-lead-body .excerpt { font-size: 16px; line-height: 1.75; }

/* The grid follows the lead post, so it no longer opens the section. */
.grid { padding-top: 24px; }

/* ─── Related posts ──────────────────────────────────────────────────── */
.related-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    transition: transform 0.18s, border-color 0.18s;
}

.related-card:hover {
    transform: translateY(-3px);
    border-color: rgba(6, 182, 212, 0.35);
}

.related-card strong {
    font-size: 17px;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.related-card .excerpt { margin-top: 8px; font-size: 14px; line-height: 1.7; }
.related-card .read-more { margin-top: 14px; font-size: 14px; }

@media (max-width: 860px) {
    .post-lead { grid-template-columns: 1fr; }
    .post-lead-cover { min-height: 0; aspect-ratio: 16 / 9; border-inline-end: 0; border-bottom: 1px solid var(--border); }
    .post-lead-body { padding: 26px; }
    .article-body { font-size: 17px; }
}

/* Cards in a row are only as tidy as their weakest link: without this the
   excerpt length decides where each "read article" sits, and the row reads
   as three different components. */
.card > a {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.card-body .read-more {
    margin-top: auto;
    padding-top: 18px;
}

.card h2 { margin-bottom: 12px; }
.card .excerpt { line-height: 1.7; }
