/* =========================================================
   Дизайн-система «тетрадь в клетку»
   ========================================================= */
:root {
    --ink:      #14243F;
    --ink-2:    #2E4166;
    --muted:    #43546E;
    --paper:    #F6F7FB;
    --paper-2:  #EDF0F7;
    --grid:     #E1E6F1;
    --line:     #D8DEEC;
    --blue:     #2F5BEA;
    --blue-dk:  #1E42C0;
    --marker:   #FFD24C;
    --physics:  #0E9E9C;
    --white:    #FFFFFF;
    --shadow:   0 18px 44px -20px rgba(20,36,63,.35);
    --shadow-sm:0 6px 20px -10px rgba(20,36,63,.3);
    --radius:   18px;
    --wrap:     1120px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Manrope', system-ui, sans-serif;
    color: var(--ink);
    background-color: var(--paper);
    /* Фон — клетчатая бумага */
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 28px 28px;
    line-height: 1.6;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.wrap--narrow { max-width: 720px; }

/* --- Маркер-выделитель (фирменный элемент) --- */
mark {
    background: transparent;
    color: inherit;
    position: relative;
    white-space: nowrap;
}
mark::before {
    content: "";
    position: absolute;
    left: -4px; right: -4px;
    bottom: 4px;
    height: 42%;
    background: var(--marker);
    transform: rotate(-1.2deg);
    z-index: -1;
    border-radius: 3px;
}

.eyebrow {
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: 12px;
    color: var(--blue);
    font-weight: 500;
    margin-bottom: 14px;
}
.eyebrow--center { text-align: center; }

/* =========================================================
   Кнопки
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-weight: 700;
    font-size: 16px;
    padding: 15px 26px;
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--blue); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--blue-dk); box-shadow: var(--shadow); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }

/* =========================================================
   Заголовок внутренней страницы
   ========================================================= */
.page-head { padding: 64px 0 40px; text-align: center; }
.page-head .eyebrow { text-align: center; }
.page-head__title {
    font-family: 'Unbounded', sans-serif; font-weight: 700;
    font-size: clamp(30px, 4.4vw, 48px); line-height: 1.1; margin-bottom: 18px;
}
.page-head__lead { color: var(--ink-2); max-width: 40em; margin: 0 auto; font-size: 18px; }

/* Блок-призыв + кнопки-переходы */
.cta-block { text-align: center; }
.cta-block__actions,
.about__cta { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 22px; }
.about__cta { justify-content: flex-start; margin-top: 26px; }

/* =========================================================
   Шапка
   ========================================================= */
.nav {
    position: sticky; top: 0; z-index: 50;
    background: rgba(246,247,251,.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; }
.brand__mark {
    display: grid; place-items: center;
    width: 34px; height: 34px;
    background: var(--ink); color: var(--marker);
    border-radius: 9px;
    font-family: 'JetBrains Mono', monospace; font-size: 20px;
}
.brand__name { font-size: 16px; }
.nav__links { display: flex; align-items: center; gap: 28px; }
.nav__links a { text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 15px; transition: color .15s; }
.nav__links a:hover { color: var(--blue); }
.nav__links a.is-active { color: var(--blue); }
.nav__links a.is-active::after {
    content: ""; display: block; height: 2px; margin-top: 4px;
    background: var(--marker); border-radius: 2px;
}
.nav__cta { background: var(--ink); color: #fff !important; padding: 9px 18px; border-radius: 10px; }
.nav__cta:hover { background: var(--blue); }
.nav__burger { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav__burger span { width: 24px; height: 2px; background: var(--ink); border-radius: 2px; }

/* =========================================================
   Герой
   ========================================================= */
.hero { padding: 72px 0 84px; overflow: hidden; }
.hero__inner { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; }
.hero__title {
    font-family: 'Unbounded', sans-serif;
    font-weight: 700;
    font-size: clamp(30px, 4.6vw, 52px);
    line-height: 1.08;
    letter-spacing: -.01em;
    margin-bottom: 22px;
}
.hero__lead { font-size: 19px; color: var(--ink-2); max-width: 30em; margin-bottom: 30px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 40px; }
.hero__stats { list-style: none; display: flex; gap: 36px; }
.hero__stats li { display: flex; flex-direction: column; }
.hero__stats b { font-family: 'JetBrains Mono', monospace; font-size: 30px; color: var(--ink); line-height: 1; }
.hero__stats span { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }

.hero__card { position: relative; }
.photo-card {
    position: relative;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    transform: rotate(1.5deg);
}
.photo-card__img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 12px; display: block; }
.photo-card__placeholder {
    width: 100%; aspect-ratio: 4/5; border-radius: 12px;
    display: grid; place-items: center; text-align: center;
    background:
        linear-gradient(135deg, var(--paper-2), #fff);
    border: 2px dashed var(--line);
    color: var(--muted); font-weight: 600;
}
.photo-card__placeholder small { font-weight: 400; font-size: 13px; }
.photo-card__tag {
    position: absolute; bottom: 26px; left: -14px;
    background: var(--ink); color: var(--marker);
    font-family: 'JetBrains Mono', monospace; font-size: 13px;
    padding: 8px 14px; border-radius: 10px;
    box-shadow: var(--shadow-sm);
}
.formula-note {
    position: absolute; top: -18px; right: -10px;
    background: var(--marker); color: var(--ink);
    font-family: 'JetBrains Mono', monospace; font-weight: 700;
    padding: 8px 14px; border-radius: 10px;
    transform: rotate(-6deg); box-shadow: var(--shadow-sm);
}
.formula-note--2 { top: auto; bottom: -14px; right: auto; left: -22px; background: var(--white); border: 1px solid var(--line); transform: rotate(4deg); color: var(--blue); }

/* =========================================================
   Секции
   ========================================================= */
.section { padding: 88px 0; }
.section--alt {
    background: var(--paper-2);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 28px 28px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.section__title {
    font-family: 'Unbounded', sans-serif;
    font-weight: 700;
    font-size: clamp(26px, 3.4vw, 40px);
    text-align: center;
    margin-bottom: 18px;
}
.section__lead { text-align: center; color: var(--ink-2); max-width: 40em; margin: 0 auto 46px; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* --- О репетиторе --- */
.about { display: grid; grid-template-columns: 340px 1fr; gap: 48px; align-items: start; margin-top: 40px; }
.about__photo img,
.about__photo-empty {
    width: 100%; aspect-ratio: 4/5; object-fit: cover;
    border-radius: var(--radius); border: 1px solid var(--line);
    box-shadow: var(--shadow); background: var(--white);
}
.about__photo-empty { display: grid; place-items: center; color: var(--muted); border: 2px dashed var(--line); }
.about__body h3 { font-size: 28px; font-family: 'Unbounded', sans-serif; }
.about__role { color: var(--blue); font-weight: 600; margin-bottom: 20px; }
.about__text { color: var(--ink-2); }
.about__contacts { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); font-weight: 600; }
.about__contacts a { color: var(--blue); text-decoration: none; }

/* --- Видеокурсы --- */
.courses { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.course {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column;
    transition: transform .2s, box-shadow .2s;
}
.course:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.course__media { aspect-ratio: 16/9; background: #000; }
.course__media iframe { width: 100%; height: 100%; border: 0; display: block; }
.course__body { padding: 20px; }
.tag {
    display: inline-block; font-family: 'JetBrains Mono', monospace;
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    padding: 4px 10px; border-radius: 6px; margin-bottom: 12px; font-weight: 500;
}
.tag--math { background: rgba(47,91,234,.12); color: var(--blue-dk); }
.tag--physics { background: rgba(14,158,156,.14); color: var(--physics); }
.course__title { font-size: 19px; margin-bottom: 8px; }
.course__desc { color: var(--muted); font-size: 15px; }

/* =========================================================
   Тренажёр ОГЭ
   ========================================================= */
.trainer {
    max-width: 720px; margin: 0 auto;
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 40px;
}
.trainer__start { text-align: center; }
.trainer__icon {
    width: 64px; height: 64px; margin: 0 auto 18px;
    display: grid; place-items: center;
    background: var(--marker); border-radius: 16px;
    font-size: 30px; transform: rotate(-4deg);
}
.trainer__start p { margin-bottom: 22px; font-size: 18px; color: var(--ink-2); }

.quiz__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 10px; }
.quiz__title { font-size: 20px; font-weight: 800; }
.quiz__counter { font-family: 'JetBrains Mono', monospace; color: var(--muted); font-size: 14px; }
.quiz__bar { height: 6px; background: var(--paper-2); border-radius: 6px; overflow: hidden; margin-bottom: 28px; }
.quiz__bar > span { display: block; height: 100%; background: var(--blue); width: 0; transition: width .3s; }

.question { border-top: 1px solid var(--line); padding: 22px 0; }
.question:first-of-type { border-top: 0; }
.question__num { font-family: 'JetBrains Mono', monospace; color: var(--blue); font-weight: 700; font-size: 14px; }
.question__text { font-size: 17px; font-weight: 600; margin: 6px 0 16px; }
.question__img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 16px; }

.options { display: grid; gap: 10px; }
.option {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 16px; border: 1px solid var(--line);
    border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s;
}
.option:hover { border-color: var(--blue); background: rgba(47,91,234,.04); }
.option input { accent-color: var(--blue); width: 18px; height: 18px; }
.option--correct { border-color: var(--physics); background: rgba(14,158,156,.09); }
.option--wrong { border-color: #E0483C; background: rgba(224,72,60,.08); }

.num-input {
    width: 100%; max-width: 260px; padding: 13px 16px;
    border: 1px solid var(--line); border-radius: 12px;
    font-family: 'JetBrains Mono', monospace; font-size: 16px;
}
.num-input:focus { outline: none; border-color: var(--blue); }

.answer-badge { display: inline-block; margin-top: 10px; font-size: 14px; font-family: 'JetBrains Mono', monospace; }
.answer-badge.ok { color: var(--physics); }
.answer-badge.no { color: #C63328; }

.quiz__foot { margin-top: 28px; display: flex; gap: 14px; flex-wrap: wrap; }

/* Результат */
.result { text-align: center; }
.result__score {
    font-family: 'JetBrains Mono', monospace; font-weight: 700;
    font-size: 56px; line-height: 1; color: var(--ink);
}
.result__ring {
    width: 150px; height: 150px; margin: 0 auto 22px;
    border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--blue) var(--p), var(--paper-2) 0);
}
.result__ring-inner { width: 118px; height: 118px; border-radius: 50%; background: var(--white); display: grid; place-items: center; }
.result__label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.result h3 { font-family: 'Unbounded', sans-serif; font-size: 24px; margin-bottom: 8px; }
.result p { color: var(--ink-2); margin-bottom: 24px; }

/* =========================================================
   Форма заявки
   ========================================================= */
.form { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; box-shadow: var(--shadow); }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 18px; }
.form label span { color: #E0483C; margin-left: 3px; }
.form input, .form textarea {
    width: 100%; margin-top: 8px; padding: 13px 15px;
    border: 1px solid var(--line); border-radius: 11px;
    font-family: inherit; font-size: 16px; font-weight: 400;
    background: var(--paper); color: var(--ink);
}
.form input:focus, .form textarea:focus { outline: none; border-color: var(--blue); background: #fff; }
.form textarea { resize: vertical; }
.hp { position: absolute; left: -9999px; }
.form__note { margin-top: 16px; text-align: center; font-weight: 600; }
.form__note.ok { color: var(--physics); }
.form__note.err { color: #C63328; }

/* =========================================================
   Подвал
   ========================================================= */
.footer { background: var(--ink); color: #C7D2E8; padding: 56px 0 26px; }
.footer__inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 24px; padding-bottom: 30px; border-bottom: 1px solid rgba(255,255,255,.12); }
.footer .brand--footer { color: #fff; font-size: 18px; margin-bottom: 8px; }
.footer__contacts { display: flex; flex-direction: column; gap: 6px; font-family: 'JetBrains Mono', monospace; font-size: 14px; }
.footer__bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 22px; font-size: 14px; color: #AEBBD6; flex-wrap: wrap; gap: 10px; }
.footer__bottom a { color: #AEBBD6; text-decoration: none; }
.footer__bottom a:hover { color: #fff; }

/* Навигация в подвале */
.footer__nav { display: flex; flex-direction: column; gap: 8px; }
.footer__nav a { color: #C7D2E8; text-decoration: none; font-size: 15px; }
.footer__nav a:hover { color: #fff; }

/* =========================================================
   Адаптив
   ========================================================= */
@media (max-width: 900px) {
    .hero__inner { grid-template-columns: 1fr; gap: 40px; }
    .hero__card { max-width: 380px; }
    .about { grid-template-columns: 1fr; }
    .about__photo { max-width: 300px; }
    .courses { grid-template-columns: repeat(2, 1fr); }
    .nav__links { display: none; }
    .nav__links.open {
        display: flex; flex-direction: column; align-items: flex-start;
        position: absolute; top: 68px; left: 0; right: 0;
        background: var(--paper); border-bottom: 1px solid var(--line);
        padding: 18px 24px; gap: 16px;
    }
    .nav__burger { display: flex; }
}
@media (max-width: 560px) {
    body { font-size: 16px; }
    .section { padding: 60px 0; }
    .hero { padding: 44px 0 60px; }
    .courses { grid-template-columns: 1fr; }
    .form__row { grid-template-columns: 1fr; }
    .trainer { padding: 24px; }
    .hero__stats { gap: 22px; }
    .form { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto; transition: none !important; }
}
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
