/* =============================================
   Transform Reads — Reader Reviews Widget
   Open Book Design (Strong Edition)
   ============================================= */

/* ── Outer wrapper: the closed book silhouette ── */
.tr-reviews-widget {
    font-family: Georgia, 'Times New Roman', serif;
    position: relative;
    width: 100%;
    max-width: 560px;
    box-sizing: border-box;
    display: flex;
    border-radius: 4px 14px 14px 4px;

    /* Multi-layer shadow for a thick book feel */
    box-shadow:
        -6px 0 0 #5a3a1a,           /* spine edge hard */
        -10px 0 0 #7a5230,          /* spine body */
        -14px 2px 0 #4a2e10,        /* spine deep shadow */
        6px 8px 28px rgba(0,0,0,0.30),
        2px 2px 0 rgba(255,255,255,0.12) inset;
}

/* ── The spine column ── */
.tr-reviews-spine {
    width: 38px;
    flex-shrink: 0;
    background: linear-gradient(to right,
        #4a2e10 0%, #7a5230 30%, #9a6a40 60%, #c8903a 80%, #b07830 100%
    );
    border-radius: 4px 0 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Spine inner highlight groove */
.tr-reviews-spine::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: 8px; width: 2px;
    background: rgba(255,255,255,0.08);
}

/* Spine vertical text */
.tr-reviews-spine-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255, 235, 180, 0.75);
    font-family: Georgia, serif;
    white-space: nowrap;
    user-select: none;
}

/* ── The page body ── */
.tr-reviews-page {
    flex: 1;
    min-width: 0;
    background:
        /* Subtle page-gradient: slightly brighter at top */
        linear-gradient(to bottom, #fdf8ee 0%, #f8f0dc 100%);
    border-radius: 0 14px 14px 0;
    padding: 28px 28px 22px 24px;
    position: relative;
    overflow: hidden;

    /* Page-edge shadow at inner gutter */
    box-shadow: inset 4px 0 8px rgba(100, 70, 30, 0.10);
}

/* Subtle horizontal ruled lines (like paper) */
.tr-reviews-page::after {
    content: '';
    position: absolute;
    top: 100px;
    left: 24px;
    right: 24px;
    bottom: 50px;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 27px,
        rgba(160, 130, 80, 0.09) 27px,
        rgba(160, 130, 80, 0.09) 28px
    );
    pointer-events: none;
}

/* Small top-corner fold */
.tr-reviews-page::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 0; height: 0;
    border-style: solid;
    border-width: 0 22px 22px 0;
    border-color: transparent #e0d0b0 transparent transparent;
    filter: drop-shadow(-1px 1px 1px rgba(0,0,0,0.12));
}

/* ── Book cover-style title block ── */
.tr-reviews-header {
    text-align: center;
    margin-bottom: 22px;
    position: relative;
    z-index: 1;
}

/* Decorative top rule */
.tr-reviews-header-rule {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.tr-reviews-header-rule::before,
.tr-reviews-header-rule::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #a07840, transparent);
}

.tr-reviews-header-ornament {
    font-size: 14px;
    color: #a07840;
    line-height: 1;
    user-select: none;
}

/* The main book title */
.tr-reviews-title {
    font-size: 22px !important;
    font-weight: 700 !important;
    font-style: italic !important;
    color: #2a1a08 !important;
    margin: 0 0 4px !important;
    padding: 0 !important;
    line-height: 1.2 !important;
    letter-spacing: 0.5px !important;
    font-family: Georgia, 'Times New Roman', serif !important;
    border: none !important;
    text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}

/* Subtitle / chapter label */
.tr-reviews-subtitle {
    font-size: 10.5px;
    font-weight: 400;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #9a7040;
    font-style: normal;
    font-family: Georgia, serif;
    margin-top: 4px;
}

/* Bottom rule below title */
.tr-reviews-header-rule-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.tr-reviews-header-rule-bottom::before,
.tr-reviews-header-rule-bottom::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #a07840, transparent);
}

/* ── Carousel ── */
.tr-reviews-carousel {
    position: relative;
    z-index: 1;
    min-height: 200px;
}

.tr-review-card {
    display: none;
    animation: trFadeIn 0.4s ease;
}

.tr-review-card.active {
    display: block;
}

@keyframes trFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Large drop-cap opening quote ── */
.tr-review-quote {
    display: block;
    font-size: 64px;
    line-height: 0.55;
    color: #c8a060;
    opacity: 0.45;
    font-family: Georgia, 'Times New Roman', serif;
    margin-bottom: 6px;
    user-select: none;
    float: left;
    margin-right: 2px;
    padding-top: 8px;
}

/* ── Stars ── */
.tr-review-stars {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
    clear: both;
}

.tr-review-stars span      { font-size: 13px; color: #c8880a; }
.tr-review-stars span.empty{ color: #d8c898; }

/* ── Comment text ── */
.tr-review-text {
    color: #2e1f0a !important;
    font-size: 14.5px !important;
    line-height: 1.8 !important;
    margin: 0 0 14px !important;
    font-style: italic !important;
    font-family: Georgia, 'Times New Roman', serif !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 4 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    clear: both;
}

/* ── Book/post title row ── */
.tr-review-book {
    font-size: 11.5px;
    color: #7a5830;
    font-style: italic;
    margin-bottom: 14px;
    font-family: Georgia, serif;
    padding-left: 2px;
}

.tr-review-book-label {
    font-style: italic;
    opacity: 0.7;
    margin-right: 3px;
}

.tr-review-book-name {
    font-weight: 700;
    font-style: normal;
    color: #4a3018;
    text-decoration: none !important;
    border-bottom: 1px dotted rgba(74, 48, 24, 0.4);
}

.tr-review-book-name:hover {
    color: #2a1a08;
    border-bottom-color: #2a1a08;
}

/* ── Ornamental divider ── */
.tr-review-divider {
    border: none;
    text-align: center;
    margin: 0 0 12px;
    position: relative;
    height: 16px;
    overflow: visible;
}

.tr-review-divider::before {
    content: '— ❧ —';
    font-size: 13px;
    color: #b09060;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    background: #f8f0dc;
    padding: 0 8px;
    line-height: 1;
}

/* Hairline behind the ornament */
.tr-review-divider::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    height: 1px;
    background: rgba(160, 130, 80, 0.2);
    z-index: -1;
}

/* ── Reviewer attribution — printed-book style ── */
.tr-review-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tr-review-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(150, 110, 60, 0.35);
    object-fit: cover;
    flex-shrink: 0;
}

.tr-review-avatar-placeholder {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(150, 110, 60, 0.35);
    background: linear-gradient(135deg, #c8a060, #9a7040);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fdf6e8;
    flex-shrink: 0;
    font-family: Georgia, serif;
    font-weight: bold;
}

.tr-review-author-details { flex: 1; min-width: 0; }

.tr-review-author-name {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #2a1a08 !important;
    margin: 0 !important;
    font-family: Georgia, serif !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: normal !important;
}

/* Name preceded by em-dash like a book attribution */
.tr-review-author-name::before {
    content: '— ';
    color: #9a7040;
    font-weight: 400;
}

.tr-review-author-date {
    font-size: 11px !important;
    color: #9a7040 !important;
    margin: 1px 0 0 !important;
    font-style: italic !important;
    font-family: Georgia, serif !important;
    padding-left: 16px; /* indent past the em-dash */
}

/* ── Navigation dots ── */
.tr-reviews-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
    position: relative;
    z-index: 1;
}

.tr-reviews-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(120, 90, 45, 0.2);
    border: 1px solid rgba(120, 90, 45, 0.3);
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.tr-reviews-dot.active {
    background: #9a7040;
    border-color: #7a5030;
    transform: scale(1.35);
}

/* ── Page number (bottom of page like a real book) ── */
.tr-reviews-page-number {
    text-align: center;
    margin-top: 16px;
    position: relative;
    z-index: 1;
    font-size: 11px;
    color: #b09060;
    font-family: Georgia, serif;
    font-style: italic;
    letter-spacing: 0.5px;
    user-select: none;
}

/* ── Footer link ── */
.tr-reviews-footer {
    text-align: center;
    margin-top: 6px;
    position: relative;
    z-index: 1;
}

.tr-reviews-footer a {
    font-size: 11px !important;
    color: #9a7040 !important;
    text-decoration: none !important;
    font-style: italic !important;
    font-family: Georgia, serif !important;
    border-bottom: 1px dotted rgba(120, 90, 45, 0.4);
    padding-bottom: 1px;
    transition: color 0.2s;
}

.tr-reviews-footer a:hover {
    color: #4a3018 !important;
    border-bottom-color: #4a3018;
}

/* ── Empty state ── */
.tr-reviews-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.tr-reviews-empty .tr-empty-icon { font-size: 34px; opacity: 0.45; }

.tr-reviews-empty p {
    font-size: 13px !important;
    color: #9a7040 !important;
    margin: 0 !important;
    text-align: center !important;
    font-style: italic !important;
    font-family: Georgia, serif !important;
}

/* ── Progress bar ── */
.tr-reviews-progress {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    height: 2px;
    background: rgba(160, 130, 80, 0.1);
    border-radius: 0 0 14px 0;
    z-index: 1;
    overflow: hidden;
}

.tr-reviews-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #c8a060, #d4920a);
    width: 0%;
    transition: width 0.1s linear;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .tr-reviews-widget  { max-width: 100%; }
    .tr-reviews-spine   { width: 28px; }
    .tr-reviews-spine-text { font-size: 7.5px; letter-spacing: 2px; }
    .tr-reviews-page    { padding: 22px 18px 18px 18px; }
    .tr-reviews-title   { font-size: 18px !important; }
}
