/* ==========================================================================
   Alborz Journal — theme stylesheet
   Editorial, modern and bilingual (English LTR / Persian RTL).
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
    --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-fa: "Vazirmatn", "Inter", "Segoe UI", "Noto Naskh Arabic", Tahoma, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

    --brand: #28398f;
    --brand-2: #4358c9;
    --brand-strong: #1b2670;
    --brand-ink: #2c3f9e;
    --brand-soft: #e9ecfb;
    --accent: #0ea5b7;
    --gold: #c8a44a;
    --success: #0f9d70;

    --bg: #f7f8fc;
    --surface: #ffffff;
    --surface-2: #f1f4fa;
    --surface-3: #e7ecf7;
    --ink: #101729;
    --ink-2: #47506b;
    --ink-3: #6f7891;
    --line: #e2e7f3;
    --line-strong: #cfd7ea;
    --header-bg: rgba(255, 255, 255, .82);
    --hero-tint-1: rgba(40, 57, 143, .16);
    --hero-tint-2: rgba(14, 165, 183, .13);
    --hero-base: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);

    --shadow-xs: 0 1px 2px rgba(16, 23, 41, .06);
    --shadow-sm: 0 6px 18px -8px rgba(23, 33, 74, .18);
    --shadow-md: 0 20px 44px -24px rgba(23, 33, 74, .34);
    --shadow-lg: 0 44px 90px -44px rgba(23, 33, 74, .48);

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --shell: 1200px;
    --gutter: clamp(1.1rem, 4vw, 2rem);
    --header-h: 78px;
    --ease: cubic-bezier(.22, .61, .36, 1);
    color-scheme: light;
}

[data-theme="dark"] {
    --brand: #3d51c4;
    --brand-2: #5d74ee;
    --brand-strong: #c3cfff;
    --brand-ink: #a9b9ff;
    --brand-soft: rgba(93, 116, 238, .16);
    --accent: #2dd4bf;
    --gold: #e2c274;

    --bg: #070b16;
    --surface: #0d1426;
    --surface-2: #131c33;
    --surface-3: #1b2542;
    --ink: #eaefff;
    --ink-2: #b6c0d9;
    --ink-3: #8894b3;
    --line: #1f2a45;
    --line-strong: #2c3a5c;
    --header-bg: rgba(9, 14, 28, .8);
    --hero-tint-1: rgba(93, 116, 238, .22);
    --hero-tint-2: rgba(45, 212, 191, .16);
    --hero-base: linear-gradient(180deg, #0b1120 0%, var(--bg) 100%);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 6px 20px -8px rgba(0, 0, 0, .55);
    --shadow-md: 0 24px 50px -26px rgba(0, 0, 0, .75);
    --shadow-lg: 0 50px 100px -50px rgba(0, 0, 0, .9);
    color-scheme: dark;
}

/* ---------- 2. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scrollbar-color: var(--line-strong) transparent;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.is-rtl,
[dir="rtl"] { font-family: var(--font-fa); }

.site-main { flex: 1 0 auto; }

img, svg, video, iframe { max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; }

a { color: var(--brand-ink); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--brand-strong); }

h1, h2, h3, h4, h5, h6 {
    color: var(--ink);
    font-weight: 750;
    line-height: 1.2;
    letter-spacing: -.02em;
    margin: 0;
}

p { margin: 0 0 1em; }
::selection { background: rgba(67, 88, 201, .22); }
:focus-visible { outline: 3px solid rgba(67, 88, 201, .45); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

.icon { display: inline-block; vertical-align: -.16em; flex: none; }

/* ---------- 3. Layout & utilities ---------- */
.shell {
    width: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: -70px;
    inset-inline-start: 1rem;
    z-index: 200;
    background: var(--brand);
    color: #fff;
    padding: .75rem 1.2rem;
    border-radius: 0 0 12px 12px;
    font-weight: 600;
    transition: top .2s var(--ease);
}
.skip-link:focus { top: 0; color: #fff; }

/* ---------- 4. Type & controls ---------- */
.eyebrow {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 0;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--brand-ink);
}
.eyebrow-light { color: #9db8ff; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    padding: .82rem 1.4rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: .93rem;
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: -.005em;
    text-decoration: none;
    cursor: pointer;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease),
                background-color .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    box-shadow: 0 14px 28px -16px rgba(40, 57, 143, .9);
}
.btn-primary:hover { color: #fff; box-shadow: 0 20px 34px -16px rgba(40, 57, 143, .95); }

.btn-ghost {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink);
    box-shadow: var(--shadow-xs);
}
.btn-ghost:hover { color: var(--brand-ink); border-color: var(--brand-2); }

.btn-light { background: #fff; color: #1b2670; box-shadow: 0 12px 28px -16px rgba(0, 0, 0, .5); }
.btn-light:hover { color: #1b2670; background: #f2f5ff; }

.btn-outline-light {
    background: rgba(255, 255, 255, .04);
    border-color: rgba(255, 255, 255, .38);
    color: #fff;
}
.btn-outline-light:hover { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .6); }

/* ---------- 5. Header & navigation ---------- */
.utility-bar {
    background: linear-gradient(90deg, #16215e 0%, #28398f 55%, #3a4fb3 100%);
    color: #dfe4ff;
    font-size: .8rem;
}
.utility-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 38px;
}
.utility-note {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0;
    letter-spacing: .02em;
    color: rgba(255, 255, 255, .86);
}
.utility-links { display: flex; align-items: center; gap: 1.3rem; }
.utility-links a {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    color: rgba(255, 255, 255, .82);
    font-size: .78rem;
}
.utility-links a:hover { color: #fff; }

.site-head {
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--header-bg);
    -webkit-backdrop-filter: blur(18px) saturate(170%);
    backdrop-filter: blur(18px) saturate(170%);
    border-bottom: 1px solid var(--line);
    transition: box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.site-head.is-scrolled { box-shadow: var(--shadow-sm); border-color: transparent; }

.head-inner {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    min-height: var(--header-h);
}

.brand {
    display: flex;
    align-items: center;
    gap: .8rem;
    flex: none;
    padding: .3rem;
    border-radius: 14px;
    transition: background-color .25s var(--ease), box-shadow .25s var(--ease);
}
.brand-logo { display: block; height: 52px; width: auto; }
.brand-tag {
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--ink-3);
    border-inline-start: 1px solid var(--line-strong);
    padding-inline-start: .8rem;
    line-height: 1.5;
}
[data-theme="dark"] .brand {
    background: #fff;
    padding: .35rem .75rem;
    box-shadow: 0 8px 20px -12px rgba(0, 0, 0, .7);
}
[data-theme="dark"] .brand-tag { color: #5b6480; border-color: #d9deee; }

.site-nav {
    display: flex;
    align-items: center;
    gap: .1rem;
    margin-inline-start: auto;
}
.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .5rem .62rem;
    border-radius: 999px;
    font-size: .865rem;
    font-weight: 550;
    color: var(--ink-2);
    white-space: nowrap;
    transition: color .2s var(--ease), background-color .2s var(--ease);
}
.nav-link::after {
    content: "";
    position: absolute;
    inset-inline: .75rem;
    bottom: .18rem;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--brand-2), var(--accent));
    transform: scaleX(0);
    transition: transform .25s var(--ease);
}
.nav-link:hover { color: var(--ink); background: var(--surface-2); }
.nav-link:hover::after,
.nav-link.is-active::after { transform: scaleX(1); }
.nav-link.is-active { color: var(--brand-ink); background: var(--brand-soft); }
.nav-lang { border: 1px solid var(--line-strong); padding: .38rem .8rem; font-weight: 650; }
.nav-lang::after { display: none; }
.nav-sep { width: 1px; height: 20px; background: var(--line-strong); margin-inline: .45rem; flex: none; }

.head-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-inline-start: .2rem;
}
.icon-btn {
    width: 40px; height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
    transition: transform .2s var(--ease), color .2s var(--ease),
                border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.icon-btn:hover {
    color: var(--brand-ink);
    border-color: var(--brand-2);
    box-shadow: var(--shadow-xs);
    transform: translateY(-1px);
}
.theme-icon { display: inline-flex; }
.theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: none; }
[data-theme="dark"] .theme-moon { display: inline-flex; }

.nav-toggle { display: none; }
.nav-close-icon { display: none; }
.nav-open-icon { display: inline-flex; }

.nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 75;
    background: rgba(6, 10, 24, .52);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .3s var(--ease);
}
body.nav-open .nav-scrim { opacity: 1; }

/* ---------- 6. Hero ---------- */
.blog-hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding-block: clamp(2.6rem, 6vw, 5rem) clamp(2.4rem, 5vw, 4.2rem);
    background:
        radial-gradient(1100px 520px at 8% -25%, var(--hero-tint-1), transparent 62%),
        radial-gradient(900px 460px at 92% -5%, var(--hero-tint-2), transparent 60%),
        var(--hero-base);
    border-bottom: 1px solid var(--line);
}
.hero-glow {
    position: absolute;
    z-index: -1;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .5;
    pointer-events: none;
}
.hero-glow-a { background: var(--hero-tint-1); inset-block-start: -18%; inset-inline-start: -8%; }
.hero-glow-b { background: var(--hero-tint-2); inset-block-start: 10%; inset-inline-end: -10%; }

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    align-items: center;
    gap: clamp(2rem, 5vw, 4rem);
}

.hero-title {
    font-size: clamp(2.6rem, 6vw, 4.6rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -.04em;
    margin: .85rem 0 1.05rem;
    background: linear-gradient(118deg, var(--ink) 32%, var(--brand-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
[data-theme="dark"] .hero-title {
    background: linear-gradient(118deg, #ffffff 30%, var(--brand-ink) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.hero-intro {
    max-width: 54ch;
    margin: 0 0 1.9rem;
    font-size: clamp(1.02rem, 1.5vw, 1.18rem);
    line-height: 1.75;
    color: var(--ink-2);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; }

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: .9rem clamp(1.5rem, 4vw, 3rem);
    list-style: none;
    margin: 2.4rem 0 0;
    padding: 1.4rem 0 0;
    border-top: 1px solid var(--line);
}
.hero-stats li { display: flex; flex-direction: column; gap: .1rem; }
.hero-stats strong {
    font-size: 1.35rem;
    font-weight: 750;
    letter-spacing: -.03em;
    line-height: 1.1;
    color: var(--ink);
}
.hero-stats span {
    font-size: .72rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-3);
}

/* Decorative card stack */
.hero-art {
    position: relative;
    min-height: 400px;
    display: grid;
    place-items: center;
}
.hero-orbit {
    position: absolute;
    width: min(420px, 92%);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px dashed rgba(67, 88, 201, .3);
    animation: orbit-spin 46s linear infinite;
}
.hero-orbit::before,
.hero-orbit::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(14, 165, 183, .22);
}
.hero-orbit::before { inset: 12%; }
.hero-orbit::after { inset: 28%; border-style: dashed; }
@keyframes orbit-spin { to { transform: rotate(360deg); } }

.hero-dots {
    position: absolute;
    inset-block-end: 4%;
    inset-inline-end: 2%;
    width: 150px;
    height: 96px;
    background-image: radial-gradient(rgba(67, 88, 201, .38) 1.4px, transparent 1.4px);
    background-size: 14px 14px;
    opacity: .6;
}

.hero-stack {
    position: absolute;
    width: min(272px, 74%);
    border-radius: 22px;
    padding: 1.4rem;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.hero-stack-back {
    transform: translate(-17%, -15%) rotate(-9deg) scale(.9);
    opacity: .6;
    background: linear-gradient(150deg, var(--surface-2), var(--surface-3));
    border-color: var(--line);
    box-shadow: var(--shadow-sm);
}
.hero-stack-mid {
    transform: translate(15%, -6%) rotate(7deg) scale(.95);
    opacity: .85;
}
.hero-stack-front {
    transform: rotate(-2deg);
    background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%);
    box-shadow: var(--shadow-lg);
    border-color: var(--line-strong);
    overflow: hidden;
}
.hero-stack-front::after {
    content: "";
    position: absolute;
    inset-block-start: -40%;
    inset-inline-end: -30%;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 183, .22), transparent 65%);
    pointer-events: none;
}
.hero-stack .stack-line { height: 7px; border-radius: 99px; background: var(--surface-3); }
.w-40 { width: 40%; } .w-50 { width: 50%; } .w-60 { width: 60%; }
.w-70 { width: 70%; } .w-75 { width: 75%; } .w-80 { width: 80%; } .w-90 { width: 90%; }
.stack-kicker { width: 34px; height: 7px; border-radius: 99px; background: var(--brand-2); opacity: .7; margin-bottom: .35rem; }
.stack-badge {
    align-self: flex-start;
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    padding: .3rem .6rem;
    border-radius: 99px;
}
.stack-letter {
    font-size: 3.4rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.05em;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.stack-title { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }

/* ---------- 7. Archive, toolbar, cards ---------- */
.archive {
    padding-block: clamp(2.6rem, 5vw, 4.4rem) clamp(3rem, 6vw, 5.2rem);
    scroll-margin-top: calc(var(--header-h) + 1.2rem);
}
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.4rem;
    flex-wrap: wrap;
    margin-bottom: 1.7rem;
}
.section-head h2 {
    font-size: clamp(1.6rem, 3vw, 2.15rem);
    letter-spacing: -.035em;
    margin-top: .4rem;
}
.section-note {
    max-width: 34ch;
    margin: 0;
    font-size: .92rem;
    color: var(--ink-3);
}
.section-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .88rem;
    font-weight: 700;
    color: var(--brand-ink);
}

.archive-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .65rem;
    margin-bottom: 2rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.search-field {
    flex: 1 1 280px;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .62rem .9rem;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid transparent;
    color: var(--ink-3);
    cursor: text;
    transition: border-color .2s var(--ease), background-color .2s var(--ease), box-shadow .2s var(--ease);
}
.search-field:focus-within {
    background: var(--surface);
    border-color: var(--brand-2);
    box-shadow: 0 0 0 4px rgba(67, 88, 201, .12);
}
.search-field input {
    width: 100%;
    border: 0;
    background: transparent;
    outline: 0;
    font-size: .95rem;
    color: var(--ink);
}
.search-field input::placeholder { color: var(--ink-3); }
.search-field input::-webkit-search-cancel-button { cursor: pointer; }

.sort-field {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-inline-start: .5rem;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.sort-field select {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f7891' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .65rem center;
    background-size: 11px;
    padding: .52rem 2rem .52rem .8rem;
    font-size: .84rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
    cursor: pointer;
}
[dir="rtl"] .sort-field select {
    padding: .52rem .8rem .52rem 2rem;
    background-position: left .65rem center;
}
.result-count {
    margin: 0;
    padding-inline: .6rem;
    font-size: .8rem;
    font-weight: 700;
    color: var(--ink-3);
    white-space: nowrap;
}

/* No results / empty states */
.empty-state,
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .7rem;
    padding: clamp(2.5rem, 6vw, 4.5rem) 1rem;
    text-align: center;
    color: var(--ink-3);
}
.empty-state h2 { font-size: 1.3rem; color: var(--ink); }
.empty-state p, .no-results p { margin: 0; font-size: .95rem; }
.empty-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--brand-ink);
}

/* Featured (lead) story */
.featured-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr);
    overflow: hidden;
    margin-bottom: clamp(1.5rem, 3vw, 2.4rem);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: linear-gradient(125deg, var(--surface) 0%, var(--surface-2) 100%);
    box-shadow: var(--shadow-md);
}
.featured-thumb {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 340px;
    overflow: hidden;
    background: linear-gradient(140deg, #1a2467 0%, #2f43a8 52%, #4d6bff 100%);
    isolation: isolate;
}
.featured-thumb::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 72% 18%, rgba(255, 255, 255, .3), transparent 46%),
        radial-gradient(circle at 18% 88%, rgba(14, 165, 183, .45), transparent 52%),
        linear-gradient(180deg, transparent 45%, rgba(7, 11, 26, .42));
    z-index: -1;
}
.featured-thumb::after {
    content: "";
    position: absolute;
    inset: auto -12% -34% -12%;
    height: 68%;
    background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .14) 0 1px, transparent 1px 20px);
    transform: rotate(-9deg);
    z-index: -1;
}
.featured-letter {
    font-size: clamp(6rem, 12vw, 10rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.06em;
    color: #fff;
    text-shadow: 0 24px 60px rgba(0, 0, 0, .38);
    opacity: .96;
}
.featured-badge {
    position: absolute;
    inset-block-start: 1.2rem;
    inset-inline-start: 1.2rem;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .4rem .75rem;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, .32);
    background: rgba(10, 16, 36, .26);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.featured-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .8rem;
    padding: clamp(1.5rem, 3.4vw, 2.8rem);
}
.featured-title {
    font-size: clamp(1.45rem, 2.6vw, 2.1rem);
    line-height: 1.2;
    letter-spacing: -.03em;
}
.featured-title a { color: var(--ink); }
.featured-title a:hover { color: var(--brand-ink); }
.featured-summary {
    margin: 0;
    font-size: 1rem;
    line-height: 1.75;
    color: var(--ink-2);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.featured-actions {
    display: flex;
    align-items: center;
    gap: 1rem 1.4rem;
    flex-wrap: wrap;
    margin-top: .5rem;
}
.featured-author {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink-3);
}

/* Article cards */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1rem, 2vw, 1.5rem);
}
.post-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.post-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s var(--ease);
}
.post-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: var(--line-strong);
}
.card-link { display: flex; flex-direction: column; height: 100%; color: inherit; }
.card-link:hover { color: inherit; }

.card-thumb {
    position: relative;
    aspect-ratio: 16 / 8.6;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    isolation: isolate;
}
.card-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 72% 16%, rgba(255, 255, 255, .28), transparent 48%),
        linear-gradient(180deg, transparent 42%, rgba(7, 11, 26, .34));
}
.thumb-letter {
    font-size: 4.3rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.05em;
    color: #fff;
    text-shadow: 0 14px 36px rgba(0, 0, 0, .28);
}
.thumb-orbit {
    position: absolute;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .3);
    transform: translate(38%, -34%);
}
.thumb-lines {
    position: absolute;
    inset: auto -10% -32% -10%;
    height: 70%;
    background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .13) 0 1px, transparent 1px 18px);
    transform: rotate(-8deg);
}
.thumb-badge {
    position: absolute;
    inset-block-start: .85rem;
    inset-inline-start: .85rem;
    z-index: 2;
    padding: .28rem .6rem;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, .26);
    background: rgba(8, 13, 30, .3);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: .64rem;
    font-weight: 750;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    flex: 1;
    padding: 1.25rem 1.35rem 1.45rem;
}
.card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem 1rem;
    font-size: .73rem;
    font-weight: 650;
    color: var(--ink-3);
}
.card-meta > span { display: inline-flex; align-items: center; gap: .35rem; }
.card-title {
    font-size: 1.08rem;
    line-height: 1.4;
    letter-spacing: -.015em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-summary {
    margin: 0;
    font-size: .9rem;
    line-height: 1.62;
    color: var(--ink-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-more {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: auto;
    padding-top: .7rem;
    font-size: .8rem;
    font-weight: 750;
    color: var(--brand-ink);
}
.card-more .icon { transition: transform .25s var(--ease); }
.post-card:hover .card-more .icon { transform: translateX(4px); }

/* Thumbnail palettes */
.post-card.grad-1 .card-thumb { background: linear-gradient(135deg, #1f2c78 0%, #3d55d6 62%, #7d92ff 100%); }
.post-card.grad-2 .card-thumb { background: linear-gradient(135deg, #0c4a6e 0%, #0891b2 58%, #34d399 100%); }
.post-card.grad-3 .card-thumb { background: linear-gradient(135deg, #6d28d9 0%, #a855f7 55%, #f0abfc 100%); }
.post-card.grad-4 .card-thumb { background: linear-gradient(135deg, #7c2d12 0%, #c2410c 52%, #f59e0b 100%); }
.post-card.grad-5 .card-thumb { background: linear-gradient(135deg, #14432e 0%, #0f766e 55%, #5eead4 100%); }
.post-card.grad-6 .card-thumb { background: linear-gradient(135deg, #3b0764 0%, #7e22ce 50%, #f472b6 100%); }

/* ---------- 8. Article page ---------- */
.progress-track {
    position: fixed;
    inset-block-start: 0;
    inset-inline: 0;
    height: 3px;
    z-index: 100;
    pointer-events: none;
}
.progress-bar {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--brand), var(--accent) 60%, var(--gold));
    box-shadow: 0 0 14px rgba(14, 165, 183, .55);
    transition: width .12s linear;
}

.article-hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding-block: clamp(1.6rem, 3vw, 2.6rem) clamp(2.4rem, 5vw, 3.6rem);
    background:
        radial-gradient(900px 420px at 12% -30%, var(--hero-tint-1), transparent 62%),
        radial-gradient(700px 380px at 95% 0%, var(--hero-tint-2), transparent 58%),
        var(--hero-base);
    border-bottom: 1px solid var(--line);
}
.article-hero-inner { max-width: 960px; }

.crumbs {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1.6rem;
    font-size: .8rem;
    color: var(--ink-3);
}
.crumbs a { color: var(--ink-3); font-weight: 600; }
.crumbs a:hover { color: var(--brand-ink); }
.crumb-sep { opacity: .5; }

.article-title {
    max-width: 24ch;
    margin: .9rem 0 1.5rem;
    font-size: clamp(2rem, 4.6vw, 3.35rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -.04em;
    color: var(--ink);
    overflow-wrap: break-word;
}
[dir="rtl"] .article-title { max-width: 30ch; line-height: 1.3; }

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .7rem 1.4rem;
    color: var(--ink-3);
    font-size: .84rem;
}
.author-chip {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    padding: .28rem .95rem .28rem .32rem;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}
[dir="rtl"] .author-chip { padding: .28rem .32rem .28rem .95rem; }
.avatar {
    display: grid;
    place-items: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    color: #fff;
    font-size: .72rem;
    font-weight: 750;
    letter-spacing: .02em;
    flex: none;
}
.author-name { color: var(--ink); font-weight: 650; font-size: .85rem; }
.meta-item { display: inline-flex; align-items: center; gap: .42rem; }
.meta-lang { padding: .28rem .7rem; border-radius: 99px; background: var(--surface-2); }

.share-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: 1.7rem;
}
.share-label {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    margin-inline-end: .4rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
    transition: transform .2s var(--ease), color .2s var(--ease),
                background-color .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.share-btn:hover {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.copy-done { display: none; }
.copy-btn.is-done { background: var(--success); border-color: var(--success); color: #fff; }
.copy-btn.is-done .copy-default { display: none; }
.copy-btn.is-done .copy-done { display: inline-flex; }

.article-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4rem);
    max-width: 1080px;
    padding-block: clamp(2rem, 4vw, 3.4rem) clamp(2rem, 4vw, 3rem);
}
.article-layout-simple { grid-template-columns: minmax(0, 1fr); max-width: 860px; }

.article-rail {
    position: sticky;
    top: calc(var(--header-h) + 1.4rem);
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
}
.rail-title {
    margin: 0 0 .7rem;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.rail-note {
    padding-top: 1.3rem;
    border-top: 1px solid var(--line);
    font-size: .8rem;
    line-height: 1.65;
    color: var(--ink-3);
}
.rail-note p:last-child { margin: 0; }

.toc ol {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    margin: 0;
    padding: 0;
    list-style: none;
    border-inline-start: 1px solid var(--line);
}
.toc a {
    display: block;
    margin-inline-start: -1px;
    padding: .3rem .8rem;
    border-inline-start: 2px solid transparent;
    font-size: .82rem;
    line-height: 1.45;
    color: var(--ink-3);
    transition: color .2s var(--ease), border-color .2s var(--ease);
}
.toc a:hover { color: var(--ink); }
.toc a.is-active { color: var(--brand-ink); border-color: var(--brand-2); font-weight: 650; }
.toc .toc-sub a { padding-inline-start: 1.5rem; font-size: .79rem; }

.article-main { min-width: 0; }

/* ---------- 9. Prose / legacy article markup ---------- */
.article-body {
    max-width: 74ch;
    font-size: 1.075rem;
    line-height: 1.85;
    color: var(--ink);
    overflow-wrap: break-word;
}
[dir="rtl"].article-body { line-height: 1.95; }
.article-body > :first-child { margin-top: 0; }
.article-body p { margin: 0 0 1.15em; }

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
    scroll-margin-top: calc(var(--header-h) + 1.4rem);
    margin: 2em 0 .7em;
    line-height: 1.3;
    letter-spacing: -.025em;
}
.article-body h1 { font-size: 1.7rem; }
.article-body h2 {
    font-size: clamp(1.32rem, 2.2vw, 1.65rem);
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--line);
}
.article-body h3 { font-size: 1.24rem; }
.article-body h4 { font-size: 1.08rem; }
.article-body h5, .article-body h6 { font-size: 1rem; }

.article-body strong { color: var(--ink); font-weight: 700; }
.article-body em { font-style: italic; }
.article-body a {
    color: var(--brand-ink);
    text-decoration: underline;
    text-decoration-color: rgba(67, 88, 201, .35);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.article-body a:hover { text-decoration-color: currentColor; }

.article-body ul,
.article-body ol { margin: 0 0 1.2em; padding-inline-start: 1.5rem; }
.article-body li { margin-bottom: .45em; }
.article-body li::marker { color: var(--brand-2); font-weight: 700; }

.article-body blockquote {
    position: relative;
    margin: 1.9em 0;
    padding: 1.15rem 1.5rem;
    border-inline-start: 3px solid var(--brand-2);
    border-radius: 0 14px 14px 0;
    background: linear-gradient(120deg, var(--surface-2), var(--surface));
    color: var(--ink-2);
    font-style: italic;
    font-size: 1.02em;
}
[dir="rtl"] .article-body blockquote { border-radius: 14px 0 0 14px; }
.article-body blockquote::before {
    content: "\201C";
    position: absolute;
    inset-block-start: -.35rem;
    inset-inline-start: .7rem;
    font-size: 3rem;
    line-height: 1;
    color: var(--brand-2);
    opacity: .25;
    font-style: normal;
}
.article-body blockquote > :last-child { margin-bottom: 0; }

.article-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.6em auto;
    border-radius: 14px;
    box-shadow: var(--shadow-md);
}
.article-body figure { margin: 1.8em 0; }
.article-body figcaption {
    margin-top: .6rem;
    font-size: .82rem;
    line-height: 1.6;
    text-align: center;
    color: var(--ink-3);
}
.article-body video,
.article-body iframe { display: block; max-width: 100%; margin: 1.6em auto; border-radius: 14px; }

.article-body table {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 1.7em 0;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: .92rem;
    -webkit-overflow-scrolling: touch;
}
.article-body th,
.article-body td {
    padding: .6rem .8rem;
    border: 1px solid var(--line);
    text-align: start;
    vertical-align: top;
}
.article-body th { background: var(--surface-2); font-weight: 700; }
.article-body tbody tr:nth-child(even) td { background: rgba(127, 141, 178, .06); }

.article-body hr {
    height: 1px;
    margin: 2.4em 0;
    border: 0;
    background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}
.article-body pre {
    margin: 1.6em 0;
    padding: 1rem 1.2rem;
    overflow-x: auto;
    border-radius: 12px;
    background: #0e1530;
    color: #dfe6ff;
    font-size: .88rem;
    line-height: 1.65;
}
.article-body code {
    padding: .12em .38em;
    border-radius: 5px;
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: .9em;
}
.article-body pre code { padding: 0; background: none; color: inherit; }

/* Legacy LDP / PDF-derived classes */
.ldp-article-content { font-size: inherit; line-height: inherit; color: inherit; }
.is-duplicate-title { display: none !important; }
.ldp-title {
    letter-spacing: -.025em;
    line-height: 1.22;
    color: var(--ink);
    margin: 0 0 .5rem;
}
.ldp-deck {
    margin: .25rem 0;
    font-size: 1.04rem;
    line-height: 1.65;
    color: var(--ink-2);
}
.ldp-byline {
    margin: .8rem 0 1.9rem;
    font-size: .78rem;
    font-weight: 650;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.ldp-para { margin: 0 0 1.1em; }
.ldp-h2, .art-h2 { font-size: clamp(1.3rem, 2.2vw, 1.6rem); font-weight: 750; margin: 1.9em 0 .6em; letter-spacing: -.02em; }
.ldp-h3, .art-h3 { font-size: 1.2rem; font-weight: 700; margin: 1.6em 0 .5em; }
.art-h4 { font-size: 1.05rem; font-weight: 700; margin: 1.4em 0 .45em; }
.art-p { margin: 0 0 1.1em; }
.art-body { max-width: none; margin: 0; font-size: inherit; line-height: inherit; color: inherit; }

.art-img-strip,
.ldp-img-strip {
    display: flex;
    flex-wrap: wrap;
    gap: .9rem;
    margin: 0 0 1.8rem;
}
.art-img-strip img,
.ldp-img-strip img {
    max-height: 230px;
    max-width: 100%;
    object-fit: contain;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}
.ldp-figure { margin: 1.8em 0; }
.ldp-caption,
.ldp-figure figcaption {
    margin-top: .55rem;
    font-size: .8rem;
    line-height: 1.6;
    text-align: center;
    color: var(--ink-3);
}
.ldp-signature {
    margin-top: 2.2rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line);
    font-style: italic;
    color: var(--ink-2);
}

/* ---------- 10. Article footer, tags, navigation ---------- */
.article-end {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2.6rem;
    padding-top: 1.6rem;
    border-top: 1px solid var(--line);
}
.tag-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: .35rem .75rem;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: .73rem;
    font-weight: 650;
    letter-spacing: .02em;
}
.tag-pill-accent { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.tag-pill-soft { background: transparent; color: var(--ink-3); }
.legacy-note { margin: 0; font-size: .8rem; color: var(--ink-3); }
.article-back {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .88rem;
    font-weight: 650;
    color: var(--brand-ink);
}

.post-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2.3rem;
}
.post-nav-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .5rem;
    min-height: 104px;
    padding: 1.15rem 1.3rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.post-nav-card:hover {
    transform: translateY(-2px);
    border-color: var(--brand-2);
    box-shadow: var(--shadow-sm);
}
.post-nav-card.is-next { align-items: flex-end; text-align: end; }
.post-nav-dir {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.post-nav-title {
    font-size: .95rem;
    font-weight: 650;
    line-height: 1.4;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-nav-spacer { display: block; }

.related {
    padding-block: clamp(2.6rem, 5vw, 4.2rem) clamp(3rem, 6vw, 5rem);
    background: var(--surface);
    border-top: 1px solid var(--line);
}
.related .section-head { margin-bottom: 1.6rem; }

/* ---------- 11. Footer ---------- */
.site-foot {
    position: relative;
    overflow: hidden;
    margin-top: auto;
    background:
        radial-gradient(900px 420px at 12% 0%, rgba(67, 88, 201, .38), transparent 62%),
        radial-gradient(720px 420px at 92% 8%, rgba(14, 165, 183, .22), transparent 58%),
        #080d1c;
    color: #c7cfe6;
}
.site-foot::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: .55;
    pointer-events: none;
}
.foot-cta,
.foot-grid,
.foot-bottom { position: relative; }

.foot-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.6rem 2.5rem;
    flex-wrap: wrap;
    padding-block: clamp(2rem, 4vw, 3.1rem);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.foot-cta h2 {
    max-width: 26ch;
    margin-top: .5rem;
    color: #fff;
    font-size: clamp(1.5rem, 3vw, 2.15rem);
    letter-spacing: -.03em;
}
.foot-cta-actions { display: flex; flex-wrap: wrap; gap: .7rem; }

.foot-grid {
    display: grid;
    grid-template-columns: 1.5fr .8fr .8fr 1fr;
    gap: clamp(1.6rem, 4vw, 3rem);
    padding-block: clamp(2rem, 4vw, 3.2rem);
}
.foot-brand p {
    max-width: 40ch;
    margin: 1.1rem 0 1.2rem;
    font-size: .92rem;
    line-height: 1.75;
    color: #aab4d0;
}
.foot-logo {
    display: inline-flex;
    padding: .55rem .85rem;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .8);
}
.foot-logo img { display: block; height: 42px; width: auto; }
.foot-mail {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .86rem;
    color: #c7cfe6;
}
.foot-mail:hover { color: #fff; }
.foot-col h3 {
    margin: 0 0 1rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: #8c97b8;
}
.foot-col ul { display: flex; flex-direction: column; gap: .55rem; margin: 0; padding: 0; list-style: none; }
.foot-col a {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .9rem;
    color: #c7cfe6;
    transition: color .2s var(--ease), transform .2s var(--ease);
}
.foot-col a:hover { color: #fff; transform: translateX(3px); }
[dir="rtl"] .foot-col a:hover { transform: translateX(-3px); }
.foot-col-about p { margin: 0 0 1rem; font-size: .88rem; line-height: 1.75; color: #aab4d0; }
.foot-book { color: #a9c1ff !important; font-weight: 600; }
.foot-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem 1.5rem;
    flex-wrap: wrap;
    padding-block: 1.35rem;
    border-top: 1px solid rgba(255, 255, 255, .1);
    font-size: .8rem;
    color: #8c97b8;
}
.foot-bottom p { margin: 0; }
.foot-motto span { color: var(--gold); margin-inline-start: .35rem; }

/* ---------- 12. Utility components ---------- */
.to-top {
    position: fixed;
    inset-inline-end: 1.2rem;
    inset-block-end: 1.2rem;
    z-index: 70;
    display: grid;
    place-items: center;
    width: 46px; height: 46px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink-2);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .25s var(--ease), transform .25s var(--ease),
                visibility .25s var(--ease), background-color .2s var(--ease), color .2s var(--ease);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

.error-page {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding-block: clamp(3rem, 8vw, 6.5rem);
    background:
        radial-gradient(900px 460px at 20% -20%, var(--hero-tint-1), transparent 62%),
        radial-gradient(700px 400px at 90% 0%, var(--hero-tint-2), transparent 58%),
        var(--hero-base);
}
.error-inner { max-width: 660px; }
.error-code {
    margin: 0 0 .3rem;
    font-size: clamp(6rem, 18vw, 11rem);
    font-weight: 800;
    line-height: .9;
    letter-spacing: -.07em;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: .92;
}
.error-inner h1 {
    margin: .7rem 0 1rem;
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    letter-spacing: -.035em;
}
.error-copy { color: var(--ink-2); margin-bottom: 1.6rem; }
.error-copy p:last-child { margin-bottom: 0; }

/* Scroll reveal (progressively enhanced) */
.js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .7s var(--ease), transform .7s var(--ease);
    transition-delay: var(--d, 0ms);
    will-change: opacity, transform;
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- 13. Bootstrap-compatible utilities used by legacy articles ---------- */
.img-fluid { max-width: 100%; height: auto; }
.rounded { border-radius: .5rem !important; }
.rounded-circle { border-radius: 50% !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.text-center { text-align: center !important; }
.text-start { text-align: start !important; }
.text-primary { color: var(--brand-ink) !important; }
.small { font-size: .85em !important; }
.bg-light { background: var(--surface-2) !important; }
.border-0 { border: 0 !important; }
.border { border: 1px solid var(--line) !important; }
.border-primary { border-color: var(--brand-2) !important; }
.border-start { border-inline-start: 1px solid var(--line) !important; }
.border-4 { border-width: 4px !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.align-items-center { align-items: center !important; }
.flex-wrap { flex-wrap: wrap !important; }
.gap-2 { gap: .5rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: .35rem !important; }
.mb-2 { margin-bottom: .6rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 2.2rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 2.2rem !important; }
.my-4 { margin-block: 1.5rem !important; }
.my-5 { margin-block: 2.2rem !important; }
.ms-0, .ps-0 { padding-inline-start: 0 !important; }
.me-2 { margin-inline-end: .6rem !important; }
.me-3 { margin-inline-end: 1rem !important; }
.p-2 { padding: .6rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }

.list-group {
    display: flex;
    flex-direction: column;
    margin: 0 0 1.4em;
    padding-inline-start: 0;
    list-style: none;
}
.list-group-item {
    position: relative;
    margin-bottom: -1px;
    padding: .85rem 1rem;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    font-size: .95rem;
}
.list-group-item:first-child { border-start-start-radius: 12px; border-start-end-radius: 12px; }
.list-group-item:last-child { margin-bottom: 0; border-end-start-radius: 12px; border-end-end-radius: 12px; }

.media { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.2em; }
.media-body { flex: 1 1 auto; min-width: 0; }

.table { width: 100%; margin-bottom: 1.4em; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: .55rem .7rem; border: 1px solid var(--line); text-align: start; }
.table th { background: var(--surface-2); }
.table-bordered th, .table-bordered td { border: 1px solid var(--line); }

blockquote.blockquote { font-size: 1em; }

/* ---------- 14. RTL refinements ---------- */
[dir="rtl"] .icon-arrow { transform: scaleX(-1); }
[dir="rtl"] .card-more .icon,
[dir="rtl"] .post-card:hover .card-more .icon { transform: scaleX(-1); }
[dir="rtl"] .post-card:hover .card-more .icon { transform: translateX(-4px) scaleX(-1); }
[dir="rtl"] .thumb-orbit { transform: translate(-38%, -34%); }
[dir="rtl"] .featured-letter,
[dir="rtl"] .thumb-letter { letter-spacing: 0; }
[dir="rtl"] .hero-stack-back { transform: translate(17%, -15%) rotate(9deg) scale(.9); }
[dir="rtl"] .hero-stack-mid { transform: translate(-15%, -6%) rotate(-7deg) scale(.95); }
[dir="rtl"] .hero-stack-front { transform: rotate(2deg); }
[dir="rtl"] .hero-dots { inset-inline: 2% auto; }
[dir="rtl"] .progress-bar { margin-inline-start: auto; }
[dir="rtl"] .search-field input { text-align: right; }

/* ---------- 15. Responsive ---------- */
@media (max-width: 1180px) {
    .brand-tag { display: none; }
    .nav-link { padding: .48rem .5rem; font-size: .83rem; }
    .nav-sep { margin-inline: .25rem; }
}
@media (max-width: 1024px) {
    .hero-grid { grid-template-columns: minmax(0, 1fr); }
    .hero-art { display: none; }
    .hero-title { max-width: 18ch; }
    .post-grid, .post-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .article-layout { grid-template-columns: minmax(0, 1fr); max-width: 880px; }
    .article-rail { display: none; }
    .article-body { max-width: none; }
    .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
    .site-head { z-index: 90; }
    .nav-toggle { display: inline-flex; }
    .head-search { display: none; }
    .site-nav {
        position: fixed;
        inset-block: 0;
        inset-inline-end: 0;
        z-index: 80;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: .15rem;
        width: min(88vw, 360px);
        margin: 0;
        padding: 5.4rem 1.3rem 2rem;
        background: var(--surface);
        box-shadow: var(--shadow-lg);
        overflow-y: auto;
    }
    body.nav-open .site-nav {
        display: flex;
        animation: nav-in .32s var(--ease);
    }
    html[dir="rtl"] body.nav-open .site-nav { animation-name: nav-in-rtl; }
    @keyframes nav-in {
        from { opacity: 0; transform: translateX(16px); }
        to { opacity: 1; transform: none; }
    }
    @keyframes nav-in-rtl {
        from { opacity: 0; transform: translateX(-16px); }
        to { opacity: 1; transform: none; }
    }
    body.nav-open .site-head {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    .head-actions { position: relative; z-index: 85; }
    .nav-link { padding: .85rem .9rem; font-size: .98rem; border-radius: 12px; }
    .nav-link::after { display: none; }
    .nav-sep { display: none; }
    .nav-lang { justify-content: center; margin-top: .6rem; }
    body.nav-open { overflow: hidden; }
    body.nav-open .nav-close-icon { display: inline-flex; }
    body.nav-open .nav-open-icon { display: none; }
    .utility-links a span { display: none; }
}

@media (max-width: 820px) {
    .featured-card { grid-template-columns: minmax(0, 1fr); }
    .featured-thumb { min-height: 220px; aspect-ratio: 16 / 9; }
    .featured-letter { font-size: clamp(4.5rem, 16vw, 7rem); }
    .foot-cta { align-items: flex-start; }
}

@media (max-width: 700px) {
    :root { --header-h: 68px; }
    body { font-size: 1.02rem; }
    .utility-bar { font-size: .74rem; }
    .utility-inner { justify-content: center; }
    .utility-links { display: none; }
    .utility-note { justify-content: center; text-align: center; }
    .head-inner { gap: .5rem; }
    .brand-logo { height: 40px; }
    [data-theme="dark"] .brand { padding: .25rem .5rem; }
    .icon-btn { width: 38px; height: 38px; }

    .hero-title { max-width: none; font-size: clamp(2.2rem, 10vw, 3rem); }
    .hero-stats { gap: .9rem 1.6rem; }
    .hero-stats strong { font-size: 1.15rem; }
    .hero-stats span { font-size: .64rem; }

    .archive-toolbar { flex-direction: column; align-items: stretch; }
    .search-field { flex: 0 0 auto; }
    .sort-field { justify-content: space-between; padding: .2rem .2rem 0; }
    .sort-field select { max-width: 62%; }
    .result-count { padding: .3rem .2rem 0; }
    .post-grid, .post-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .card-thumb { aspect-ratio: 16 / 8; }

    .article-title { max-width: none; font-size: clamp(1.75rem, 8vw, 2.4rem); line-height: 1.15; }
    .article-meta { gap: .55rem 1rem; font-size: .8rem; }
    .author-chip { padding: .25rem .8rem .25rem .28rem; }
    .share-label span { display: none; }
    .article-body { font-size: 1.02rem; }
    .post-nav { grid-template-columns: minmax(0, 1fr); }
    .post-nav-card.is-next { align-items: flex-start; text-align: start; }

    .foot-grid { grid-template-columns: minmax(0, 1fr); gap: 1.8rem; }
    .foot-cta-actions { width: 100%; }
    .foot-cta-actions .btn { flex: 1 1 auto; }
    .foot-bottom { flex-direction: column; text-align: center; }

    .related { padding-block: 2.4rem 3rem; }
    .to-top { width: 42px; height: 42px; inset-inline-end: .9rem; inset-block-end: .9rem; }
}

@media (max-width: 380px) {
    .hero-actions .btn, .btn { width: 100%; }
    .share-row { gap: .35rem; }
}

/* ---------- 16. Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    .js .reveal { opacity: 1; transform: none; }
}

@media print {
    .utility-bar, .site-head, .site-foot, .article-rail, .share-row,
    .post-nav, .related, .progress-track, .to-top, .skip-link,
    .article-back, .nav-scrim { display: none !important; }
    body { background: #fff; color: #000; font-size: 11pt; }
    .article-hero, .blog-hero, .error-page { background: none; border: 0; padding: 0 0 1rem; }
    .article-title, .hero-title, .error-code { color: #000; -webkit-text-fill-color: #000; background: none; }
    .article-layout { display: block; padding: 0; max-width: none; }
    .article-body { max-width: none; font-size: 11pt; line-height: 1.6; }
    .article-body a { color: #000; text-decoration: underline; }
    .article-body h2 { border-color: #ccc; }
    .post-card, .featured-card { break-inside: avoid; }
}













/* ==========================================================================
   17. Static pages + homepage "latest article" hero
   Used by the pages migrated off the old PHP site (who-we-are, what-we-do,
   how-we-do-it, books, videos) and by the latest-article card in the archive
   hero that replaced the old /this-week page.
   ========================================================================== */

/* ---------- homepage: newest article in the hero ---------- */
.hero-latest { display: flex; flex-direction: column; gap: .9rem; min-width: 0; }
.hero-latest-label {
    display: inline-flex; align-items: center; gap: .5rem; margin: 0;
    font-size: .72rem; font-weight: 700; letter-spacing: .16em;
    text-transform: uppercase; color: var(--ink-3);
}
.hero-latest-card {
    padding: 1.6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}
.hero-latest-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.1rem;
    margin-bottom: .8rem; font-size: .78rem; color: var(--ink-3);
}
.hero-latest-meta span { display: inline-flex; align-items: center; gap: .35rem; }
.hero-latest-title {
    margin: 0 0 .7rem;
    font-size: clamp(1.2rem, 2.2vw, 1.55rem);
    line-height: 1.25; letter-spacing: -.01em;
}
[dir="rtl"] .hero-latest-title { font-family: var(--font-fa); }
.hero-latest-title a { color: var(--ink); text-decoration: none; }
.hero-latest-title a:hover { color: var(--brand-ink); }
.hero-latest-summary {
    margin: 0 0 1.2rem; color: var(--ink-2); font-size: .95rem; line-height: 1.55;
    display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;
    overflow: hidden;
}
.hero-latest-cta { align-self: flex-start; }

/* ---------- migrated static pages ---------- */
.article-standfirst {
    margin: 1rem 0 0; max-width: 62ch;
    font-size: 1.06rem; line-height: 1.6; color: var(--ink-2);
}
.page-body .lede { font-size: 1.1rem; line-height: 1.6; color: var(--ink-2); }
.page-body > h2 { margin-top: 2.4em; }
.page-body > h2:first-child { margin-top: 0; }

/* ---------- board of directors ---------- */
.board-grid { display: grid; gap: 1.4rem; margin: 1.8rem 0 0; }
.board-card {
    display: grid; grid-template-columns: 152px minmax(0, 1fr);
    gap: 1.3rem; align-items: start;
    padding: 1.2rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); box-shadow: var(--shadow-xs);
}
.board-photo {
    width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
    border-radius: var(--radius-sm); background: var(--surface-2);
}
.board-body h3 { margin: 0 0 .15rem; font-size: 1.12rem; }
.board-role {
    margin: 0 0 .7rem; font-size: .78rem; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}
.board-role-founder { color: var(--brand-ink); }
.board-body p { margin: 0; font-size: .95rem; line-height: 1.6; color: var(--ink-2); }
.board-card-founder { border-color: var(--brand-soft); box-shadow: var(--shadow-sm); }

/* ---------- books ---------- */
.book-grid {
    display: grid; gap: 1.4rem; margin-top: 1.6rem;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.book-card {
    display: flex; flex-direction: column;
    padding: 1.1rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); box-shadow: var(--shadow-xs);
}
.book-cover {
    width: 100%; height: 260px; object-fit: contain;
    margin-bottom: 1rem;
    background: var(--surface-2); border-radius: var(--radius-sm);
}
.book-body { display: flex; flex-direction: column; flex: 1 1 auto; }
.book-body h3 { margin: 0 0 .2rem; font-size: 1.02rem; line-height: 1.3; }
.book-meta {
    margin: 0 0 .7rem; font-size: .74rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
.book-body p { margin: 0 0 1rem; font-size: .9rem; line-height: 1.55; color: var(--ink-2); }
.book-link { margin-top: auto; width: 100%; justify-content: center; }

/* ---------- videos ---------- */
.video-grid {
    display: grid; gap: 1.2rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.video-embed {
    position: relative; aspect-ratio: 16 / 9; overflow: hidden;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface-2); box-shadow: var(--shadow-xs);
}
/* Beats `.article-body iframe` (equal specificity, earlier in the file). */
.video-embed iframe {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    margin: 0; border: 0; border-radius: 0;
}

/* ---------- responsive additions ---------- */
@media (max-width: 700px) {
    .board-card { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .board-photo { max-width: 190px; }
    .book-grid, .video-grid { grid-template-columns: minmax(0, 1fr); }
    .book-cover { height: 220px; }
    .hero-latest-card { padding: 1.2rem; }
}

/* ==========================================================================
   18. Motion — header, navigation, buttons
   Transform/opacity only, so it stays compositor-friendly. The global
   `prefers-reduced-motion` block at the end neutralises every rule here.
   ========================================================================== */

/* ---------- sticky header compresses as you scroll ---------- */
.site-head .head-inner { transition: min-height .4s var(--ease); }
.site-head.is-scrolled .head-inner { min-height: calc(var(--header-h) - 10px); }
.brand-logo { transition: height .4s var(--ease), filter .3s var(--ease); }
.site-head.is-scrolled .brand-logo { height: 42px; }
.brand:hover .brand-logo { filter: brightness(1.06); }

/* ---------- nav link: the pill grows, the label lifts, the underline slides ---------- */
.nav-link {
    isolation: isolate;
    transition: color .22s var(--ease), transform .28s var(--ease);
}
.nav-link::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: var(--surface-2);
    opacity: 0;
    transform: scale(.85);
    transition: opacity .28s var(--ease), transform .28s var(--ease);
}
.nav-link:hover { background: transparent; transform: translateY(-1px); }
.nav-link:hover::before { opacity: 1; transform: scale(1); }
.nav-link.is-active { background: transparent; }
.nav-link.is-active::before { opacity: 1; transform: scale(1); background: var(--brand-soft); }
.nav-link::after { transition: transform .32s cubic-bezier(.2, .8, .2, 1); }
.nav-link:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 3px; }

/* the globe does a slow half-turn */
.nav-lang .icon { transition: transform .55s var(--ease); }
.nav-lang:hover .icon { transform: rotate(180deg); }

/* ---------- icon buttons ---------- */
.icon-btn {
    transition: transform .25s var(--ease), color .2s var(--ease),
                border-color .2s var(--ease), box-shadow .25s var(--ease),
                background-color .2s var(--ease);
}
.icon-btn:hover { transform: translateY(-2px) scale(1.04); }
.icon-btn:active { transform: translateY(0) scale(.95); }
.theme-btn .theme-icon .icon { transition: transform .5s var(--ease); }
.theme-btn:hover .theme-icon .icon { transform: rotate(-20deg); }

/* ---------- mobile drawer: links cascade in ---------- */
@keyframes nav-item-in {
    from { opacity: 0; transform: translateX(14px); }
    to   { opacity: 1; transform: none; }
}
@keyframes nav-item-in-rtl {
    from { opacity: 0; transform: translateX(-14px); }
    to   { opacity: 1; transform: none; }
}
@media (max-width: 960px) {
    body.nav-open .site-nav .nav-link {
        animation: nav-item-in .38s var(--ease) both;
    }
    html[dir="rtl"] body.nav-open .site-nav .nav-link {
        animation-name: nav-item-in-rtl;
    }
    body.nav-open .site-nav .nav-link:nth-child(1) { animation-delay: .04s; }
    body.nav-open .site-nav .nav-link:nth-child(2) { animation-delay: .08s; }
    body.nav-open .site-nav .nav-link:nth-child(3) { animation-delay: .12s; }
    body.nav-open .site-nav .nav-link:nth-child(4) { animation-delay: .16s; }
    body.nav-open .site-nav .nav-link:nth-child(5) { animation-delay: .20s; }
    body.nav-open .site-nav .nav-link:nth-child(6) { animation-delay: .24s; }
    body.nav-open .site-nav .nav-link:nth-child(7) { animation-delay: .28s; }
}

/* ---------- buttons: lift, then a light sweep across the face ---------- */
.btn {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    transition: transform .28s var(--ease), box-shadow .28s var(--ease),
                background-color .25s var(--ease), color .2s var(--ease),
                border-color .25s var(--ease);
}
.btn::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;                                  /* above the fill, below the label */
    background: linear-gradient(115deg, transparent 22%, rgba(255, 255, 255, .5) 46%, transparent 70%);
    transform: translateX(-130%);
    transition: transform .75s var(--ease);
    pointer-events: none;
}
.btn:hover::after { transform: translateX(130%); }
.btn:active { transform: translateY(0) scale(.985); }
.btn:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 3px; }
.btn .icon { transition: transform .28s var(--ease); }
.btn:hover .icon { transform: translateX(3px); }
[dir="rtl"] .btn:hover .icon { transform: translateX(-3px); }

/* ---------- sort control ---------- */
.sort-field select { transition: border-color .22s var(--ease), box-shadow .22s var(--ease); }
.sort-field select:hover { border-color: var(--brand-2); }

/* ---------- footer and utility links: the underline wipes in ---------- */
.foot-col ul a,
.foot-mail,
.utility-links a {
    background-image: linear-gradient(currentColor, currentColor);
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 0% 1px;
    transition: background-size .32s var(--ease), color .2s var(--ease);
}
.foot-col ul a:hover,
.foot-mail:hover,
.utility-links a:hover { background-size: 100% 1px; }
[dir="rtl"] .foot-col ul a,
[dir="rtl"] .foot-mail,
[dir="rtl"] .utility-links a { background-position: 100% 100%; }




