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

:root {
    --font-forum: Forum, Georgia, serif;
    --font-roboto: "Roboto Slab", Georgia, serif;
    --font-serif: serif;
}

body {
    font-family: var(--font-forum), serif;
    background-color: #1a1410;
    background-image: url('../img/book-background.avif');
    background-image: -webkit-image-set(
        url('../img/book-background.avif') 1x,
        url('../img/book-background.webp') 1x,
        url('../img/book-background.jpg') 1x
    );
    background-image: image-set(
        url('../img/book-background.avif') type('image/avif'),
        url('../img/book-background.webp') type('image/webp'),
        url('../img/book-background.jpg') type('image/jpeg')
    );
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: #f5f5f5;
    line-height: 1.7;
    overflow-x: hidden;
}

/* iOS Safari: fixed backgrounds not supported, use repeating scroll instead */
@supports (-webkit-touch-callout: none) {
    body {
        background-attachment: scroll;
        background-size: auto;
        background-repeat: repeat;
        background-position: top center;
    }
}

/* Fallback for browsers that don't support image-set */
@supports not (background-image: image-set(url('../img/book-background.avif') type('image/avif'))) {
    body {
        background-image: url('../img/book-background.webp');
    }
}

@supports not (background-image: image-set(url('../img/book-background.webp') type('image/webp'))) {
    body {
        background-image: url('../img/book-background.jpg');
    }
}

@font-face {
   font-display: block;
   font-family: 'Forum';
   font-style: normal;
   font-weight: 400;
   src: url('../fonts/forum-v19-cyrillic_cyrillic-ext_latin_latin-ext-regular.woff2') format('woff2');
}

@font-face {
  font-display: block;
  font-family: 'Roboto Slab';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/roboto-slab-v36-cyrillic_cyrillic-ext_latin_latin-ext-regular.woff2') format('woff2');
}

@font-face {
    font-display: block;
    font-family: 'Roboto Slab';
    font-style: normal;
    font-weight: 700;
    src: url('../fonts/roboto-slab-v36-cyrillic_cyrillic-ext_latin_latin-ext-700.woff2') format('woff2');
}

@font-face {
  font-display: block;
  font-family: 'Pacifico';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/pacifico-v23-cyrillic_cyrillic-ext_latin_latin-ext-regular.woff2') format('woff2');
}

.page-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 20px;
}

.page-container :where(h1, hr, section, div, p) {
    text-align: left;
    margin-bottom: 20px;
}

.main-title {
    font-family: var(--font-forum), serif;
    font-size: clamp(24px, 3vw, 36px);
    font-weight: 700;
    line-height: 1.4;
    color: #ffffff;
    margin-bottom: 0;
    letter-spacing: 0.2px;
}

.text-base {
    font-family: var(--font-roboto), serif;
    font-size: clamp(16px, 2vw, 24px);
    line-height: 1.8;
    color: #e8e8e8;
    font-weight: 500;
}

.text-italic {
    font-family: var(--font-serif), serif;
    font-style: italic;
}

.text-bold {
    font-weight: 700;
}

.text-block {
    font-family: var(--font-roboto), serif;
    font-size: clamp(16px, 2vw, 24px);
    line-height: 1.8;
    color: #e8e8e8;
    font-weight: 500;
}

.memories * + * {
    margin-top: 32px;
}

.signature {
    font-family: Forum, Georgia, serif;
    text-align: right;
    font-size: clamp(20px, 3.5vw, 28px);
    font-style: italic;
    color: #d4b584;
    font-weight: 300;
    letter-spacing: 1px;
}

.handwritten-word {
    display: block;
    text-align: right;
    font-family: 'Pacifico', cursive;
    font-size: clamp(32px, 3.5vw, 42px);
    font-style: italic;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.books-image {
    display: flex;
    justify-content: flex-start;
    margin: 0;
}

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

.books-caption {
    font-family: var(--font-roboto), serif;
    font-size: clamp(12px, 1.2vw, 16px);
    line-height: 1.6;
    color: #d8d8d8;
    text-align: center;
    margin-top: 2px;
    font-weight: 300;
}

.quote,
.testimonial {
    font-family: var(--font-roboto), serif;
    font-size: clamp(24px, 2.7vw, 30px);
    line-height: 1.7;
    font-weight: 700;
}

.quote-attribution,
.testimonial-attribution {
    font-family: var(--font-roboto), serif;
    font-size: clamp(14px, 2vw, 16px);
    color: #b8b8b8;
    font-weight: 300;
    line-height: 1.7;
    text-align: right;
    margin-top: 8px;
}

.contact-intro {
    font-size: clamp(16px, 1.7vw, 20px);
    margin-bottom: 26px;
}

.message-box {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.message-input {
    width: 100%;
    padding: 20px 24px;
    font-size: clamp(15px, 2vw, 16px);
    line-height: 1.65;
    background-color: rgba(255, 255, 255, 0.95);
    color: #333;
    border: none;
    border-radius: 24px;
    font-family: var(--font-roboto), serif;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.submit-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    padding: 18px 32px;
    font-size: clamp(16px, 2.2vw, 19px);
    font-weight: 500;
    background: #7a4f5e;
    color: #ffffff;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-family: 'Roboto Slab', 'Georgia', serif;
    text-align: center;
    text-decoration: none;
}

.submit-button:hover {
    background: #8d5f70;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

.telegram-icon {
    flex-shrink: 0;
}

.submit-button:active {
    transform: translateY(0);
}

.subtitle {
    font-family: var(--font-forum), serif;
    font-size: clamp(20px, 2.7vw, 32px);
    font-weight: 700;
    letter-spacing: 0.2px;
    text-align: center;
}

.process-steps {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 0;
    border-collapse: separate;
    border-spacing: 0 45px;
}

.subtitle-2 {
    font-family: var(--font-forum), serif;
    font-size: clamp(22px, 2.7vw, 32px);
    font-weight: 500;
    color: #ffffff;
    line-height: 1.2;
    padding-right: 20px;
    vertical-align: top;
    white-space: nowrap;
}

.item-description {
    font-family: var(--font-roboto), serif;
    font-size: clamp(16px, 2.5vw, 20px);
    line-height: 1.75;
    color: #d8d8d8;
    font-weight: 300;
    vertical-align: top;
}

.i-do-section {
    font-size: clamp(16px, 2.5vw, 20px);
    width: -moz-fit-content;
    width: -webkit-fit-content;
    width: fit-content;
    margin: 0 auto;
    text-align: left;
}

.to-be-heard {
    font-size: clamp(12px, 1.4vw, 16px);
    text-align: center;
}

.text-centered {
    text-align: center;
}

/* Benefits Section */
.benefits-section {
    text-align: left;
    padding: 0;
}

.benefits-list {
    width: -moz-fit-content;
    width: -webkit-fit-content;
    width: fit-content;
    max-width: 500px;
    margin: 0 auto;
    padding: 0;
    border-collapse: separate;
    border-spacing: 0 24px;
}

.benefits-list td {
    vertical-align: middle;
}

.gift-table {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.gift-table td {
    vertical-align: top;
}

.gift-table .subtitle-2 {
    padding-right: 20px;
}

.gift-content {
    text-align: left;
}

.gift-description {
    font-family: var(--font-roboto), serif;
    font-size: clamp(14px, 1.4vw, 16px);
    line-height: 1.75;
    color: #e8e8e8;
}

/* Author Section */
.author-section {
    text-align: center;
}

.author-image {
    display: flex;
    justify-content: center;
    padding: 0;
}

.author-image img {
    max-width: min(500px, 100%);
    height: auto;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    display: block;
    margin: 0 auto;
}

/* Decorative Separator */
.separator {
    width: 100%;
    max-width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(201, 168, 117, 0.3) 20%, rgba(201, 168, 117, 0.8) 50%, rgba(201, 168, 117, 0.3) 80%, transparent 100%);
    margin: 24px auto;
    border: none;
    position: relative;
}

.audio-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
    margin-left: auto;
    margin-right: auto;
    max-width: 500px;
}

.final-padding {
    padding-top: 80px;
    padding-bottom: 20px;
    text-align: center;
    color: gray;
}

/* Quote Carousel */
.quote-carousel-section, .testimonial-carousel-section { overflow: hidden; }

.carousel-viewport {
    position: relative;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    cursor: grab;
    margin-bottom: 0;
}
.carousel-viewport:active { cursor: grabbing; }

.carousel-track {
    display: flex;
    gap: 16px;
    will-change: transform;
    margin-bottom: 0;
}

.carousel-slide {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 32px 28px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.carousel-slide .quote {
    font-size: clamp(17px, 2.2vw, 24px);
    line-height: 1.65;
}

.carousel-fade-left,
.carousel-fade-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 2;
}
.carousel-fade-left {
    left: 0;
    background: linear-gradient(to right, rgba(26, 20, 16, 0.5) 0%, transparent 100%);
}
.carousel-fade-right {
    right: 0;
    background: linear-gradient(to left, rgba(26, 20, 16, 0.5) 0%, transparent 100%);
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    padding: 0;
    transition: background 0.3s;
}
.carousel-dot.active { background: rgba(255, 255, 255, 0.8); }

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}
