/* ==========================================================
   EBOOK STORE - single stylesheet.
   Contains NO brand colours: every colour is a --c-* variable
   injected from config.php (THEME_COLORS). Edit config to
   re-skin the entire site.
   ========================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: var(--font-size-base, 18px); }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--c-text);
    background: var(--c-paper);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--c-accent); text-decoration: none; }
a:hover { color: var(--c-accent-dark); text-decoration: underline; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--c-ink);
    line-height: 1.2;
    margin: 0 0 0.5em;
}
h1 { font-size: clamp(1.667rem, 4vw, 2.333rem); }
h2 { font-size: clamp(1.333rem, 3vw, 1.667rem); }
h3 { font-size: 1.167rem; }

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

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--c-btn-bg);
    color: var(--c-btn-text);
    border: none;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.889rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}
.btn:hover {
    background: var(--c-btn-hover-bg);
    color: var(--c-btn-hover-text);
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-small { padding: 8px 16px; font-size: 0.778rem; }
.btn-accent { background: var(--c-accent); color: var(--c-btn-text); }
.btn-accent:hover { background: var(--c-accent-dark); }
.btn-ghost {
    background: transparent;
    color: var(--c-ink);
    border: 2px solid var(--c-border);
}
.btn-ghost:hover { background: var(--c-surface); color: var(--c-ink); border-color: var(--c-ink); }
.btn-large { padding: 16px 32px; font-size: 1rem; width: 100%; }

/* ---------- HEADER ---------- */
.site-header { background: var(--c-header-bg); border-bottom: 1px solid var(--c-border); }
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 22px 20px 18px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.logo { flex-shrink: 0; display: block; }
.tagline {
    margin: 0;
    color: var(--c-header-text);
    font-size: 0.833rem;
    opacity: 0.85;
    max-width: 360px;
}
.header-search { margin-left: auto; display: flex; gap: 8px; }
.header-search input {
    padding: 10px 14px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    font-size: 0.833rem;
    min-width: 220px;
    background: var(--c-surface);
    color: var(--c-text);
}
.header-search input:focus { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.header-search button {
    padding: 10px 18px;
    background: var(--c-ink);
    color: var(--c-text-on-dark);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.header-search button:hover { background: var(--c-accent); }

.site-nav { background: var(--c-nav-bg); text-align: center; }
.site-nav ul {
    margin: 0 auto;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}
.site-nav li { margin: 0; float: none; }
.site-nav a {
    display: block;
    padding: 13px 18px;
    color: var(--c-nav-text);
    font-weight: 600;
    font-size: 0.889rem;
    text-decoration: none;
}
.site-nav a:hover { background: var(--c-nav-hover-bg); color: var(--c-nav-hover-text); }
.cart-badge {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    background: var(--c-accent);
    color: var(--c-btn-text);
    border-radius: 999px;
    font-size: 0.667rem;
    text-align: center;
}

/* ---------- HERO & TRUST STRIP ---------- */
.hero { text-align: center; padding: 56px 20px 36px; max-width: 760px; margin: 0 auto; }
.hero p { font-size: 1.111rem; color: var(--c-text-muted); margin: 0; }

.usp-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    max-width: 1100px;
    margin: 0 auto 48px;
    padding: 0 20px;
}
.usp {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 16px 18px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.usp-icon { font-size: 1.111rem; line-height: 1.5; color: var(--c-accent); width: 26px; text-align: center; }
.usp h3 { font-family: var(--font-body); font-size: 0.889rem; margin: 0 0 2px; }
.usp p { margin: 0; font-size: 0.806rem; color: var(--c-text-muted); }

/* ---------- CATEGORY PILLS ---------- */
.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 0 auto 36px;
    padding: 0 20px;
}
.category-pills a {
    padding: 8px 18px;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    background: var(--c-surface);
    color: var(--c-ink);
    font-size: 0.833rem;
    font-weight: 600;
    text-decoration: none;
}
.category-pills a:hover, .category-pills a.active {
    background: var(--c-ink);
    color: var(--c-text-on-dark);
    border-color: var(--c-ink);
}

/* ---------- BOOK GRID ---------- */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 56px;
}
.book-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s, box-shadow 0.18s;
}
.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.10);
}
.book-card-cover { display: block; background: var(--c-paper); }
.book-card-cover img { width: 100%; height: auto; display: block; aspect-ratio: 3 / 4; object-fit: cover; }
.book-card-body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.book-card-title { font-size: 0.972rem; margin: 0 0 4px; }
.book-card-title a { color: var(--c-ink); }
.book-card-subtitle {
    font-size: 0.806rem;
    color: var(--c-text-muted);
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.book-card-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.book-card-price { font-size: 1.056rem; font-weight: 700; color: var(--c-accent); }

/* ---------- PAGINATION ---------- */
.pagination { text-align: center; padding: 0 20px 56px; }
.pagination a, .pagination .current, .pagination .ellipsis {
    display: inline-block;
    margin: 4px;
    padding: 9px 15px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.833rem;
}
.pagination a { background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-ink); text-decoration: none; }
.pagination a:hover { background: var(--c-ink); color: var(--c-text-on-dark); }
.pagination .current { background: var(--c-accent); color: var(--c-btn-text); }
.pagination .ellipsis { color: var(--c-text-muted); }

/* ---------- PRODUCT PAGE ---------- */
.breadcrumbs { max-width: 1100px; margin: 0 auto; padding: 18px 20px 0; font-size: 0.806rem; color: var(--c-text-muted); }
.breadcrumbs a { color: var(--c-text-muted); }
.breadcrumbs a:hover { color: var(--c-accent); }
.breadcrumbs .fas { font-size: 0.611rem; margin: 0 7px; color: var(--c-text-muted); }

.product-layout {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 56px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 40px;
    align-items: start;
}
.product-main h1 { margin-bottom: 6px; }
.product-subtitle { font-size: 1.167rem; color: var(--c-text-muted); margin: 0 0 24px; }
.product-cover {
    float: left;
    width: min(260px, 42%);
    margin: 0 28px 16px 0;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
.product-description { font-size: 1rem; }
.product-description p { margin: 0 0 1em; }

.details-table {
    clear: both;
    width: 100%;
    margin-top: 28px;
    border-collapse: collapse;
    font-size: 0.861rem;
}
.details-table th, .details-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--c-border); }
.details-table th { width: 170px; color: var(--c-text-muted); font-weight: 600; }

/* Sticky buy panel - the conversion engine of the page */
.buy-panel {
    position: sticky;
    top: 20px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    padding: 26px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}
.buy-price { font-size: 1.889rem; font-weight: 700; color: var(--c-ink); font-family: var(--font-display); }
.buy-formats { margin: 10px 0 18px; display: flex; gap: 8px; }
.format-badge {
    padding: 4px 12px;
    border-radius: 5px;
    background: var(--c-paper);
    border: 1px solid var(--c-border);
    font-size: 0.694rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--c-ink);
}
.buy-bullets { list-style: none; margin: 18px 0 0; padding: 0; font-size: 0.861rem; color: var(--c-text-muted); }
.buy-bullets li { padding: 5px 0; }
.buy-bullets li .fas { color: var(--c-success); margin-right: 9px; width: 16px; text-align: center; }
.secure-note { margin: 16px 0 0; font-size: 0.778rem; color: var(--c-text-muted); text-align: center; }
.secure-note .fas { margin-right: 6px; }
.pagination .fas { font-size: 0.667rem; }

/* ---------- RELATED ---------- */
.related-section { max-width: 1100px; margin: 0 auto; padding: 0 20px 56px; }
.related-section .book-grid { padding: 0; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

/* ---------- CART ---------- */
.cart-page { max-width: 860px; margin: 0 auto; padding: 32px 20px 64px; }
.cart-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 12px;
}
.cart-item img { width: 56px; border-radius: 4px; flex-shrink: 0; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-title { font-weight: 700; color: var(--c-ink); }
.cart-item-meta { font-size: 0.806rem; color: var(--c-text-muted); }
.cart-item-price { font-weight: 700; color: var(--c-accent); white-space: nowrap; }
.cart-remove { font-size: 0.806rem; color: var(--c-text-muted); }

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--c-ink);
    color: var(--c-text-on-dark);
    border-radius: 8px;
    padding: 18px 22px;
    margin: 18px 0;
    font-size: 1rem;
    font-weight: 700;
}
.cart-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.cart-empty { text-align: center; padding: 48px 0; }

/* ---------- NOTICES & MESSAGES ---------- */
.notice {
    max-width: 860px;
    margin: 24px auto 0;
    padding: 16px 20px;
    border-radius: 8px;
    border-left: 4px solid var(--c-accent);
    background: var(--c-surface);
    font-size: 0.833rem;
}
.notice-success { border-left-color: var(--c-success); }
.notice-error { border-left-color: var(--c-error); }
.error-message { color: var(--c-error); font-weight: 700; text-align: center; }
.success-message { color: var(--c-success); font-weight: 700; text-align: center; }

/* ---------- FAQ ---------- */
.faq-section { max-width: 760px; margin: 0 auto; padding: 0 20px 64px; }
.faq-section details {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 10px;
}
.faq-section summary { font-weight: 700; cursor: pointer; color: var(--c-ink); }
.faq-section p { margin: 10px 0 0; color: var(--c-text-muted); }

/* ---------- LEGAL / CONTENT PAGES ---------- */
.content-page { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; }
.content-page .panel {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    padding: 32px;
}
.content-page h2 { margin-top: 1.4em; }
.content-page h2:first-child { margin-top: 0; }
.content-page ul, .content-page ol { padding-left: 22px; }
.updated-date { margin-top: 28px; font-size: 0.694rem; color: var(--c-text-muted); }

/* ---------- FORMS (download / verification) ---------- */
.form-card {
    max-width: 440px;
    margin: 28px auto;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    padding: 28px;
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 0.861rem; margin-bottom: 5px; color: var(--c-ink); }
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    font-size: 0.833rem;
    background: var(--c-paper);
    color: var(--c-text);
}
.form-control:focus { outline: 2px solid var(--c-accent); outline-offset: 1px; }

/* download table */
table.download-table { width: 100%; max-width: 600px; margin: 0 auto 24px; border-collapse: collapse; }
table.download-table th { background: var(--c-ink); color: var(--c-text-on-dark); padding: 10px 14px; text-align: left; }
table.download-table td { padding: 10px 14px; border-bottom: 1px solid var(--c-border); }

/* ---------- FOOTER ---------- */
.site-footer { background: var(--c-footer-bg); color: var(--c-footer-text); margin-top: 24px; }
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 20px 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 32px;
}
.footer-heading {
    font-family: var(--font-body);
    font-size: 0.778rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-text-on-dark);
    margin-bottom: 14px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: var(--c-footer-text); font-size: 0.833rem; }
.footer-col a:hover { color: var(--c-text-on-dark); }
.footer-tagline { font-size: 0.806rem; line-height: 1.6; margin: 10px 0 0; }
.copyright { font-size: 0.75rem; margin-top: 16px; opacity: 0.7; }
.footer-newsletter-text { font-size: 0.806rem; margin: 0 0 12px; }
.newsletter-form input[type="text"],
.newsletter-form input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: none;
    border-radius: 6px;
    font-size: 0.778rem;
}
.robot-label { display: block; font-size: 0.806rem; margin: 4px 0 12px; }
.hp-field { display: none !important; position: absolute; left: -9999px; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
    .product-layout { grid-template-columns: 1fr; }
    .buy-panel { position: static; }
    .product-cover { float: none; display: block; margin: 0 auto 24px; }
}
@media (max-width: 640px) {
    .header-inner { justify-content: center; text-align: center; }
    .header-search { margin: 0 auto; width: 100%; }
    .header-search input { flex: 1; min-width: 0; }
    .tagline { max-width: none; }
    .book-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
    .hero { padding: 36px 20px 24px; }
    .cart-item { flex-wrap: wrap; }
}
