/* Interactive story blocks (about-mongolia, gateway-to-nomadic-heritage — markup in their
   src/content/pages/*.html, behaviour in /js/smx-interactive.js). Works in both themes. */

.post-content {
  --smx-accent: #a8866c;
  --smx-sand: #ceb19c;
  --smx-ink: #36454f;
  --smx-muted: #7a7a7a;
  --smx-card: #faf7f3;
  --smx-line: rgba(168, 134, 108, 0.28);
  --smx-women: #c2410c;
  --smx-men: #c9bfb5;
}
html.sm-dark .post-content {
  --smx-accent: #ceb19c;
  --smx-ink: #eee8e1;
  --smx-muted: #8f877e;
  --smx-card: #201d1a;
  --smx-line: #3b3630;
  --smx-women: #f59e6b;
  --smx-men: #4a443d;
}

.smx-block {
  margin: 34px 0 40px;
  padding: 28px 26px;
  border: 1px solid var(--smx-line);
  border-radius: 18px;
  background: var(--smx-card);
  color: var(--smx-ink);
}
.smx-kicker {
  margin: 0 0 18px !important;
  font-family: 'Poppins', sans-serif;
  font-size: 11px !important;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--smx-accent) !important;
  text-align: center;
}
.smx-kicker--sub { margin-top: 30px !important; }
.smx-note {
  margin: 16px 0 0 !important;
  text-align: center;
  font-size: 0.95em;
  color: var(--smx-muted) !important;
}
.smx-block button { font: inherit; color: inherit; }
.smx-count { font-variant-numeric: tabular-nums; }

/* ---------- Chapter navigation ---------- */
.smx-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 34px;
}
.smx-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--smx-line);
  border-radius: 999px;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--smx-ink) !important;
  text-decoration: none !important;
  transition: background-color 0.25s, border-color 0.25s, transform 0.2s;
}
.smx-chip span { color: var(--smx-accent); font-weight: 600; }
.smx-chip:hover, .smx-chip.is-active {
  background: var(--smx-accent);
  border-color: var(--smx-accent);
  color: #fff !important;
  transform: translateY(-1px);
}
html.sm-dark .smx-chip:hover, html.sm-dark .smx-chip.is-active { color: #1d1916 !important; }
.smx-chip:hover span, .smx-chip.is-active span { color: inherit; }
.smx-anchor { scroll-margin-top: 110px; }

/* side dots (desktop) */
.smx-dots {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.smx-dots.is-visible { opacity: 1; pointer-events: auto; }
.smx-dots a {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--smx-accent, #a8866c);
  transition: background-color 0.25s, transform 0.25s;
}
.smx-dots a.is-active { background: var(--smx-accent, #a8866c); transform: scale(1.3); }
.smx-dots a::after {
  content: attr(title);
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font: 600 11px/1 'Poppins', sans-serif;
  letter-spacing: 0.05em;
  color: var(--smx-accent, #a8866c);
  opacity: 0;
  transition: opacity 0.2s;
}
.smx-dots a:hover::after, .smx-dots a.is-active::after { opacity: 1; }
.smx-dots { --smx-accent: #a8866c; }
html.sm-dark .smx-dots { --smx-accent: #ceb19c; }
@media (max-width: 1100px) { .smx-dots { display: none; } }

/* ---------- Timeline ---------- */
.smx-tl-track {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  padding: 0 4px;
  margin-bottom: 26px;
}
.smx-tl-track::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 9px;
  height: 2px;
  background: var(--smx-line);
}
.smx-tl-track::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 9px;
  height: 2px;
  width: calc((100% - 36px) * var(--p, 0));
  background: var(--smx-accent);
  transition: width 0.5s cubic-bezier(0.22, 0.61, 0.16, 1);
}
.smx-tl-dot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.smx-tl-dot::before {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--smx-accent);
  background: var(--smx-card);
  transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
}
.smx-tl-dot.is-past::before { background: var(--smx-accent); }
.smx-tl-dot.is-active::before {
  background: var(--smx-accent);
  transform: scale(1.25);
  box-shadow: 0 0 0 6px rgba(206, 177, 156, 0.25);
}
.smx-tl-dot b {
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--smx-muted);
  transition: color 0.3s;
}
.smx-tl-dot.is-active b { color: var(--smx-accent); }
.smx-tl-cards { position: relative; min-height: 120px; }
.smx-tl-card {
  position: absolute;
  inset: 0;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.45s, transform 0.45s;
  pointer-events: none;
}
.smx-tl-card.is-active { position: relative; opacity: 1; transform: none; pointer-events: auto; }
.smx-tl-card h4 {
  margin: 0 0 8px !important;
  font-family: 'Cormorant Garamond', serif;
  font-size: 30px !important;
  line-height: 1.15 !important;
  color: var(--smx-ink) !important;
}
.smx-tl-card p { margin: 0 auto !important; max-width: 560px; color: var(--smx-muted) !important; }
.smx-tl-nav { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }
.smx-tl-nav button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--smx-line);
  background: transparent;
  font-size: 22px !important;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.smx-tl-nav button:hover { background: var(--smx-accent); color: #fff; }
@media (max-width: 640px) {
  .smx-tl-dot b { font-size: 9px; }
  .smx-tl-dot::before { width: 14px; height: 14px; }
  .smx-tl-track::before, .smx-tl-track::after { top: 7px; }
  .smx-tl-card h4 { font-size: 24px !important; }
  .smx-block { padding: 22px 16px; }
}

/* ---------- Livestock ---------- */
.smx-herd { text-align: center; }
.smx-herd-big { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.smx-herd-big .smx-count,
.smx-stat .smx-count {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  line-height: 1;
  color: var(--smx-accent);
}
.smx-herd-big .smx-count { font-size: 64px; }
.smx-herd-big small, .smx-stat small {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--smx-muted);
}
.smx-herd-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.smx-person { font-size: 34px; }
.smx-eq { font-family: 'Poppins', sans-serif; font-size: 22px; color: var(--smx-accent); }
.smx-herd-icons { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 360px; }
.smx-herd-icons span {
  font-size: 22px;
  opacity: 0;
  transform: scale(0.3) translateY(8px);
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.smx-herd.is-in .smx-herd-icons span { opacity: 1; transform: none; }

/* ---------- Parliament ---------- */
.smx-parl { text-align: center; }
.smx-parl-svg { width: min(100%, 520px); height: auto; display: block; margin: 0 auto; }
.smx-parl-svg circle {
  transition: fill 0.4s, opacity 0.4s, transform 0.5s;
  transform-box: fill-box;
  transform-origin: center;
}
.smx-parl-svg circle.w { fill: var(--smx-women); }
.smx-parl-svg circle.m { fill: var(--smx-men); }
.smx-parl:not(.is-in) .smx-parl-svg circle { opacity: 0; transform: scale(0); }
.smx-parl[data-focus="w"] .smx-parl-svg circle.m,
.smx-parl[data-focus="m"] .smx-parl-svg circle.w { opacity: 0.25; }
.smx-parl[data-focus="m"] .smx-parl-svg circle.m { fill: var(--smx-accent); }
.smx-parl-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.smx-legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--smx-line);
  border-radius: 999px;
  background: transparent;
  font-family: 'Poppins', sans-serif !important;
  font-size: 13px !important;
  cursor: pointer;
}
.smx-legend.is-on { border-color: var(--smx-accent); box-shadow: 0 0 0 3px rgba(206, 177, 156, 0.2); }
.smx-legend i { width: 12px; height: 12px; border-radius: 50%; }
.smx-legend i.w { background: var(--smx-women); }
.smx-legend i.m { background: var(--smx-men); }
.smx-legend em { font-style: normal; color: var(--smx-women); font-weight: 600; }

/* ---------- Stat grids ---------- */
.smx-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.smx-block.smx-stats { padding: 22px; }
.smx-stats--wild { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.smx-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  text-align: center;
  border-radius: 12px;
  transition: background-color 0.25s, transform 0.25s;
}
.smx-stat:hover { background: rgba(206, 177, 156, 0.12); transform: translateY(-3px); }
.smx-stat .smx-count { font-size: 40px; }
.smx-stat small { font-size: 10px; line-height: 1.5; }
@media (max-width: 900px) {
  .smx-stats--wild { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .smx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .smx-stat .smx-count { font-size: 32px; }
}

/* ---------- Economy bars ---------- */
.smx-bars { display: flex; flex-direction: column; gap: 16px; }
.smx-bar {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr 56px;
  align-items: center;
  gap: 14px;
}
.smx-bar-label { font-family: 'Poppins', sans-serif; font-size: 12px; color: var(--smx-muted); }
.smx-bar b { font-family: 'Poppins', sans-serif; font-size: 14px; color: var(--smx-ink); text-align: right; }
.smx-bar-track { height: 12px; border-radius: 999px; background: var(--smx-line); overflow: hidden; }
.smx-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--smx-sand), var(--smx-accent));
  transition: width 1.2s cubic-bezier(0.22, 0.61, 0.16, 1);
}
.smx-econ.is-in .smx-bar-fill { width: calc(var(--v) / var(--max, 25) * 100%); }
.smx-econ.is-in .smx-bar:nth-child(2) .smx-bar-fill { transition-delay: 0.15s; }
.smx-econ.is-in .smx-bar:nth-child(3) .smx-bar-fill { transition-delay: 0.3s; }
.smx-econ.is-in .smx-bar:nth-child(4) .smx-bar-fill { transition-delay: 0.45s; }
@media (max-width: 640px) {
  .smx-bar { grid-template-columns: 1fr 52px; row-gap: 6px; }
  .smx-bar-label { grid-column: 1 / -1; }
}

.smx-mines { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.smx-mine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  border: 1px solid var(--smx-line);
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.25s, transform 0.25s, background-color 0.25s;
}
.smx-mine:hover { transform: translateY(-3px); border-color: var(--smx-accent); }
.smx-mine-ico { font-size: 28px; }
.smx-mine b { font-family: 'Cormorant Garamond', serif; font-size: 22px; }
.smx-mine-more {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--smx-muted);
  transition: max-height 0.45s ease, opacity 0.35s ease;
}
.smx-mine[aria-expanded="true"] { border-color: var(--smx-accent); background: rgba(206, 177, 156, 0.1); }
.smx-mine[aria-expanded="true"] .smx-mine-more { max-height: 140px; opacity: 1; }
@media (max-width: 640px) { .smx-mines { grid-template-columns: 1fr; } }

/* ---------- Wildlife flip cards ---------- */
.smx-flips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.smx-flip {
  position: relative;
  height: 170px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 900px;
}
.smx-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--smx-line);
  border-radius: 14px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.16, 1);
}
.smx-front { background: var(--smx-card); }
.smx-back {
  transform: rotateY(180deg);
  background: var(--smx-accent);
  color: #fff;
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
}
html.sm-dark .smx-back { color: #1d1916; }
.smx-flip[aria-pressed="true"] .smx-front { transform: rotateY(-180deg); }
.smx-flip[aria-pressed="true"] .smx-back { transform: rotateY(0); }
.smx-ico { font-size: 40px; transition: transform 0.3s; }
.smx-flip:hover .smx-ico { transform: scale(1.12) rotate(-4deg); }
.smx-front b { font-family: 'Cormorant Garamond', serif; font-size: 20px; line-height: 1.15; }
.smx-front small { font-family: 'Poppins', sans-serif; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--smx-muted); }
@media (max-width: 900px) { .smx-flips { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Reveal on scroll ---------- */
.smx-block { opacity: 0; transform: translateY(24px); transition: opacity 0.7s, transform 0.7s cubic-bezier(0.22, 0.61, 0.16, 1); }
.smx-block.is-in { opacity: 1; transform: none; }
.no-js .smx-block, .smx-block.smx-noanim { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .smx-block, .smx-bar-fill, .smx-face, .smx-herd-icons span, .smx-parl-svg circle, .smx-tl-card {
    transition: none !important;
  }
}

/* ---------- Proven resource reserves (replaces the static infographic) ---------- */
.smx-res { margin: 0; padding: 22px 16px; }
.smx-res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}
.smx-res-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 0 12px;
  border: 1px solid var(--smx-line);
  border-radius: 14px;
  background: transparent;
  overflow: hidden;
  cursor: pointer;
  text-align: center;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s, opacity 0.3s;
}
.smx-res-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  margin-bottom: 8px;
  transition: transform 0.5s cubic-bezier(0.22, 0.61, 0.16, 1), filter 0.3s;
}
.smx-res-tile:hover { transform: translateY(-3px); border-color: var(--smx-accent); }
.smx-res-tile:hover img { transform: scale(1.08); }
.smx-res-tile[aria-pressed="true"] {
  border-color: var(--smx-accent);
  box-shadow: 0 0 0 3px rgba(206, 177, 156, 0.3);
}
.smx-res.has-pick .smx-res-tile[aria-pressed="false"] { opacity: 0.55; }
.smx-res.has-pick .smx-res-tile[aria-pressed="false"] img { filter: grayscale(0.7); }
.smx-res-name {
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--smx-muted);
}
.smx-res-val { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.smx-res-val .smx-count {
  font-family: 'Cormorant Garamond', serif;
  font-size: 30px;
  font-weight: 600;
  color: var(--smx-accent);
}
.smx-res-val small { margin-top: 3px; font-family: 'Poppins', sans-serif; font-size: 10px; color: var(--smx-muted); }

.smx-res-detail { min-height: 92px; margin-top: 18px; text-align: center; }
.smx-res-hint { margin: 30px 0 0 !important; font-size: 0.95em; color: var(--smx-muted) !important; }
.smx-res-detail h4 {
  margin: 0 0 4px !important;
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px !important;
  color: var(--smx-ink) !important;
}
.smx-res-detail .smx-res-tonnes { font-family: 'Poppins', sans-serif; font-size: 12px; color: var(--smx-accent); }
.smx-res-detail p { margin: 6px 0 0 !important; font-size: 0.95em; line-height: 1.45; color: var(--smx-muted) !important; }
.smx-res-detail > div { animation: smx-pop 0.4s cubic-bezier(0.22, 0.61, 0.16, 1); }
@keyframes smx-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.smx-res-scale { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.smx-res-scale .smx-res-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  align-items: center;
  gap: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  color: var(--smx-muted);
  cursor: pointer;
}
.smx-res-scale .bar { height: 8px; border-radius: 999px; background: var(--smx-line); overflow: hidden; }
.smx-res-scale .bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--smx-sand);
  transition: width 1s cubic-bezier(0.22, 0.61, 0.16, 1), background-color 0.3s;
}
.smx-res.is-in .smx-res-scale .bar i { width: var(--w); }
.smx-res-scale .smx-res-row.is-on { color: var(--smx-ink); font-weight: 600; }
.smx-res-scale .smx-res-row.is-on .bar i { background: var(--smx-accent); }
.smx-res-scale-title {
  margin: 0 0 2px;
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--smx-accent);
  text-align: center;
}
.smx-res-src { margin: 14px 0 0 !important; text-align: center; font-size: 12px !important; color: var(--smx-muted) !important; }
.smx-res-src a { color: var(--smx-accent) !important; }

/* ---------- Ulaanbaatar map explorer (gateway-to-nomadic-heritage) ---------- */
.smx-map { padding: 22px; }
.smx-map-wrap {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) 1.4fr;
  gap: 18px;
  align-items: stretch;
}
.smx-places {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.smx-places li { margin: 0 !important; padding: 0 !important; list-style: none !important; }
.smx-places li::before { display: none !important; }
.smx-place {
  display: flex;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.25s, border-color 0.25s;
}
.smx-place:hover { background: rgba(206, 177, 156, 0.12); }
.smx-place[aria-pressed="true"] { border-color: var(--smx-accent); background: rgba(206, 177, 156, 0.16); }
.smx-place-num {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 600 12px/1 'Poppins', sans-serif;
  color: var(--smx-accent);
  border: 1.5px solid var(--smx-accent);
  transition: background-color 0.25s, color 0.25s;
}
.smx-place[aria-pressed="true"] .smx-place-num { background: var(--smx-accent); color: #fff; }
html.sm-dark .smx-place[aria-pressed="true"] .smx-place-num { color: #1d1916; }
.smx-place-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.smx-place-body b { font-family: 'Cormorant Garamond', serif; font-size: 20px; line-height: 1.2; color: var(--smx-ink); }
.smx-place-desc {
  font-size: 15px;
  line-height: 1.45;
  color: var(--smx-muted);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}
.smx-place[aria-pressed="true"] .smx-place-desc { max-height: 160px; opacity: 1; }
.smx-map-frame {
  position: relative;
  min-height: 420px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--smx-line);
  background: var(--smx-line);
}
.smx-map-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
html.sm-dark .smx-map-frame iframe { filter: invert(0.9) hue-rotate(180deg) saturate(0.6) brightness(0.95); }
.smx-map-open {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(23, 21, 19, 0.82);
  color: #fff !important;
  font: 600 11px/1 'Poppins', sans-serif;
  letter-spacing: 0.04em;
  text-decoration: none !important;
}
.smx-map-open:hover { background: var(--smx-accent); }
@media (max-width: 800px) {
  .smx-map-wrap { grid-template-columns: 1fr; }
  .smx-map-frame { min-height: 320px; order: -1; }
}
