:root {
    --bg: #f4f1ea;
    --paper: #fffdf8;
    --ink: #16140f;
    --muted: #6b665c;
    --line: #d9d3c5;
    --grid: rgba(22, 20, 15, 0.05);
    --accent: #ff5a1f;
    --accent-soft: #ffe4d6;
    --ok: #1f8a5b;
    --danger: #c2261b;
    --border: 1.5px solid var(--ink);
    --shadow: 6px 6px 0 var(--ink);
    --shadow-sm: 3px 3px 0 var(--ink);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
        Arial, sans-serif;
    --font-display: "Iowan Old Style", "Palatino Linotype", Palatino,
        "Book Antiqua", Georgia, serif;
    --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono",
        monospace;
}

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

html {
    min-height: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    color: var(--ink);
    background-color: var(--bg);
    /* Тонкая «миллиметровка» вместо анимированного фона */
    background-image: linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 32px 32px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 32px 24px;
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    overflow-x: hidden;
    overflow-wrap: break-word;
}

::selection {
    background: var(--accent);
    color: var(--ink);
}

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

/* ── Каркас ────────────────────────────────────────────────────── */
.shell {
    width: min(1040px, 100%);
    margin: auto;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    background: var(--paper);
    border: var(--border);
    box-shadow: var(--shadow);
}

/* ── Левая колонка ─────────────────────────────────────────────── */
.hero {
    min-width: 0;
    padding: 44px 44px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand__mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    color: var(--ink);
    background: var(--accent);
    border: var(--border);
    box-shadow: var(--shadow-sm);
}

.brand__mark svg {
    width: 22px;
    height: 22px;
}

.brand__name {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.hero__tag,
.tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 5px 10px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    background: var(--accent-soft);
    border: var(--border);
}

.hero__tag::before,
.tag::before {
    content: "";
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
}

.hero__title {
    font-family: var(--font-display);
    font-size: clamp(32px, 4.4vw, 48px);
    line-height: 1.02;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hero__title em {
    font-style: italic;
    color: var(--accent);
}

.hero__lead {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.6;
    max-width: 44ch;
}

.features {
    list-style: none;
    display: flex;
    flex-direction: column;
    margin-top: auto;
    border-top: 1px solid var(--line);
}

.features__item {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.features__icon {
    flex: none;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
}

.features__item strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
}

.features__item span:not(.features__icon) {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 13.5px;
}

.hero__links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero__link {
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    background: var(--paper);
    border: var(--border);
    transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.hero__link:hover {
    background: var(--accent-soft);
    box-shadow: var(--shadow-sm);
    transform: translate(-2px, -2px);
}

/* ── Правая колонка (форма) ────────────────────────────────────── */
.auth {
    min-width: 0;
    padding: 44px;
    display: grid;
    place-items: center;
    background: var(--bg);
}

.auth__card {
    width: 100%;
    max-width: 360px;
}

.auth__head h2 {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.auth__head p {
    color: var(--muted);
    font-size: 14.5px;
    margin-top: 6px;
}

.form {
    margin-top: 26px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field__label {
    display: block;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

.field__wrap {
    position: relative;
}

.field__input {
    width: 100%;
    padding: 13px 14px;
    font-family: inherit;
    font-size: 15px;
    color: var(--ink);
    background: var(--paper);
    border: var(--border);
    border-radius: 0;
    outline: none;
    transition: box-shadow 0.15s, transform 0.15s;
}

.field__wrap .field__input {
    padding-right: 48px;
}

.field__input::placeholder {
    color: #a8a295;
}

.field__input:focus {
    box-shadow: 4px 4px 0 var(--accent);
    transform: translate(-2px, -2px);
}

.field__toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    color: inherit;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.field__input:focus + .field__toggle {
    transform: translate(-2px, calc(-50% - 2px));
}

.field__toggle:hover,
.field__toggle.is-active {
    opacity: 1;
}

.form__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 13.5px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.check input {
    width: 16px;
    height: 16px;
    accent-color: var(--ink);
}

.link {
    color: var(--ink);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: color 0.15s;
}

.link:hover {
    color: var(--accent);
}

/* ── Кнопка ────────────────────────────────────────────────────── */
.btn {
    position: relative;
    margin-top: 4px;
    padding: 14px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    background: var(--accent);
    border: var(--border);
    border-radius: 0;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}

.btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--ink);
}

.btn:active {
    transform: translate(3px, 3px);
    box-shadow: 0 0 0 var(--ink);
}

.btn:disabled {
    cursor: default;
    transform: translate(3px, 3px);
    box-shadow: none;
}

.btn__spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(22, 20, 15, 0.25);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn.is-loading .btn__text {
    visibility: hidden;
}

.btn.is-loading .btn__spinner {
    display: block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.form__note {
    font-family: var(--font-mono);
    font-size: 12.5px;
    min-height: 18px;
    text-align: center;
    color: var(--muted);
}

.form__note.is-error {
    color: var(--danger);
}

.auth__foot {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px dashed var(--line);
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

/* ── Верхняя панель внутренних страниц ─────────────────────────── */
/* Колонка на всю высоту — футер прижат к низу даже на коротких страницах */
.page {
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
}

.topbar-wrap {
    background: var(--paper);
    border-bottom: var(--border);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1040px;
    margin: 0 auto;
    padding: 16px 24px;
}

.topbar .brand {
    text-decoration: none;
    color: var(--ink);
}

.topnav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topnav__link {
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    border: 1.5px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.topnav__link:hover {
    color: var(--ink);
    border-color: var(--line);
}

.topnav__link.is-active {
    color: var(--ink);
    background: var(--accent-soft);
    border-color: var(--ink);
}

.btn--ghost {
    margin: 0 0 0 6px;
    padding: 8px 14px;
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--paper);
}

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

/* ── Статьи ────────────────────────────────────────────────────── */
.article {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 56px 24px 64px;
}

.article__head {
    max-width: 720px;
    margin-bottom: 44px;
}

.tag {
    margin-bottom: 20px;
}

.article__title {
    font-family: var(--font-display);
    font-size: clamp(34px, 5.5vw, 56px);
    line-height: 1.02;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.article__lead {
    margin-top: 18px;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.65;
}

.os-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
    gap: 22px;
}

.os-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px 22px;
    background: var(--paper);
    border: var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
}

.os-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: var(--shadow);
}

.os-card__top {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--line);
}

.os-card__logo {
    flex: none;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    font-size: 24px;
    background: var(--accent-soft);
    border: var(--border);
}

.os-card__top h2 {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.os-card__vendor {
    display: block;
    margin-top: 2px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--muted);
}

.os-card p {
    color: var(--muted);
    font-size: 14.5px;
    line-height: 1.6;
}

.os-card__list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 6px;
}

.os-card__list li {
    position: relative;
    padding-left: 20px;
    font-size: 13.5px;
    color: var(--ink);
}

.os-card__list li::before {
    content: "→";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--accent);
    font-weight: 700;
}

.article__cta {
    margin-top: 48px;
    padding: 32px 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 24px;
    background: var(--ink);
    color: var(--paper);
    border: var(--border);
    box-shadow: 6px 6px 0 var(--accent);
}

.article__cta p {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
}

.article__cta .btn {
    display: inline-block;
    margin: 0;
    padding: 13px 26px;
    border-color: var(--paper);
    box-shadow: 3px 3px 0 var(--paper);
}

.article__cta .btn:hover {
    box-shadow: 5px 5px 0 var(--paper);
}

.article__cta .btn:active {
    box-shadow: none;
}

.footer {
    border-top: var(--border);
    background: var(--paper);
}

.footer p {
    max-width: 1040px;
    margin: 0 auto;
    padding: 20px 24px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--muted);
}

/* ── Адаптив ───────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero {
        padding: 30px 24px 26px;
        gap: 18px;
        border-right: none;
        border-bottom: var(--border);
    }

    .hero__lead {
        font-size: 15px;
        max-width: none;
    }

    .features {
        margin-top: 4px;
    }

    .auth {
        padding: 30px 24px 36px;
    }

    .topbar {
        padding: 14px 20px;
    }

    .article {
        padding: 36px 20px 48px;
    }

    .article__head {
        margin-bottom: 30px;
    }

    .article__lead {
        font-size: 16px;
    }

    .article__cta {
        margin-top: 36px;
        padding: 26px 22px;
    }
}

@media (max-width: 560px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .topbar .brand {
        justify-content: center;
    }

    .topnav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    /* 16px — иначе Safari на iOS зумит страницу при фокусе в поле */
    .field__input {
        font-size: 16px;
    }

    .os-grid {
        gap: 18px;
    }

    .os-card {
        padding: 20px 18px;
    }

    .article__cta {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .article__cta p {
        font-size: 21px;
    }
}

@media (max-width: 420px) {
    body {
        padding: 16px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .page {
        padding: 0;
    }

    .shell {
        box-shadow: 4px 4px 0 var(--ink);
    }

    .hero {
        padding: 24px 18px 22px;
    }

    .auth {
        padding: 26px 18px 32px;
    }

    .topbar {
        padding: 14px 16px;
    }

    .article {
        padding: 28px 16px 40px;
    }

    .os-card {
        padding: 18px 16px;
    }

    .article__cta {
        padding: 24px 16px;
        box-shadow: 4px 4px 0 var(--accent);
    }
}

/* Убираем анимацию для тех, кто её отключил */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
