/* Должок — лендинг этапа 1. Токены из docs/DESIGN.md, паттерны из docs/design/patterns.md. */

:root {
    /* Цвета */
    --paper: #F2E8D5;
    --surface: #FAF3E6;
    --paper-deep: #E7DAC2;
    --ink: #211D18;
    --ink-soft: #5C5346;
    --line: #CDBFA6;
    --line-strong: #A8987C;
    --primary: #1F4A44;
    --primary-pressed: #14332F;
    --primary-soft: #DCE5DF;
    --accent: #A63326;
    --accent-soft: #F0DCD4;
    --positive: #2A6B4C;
    --gold: #C08A3E;

    /* Форма и ритм */
    --radius-field: 6px;
    --radius-card: 10px;
    --radius-sheet: 16px;
    --tap-min: 44px;
    --page-mobile: 20px;
    --page-desktop: 24px;
    --content-max: 1120px;
    --text-max: 640px;

    /* Шрифты */
    --font-ui: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-heading: "Lora", Georgia, "Times New Roman", serif;
    --font-brand: "Ruslan Display", var(--font-heading);
}

/* Основа */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding-top: 64px;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1,
h2 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
    text-wrap: balance;
}

p {
    margin: 0;
}

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

a {
    color: var(--primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.wrap {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding-left: var(--page-desktop);
    padding-right: var(--page-desktop);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Кнопки */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tap-min);
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-card);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.btn-primary {
    background: var(--primary);
    color: var(--paper);
    min-height: 52px;
    padding: 0 24px;
    font-size: 16px;
}

.btn-primary:hover {
    background: var(--primary-pressed);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
}

.btn-ghost:hover {
    background: var(--primary-soft);
}

/* Шапка */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: 64px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 64px;
}

.logo {
    font-family: var(--font-brand);
    font-size: 26px;
    line-height: 1;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
}

.slogan {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.lang {
    flex: none;
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink-soft);
    white-space: nowrap;
}

.btn-header {
    font-size: 14px;
    padding: 0 12px;
}

.header-cta-short {
    display: none;
}

/* Hero */

.hero {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    align-items: center;
    gap: 48px;
    padding-top: 64px;
    padding-bottom: 56px;
}

.hero h1 {
    font-size: clamp(32px, 4.6vw, 56px);
    line-height: 1.06;
    max-width: 15ch;
}

.lead {
    margin-top: 24px;
    font-size: 18px;
    line-height: 1.55;
    max-width: 46ch;
}

.note {
    margin-top: 16px;
    font-size: 15px;
    color: var(--ink-soft);
    max-width: 46ch;
}

.hero-art {
    margin: 0;
}

.hero-art img {
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
}

/* Квиз */

.quiz {
    padding-top: 56px;
    padding-bottom: 56px;
    border-top: 1px solid var(--line);
    scroll-margin-top: 80px;
}

.quiz h2,
.scheme h2 {
    font-size: clamp(24px, 2.6vw, 30px);
    line-height: 1.2;
    max-width: 22ch;
}

.quiz-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

.card {
    position: relative;
    display: block;
    padding: 22px 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    cursor: pointer;
    box-shadow: 0 2px 0 rgba(33, 29, 24, 0.05);
    transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
}

.card:active {
    transform: translateY(0);
}

.card:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.card.is-selected,
.card:has(input:checked) {
    background: var(--primary-soft);
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.card {
    display: grid;
    grid-template-columns: 112px 1fr;
    column-gap: 18px;
    align-items: center;
}

.card-img {
    grid-row: 1 / span 2;
    width: 112px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--line);
}

.card-title {
    display: block;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.35;
    padding-right: 28px;
}

.card-text {
    display: block;
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--ink-soft);
    max-width: 42ch;
}

.card-stamp {
    position: absolute;
    top: 12px;
    right: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 3px;
    background: var(--accent);
    color: var(--paper);
    font-size: 12px;
    line-height: 1;
    transform: rotate(-6deg);
}

.card.is-selected .card-stamp,
.card:has(input:checked) .card-stamp {
    display: flex;
}

.quiz-more {
    margin-top: 20px;
    padding: 22px 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    max-width: 72ch;
}

.quiz-more[hidden],
.detail[hidden] {
    display: none;
}

.detail h3 {
    font-size: 18px;
    line-height: 1.3;
}

.benefits {
    margin: 12px 0 0;
    padding-left: 20px;
    line-height: 1.55;
}

.benefits li + li {
    margin-top: 6px;
}

.more-lead {
    margin-top: 20px;
    font-size: 14px;
    color: var(--ink-soft);
}

.more-list {
    margin: 6px 0 0;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink-soft);
}

/* Как устроено */

.scheme {
    padding-top: 56px;
    padding-bottom: 56px;
    border-top: 1px solid var(--line);
}

.scheme-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
}

.scheme-list li {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 14px;
    align-items: start;
}

.scheme-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
}

.scheme-list p {
    font-size: 15px;
    line-height: 1.5;
    padding-top: 4px;
}

/* Форма контакта */

.contact {
    padding-top: 64px;
    padding-bottom: 72px;
    border-top: 1px solid var(--line);
    scroll-margin-top: 80px;
}

.contact-card {
    max-width: var(--text-max);
    margin: 0 auto;
    padding: clamp(24px, 4vw, 40px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: 0 2px 0 rgba(33, 29, 24, 0.05);
}

.contact-card h2 {
    font-size: clamp(26px, 3vw, 34px);
    line-height: 1.15;
}

.contact-card > p {
    margin-top: 12px;
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
}

.contact-card.is-done .contact-intro {
    display: none;
}

.contact-card.is-done .success-text {
    margin-top: 12px;
}

.contact-form {
    margin-top: 24px;
}

.field label {
    display: block;
    font-size: 13px;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    height: 52px;
    padding: 0 14px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-field);
    color: var(--ink);
    font-family: inherit;
    font-size: 16px;
}

.field input::placeholder {
    color: var(--ink-soft);
    opacity: 0.8;
}

.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.field input.is-invalid {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.field-error {
    margin-top: 6px;
    font-size: 13px;
    color: var(--accent);
}

.contact-form .btn-primary {
    width: 100%;
    margin-top: 16px;
}

.form-note {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--ink-soft);
}

.success {
    margin-top: 16px;
}

.success-text {
    font-size: 17px;
    line-height: 1.5;
    max-width: 48ch;
}

.success .form-note {
    margin-top: 10px;
}

/* Подвал */

.site-footer {
    border-top: 1px solid var(--line);
    padding-top: 24px;
    padding-bottom: 40px;
}

.footer-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.site-footer p {
    flex: 1 1 auto;
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink-soft);
    max-width: 72ch;
}

/* Политика */

.legal {
    padding-top: 48px;
    padding-bottom: 64px;
    max-width: 720px;
}

.legal h1 {
    font-size: clamp(28px, 3.4vw, 40px);
    line-height: 1.15;
}

.legal h2 {
    margin-top: 32px;
    font-size: 20px;
}

.legal p {
    margin-top: 10px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
}

.legal-draft {
    margin-top: 16px !important;
    padding: 12px 14px;
    background: var(--accent-soft);
    border-radius: var(--radius-card);
    font-size: 14px !important;
    color: var(--accent) !important;
}

.legal-back {
    margin-top: 40px !important;
}


/* Адаптив */

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .hero h1 {
        max-width: 20ch;
    }

    .hero-art {
        display: none;
    }

    .slogan {
        display: none;
    }

    .header-cta-full {
        display: none;
    }

    .header-cta-short {
        display: inline;
    }
}

@media (max-width: 720px) {
    .quiz-cards {
        grid-template-columns: 1fr;
    }

    .scheme-list {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .quiz,
    .scheme {
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .contact {
        padding-top: 40px;
        padding-bottom: 48px;
    }
}

@media (max-width: 520px) {
    .wrap {
        padding-left: var(--page-mobile);
        padding-right: var(--page-mobile);
    }

    .logo {
        font-size: 22px;
    }

    .header-actions {
        gap: 4px;
    }

    .footer-inner {
        gap: 12px;
    }

    .lang {
        font-size: 12px;
    }

    .card {
        padding: 18px 20px;
    }

    .lead {
        font-size: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }

    .card:hover {
        transform: none;
    }
}

@media (max-width: 480px) {
    .card {
        grid-template-columns: 80px 1fr;
        column-gap: 14px;
    }

    .card-img {
        width: 80px;
        height: 64px;
    }
}

/* Тёмная тема: ночные токены из DESIGN.md. Включается системной темой или кнопкой (html[data-theme]) */

.only-dark {
    display: none;
}

html[data-theme="dark"] {
    --paper: #141A18;
    --surface: #1C2422;
    --paper-deep: #243029;
    --ink: #F0E6D2;
    --ink-soft: #B3A894;
    --line: #3A453F;
    --line-strong: #5A685F;
    --primary: #7FB5A9;
    --primary-pressed: #9CC8BD;
    --primary-soft: #243029;
    --accent: #E0766A;
    --accent-soft: #3A2622;
    --positive: #6FBD97;
    color-scheme: dark;
}

html[data-theme="dark"] .only-light {
    display: none;
}

html[data-theme="dark"] .only-dark {
    display: inline;
}

html[data-theme="dark"] .hero-art .only-dark {
    display: block;
}

html[data-theme="dark"] .logo-mark {
    box-shadow: 0 0 0 1px var(--line);
}

html[data-theme="dark"] .card-img {
    filter: brightness(0.88);
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        --paper: #141A18;
        --surface: #1C2422;
        --paper-deep: #243029;
        --ink: #F0E6D2;
        --ink-soft: #B3A894;
        --line: #3A453F;
        --line-strong: #5A685F;
        --primary: #7FB5A9;
        --primary-pressed: #9CC8BD;
        --primary-soft: #243029;
        --accent: #E0766A;
        --accent-soft: #3A2622;
        --positive: #6FBD97;
        color-scheme: dark;
    }

    html:not([data-theme="light"]) .only-light {
        display: none;
    }

    html:not([data-theme="light"]) .only-dark {
        display: inline;
    }

    html:not([data-theme="light"]) .hero-art .only-dark {
        display: block;
    }

    html:not([data-theme="light"]) .logo-mark {
        box-shadow: 0 0 0 1px var(--line);
    }

    html:not([data-theme="light"]) .card-img {
        filter: brightness(0.88);
    }
}

/* Кнопка темы */

.theme-toggle {
    flex: none;
    width: 44px;
    height: 44px;
    padding: 4px;
    background: transparent;
    border: 0;
    border-radius: var(--radius-card);
    cursor: pointer;
}

.theme-toggle img {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.theme-toggle:hover img {
    transform: rotate(-8deg);
}

.theme-toggle img {
    transition: transform 160ms ease;
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle img {
        transition: none;
    }
}

.quiz-more > .btn {
    margin-top: 20px;
}

.card-title b {
    font-weight: 700;
}
