/*
 * responsive.css — viewport breakpoints only (loaded after style.css)
 * Order: large → small. Nav drawer from 1024px.
 */

/* ——— Motion ——— */
@media (prefers-reduced-motion: reduce) {
    .hero__nav a,
    .hero__nav-toggle-bar,
    .cta,
    .cta-shell,
    .format-picker__option,
    .hero__nav,
    .hero__nav-backdrop,
    .site-topbar::before {
        transition: none !important;
    }
}

/* ——— Large laptop / small desktop ——— */
@media (max-width: 1536px) {
    html {
        font-size: 58%;
    }
    :root {
        --hero-content-padding-left: clamp(2.4rem, 5vw, 10rem);
        --hero-content-padding-right: 0;
        --hero-content-padding-bottom: 5rem;
        --site-header-inline-padding: 10rem;
    }
    .site-topbar .hero__header {
        padding: 2rem 10rem;
    }

    .hero__content {
        max-width: min(72rem, 100%);
    }

    .hero__title {
        max-width: 100%;
    }

    .about-book {
        padding: 16rem 0;
    }

    .news {
        padding: 8rem clamp(2rem, 5vw, 8rem);
    }

    .site-footer {
        padding: 6rem 10rem;
    }

    .contact__form-wrap {
        padding: 2.6rem clamp(1.6rem, 5vw, 4.5rem);
    }
}

@media (max-width: 1366px) {
    html {
        font-size: 50%;
    }
}

/* ——— Tablet + hamburger nav ——— */
@media (max-width: 1024px) {
    html {
        font-size: 50%;
    }
    :root {
        --site-header-inline-padding: 6rem;
    }
    .site-topbar .hero__header {
        padding: 2rem 6rem;
    }
    .site-footer {
        padding: 6rem 6rem 2rem;
        border-top: 1px solid var(--color-border-gold-muted);
    }

    .site-footer__cols {
        gap: clamp(2.8rem, 4vw, 4.5rem) clamp(2rem, 4vw, 3.5rem);
    }

    .site-footer__links li {
        margin-bottom: 1rem;
    }

    .hero__nav-toggle {
        display: flex;
        box-sizing: border-box;
        border-radius: 0.8rem;
        border: 1px solid rgba(255, 208, 104, 0.45);
        background: linear-gradient(
            165deg,
            rgba(12, 9, 7, 0.92) 0%,
            rgba(6, 4, 3, 0.88) 100%
        );
        box-shadow:
            0 0 0 1px rgba(0, 0, 0, 0.5),
            0 0.3rem 1rem rgba(0, 0, 0, 0.45),
            inset 0 1px 0 rgba(255, 220, 160, 0.12);
    }

    .hero__nav-toggle:hover {
        border-color: rgba(255, 224, 160, 0.65);
        box-shadow:
            0 0 0 1px rgba(0, 0, 0, 0.55),
            0 0 1.2rem rgba(255, 200, 80, 0.18),
            0 0.35rem 1.1rem rgba(0, 0, 0, 0.5),
            inset 0 1px 0 rgba(255, 230, 190, 0.18);
    }

    .hero__nav-toggle:focus-visible {
        outline: 2px solid var(--gradient-top);
        outline-offset: 3px;
    }

    .hero__nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 3000;
        background: rgba(6, 4, 3, 0.55);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: 0.3s ease all;
    }

    .hero__nav {
        position: fixed;
        top: 0;
        right: 0;
        z-index: 3001;
        width: min(36rem, 100vw - 2.4rem);
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        padding: clamp(6rem, 12vh, 8rem) clamp(2rem, 4vw, 2.8rem) 2.4rem;
        box-sizing: border-box;
        background: linear-gradient(
            200deg,
            rgba(14, 11, 9, 0.98) 0%,
            rgba(8, 6, 5, 0.97) 45%,
            rgba(5, 4, 3, 0.99) 100%
        );
        border-left: 1px solid rgba(255, 200, 100, 0.35);
        box-shadow: -0.8rem 0 2.4rem rgba(0, 0, 0, 0.45);
        overflow-y: auto;
        transform: translate3d(100%, 0, 0);
        transition: 0.3s ease all;
    }

    .hero__nav-list {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
    }

    .hero__nav-list li {
        border-bottom: 1px solid rgba(255, 208, 104, 0.12);
    }

    .hero__nav-list li:last-child {
        border-bottom: none;
    }

    .hero__nav a {
        display: block;
        padding: 1.4rem 0.4rem;
        font-size: clamp(1.7rem, 2.6vw, 2rem);
        letter-spacing: 0.06em;
    }

    .news:not(.blog-page) .news__grid {
        display: grid;
        grid-auto-flow: row;
        grid-template-columns: 1fr;
        width: 100%;
        max-width: 52rem;
        margin-inline: auto;
        gap: 2.4rem;
    }

    .news:not(.blog-page) .news-card {
        flex: none;
        max-width: none;
        margin-inline: auto;
    }

    .page-article .article-news .news__grid {
        grid-auto-flow: row;
        grid-template-columns: 1fr;
        max-width: none;
        width: 100%;
        margin-inline: auto;
        gap: 2.4rem;
    }

    .world-kalador__content {
        text-align: center;
        align-items: center;
        margin-inline: auto;
    }

    .world-kalador__title {
        margin-left: auto;
        margin-right: auto;
    }

    .world-kalador__action {
        justify-content: center;
    }

    body.is-nav-open {
        overflow: hidden;
    }

    body.is-nav-open .hero__nav-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    body.is-nav-open .hero__nav {
        transform: translate3d(0, 0, 0);
    }

    body.is-nav-open .hero__nav-toggle-bar:nth-child(1) {
        top: 50%;
        margin-top: -1px;
        transform: rotate(45deg);
    }

    body.is-nav-open .hero__nav-toggle-bar:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }

    body.is-nav-open .hero__nav-toggle-bar:nth-child(3) {
        top: 50%;
        bottom: auto;
        margin-top: -1px;
        transform: rotate(-45deg);
    }
}

/* ——— Tablet portrait ——— */
@media (max-width: 900px) {
    .world-kalador__inner {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .kalador-world__inner {
        grid-template-columns: 1fr;
        gap: 3.2rem;
    }

    .kalador-world__figure {
        order: -1;
        justify-self: center;
        max-width: min(56rem, 100%);
    }

    .kalador-world__text {
        max-width: none;
    }

    .world-kalador__spacer {
        display: none;
    }

    .about-author__inner {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .about-author__spacer {
        display: none;
    }

    .about-author__visual {
        order: -1;
    }

    .contact__inner {
        grid-template-columns: 1fr;
    }

    .contact__form-wrap {
        max-width: 56rem;
        margin-inline: auto;
    }

    .contact__form {
        --field-bg-w: min(456px, 100%);
    }

    .about-intro__top {
        grid-template-columns: 1fr;
    }

    .about-intro__figure {
        justify-self: center;
        order: -1;
        max-width: 40rem;
    }
}

/* ——— Small tablet / large phone ——— */
@media (max-width: 768px) {
    html {
        font-size: 56.25%;
    }
    :root {
        --section-content-inline-sym: clamp(1.6rem, 4vw, 2.4rem);
    }

    .hero {
        min-height: min(100vh, 100dvh);
    }

    .hero__logo img {
        width: clamp(14rem, 48vw, 22rem);
        max-height: 4.8rem;
    }

    .hero__purchase .cta-shell--wide {
        max-width: 100%;
    }

    .about-book {
        padding: 10rem 0;
    }
    .about-book__content, .about-author__content {
        max-width: 100%;
    }
    .world-kalador__content, .news:not(.blog-page) .news__grid, .contact__form-wrap {
        max-width: 90%;
    }

    .about-book__inner,
    .about-book__content {
        padding-inline: clamp(1.6rem, 4vw, 2.4rem);
    }

    .about-book__text,
    .world-kalador__text,
    .about-author__text {
        margin-bottom: 2.4rem;
    }
    .about-intro__figure {
        justify-self: left;
    }
    .about-intro {
        padding: var(--page-first-section-padding-top) 0 8rem;
    }

    .article-page {
        padding: var(--page-first-section-padding-top) var(--section-content-inline-sym) 6rem;
    }
    .about-intro__kicker {
        max-width: 100%;
    }

    .about-intro__signoff {
        padding: 2.4rem clamp(1.4rem, 4vw, 2.4rem);
        gap: 1.6rem;
    }

    .about-author__inner, .contact__inner {
        grid-auto-flow: row;
    }
    .about-author__photo {
        width: 60%;
    }

    .world-kalador,
    .about-author {
        padding: 6rem clamp(1.6rem, 4vw, 2.4rem);
    }

    .page-kalador .kalador-world {
        padding-bottom: 6rem;
    }

    .news-card__body {
        padding: 1.6rem 1.4rem 1rem;
    }

    .news-card__excerpt {
        font-size: 1.4rem;
    }

    .contact {
        padding: var(--page-first-section-padding-top) 0 8rem;
    }

    .contact__form-wrap {
        padding: 2.2rem clamp(1rem, 4vw, 2rem);
    }
    .contact__form {
        --field-bg-w: min(456px, 100%);
    }
    .contact__visual {
        order: -1;
    }
    .contact__book {
        max-width: 40rem;
    }

    .site-footer__cols {
        gap: clamp(3rem, 5vw, 4.8rem) clamp(2rem, 4vw, 3.2rem);
    }

    .site-footer__col-heading {
        margin-bottom: 2rem;
    }

    .site-footer__mail-text {
        margin-bottom: 1.6rem;
    }

    .site-footer__bar {
        padding-top: clamp(2.6rem, 4vw, 3.4rem);
        gap: 2rem 2.4rem;
    }
}

/* ——— Blog page: card grid ——— */
@media (max-width: 1100px) {
    .page-blog .news__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .page-blog .news__grid {
        grid-template-columns: 1fr;
    }

    .page-blog .news__inner > h1 {
        text-align: center;
    }

    .blog-pagination__shell {
        padding-inline: clamp(1.2rem, 4vw, 2rem);
    }

    .blog-pagination__inner {
        justify-items: center;
        text-align: center;
    }

    .blog-pagination__btn {
        width: 100%;
        max-width: 28rem;
        display: flex;
        justify-content: center;
    }
}

/* ——— Footer two-column ——— */
@media (max-width: 1000px) {
    .site-footer__cols {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.35fr);
        gap: clamp(3.2rem, 5vw, 4.8rem) clamp(2.4rem, 4vw, 3.2rem);
    }
}

/* ——— Phone ——— */
@media (max-width: 560px) {
    html {
        font-size: 46%;
    }
    :root {
        --hero-content-padding-left: 3rem;
        --hero-content-padding-right: 3rem;
        --hero-content-padding-bottom: 3rem;
        --site-header-inline-padding: 2rem;
    }
    .site-topbar .hero__header {
        padding: 2rem 2rem;
    }
    .page-article .article-news .news__grid {
        max-width: 100%;
    }
    .page-book .cta.cta--btn-lg {
        --img-btn-w: 330px;
    }
    .site-footer {
        padding: 4rem 4rem 2rem;
    }
    .hero__content {
        max-width: 100%;
    }
    header .cta.cta--btn-sm {
        --img-btn-w: 112px;
    }

    .hero__header {
        flex-wrap: nowrap;
        gap: 1.2rem;
    }
    .hero__copy {
        max-width: 100%;
        width: 100%;
    }
    .contact__form {
        --field-bg-w: min(288px, 92vw);
    }

    .format-picker__option {
        --select-bg-w: 140px;
        --select-bg-h: 52px;
    }

    .site-footer__cols {
        grid-template-columns: 1fr;
        row-gap: 4.2rem;
        column-gap: 0;
        padding-bottom: 3.6rem;
    }

    .site-footer__col--brand .site-footer__brand {
        margin-bottom: 2rem;
    }

    .site-footer__tagline {
        line-height: 1.6;
    }

    .site-footer__col-heading {
        margin-bottom: 1.8rem;
    }

    .site-footer__links li {
        margin-bottom: 1.2rem;
    }

    .site-footer__links a {
        font-size: 16px;
        line-height: 1.55;
        display: inline-block;
        padding-block: 0.25rem;
    }

    .site-footer__social {
        gap: 1.2rem;
    }

    .site-footer__mail-text {
        margin-bottom: 1.6rem;
        line-height: 1.55;
    }

    .site-footer__mail-form {
        gap: 1rem;
    }

    .site-footer__bar {
        flex-direction: column;
        align-items: flex-start;
        padding-top: 3rem;
        gap: 2.4rem;
    }

    .site-footer__legal {
        gap: 1.2rem 2rem;
    }

    .about-author__photo {
        width: 100%;
    }
    .about-author__inner {
        gap: 3rem;
    }

    .news__title,
    .news__inner > h1,
    .news__inner > h2,
    .article-news > h1,
    .article-news > h2,
    .article-news > h3 {
        margin-bottom: 2.4rem;
    }
    .page-blog a.cta.cta--btn-sm {
        --img-btn-w: 100px;
    }
    .contact__form .cta-shell--wide.cta-shell--hero-buy button.cta.cta--btn-lg {
        width: min(100%, var(--field-bg-w)) !important;
        max-width: 100%;
    }
    .page-contact .contact__inner {
        padding-left: 0;
        padding-right: 0;
    }
}

@media (max-width: 480px) {
    .hero__content {
        padding-bottom: 4rem;
    }

    .hero__nav {
        width: 100vw;
        border-left: none;
    }

    .site-footer__social-link {
        width: 4.4rem;
        height: 4.4rem;
    }
}
