/* ========================================
   TESTIMONIALS / GUESTBOOK PAGE - BOOK THEME
   ======================================== */

/* Fonts and icons loaded locally (see layout: /fonts/newsreader/newsreader.css, /fonts/material-icons/material-icons.css) */

/* CSS Variables for Book Theme */
:root {
    --testimonial-primary: #f4c025;
    --testimonial-parchment: #fdf6e3;
    --testimonial-parchment-dark: #e6dec6;
    --testimonial-leather: #3e2723;
    --testimonial-book-cover: #3e2723;
    --testimonial-ink: #2c241b;
    --testimonial-ink-muted: rgba(62, 39, 35, 0.68);
    --testimonial-sticky-note: #fef9e7;
    --testimonial-bg-light: #f8f8f5;
    --testimonial-bg-dark: #221e10;
}

[data-theme="dark"] {
    /* Candlelit paper: warm cream pages + dark sepia ink (real open book in a dim room) */
    --testimonial-parchment: #ebe0c8;
    --testimonial-parchment-dark: #e0d4ba;
    --testimonial-book-cover: #2a1710;
    --testimonial-leather: #4a2e1f;
    --testimonial-ink: #3a2e22;
    --testimonial-ink-muted: rgba(58, 46, 34, 0.72);
    --testimonial-sticky-note: #f3e8cc;
    --testimonial-primary: #c8941a;
    --testimonial-bg-dark: #16130f;
}

html.dark {
    --testimonial-parchment: #ebe0c8;
    --testimonial-parchment-dark: #e0d4ba;
    --testimonial-book-cover: #2a1710;
    --testimonial-leather: #4a2e1f;
    --testimonial-ink: #3a2e22;
    --testimonial-ink-muted: rgba(58, 46, 34, 0.72);
    --testimonial-sticky-note: #f3e8cc;
    --testimonial-primary: #c8941a;
    --testimonial-bg-dark: #16130f;
}

/* Testimonials Page Container */
.testimonials-page {
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Book Container - center the book on screen */
.testimonials-book-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.testimonials-book-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    position: relative;
}

.testimonials-book-frame {
    position: relative;
    width: 100%;
    max-width: 1152px;
}

/* Book: Left | Spine (middle) | Right - spine in center like a real book */
.testimonials-book {
    direction: ltr; /* keep book layout left-to-right even in RTL locale */
    position: relative;
    width: 100%;
    max-width: 1152px;
    aspect-ratio: 1.4 / 1;
    background: var(--testimonial-parchment);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.75),
        0 0 0 15px var(--testimonial-book-cover);
    border-radius: 0.5rem;
    display: flex;
    overflow: hidden;
    transform-style: preserve-3d;
    perspective: 1600px;
    perspective-origin: 50% 50%;
    touch-action: pan-y;
}

.testimonials-book.book-flipping-next,
.testimonials-book.book-flipping-prev {
    overflow: visible;
}

@media (min-width: 768px) {
    .testimonials-book {
        aspect-ratio: 1.6 / 1;
    }
}

/* Realistic page flip: paper lifts, curls, and casts a shadow on the spread */

@keyframes pageTurnRightToLeft {
    0% {
        transform: rotateY(0deg) rotateX(0deg) translateZ(0);
        box-shadow: none;
    }
    8% {
        transform: rotateY(-12deg) rotateX(1.5deg) translateZ(6px);
        box-shadow: -4px 2px 12px -4px rgba(0, 0, 0, 0.18);
    }
    22% {
        transform: rotateY(-38deg) rotateX(2.5deg) translateZ(14px);
        box-shadow: -10px 4px 22px -6px rgba(0, 0, 0, 0.24);
    }
    42% {
        transform: rotateY(-72deg) rotateX(3deg) translateZ(22px);
        box-shadow: -16px 6px 28px -8px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: rotateY(-90deg) rotateX(2deg) translateZ(24px);
        box-shadow: -18px 8px 32px -8px rgba(0, 0, 0, 0.32);
    }
    58% {
        transform: rotateY(-108deg) rotateX(3deg) translateZ(22px);
        box-shadow: -16px 6px 28px -8px rgba(0, 0, 0, 0.3);
    }
    78% {
        transform: rotateY(-142deg) rotateX(2.5deg) translateZ(14px);
        box-shadow: -10px 4px 22px -6px rgba(0, 0, 0, 0.24);
    }
    92% {
        transform: rotateY(-168deg) rotateX(1.5deg) translateZ(6px);
        box-shadow: -4px 2px 12px -4px rgba(0, 0, 0, 0.18);
    }
    100% {
        transform: rotateY(-180deg) rotateX(0deg) translateZ(0);
        box-shadow: none;
    }
}

@keyframes pageTurnLeftToRight {
    0% {
        transform: rotateY(0deg) rotateX(0deg) translateZ(0);
        box-shadow: none;
    }
    8% {
        transform: rotateY(12deg) rotateX(1.5deg) translateZ(6px);
        box-shadow: 4px 2px 12px -4px rgba(0, 0, 0, 0.18);
    }
    22% {
        transform: rotateY(38deg) rotateX(2.5deg) translateZ(14px);
        box-shadow: 10px 4px 22px -6px rgba(0, 0, 0, 0.24);
    }
    42% {
        transform: rotateY(72deg) rotateX(3deg) translateZ(22px);
        box-shadow: 16px 6px 28px -8px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: rotateY(90deg) rotateX(2deg) translateZ(24px);
        box-shadow: 18px 8px 32px -8px rgba(0, 0, 0, 0.32);
    }
    58% {
        transform: rotateY(108deg) rotateX(3deg) translateZ(22px);
        box-shadow: 16px 6px 28px -8px rgba(0, 0, 0, 0.3);
    }
    78% {
        transform: rotateY(142deg) rotateX(2.5deg) translateZ(14px);
        box-shadow: 10px 4px 22px -6px rgba(0, 0, 0, 0.24);
    }
    92% {
        transform: rotateY(168deg) rotateX(1.5deg) translateZ(6px);
        box-shadow: 4px 2px 12px -4px rgba(0, 0, 0, 0.18);
    }
    100% {
        transform: rotateY(180deg) rotateX(0deg) translateZ(0);
        box-shadow: none;
    }
}

@keyframes bookFlipTiltNext {
    0%, 100% { transform: perspective(1600px) rotateX(0deg); }
    50% { transform: perspective(1600px) rotateX(1.2deg); }
}

@keyframes bookFlipTiltPrev {
    0%, 100% { transform: perspective(1600px) rotateX(0deg); }
    50% { transform: perspective(1600px) rotateX(-1.2deg); }
}

.page-flip-left,
.page-flip-right {
    position: relative;
    transform-style: preserve-3d;
    background: transparent;
    z-index: 1;
}

.page-sheet {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform-origin: left center;
    will-change: transform;
}

.page-flip-left .page-sheet {
    transform-origin: right center;
}

.page-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
}

.page-face--front {
    z-index: 2;
    background: var(--testimonial-parchment);
    background-image: url('/images/testimonials/cream-paper.png');
    background-size: 200px;
    color: var(--testimonial-ink);
    padding: 2rem 2.5rem;
}

.page-flip-right .page-face--front {
    background-color: var(--testimonial-parchment-dark);
    box-shadow: inset 14px 0 36px -18px rgba(0, 0, 0, 0.1);
}

.page-face--back {
    transform: rotateY(180deg);
    z-index: 1;
    background-color: var(--testimonial-parchment-dark);
    background-image:
        linear-gradient(90deg, rgba(0, 0, 0, 0.06) 0%, transparent 28%),
        url('/images/testimonials/cream-paper.png');
    background-size: 100% 100%, 200px;
}

.page-flip-left .page-face--back {
    background-color: var(--testimonial-parchment);
    background-image:
        linear-gradient(270deg, rgba(0, 0, 0, 0.06) 0%, transparent 28%),
        url('/images/testimonials/cream-paper.png');
    background-size: 100% 100%, 200px;
}

[data-theme="dark"] .page-face--front,
html.dark .page-face--front {
    background-color: var(--testimonial-parchment);
    background-image:
        linear-gradient(155deg, rgba(255, 250, 235, 0.42) 0%, transparent 48%),
        url('/images/testimonials/cream-paper.png');
    background-size: 100% 100%, 200px;
}

[data-theme="dark"] .page-flip-right .page-face--front,
html.dark .page-flip-right .page-face--front {
    background-color: var(--testimonial-parchment-dark);
    background-image:
        linear-gradient(155deg, rgba(255, 250, 235, 0.28) 0%, transparent 48%),
        linear-gradient(90deg, rgba(0, 0, 0, 0.09) 0%, transparent 14%),
        url('/images/testimonials/cream-paper.png');
    background-size: 100% 100%, 100% 100%, 200px;
}

[data-theme="dark"] .page-face--back,
html.dark .page-face--back {
    background-color: var(--testimonial-parchment-dark);
}

/* Next spread: right page lifts and turns over the spine */
.page-flip-right.flipping .page-sheet,
.page-flip-left.flipping-reverse .page-sheet {
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.22));
}

.page-flip-right.flipping {
    z-index: 12;
}

.page-flip-right.flipping .page-sheet {
    animation: pageTurnRightToLeft 0.95s cubic-bezier(0.45, 0.05, 0.25, 0.95) forwards;
}

/* Prev spread: left page lifts and turns back */
.page-flip-left.flipping-reverse {
    z-index: 12;
}

.page-flip-left.flipping-reverse .page-sheet {
    animation: pageTurnLeftToRight 0.95s cubic-bezier(0.45, 0.05, 0.25, 0.95) forwards;
}

.testimonials-book.book-flipping-next {
    animation: bookFlipTiltNext 0.95s ease-in-out;
}

.testimonials-book.book-flipping-prev {
    animation: bookFlipTiltPrev 0.95s ease-in-out;
}

.testimonials-book.book-flipping-next .page-flip-left::after,
.testimonials-book.book-flipping-prev .page-flip-right::after {
    opacity: 1;
}

.page-flip-left::after,
.page-flip-right::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 0;
}

.page-flip-left::after {
    background: linear-gradient(270deg, rgba(0, 0, 0, 0.14) 0%, transparent 42%);
}

.page-flip-right::after {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.14) 0%, transparent 42%);
}

@media (prefers-reduced-motion: reduce) {
    .page-flip-right.flipping .page-sheet,
    .page-flip-left.flipping-reverse .page-sheet,
    .testimonials-book.book-flipping-next,
    .testimonials-book.book-flipping-prev {
        animation: none !important;
    }
}

[data-theme="dark"] .testimonials-book,
html.dark .testimonials-book {
    box-shadow:
        0 28px 56px -10px rgba(0, 0, 0, 0.88),
        0 0 0 14px var(--testimonial-book-cover),
        0 0 0 16px rgba(42, 23, 16, 0.55),
        0 0 40px rgba(200, 148, 26, 0.07);
}

/* Book Pages - equal width; spine is a separate center column */
.testimonials-page-left,
.testimonials-page-right {
    flex: 1;
    min-width: 0;
    position: relative;
    padding: 0;
    color: var(--testimonial-ink);
    overflow: visible;
}

.testimonials-page-left {
    border-right: none; /* spine is the center column */
}

/* Spine in the MIDDLE of the book (like a real open book) */
.book-spine-center {
    flex: 0 0 4rem;
    width: 4rem;
    min-width: 4rem;
    background: linear-gradient(90deg,
        rgba(0,0,0,0.05) 0%,
        rgba(0,0,0,0.2) 35%,
        rgba(0,0,0,0.3) 50%,
        rgba(0,0,0,0.2) 65%,
        rgba(0,0,0,0.05) 100%
    );
    pointer-events: none;
    z-index: 10;
}

[data-theme="dark"] .testimonials-page-left,
[data-theme="dark"] .testimonials-page-right,
html.dark .testimonials-page-left,
html.dark .testimonials-page-right {
    color: var(--testimonial-ink);
}

[data-theme="dark"] .book-spine-center,
html.dark .book-spine-center {
    background: linear-gradient(90deg,
        rgba(0, 0, 0, 0.12) 0%,
        rgba(0, 0, 0, 0.38) 35%,
        rgba(0, 0, 0, 0.48) 50%,
        rgba(0, 0, 0, 0.38) 65%,
        rgba(0, 0, 0, 0.12) 100%
    );
}

.testimonials-page-right {
    /* right page styling lives on .page-face--front */
}


/* Page Header */
.testimonials-page-header {
    margin-bottom: 2rem;
    border-bottom: 2px solid rgba(244, 192, 37, 0.3);
    padding-bottom: 1rem;
}

.testimonials-page-header h2 {
    font-family: 'Newsreader', serif;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--testimonial-leather);
    font-style: italic;
    margin: 0;
}

.testimonials-page-header p {
    font-family: 'Newsreader', serif;
    font-size: 1.125rem;
    color: var(--testimonial-ink-muted);
    margin-top: 0.5rem;
    font-style: italic;
}

[data-theme="dark"] .testimonials-page-header,
html.dark .testimonials-page-header {
    border-bottom-color: rgba(200, 148, 26, 0.35);
}

[data-theme="dark"] .testimonials-page-header p,
html.dark .testimonials-page-header p {
    color: var(--testimonial-ink-muted);
}

/* Single Testimonial Page Layout */
.testimonial-single-page {
    position: relative;
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Review Card */
.testimonial-review {
    margin-bottom: 2.5rem;
    position: relative;
}

.testimonial-review:last-child {
    margin-bottom: 0;
}

/* Guest Polaroid */
.testimonial-polaroid {
    position: absolute;
    width: 6rem;
    background: white;
    padding: 0.5rem;
    padding-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: rotate(6deg);
    transition: transform 0.3s;
    z-index: 10;
}

.testimonial-polaroid:hover {
    transform: rotate(0deg);
}

.testimonial-polaroid img {
    width: 100%;
    height: 5rem;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter 0.5s;
}

.testimonial-polaroid:hover img {
    filter: grayscale(0%);
}

.testimonial-polaroid-name {
    text-align: center;
    margin-top: 0.5rem;
    font-family: 'Newsreader', serif;
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
}

/* Polaroid Tape */
.polaroid-tape {
    position: absolute;
    top: -0.75rem;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 3rem;
    height: 1rem;
    background-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    backdrop-filter: blur(2px);
}

/* Review Content */
.testimonial-content {
    padding-right: 6rem;
}

.testimonial-content-right {
    padding-left: 6rem;
}

/* Stars Rating */
.testimonial-stars {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    color: var(--testimonial-primary);
}

.testimonial-stars .material-icons {
    font-size: 1.25rem;
}

/* Review Title */
.testimonial-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--testimonial-leather);
    margin-bottom: 0.25rem;
}

/* Review Date */
.testimonial-date {
    font-size: 0.875rem;
    color: var(--testimonial-ink-muted);
    margin-bottom: 0.75rem;
    font-style: italic;
}

/* Review Text */
.testimonial-text {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--testimonial-ink);
    font-family: 'Newsreader', serif;
    font-style: italic;
}

/* Single Page Testimonial Styles */
.testimonial-single-page .testimonial-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--testimonial-leather);
    margin-bottom: 0.5rem;
    font-family: 'Newsreader', serif;
}

.testimonial-single-page .testimonial-date {
    font-size: 0.875rem;
    color: var(--testimonial-ink-muted);
    font-style: italic;
    margin-bottom: 1rem;
    font-family: 'Newsreader', serif;
}

.testimonial-single-page .testimonial-text {
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--testimonial-ink);
    font-family: 'Newsreader', serif;
    font-style: italic;
}

/* Guestbook: multiple reviews per page (2 left, 2 right) - NO scroll */
.testimonials-list {
    overflow: hidden;
    overflow-x: hidden;
}

.guestbook-review-card .testimonial-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--testimonial-leather);
    margin-bottom: 0.25rem;
    font-family: 'Newsreader', serif;
}

.guestbook-review-card .testimonial-date {
    font-size: 0.875rem;
    color: var(--testimonial-ink-muted);
    font-style: italic;
    margin-bottom: 0.75rem;
}

[data-theme="dark"] .guestbook-review-card .testimonial-date,
html.dark .guestbook-review-card .testimonial-date {
    color: var(--testimonial-ink-muted);
}

.guestbook-review-card .testimonial-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--testimonial-ink);
    font-family: 'Newsreader', serif;
    font-style: italic;
}

/* Show more button for long comments - pill style */
.guestbook-show-more {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--testimonial-leather);
    background: rgba(244, 192, 37, 0.2);
    border: 1px solid rgba(244, 192, 37, 0.5);
    border-radius: 9999px;
    cursor: pointer;
    text-decoration: none;
    font-style: normal;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.guestbook-show-more:hover {
    background: rgba(244, 192, 37, 0.35);
    color: var(--testimonial-leather);
    border-color: var(--testimonial-primary);
}
.guestbook-show-more .material-icons {
    font-size: 1rem;
}

/* Note overlay: full comment in a sticky-note sheet (book theme) */
.guestbook-note-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(34, 24, 18, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}
.guestbook-note-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.guestbook-note-stack {
    width: 100%;
    max-width: 420px;
    display: flex;
    justify-content: center;
    padding: 0.5rem;
}
.guestbook-note {
    position: relative;
    max-width: 420px;
    width: 100%;
    max-height: 70vh;
    overflow: hidden;
    background: var(--testimonial-sticky-note);
    background-image: url('/images/testimonials/cream-paper.png');
    background-size: 120px;
    padding: 1.35rem 1.25rem 1.25rem;
    box-shadow:
        0 0 0 4px var(--testimonial-book-cover),
        0 12px 36px rgba(0, 0, 0, 0.35),
        2px 3px 0 rgba(0, 0, 0, 0.08);
    transform: rotate(-0.8deg) translateY(12px);
    border: 1px solid rgba(62, 39, 35, 0.18);
    border-radius: 0.15rem;
    transition: transform 0.25s ease;
}
.guestbook-note--sheet {
    border-radius: 0.15rem 0.65rem 0.15rem 0.15rem;
}
.guestbook-note-tape {
    position: absolute;
    top: -0.55rem;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 4.5rem;
    height: 1.15rem;
    background: rgba(244, 192, 37, 0.72);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    pointer-events: none;
}
.guestbook-note-overlay.is-open .guestbook-note {
    transform: rotate(-0.5deg) translateY(0);
}
.guestbook-note-header {
    margin-bottom: 0.75rem;
    padding-right: 1.75rem;
}
.guestbook-note-stars {
    display: flex;
    gap: 0.05rem;
    margin-bottom: 0.35rem;
}
.guestbook-note-stars .material-icons {
    font-size: 1rem !important;
}
.guestbook-note-title {
    margin: 0 0 0.25rem;
    font-family: 'Newsreader', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--testimonial-leather);
    line-height: 1.3;
}
.guestbook-note-meta {
    margin: 0;
    font-size: 0.75rem;
    color: var(--testimonial-ink-muted);
    font-style: italic;
}
.guestbook-note-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    background: transparent;
    color: var(--testimonial-leather);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}
.guestbook-note-close:hover {
    background: rgba(62, 39, 35, 0.1);
    color: var(--testimonial-leather);
}
.guestbook-note-close .material-icons {
    font-size: 1.25rem;
}
.guestbook-note-content {
    font-family: 'Newsreader', serif;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--testimonial-ink);
    font-style: italic;
    overflow-y: auto;
    max-height: calc(70vh - 7rem);
    padding-right: 0.35rem;
}
.guestbook-note-content::-webkit-scrollbar {
    width: 6px;
}
.guestbook-note-content::-webkit-scrollbar-thumb {
    background: rgba(62, 39, 35, 0.25);
    border-radius: 3px;
}

@media (max-width: 480px) {
    .guestbook-note-overlay {
        align-items: flex-end;
        padding: 0.75rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    }
    .guestbook-note-stack {
        max-width: 100%;
    }
    .guestbook-note {
        max-width: 100%;
        max-height: min(78vh, 520px);
        padding: 1.15rem 1rem 1rem;
        transform: rotate(-0.4deg) translateY(100%);
        border-radius: 0.35rem 0.35rem 0.15rem 0.15rem;
    }
    .guestbook-note-overlay.is-open .guestbook-note {
        transform: rotate(-0.35deg) translateY(0);
    }
    .guestbook-note-content {
        max-height: calc(78vh - 8rem);
        font-size: 0.875rem;
    }
    .guestbook-note-close {
        top: 0.35rem;
        right: 0.35rem;
        width: 2rem;
        height: 2rem;
    }
}

body.guestbook-note-open {
    overflow: hidden;
}

[data-theme="dark"] .guestbook-note,
html.dark .guestbook-note {
    background-color: var(--testimonial-sticky-note);
    background-image:
        linear-gradient(155deg, rgba(255, 250, 235, 0.35) 0%, transparent 50%),
        url('/images/testimonials/cream-paper.png');
    background-size: 100% 100%, 120px;
    border-color: rgba(74, 46, 31, 0.22);
    box-shadow:
        0 0 0 4px var(--testimonial-book-cover),
        0 14px 40px rgba(0, 0, 0, 0.45),
        2px 3px 0 rgba(0, 0, 0, 0.1);
}
[data-theme="dark"] .guestbook-note-content,
html.dark .guestbook-note-content {
    color: var(--testimonial-ink);
}
[data-theme="dark"] .guestbook-note-close,
html.dark .guestbook-note-close {
    color: var(--testimonial-leather);
}
[data-theme="dark"] .guestbook-note-close:hover,
html.dark .guestbook-note-close:hover {
    background: rgba(74, 46, 31, 0.1);
}
[data-theme="dark"] .guestbook-note-meta,
html.dark .guestbook-note-meta {
    color: var(--testimonial-ink-muted);
}
[data-theme="dark"] .guestbook-note-title,
html.dark .guestbook-note-title {
    color: var(--testimonial-leather);
}
[data-theme="dark"] .guestbook-show-more,
html.dark .guestbook-show-more {
    color: var(--testimonial-leather);
    background-color: var(--testimonial-sticky-note);
    background-image: url('/images/testimonials/cream-paper.png');
    background-size: 80px;
    border-color: rgba(200, 148, 26, 0.45);
}
[data-theme="dark"] .guestbook-show-more:hover,
html.dark .guestbook-show-more:hover {
    background-color: #f8efcf;
    border-color: var(--testimonial-primary);
}
[data-theme="dark"] .guestbook-flip-note,
html.dark .guestbook-flip-note {
    background-color: var(--testimonial-sticky-note);
    border-color: rgba(74, 46, 31, 0.2);
    color: var(--testimonial-leather);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), 1px 2px 0 rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] .testimonial-doodle,
html.dark .testimonial-doodle {
    opacity: 0.14;
    mix-blend-mode: multiply;
}
[data-theme="dark"] .guestbook-note-overlay,
html.dark .guestbook-note-overlay {
    background: rgba(22, 16, 12, 0.72);
}
[data-theme="dark"] .testimonial-form-modal,
html.dark .testimonial-form-modal {
    background-color: var(--testimonial-parchment);
    background-image:
        linear-gradient(155deg, rgba(255, 250, 235, 0.35) 0%, transparent 50%),
        url('/images/testimonials/cream-paper.png');
    background-size: 100% 100%, 200px;
    color: var(--testimonial-ink);
}
.guestbook-polaroid {
    position: absolute;
    top: 0;
}

.guestbook-polaroid.polaroid-right {
    right: -0.5rem;
    left: auto;
}

.guestbook-polaroid.polaroid-left {
    left: -0.5rem;
    right: auto;
}

.guestbook-polaroid .shadow-polaroid {
    width: 6rem;
    max-width: 6rem;
    padding-bottom: 2rem;
}

.guestbook-polaroid .polaroid-img-wrap {
    width: 100%;
    height: 5rem;
    min-height: 5rem;
    background: #e5e7eb;
    overflow: hidden;
    position: relative;
    filter: grayscale(100%);
    transition: filter 0.5s;
}

.guestbook-polaroid:hover .polaroid-img-wrap {
    filter: grayscale(0%);
}

.guestbook-polaroid .polaroid-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.font-handwriting {
    font-family: 'Newsreader', serif;
    font-style: italic;
}

.shadow-polaroid {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Page Number */
.testimonial-page-number {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    color: var(--testimonial-ink-muted);
    font-weight: bold;
    font-size: 0.875rem;
}

[data-theme="dark"] .testimonial-page-number,
html.dark .testimonial-page-number {
    color: var(--testimonial-ink-muted);
}

/* Filter Bookmark */
.testimonial-filter-bookmark {
    position: absolute;
    top: -1rem;
    right: 3rem;
    z-index: 20;
}

.testimonial-filter-bookmark button {
    background: var(--testimonial-primary);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    width: 4rem;
    height: 6rem;
    border-radius: 0 0 0.5rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 1rem;
    cursor: pointer;
    border: none;
    transition: transform 0.3s;
    color: var(--testimonial-bg-dark);
}

.testimonial-filter-bookmark button:hover {
    transform: translateY(-0.5rem);
}

.testimonial-filter-bookmark .material-icons {
    font-size: 1.5rem;
}

.testimonial-filter-bookmark span {
    font-size: 0.75rem;
    font-weight: bold;
    margin-top: 0.25rem;
}

/* RTL: filter bookmark on the other side (stick out from start side) */
[dir="rtl"] .testimonial-filter-bookmark {
    right: auto;
    left: 3rem;
}
[dir="rtl"] .testimonial-filter-bookmark button {
    border-radius: 0.5rem 0 0 0.5rem;
}

/* Flip controls OUTSIDE book - always visible below the book */
.testimonial-flip-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    direction: ltr; /* book is LTR: prev left, next right in fa/en */
}

/* RTL locale: keep same order as LTR (do not mirror flex or icons) */
[dir="rtl"] .testimonial-flip-controls {
    flex-direction: row;
    direction: ltr;
}
[dir="rtl"] .testimonial-flip-controls-mobile {
    flex-direction: row;
}
[dir="rtl"] .testimonial-flip-controls-mobile .testimonial-flip-btn-circle .material-icons {
    transform: scaleX(-1);
}

.testimonial-flip-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--testimonial-leather);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9375rem;
    font-family: 'Newsreader', serif;
    padding: 0.5rem 0.75rem;
    transition: color 0.2s;
}

.testimonial-flip-btn:hover:not(:disabled) {
    color: var(--testimonial-primary);
}

.testimonial-flip-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.testimonial-flip-sep {
    color: var(--testimonial-leather);
    opacity: 0.5;
    font-weight: bold;
}

[data-theme="dark"] .testimonial-flip-btn,
html.dark .testimonial-flip-btn {
    color: var(--testimonial-leather);
}
[data-theme="dark"] .testimonial-flip-btn:hover:not(:disabled),
html.dark .testimonial-flip-btn:hover:not(:disabled) {
    color: var(--testimonial-primary);
}
[data-theme="dark"] .testimonial-flip-sep,
html.dark .testimonial-flip-sep {
    color: var(--testimonial-leather);
}
[data-theme="dark"] .testimonial-flip-btn-circle,
html.dark .testimonial-flip-btn-circle {
    background: var(--testimonial-leather);
    color: var(--testimonial-primary);
}

.testimonial-flip-controls-mobile {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.testimonial-flip-btn-circle {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background: var(--testimonial-leather);
    color: var(--testimonial-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.testimonial-flip-btn-circle .material-icons {
    font-size: 1.25rem;
}

.testimonial-pagination .material-icons {
    font-size: 1.25rem;
}

/* Utility Classes */
.w-1 { width: 0.25rem; }
.h-1 { height: 0.25rem; }
.w-1\.5 { width: 0.375rem; }
.h-1\.5 { height: 0.375rem; }
.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.w-100 { width: 100%; }
.h-100 { height: 100%; }
.pr-24 { padding-right: 6rem; }
.pl-24 { padding-left: 6rem; }
.mb-10 { margin-bottom: 2.5rem; }
.absolute { position: absolute; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.pointer-events-none { pointer-events: none; }
.bg-gradient-to-b { background-image: linear-gradient(to bottom, var(--tw-gradient-stops)); }
.from-black\/40 { --tw-gradient-from: rgba(0, 0, 0, 0.4); }
.via-transparent { --tw-gradient-via: transparent; }
.to-black\/60 { --tw-gradient-to: rgba(0, 0, 0, 0.6); }

/* ========== MOBILE: notebook – one spread (4 comments) per page, no skip ========== */
.testimonials-list-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.testimonials-list-mobile .guestbook-review-card {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(62, 39, 35, 0.12);
}
[data-theme="dark"] .testimonials-list-mobile .guestbook-review-card,
html.dark .testimonials-list-mobile .guestbook-review-card {
    border-bottom-color: rgba(74, 46, 31, 0.18);
}
.testimonials-list-mobile .guestbook-review-card:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Sticky-note page turners (mobile – overlaid on book footer) */
.guestbook-flip-notes {
    display: none;
}

.guestbook-flip-note {
    position: absolute;
    bottom: 0;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 2.5rem;
    min-width: 5.5rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid rgba(62, 39, 35, 0.18);
    background: var(--testimonial-sticky-note);
    background-image: url('/images/testimonials/cream-paper.png');
    background-size: 100px;
    color: var(--testimonial-leather);
    font-family: 'Newsreader', serif;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Book layout is LTR: prev = left page side, next = right page side (same in fa/en) */
.guestbook-flip-note--prev {
    left: 0.35rem;
    transform: rotate(-2.5deg);
    border-radius: 0.2rem 0.65rem 0.2rem 0.2rem;
}

.guestbook-flip-note--next {
    right: 0.35rem;
    transform: rotate(2deg);
    border-radius: 0.65rem 0.2rem 0.2rem 0.2rem;
}

.guestbook-flip-note__corner {
    position: absolute;
    top: 0;
    width: 0.65rem;
    height: 0.65rem;
    background: rgba(244, 192, 37, 0.35);
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.guestbook-flip-note--prev .guestbook-flip-note__corner {
    left: 0;
}

.guestbook-flip-note--next .guestbook-flip-note__corner {
    right: 0;
    transform: scaleX(-1);
}

.guestbook-flip-note__icon {
    font-size: 0.95rem !important;
    color: var(--testimonial-primary);
}

.guestbook-flip-note:active:not(:disabled) {
    transform: rotate(0deg) scale(0.97);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
}

.guestbook-flip-note--prev:active:not(:disabled) {
    transform: rotate(-1deg) scale(0.97);
}

.guestbook-flip-note--next:active:not(:disabled) {
    transform: rotate(1deg) scale(0.97);
}

.guestbook-flip-note:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    filter: grayscale(0.25);
}

.guestbook-page-blank {
    min-height: 3rem;
}

.guestbook-page-blank--soft {
    min-height: 100%;
    opacity: 0.35;
}

.guestbook-header--compact {
    display: none !important;
}

.guestbook-review-card--mobile-single {
    margin-bottom: 0 !important;
    padding-bottom: 1.75rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.guestbook-mobile-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.guestbook-mobile-meta {
    flex: 1;
    min-width: 0;
}

.guestbook-mobile-date {
    margin: 0 !important;
    font-size: 0.65rem !important;
    line-height: 1.2;
}

.guestbook-review-card--mobile-single .guestbook-polaroid--inline {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    display: block;
    flex-shrink: 0;
    margin-bottom: 0 !important;
    transform: rotate(-2deg) !important;
}

.guestbook-review-card--mobile-single .guestbook-polaroid--inline .shadow-polaroid {
    width: 3.1rem;
    max-width: 3.1rem;
    padding: 0.25rem 0.25rem 0.85rem;
}

.guestbook-review-card--mobile-single .guestbook-polaroid--inline .polaroid-img-wrap {
    height: 2.35rem;
    min-height: 2.35rem;
}

.guestbook-review-card--mobile-single .guestbook-polaroid--inline .font-handwriting {
    font-size: 0.55rem !important;
    margin-top: 0.15rem !important;
}

.guestbook-review-card--mobile-single .guestbook-polaroid--inline .polaroid-tape {
    width: 1.75rem !important;
    height: 0.55rem !important;
    top: -0.4rem !important;
}

.guestbook-review-body--mobile {
    padding-inline: 0 !important;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.guestbook-review-card--mobile-single .testimonial-stars {
    margin-bottom: 0 !important;
    gap: 0;
}

.guestbook-review-card--mobile-single .testimonial-stars .material-icons {
    font-size: 0.82rem !important;
}

.guestbook-review-card--mobile-single .testimonial-title {
    font-size: 0.82rem;
    line-height: 1.25;
    margin-bottom: 0.2rem !important;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.guestbook-review-card--mobile-single .testimonial-text {
    font-size: 0.74rem;
    line-height: 1.45;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.guestbook-review-card--mobile-single .guestbook-property-ref {
    font-size: 0.65rem !important;
    margin-bottom: 0.25rem !important;
}

.guestbook-review-card--mobile-single .guestbook-property-thumb {
    width: 1.35rem !important;
    height: 1.35rem !important;
}

.guestbook-show-more--mobile {
    align-self: flex-start;
    margin-top: 0.35rem;
    padding: 0.28rem 0.5rem;
    font-size: 0.68rem;
    border-radius: 0.15rem 0.45rem 0.15rem 0.15rem;
    background: var(--testimonial-sticky-note);
    background-image: url('/images/testimonials/cream-paper.png');
    background-size: 80px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
    transform: rotate(-1deg);
}

.guestbook-show-more--mobile .material-icons {
    font-size: 0.85rem !important;
}

.guestbook-show-more--mobile[hidden] {
    display: none !important;
}

@media (max-width: 767px) {
    .client-main.testimonials-page {
        min-height: auto;
        padding-bottom: var(--theme-bottom-nav-clearance, calc(4.85rem + env(safe-area-inset-bottom, 0px)));
    }

    .client-main.testimonials-page > .theme-footer {
        margin-top: 0;
        margin-bottom: 0;
        padding-block: 0.35rem;
    }

    .testimonials-book-container {
        padding: 1.25rem 0.5rem 1.25rem;
        min-height: auto;
        align-items: center;
        justify-content: center;
    }

    .testimonials-book-wrapper {
        width: 100%;
        max-width: 420px;
        gap: 0.35rem;
    }

    .testimonials-book-frame {
        max-width: 100%;
        padding-bottom: 0.5rem;
    }

    .testimonials-book {
        max-width: 100%;
        width: 100%;
        aspect-ratio: 1.48 / 1;
        min-height: 255px;
        max-height: min(56vh, 400px);
    }

    .page-face--front {
        padding: 0.55rem 0.45rem 2.65rem;
    }

    .testimonials-page-left .testimonials-list,
    .testimonials-page-left #leftPageContent {
        min-height: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .book-spine-center {
        flex: 0 0 1.15rem;
        width: 1.15rem;
        min-width: 1.15rem;
    }

    .testimonials-page-header {
        margin-bottom: 0.35rem;
        padding-bottom: 0.3rem;
    }

    .testimonials-page-header h2 {
        font-size: 1.05rem;
    }

    .testimonials-page-header p {
        font-size: 0.68rem;
        margin-top: 0.1rem;
    }

    .testimonial-doodle {
        width: 4.5rem;
        height: 4.5rem;
        opacity: 0.08;
    }

    .testimonial-flip-controls {
        display: none !important;
    }

    .testimonial-flip-controls-mobile {
        display: none !important;
    }

    .guestbook-flip-notes {
        display: block;
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 0;
        pointer-events: none;
        z-index: 35;
    }

    .guestbook-flip-note {
        pointer-events: auto;
        max-width: calc(50% - 0.35rem);
        bottom: 0.15rem;
        transform: rotate(-2.5deg);
        font-size: 0.72rem;
        min-height: 2.25rem;
        min-width: 4.75rem;
        padding: 0.35rem 0.45rem;
    }

    .guestbook-flip-note--next {
        transform: rotate(2deg);
    }

    .guestbook-flip-note--prev:active:not(:disabled),
    .guestbook-flip-note--next:active:not(:disabled),
    .guestbook-flip-note:active:not(:disabled) {
        transform: rotate(0deg) scale(0.97);
    }

    .guestbook-flip-note__text {
        direction: rtl;
        unicode-bidi: plaintext;
        white-space: nowrap;
    }

    .testimonial-page-number {
        font-size: 0.68rem;
        bottom: 2.35rem;
        opacity: 0.5;
    }

    .testimonial-filter-bookmark {
        right: 0.25rem;
        top: -0.3rem;
    }

    [dir="rtl"] .testimonial-filter-bookmark {
        right: auto;
        left: 0.25rem;
    }

    .testimonial-filter-bookmark button {
        width: 2.45rem;
        height: 3.5rem;
        padding-bottom: 0.35rem;
    }

    .testimonial-filter-bookmark .material-icons {
        font-size: 1rem;
    }

    .testimonial-filter-bookmark span {
        font-size: 0.55rem;
    }

    .guestbook-show-more {
        padding: 0.28rem 0.5rem;
        min-height: auto;
        font-size: 0.68rem;
    }

    .guestbook-review-card--mobile-single {
        padding-bottom: 1.35rem;
    }
}

@media (max-width: 380px) {
    .testimonials-book {
        aspect-ratio: 1.32 / 1;
        min-height: 248px;
        max-height: min(54vh, 380px);
    }

    .page-face--front {
        padding-inline: 0.45rem;
    }

    .guestbook-flip-note {
        font-size: 0.7rem;
        min-width: 4.85rem;
        min-height: 2.35rem;
        padding: 0.35rem 0.45rem;
    }
}

/* Form Section - Modal Overlay */
.testimonial-form-section {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
}

.testimonial-form-modal {
    max-width: 600px;
    width: 90%;
    margin: 0 auto;
    padding: 2rem;
    background: var(--testimonial-parchment);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    position: relative;
}

/* Decorative Elements */
.testimonial-doodle {
    position: absolute;
    top: 0;
    right: 0;
    opacity: 0.1;
    pointer-events: none;
    transform: rotate(12deg);
    width: 12rem;
    height: 12rem;
    mix-blend-mode: multiply;
}

.testimonial-quill {
    position: absolute;
    right: -1rem;
    bottom: 2.5rem;
    width: 6rem;
    height: 6rem;
    opacity: 0.9;
    pointer-events: none;
    filter: drop-shadow(0 25px 50px rgba(0, 0, 0, 0.5));
}

@media (max-width: 1280px) {
    .testimonial-quill {
        display: none;
    }
}

/* Navigation */
.testimonials-nav {
    position: relative;
    z-index: 20;
    width: 100%;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--testimonial-parchment);
}

.testimonials-nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.testimonials-nav-brand .material-icons {
    color: var(--testimonial-primary);
    font-size: 2rem;
}

.testimonials-nav-brand h1 {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--testimonial-primary);
    margin: 0;
}

.testimonials-nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.testimonials-nav-links button {
    background: none;
    border: none;
    color: var(--testimonial-parchment);
    cursor: pointer;
    transition: color 0.3s;
    padding: 0;
}

.testimonials-nav-links button:hover {
    color: var(--testimonial-primary);
}

.testimonials-nav-links button.active {
    font-weight: bold;
    border-bottom: 2px solid var(--testimonial-primary);
}
