:root {
    --ink: #2f1718;
    --body: #7a7a7a;
    --muted: #7a7a7a;
    --paper: #f9f3ee;
    --rose: #e6d4d5;
    --accent: #8c4448;
    --accent-dark: #6d3337;
    --white: #ffffff;
    --gold: #fec42d;
    --line: rgba(47, 23, 24, 0.14);
    --shadow: 0 22px 70px rgba(47, 23, 24, 0.12);
    --container: 1140px;
    --header-height: 88px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 18px);
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--body);
    font-family: "Roboto", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
}

body.nav-open {
    overflow: hidden;
}

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

a {
    color: var(--ink);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    color: var(--accent);
}

h1,
h2,
h3 {
    margin: 0;
    color: var(--ink);
    font-family: "Josefin Sans", Arial, sans-serif;
    font-weight: 700;
    line-height: 1.06;
    letter-spacing: 0;
}

h1,
h2 {
    letter-spacing: -3px;
}

h1 {
    font-size: 56px;
}

h2 {
    font-size: 48px;
}

h3 {
    font-size: 24px;
}

p {
    margin: 0;
}

strong {
    color: var(--ink);
}

.skip-link {
    position: fixed;
    left: 18px;
    top: 18px;
    z-index: 20;
    transform: translateY(-140%);
    border-radius: 999px;
    background: var(--ink);
    color: var(--white);
    padding: 10px 16px;
    font-weight: 700;
}

.skip-link:focus {
    transform: translateY(0);
}

.container {
    width: min(calc(100% - 48px), var(--container));
    margin-inline: auto;
}

.section {
    padding: 82px 0;
}

.section-heading {
    max-width: 720px;
    margin: 0 auto 44px;
    text-align: center;
}

.section-heading h2 {
    margin-bottom: 18px;
}

.books .section-heading {
    max-width: 980px;
}

.books .section-heading h2 {
    white-space: nowrap;
}

.books .section-heading p span {
    display: block;
    white-space: nowrap;
}

.books .section-heading p:not(.eyebrow) {
    color: #000000;
}

.eyebrow {
    margin-bottom: 12px;
    color: var(--accent);
    font-family: "Josefin Sans", Arial, sans-serif;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
}

.eyebrow--light {
    color: var(--rose);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: var(--header-height);
    border-bottom: 1px solid rgba(47, 23, 24, 0.08);
    background: rgba(249, 243, 238, 0.94);
    backdrop-filter: blur(18px);
}

.site-header__inner {
    width: min(calc(100% - 40px), var(--container));
    min-height: var(--header-height);
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    width: 238px;
    min-width: 0;
}

.brand img {
    width: 100%;
}

.primary-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.primary-nav a {
    border-radius: 999px;
    color: var(--ink);
    font-family: "Josefin Sans", Arial, sans-serif;
    font-weight: 700;
    padding: 12px 14px;
}

.primary-nav a:hover,
.primary-nav a:focus-visible {
    background: var(--rose);
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    cursor: pointer;
}

.nav-toggle span {
    width: 19px;
    height: 2px;
    border-radius: 999px;
    background: var(--white);
    transition: transform 180ms ease, opacity 180ms ease;
}

.nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-open .nav-toggle span:nth-child(2) {
    opacity: 0;
}

.nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 58px 0 72px;
    background: var(--paper);
}

.section-with-sakura::before {
    content: "";
    position: absolute;
    left: -120px;
    top: 70px;
    width: 390px;
    height: 650px;
    background: url("../img/sakura-background.png") center / contain no-repeat;
    opacity: 0.13;
    pointer-events: none;
}

.hero__inner {
    position: relative;
    display: grid;
    place-items: center;
    text-align: center;
}

.hero__copy {
    max-width: 920px;
}

.hero__copy h1 {
    margin-bottom: 18px;
}

.hero__copy p:last-child {
    max-width: 860px;
    margin-inline: auto;
    color: #000000;
}

.author {
    background: var(--white);
}

.author.section {
    padding-top: 48px;
}

.author__grid {
    display: grid;
    grid-template-columns: 0.42fr 0.58fr;
    align-items: center;
    gap: 48px;
}

.author__portrait-wrap {
    display: flex;
    align-items: end;
    justify-content: center;
    min-height: 580px;
    background: transparent;
    overflow: hidden;
    padding: 0 34px;
}

.author__portrait {
    max-height: 580px;
    object-fit: contain;
}

.author__content h2 {
    margin-bottom: 22px;
}

.author__content {
    padding-right: 48px;
}

.author__story {
    color: #000000;
}

.author__story p + p {
    margin-top: 16px;
}

.author__quote {
    margin-top: 22px;
    border-radius: 8px;
    background: var(--rose);
    color: #000000;
    padding: 40px;
}

.signature {
    margin-top: 18px;
    color: var(--ink);
    font-family: "Yellowtail", cursive;
    font-size: 40px;
    line-height: 1.2;
}

.books {
    background: var(--paper);
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: min(calc(100vw - 64px), 1320px);
    margin-inline: calc((100% - min(calc(100vw - 64px), 1320px)) / 2);
    gap: 20px;
}

.book-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    overflow: visible;
    border: 0;
    background: transparent;
}

.book-card img {
    width: 100%;
    aspect-ratio: 584 / 800;
    object-fit: contain;
    border-radius: 30px 0 30px 30px;
    filter: drop-shadow(16px 22px 16px rgba(47, 23, 24, 0.22));
    transform: scale(1);
    transition: transform 240ms ease, filter 240ms ease;
    will-change: transform;
}

.book-card img:hover {
    filter: drop-shadow(20px 28px 18px rgba(47, 23, 24, 0.28));
    transform: scale(1.12);
}

.book-card:hover,
.book-card:focus-within {
    z-index: 1;
}

.book-card__body {
    display: grid;
    gap: 8px;
    justify-items: center;
    width: 100%;
    padding: 16px 0 0;
    text-align: center;
}

.button {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--white);
    font-weight: 700;
    padding: 13px 24px;
    transition: background 180ms ease, transform 180ms ease;
}

.button:hover,
.button:focus-visible {
    background: var(--accent-dark);
    color: var(--white);
    transform: translateY(-1px);
}

.book-card .button {
    position: relative;
    left: 16px;
    min-height: 58px;
    padding: 17px 38px;
    font-size: 16px;
    font-weight: 400;
    transition: background 180ms ease, transform 240ms ease;
    transform-origin: center;
}

.book-card .button:hover,
.book-card .button:focus-visible {
    transform: scale(1.12);
}

.button--small {
    min-height: 42px;
    padding: 10px 20px;
}

.checkout {
    background: var(--rose);
}

.checkout.section {
    padding: 38px 0;
}

.checkout__grid {
    display: grid;
    grid-template-columns: 0.42fr 0.58fr;
    align-items: center;
    gap: 44px;
}

.checkout__image {
    display: flex;
    justify-content: center;
}

.checkout__image img {
    width: min(232px, 70%);
}

.checkout__content h2 {
    margin-bottom: 12px;
}

.checkout__status {
    color: var(--ink);
    font-family: "Josefin Sans", Arial, sans-serif;
    font-size: 28px;
    font-weight: 700;
    font-style: italic;
}

.readers {
    background: var(--white);
}

.readers__grid {
    display: grid;
    grid-template-columns: 0.62fr 0.38fr;
    align-items: center;
    gap: 34px;
}

.readers__quotes {
    position: relative;
    z-index: 1;
    width: calc(100% + 84px);
    border-radius: 8px;
    background: var(--accent);
    color: var(--white);
    padding: 126px 138px 126px 54px;
}

.readers__quotes h2 {
    margin-bottom: 0;
    color: var(--white);
}

.testimonial-slider {
    margin-top: 10px;
    overflow: hidden;
}

.testimonial-list {
    display: flex;
    transition: transform 650ms ease;
    will-change: transform;
}

.testimonial {
    flex: 0 0 100%;
    margin: 0;
    padding-top: 6px;
}

.stars {
    color: var(--gold);
    font-size: 20px;
    line-height: 1;
}

.testimonial blockquote {
    margin: 14px 0 22px;
    color: var(--white);
}

.testimonial figcaption {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--rose);
    font-size: 14px;
}

.testimonial figcaption img {
    width: 70px;
    height: 70px;
    flex: 0 0 70px;
    border-radius: 999px;
    object-fit: cover;
}

.testimonial figcaption strong {
    display: block;
    color: var(--white);
    font-family: "Josefin Sans", Arial, sans-serif;
    font-size: 19px;
}

.readers__image {
    position: relative;
    z-index: 2;
    width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.site-footer {
    background: var(--ink);
    color: rgba(255, 255, 255, 0.78);
    padding: 46px 0;
}

.site-footer__inner {
    width: min(calc(100% - 48px), var(--container));
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.footer-brand {
    display: inline-flex;
    width: 220px;
    border-radius: 8px;
    background: var(--white);
    padding: 10px 14px;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
}

.footer-nav a {
    color: var(--white);
    font-family: "Josefin Sans", Arial, sans-serif;
    font-weight: 700;
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
    color: var(--rose);
}

.site-footer p {
    margin: 0;
}

@media (max-width: 1024px) {
    :root {
        --header-height: 82px;
    }

    h1 {
        font-size: 44px;
    }

    h2 {
        font-size: 36px;
    }

    h3 {
        font-size: 22px;
    }

    .section {
        padding: 72px 0;
    }

    .brand {
        width: 210px;
    }

    .hero {
        padding: 64px 0 76px;
    }

    .author__grid,
    .checkout__grid,
    .readers__grid {
        grid-template-columns: 1fr 1fr;
        gap: 28px;
    }

    .author__portrait-wrap {
        min-height: 500px;
        padding-inline: 24px;
    }

    .author__portrait {
        max-height: 500px;
    }

    .author__content {
        padding-right: 28px;
    }

    .author__quote {
        padding: 28px;
    }

    .book-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: min(calc(100vw - 80px), 812px);
        margin-inline: calc((100% - min(calc(100vw - 80px), 812px)) / 2);
        gap: 18px;
    }

    .readers__quotes {
        width: calc(100% + 78px);
        padding: 46px 108px 46px 30px;
    }

    .site-footer__inner {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 767px) {
    :root {
        --header-height: 76px;
    }

    body {
        font-size: 15px;
    }

    h1 {
        font-size: 34px;
    }

    h2 {
        font-size: 30px;
    }

    h3 {
        font-size: 21px;
    }

    .container {
        width: min(calc(100% - 32px), var(--container));
    }

    .section {
        padding: 58px 0;
    }

    .site-header__inner {
        width: min(calc(100% - 28px), var(--container));
    }

    .brand {
        width: 172px;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .primary-nav {
        position: absolute;
        left: 14px;
        right: 14px;
        top: calc(100% + 8px);
        display: grid;
        gap: 4px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--white);
        padding: 10px;
        box-shadow: var(--shadow);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-8px);
        transition: opacity 180ms ease, transform 180ms ease;
    }

    .nav-open .primary-nav {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .primary-nav a {
        padding: 13px 14px;
    }

    .no-js .nav-toggle {
        display: none;
    }

    .no-js .primary-nav {
        position: static;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        box-shadow: none;
    }

    .hero {
        padding: 54px 0 62px;
    }

    .section-with-sakura::before {
        left: -190px;
        top: 220px;
        width: 330px;
    }

    .author__grid,
    .checkout__grid,
    .readers__grid {
        grid-template-columns: 1fr;
    }

    .author__portrait-wrap {
        min-height: 0;
        padding: 26px 26px 0;
    }

    .author__portrait {
        max-height: 480px;
    }

    .author__content {
        padding-right: 0;
        text-align: center;
    }

    .author__story,
    .author__quote {
        text-align: left;
    }

    .signature {
        font-size: 34px;
    }

    .book-grid {
        grid-template-columns: 1fr;
        width: calc(100% - 24px);
        margin-inline: auto;
        gap: 22px;
    }

    .books .section-heading h2 {
        white-space: normal;
    }

    .books .section-heading p span {
        display: inline;
        white-space: normal;
    }

    .book-card {
        max-width: 440px;
        margin-inline: auto;
    }

    .checkout__content {
        text-align: center;
    }

    .checkout__image img {
        width: 150px;
    }

    .readers__quotes {
        width: 100%;
        padding: 50px 24px;
    }

    .readers__image {
        max-width: 420px;
        margin-inline: auto;
        transform: none;
    }

    .footer-brand {
        width: 190px;
    }
}

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

    .book-card img:hover,
    .book-card .button:hover,
    .book-card .button:focus-visible {
        transform: none;
    }
}
