/* Sakurairo Booklist — gallery layout (v1.4) */

.booklist-template-wrap .site-content,
.booklist-page {
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
}

/* —— Page header —— */
.booklist-title-container {
    margin: 6.5% 0 4%;
    text-align: center;
}

.booklist-template-wrap span.linkss-title {
    font-size: 30px;
    display: block;
    margin: 0;
    letter-spacing: 2px;
    font-weight: var(--global-font-weight, 600);
}

.booklist-template-wrap .linkss-title .faa-parent {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.booklist-template-wrap .linkss-title .faa-parent i {
    font-size: 0.9em;
    color: var(--theme-skin-matching, #5b8def);
}

body.dark .booklist-template-wrap .linkss-title .faa-parent i {
    color: var(--friend-link-title, #8ab4f8);
}

.booklist-hero-rule {
    display: block;
    width: 48px;
    height: 2px;
    margin: 18px auto 0;
    border-radius: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--theme-skin-matching, #5b8def),
        transparent
    );
    opacity: 0.85;
}

/* —— Grid —— */
.booklist-page {
    margin-bottom: 88px;
    padding: 0 20px 12px;
}

.booklist-grid {
    display: grid;
    grid-template-columns: repeat(var(--booklist-cols, 4), minmax(0, 1fr));
    gap: 36px 26px;
}

/* —— Card entrance (subtle) —— */
.booklist-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

.booklist-card.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition-delay: calc(var(--booklist-i, 0) * 0.06s);
}

@media (prefers-reduced-motion: reduce) {
    .booklist-card {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* —— Cover + reflection —— */
.booklist-cover-stage {
    position: relative;
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    padding-bottom: 4px;
}

.booklist-cover-link {
    display: block;
    text-decoration: none;
    color: inherit;
    perspective: 800px;
}

.booklist-cover-link--static {
    cursor: default;
    pointer-events: none;
}

.booklist-cover-shell {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.04),
        0 12px 28px rgba(0, 0, 0, 0.1);
    transform: translateY(0) rotateX(0deg);
    transition:
        transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
        box-shadow 0.4s ease;
}

.booklist-cover-link--interactive:hover .booklist-cover-shell,
.booklist-cover-link--interactive:focus-visible .booklist-cover-shell {
    transform: translateY(-5px) rotateX(2deg);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.08),
        0 20px 40px rgba(0, 0, 0, 0.14);
}

.booklist-cover-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        125deg,
        rgba(255, 255, 255, 0.35) 0%,
        transparent 42%,
        transparent 58%,
        rgba(255, 255, 255, 0.08) 100%
    );
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 0.35s ease;
}

.booklist-cover-link--interactive:hover .booklist-cover-shine {
    opacity: 1;
}

.booklist-cover-image,
.booklist-text-cover {
    width: 100%;
    height: 100%;
    display: block;
}

.booklist-cover-image {
    object-fit: cover;
}

/* Reflection */
.booklist-cover-reflection {
    position: relative;
    width: 88%;
    margin: 10px auto 0;
    height: 52px;
    overflow: hidden;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0%, transparent 78%);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0%, transparent 78%);
}

.booklist-cover-reflection__inner {
    transform: scaleY(-1);
    transform-origin: center top;
    opacity: 0.55;
    filter: blur(0.3px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.booklist-card:hover .booklist-cover-reflection__inner,
.booklist-card:focus-within .booklist-cover-reflection__inner {
    opacity: 0.72;
}

.booklist-cover-image--reflection,
.booklist-text-cover--reflection {
    aspect-ratio: 2 / 3;
    pointer-events: none;
}

.booklist-text-cover--reflection .booklist-text-cover__title,
.booklist-text-cover--reflection .booklist-text-cover__frame,
.booklist-text-cover--reflection .booklist-text-cover__ornament {
    display: none;
}

/* —— Text cover (existing textures) —— */
.booklist-text-cover {
    --booklist-title-color: #2c2419;
    --booklist-ornament-color: rgba(44, 36, 25, 0.35);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    box-sizing: border-box;
    background-color: #ebe8e3;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0.15) 40%, rgba(0, 0, 0, 0.06) 100%),
        var(--booklist-text-cover-bg);
    background-size: cover;
    background-position: center;
}

.booklist-text-cover__frame {
    position: absolute;
    inset: 12px;
    border: 1px solid var(--booklist-ornament-color);
    border-radius: 3px;
    pointer-events: none;
}

.booklist-text-cover__ornament {
    position: absolute;
    top: 16px;
    left: 50%;
    width: 28px;
    height: 2px;
    margin-left: -14px;
    background: var(--booklist-ornament-color);
    pointer-events: none;
}

.booklist-text-cover__title {
    position: relative;
    z-index: 1;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    overflow: hidden;
    text-align: center;
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, serif;
    font-size: clamp(14px, 3.8vw, 18px);
    line-height: 1.45;
    font-weight: 700;
    color: var(--booklist-title-color);
    letter-spacing: 0.1em;
    word-break: break-word;
}

.booklist-text-cover--warm { --booklist-title-color: #3d2e1f; --booklist-ornament-color: rgba(120, 86, 40, 0.45); }
.booklist-text-cover--rose { --booklist-title-color: #4a2c3a; --booklist-ornament-color: rgba(110, 58, 78, 0.42); }
.booklist-text-cover--sage { --booklist-title-color: #2a3d2e; --booklist-ornament-color: rgba(58, 90, 62, 0.42); }
.booklist-text-cover--teal {
    --booklist-title-color: #f4f7fa;
    --booklist-ornament-color: rgba(255, 255, 255, 0.45);
    background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.45) 100%), var(--booklist-text-cover-bg);
}

/* —— Footer: title + actions —— */
.booklist-card-footer {
    width: 100%;
    max-width: 200px;
    margin-top: 6px;
    text-align: center;
}

.booklist-card-title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.06em;
    color: var(--theme-skin, #505050);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    word-break: break-word;
}

.booklist-card-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.booklist-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.06em;
    text-decoration: none;
    border-radius: 999px;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    box-sizing: border-box;
}

.booklist-download-btn {
    color: #fff;
    border: 2px solid var(--theme-skin-matching, #5b8def);
    background: var(--theme-skin-matching, #5b8def);
    box-shadow: 0 2px 10px rgba(91, 141, 239, 0.25);
}

.booklist-download-btn:hover,
.booklist-download-btn:focus {
    color: var(--theme-skin-matching, #5b8def);
    background: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(91, 141, 239, 0.2);
}

.booklist-download-btn__icon {
    font-size: 14px;
    line-height: 1;
}

.booklist-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    padding: 48px 16px;
}

/* —— Dark mode —— */
body.dark .booklist-cover-shell {
    background: var(--dark-bg-secondary, #2a2a2a);
    border-color: var(--dark-border-color, rgba(255, 255, 255, 0.08));
    box-shadow: var(--dark-shadow-normal, 0 12px 28px rgba(0, 0, 0, 0.35));
}

body.dark .booklist-card-title {
    color: var(--dark-text-primary, #e8e8e8);
}

body.dark .booklist-text-cover {
    background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.5) 100%), var(--booklist-text-cover-bg-dark, var(--booklist-text-cover-bg));
    --booklist-title-color: #f0ebe3;
}

body.dark .booklist-download-btn {
    background: var(--friend-link-title, #8ab4f8);
    border-color: var(--friend-link-title, #8ab4f8);
    color: var(--dark-bg-primary, #1a1a1a);
}

body.dark .booklist-download-btn:hover,
body.dark .booklist-download-btn:focus {
    color: var(--friend-link-title, #8ab4f8);
    background: transparent;
}

body.dark .booklist-empty {
    color: var(--dark-text-secondary, #aaa);
}

@media (max-width: 1024px) {
    .booklist-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .booklist-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px 18px;
    }

    .booklist-title-container {
        margin: 10% 0 6%;
    }

    .booklist-template-wrap span.linkss-title {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .booklist-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-width: 360px;
        margin-left: auto;
        margin-right: auto;
    }

    .booklist-cover-stage,
    .booklist-card-footer {
        max-width: 100%;
    }
}
