/* ---------- Fonts ---------- */
@font-face {
    font-family: 'Roboto Var';
    /* src: url('https://alterlit.ru/assets/books/karton/Roboto.ttf') format('truetype'); */
    src: url('./Roboto.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Roboto Var';
    /* src: url('https://alterlit.ru/assets/books/karton/Roboto-Italic.ttf') format('truetype'); */
    src: url('./Roboto-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

/* Roboto.ttf/Roboto-Italic.ttf are variable fonts; weight is driven
   explicitly via font-variation-settings below (a font-weight range
   descriptor on @font-face proved unreliable in local headless testing),
   font-weight is kept in sync for fallback fonts that ignore
   variation-settings. */

/* ---------- Tokens ---------- */
:root {
    --bg: #EFEFEF;
    --bg-alt: #E5E4E0;
    --ink: #111110;
    --ink-soft: rgba(17, 17, 16, .62);
    --line: rgba(17, 17, 16, .13);
    --accent: #B07C36;
    --accent-strong: #8C5F24;
    --accent-ink: #17130D;
    --cta-bg: #0A0A09;
    --cta-ink: #F4F2EE;
    --cta-bg-hover: #262523;
    --shadow: 0 30px 60px -30px rgba(20, 16, 10, .35);

    --font: 'Roboto Var', 'Roboto', 'Segoe UI', Arial, sans-serif;
    --container-w: 1200px;
    --gutter: clamp(20px, 5vw, 64px);

    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #131211;
    --bg-alt: #1B1917;
    --ink: #F1EFEA;
    --ink-soft: rgba(241, 239, 234, .64);
    --line: rgba(241, 239, 234, .16);
    --accent: #D6A25E;
    --accent-strong: #E4B570;
    --cta-bg: #F1EFEA;
    --cta-ink: #121110;
    --cta-bg-hover: #FFFFFF;
    --shadow: 0 30px 70px -28px rgba(0, 0, 0, .65);
    color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

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

html {
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    margin: 0;
    font-family: var(--font);
    font-weight: 400;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    transition: background-color .35s ease, color .35s ease;
}

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

ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

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

h1, h2, h3, p, blockquote {
    margin: 0;
}

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

.container {
    max-width: var(--container-w);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    font-family: var(--font);
    font-weight: 500;
    font-variation-settings: 'wght' 500;
    font-size: 1.1rem;
    color: var(--cta-ink);
    background-color: var(--cta-bg);
    text-decoration: none;
    padding: 1em 4em;
    border-radius: 1.2em;
    border: none;
    cursor: pointer;
    transition: background-color .2s ease, transform .2s ease;
}

.btn:hover, .btn:focus-visible {
    background-color: var(--cta-bg-hover);
}

.btn:active {
    transform: scale(.97);
}

/* ---------- Header / Footer ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background-color: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color .3s ease, background-color .35s ease;
}

.header-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    padding-block: 26px;
}

.logo {
    display: inline-flex;
    flex-shrink: 0;
}

.logo svg{
    max-width: 7vw;
}

.logo-img {
    /* height: 46px; */
    height: 89px;
    width: auto;
}

.header-menu {
    display: flex;
    align-items: center;
    gap: clamp(24px, 3vw, 48px);
    margin-left: auto;
}

.nav {
    display: flex;
    align-items: center;
    gap: clamp(20px, 3.2vw, 44px);
    flex-wrap: wrap;
}

.nav a {
    font-size: 1.6rem;
    font-weight: 500;
    font-variation-settings: 'wght' 500;
    position: relative;
    padding-block: 2px;
}

.nav a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 100%;
    bottom: -2px;
    height: 1.5px;
    background: var(--accent);
    transition: right .25s ease;
}

.nav a:hover::after, .nav a:focus-visible::after {
    right: 0;
}

.header-controls {
     display: flex;
    align-items: center;
    gap: 22px;
    flex-shrink: 0;
}

/* External link (leads to another site); pill button in the accent color
   with a "go to" (external-link) icon so it visually reads as navigation,
   not as a switch. --accent-ink stays dark in both themes because the
   accent color itself never gets dark enough for light text to pass
   contrast. */
.page-toggle {
    display: inline-flex;
    padding: 4px;
}

.page-toggle-track {
    display: block;
    width: 52px;
    height: 28px;
    border-radius: 999px;
    background: var(--ink);
    padding: 3px;
    transition: background-color .3s ease;
}

.page-toggle-knob {
    display: block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg);
    /*transform: translateX(24px);*/
    transform: translateX(0);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1), background-color .3s ease;
}

/*[data-theme="dark"] .page-toggle-knob {*/
/*    transform: translateX(0);*/
/*}*/

[data-book="second"] .page-toggle-knob {
    transform: translateX(24px);
}

/* Theme switch: lives in the nav, next to "Купить". The sun/moon icon
   sits inside the sliding knob itself and swaps with the theme, so one
   compact control reads clearly instead of two icons flanking a track. */
.theme-switch {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
}

.theme-switch-track {
    display: block;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: var(--ink);
    padding: 3px;
    transition: background-color .3s ease;
}

.theme-switch-knob {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--ink);
    transform: translateX(20px);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1), background-color .3s ease;
}

.theme-switch-knob svg {
    position: absolute;
    opacity: 0;
    transform: scale(.5);
    transition: opacity .25s ease, transform .25s ease;
}

.theme-switch-knob .icon-sun {
    opacity: 1;
    transform: scale(1);
}

[data-theme="dark"] .theme-switch-knob {
    transform: translateX(0);
}

[data-theme="dark"] .theme-switch-knob .icon-sun {
    opacity: 0;
    transform: scale(.5);
}

[data-theme="dark"] .theme-switch-knob .icon-moon {
    opacity: 1;
    transform: scale(1);
}

/* Burger menu (mobile) */
.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    flex-shrink: 0;
}

.burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink);
    transition: transform .3s ease, opacity .3s ease;
}

.burger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.burger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.burger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.site-footer {
    padding-block: 0 26px;
    margin-top: 40px;
}

.site-footer .logo-img {
    height: 40px;
}

/* ---------- Hero ---------- */
.hero {
    padding-block: clamp(1em, 3vw, 2em) clamp(1em, 5vw, 2em);
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(300px, 600px) 1fr;
    align-items: center;
    gap: clamp(32px, 5vw, 56px);
    padding-left: var(--gutter);
}

.hero-kicker {
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: .3em;
}

.hero-title {
    text-transform: uppercase;
    font-weight: 800;
    font-variation-settings: 'wght' 800;
    line-height: .95;
    letter-spacing: -.01em;
    color: var(--ink);
    margin-bottom: .5em;
}

.hero-title .line {
    display: block;
}

.hero-title .line-sm {
    font-size: clamp(2.1rem, 3.4vw, 3rem);
    font-weight: 500;
}

.hero-title .line-lg {
    font-size: clamp(4.2rem, 8vw, 7rem);
    font-weight: 900;
    font-variation-settings: 'wght' 900;
    color: var(--accent);
}

.hero-quote {
    font-style: italic;
    font-size: clamp(1.05rem, 1.3vw, 1.2rem);
    line-height: 1.5;
    color: var(--ink-soft);
    max-width: 45ch;
    margin-bottom: 1.7em;
}

.hero-media {
    min-width: 0;
}

.hero-media-img {
    width: 100%;
    height: auto;
}

/* ---------- About book ---------- */
.about-book {
    background-color: var(--bg);
    transition: background-color .35s ease;
}

.about-book-grid {
    display: grid;
    grid-template-columns: minmax(280px, 460px) 1fr;
    align-items: center;
    gap: clamp(32px, 6vw, 72px);
    padding-block: clamp(1em, 8vw, 3em);
}

.about-book-text h2,
.about-author-text h2,
.buy-text h2,
.news h2 {
    font-size: clamp(2rem, 3.2vw, 2.75rem);
    font-weight: 500;
    font-variation-settings: 'wght' 700;
    margin-bottom: .6em;
}

.about-book-text p,
.about-author-text p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--ink-soft);
    max-width: 46ch;
}

.about-book-text p + p,
.about-author-text p + p {
    margin-top: 1.3em;
}

/* ---------- About author ---------- */
.about-author-grid {
    display: grid;
    grid-template-columns: 1fr minmax(280px, 460px);
    align-items: center;
    gap: clamp(32px, 6vw, 72px);
    padding-block: clamp(2em, 9vw, 3em);
}

.about-author-text .btn {
    margin-top: 1.8em;
}

.about-author-media {
    display: flex;
    justify-content: center;
}

.about-author-media img {
    width: 100%;
    max-width: 440px;
}

/* ---------- News ---------- */
.news {
    padding-block: clamp(56px, 8vw, 100px);
}

.news .container {
    margin-bottom: clamp(28px, 4vw, 44px);
}

.news-slider {
    position: relative;
    max-width: var(--container-w);
    margin-inline: auto;
    padding-inline: var(--gutter);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
}

.news-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 2 * 32px) / 3);
    gap: 32px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 0;
    scrollbar-width: none;
}

.news-track::-webkit-scrollbar {
    display: none;
}

.news-card {
    scroll-snap-align: start;
}

.news-card img {
    width: 100%;
    aspect-ratio: 4 / 4.6;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 1.1em;
}

.news-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    font-variation-settings: 'wght' 700;
    margin-bottom: .35em;
}

.news-card p {
    font-size: 1rem;
    color: var(--ink-soft);
}

.news-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.news-arrow:hover, .news-arrow:focus-visible {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}

.news-arrow:active {
    transform: scale(.92);
}

.news-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: clamp(20px, 3vw, 32px);
}

.news-dots button {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: none;
    background: var(--line);
    cursor: pointer;
    padding: 0;
    transition: background-color .2s ease, width .2s ease;
}

.news-dots button[aria-current="true"] {
    background: var(--accent);
    width: 20px;
    border-radius: 4px;
}

/* ---------- Buy ---------- */
.buy {
    background-color: var(--bg);
    transition: background-color .35s ease;
}

.buy-grid {
    display: grid;
    grid-template-columns: minmax(260px, 440px) 1fr;
    align-items: center;
    gap: clamp(32px, 6vw, 72px);
    padding-block: clamp(56px, 9vw, 110px);
}

.buy-media img{
        max-width: 80%;
}

.buy-text p {
    font-size: 1.1rem;
    margin-bottom: .45em;
    color: var(--ink-soft);
}

.buy-text p strong {
    color: var(--ink);
    font-weight: 500;
    font-variation-settings: 'wght' 500;
}

.shops {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 1.6em;
}

.shops img {
    width: 60px;
    height: auto;
    border-radius: 16px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.shops a:hover img, .shops a:focus-visible img {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

@media (min-width: 721px) {
    .header-inner {
        gap: 0;
    }
    /* .logo {
        flex: 1 0 0px;
        display: flex;
        justify-content: flex-start;
    } */
    .header-menu {
        flex: 0 0 auto;
        margin-left: 0;
    }
    /* .header-inner::after {
        content: '';
        flex: 1 0 0px;
        display: block;
    } */
    .header-menu .nav {
       gap: clamp(20px, 6.94vw, 70px);
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: clamp(32px, 2vw, 56px);
    }
    .hero-quote{
        max-width: none;
    }

    .hero-media {
        order: -1;
        padding-inline: var(--gutter);
        max-width: 40vw;
        margin-inline: auto;
    }

    .about-book-grid {
        grid-template-columns: minmax(240px, 360px) 1fr;
    }

    .buy-grid {
        grid-template-columns: minmax(220px, 360px) 1fr;
    }
}

@media (max-width: 860px) {
    .about-book-grid,
    .about-author-grid,
    .buy-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .about-book-media {
        max-width: 340px;
        margin-inline: auto;
    }

    .about-book-text p,
    .about-author-text p {
        max-width: none;
        margin-inline: auto;
    }

    .about-author-grid {
        direction: ltr;
    }

    .about-author-media {
        order: -1;
        margin-bottom: 8px;
    }

    .buy-media {
        order: -1;
        max-width: 320px;
        margin-inline: auto;
    }
    

    .shops {
        justify-content: center;
    }

    .news-track {
        grid-auto-columns: calc((100% - 32px) / 2);
    }
}

@media (max-width: 720px) {
    .burger {
        display: flex;
    }

    .header-inner {
        padding-block: 0;
    }

    .header-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--bg);
        border-top: 1px solid var(--line);
        max-height: 0;
        overflow: hidden;
        transition: max-height .35s ease, background-color .35s ease, border-color .3s ease;
    }

    .header-menu.is-open {
        max-height: 75vh;
        overflow-y: auto;
    }

    .nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        width: 100%;
        padding: 12px var(--gutter) 4px;
    }

    .nav a {
        width: 100%;
        padding-block: 12px;
    }

    .theme-switch {
        margin: 10px 0 6px;
    }

    .header-controls {
        margin-left: auto;
    }

    .hero-media {
        max-width: 50vw;
    }

    .about-book-media {
        display: none;
    }
    .site-footer{
        display: none;;
    }
}
@media (max-width: 640px) {
    .site-footer .header-inner {
        justify-content: center;
        text-align: center;
    }

    .site-footer .nav {
        justify-content: center;
        gap: 16px 22px;
    }

    .hero-title .line-lg {
        font-size: clamp(3.2rem, 16vw, 4.5rem);
    }

    .hero-quote {
        max-width: none;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .news-track {
        grid-auto-columns: 82%;
    }

    .news-arrow {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 420px) {
    .shops img {
        width: 52px;
    }

    .logo-img {
        height: 38px;
    }
}
