/* ==========================================
   palsunch.ru — сайт-визитка Павла Скороходова
   Редизайн: светлая современная тема, один акцент,
   системный шрифтовой стек, без эмодзи.
   ========================================== */

/* --- Токены --- */
:root {
    /* Поверхности и текст (одно семейство серого, прохладный оттенок) */
    --bg: #F6F8FB;
    --surface: #FFFFFF;
    --surface-soft: #EEF3FA;
    --text: #0E1723;
    --text-soft: #33414F;
    --muted: #5C6C7E;
    --line: rgba(14, 23, 35, 0.08);
    --line-strong: rgba(14, 23, 35, 0.14);

    /* Один акцент (насыщенность ниже 80%) */
    --accent: #1B6CF3;
    --accent-ink: #0B4FBF;
    --accent-soft: rgba(27, 108, 243, 0.10);

    /* Тени — тонированные в синий, а не чёрные */
    --shadow-sm: 0 1px 2px rgba(16, 50, 110, 0.05);
    --shadow-md: 0 12px 30px rgba(16, 50, 110, 0.08);
    --shadow-lg: 0 24px 60px rgba(16, 50, 110, 0.12);

    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
        "Liberation Mono", monospace;

    --header-height: 64px;
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --transition: 240ms var(--ease);
}

/* --- Сброс --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
    font-family: var(--font-sans);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.62;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--header-height);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

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

h1, h2, h3 {
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

/* --- Доступность: ссылка «к содержимому» --- */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 200;
    padding: 10px 16px;
    background: var(--accent);
    color: #fff;
    border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus {
    left: 0;
}

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

/* --- Анимации появления --- */
@keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}

.section {
    padding: 96px 22px;
    animation: rise 700ms var(--ease) both;
}
.section:nth-of-type(2) { animation-delay: 80ms; }
.section:nth-of-type(3) { animation-delay: 160ms; }
.section:nth-of-type(4) { animation-delay: 240ms; }
.section:nth-of-type(5) { animation-delay: 320ms; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .section { animation: none; }
    * { transition-duration: 1ms !important; }
}

/* --- Хедер --- */
.tm-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    display: flex;
    align-items: center;
    height: var(--header-height);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    background-color: rgba(255, 255, 255, 0.72);
    border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
}

.tm-header-logo {
    display: flex;
    align-items: center;
    padding: 0 22px;
}

.tm-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.tm-logo-img {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.tm-header-body {
    flex: 1;
    display: flex;
    justify-content: center;
}

.tm-header-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tm-header-link {
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    white-space: nowrap;
    color: var(--muted);
    border-radius: var(--radius-sm);
    transition: color var(--transition), background-color var(--transition);
}
.tm-header-link:hover,
.tm-header-link:focus-visible {
    color: var(--text);
    background-color: var(--surface-soft);
}

.tm-header-cta {
    flex-shrink: 0;
    margin-right: 18px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-sm);
    transition: background-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.tm-header-cta:hover {
    background: var(--accent-ink);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.tm-header-cta:active {
    transform: translateY(0);
}

/* --- Каркас --- */
.page-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.container {
    width: 100%;
    max-width: 1160px;
    margin-inline: auto;
    padding-inline: 22px;
}
.container--narrow {
    max-width: 880px;
}

/* --- Заголовки секций --- */
.section__title {
    font-size: clamp(24px, 2.4vw, 32px);
    font-weight: 600;
    margin-bottom: 14px;
}
.section__title::after {
    content: "";
    display: block;
    width: 44px;
    height: 3px;
    margin-top: 16px;
    border-radius: 3px;
    background: var(--accent);
}
.section--projects .section__title::after,
.section--about .section__title::after,
.section--book .section__title::after,
.section--stack .section__title::after,
.section--contacts .section__title::after {
    margin-inline: auto;
}
.section--projects,
.section--about,
.section--book,
.section--stack,
.section--contacts {
    text-align: center;
}

/* --- Hero --- */
.section--hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: calc(100dvh - var(--header-height));
    padding-top: 72px;
    padding-bottom: 96px;
    overflow: hidden;
    text-align: left;
    background:
        radial-gradient(80% 60% at 12% 0%, rgba(27, 108, 243, 0.10), transparent 62%),
        radial-gradient(70% 60% at 92% 8%, rgba(24, 196, 196, 0.09), transparent 60%),
        var(--bg);
}
.section--hero > .container {
    position: relative;
    z-index: 2;
}
#particles-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.hero__brand {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 22px;
    margin-bottom: 26px;
}
.hero__photo {
    width: 104px;
    height: 104px;
    border-radius: 22px; /* «squircle», не круг */
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
    outline: 1px solid var(--line);
}
.hero__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hero__name {
    font-size: clamp(30px, 4vw, 46px);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}
.hero__role {
    font-size: 16px;
    color: var(--muted);
}
.hero__tagline {
    max-width: 62ch;
    margin-bottom: 30px;
    font-size: clamp(17px, 1.5vw, 20px);
    color: var(--text-soft);
    line-height: 1.6;
}
.hero__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* --- Кнопки --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 26px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    line-height: 1.3;
    transition: background-color var(--transition), color var(--transition),
        border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn--blue {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-md);
}
.btn--blue:hover {
    background: var(--accent-ink);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.btn--outline {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--line-strong);
    color: var(--text);
}
.btn--outline:hover {
    border-color: var(--accent);
    color: var(--accent-ink);
    background: #fff;
    transform: translateY(-2px);
}
.btn:active {
    transform: translateY(0) scale(0.99);
}

/* --- Текстовые блоки (канон — вариант 2: радиальное «сияние») --- */
.project-card--grad {
    background: radial-gradient(120% 90% at 14% 0%, rgba(27, 108, 243, 0.18), rgba(27, 108, 243, 0) 58%), var(--surface);
}

/* Вариант 1 — мягкий линейный градиент (для сравнения: ?blocks=1) */
body[data-blocks="1"] .project-card--grad {
    background: linear-gradient(150deg, rgba(27, 108, 243, 0.10), rgba(27, 108, 243, 0) 62%), var(--surface);
}

/* Вариант 2 — радиальное «сияние» (один оттенок) */
body[data-blocks="2"] .project-card--grad {
    background: radial-gradient(120% 90% at 14% 0%, rgba(27, 108, 243, 0.18), rgba(27, 108, 243, 0) 58%), var(--surface);
}

/* Вариант 3 — mesh из нескольких оттенков одного семейства (для сравнения: ?blocks=3) */
body[data-blocks="3"] .project-card--grad {
    background:
        radial-gradient(58% 58% at 8% 0%, rgba(27, 108, 243, 0.16), transparent 60%),
        radial-gradient(58% 58% at 92% 18%, rgba(24, 196, 196, 0.14), transparent 60%),
        radial-gradient(80% 80% at 50% 104%, rgba(122, 92, 240, 0.11), transparent 64%),
        var(--surface);
}

/* Микротекстура (зерно) поверх блоков — чтобы не было «стерильной» заливки */
.project-card--grad {
    position: relative;
    isolation: isolate;
}
.project-card--grad::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    opacity: 0.5;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}

/* --- Карточки услуг --- */
.projects__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 42px;
    text-align: left;
}
.project-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 30px 26px 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--line-strong);
}
.project-card__index {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--accent-ink);
    padding: 5px 9px;
    border: 1px solid rgba(27, 108, 243, 0.28);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.6);
    margin-bottom: 18px;
}
.project-card__title {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 10px;
}
.project-card__desc {
    font-size: 15.5px;
    line-height: 1.62;
    color: var(--text-soft);
}
.project-card__desc strong {
    display: inline-block;
    margin-top: 4px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.about__lead {
    max-width: 74ch;
    margin: 30px auto 0;
    font-size: 17px;
    color: var(--text-soft);
}

/* --- Книга (витрина: обложка + описание) --- */
.section--book {
    background: var(--surface);
    border-block: 1px solid var(--line);
}
.book-feature {
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    gap: 44px;
    align-items: center;
    max-width: 940px;
    margin: 42px auto 0;
    padding: 36px;
    text-align: left;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.book-feature:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--line-strong);
}
.book-feature__cover img {
    width: 100%;
    height: auto;
    border-radius: 5px;
    box-shadow: 0 22px 44px rgba(16, 50, 110, 0.24);
}
.book-feature__badge {
    display: inline-block;
    margin-bottom: 14px;
    padding: 5px 11px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-ink);
    border: 1px solid rgba(27, 108, 243, 0.28);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.72);
}
.book-feature__title {
    font-size: clamp(20px, 2.1vw, 25px);
    font-weight: 600;
    margin-bottom: 12px;
}
.book-feature__desc {
    font-size: 16px;
    color: var(--text-soft);
}
.book-feature__meta {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 22px;
}
.book-feature__meta li {
    padding: 6px 12px;
    font-size: 13.5px;
    color: var(--text-soft);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.book-feature__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--accent-ink);
}
.book-feature__cta::after {
    content: "";
    width: 16px;
    height: 16px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M5 12h13M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M5 12h13M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform var(--transition);
}
.book-feature:hover .book-feature__cta::after {
    transform: translateX(4px);
}

/* --- Кейс --- */
.section--about {
    background: var(--surface);
    border-block: 1px solid var(--line);
}
.about__text {
    max-width: 74ch;
    margin-inline: auto;
    text-align: left;
}
.about__text p {
    color: var(--text-soft);
    margin-bottom: 18px;
}
.about__timeline {
    list-style: none;
    display: grid;
    gap: 14px;
    margin: 26px 0;
}
.about__timeline li {
    position: relative;
    padding: 16px 20px 16px 22px;
    border-left: 2px solid var(--accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: var(--surface-soft);
    font-size: 15.5px;
    color: var(--text-soft);
    transition: transform var(--transition), background-color var(--transition);
}
.about__timeline li:hover {
    transform: translateX(4px);
    background: #E7EEF9;
}
.about__timeline li strong {
    display: block;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

/* --- Как работаю --- */
.section--stack {
    background: var(--bg);
}
.stack__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 26px;
    margin-top: 42px;
    text-align: left;
}
.stack__group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.stack__label {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}
.stack__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tag {
    display: inline-block;
    padding: 7px 13px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-soft);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: color var(--transition), border-color var(--transition), background-color var(--transition), transform var(--transition);
}
.tag:hover {
    color: var(--accent-ink);
    border-color: rgba(27, 108, 243, 0.35);
    background: rgba(27, 108, 243, 0.05);
    transform: translateY(-1px);
}

/* --- Контакты --- */
.section--contacts {
    background: var(--surface);
    border-top: 1px solid var(--line);
}
.contacts__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    max-width: 620px;
    margin: 42px auto 0;
    text-align: left;
}
.contact-item {
    padding: 26px 24px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: transform var(--transition), box-shadow var(--transition);
}
.contact-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}
.contact-item__title {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 10px;
}
.contact-item__link,
.contact-item__text {
    font-size: 17px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.contact-item__link {
    display: inline-block;
    color: var(--accent-ink);
    transition: transform var(--transition), color var(--transition);
}
.contact-item__link:hover {
    color: var(--accent);
    transform: scale(1.06);
}
.contact-item__text {
    color: var(--text);
}

/* --- Подвал --- */
.tm-footer {
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
}
.tm-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 28px;
    padding: 22px;
    font-size: 13px;
    color: var(--muted);
}
.tm-footer-link {
    transition: color var(--transition);
}
.tm-footer-link:hover,
.tm-footer-link:focus-visible {
    color: var(--text);
}

/* --- Переключатель вариантов градиентных блоков --- */
.variant-switch {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 120;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    box-shadow: var(--shadow-md);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}
.variant-switch__label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.variant-switch__dot {
    width: 16px;
    height: 16px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: transform var(--transition), background-color var(--transition), border-color var(--transition);
}
.variant-switch__dot:nth-of-type(2) {
    background: linear-gradient(150deg, var(--accent), rgba(27, 108, 243, 0.15));
}
.variant-switch__dot:nth-of-type(3) {
    background: radial-gradient(circle at 30% 30%, var(--accent), rgba(24, 196, 196, 0.7));
}
.variant-switch__dot:nth-of-type(4) {
    background: linear-gradient(120deg, var(--accent), #18C4C4 55%, #7A5CF0);
}
.variant-switch__dot:hover {
    transform: scale(1.12);
}
.variant-switch__dot.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(27, 108, 243, 0.28);
}

/* ==========================================
   Адаптив
   ========================================== */

/* Мобильные (≤639px) */
@media screen and (max-width: 639px) {
    .tm-header {
        flex-wrap: wrap;
        height: auto;
        padding-block: 8px;
    }
    .tm-header-body {
        flex-basis: 100%;
        justify-content: flex-start;
        order: 3;
        padding: 6px 0 2px;
        overflow-x: auto;
    }
    .tm-header-cta {
        margin-left: auto;
        margin-right: 14px;
        order: 2;
    }
    .tm-logo-text {
        display: none;
    }
    .section {
        padding: 64px 18px;
    }
    .section--hero {
        padding-top: 40px;
        padding-bottom: 64px;
    }
    .hero__brand {
        grid-template-columns: 1fr;
        gap: 18px;
        text-align: left;
    }
    .hero__photo {
        width: 88px;
        height: 88px;
    }
    .hero__buttons .btn {
        width: 100%;
    }
    .projects__grid,
    .contacts__grid {
        grid-template-columns: 1fr;
    }
    .book-feature {
        grid-template-columns: 1fr;
        gap: 26px;
        padding: 24px;
    }
    .book-feature__cover {
        max-width: 240px;
        margin-inline: auto;
    }
    .variant-switch {
        right: 12px;
        bottom: 12px;
        padding: 7px 12px;
    }
}

/* Планшеты (640–959px) */
@media screen and (min-width: 640px) and (max-width: 959px) {
    .projects__grid,
    .contacts__grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero__photo {
        width: 96px;
        height: 96px;
    }
}

/* Десктоп (≥960px) */
@media screen and (min-width: 960px) {
    :root {
        --header-height: 68px;
    }
    .hero__photo {
        width: 120px;
        height: 120px;
    }
}
