/* ============================================================
   Rapid Vibe — global stylesheet
   Zero-dependency, SEO-friendly, dark-mode capable design system
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg: #faf7f1;
  --bg-soft: #f2ecdf;
  --surface: #ffffff;
  --ink: #1c1917;
  --muted: #6f675c;
  --line: #e8e0d1;
  --accent: #e8590c;
  --accent-strong: #c94c07;
  --accent-soft: #fdeadd;
  --on-accent: #ffffff;
  --ring: rgba(232, 89, 12, 0.35);
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.06), 0 1px 3px rgba(28, 25, 23, 0.08);
  --shadow-md: 0 6px 16px -4px rgba(28, 25, 23, 0.12), 0 3px 8px -4px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 24px 48px -12px rgba(28, 25, 23, 0.22);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --font-display: "Fraunces", "Georgia", "Times New Roman", serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --maxw: 1140px;
  --maxw-narrow: 720px;
  --header-h: 68px;
  --grad-accent: linear-gradient(135deg, #f59e0b, #e8590c 55%, #c94c07);
}

[data-theme="dark"] {
  --bg: #121110;
  --bg-soft: #1a1815;
  --surface: #201d19;
  --ink: #f0ece3;
  --muted: #a79c8c;
  --line: #332e27;
  --accent: #ff8a3d;
  --accent-strong: #ffa35f;
  --accent-soft: #2c1e12;
  --on-accent: #1c1107;
  --ring: rgba(255, 138, 61, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px -6px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s ease, color 0.35s ease;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color 0.18s ease; }
a:hover { color: var(--accent-strong); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.18; margin: 0 0 0.5em; font-weight: 640; letter-spacing: -0.01em; }
p { margin: 0 0 1.1em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip-link {
  position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent);
  padding: 8px 16px; border-radius: 8px; z-index: 200; font-weight: 600;
}
.skip-link:focus { left: 8px; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.container-narrow { max-width: var(--maxw-narrow); margin: 0 auto; padding: 0 22px; }

/* ---------- Announcement bar ---------- */
.announce {
  background: var(--grad-accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  padding: 8px 16px;
  letter-spacing: 0.01em;
}
.announce a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.announce a:hover { opacity: 0.85; color: #fff; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, background 0.35s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--font-display); font-size: 21px; font-weight: 700; }
.brand:hover { color: var(--ink); }
.brand img { width: 30px; height: 30px; border-radius: 9px; }
.brand .accent { color: var(--accent); }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--ink); font-weight: 560; font-size: 15px;
  padding: 8px 13px; border-radius: 999px; position: relative;
}
.nav a:hover { background: var(--bg-soft); color: var(--accent); }
.nav a.active { color: var(--accent); }
.nav a.active::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 2px; width: 18px; height: 3px; border-radius: 3px; background: var(--accent);
}

.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer;
  display: grid; place-items: center; transition: transform 0.18s ease, border-color 0.2s, background 0.2s;
}
.icon-btn:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 19px; height: 19px; }

.nav-toggle { display: none; }

/* Mobile nav drawer */
.mobile-nav {
  position: fixed; inset: var(--header-h) 0 auto 0; z-index: 99;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 12px 22px 22px; display: none; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-lg); animation: slideDown 0.22s ease;
}
.mobile-nav.open { display: flex; }
.mobile-nav a { padding: 12px 14px; border-radius: 12px; color: var(--ink); font-weight: 600; }
.mobile-nav a:hover { background: var(--bg-soft); color: var(--accent); }
.mobile-nav .btn { margin-top: 10px; justify-content: center; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 620; font-size: 15px; cursor: pointer; line-height: 1;
  transition: transform 0.18s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s;
  background: var(--surface); color: var(--ink); border-color: var(--line); text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--ink); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--grad-accent); color: #fff; border-color: transparent; box-shadow: 0 4px 14px -4px rgba(232, 89, 12, 0.5); }
.btn-primary:hover { color: #fff; box-shadow: 0 8px 22px -6px rgba(232, 89, 12, 0.55); }
.btn-sm { padding: 9px 16px; font-size: 13.5px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 72px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 300px at 85% 0%, var(--accent-soft), transparent 65%),
    radial-gradient(500px 260px at 0% 100%, var(--accent-soft), transparent 60%);
  opacity: 0.7;
}
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 48px; align-items: center; position: relative; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--accent); font-size: 12.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  padding: 7px 14px; border-radius: 999px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.hero h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); margin-bottom: 0.35em; }
.hero h1 .mark {
  background: var(--grad-accent); -webkit-background-clip: text; background-clip: text;
  color: transparent; font-style: italic;
}
.hero-sub { font-size: 1.14rem; color: var(--muted); max-width: 34em; margin-bottom: 30px; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 34px; }
.hero-stats { display: flex; gap: 34px; flex-wrap: wrap; }
.hero-stats .stat b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--ink); }
.hero-stats .stat span { font-size: 13px; color: var(--muted); }

.hero-art { position: relative; display: grid; place-items: center; }
.hero-art svg { width: 100%; height: auto; }

/* floating chips on hero art */
.float-chip {
  position: absolute; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 13px; font-size: 12.5px; font-weight: 600;
  box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}
.float-chip:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.float-chip svg { width: 16px; height: 16px; color: var(--accent); }
.chip-1 { top: 8%; left: -4%; }
.chip-2 { bottom: 14%; right: -2%; }

/* ---------- Sections ---------- */
.section { padding: 60px 0; }
.section-soft { background: var(--bg-soft); }
.section-head { max-width: 640px; margin-bottom: 38px; }
.section-head h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin-bottom: 0.3em; }
.section-head p { color: var(--muted); }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }

/* ---------- Post cards ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.post-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.25s ease, border-color 0.25s;
}
.post-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.post-card .thumb { aspect-ratio: 16/9; overflow: hidden; }
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
.post-card:hover .thumb img { transform: scale(1.05); }
.post-card .body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.post-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.post-meta .sep { opacity: 0.5; }
.post-card h3 { font-size: 1.22rem; margin-bottom: 0.5em; }
.post-card h3 a { color: var(--ink); }
.post-card h3 a:hover { color: var(--accent); }
.post-card .excerpt { color: var(--muted); font-size: 0.95rem; flex: 1; }
.post-card .card-langs { margin-top: 12px; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.post-card .card-langs a { font-weight: 700; font-size: 11px; letter-spacing: 0.5px; color: var(--accent); border: 1px solid var(--accent-soft); border-radius: 6px; padding: 2px 6px; transition: background 0.2s ease, color 0.2s ease; }
.post-card .card-langs a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.post-card .card-link { margin-top: 16px; font-weight: 650; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.post-card .card-link svg { width: 15px; height: 15px; transition: transform 0.2s ease; }
.post-card:hover .card-link svg { transform: translateX(4px); }

/* Featured card */
.featured { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); margin-bottom: 30px; }
.featured:hover { box-shadow: var(--shadow-md); }
.featured .thumb { aspect-ratio: auto; min-height: 100%; }
.featured .thumb img { height: 100%; }
.featured .body { padding: 40px 38px; display: flex; flex-direction: column; justify-content: center; }
.featured .flag { align-self: flex-start; margin-bottom: 16px; }
.featured h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin-bottom: 0.45em; }
.featured h2 a { color: var(--ink); }
.featured h2 a:hover { color: var(--accent); }
.featured .excerpt { color: var(--muted); }

/* ---------- Chips / tags ---------- */
.chip {
  display: inline-block; background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px; font-weight: 620;
  padding: 6px 13px; border-radius: 999px; transition: all 0.2s ease;
}
a.chip:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.flag {
  display: inline-block; background: var(--grad-accent); color: #fff;
  font-size: 11.5px; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px;
}
.topic-row { display: flex; flex-wrap: wrap; gap: 10px; }
[data-theme="dark"] .flag, [data-theme="dark"] .btn-primary { color: #fff; }

/* ---------- Newsletter ---------- */
.newsletter {
  background: var(--grad-accent); border-radius: var(--radius-lg); color: #fff;
  padding: 52px 48px; position: relative; overflow: hidden;
}
.newsletter::after {
  content: ""; position: absolute; right: -70px; top: -70px; width: 260px; height: 260px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.14);
}
.newsletter::before {
  content: ""; position: absolute; right: 60px; bottom: -100px; width: 200px; height: 200px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.1);
}
.newsletter .inner { position: relative; z-index: 1; max-width: 560px; }
.newsletter h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 0.35em; }
.newsletter p { opacity: 0.94; }
.newsletter form { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.newsletter input[type="email"] {
  flex: 1; min-width: 220px; padding: 14px 18px; border-radius: 999px; border: none;
  font-size: 15px; font-family: inherit; background: #fff; color: #1c1917;
}
.newsletter input[type="email"]:focus { outline: 3px solid rgba(255, 255, 255, 0.5); }
.newsletter .btn { background: #1c1917; color: #fff; border: none; }
.newsletter .btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3); }
.newsletter .fine { font-size: 12.5px; opacity: 0.85; margin-top: 14px; }
.form-note { font-size: 14px; margin-top: 12px; font-weight: 600; }
.form-note.ok { color: #052e16; }
[data-theme="dark"] .form-note.ok { color: #bbf7d0; }

/* ---------- Exit-intent newsletter modal ---------- */
.exit-overlay {
  position: fixed; inset: 0; z-index: 500; background: rgba(18, 16, 14, 0.6);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 22px;
  opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s ease;
}
.exit-overlay.open { opacity: 1; visibility: visible; }
.exit-modal {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; padding: 42px 38px; text-align: center;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.exit-overlay.open .exit-modal { transform: none; }
.exit-modal h2 { font-size: clamp(1.5rem, 4vw, 1.9rem); margin-bottom: 0.4em; }
.exit-modal p { color: var(--muted); }
.exit-modal form { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.exit-modal input[type="email"] {
  flex: 1; min-width: 200px; padding: 13px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink);
  font-size: 15px; font-family: inherit;
}
.exit-modal input[type="email"]:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.exit-modal .btn { background: var(--accent); color: #fff; border: none; }
.exit-modal .btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.exit-modal .fine { font-size: 12.5px; opacity: 0.8; margin-top: 14px; }
.exit-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
  border-radius: 50%; border: none; background: var(--bg-soft); color: var(--ink);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}
.exit-close:hover { background: var(--line); transform: rotate(90deg); }
[dir="rtl"] .exit-close { right: auto; left: 14px; }
@media (prefers-reduced-motion: reduce) {
  .exit-overlay, .exit-modal, .exit-overlay.open .exit-modal { transition: none; transform: none; }
}
@media (max-width: 560px) {
  .exit-modal { padding: 34px 22px; }
  .exit-modal form { flex-direction: column; }
  .exit-modal input[type="email"] { width: 100%; }
}

/* ---------- FAQ (FAQPage rich results) ---------- */
.faq-list { max-width: 780px; margin: 0 auto; }
.faq-list details {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 10px; overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.faq-list details:hover { border-color: var(--accent); }
.faq-list details[open] { border-color: var(--accent); }
.faq-list summary {
  cursor: pointer; list-style: none; padding: 16px 20px; font-weight: 600;
  font-size: 16px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+"; font-size: 22px; line-height: 1; color: var(--accent);
  transition: transform 0.2s ease; flex-shrink: 0;
}
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list details p { padding: 0 20px 18px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.faq-list details p a { color: var(--accent); font-weight: 600; }
.faq-list details p a:hover { text-decoration: underline; }

/* ---------- Topics hub ---------- */
.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.topic-tile {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px 24px; color: var(--ink);
  transition: transform 0.22s ease, box-shadow 0.25s ease, border-color 0.25s;
}
.topic-tile:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--ink); }
.topic-tile .tile-emoji { font-size: 1.7rem; margin-bottom: 6px; }
.topic-tile .tile-name { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.topic-tile .tile-count { font-size: 13px; color: var(--muted); }
.topic-tile .tile-go { margin-top: 12px; font-size: 13.5px; font-weight: 700; color: var(--accent); }
.topic-tile:hover .tile-go { text-decoration: underline; }
@media (max-width: 900px) { .topic-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .topic-grid { grid-template-columns: 1fr; } }

/* ---------- Start Here journey ---------- */
.steps { display: flex; flex-direction: column; gap: 18px; max-width: 780px; margin: 0 auto; }
.step-card {
  display: flex; gap: 20px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px; transition: transform 0.22s ease, box-shadow 0.25s ease, border-color 0.25s;
}
.step-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.step-num {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  background: var(--grad-accent); color: #fff; font-family: var(--font-display);
  font-size: 1.3rem; font-weight: 700; display: grid; place-items: center;
}
.step-card h2 { font-size: 1.3rem; margin-bottom: 0.2em; }
.step-card h2 .step-emoji { margin-right: 6px; }
.step-card p { color: var(--muted); font-size: 0.97rem; margin-bottom: 0.9em; }
.step-card .btn { margin-top: 2px; }
.start-hero { padding: 64px 0 40px; text-align: center; }
.start-hero h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); margin-bottom: 0.3em; }
.start-hero p { color: var(--muted); max-width: 40em; margin: 0 auto 8px; font-size: 1.08rem; }
.start-path { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; }
.start-path .chip { cursor: default; }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--line); padding: 56px 0 30px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: 34px; margin-bottom: 40px; }
.footer-grid h4 { font-family: var(--font-body); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.footer-grid a { display: block; color: var(--ink); font-size: 14.5px; padding: 4px 0; }
.footer-grid a:hover { color: var(--accent); }
.footer-grid p { color: var(--muted); font-size: 14.5px; }
.socials { display: flex; gap: 10px; margin-top: 16px; }
.socials a {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  transition: transform 0.18s ease, color 0.2s, border-color 0.2s;
}
.socials a:hover { transform: translateY(-3px); color: var(--accent); border-color: var(--accent); }
.socials svg { width: 17px; height: 17px; }
.footer-bottom { border-top: 1px solid var(--line); padding-top: 22px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }
.footer-bottom a { color: var(--muted); }
.footer-bottom a:hover { color: var(--accent); }

/* ---------- Post pages ---------- */
.reading-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--grad-accent); z-index: 300; transition: width 0.1s linear;
}
.post-header { padding: 52px 0 10px; text-align: center; }
.post-header .breadcrumbs { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.post-header .breadcrumbs a { color: var(--muted); }
.post-header .breadcrumbs a:hover { color: var(--accent); }
.post-header h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); max-width: 22em; margin: 0 auto 0.4em; }
.post-header .subtitle { color: var(--muted); font-size: 1.1rem; max-width: 36em; margin: 0 auto 22px; }
.post-meta-big { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.post-meta-big .avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--grad-accent);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.post-cover { margin: 34px auto 0; max-width: var(--maxw); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); }
.post-cover img { width: 100%; }

.post-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 44px; margin: 44px auto 0; }
.toc { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; font-size: 14px; }
.toc h4 { font-family: var(--font-body); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.toc ul { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.toc li { margin: 0; }
.toc a { display: block; padding: 6px 0 6px 16px; color: var(--muted); border-left: 2px solid transparent; margin-left: -2px; }
.toc a:hover { color: var(--accent); border-left-color: var(--accent); }

.post-body { font-size: 1.06rem; }
.post-body h2 { font-size: 1.65rem; margin: 1.9em 0 0.6em; scroll-margin-top: calc(var(--header-h) + 20px); }
.post-body h3 { font-size: 1.28rem; margin: 1.5em 0 0.5em; scroll-margin-top: calc(var(--header-h) + 20px); }
.post-body h2::before { content: "§"; color: var(--accent); font-weight: 400; margin-right: 8px; opacity: 0.8; }
.post-body p, .post-body li { color: color-mix(in srgb, var(--ink) 92%, var(--muted)); }
.post-body ul, .post-body ol { padding-left: 1.4em; margin-bottom: 1.3em; }
.post-body li { margin-bottom: 0.45em; }
.post-body a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.post-body blockquote {
  margin: 1.6em 0; padding: 18px 24px; border-left: 4px solid var(--accent);
  background: var(--bg-soft); border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic; color: var(--muted);
}
.post-body code {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 7px; font-size: 0.88em;
}
.post-body table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 0.95rem; }
.post-body th { background: var(--bg-soft); text-align: left; font-weight: 700; }
.post-body th, .post-body td { border: 1px solid var(--line); padding: 11px 14px; }
.post-body tr:hover td { background: var(--bg-soft); }
.post-body .checklist { list-style: none; padding-left: 0; }
.post-body .checklist li { padding-left: 34px; position: relative; margin-bottom: 0.7em; }
.post-body .checklist li::before {
  content: "✓"; position: absolute; left: 0; top: 1px;
  width: 23px; height: 23px; border-radius: 7px; background: var(--accent-soft);
  color: var(--accent); font-weight: 800; font-size: 13px; display: grid; place-items: center;
}
.post-body .callout {
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: var(--radius); padding: 18px 22px; margin: 1.6em 0;
}
.post-body .callout b { color: var(--accent); }

.share-row { display: flex; align-items: center; gap: 10px; margin: 44px 0 8px; padding-top: 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.share-row span { font-size: 14px; font-weight: 650; color: var(--muted); margin-right: 4px; }
.share-row .icon-btn { width: 42px; height: 42px; }

.author-box {
  display: flex; gap: 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 26px; margin-top: 30px; align-items: flex-start;
}
.author-box .avatar { width: 62px; height: 62px; border-radius: 50%; background: var(--grad-accent); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 800; flex-shrink: 0; }
.author-box h3 { margin-bottom: 0.15em; font-size: 1.15rem; }
.author-box p { color: var(--muted); font-size: 0.95rem; margin: 0; }
.author-box a { font-size: 13.5px; font-weight: 650; }

.related { margin-top: 56px; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 44px; }
.prevnext a {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; color: var(--ink); transition: all 0.2s ease; display: block;
}
.prevnext a:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-md); color: var(--ink); }
.prevnext .dir { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; display: block; margin-bottom: 4px; }
.prevnext b { font-size: 14.5px; }
.prevnext .next { text-align: right; }

/* ---------- Search overlay ---------- */
.search-overlay {
  position: fixed; inset: 0; z-index: 400; background: rgba(18, 16, 14, 0.55);
  backdrop-filter: blur(6px); display: none; align-items: flex-start; justify-content: center; padding: 12vh 22px 40px;
}
.search-overlay.open { display: flex; }
.search-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  width: 100%; max-width: 640px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop 0.22s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-14px) scale(0.98); } to { opacity: 1; transform: none; } }
.search-panel input {
  width: 100%; border: none; outline: none; background: transparent; color: var(--ink);
  font-family: inherit; font-size: 1.05rem; padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}
.search-panel input::placeholder { color: var(--muted); }
.search-results { max-height: 46vh; overflow-y: auto; padding: 8px; }
.search-result { display: block; padding: 13px 16px; border-radius: 12px; color: var(--ink); }
.search-result:hover { background: var(--bg-soft); color: var(--ink); }
.search-result b { font-family: var(--font-display); font-size: 1.02rem; display: block; margin-bottom: 2px; }
.search-result span { font-size: 13px; color: var(--muted); }
.search-result .search-langs { display: block; margin-top: 5px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; color: var(--accent); }
.search-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 14.5px; }

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: all 0.25s ease;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: none; }
.back-to-top:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-3px); }
.back-to-top svg { width: 20px; height: 20px; }

/* ---------- Reveal animations (only when JS is active) ---------- */
html.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
html.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html.js .reveal { opacity: 1; transform: none; }
}

/* ---------- Page header (inner pages) ---------- */
.page-header { padding: 56px 0 20px; text-align: center; }
.page-header h1 { font-size: clamp(2rem, 4.4vw, 3rem); }
.page-header p { color: var(--muted); max-width: 38em; margin: 0 auto; }
.prose { max-width: var(--maxw-narrow); margin: 0 auto; padding: 30px 22px 60px; }
.prose h2 { font-size: 1.5rem; margin-top: 1.6em; }

/* ---------- 404 ---------- */
.error-hero { text-align: center; padding: 90px 22px 100px; }
.error-hero .code { font-family: var(--font-display); font-size: clamp(5rem, 14vw, 8rem); background: var(--grad-accent); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; margin-bottom: 8px; }
.error-hero h1 { margin-bottom: 0.3em; }

/* ---------- Multilingual / RTL support ---------- */
.lang-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 700;
  color: var(--muted); letter-spacing: 0.03em;
}
.lang-badge svg { width: 13px; height: 13px; color: var(--accent); }
.lang-switch { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lang-switch a {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13.5px;
  transition: all 0.2s ease;
}
.lang-switch a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.lang-switch a.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* Arabic / RTL direction */
html[dir="rtl"] body { direction: rtl; font-family: "Noto Kufi Arabic", var(--font-body); }
html[dir="rtl"] .post-body h2::before { content: "§"; margin-right: 0; margin-left: 8px; }
html[dir="rtl"] .post-body .checklist li { padding-left: 0; padding-right: 34px; }
html[dir="rtl"] .post-body .checklist li::before { left: auto; right: 0; }
html[dir="rtl"] .post-body blockquote { border-left: none; border-right: 4px solid var(--accent); border-radius: var(--radius) 0 0 var(--radius); }
html[dir="rtl"] .toc ul { border-left: none; border-right: 2px solid var(--line); }
html[dir="rtl"] .toc a { padding: 6px 16px 6px 0; border-left: none; border-right: 2px solid transparent; margin-left: 0; margin-right: -2px; }
html[dir="rtl"] .toc a:hover { border-right-color: var(--accent); }
html[dir="rtl"] .btn svg,
html[dir="rtl"] .card-link svg { transform: scaleX(-1); }
html[dir="rtl"] .featured .thumb { order: 1; }
html[dir="rtl"] .prevnext .next { text-align: left; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .post-layout { grid-template-columns: 1fr; }
  .toc { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-art { order: -1; max-width: 460px; margin: 0 auto; }
  .post-grid { grid-template-columns: 1fr 1fr; }
  .featured { grid-template-columns: 1fr; }
  .featured .thumb { aspect-ratio: 16/9; }
  .featured .thumb img { height: auto; }
}
@media (max-width: 720px) {
  .nav, .header-actions .search-btn, .header-actions .theme-toggle { display: none; }
  .nav-toggle { display: grid; }
  body { font-size: 16px; }
  .post-grid { grid-template-columns: 1fr; }
  .section { padding: 44px 0; }
  .newsletter { padding: 40px 26px; }
  .prevnext { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .hero-stats { gap: 22px; }
}

/* ---------- Language picker ---------- */
.lang-picker { position: relative; flex: none; }
.lang-picker-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font: 600 13.5px/1 var(--font-body); cursor: pointer; white-space: nowrap;
  transition: transform 0.18s ease, border-color 0.2s, background 0.2s, color 0.2s;
}
.lang-picker-btn:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
.lang-picker-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.lang-picker-btn svg { width: 17px; height: 17px; flex: none; }
.lang-picker-chevron { width: 13px; height: 13px; opacity: 0.65; transition: transform 0.2s ease; }
.lang-picker.open .lang-picker-chevron { transform: rotate(180deg); }
.lang-picker-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 130;
  min-width: 220px; padding: 6px; margin: 0; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.lang-picker.open .lang-picker-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.lang-picker-menu li { margin: 0; padding: 0; }
.lang-picker-menu a,
.lang-picker-menu .lang-current {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.lang-picker-menu a:hover { background: var(--accent-soft); color: var(--accent); }
.lang-picker-menu .lang-current { color: var(--accent); background: var(--accent-soft); cursor: default; }
.lang-picker-menu .lang-name { flex: 1; }
.lang-picker-menu .lang-check { width: 15px; height: 15px; flex: none; }
/* RTL: keep the dropdown anchored to the same visual edge */
html[dir="rtl"] .lang-picker-menu { right: auto; left: 0; }

/* Mobile drawer: the picker expands inline full-width. The menu is fully
   hidden when closed (display:none) so it never leaves a blank strip in the
   drawer — unlike the desktop copy, no transition is needed here. */
.mobile-nav .lang-picker { width: 100%; margin-top: 4px; }
.mobile-nav .lang-picker-btn { width: 100%; justify-content: center; }
.mobile-nav .lang-picker-menu {
  display: none; position: static; width: 100%; min-width: 0; margin-top: 6px;
  box-shadow: none; transform: none; border-color: var(--line);
}
.mobile-nav .lang-picker.open .lang-picker-menu {
  display: block; opacity: 1; visibility: visible;
}
@media (max-width: 720px) {
  .header-actions .lang-picker { display: none; } /* drawer copy takes over */
}
