/*
 * Ландинг хуудасны загвар — /landing
 *
 * Нэг л (цайвар) горим: нэвтрэх хуудастай ижил цагаан суурь, бэхэн бичвэр.
 * Нэг тод өнгө — шунхан улаан тамга (朱砂). Алтан гишүүний хэсэг шөнийн
 * дэвсгэр (#0b1220 — PWA-ийн theme_color) дээр алтан өнгөөр.
 *
 * Фонт: Manrope (кирилл дэмжинэ) гарчиг/бичвэр, Noto Serif SC том ханзад.
 */

:root {
    --paper:   #fbfaf7;
    --white:   #ffffff;
    --ink:     #12141a;
    --body:    #3a3f4b;
    --soft:    #6b7280;
    --line:    #e7e4dd;
    --line-2:  #cfcac0;
    --seal:    #c1272d;
    --seal-2:  #a31f24;
    --seal-bg: #fbeeec;
    --gold:    #e2b33c;
    --gold-2:  #f3d27a;
    --night:   #0b1220;
    --night-2: #141d33;
    --night-line: #22304d;
    --ok:      #1f7a3a;
    --inv-bg:  #12141a;   /* бэхэн товч, чип: дэвсгэр */
    --inv-fg:  #ffffff;   /*                бичвэр    */
    --inv-hover: #262a35;
    --top-bg:  rgba(251, 250, 247, .9);
    --foot-bg: #12141a;
    --foot-fg: #b9bfcc;
    --foot-dim: #8f97a8;
    --shadow:  rgba(18, 20, 26, .45);
    --radius:  16px;
    --font:    "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    --hanzi:   "Noto Serif SC", "Songti SC", "SimSun", serif;
    color-scheme: light;
}

/* Бараан горим — dashboard-тай ижил механизм: localStorage `dash_theme` →
   html[data-theme]; сонголтгүй бол системийнх. Дэвсгэр #0b1220 (апптай ижил). */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper:   #0b1220;
        --white:   #121a2b;
        --ink:     #f1f3f7;
        --body:    #c3cad8;
        --soft:    #8b95a8;
        --line:    #223050;
        --line-2:  #34456b;
        --seal:    #d9433f;
        --seal-2:  #c1272d;
        --seal-bg: rgba(217, 67, 63, .16);
        --night:   #060b16;
        --night-2: #121a2b;
        --night-line: #223050;
        --ok:      #4ade80;
        --inv-bg:  #f1f3f7;
        --inv-fg:  #0b1220;
        --inv-hover: #d9dee8;
        --top-bg:  rgba(11, 18, 32, .9);
        --foot-bg: #060b16;
        --foot-fg: #a7b0c2;
        --foot-dim: #6f7a90;
        --shadow:  rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --paper:   #0b1220;
    --white:   #121a2b;
    --ink:     #f1f3f7;
    --body:    #c3cad8;
    --soft:    #8b95a8;
    --line:    #223050;
    --line-2:  #34456b;
    --seal:    #d9433f;
    --seal-2:  #c1272d;
    --seal-bg: rgba(217, 67, 63, .16);
    --night:   #060b16;
    --night-2: #121a2b;
    --night-line: #223050;
    --ok:      #4ade80;
    --inv-bg:  #f1f3f7;
    --inv-fg:  #0b1220;
    --inv-hover: #d9dee8;
    --top-bg:  rgba(11, 18, 32, .9);
    --foot-bg: #060b16;
    --foot-fg: #a7b0c2;
    --foot-dim: #6f7a90;
    --shadow:  rgba(0, 0, 0, .6);
    color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.65;
    color: var(--body);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 {
    color: var(--ink);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    text-wrap: balance;
}

h1 { font-size: clamp(34px, 5.2vw, 60px); }
h2 { font-size: clamp(26px, 3.4vw, 40px); }
h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }

.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
.wrap-narrow { width: min(760px, 100% - 40px); }

.skip {
    position: absolute; left: -999px; top: 8px;
    background: var(--inv-bg); color: var(--inv-fg); padding: 8px 12px; border-radius: 8px; z-index: 99;
}
.skip:focus { left: 8px; }

:focus-visible { outline: 3px solid var(--seal); outline-offset: 3px; border-radius: 6px; }

/* ---------------------------------------------------------- товч */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
    border: 1.5px solid transparent;
    transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-lg { padding: 15px 28px; font-size: 16px; }
.btn-ink { background: var(--inv-bg); color: var(--inv-fg); }
.btn-ink:hover { background: var(--inv-hover); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--white); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-seal { background: var(--seal); color: #fff; box-shadow: 0 8px 24px -10px rgba(193, 39, 45, .6); }
.btn-seal:hover { background: var(--seal-2); }
.btn-gold { background: var(--gold); color: var(--night); }
.btn-gold:hover { background: var(--gold-2); }

/* ---------------------------------------------------------- толгой: лого + нэвтрэх маягт */

.top {
    position: sticky; top: 0; z-index: 50;
    background: var(--top-bg);
    backdrop-filter: saturate(160%) blur(10px);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 72px; padding-block: 10px; }
.logo img { width: 184px; height: auto; }

.hl { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hl-form { display: flex; align-items: center; gap: 8px; margin: 0; }
.hl-form input {
    width: 190px; height: 40px; padding: 0 12px;
    border: 1.5px solid var(--line); border-radius: 10px; background: var(--white);
    font: inherit; font-size: 14px; color: var(--ink);
    transition: border-color .15s;
}
.hl-form input::placeholder { color: var(--soft); }
.hl-form input:focus { outline: none; border-color: var(--ink); }
.hl-form .btn { height: 40px; padding-inline: 20px; }
.hl-sub { display: flex; align-items: center; gap: 14px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.hl-sub a { color: var(--seal); }
.hl-sub a:hover { text-decoration: underline; }
.hl-sub a.hl-reg { color: var(--ink); }
.hl-remember { display: inline-flex; align-items: center; gap: 6px; color: var(--soft); cursor: pointer; font-weight: 600; }
.hl-remember input { width: 15px; height: 15px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.hl-msg { display: none; color: var(--seal); }
.hl-msg.on { display: inline; }
.hl-msg.ok { color: var(--ok); }

.langs {
    display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--white);
}
.langs a { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--soft); }
.langs a.on { background: var(--inv-bg); color: var(--inv-fg); }

/* ---------------------------------------------------------- hero */

.hero { position: relative; overflow: hidden; padding-block: clamp(56px, 9vw, 120px) clamp(48px, 7vw, 96px); }
.hero-in { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(32px, 6vw, 80px); align-items: center; }

.eyebrow {
    display: inline-block;
    font-size: 12.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
    color: var(--seal); margin-bottom: 18px;
}
.eyebrow-gold { color: var(--gold); letter-spacing: 0; font-size: 22px; }

.lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--body); max-width: 40em; }
.hero-copy .lead { margin-top: 20px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-note { margin-top: 18px; font-size: 13.5px; color: var(--soft); }

.hero-art { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hero-img { border-radius: var(--radius); box-shadow: 0 30px 60px -30px var(--shadow); }

/* Тамга: улаан дөрвөлжин, дотор нь цагаан ханз, бага зэрэг хазайсан */
.seal {
    width: clamp(220px, 26vw, 320px); aspect-ratio: 1;
    background: var(--seal);
    border-radius: 18px;
    display: grid; place-items: center;
    transform: rotate(-4deg);
    box-shadow: 0 40px 80px -36px rgba(193, 39, 45, .75), inset 0 0 0 6px rgba(255, 255, 255, .12), inset 0 0 0 9px var(--seal);
    position: relative;
}
.seal::after {
    content: ""; position: absolute; inset: 14px; border: 2px solid rgba(255, 255, 255, .35); border-radius: 10px;
}
.seal-hanzi {
    font-family: var(--hanzi); font-weight: 700; color: #fff;
    font-size: clamp(140px, 17vw, 210px); line-height: 1; transform: rotate(4deg);
}
.seal-pinyin { margin-top: 26px; font-size: 14px; letter-spacing: .08em; color: var(--soft); text-transform: uppercase; font-weight: 700; }

/* ---------------------------------------------------------- тоо баримт */

.stats { border-block: 1px solid var(--line); background: var(--white); padding-block: 34px; }
.stats-title { font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--soft); text-align: center; margin-bottom: 20px; }
.stats-row { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 44px; }
.stats-row li { display: flex; flex-direction: column; align-items: center; min-width: 120px; }
.stats-row .num { font-size: clamp(26px, 3vw, 36px); font-weight: 800; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stats-row span { font-size: 13.5px; color: var(--soft); margin-top: 4px; }

/* ---------------------------------------------------------- хэсгүүд */

.sec { padding-block: clamp(56px, 8vw, 104px); }
.sec-head { max-width: 640px; margin-bottom: clamp(28px, 4vw, 48px); }
.sec-head p { margin-top: 12px; font-size: 17.5px; color: var(--soft); }

/* Сонсох · Унших · Бичих */
.pillars { background: var(--white); border-bottom: 1px solid var(--line); }
.pillar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pillar {
    position: relative; overflow: hidden;
    padding: 30px 26px 28px;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color .2s, transform .2s;
}
.pillar:hover { border-color: var(--seal); transform: translateY(-2px); }
.pillar-hanzi {
    display: block; font-family: var(--hanzi); font-weight: 700;
    font-size: 64px; line-height: 1; color: var(--seal); margin-bottom: 18px;
}
.pillar::before {
    content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px;
    border-radius: 50%; background: var(--seal-bg); z-index: 0;
}
.pillar > * { position: relative; z-index: 1; }
.pillar p { margin-top: 10px; font-size: 15.5px; }

/* Боломжууд */
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feat { padding: 26px 24px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.feat-icon { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--seal-bg); font-size: 22px; margin-bottom: 16px; }
.feat p { margin-top: 8px; font-size: 15.5px; }

/* Яагаад Learby — хайлтын системд зориулсан бичвэрийн хэсэг */
.about { background: var(--paper); }
.about-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 40px; }
.about-item { padding-left: 18px; border-left: 3px solid var(--seal); }
.about-item p { margin-top: 6px; font-size: 16px; }
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } }

/* Алхмууд — жинхэнэ дараалал тул дугаарласан */
.steps { background: var(--white); border-block: 1px solid var(--line); }
.step-list { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; counter-reset: none; }
.step-list li { display: flex; gap: 18px; align-items: flex-start; }
.step-n {
    flex: none; width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--inv-bg); color: var(--inv-fg); font-weight: 800; font-size: 17px;
}
.step-list p { margin-top: 6px; font-size: 15.5px; }

/* Алтан гишүүн */
.gold { background: var(--night); color: #c8cfdd; }
.gold h2 { color: #fff; }
.gold .lead { color: #aab3c5; margin-top: 12px; }
.gold-in { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.gold-copy .btn { margin-top: 28px; }
.gold-list { list-style: none; display: grid; gap: 12px; }
.gold-list li {
    padding: 16px 18px 16px 50px; position: relative;
    background: var(--night-2); border: 1px solid var(--night-line); border-radius: 12px;
    color: #e8ecf3; font-weight: 500;
}
.gold-list li::before {
    content: "✓"; position: absolute; left: 18px; top: 15px;
    width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
    background: var(--gold); color: var(--night); font-size: 13px; font-weight: 800;
}

/* Асуулт */
.faq-list { display: grid; gap: 10px; }
.faq-item { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 0 22px; }
.faq-item[open] { border-color: var(--line-2); }
.faq-item summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary h3 { font-size: 17px; }
.faq-x { flex: none; width: 22px; height: 22px; position: relative; }
.faq-x::before, .faq-x::after { content: ""; position: absolute; left: 50%; top: 50%; background: var(--ink); transform: translate(-50%, -50%); transition: transform .2s; }
.faq-x::before { width: 14px; height: 2px; }
.faq-x::after { width: 2px; height: 14px; }
.faq-item[open] .faq-x::after { transform: translate(-50%, -50%) rotate(90deg); }
.faq-item p { padding: 0 0 20px; font-size: 16px; max-width: 60ch; }

/* Дуудлага */
.cta { background: var(--white); border-top: 1px solid var(--line); }
.cta-in { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.cta .lead { max-width: 34em; }
.cta .btn { margin-top: 10px; }

/* ---------------------------------------------------------- хэл: хөлийн дээр */

.langbar { background: var(--white); border-top: 1px solid var(--line); padding-block: 22px; }
.langbar .wrap { display: flex; justify-content: center; }
.langs-lg { gap: 4px; padding: 4px; }
.langs-lg a { padding: 8px 18px; font-size: 14px; }

/* ---------------------------------------------------------- хөл */

.foot { background: var(--foot-bg); color: var(--foot-fg); padding-block: 36px; font-size: 14px; }
.foot-in { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.foot-brand { display: flex; gap: 10px; align-items: baseline; }
.foot-brand b { color: #fff; font-size: 16px; }
.foot-copy { color: var(--foot-dim); }
.foot-dev a { color: var(--gold-2); font-weight: 700; }
.foot-dev a:hover { text-decoration: underline; }

/* ---------------------------------------------------------- хөдөлгөөн */

.rv { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
.rv.in { opacity: 1; transform: none; }
.no-io .rv { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .rv { opacity: 1; transform: none; transition: none; }
    .btn { transition: none; }
}

/* ---------------------------------------------------------- гар утас */

@media (max-width: 960px) {
    .pillar-grid, .feat-grid, .step-list { grid-template-columns: 1fr 1fr; }
    .gold-in { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    body { font-size: 16px; }
    /* Толгой: форм үргэлж ил, лого дор бүтэн өргөнөөр; хуудас дагаж наалдахгүй */
    .top { position: static; background: var(--paper); backdrop-filter: none; -webkit-backdrop-filter: none; }
    .top-in { flex-direction: column; align-items: stretch; gap: 12px; padding-block: 14px; }
    .logo { align-self: center; }
    .logo img { width: 160px; }
    .hl { align-items: stretch; gap: 10px; }
    .hl-form { flex-direction: column; align-items: stretch; }
    .hl-form input { width: 100%; height: 44px; font-size: 16px; }
    .hl-form .btn { width: 100%; height: 44px; }
    .hl-sub { flex-wrap: wrap; justify-content: space-between; row-gap: 8px; font-size: 13.5px; }
    .hl-msg.on { width: 100%; text-align: center; }

    .hero-in { grid-template-columns: 1fr; text-align: center; }
    .hero-copy .lead { margin-inline: auto; }
    .hero-cta { justify-content: center; }
    .hero-art { order: -1; }
    .seal { width: clamp(150px, 42vw, 200px); border-radius: 14px; }
    .seal-hanzi { font-size: clamp(96px, 28vw, 130px); }
    .seal-pinyin { margin-top: 18px; margin-bottom: 8px; }

    .pillar-grid, .feat-grid, .step-list { grid-template-columns: 1fr; }
    .stats-row { gap: 16px 28px; }
    .stats-row li { min-width: 96px; }
}

/* ---------------------------------------------------------- цонхнууд: бүртгүүлэх, нууц үг сэргээх */

.modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    background: rgba(18, 20, 26, .55);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal[hidden] { display: none; }
.modal-card {
    position: relative;
    width: min(460px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
    background: var(--white); border-radius: 20px;
    padding: 28px 26px 24px;
    box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .5);
}
.modal-sm { width: min(400px, 100%); }
.modal-card h2 { font-size: 24px; padding-right: 36px; }
.modal-note { margin-top: 6px; color: var(--soft); font-size: 14.5px; }
.modal-x {
    position: absolute; top: 14px; right: 14px;
    width: 36px; height: 36px; border-radius: 50%; border: 0;
    background: var(--paper); color: var(--ink); font-size: 15px; cursor: pointer;
}
.modal-x:hover { background: var(--line); }
.modal-card form { margin-top: 18px; display: grid; gap: 12px; }
.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 700; color: var(--body); }
.f input {
    height: 44px; padding: 0 12px;
    border: 1.5px solid var(--line); border-radius: 10px; background: var(--white);
    font: inherit; font-size: 15px; color: var(--ink);
}
.f input:focus { outline: none; border-color: var(--ink); }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-msg { display: none; font-size: 13.5px; font-weight: 700; color: var(--seal); }
.modal-msg.on { display: block; }
.modal-msg.ok { color: var(--ok); }
.modal-submit { width: 100%; margin-top: 4px; }
.modal-foot { margin-top: 16px; font-size: 13.5px; color: var(--soft); text-align: center; }

.rg-avatar { display: flex; align-items: center; gap: 14px; }
.rg-av-btn {
    width: 72px; height: 72px; border-radius: 50%; flex: none; overflow: hidden;
    border: 2px dashed var(--line); background: var(--paper); color: var(--soft);
    display: grid; place-items: center; cursor: pointer; padding: 0;
}
.rg-av-btn img { width: 100%; height: 100%; object-fit: cover; }
.rg-av-btn.has { border-style: solid; border-color: var(--seal); }
.rg-avatar b { display: block; font-size: 13.5px; color: var(--ink); }
.rg-av-pick { display: inline-block; margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--seal); cursor: pointer; }
.rg-av-pick:hover { text-decoration: underline; }

body.modal-open { overflow: hidden; }

@media (max-width: 480px) {
    .modal { padding: 10px; align-items: flex-end; }
    .modal-card { border-radius: 18px; padding: 22px 18px 18px; max-height: calc(100vh - 20px); }
    .f2 { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------- бараан лого */

.logo .logo-d { display: none; }
:root[data-theme="dark"] .logo.has-dl .logo-l { display: none; }
:root[data-theme="dark"] .logo.has-dl .logo-d { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .logo.has-dl .logo-l { display: none; }
    :root:not([data-theme="light"]) .logo.has-dl .logo-d { display: block; }
}

/* ---------------------------------------------------------- горим солих товч — баруун доод буланд, үргэлж дагана */

.theme-fab {
    position: fixed; right: 18px; bottom: 18px; z-index: 90;
    width: 50px; height: 50px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--white); color: var(--ink);
    display: grid; place-items: center; cursor: pointer; padding: 0;
    box-shadow: 0 12px 30px -10px var(--shadow);
    transition: transform .15s ease, border-color .15s ease;
}
.theme-fab:hover { transform: translateY(-2px); border-color: var(--ink); }
.theme-fab svg { width: 22px; height: 22px; }
.theme-fab .i-moon { display: block; }
.theme-fab .i-sun { display: none; }
:root[data-theme="dark"] .theme-fab .i-moon { display: none; }
:root[data-theme="dark"] .theme-fab .i-sun { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-fab .i-moon { display: none; }
    :root:not([data-theme="light"]) .theme-fab .i-sun { display: block; }
}
@media (max-width: 480px) {
    .theme-fab { right: 14px; bottom: 14px; width: 46px; height: 46px; }
}
