/* ============================================================
   Magistral Blog — non-critical styles
   Critical above-the-fold styles are inlined in templates.
   Variables and base typography come from the inlined block.
   ============================================================ */

/* === Hero photo (above article header) === */
.post-hero {
  max-width: 980px;
  margin: 0 auto 56px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px -20px rgba(112, 72, 227, 0.4), 0 4px 16px rgba(0, 0, 0, 0.2);
  aspect-ratio: 16 / 9;
  position: relative;
  background: linear-gradient(135deg, rgba(148, 63, 227, 0.12), rgba(77, 204, 216, 0.12));
}
.post-hero picture,
.post-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-hero figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-3);
  text-align: center;
  font-style: italic;
}

/* === Body illustration (mid-article) === */
.post-body-illustration {
  margin: 64px auto;
  max-width: 480px;
  padding: 32px;
  text-align: center;
}
.post-body-illustration img {
  width: 100%;
  height: auto;
  max-width: 480px;
  display: block;
  margin: 0 auto;
}
.post-body-illustration figcaption {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-3);
  text-align: center;
  font-style: italic;
}
@media (max-width: 600px) {
  .post-hero { margin-bottom: 36px; border-radius: 14px; }
  .post-body-illustration { max-width: 320px; padding: 20px; margin: 48px auto; }
}
[data-theme="light"] .post-hero {
  box-shadow: 0 16px 40px -16px rgba(112, 72, 227, 0.18), 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* === Article body (prose) === */
.prose {
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-2);
}
.prose > * + * { margin-top: 1.25em; }

.prose h2,
.prose h3,
.prose h4 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  scroll-margin-top: 96px;
}
.prose h2 {
  font-size: 1.625rem;
  margin-top: 2.4em;
  padding-bottom: .35em;
  position: relative;
}
.prose h2::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 56px; height: 3px;
  background: var(--grad);
  border-radius: 2px;
}
.prose h3 {
  font-size: 1.25rem;
  margin-top: 2em;
}
.prose h4 {
  font-size: 1.05rem;
  margin-top: 1.6em;
  color: var(--text-2);
}

.prose p { font-size: 1.0625rem; line-height: 1.75; }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { color: var(--text); }

.prose a {
  color: var(--cyan);
  text-decoration: underline;
  text-decoration-color: rgba(77,204,216,.4);
  text-underline-offset: 3px;
  transition: color .2s, text-decoration-color .2s;
}
.prose a:hover {
  color: var(--text);
  text-decoration-color: var(--cyan);
}

/* Heading anchor links (rehype-autolink-headings) */
.prose .anchor {
  margin-left: .35em;
  opacity: 0;
  color: var(--text-3);
  font-weight: 400;
  transition: opacity .2s;
  text-decoration: none;
}
.prose h2:hover .anchor,
.prose h3:hover .anchor,
.prose h4:hover .anchor { opacity: 1; }

/* Lists */
.prose ul, .prose ol {
  padding-left: 1.4em;
}
.prose ul li::marker { color: var(--violet); }
.prose ol li::marker { color: var(--cyan); font-weight: 700; }
.prose li + li { margin-top: .4em; }
.prose li > p { display: inline; }

/* Blockquotes */
.prose blockquote {
  margin: 1.6em 0;
  padding: 1em 1.4em;
  border-left: 3px solid var(--violet);
  background: rgba(112,72,227,.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
  font-style: normal;
}
.prose blockquote p { font-size: 1.0625rem; }
.prose blockquote p + p { margin-top: .8em; }

/* Code */
.prose code {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: .92em;
  padding: .15em .42em;
  background: rgba(112,72,227,.12);
  color: var(--text);
  border-radius: 5px;
  border: 1px solid rgba(112,72,227,.18);
}
.prose pre {
  margin: 1.6em 0;
  padding: 1.2em 1.4em;
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: .92em;
  line-height: 1.6;
  color: var(--text-2);
}
.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 1em;
  border-radius: 0;
}

/* Tables */
.prose table {
  width: 100%;
  margin: 1.6em 0;
  border-collapse: collapse;
  font-size: .95rem;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.prose thead { background: rgba(112,72,227,.08); }
.prose th, .prose td {
  padding: .8em 1em;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}
.prose th { color: var(--text); font-weight: 600; }
.prose tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }
.prose tbody tr:last-child td { border-bottom: none; }

/* Images and figures */
.prose img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin: 1.6em 0;
}
.prose figure { margin: 1.6em 0; }
.prose figcaption {
  margin-top: .6em;
  font-size: .9rem;
  color: var(--text-3);
  text-align: center;
}

/* Horizontal rule */
.prose hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--glass-border), transparent);
  margin: 2.4em 0;
}

/* === Article header === */
.article-header { max-width: 800px; margin: 0 auto 56px; text-align: center; }
.article-header .breadcrumb {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 18px;
}
.article-header .breadcrumb a { color: var(--text-3); }
.article-header .breadcrumb a:hover { color: var(--cyan); }
.article-header .breadcrumb .sep { color: var(--text-4); }
.article-header .category-pill {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 50px;
  background: rgba(112,72,227,.12);
  border: 1px solid rgba(112,72,227,.25);
  font-size: 12px;
  color: var(--violet);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 20px;
}
.article-header h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 18px;
}
.article-header .lede {
  font-size: 1.15rem;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 640px;
  margin: 0 auto;
}
.article-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 28px;
  font-size: 13px;
  color: var(--text-3);
}
.article-meta .author-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
}
.article-meta .author-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
}
.article-meta .dot { color: var(--text-4); }

/* Tags row inside article */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.article-tags a {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 50px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-3);
  transition: all .2s;
}
.article-tags a:hover {
  color: var(--text);
  border-color: rgba(112,72,227,.3);
}

/* === Article footer === */
.article-footer { max-width: 720px; margin: 64px auto 0; }
.author-card {
  display: flex;
  gap: 18px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  margin-top: 48px;
}
.author-card .avatar {
  width: 56px; height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
}
.author-card h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}
.author-card p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0;
}

.share-block {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 36px;
  padding: 20px 0;
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
}
.share-block .label {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 600;
}
.share-block a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 50px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  font-size: 13px;
  color: var(--text-2);
  transition: all .2s;
}
.share-block a:hover {
  color: var(--text);
  border-color: rgba(112,72,227,.3);
  transform: translateY(-1px);
}

/* CTA banner near end of article */
.cta-banner {
  margin: 56px 0 0;
  padding: 36px 32px;
  border-radius: var(--radius-lg);
  background: var(--grad);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(112,72,227,.25);
}
.cta-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.12) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: ctaShimmer 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ctaShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.cta-banner h3 {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 800;
  color: white;
  margin-bottom: 8px;
  line-height: 1.3;
}
.cta-banner p {
  font-size: 15px;
  color: rgba(255,255,255,.9);
  margin-bottom: 22px;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}
.cta-banner .cta-btn {
  display: inline-block;
  padding: 13px 28px;
  border-radius: 12px;
  background: rgba(5,13,36,.92);
  color: white;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,.15);
  transition: all .25s;
  position: relative;
  z-index: 1;
}
.cta-banner .cta-btn:hover {
  background: rgba(5,13,36,1);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

/* === Related posts === */
.related-section {
  max-width: 1100px;
  margin: 80px auto 0;
}
.related-section h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 28px;
  text-align: center;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* === Post cards (used in index, category, tag, related) === */
.post-card {
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .3s, transform .3s, box-shadow .3s;
  text-decoration: none;
  color: inherit;
  height: 100%;
}
.post-card:hover {
  border-color: rgba(112,72,227,.3);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}
.post-card .card-hero {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, rgba(148,63,227,.18) 0%, rgba(112,72,227,.10) 35%, rgba(86,131,224,.12) 65%, rgba(77,204,216,.16) 100%);
  position: relative;
  overflow: hidden;
}
.post-card .card-hero img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.post-card .card-hero .card-pill {
  position: absolute;
  top: 14px; left: 14px;
  padding: 4px 12px;
  border-radius: 50px;
  background: rgba(5,13,36,.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 11px;
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.post-card .card-body {
  padding: 22px 22px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.post-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.post-card p {
  font-size: .9rem;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 16px;
  flex: 1;
}
.post-card .card-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--text-3);
}
.post-card .card-meta .dot { color: var(--text-4); }

/* Featured row layout */
.featured-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 56px;
}
.featured-row .featured-main { grid-row: span 2; }
.featured-row .featured-main .card-hero { aspect-ratio: 16 / 10; }
.featured-row .featured-main h3 { font-size: 1.5rem; }
.featured-row .featured-main p { font-size: 1rem; }
.featured-row .featured-side { display: flex; flex-direction: column; }
.featured-row .featured-side .card-hero { aspect-ratio: 16 / 7; }

/* === Index hero === */
.blog-hero {
  text-align: center;
  padding: 144px 0 60px;
  position: relative;
}
.blog-hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 18px;
}
.blog-hero p {
  font-size: 1.1rem;
  color: var(--text-2);
  max-width: 600px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

/* Search input */
.blog-search {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}
.blog-search input {
  width: 100%;
  padding: 14px 18px 14px 46px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.blog-search input:focus {
  outline: none;
  border-color: rgba(112,72,227,.5);
  box-shadow: 0 0 0 4px rgba(112,72,227,.12);
}
.blog-search input::placeholder { color: var(--text-4); }
.blog-search .search-icon {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
}

/* Category filter pills */
.category-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 36px 0 48px;
}
.category-filter button {
  padding: 8px 16px;
  border-radius: 50px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  font-family: inherit;
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.category-filter button:hover {
  color: var(--text);
  border-color: rgba(112,72,227,.3);
}
.category-filter button.active {
  background: var(--grad);
  color: white;
  border-color: transparent;
  font-weight: 600;
}

/* All-posts grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-3);
  font-size: 15px;
}

/* === Taxonomy header (category / tag pages) === */
.taxonomy-header {
  text-align: center;
  padding: 144px 0 40px;
}
.taxonomy-header .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .25em;
  color: var(--cyan);
  font-weight: 600;
  margin-bottom: 16px;
}
.taxonomy-header h1 {
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}
.taxonomy-header p {
  font-size: 1.05rem;
  color: var(--text-2);
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.6;
}

/* === Premium footer (mirrors landing.html) ============================ */
.blog-footer { position: relative; margin-top: 120px; border-top: 1px solid var(--nav-border); color: var(--text-3); font-size: 13px; }
.blog-footer::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(112,72,227,.04), transparent 70%); pointer-events: none; }
.blog-footer .footer-main { position: relative; max-width: 1200px; margin: 0 auto; padding: 80px 24px 48px; display: grid; grid-template-columns: 2.4fr 1fr 1fr 1fr; gap: 48px; }
.blog-footer .footer-brand-col { display: flex; flex-direction: column; gap: 18px; max-width: 360px; }
.blog-footer .footer-logo { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.blog-footer .footer-logo-icon { width: 38px; height: 38px; object-fit: contain; border-radius: 9px; }
.blog-footer .footer-logo-text { font-family: 'DM Sans', sans-serif; font-weight: 800; font-size: 22px; letter-spacing: -0.03em; color: var(--text); }
.blog-footer .footer-tagline { font-size: 14px; color: var(--text-2); line-height: 1.6; max-width: 320px; }
.blog-footer .footer-socials { display: flex; gap: 10px; margin-top: 4px; }
.blog-footer .footer-social { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--glass-border); background: var(--toggle-bg); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; transition: color .2s, border-color .2s, background .2s, transform .2s; }
.blog-footer .footer-social:hover { color: var(--text); border-color: rgba(112,72,227,.4); background: rgba(112,72,227,.08); transform: translateY(-2px); }
.blog-footer .footer-social svg { width: 18px; height: 18px; fill: currentColor; }
.blog-footer .footer-col h4 { font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 2px; color: var(--cyan); font-weight: 700; text-transform: uppercase; margin-bottom: 18px; }
.blog-footer .footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 11px; padding: 0; margin: 0; }
.blog-footer .footer-col a { font-size: 14px; color: var(--text-2); transition: color .2s; text-decoration: none; }
.blog-footer .footer-col a:hover { color: var(--text); }
.blog-footer .footer-bottom { position: relative; max-width: 1200px; margin: 0 auto; padding: 24px 24px 32px; border-top: 1px solid var(--nav-border); display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.blog-footer .footer-bottom-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); line-height: 1.6; }
.blog-footer .footer-bottom-left .footer-copy-mini { display: flex; align-items: center; gap: 8px; }
.blog-footer .footer-bottom-left .footer-mini-logo { width: 18px; height: 18px; object-fit: contain; opacity: .85; }
.blog-footer .footer-legal-info { font-size: 11px; color: var(--text-4); line-height: 1.6; max-width: 100%; flex-basis: 100%; padding-top: 14px; margin-top: 2px; border-top: 1px dashed var(--nav-border); }
.blog-footer .footer-legal-info a { color: inherit; text-decoration: underline; }
@media (max-width: 900px) {
  .blog-footer .footer-main { grid-template-columns: 1fr 1fr; gap: 36px 32px; padding: 60px 24px 40px; }
  .blog-footer .footer-brand-col { grid-column: 1 / -1; max-width: none; }
}
@media (max-width: 540px) {
  .blog-footer .footer-main { grid-template-columns: 1fr; gap: 32px; padding: 56px 24px 36px; }
  .blog-footer .footer-bottom { padding: 20px 24px 28px; flex-direction: column; align-items: flex-start; gap: 14px; }
}

/* === Responsive === */
@media (max-width: 900px) {
  .related-grid, .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .featured-row { grid-template-columns: 1fr; }
  .featured-row .featured-main { grid-row: auto; }
}
@media (max-width: 600px) {
  .related-grid, .posts-grid { grid-template-columns: 1fr; }
  .article-header h1 { font-size: 1.8rem; }
  .article-header .lede { font-size: 1.02rem; }
  .prose { font-size: 1rem; }
  .prose h2 { font-size: 1.4rem; }
  .blog-hero { padding-top: 120px; }
  .cta-banner { padding: 28px 22px; }
  .author-card { flex-direction: column; text-align: center; align-items: center; }
}

/* ============================================================
   Header language selector
   Per-page-aware dropdown showing every language the page is
   translated into. Server-rendered so options exist before JS.
   ============================================================ */
.mg-lang-selector {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.mg-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--toggle-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-3);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
.mg-lang-trigger:hover,
.mg-lang-trigger[aria-expanded="true"] {
  color: var(--text);
  border-color: rgba(112,72,227,.3);
  background: var(--glass-hover);
}
.mg-lang-trigger:focus-visible {
  outline: none;
  border-color: rgba(112,72,227,.5);
  box-shadow: 0 0 0 3px rgba(112,72,227,.18);
}
.mg-lang-trigger-code {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--violet);
}
[data-theme="dark"] .mg-lang-trigger-code { color: var(--cyan); }
.mg-lang-trigger-name {
  white-space: nowrap;
}
.mg-lang-chevron {
  width: 12px;
  height: 12px;
  transition: transform .15s;
}
.mg-lang-trigger[aria-expanded="true"] .mg-lang-chevron {
  transform: rotate(180deg);
}

.mg-lang-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  min-width: 200px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.24), 0 2px 8px rgba(0,0,0,.12);
  animation: mgLangPanelIn .12s ease-out;
}
[data-theme="light"] .mg-lang-panel {
  background: white;
  box-shadow: 0 12px 32px rgba(112,72,227,.12), 0 2px 8px rgba(0,0,0,.04);
}
@keyframes mgLangPanelIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.mg-lang-panel li { list-style: none; margin: 0; }
.mg-lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.mg-lang-option:hover,
.mg-lang-option:focus-visible {
  outline: none;
  background: var(--glass-hover);
  color: var(--text);
}
.mg-lang-option-current {
  color: var(--text);
  background: var(--grad-subtle);
}
.mg-lang-option-current:hover,
.mg-lang-option-current:focus-visible {
  background: var(--grad-subtle);
}
.mg-lang-option-code {
  display: inline-block;
  min-width: 24px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--violet);
}
[data-theme="dark"] .mg-lang-option-code { color: var(--cyan); }
.mg-lang-option-name {
  flex: 1;
}
.mg-lang-check {
  width: 14px;
  height: 14px;
  color: var(--violet);
  flex-shrink: 0;
}
[data-theme="dark"] .mg-lang-check { color: var(--cyan); }

@media (max-width: 600px) {
  .mg-lang-trigger-name { display: none; }
  .mg-lang-trigger { padding: 7px 8px; gap: 4px; }
  .mg-lang-panel { right: -8px; min-width: 180px; }
}

/* ============================================================
   Soft language detection banner
   Hidden by default. JS toggles display:flex when the user's
   browser language differs from current AND a translation
   exists. 30-day localStorage dismissal.
   ============================================================ */
.mg-lang-banner {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  z-index: 99;
  background: rgba(112,72,227,.10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(112,72,227,.18);
  opacity: 0;
  transition: opacity .2s ease-out;
}
[data-theme="light"] .mg-lang-banner {
  background: rgba(112,72,227,.06);
  border-bottom-color: rgba(112,72,227,.12);
}
.mg-lang-banner.mg-lang-banner-shown { opacity: 1; }
.mg-lang-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.mg-lang-banner-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.mg-lang-banner-msg {
  margin: 0;
  flex: 1;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.4;
}
.mg-lang-banner-btn {
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--grad);
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .15s, box-shadow .15s;
}
.mg-lang-banner-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(112,72,227,.32);
}
.mg-lang-banner-dismiss {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-family: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.mg-lang-banner-dismiss:hover {
  color: var(--text);
  background: var(--glass-hover);
}
.mg-lang-banner-dismiss:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(112,72,227,.4);
}

@media (max-width: 640px) {
  .mg-lang-banner-inner {
    flex-wrap: wrap;
    padding: 8px 16px;
    gap: 8px;
    row-gap: 8px;
  }
  .mg-lang-banner-msg {
    flex: 1 1 100%;
    font-size: 13px;
  }
  .mg-lang-banner-icon { order: -1; }
  .mg-lang-banner-btn {
    margin-left: auto;
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* === Newsletter popup (blog-only, JS-triggered after dwell) ============ */
.nl-popup-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 1200; opacity: 0; transition: opacity .28s ease; }
.nl-popup-backdrop.is-visible { display: block; }
.nl-popup-backdrop.is-open { opacity: 1; }
.nl-popup { display: none; position: fixed; left: 50%; top: 50%; transform: translate(-50%, calc(-50% + 16px)); width: calc(100% - 40px); max-width: 460px; background: var(--bg); border: 1px solid var(--nav-border); border-radius: 16px; box-shadow: 0 32px 64px rgba(0,0,0,.4), 0 0 0 1px rgba(112,72,227,.05); z-index: 1201; padding: 28px 28px 24px; opacity: 0; transition: opacity .32s cubic-bezier(.16,1,.3,1), transform .32s cubic-bezier(.16,1,.3,1); color: var(--text); }
.nl-popup.is-visible { display: block; }
.nl-popup.is-open { opacity: 1; transform: translate(-50%, -50%); }
.nl-popup-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 1px solid var(--glass-border); border-radius: 10px; background: var(--toggle-bg); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.nl-popup-close:hover { border-color: rgba(112,72,227,.3); }
.nl-popup-kicker { font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 2px; color: var(--cyan); font-weight: 600; text-transform: uppercase; }
.nl-popup-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; color: var(--text); margin-top: 10px; }
.nl-popup-sub { font-size: 14px; color: var(--text-2); margin-top: 10px; line-height: 1.55; }
.nl-popup-sub strong { color: var(--text); font-weight: 700; }
.nl-popup-form { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.nl-popup-form input[type="email"] { flex: 1; min-width: 180px; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 10px; padding: 12px 14px; color: var(--text); font-size: 14px; outline: none; font-family: inherit; }
.nl-popup-form input[type="email"]:focus { border-color: rgba(112,72,227,.5); box-shadow: 0 0 0 3px rgba(112,72,227,.12); }
.nl-popup-form button { padding: 0 18px; min-height: 44px; border: 0; border-radius: 10px; background: var(--grad); color: white; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
.nl-popup-form button:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(112,72,227,.25); }
.nl-popup-form button:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.nl-popup-fine { font-size: 11px; color: var(--text-3); margin-top: 12px; }
.nl-popup-state { display: none; margin-top: 14px; font-size: 13px; }
.nl-popup-state.is-success { color: var(--success); display: block; }
.nl-popup-state.is-error { color: var(--error); display: block; }
