/* === Base theme === */
:root{
  --bg:#0b0c10;
  --card:#151821;
  --muted:#9aa3b2;
  --text:#e8ecf1;
  --accent:#4da3ff;
  --accent-2:#8ee887;
  --border: #202635;
  --radius:14px;
  --container:1100px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:linear-gradient(180deg,#0b0c10 0%, #0f1118 100%);
  color:var(--text);
  font:16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

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

.site-header{
  position:sticky; top:0; z-index:10;
  background:rgba(11,12,16,.75); backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
}
.header-inner{display:flex;align-items:center;gap:16px;min-height:64px}
.logo{font-weight:800;letter-spacing:.2px;text-decoration:none;color:var(--text);font-size:20px}
.logo .dot{color:var(--accent)}
.nav{display:flex;gap:16px;margin-left:auto}
.nav a{color:var(--text);text-decoration:none;opacity:.85}
.nav a:hover{opacity:1}

.lang-switch{display:flex;gap:8px}
.lang-btn{
  background:var(--card); border:1px solid var(--border); color:var(--text);
  padding:6px 10px; border-radius:10px; cursor:pointer; font-weight:600;
  transition: transform .12s ease;
}
.lang-btn:active{ transform: scale(.96); }

.hero{padding:28px 0 10px; position: relative; overflow: hidden;
  background:
    radial-gradient(1200px 500px at 20% -10%, rgba(77,163,255,.14), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(142,232,135,.09), transparent 70%);
}
.hero h1{margin:0 0 8px;font-size:28px}
.muted{color:var(--muted);margin:0}

.hero::before{
  content:"";
  position:absolute; inset:-2px;
  opacity:.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'><g fill='none' stroke='%23ffffff' stroke-width='2'><circle cx='70' cy='70' r='30'/><path d='M40 70h60M70 40v60'/><path d='M20 110c15-25 30 25 45 0M75 110c15-25 30 25 45 0'/></g></svg>");
  background-size: 140px 140px;
  animation: drift 60s linear infinite;
  pointer-events:none;
  z-index:0;
}
@keyframes drift { from{ background-position: 0 0; } to{ background-position: 1000px 0; } }
.hero > * { position: relative; z-index: 1; }

.search-wrap{margin:18px 0 6px}
#search{
  width:100%; padding:14px 16px; border-radius:12px;
  border:1px solid var(--border); background:#0f1320; color:var(--text);
  outline:none;
}
#search:focus{border-color:var(--accent)}

.grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:16px; margin:22px 0 36px;
}
@media (max-width:960px){.grid{grid-template-columns:repeat(2,1fr)}}
@media (max-width:640px){.grid{grid-template-columns:1fr}}

.card{
  display:flex; flex-direction:column; gap:10px;
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:16px; min-height:170px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover{transform:translateY(-3px); border-color:#2a364c; box-shadow: 0 10px 28px rgba(0,0,0,.28);}
.card a{color:var(--text); text-decoration:none}
.card .title{font-size:18px; font-weight:700; margin:0}
.card .meta{font-size:13px; color:var(--muted); display:flex; gap:10px}
.card .excerpt{margin:6px 0 0; color:#cad2de}

.about{
  background:linear-gradient(180deg, rgba(77,163,255,.1), rgba(142,232,135,.08));
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px; margin:18px 0 40px;
}

.article{padding:24px 0 60px}
.article h1{margin:0 0 6px; font-size:28px; position:relative; padding-bottom:8px}
.article .meta{color:var(--muted); margin-bottom:18px}
.article .content{background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:18px}
.article img{max-width:100%; height:auto; border-radius:12px}
.back{display:inline-block; margin-top:14px; color:var(--accent); text-decoration:none}

.site-footer{border-top:1px solid var(--border); padding:16px 0; color:var(--muted)}
.site-footer .container{display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap}

.badge{
  display:inline-flex; align-items:center; gap:6px;
  font-size:12px; color:#cfe7ff; background:#10213a; border:1px solid #243a60;
  padding:3px 8px; border-radius:999px;
}

/* === Этно-ленты (кочкор мүйүз) =========================== */
.ornament-top,
.ornament-bottom{
  height: 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='12' viewBox='0 0 120 12'><path d='M0 8c6-7 12 7 18 0s12 7 18 0 12 7 18 0 12 7 18 0 12 7 18 0 12-7 12-7v11H0Z' fill='%238ec8ff' fill-opacity='.22'/><path d='M0 6c6-7 12 7 18 0s12 7 18 0 12 7 18 0 12 7 18 0 12 7 18 0 12-7 12-7' fill='none' stroke='%234da3ff' stroke-opacity='.28'/></svg>");
  background-size: 120px 12px;
  animation: slideX 18s linear infinite;
}
.ornament-bottom{ opacity:.9; }

@keyframes slideX { from{ background-position: 0 0; } to{ background-position: 120px 0; } }

/* ====== Иллюстрация в hero ====== */
.hero-illustration{
  position: relative;
  margin: 14px 0 0;
  height: 220px;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.25));
}
@media (max-width:640px){ .hero-illustration{ height:180px } }

/* Палитра и формы */
.hero-illustration .sun{ fill:#ffd15c; opacity:.9 }
.hero-illustration .cloud ellipse{ fill:#ffffff; opacity:.12 }
.hero-illustration .mountain.far{ fill:#21304a }
.hero-illustration .mountain.near{ fill:#2a3c5d }
.hero-illustration .ground{ fill:#162234 }

/* Юрта */
.hero-illustration .yurt-body{ fill:#eae6df; opacity:.9 }
.hero-illustration .yurt-door{ fill:#9b5a28 }
.hero-illustration .tunduk-ring{ fill:none; stroke:#c43128; stroke-width:2 }
.hero-illustration .tunduk-cross{ stroke:#c43128; stroke-width:2 }
.hero-illustration .yurt-braid{
  fill:none; stroke:#4da3ff; stroke-width:3; stroke-linecap:round;
  stroke-dasharray: 6 10; opacity:.7
}

/* Мягкие анимации */
@keyframes floatX { from{ transform: translateX(0) } to{ transform: translateX(40px) } }
@keyframes upDown { 0%{ transform: translateY(0) } 50%{ transform: translateY(-4px) } 100%{ transform: translateY(0) } }
@keyframes sunPulse { 0%{ transform: scale(1) } 50%{ transform: scale(1.05) } 100%{ transform: scale(1) } }

.hero-illustration .cloud.c1{ animation: floatX 32s linear infinite alternate; }
.hero-illustration .cloud.c2{ animation: floatX 40s linear infinite alternate-reverse; }
.hero-illustration .sun{ transform-origin: 780px 70px; animation: sunPulse 9s ease-in-out infinite; }
.hero-illustration .yurt{ animation: upDown 6s ease-in-out infinite; }

/* Уважение к prefers-reduced-motion */
@media (prefers-reduced-motion: reduce){
  .hero-illustration .cloud, .hero-illustration .sun, .hero-illustration .yurt{ animation: none !important; }
  .ornament-top, .ornament-bottom, .hero::before{ animation: none !important; }
  .card, .lang-btn{ transition: none !important; }
}

/* ===== Мини-hero для post.html ===== */
.hero--post{
  position: relative;
  overflow: hidden;
  padding: 8px 0 0;
  background:
    radial-gradient(700px 220px at 5% -10%, rgba(77,163,255,.12), transparent 60%),
    radial-gradient(520px 200px at 95% 0%, rgba(142,232,135,.08), transparent 70%);
}
.hero--post::before{
  content:"";
  position:absolute; inset:-2px;
  opacity:.05;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><g fill='none' stroke='%23ffffff' stroke-width='2'><circle cx='60' cy='60' r='24'/><path d='M36 60h48M60 36v48'/></g></svg>");
  background-size:120px 120px;
  animation: drift 70s linear infinite;
  pointer-events:none;
}
.hero-illustration--mini{ height:140px; margin:0 auto; max-width:980px; filter: drop-shadow(0 8px 16px rgba(0,0,0,.25)); }
@media (max-width:640px){ .hero-illustration--mini{ height:120px } }

.hero-illustration--mini .sun{ fill:#ffd15c; opacity:.9 }
.hero-illustration--mini .mountain.far{ fill:#21304a }
.hero-illustration--mini .mountain.near{ fill:#2a3c5d }
.hero-illustration--mini .ground{ fill:#162234 }
.hero-illustration--mini .yurt-body{ fill:#eae6df; opacity:.95 }
.hero-illustration--mini .yurt-door{ fill:#9b5a28 }
.hero-illustration--mini .tunduk-ring{ fill:none; stroke:#c43128; stroke-width:2 }
.hero-illustration--mini .tunduk-cross{ stroke:#c43128; stroke-width:2 }
.hero-illustration--mini .yurt-braid{ fill:none; stroke:#4da3ff; stroke-width:3; stroke-linecap:round; stroke-dasharray:6 10; opacity:.7 }

/* ===== Этно-орнамент под заголовком статьи ===== */
.article h1::after{
  content:"";
  display:block;
  height:12px;
  margin-top:10px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='12' viewBox='0 0 120 12'><path d='M0 8c6-7 12 7 18 0s12 7 18 0 12 7 18 0 12 7 18 0 12 7 18 0 12-7 12-7v11H0Z' fill='%238ee887' fill-opacity='.18'/><path d='M0 6c6-7 12 7 18 0s12 7 18 0 12 7 18 0 12 7 18 0 12 7 18 0 12-7 12-7' fill='none' stroke='%234da3ff' stroke-opacity='.55'/></svg>");
  background-size:120px 12px;
  animation: ornament-shimmer 9s linear infinite;
  border-radius: 8px;
}
@keyframes ornament-shimmer{
  from{ background-position: 0 0; }
  to{ background-position: 120px 0; }
}

/* ===== Reveal-on-scroll ===== */
.reveal-up{ opacity:0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal-up.is-visible{ opacity:1; transform:none; }

/* ===== Page Transitions (View Transitions API) ===== */
.logo{ view-transition-name: logo; }
.hero h1{ view-transition-name: hero-title; }

@supports (view-transition-name: root){
  ::view-transition-old(root){ animation: vt-fade-out .3s ease both; }
  ::view-transition-new(root){ animation: vt-fade-in .32s ease both; }

  @keyframes vt-fade-out{ to{ opacity:0 } }
  @keyframes vt-fade-in{ from{ opacity:0 } to{ opacity:1 } }
}

/* Фолбэк классы */
.page-fade-enter{ opacity:0 }
.page-fade-enter-active{ opacity:1; transition: opacity .28s ease }
.page-fade-exit{ opacity:1 }
.page-fade-exit-active{ opacity:0; transition: opacity .22s ease }

/* ===== Ночной режим: мягкие звёзды ===== */
body.night{ background: linear-gradient(180deg,#080a0f 0%, #0b0e15 100%); }
body.night .night-sky{
  position: fixed; inset:0; pointer-events:none; z-index: 0;
  opacity:.23;
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #ffffff, rgba(255,255,255,0) 60%),
    radial-gradient(1.5px 1.5px at 32% 12%, #ffffff, rgba(255,255,255,0) 60%),
    radial-gradient(1.5px 1.5px at 52% 22%, #ffffff, rgba(255,255,255,0) 60%),
    radial-gradient(1.5px 1.5px at 72% 16%, #ffffff, rgba(255,255,255,0) 60%),
    radial-gradient(1.5px 1.5px at 88% 26%, #ffffff, rgba(255,255,255,0) 60%),
    radial-gradient(1.5px 1.5px at 20% 36%, #ffffff, rgba(255,255,255,0) 60%),
    radial-gradient(1.5px 1.5px at 40% 42%, #ffffff, rgba(255,255,255,0) 60%),
    radial-gradient(1.5px 1.5px at 64% 38%, #ffffff, rgba(255,255,255,0) 60%),
    radial-gradient(1.5px 1.5px at 84% 44%, #ffffff, rgba(255,255,255,0) 60%);
  animation: starsTwinkle 8s ease-in-out infinite alternate;
}
@keyframes starsTwinkle{
  0%{ opacity:.18; transform: translateY(0); }
  100%{ opacity:.28; transform: translateY(-60px); }
}

body.night .card{ box-shadow: 0 8px 26px rgba(0,0,0,.34); }
body.night .hero::before,
body.night .hero--post::before{ opacity:.07; }

@media (prefers-reduced-motion: reduce){
  body.night .night-sky{ animation:none !important; }
  .article h1::after{ animation:none !important; }
}
