/*
 * Public site theme — an RTL Persian take on Ghost's "Source" theme layout
 * (https://github.com/TryGhost/Source, MIT). Written from scratch.
 * Note: never use letter-spacing on Persian text; it breaks letter joining.
 */

/* ---------- Tokens ---------- */
:root {
  --color-bg: #ffffff;
  --color-surface: #f6f6f4;
  --color-text: #15171a;
  --color-secondary: #5c6670;
  --color-muted: #8a939b;
  --color-border: #e8e8e6;
  --color-accent: #2563eb;
  --color-accent-contrast: #ffffff;
  --color-accent-soft: #e6eefd;
  --color-success: #15803d;
  --color-danger: #c62828;

  --font: 'Vazirmatn', Tahoma, sans-serif;
  --container: 1200px;
  --content: 720px;
  --gutter: max(4vw, 16px);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px rgb(0 0 0 / .06);
  --header-h: 72px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #121416;
    --color-surface: #1b1e21;
    --color-text: #e8eaed;
    --color-secondary: #aab3bb;
    --color-muted: #7d868e;
    --color-border: #2a2e33;
    --color-accent: #60a5fa;
    --color-accent-contrast: #0b1220;
    --color-accent-soft: #15233f;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .3);
  }
}

:root[data-theme="dark"] {
  --color-bg: #121416;
  --color-surface: #1b1e21;
  --color-text: #e8eaed;
  --color-secondary: #aab3bb;
  --color-muted: #7d868e;
  --color-border: #2a2e33;
  --color-accent: #60a5fa;
  --color-accent-contrast: #0b1220;
  --color-accent-soft: #15233f;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .3);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  /* Keep the footer at the bottom of the viewport on short pages */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.85;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.45; margin: 0; font-weight: 800; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--color-muted); }
.center { text-align: center; }
.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: 56px; }
.site-main { flex: 1 0 auto; }
.site-header, .site-footer { flex-shrink: 0; }
.skip-link { position: absolute; inset-inline-start: 16px; top: -48px; background: var(--color-text); color: var(--color-bg); padding: 8px 16px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { top: 12px; }

/* ---------- Buttons, chips, icons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding-inline: 22px; border: 0; border-radius: 999px;
  background: var(--color-text); color: var(--color-bg); font-weight: 700; cursor: pointer;
  transition: opacity .2s;
}
.button:hover { opacity: .85; }
.button-ghost { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.icon-button {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: var(--color-text); cursor: pointer; transition: background .2s;
}
.icon-button:hover { background: var(--color-surface); }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button.copied { color: var(--color-success); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  background: var(--color-surface); color: var(--color-secondary); font-size: .875rem; font-weight: 600;
  transition: background .2s, color .2s;
}
.chip span { color: var(--color-muted); font-weight: 500; }
.chip:hover { background: var(--color-accent-soft); color: var(--color-accent); }
.kicker { display: inline-block; color: var(--color-accent); font-size: .8125rem; font-weight: 800; }
.eyebrow { display: inline-block; font-size: .8125rem; font-weight: 700; color: var(--color-muted); }
.link-button { background: none; border: 0; padding: 0; color: var(--color-accent); font-weight: 700; cursor: pointer; font-size: .875rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: color-mix(in srgb, var(--color-bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--color-border); }
.header-inner { display: flex; align-items: center; gap: 32px; height: 100%; }
.site-logo { font-size: 1.375rem; font-weight: 900; white-space: nowrap; }
.site-logo img { height: 36px; width: auto; }
.site-nav { flex: 1; }
.menu { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.menu a { display: block; padding: 6px 12px; border-radius: 999px; color: var(--color-secondary); font-weight: 600; font-size: .9375rem; transition: color .2s, background .2s; }
.menu a:hover, .menu .is-active > a { color: var(--color-text); background: var(--color-surface); }
.menu .has-children { position: relative; }
.submenu {
  position: absolute; inset-inline-start: 0; top: calc(100% + 8px); min-width: 200px; padding: 8px;
  list-style: none; margin: 0; background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: all .15s;
}
.has-children:hover > .submenu, .has-children:focus-within > .submenu { opacity: 1; visibility: visible; transform: none; }
.submenu a { border-radius: var(--radius-sm); }
.header-actions { display: flex; gap: 2px; margin-inline-start: auto; }
.menu-toggle { display: none; }
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* ---------- Home ---------- */
.home-hero { text-align: center; padding-block: 72px 48px; }
.home-title { font-size: clamp(1.875rem, 4.5vw, 3rem); font-weight: 900; line-height: 1.3; }
.home-tagline { margin: 12px auto 28px; max-width: 620px; font-size: 1.25rem; color: var(--color-secondary); }

.featured { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 40px; padding-bottom: 56px; border-bottom: 1px solid var(--color-border); }
.featured-main { display: grid; gap: 24px; }
.featured-media { position: relative; display: block; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; background: var(--color-surface); }
.featured-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.featured-main:hover .featured-media img { transform: scale(1.03); }
.featured-body { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.featured-body .eyebrow { background: var(--color-accent); color: var(--color-accent-contrast); padding: 2px 10px; border-radius: 999px; }
.featured-title { font-size: clamp(1.375rem, 2.6vw, 2rem); line-height: 1.4; }
.featured-title a:hover { color: var(--color-accent); }
.featured-excerpt { font-size: 1.125rem; color: var(--color-secondary); }
.featured-side { display: flex; flex-direction: column; gap: 24px; }
.featured-side .post-card + .post-card { padding-top: 24px; border-top: 1px solid var(--color-border); }

.section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.section-header h2, .section-title { font-size: 1.375rem; }
.section-title { margin: 32px 0 20px; }
.section-link { color: var(--color-secondary); font-weight: 600; }
.section-link:hover { color: var(--color-accent); }
.video-band { background: var(--color-surface); }

/* ---------- Post cards ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px 32px; }
.post-card { display: flex; flex-direction: column; gap: 16px; }
.post-card-media { position: relative; display: block; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 10; background: var(--color-surface); }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.post-card:hover .post-card-media img { transform: scale(1.04); }
.post-card-body { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.post-card-title { font-size: 1.25rem; line-height: 1.55; }
.post-card-title a { background: linear-gradient(currentColor, currentColor) no-repeat 100% 100% / 0 1px; transition: background-size .3s; }
.post-card:hover .post-card-title a { background-size: 100% 1px; }
.post-card-excerpt { color: var(--color-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-meta { font-size: .8125rem; color: var(--color-muted); }
.post-card-small { flex-direction: row; gap: 16px; }
.post-card-small .post-card-media { flex: 0 0 112px; aspect-ratio: 1; border-radius: var(--radius-sm); }
.post-card-small .post-card-title { font-size: 1rem; }
.play-badge {
  position: absolute; inset: 0; margin: auto; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; background: rgb(0 0 0 / .55); backdrop-filter: blur(4px);
}
.play-badge svg { width: 22px; height: 22px; fill: #fff; transform: translateX(1px); }
.play-badge-lg { width: 76px; height: 76px; }
.play-badge-lg svg { width: 30px; height: 30px; }
.post-card-small .play-badge { width: 34px; height: 34px; }
.post-card-small .play-badge svg { width: 14px; height: 14px; }

/* Byline */
.byline { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.byline-text { display: flex; flex-direction: column; line-height: 1.5; }
.byline-name { font-size: .875rem; font-weight: 700; }
.byline-name:hover { color: var(--color-accent); }
.byline-meta { font-size: .8125rem; color: var(--color-muted); }
.dot { margin-inline: 6px; }
.avatar {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  background: var(--color-accent-soft); color: var(--color-accent); font-weight: 800;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 40px; height: 40px; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.5rem; }
.avatar-xl { width: 112px; height: 112px; font-size: 2.5rem; margin: 0 auto 16px; }

/* ---------- Archive ---------- */
.archive-header { text-align: center; padding-block: 64px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.archive-title { font-size: clamp(1.75rem, 3.8vw, 2.75rem); font-weight: 900; }
.archive-description { max-width: 620px; font-size: 1.125rem; color: var(--color-secondary); }
.search-inline { width: 100%; max-width: 520px; display: flex; gap: 8px; margin-top: 8px; }
.search-inline input {
  flex: 1; height: 48px; padding-inline: 20px; border: 1px solid var(--color-border); border-radius: 999px;
  background: var(--color-surface); transition: border-color .2s, background .2s;
}
.search-inline input:focus { outline: none; border-color: var(--color-accent); background: var(--color-bg); }
.search-large input { height: 56px; font-size: 1.125rem; }
.search-large .button { height: 56px; }
.link-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 8px; }
.link-list a { font-weight: 700; }
.link-list a:hover { color: var(--color-accent); }
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 64px; }
.pagination-info { color: var(--color-muted); font-size: .875rem; }

/* ---------- Article ---------- */
.reading-progress { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 60; pointer-events: none; }
.reading-progress span { display: block; height: 100%; width: 0; background: var(--color-accent); margin-inline-start: 0; transition: width .1s linear; }

/* Content grid: main column with optional wide / full-bleed rows (like Ghost's kg-width-*) */
.gh-canvas {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), auto)
    [wide-start] minmax(auto, 200px)
    [main-start] min(var(--content), calc(100% - var(--gutter) * 2))
    [main-end] minmax(auto, 200px)
    [wide-end] minmax(var(--gutter), auto)
    [full-end];
}
.gh-canvas > * { grid-column: main; }
.gh-canvas > .wide, .gh-canvas > figure.wide, .article-media > .wide { grid-column: wide; }
.gh-canvas > .full, .gh-canvas > figure.full { grid-column: full; }

.article-header { padding-block: 56px 32px; text-align: center; }
.article-header > * { justify-self: center; }
.article-title { font-size: clamp(1.75rem, 4.2vw, 2.75rem); line-height: 1.35; font-weight: 900; margin-top: 12px; }
.article-excerpt { margin-top: 16px; font-size: clamp(1.125rem, 2vw, 1.375rem); color: var(--color-secondary); line-height: 1.8; }
.article-byline { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--color-border); width: 100%; text-align: start; }
.share { display: flex; gap: 2px; }
.article-actions { display: flex; align-items: center; gap: 8px; }
.edit-link {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding-inline: 12px;
  margin-inline-start: 4px; border: 1px solid var(--color-border); border-radius: 999px;
  color: var(--color-secondary); font-size: .8125rem; font-weight: 600; transition: color .2s, border-color .2s;
}
.edit-link:hover { color: var(--color-accent); border-color: var(--color-accent); }
.edit-link svg { flex: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.draft-note { background: var(--color-accent-soft); color: var(--color-accent); padding: 6px 16px; border-radius: 999px; font-weight: 700; font-size: .875rem; margin-bottom: 16px; }
.breadcrumbs { display: flex; gap: 8px; color: var(--color-muted); font-size: .875rem; }
.breadcrumbs a:hover { color: var(--color-accent); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; list-style: none; margin: 0 0 16px; padding: 0; }
.breadcrumbs li + li::before { content: '/'; margin-inline-end: 8px; opacity: .6; }
.breadcrumbs [aria-current] { color: var(--color-secondary); }
.article-updated { margin-top: 12px; font-size: .875rem; }

.article-media { margin: 0 0 48px; }
.article-media img, .article-media video { width: 100%; border-radius: var(--radius); background: #000; }
.article-media img { height: auto; }
.article-media figcaption, .gh-content figcaption { grid-column: main; margin-top: 12px; text-align: center; font-size: .875rem; color: var(--color-muted); }

/* Table of contents */
.toc { margin-bottom: 32px; }
.toc details { border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 14px 20px; }
.toc summary { cursor: pointer; font-weight: 800; }
.toc ol { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: .9375rem; }
.toc a { color: var(--color-secondary); }
.toc a:hover { color: var(--color-accent); }
.toc-l2 { padding-inline-start: 1.25em; }
.toc-l3 { padding-inline-start: 2.5em; }

/* Article body typography */
.gh-content { font-size: 1.1875rem; line-height: 2.05; }
.gh-content > * + * { margin-top: 1.6em; }
.gh-content > :is(h2, h3, h4) + * { margin-top: .7em; }
.gh-content h2 { font-size: 1.5rem; margin-top: 2.2em; }
.gh-content h3 { font-size: 1.25rem; margin-top: 1.8em; }
.gh-content a { color: var(--color-accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.gh-content strong { font-weight: 800; }
.gh-content mark { background: var(--color-accent-soft); color: inherit; padding: 0 4px; border-radius: 4px; }
.gh-content ul, .gh-content ol { padding-inline-start: 1.4em; }
.gh-content li + li { margin-top: .5em; }
.gh-content li::marker { color: var(--color-accent); }
.gh-content blockquote {
  margin-inline: 0; padding-inline-start: 24px; border-inline-start: 4px solid var(--color-accent);
  font-size: 1.25rem; font-weight: 600; color: var(--color-text);
}
.gh-content blockquote cite { display: block; margin-top: 8px; font-size: .9375rem; font-style: normal; font-weight: 500; color: var(--color-muted); }
.gh-content blockquote.pull { border: 0; padding: 0; text-align: center; font-size: 1.625rem; font-weight: 800; line-height: 1.7; }
.gh-content hr { border: 0; height: auto; text-align: center; overflow: visible; }
.gh-content hr::before { content: '* * *'; color: var(--color-muted); font-size: 1.25rem; }
.gh-content figure { margin: 2.4em 0 0; }
.gh-content figure + * { margin-top: 2.4em; }
.gh-content figure img, .gh-content figure video, .gh-content > video, .gh-content > img { width: 100%; border-radius: var(--radius-sm); }
.gh-content figure.full img, .gh-content figure.full video { border-radius: 0; }
.gh-content figure.full figcaption { padding-inline: var(--gutter); }
.gh-content figure.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gh-content figure.gallery figcaption { grid-column: 1 / -1; }
.gh-content figure.gallery img { aspect-ratio: 4 / 3; object-fit: cover; height: 100%; }
.gh-content pre {
  direction: ltr; text-align: left; overflow-x: auto; padding: 20px 24px; border-radius: var(--radius-sm);
  background: #15171a; color: #e8eaed; font-size: .9375rem; line-height: 1.7;
}
.gh-content code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; direction: ltr; unicode-bidi: isolate; }
.gh-content :not(pre) > code { background: var(--color-surface); padding: 2px 6px; border-radius: 4px; }
.gh-content table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.gh-content th, .gh-content td { padding: 10px 12px; border-bottom: 1px solid var(--color-border); text-align: start; }
.gh-content th { font-weight: 800; }
.gh-content .callout { display: flex; gap: 12px; padding: 20px 24px; border-radius: var(--radius-sm); background: var(--color-surface); font-size: 1.0625rem; }

.article-footer { padding-block: 56px 24px; }
.article-footer > * + * { margin-top: 32px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 16px; border-block: 1px solid var(--color-border); font-weight: 600; color: var(--color-secondary); }
.author-card { display: flex; gap: 20px; align-items: flex-start; padding: 28px; border-radius: var(--radius); background: var(--color-surface); }
.author-card-name { display: block; font-size: 1.25rem; font-weight: 800; margin-bottom: 4px; }
.author-card p { color: var(--color-secondary); }
.related { background: var(--color-surface); margin-top: 48px; }
.album-link { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); transition: border-color .2s; }
.album-link:hover { border-color: var(--color-accent); }
.album-link svg { flex: none; width: 24px; height: 24px; fill: none; stroke: var(--color-accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Comments ---------- */
.comments { padding-block: 56px 80px; }
.comments > h2 { font-size: 1.5rem; margin-bottom: 24px; }
.comments > h3 { font-size: 1.25rem; margin: 40px 0 16px; }
.comment { display: flex; gap: 14px; padding-block: 18px; border-bottom: 1px solid var(--color-border); }
.comment-body { flex: 1; }
.comment-meta { display: flex; gap: 10px; align-items: baseline; font-size: .9375rem; }
.comment-meta .muted { font-size: .8125rem; }
.comment-body p { margin: 4px 0 6px; color: var(--color-secondary); }
.comment-reply { border-bottom: 0; padding-bottom: 0; margin-top: 8px; padding-inline-start: 16px; border-inline-start: 2px solid var(--color-border); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
.field label { font-weight: 700; font-size: .875rem; }
.form input:not([type=hidden]), .form textarea, .form select {
  width: 100%; padding: 12px 16px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-bg); transition: border-color .2s, box-shadow .2s;
}
.form input:focus, .form textarea:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
.form .button { align-self: flex-start; }
.errorlist { list-style: none; margin: 0; padding: 0; color: var(--color-danger); font-size: .875rem; }
.card-surface { padding: 32px; border-radius: var(--radius); background: var(--color-surface); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.contact-info p { display: flex; flex-direction: column; margin-bottom: 20px; }
.contact-info strong { font-size: .875rem; color: var(--color-muted); }
.messages { padding-top: 16px; }
.alert { padding: 14px 20px; border-radius: var(--radius-sm); background: var(--color-surface); border-inline-start: 4px solid var(--color-accent); }
.alert-success { border-inline-start-color: var(--color-success); }
.alert-error { border-inline-start-color: var(--color-danger); }

/* ---------- Landing / error ---------- */
.landing-hero { padding-block: 120px; text-align: center; color: #fff; background: linear-gradient(rgb(0 0 0 / .45), rgb(0 0 0 / .45)), var(--hero-image, linear-gradient(135deg, #2563eb, #1e3a8a)) center / cover; }
.landing-hero .home-tagline { color: rgb(255 255 255 / .85); }
.page-landing .gh-content { font-size: 1.125rem; padding-block: 48px 56px; }
.error-page { text-align: center; padding-block: 120px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.error-code { font-size: clamp(5rem, 15vw, 9rem); font-weight: 900; line-height: 1; color: var(--color-accent); }

/* ---------- Footer ---------- */
.site-footer { margin-top: 0; padding-top: 64px; background: var(--color-surface); color: var(--color-secondary); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 48px; padding-bottom: 40px; }
.footer-about p { margin: 12px 0 20px; max-width: 420px; }
.footer-about .site-logo { color: var(--color-text); }
.social { display: flex; flex-wrap: wrap; gap: 16px; font-weight: 600; }
.social a:hover, .footer-nav a:hover { color: var(--color-accent); }
.footer-nav .menu { flex-direction: column; gap: 0; }
.footer-nav .menu a { padding-inline: 0; background: none; }
.footer-bottom { padding-block: 24px; border-top: 1px solid var(--color-border); font-size: .875rem; }

/* ---------- Home sections ---------- */
.home-section.bg-surface { background: var(--color-surface); }
.home-section.bg-accent { background: var(--color-accent); --color-text: #fff; --color-secondary: rgb(255 255 255 / .85); --color-muted: rgb(255 255 255 / .7); --color-border: rgb(255 255 255 / .25); --color-surface: rgb(255 255 255 / .12); --color-accent: #fff; --color-accent-soft: rgb(255 255 255 / .15); color: var(--color-text); }
.home-section.bg-dark { background: #0d0f11; --color-text: #e8eaed; --color-secondary: #aab3bb; --color-muted: #7d868e; --color-border: #2a2e33; --color-surface: #1b1e21; color: var(--color-text); }
.home-section + .home-section.bg-default > .container.section { border-top: 1px solid var(--color-border); }
.home-section.bg-default + .home-section.bg-default > .section { padding-top: 56px; }
.section-header-center { justify-content: center; text-align: center; }
.section-subtitle { color: var(--color-secondary); margin-top: 6px; }
.post-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.post-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 24px; }
.post-grid.cols-4 .post-card-title { font-size: 1.0625rem; }
.post-grid.hide-excerpt .post-card-excerpt { display: none; }
.home-section-featured .featured { padding-bottom: 0; border-bottom: 0; }
.button-light { background: #fff; color: #15171a; }

/* Slider */
.home-section-slider { padding-top: 24px; }
.slider { position: relative; border-radius: var(--radius); overflow: hidden; background: #15171a; color: #fff; touch-action: pan-y; }
.slider-track { display: grid; }
.slide { grid-area: 1 / 1; position: relative; min-height: clamp(320px, 48vw, 540px); display: flex; align-items: flex-end; opacity: 0; visibility: hidden; transition: opacity .7s ease, visibility .7s; }
.slide.is-active { opacity: 1; visibility: visible; }
.slide-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); transition: transform 7s ease; }
.slide.is-active .slide-image { transform: scale(1); }
.slide::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgb(0 0 0 / .72), rgb(0 0 0 / .1) 60%, transparent); }
.slide-content { position: relative; z-index: 1; padding: clamp(24px, 5vw, 56px); padding-bottom: clamp(72px, 8vw, 96px); max-width: 720px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.slide-title { font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.35; }
.slide-text { font-size: clamp(1rem, 1.6vw, 1.1875rem); color: rgb(255 255 255 / .88); }
.slider-controls { position: absolute; z-index: 2; inset-inline: clamp(24px, 5vw, 56px); bottom: 24px; display: flex; align-items: center; gap: 12px; }
.slider-dots { display: flex; gap: 8px; }
.slider-dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: rgb(255 255 255 / .45); cursor: pointer; transition: width .3s, background .3s; }
.slider-dot.is-active { width: 28px; background: #fff; }
.slider-arrow { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgb(255 255 255 / .35); background: rgb(0 0 0 / .2); color: #fff; cursor: pointer; backdrop-filter: blur(6px); }
.slider-arrow:hover { background: rgb(255 255 255 / .2); }
.slider-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Hero */
.hero { text-align: center; padding-block: clamp(56px, 9vw, 112px); }
.hero-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.hero .home-tagline { margin: 0; }
.hero-body { max-width: 620px; color: var(--color-secondary); }
.hero-with-image { color: #fff; background: linear-gradient(rgb(0 0 0 / .5), rgb(0 0 0 / .5)), var(--hero-image) center / cover; }
.hero-with-image .home-tagline, .hero-with-image .hero-body { color: rgb(255 255 255 / .85); }

/* Ranked list */
.ranked-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px 40px; counter-reset: rank; }
.ranked-item { display: flex; gap: 16px; align-items: flex-start; padding-bottom: 20px; border-bottom: 1px solid var(--color-border); }
.ranked-number { flex: none; font-size: 2.5rem; font-weight: 900; line-height: 1; color: var(--color-accent); opacity: .35; min-width: 40px; }
.ranked-title { font-size: 1.0625rem; line-height: 1.6; margin: 2px 0 4px; }
.ranked-title a:hover { color: var(--color-accent); }

/* Stats */
.stats { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.stats.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 16px; text-align: center; border-radius: var(--radius); background: var(--color-surface); }
.stat-icon { font-size: 1.75rem; line-height: 1; margin-bottom: 8px; }
.stat-value { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 900; line-height: 1.2; color: var(--color-accent); font-variant-numeric: tabular-nums; }
.stat-suffix { font-size: .55em; margin-inline-start: 4px; }
.stat-label { color: var(--color-secondary); font-weight: 600; }
.bg-surface .stat { background: var(--color-bg); }

/* Feature cards */
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.features.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.features.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.feature-card { padding: 28px; border-radius: var(--radius); border: 1px solid var(--color-border); background: var(--color-bg); transition: transform .2s, box-shadow .2s; }
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--color-accent-soft); font-size: 1.5rem; margin-bottom: 16px; }
.feature-card h3 { font-size: 1.125rem; margin-bottom: 6px; }
.feature-card p { color: var(--color-secondary); }
.bg-dark .feature-card, .bg-accent .feature-card { background: var(--color-surface); }

/* Logo strip: a centered row by default; .is-moving (set by home.js) loops it */
.logo-strip { --logo-height: 48px; --logo-width: 140px; --logo-space: 28px; --logo-filter: grayscale(1); --logo-opacity: .65; overflow: hidden; }
.logo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; }
.logo-list + .logo-list { display: none; }
.logo-item { padding: 12px var(--logo-space); }
.logo-item a { display: block; }
.logo-item img { display: block; height: var(--logo-height); width: auto; max-width: var(--logo-width); object-fit: contain; filter: var(--logo-filter); opacity: var(--logo-opacity); transition: filter .3s, opacity .3s; }
.logo-item a:hover img, .logo-item a:focus-visible img { filter: none; opacity: 1; }
.logo-name { display: grid; place-items: center; height: var(--logo-height); font-weight: 800; font-size: 1.125rem; color: var(--color-muted); white-space: nowrap; }
/* Grayscale makes dark logos disappear on dark backgrounds, so show them in color there */
:root[data-theme="dark"] .logo-strip, .bg-dark .logo-strip, .bg-accent .logo-strip { --logo-filter: none; --logo-opacity: .85; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-strip { --logo-filter: none; --logo-opacity: .85; } }
.logo-strip.is-moving { mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent); }
.logo-strip.is-moving .logo-track { display: flex; width: max-content; animation: logo-loop calc(var(--logo-count) * var(--logo-seconds) * 1s) linear infinite; }
.logo-strip.is-moving .logo-list { display: flex; flex-wrap: nowrap; }
.logo-strip.is-moving:hover .logo-track, .logo-strip.is-moving:focus-within .logo-track { animation-play-state: paused; }
@keyframes logo-loop { to { transform: translateX(50%); } }
[dir="ltr"] .logo-strip.is-moving .logo-track { animation-name: logo-loop-ltr; }
@keyframes logo-loop-ltr { to { transform: translateX(-50%); } }

/* Topics */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.topic-card { display: flex; flex-direction: column; gap: 6px; padding: 24px; min-height: 160px; border-radius: var(--radius); background: var(--color-surface); transition: background .2s, color .2s; }
.topic-card:hover { background: var(--color-accent); color: #fff; }
.topic-card:hover .topic-desc, .topic-card:hover .topic-count { color: rgb(255 255 255 / .85); }
.topic-name { font-size: 1.375rem; font-weight: 900; }
.topic-desc { color: var(--color-secondary); font-size: .9375rem; flex: 1; }
.topic-count { color: var(--color-accent); font-weight: 700; font-size: .875rem; }

/* Authors */
.author-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; }
.author-tile { flex: 0 1 260px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 20px; border-radius: var(--radius); border: 1px solid var(--color-border); transition: border-color .2s; }
.author-tile:hover { border-color: var(--color-accent); }
.author-tile strong { font-size: 1.125rem; }
.author-tile-bio { color: var(--color-secondary); font-size: .9375rem; }

/* CTA */
.cta { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: clamp(32px, 5vw, 56px); border-radius: var(--radius); background: linear-gradient(135deg, #2563eb, #1e3a8a); color: #fff; }
.cta-with-image { background: linear-gradient(90deg, rgb(0 0 0 / .65), rgb(0 0 0 / .25)), var(--cta-image) center / cover; }
.cta h2 { font-size: clamp(1.375rem, 2.6vw, 1.875rem); }
.cta-subtitle, .cta-body { color: rgb(255 255 255 / .88); margin-top: 8px; max-width: 560px; }
.cta .button { flex: none; }

.text-section-title { font-size: 1.5rem; margin-bottom: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats, .stats.cols-3, .features.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .featured { grid-template-columns: 1fr; }
  .featured-side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
  .featured-side .post-card + .post-card { padding-top: 0; border-top: 0; }
  .featured-side .post-card-small { flex-direction: column; }
  .featured-side .post-card-small .post-card-media { flex: none; aspect-ratio: 16 / 10; }
}

@media (max-width: 767px) {
  :root { --header-h: 60px; }
  .menu-toggle { display: inline-grid; margin-inline-start: -8px; }
  .header-inner { gap: 8px; }
  .site-nav {
    position: fixed; inset: var(--header-h) 0 auto 0; padding: 16px var(--gutter) 24px;
    background: var(--color-bg); border-bottom: 1px solid var(--color-border); box-shadow: var(--shadow);
    display: none;
  }
  .nav-open .site-nav { display: block; }
  .site-nav .menu { flex-direction: column; }
  .site-nav .menu a { padding: 10px 12px; font-size: 1.0625rem; }
  .submenu { position: static; opacity: 1; visibility: visible; transform: none; border: 0; box-shadow: none; padding: 0 16px 0 0; min-width: 0; }
  .section { padding-block: 40px; }
  .home-hero { padding-block: 48px 32px; }
  .post-grid { grid-template-columns: 1fr; gap: 40px; }
  .post-grid.cols-2, .post-grid.cols-4, .features, .features.cols-2, .features.cols-4 { grid-template-columns: 1fr; }
  .stats, .stats.cols-2, .stats.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cta { flex-direction: column; align-items: flex-start; }
  .slider { border-radius: var(--radius-sm); }
  .slider-arrow { display: none; }
  .featured-side { grid-template-columns: 1fr; }
  .featured-side .post-card-small { flex-direction: row; }
  .featured-side .post-card-small .post-card-media { flex: 0 0 96px; aspect-ratio: 1; }
  .gh-content { font-size: 1.0625rem; line-height: 2; }
  .gh-canvas > .wide, .gh-canvas > figure.wide, .article-media > .wide { grid-column: full; }
  .article-media img, .article-media video, .gh-content figure.wide img, .gh-content figure.wide video { border-radius: 0; }
  .article-media figcaption, .gh-content figure.wide figcaption { padding-inline: var(--gutter); }
  .gh-content figure.gallery.wide { padding-inline: var(--gutter); }
  .article-header { padding-top: 32px; }
  .form-row, .contact-grid, .footer-grid { grid-template-columns: 1fr; }
  .gh-content figure.gallery { grid-template-columns: 1fr; }
  .author-card { flex-direction: column; }
  .share-row { flex-direction: column; align-items: flex-start; }
}

/*
 * django-debug-toolbar (dev only) has a 1px screen-reader element positioned
 * absolutely; in an RTL page it lands outside the viewport on the left and
 * makes the whole page scroll horizontally. Clip it at the toolbar's host
 * element; the toolbar's own fixed-position panels are not affected.
 */
#djDebugRoot {
  position: relative;
  overflow: hidden;
}
