/*
Theme Name: Book Vault
Theme URI: https://example.com/book-vault
Author: Vault Dev
Description: A premium, Storytel-inspired black and white e-library theme.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
Text Domain: bookvault
*/

:root {
    --bg-white: #ffffff;
    --bg-light-gray: #f5f5f5;
    --bg-paper: #fbfbfa;
    --text-black: #000000;
    --text-dark-gray: #333333;
    --text-mid-gray: #757575;
    --border-color: #e0e0e0;
    --shadow-soft: 0 16px 42px rgba(12, 12, 12, 0.08);
    --motion: cubic-bezier(0.32, 0.72, 0, 1);
}

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

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-white);
    color: var(--text-black);
    display: flex;
    flex-direction: column;
    font-family: "Outfit", system-ui, sans-serif;
    line-height: 1.5;
    min-height: 100dvh;
    overflow-x: hidden;
    text-rendering: geometricPrecision;
}

body.admin-bar .site-header {
    top: 32px;
}

h1,
h2,
h3 {
    font-family: "Outfit", system-ui, sans-serif;
    letter-spacing: -0.04em;
    text-wrap: balance;
}

a {
    color: inherit;
}

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

#primary {
    flex: 1 0 auto;
}

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal;
}

.site-header {
    align-items: center;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    font-family: "Outfit", system-ui, sans-serif;
    justify-content: space-between;
    min-height: 76px;
    padding: 16px 4%;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header * {
    font-family: inherit;
}

.logo-container {
    align-items: center;
    color: var(--text-black);
    display: flex;
    gap: 10px;
    text-decoration: none;
}

.logo-mark {
    align-items: center;
    background: var(--text-black);
    border: 1px solid var(--text-black);
    border-radius: 10px;
    color: var(--bg-white);
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 800;
    height: 36px;
    justify-content: center;
    letter-spacing: 0.04em;
    width: 36px;
}

.logo-text {
    font-size: clamp(1.08rem, 2vw, 1.28rem);
    font-weight: 750;
    letter-spacing: -0.025em;
    line-height: 1;
    max-width: 220px;
    text-wrap: balance;
}

.nav-center {
    display: flex;
    gap: 30px;
}

.nav-center a,
.menu a {
    color: var(--text-dark-gray);
    font-size: 0.9rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    line-height: 1;
    text-decoration: none;
    transition: color 0.28s var(--motion), transform 0.28s var(--motion);
}

.nav-center a:hover,
.menu a:hover {
    color: var(--text-black);
    transform: translateY(-1px);
}

.menu {
    display: flex;
    gap: 30px;
    list-style: none;
}

.nav-right {
    align-items: center;
    display: flex;
    gap: 20px;
}

.btn-outline-black,
.btn-solid-black,
.btn-pricing {
    border-radius: 50px;
    display: inline-flex;
    font-size: 0.9rem;
    font-weight: 700;
    justify-content: center;
    line-height: 1;
    text-decoration: none;
    transition: background 0.32s var(--motion), border-color 0.32s var(--motion), color 0.32s var(--motion), transform 0.32s var(--motion);
}

.btn-outline-black {
    border: 2px solid var(--text-black);
    color: var(--text-black);
    padding: 8px 20px;
}

.btn-outline-black:hover {
    background: var(--text-black);
    color: var(--bg-white);
}

.btn-solid-black {
    background: var(--text-black);
    border: 2px solid var(--text-black);
    color: var(--bg-white);
    padding: 10px 24px;
}

.btn-solid-black:hover,
.btn-pricing:hover {
    background: var(--text-dark-gray);
    border-color: var(--text-dark-gray);
    transform: translateY(-1px);
}

.btn-outline-black:active,
.btn-solid-black:active,
.btn-pricing:active {
    transform: scale(0.98);
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--text-black);
    outline-offset: 4px;
}

.btn-hero {
    font-size: 1.05rem;
    padding: 15px 34px;
}

.hero {
    align-items: center;
    background:
        radial-gradient(circle at 76% 12%, rgba(0, 0, 0, 0.06), transparent 30%),
        linear-gradient(180deg, var(--bg-white), var(--bg-paper));
    display: flex;
    justify-content: space-between;
    min-height: 620px;
    padding: 86px 4% 72px;
}

.hero-text {
    max-width: 52%;
}

.hero-text h1 {
    font-size: clamp(3.2rem, 6.4vw, 6rem);
    font-weight: 850;
    line-height: 0.95;
    margin-bottom: 20px;
    max-width: 760px;
}

.hero-text p {
    color: var(--text-mid-gray);
    font-size: clamp(1.05rem, 1.6vw, 1.22rem);
    margin-bottom: 30px;
    max-width: 90%;
    text-wrap: pretty;
}

.hero-image {
    display: flex;
    justify-content: center;
    position: relative;
    width: 44%;
}

.hero-book-stack {
    display: flex;
    gap: 20px;
    transform: rotate(-5deg);
}

.hero-book {
    aspect-ratio: 2 / 3;
    border-radius: 10px;
    box-shadow: 18px 24px 54px rgba(0, 0, 0, 0.18);
    object-fit: cover;
    transition: transform 0.55s var(--motion), box-shadow 0.55s var(--motion);
    width: 180px;
}

.hero-book:hover {
    box-shadow: 20px 30px 64px rgba(0, 0, 0, 0.22);
    transform: translateY(-10px) rotate(4deg);
}

.block-heading {
    margin: 0 auto 32px;
    max-width: 760px;
    padding: 0 4%;
    text-align: center;
}

.block-heading span {
    color: var(--text-mid-gray);
    display: block;
    font-size: 0.8rem;
    font-weight: 750;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.block-heading h2 {
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    font-weight: 820;
    line-height: 1.1;
    margin-bottom: 12px;
}

.block-heading p {
    color: var(--text-mid-gray);
    font-size: 1.05rem;
}

.categories-block {
    border-top: 1px solid var(--border-color);
    padding: 72px 0 0;
}

.category-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 auto 34px;
    max-width: 1200px;
    padding: 0 4%;
}

.category-tile {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-black);
    display: grid;
    gap: 10px;
    min-height: 170px;
    padding: 26px;
    text-decoration: none;
    transition: border-color 0.36s var(--motion), box-shadow 0.36s var(--motion), transform 0.36s var(--motion);
}

.category-tile:hover {
    border-color: var(--text-black);
    box-shadow: var(--shadow-soft);
    transform: translateY(-4px);
}

.category-code {
    align-items: center;
    background: var(--text-black);
    border: 1px solid var(--text-black);
    border-radius: 10px;
    color: var(--bg-white);
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 850;
    height: 38px;
    justify-content: center;
    letter-spacing: 0.04em;
    min-width: 38px;
    padding: 0 10px;
    width: max-content;
}

.category-tile strong {
    font-size: 1.15rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.category-tile > span:not(.category-code) {
    color: var(--text-mid-gray);
    font-size: 0.92rem;
}

.section-row {
    padding: 40px 0 20px;
}

.section-row.is-muted {
    background: var(--bg-light-gray);
    padding-bottom: 40px;
    padding-top: 40px;
}

.row-header {
    align-items: baseline;
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 4%;
}

.row-header h2 {
    font-size: 1.8rem;
    font-weight: 780;
}

.row-header a {
    align-items: center;
    color: var(--text-mid-gray);
    display: flex;
    font-size: 0.9rem;
    font-weight: 600;
    gap: 5px;
    text-decoration: none;
}

.carousel-track {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 0 4% 30px;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

.book-card {
    color: var(--text-black);
    cursor: pointer;
    flex: 0 0 auto;
    text-decoration: none;
    transition: transform 0.36s var(--motion);
    width: 160px;
}

.book-card:hover {
    transform: translateY(-8px);
}

.book-cover {
    aspect-ratio: 2 / 3;
    background: #eeeeee;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    object-fit: cover;
    width: 160px;
}

.fallback-book-card {
    cursor: pointer;
}

.fallback-cover {
    align-items: flex-end;
    aspect-ratio: 2 / 3;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12);
    color: var(--bg-white);
    display: flex;
    overflow: hidden;
    padding: 16px;
    position: relative;
    width: 160px;
}

.fallback-cover::before {
    background: rgba(255, 255, 255, 0.12);
    content: "";
    height: 100%;
    left: 18px;
    position: absolute;
    top: 0;
    width: 1px;
}

.fallback-cover span {
    font-size: 1.25rem;
    font-weight: 850;
    letter-spacing: -0.05em;
    line-height: 0.9;
    position: relative;
    z-index: 1;
}

.fallback-cover-1 {
    background: linear-gradient(145deg, #111111, #4d4d4d);
}

.fallback-cover-2 {
    background: linear-gradient(145deg, #2a2a2a, #090909);
}

.fallback-cover-3 {
    background: linear-gradient(145deg, #f4f4f4, #202020);
}

.fallback-cover-4 {
    background: linear-gradient(145deg, #3c3c3c, #0c0c0c 62%, #ffffff 63%, #d7d7d7);
}

.fallback-cover-5 {
    background: linear-gradient(160deg, #000000, #1c1c1c 48%, #707070);
}

.book-meta {
    margin-top: 10px;
}

.book-meta h4 {
    font-family: "Outfit", system-ui, sans-serif;
    font-size: 0.9rem;
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-meta strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-meta span {
    color: var(--text-mid-gray);
    display: block;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-row {
    color: var(--text-mid-gray);
    padding: 10px 4% 30px;
}

.pricing-section {
    background: var(--bg-light-gray);
    padding: 96px 4%;
}

.pricing-section h2 {
    font-size: 2.5rem;
    margin-bottom: 12px;
    text-align: center;
}

.reviews-section {
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 96px 4%;
}

.reviews-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 auto;
    max-width: 1200px;
}

.review-card {
    background: var(--bg-light-gray);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 220px;
    padding: 30px;
}

.review-card blockquote {
    color: var(--text-dark-gray);
    font-size: 1.05rem;
    font-weight: 550;
    line-height: 1.55;
}

.review-card figcaption {
    border-top: 1px solid var(--border-color);
    color: var(--text-mid-gray);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-top: 24px;
    padding-top: 18px;
    text-transform: uppercase;
}

.pricing-subtitle {
    color: var(--text-mid-gray);
    margin-bottom: 40px;
    text-align: center;
}

.pricing-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin: 0 auto;
    max-width: 1200px;
}

.pricing-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px;
    text-align: center;
    transition: border-color 0.36s var(--motion), box-shadow 0.36s var(--motion), transform 0.36s var(--motion);
}

.pricing-card:hover {
    border-color: #cccccc;
    box-shadow: var(--shadow-soft);
}

.pricing-card.featured {
    background: var(--text-black);
    border: none;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    color: var(--bg-white);
    transform: scale(1.05);
}

.tier {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.price {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.price span {
    font-size: 1rem;
    font-weight: 400;
}

.btn-pricing {
    background: var(--text-black);
    border: 2px solid var(--text-black);
    color: var(--bg-white);
    margin-top: 20px;
    padding: 12px 20px;
}

.pricing-card.featured .btn-pricing {
    background: var(--bg-white);
    border-color: var(--bg-white);
    color: var(--text-black);
}

.pricing-card.featured .btn-pricing:hover {
    background: transparent;
    color: var(--bg-white);
}

.single-book-container {
    margin: 60px auto;
    max-width: 800px;
    padding: 0 4%;
}

.content-container {
    margin: clamp(54px, 8vw, 88px) auto 0;
    max-width: 800px;
    min-height: calc(100dvh - 260px);
    padding: 0 4% clamp(44px, 7vw, 78px);
}

.single-book-container h1,
.content-container h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    line-height: 1.1;
}

.single-book-excerpt {
    color: var(--text-mid-gray);
    font-size: 1.1rem;
    margin-top: 10px;
}

.book-preview-container {
    background: var(--bg-light-gray);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 30px;
    max-height: 300px;
    overflow: hidden;
    padding: 30px;
    position: relative;
}

.book-preview-container.is-unlocked {
    max-height: none;
}

.book-preview-text {
    color: var(--text-dark-gray);
    filter: blur(5px);
    line-height: 1.8;
    user-select: none;
}

.unlocked-content {
    color: var(--text-dark-gray);
    line-height: 1.8;
}

.unlocked-content > * + *,
.book-preview-text > * + * {
    margin-top: 1rem;
}

.preview-lock {
    background: var(--bg-white);
    border: 2px solid var(--text-black);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    left: 50%;
    max-width: calc(100% - 40px);
    padding: 40px;
    position: absolute;
    text-align: center;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    z-index: 10;
}

.preview-lock i {
    font-size: 2rem;
    margin-bottom: 15px;
}

.preview-lock h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.preview-lock p {
    color: var(--text-mid-gray);
    font-size: 0.9rem;
    margin-bottom: 25px;
}

.site-footer {
    background: var(--text-black);
    color: var(--bg-white);
    flex-shrink: 0;
    margin-top: auto;
    padding: 36px 4%;
}

.footer-inner {
    align-items: flex-start;
    display: flex;
    gap: 32px;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 1200px;
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
    margin-top: 6px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 22px;
    justify-content: flex-end;
    max-width: 620px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.9rem;
    font-weight: 650;
    text-decoration: none;
    transition: color 0.28s var(--motion), transform 0.28s var(--motion);
}

.footer-links a:hover {
    color: var(--bg-white);
    transform: translateY(-1px);
}

@media (max-width: 900px) {
    body.admin-bar .site-header {
        top: 46px;
    }

    .site-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
        position: relative;
    }

    .logo-container {
        width: 100%;
    }

    .logo-text {
        max-width: none;
    }

    .nav-center,
    .menu,
    .nav-right {
        flex-wrap: wrap;
        gap: 16px;
    }

    .hero {
        align-items: flex-start;
        flex-direction: column;
        gap: 48px;
        min-height: auto;
        padding-top: 56px;
    }

    .hero-text,
    .hero-image {
        max-width: none;
        width: 100%;
    }

    .hero-text p {
        max-width: none;
    }

    .hero-book {
        width: min(29vw, 160px);
    }

    .pricing-card.featured {
        transform: none;
    }

    .category-grid,
    .reviews-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .hero {
        padding: 42px 5% 48px;
    }

    .hero-text h1 {
        font-size: clamp(2.7rem, 15vw, 4.25rem);
    }

    .hero-book-stack {
        gap: 12px;
        transform: rotate(-3deg);
    }

    .row-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 0 5%;
    }

    .carousel-track {
        padding-left: 5%;
        padding-right: 5%;
    }

    .book-card,
    .book-cover,
    .fallback-cover {
        width: 132px;
    }

    .site-header {
        padding-left: 5%;
        padding-right: 5%;
    }

    .nav-right {
        width: 100%;
    }

    .nav-right a {
        flex: 1 1 auto;
    }

    .preview-lock {
        padding: 28px 22px;
    }

    .footer-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .footer-links {
        justify-content: flex-start;
    }
}
