/* ─────────────────────────────────────────────────────────────
   Палитра «рысь»: тёплая бумага, ржаво-рыжий акцент, глубокий графит.
   Все цвета — только через токены: тёмная тема переопределяет их одним
   блоком, а компоненты об этом ничего не знают.
   ───────────────────────────────────────────────────────────── */

:root {
    --bg: #fbfaf8;
    --surface: #ffffff;
    --surface-alt: #f4f1ec;
    --fg: #1c1a17;
    --muted: #6f6a62;
    --line: #e7e2d9;
    --accent: #b5561f;
    --accent-hover: #9a4718;
    --accent-soft: #f8ece4;
    --error: #a83224;
    --error-soft: #fbeae7;
    --ok-soft: #eef2e8;
    --warn-soft: #fdf3e2;
    --bar-high: #4e7a46;
    --bar-mid: #c98f2e;
    --bar-low: #a63d28;
    --radius: 12px;
    --maxw: 780px;
    --serif: Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #151412;
        --surface: #1d1b18;
        --surface-alt: #232019;
        --fg: #f0ece4;
        --muted: #a29b90;
        --line: #302c26;
        --accent: #e08243;
        --accent-hover: #f09a5e;
        --accent-soft: #2a2018;
        --error: #e8836f;
        --error-soft: #2e1c18;
        --ok-soft: #1c241b;
        --warn-soft: #2b2317;
        --bar-high: #6b9c5e;
        --bar-mid: #d2a247;
        --bar-low: #c05a41;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

main { max-width: var(--maxw); margin: 0 auto; padding: 32px 20px 80px; }

h1 { font-family: var(--serif); font-size: 38px; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 14px; }
h2 { font-family: var(--serif); font-size: 25px; margin: 44px 0 16px; }
h3 { font-size: 15px; margin: 22px 0 6px; color: var(--muted); font-weight: 600; }
p { margin: 0 0 14px; }
.lead { color: var(--muted); font-size: 18px; margin-bottom: 30px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 14px; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

/* ── Шапка ────────────────────────────────────────────────── */
.site-header {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    max-width: var(--maxw); margin: 0 auto; padding: 20px;
}
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--fg); }
.logo-mark { display: block; width: 46px; color: var(--accent); flex: none; }
.logo-mark svg { display: block; width: 100%; height: auto; }
.logo-text { font-family: var(--serif); font-size: 19px; font-weight: 700; line-height: 1.1; }
.logo-text span { display: block; font-family: inherit; font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.site-header nav { display: flex; gap: 20px; font-size: 15px; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover, .site-header nav a.current { color: var(--accent); }
.site-footer {
    max-width: var(--maxw); margin: 0 auto; padding: 24px 20px 40px;
    border-top: 1px solid var(--line); font-size: 14px; color: var(--muted);
}

/* ── Таблица рейтинга ─────────────────────────────────────── */
table.rating { width: 100%; border-collapse: collapse; }
table.rating th {
    text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); font-weight: 600; padding: 0 8px 10px; border-bottom: 1px solid var(--line);
}
table.rating td { padding: 16px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.rating tr:hover td { background: var(--surface-alt); }
table.rating a { font-weight: 600; text-decoration: none; }
table.rating a:hover { text-decoration: underline; }
table.rating .muted { font-size: 14px; }
table.rating .unit { display: block; }
td.rank { font-family: var(--serif); font-size: 20px; color: var(--muted); width: 34px; }
td.score { font-family: var(--serif); font-size: 24px; font-weight: 700; white-space: nowrap; }

/* ── Уведомления ──────────────────────────────────────────── */
.notice { padding: 16px 18px; border-radius: var(--radius); margin-bottom: 26px; }
.notice-ok { background: var(--ok-soft); }
.notice-error { background: var(--error-soft); color: var(--error); }
.warn { background: var(--warn-soft); padding: 12px 16px; border-radius: var(--radius); font-size: 15px; }

/* ── Анкета ───────────────────────────────────────────────── */
.survey .block { border: none; border-top: 1px solid var(--line); padding: 28px 0 8px; margin: 0 0 8px; }
.survey legend { font-family: var(--serif); font-size: 22px; font-weight: 700; padding: 0 10px 0 0; }

.question { margin: 0 0 30px; padding: 12px; border-radius: var(--radius); }
.question-title { font-weight: 600; margin: 0 0 10px; }
.question-title .num { color: var(--muted); font-weight: 400; margin-right: 6px; }

.options { display: flex; flex-direction: column; gap: 2px; }
.option {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 10px 14px; border-radius: 8px; cursor: pointer;
    border: 1px solid transparent;
}
.option:hover { background: var(--accent-soft); }
.option input { margin: 5px 0 0; flex: none; accent-color: var(--accent); }
.option-text { flex: 1; }
.option:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.option-skip { color: var(--muted); }

.has-error { background: var(--error-soft); }
span.error { display: block; color: var(--error); font-size: 14px; margin-top: 6px; }

.field { margin: 0 0 20px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field select, .field input[type=text], .field input[type=date], .field textarea {
    width: 100%; padding: 11px 13px; font: inherit; color: inherit;
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.field select:focus, .field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field textarea { resize: vertical; }

.nps { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 8px; }
.nps-item input { position: absolute; opacity: 0; }
.nps-item span {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 8px;
    cursor: pointer; background: var(--surface);
}
.nps-item:hover span { border-color: var(--accent); }
.nps-item input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.nps-item input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.nps-legend { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 26px; }

.submit-row { display: flex; align-items: center; gap: 18px; padding-top: 14px; }
button[type=submit], .button {
    display: inline-block; font: inherit; font-weight: 600; color: #fff; background: var(--accent);
    border: none; border-radius: 8px; padding: 14px 26px; cursor: pointer; text-decoration: none;
}
button[type=submit]:hover, .button:hover { background: var(--accent-hover); color: #fff; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ── Карточка коворкинга ──────────────────────────────────── */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }

.summary { display: flex; gap: 12px; margin: 28px 0 10px; }
.summary-item {
    flex: 1; padding: 20px; text-align: center;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.summary-item .big { font-family: var(--serif); font-size: 40px; font-weight: 700; line-height: 1.05; }
.summary-item .muted { font-size: 13px; }

.block-row { display: flex; align-items: center; gap: 16px; padding: 10px 0; }
.block-name { flex: 0 0 235px; font-size: 15px; }
.block-name .muted { font-size: 12px; display: block; }
.block-bar { flex: 1; height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.block-bar .muted { font-size: 12px; line-height: 10px; }
.bar { height: 100%; border-radius: 999px; }
.bar-high { background: var(--bar-high); }
.bar-mid { background: var(--bar-mid); }
.bar-low { background: var(--bar-low); }
.block-score { flex: 0 0 40px; text-align: right; font-weight: 700; font-family: var(--serif); }

.criteria-details { border-bottom: 1px solid var(--line); }
.criteria-details > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 10px 0; }
table.criteria { width: 100%; border-collapse: collapse; }
table.criteria td { padding: 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.criteria-verdict { font-size: 14px; margin-top: 2px; }
.criteria-score { text-align: right; white-space: nowrap; font-weight: 700; padding-left: 16px; font-family: var(--serif); }
.criteria-score .muted { font-size: 12px; font-weight: 400; font-family: inherit; }

.info-block { background: var(--surface-alt); padding: 18px 20px; border-radius: var(--radius); line-height: 1.75; }

.comment { margin: 0 0 16px; padding: 16px 20px; border-left: 3px solid var(--accent); background: var(--surface-alt); border-radius: 0 var(--radius) var(--radius) 0; }
.comment p { margin: 0 0 8px; }
.comment footer { font-size: 13px; color: var(--muted); }

.cta { display: flex; align-items: center; gap: 22px; margin: 44px 0 0; flex-wrap: wrap; }

/* ── Методология ──────────────────────────────────────────── */
.method-steps { padding-left: 22px; }
.method-steps li { margin-bottom: 10px; }
.scale { padding-left: 24px; margin: 6px 0 16px; }
.scale li { padding: 3px 0; }

@media (max-width: 640px) {
    body { font-size: 16px; }
    h1 { font-size: 30px; }
    h2 { font-size: 22px; }
    main { padding-top: 20px; }
    .summary { flex-direction: column; }

    /* Блоки карточки: название и балл в строку, полоска под ними во всю ширину.
       Так семь блоков занимают вдвое меньше экрана и читаются одним взглядом. */
    .block-row {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "name score"
            "bar  bar";
        column-gap: 12px; row-gap: 7px;
        padding: 9px 0;
    }
    .block-name { grid-area: name; flex: none; }
    .block-bar { grid-area: bar; flex: none; }
    .block-score { grid-area: score; flex: none; }

    /* Шапка: логотип чуть мельче, иначе на телефоне съедает четверть экрана */
    .logo-mark { width: 38px; }
    .site-header { padding: 16px 20px; gap: 10px; }
    .nps-item span { width: 42px; height: 42px; }
    .site-header { flex-direction: column; align-items: flex-start; gap: 14px; }
    /* Таблица из шести колонок в 375px не влезает — правые столбцы уезжали за край.
       На узких экранах строка становится карточкой с жёсткой сеткой: если пустить
       колонки по потоку, у коротких названий метро подскакивает на строку с именем
       и выравнивание пляшет от строки к строке. Подписи берутся из data-label. */
    table.rating thead { display: none; }
    table.rating, table.rating tbody, table.rating td { display: block; }
    table.rating tr {
        display: grid;
        grid-template-columns: 22px 1fr auto;
        grid-template-areas:
            "rank name  score"
            ".    metro metro"
            ".    rec   cnt";
        column-gap: 10px;
        row-gap: 2px;
        padding: 16px 0;
        border-bottom: 1px solid var(--line);
    }
    table.rating tr:hover td { background: none; }
    table.rating td { border: none; padding: 0; }

    table.rating td.rank { grid-area: rank; font-size: 16px; line-height: 1.6; }
    table.rating td:nth-child(2) { grid-area: name; }
    table.rating td:nth-child(3) { grid-area: metro; }
    table.rating td.score { grid-area: score; font-size: 26px; line-height: 1.1; }
    table.rating td:nth-child(5) { grid-area: rec; }
    table.rating td:nth-child(6) { grid-area: cnt; text-align: right; }

    /* метро, рекомендуют, оценок — мелкой строкой с подписью из data-label */
    table.rating td:nth-child(3),
    table.rating td:nth-child(5),
    table.rating td:nth-child(6) {
        font-size: 14px; font-family: inherit; font-weight: 400; margin-top: 4px;
    }
    table.rating td:nth-child(3)::before,
    table.rating td:nth-child(5)::before,
    table.rating td:nth-child(6)::before {
        content: attr(data-label) " ";
        color: var(--muted);
    }
    table.rating .unit { display: inline; font-size: 13px; margin-left: 4px; }
    .submit-row { flex-wrap: wrap; gap: 12px; }
    .submit-row button[type=submit] { width: 100%; }
}
