:root {
    --brand-red: #c1272d;
    --brand-red-dark: #9a1f24;
    --text-dark: #1a1a1a;
    --text-muted: #555;
    --bg-light: #f8f6f3;
    --white: #ffffff;
    --border: #e5e0d8;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    color: var(--text-dark);
    background: var(--bg-light);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

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

/* Header */
.site-header {
    background: var(--white);
    border-bottom: 3px solid var(--brand-red);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--text-dark);
    min-width: 0;
    flex-shrink: 1;
}

.brand-logo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.brand-name {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.3;
    max-width: 220px;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.cart-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 4px;
    color: var(--text-dark);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.cart-button svg {
    width: 22px;
    height: 22px;
}

.cart-button:hover,
.cart-button.active {
    background: var(--brand-red);
    color: var(--white);
}

.cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--brand-red);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.cart-button:hover .cart-badge,
.cart-button.active .cart-badge {
    background: var(--white);
    color: var(--brand-red);
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.5rem 1.25rem;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: var(--brand-red);
    color: var(--white);
}

/* Main content */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
}

.page-section-narrow {
    max-width: 720px;
    margin: 0 auto;
}

.page-title {
    font-family: 'Libre Baskerville', serif;
    font-size: 2rem;
    color: var(--brand-red);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
}

.search-bar {
    width: 100%;
    margin-bottom: 2rem;
}

.search-field {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.6rem;
    font-size: 16px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--white);
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(193, 39, 45, 0.12);
}

.search-field:focus-within .search-icon {
    color: var(--brand-red);
}

#search-results.is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* Book grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 1.26rem;
}

.book-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--white);
    border-radius: 5px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.book-image-wrap {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #eee;
}

.book-discount-tag {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    z-index: 1;
    padding: 0.2rem 0.4rem;
    background: var(--brand-red);
    color: var(--white);
    font-size: 0.62rem;
    font-weight: 700;
    border-radius: 3px;
    line-height: 1.2;
}

.book-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0ebe3, #e8e0d4);
    font-size: 2.16rem;
}

.book-info {
    padding: 0.72rem 0.9rem 0.9rem;
}

.book-name {
    font-family: 'Libre Baskerville', serif;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.36rem;
}

.book-price {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--brand-red);
}

.book-price-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.4rem;
}

.book-price-original {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.book-discount-badge {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--brand-red);
    background: rgba(193, 39, 45, 0.1);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 520px;
    margin: 2rem auto 0;
}

.empty-state-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 1.5rem;
    color: var(--brand-red);
    opacity: 0.85;
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.empty-state-title {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.empty-state-text {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 1.05rem;
}

/* Info pages */
.info-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    line-height: 1.7;
}

.info-card p + p {
    margin-top: 1rem;
}

.contact-list {
    list-style: none;
    margin-top: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}

.contact-item:last-child {
    border-bottom: none;
}

.contact-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(193, 39, 45, 0.08);
    color: var(--brand-red);
    border-radius: 50%;
}

.contact-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.contact-value {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    line-height: 1.5;
    padding-top: 0.45rem;
    word-break: break-word;
}

a.contact-value {
    color: var(--text-dark);
}

a.contact-value:hover {
    color: var(--brand-red);
    text-decoration: underline;
}

/* Messages */
.messages {
    margin-bottom: 1.5rem;
}

.message {
    padding: 0.85rem 1rem;
    border-radius: 4px;
    font-weight: 600;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* Book detail */
.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--brand-red);
}

.book-detail {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2.5rem;
    align-items: start;
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.book-detail-image {
    width: 100%;
}

.book-page-slider {
    position: relative;
    width: 100%;
}

.book-slider-viewport {
    overflow: hidden;
    border-radius: 6px;
    width: 100%;
}

.book-slider-track {
    position: relative;
    width: 100%;
}

.book-slider-slide {
    display: none;
    position: relative;
}

.book-slider-slide.is-active {
    display: block;
}

.book-page-slider .book-detail-cover {
    object-fit: contain;
    background: #f7f7f7;
}

.book-slider-label {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.55rem;
    border-radius: 4px;
}

.book-slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--brand-red);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.2s;
}

.book-slider-btn:hover {
    background: #fff;
}

.book-slider-prev { left: 8px; }
.book-slider-next { right: 8px; }

.book-slider-dots {
    display: flex;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 0.75rem;
}

.book-slider-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
}

.book-slider-dot.is-active {
    background: var(--brand-red);
}

.book-detail-cover {
    width: 100%;
    border-radius: 6px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
}

.book-detail-placeholder {
    width: 100%;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0ebe3, #e8e0d4);
    border-radius: 6px;
    font-size: 4rem;
}

.book-detail-title {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.75rem;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.book-detail-pricing {
    margin-bottom: 1.5rem;
}

.book-detail-price-original {
    display: inline-block;
    font-size: 1.1rem;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-right: 0.75rem;
}

.book-detail-discount-badge {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--white);
    background: var(--brand-red);
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.book-detail-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-red);
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.book-detail-meta {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.book-detail-meta-item {
    display: flex;
    gap: 0.5rem;
}

.book-detail-meta dt {
    font-weight: 600;
    color: var(--text-muted);
    min-width: 70px;
}

.book-detail-meta dd {
    font-weight: 600;
    color: var(--text-dark);
}

.book-detail-description h2 {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.book-detail-description p {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.book-detail-actions {
    margin-top: 0.5rem;
}

.book-detail-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    max-width: 420px;
}

.btn-add-to-cart {
    flex: 1 1 140px;
    max-width: none;
    min-height: 44px;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--white);
    background: var(--brand-red);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add-to-cart:hover {
    background: var(--brand-red-dark);
}

.btn-buy-now {
    flex: 1 1 140px;
    min-height: 44px;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--brand-red);
    background: var(--white);
    border: 2px solid var(--brand-red);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-buy-now:hover {
    background: var(--brand-red);
    color: var(--white);
}

/* Cart page */
.cart-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 1rem;
    align-items: center;
    background: var(--white);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.cart-item-image {
    display: block;
}

.cart-item-image img,
.cart-item-placeholder {
    width: 80px;
    height: 100px;
    border-radius: 4px;
    object-fit: cover;
}

.cart-item-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0ebe3, #e8e0d4);
    font-size: 1.5rem;
}

.cart-item-name {
    font-family: 'Libre Baskerville', serif;
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.cart-item-name a {
    color: var(--text-dark);
    text-decoration: none;
}

.cart-item-name a:hover {
    color: var(--brand-red);
}

.cart-item-price,
.cart-item-qty {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.cart-item-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.cart-qty-form {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    background: var(--white);
}

.cart-qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-light);
    color: var(--text-dark);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}

.cart-qty-btn:hover {
    background: var(--brand-red);
    color: var(--white);
}

.cart-qty-value {
    min-width: 36px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.cart-remove-form {
    display: inline;
}

.cart-remove-btn {
    padding: 0.45rem 0.85rem;
    min-height: 36px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--white);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.cart-remove-btn:hover {
    background: #fff5f5;
    border-color: var(--brand-red);
    color: var(--brand-red);
}

.cart-item-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-red);
}

.cart-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
    background: var(--white);
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.cart-summary-totals {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 220px;
}

.cart-summary-line,
.cart-summary-total {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    margin: 0;
}

.cart-summary-line {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.cart-summary-line span:last-child {
    font-weight: 600;
    color: var(--text);
}

.cart-summary-total {
    font-size: 1.2rem;
    padding-top: 0.4rem;
    border-top: 1px solid #eee;
}

.cart-summary-total strong {
    color: var(--brand-red);
}

.cart-summary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.btn-continue-shopping {
    display: inline-block;
    min-height: 44px;
    line-height: 44px;
    padding: 0 1.25rem;
    font-weight: 600;
    color: var(--white);
    background: var(--brand-red);
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-continue-shopping:hover {
    background: var(--brand-red-dark);
}

.btn-secondary {
    display: inline-block;
    min-height: 44px;
    line-height: 42px;
    padding: 0 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    background: var(--white);
    border: 1px solid var(--border);
    text-decoration: none;
    border-radius: 4px;
    transition: border-color 0.2s, color 0.2s;
}

.btn-secondary:hover {
    border-color: var(--brand-red);
    color: var(--brand-red);
}

.empty-state .btn-continue-shopping {
    margin-top: 1.25rem;
}

/* Checkout */
.checkout-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 2rem;
    align-items: start;
}

.checkout-form {
    background: var(--white);
    padding: 1.75rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-field label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.form-optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.85rem;
}

.form-section-title {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.form-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-dark);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(193, 39, 45, 0.12);
}

textarea.form-input {
    resize: vertical;
    min-height: 96px;
    line-height: 1.5;
}

.form-phone {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-phone:focus-within {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(193, 39, 45, 0.12);
}

.form-phone-prefix {
    display: inline-flex;
    align-items: center;
    padding: 0 0.85rem;
    background: var(--bg-light);
    color: var(--text-muted);
    font-weight: 600;
    border-right: 1px solid var(--border);
}

.form-phone .form-input {
    border: none;
    border-radius: 0;
    flex: 1;
    box-shadow: none;
}

.form-error {
    color: var(--brand-red);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.btn-checkout {
    margin-top: 0.5rem;
}

.checkout-summary {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 100px;
}

.checkout-summary-title {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.15rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.checkout-summary-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.checkout-summary-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.checkout-summary-name {
    color: var(--text-dark);
}

.checkout-summary-name small {
    color: var(--text-muted);
    font-weight: 600;
}

.checkout-summary-price {
    font-weight: 700;
    color: var(--text-dark);
    white-space: nowrap;
}

.checkout-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 0.45rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.checkout-summary-row span:last-child {
    color: var(--text-dark);
    font-weight: 600;
}

.checkout-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 0.85rem;
    margin-top: 0.6rem;
    border-top: 1px solid var(--border);
    font-size: 1.05rem;
}

.checkout-summary-total strong {
    color: var(--brand-red);
    font-size: 1.25rem;
}

.checkout-summary-note {
    margin-top: 0.85rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

/* Payment & success */
.payment-amount {
    font-size: 1.15rem;
    margin-bottom: 0.85rem;
}

.payment-info {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.payment-secure {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.success-card {
    text-align: center;
}

.success-card .contact-list,
.success-card .checkout-summary-list {
    text-align: left;
}

.success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: #2e7d32;
}

.success-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.success-note {
    margin: 1.5rem 0;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}

.success-note a {
    color: var(--brand-red);
    text-decoration: none;
    font-weight: 600;
}

.success-note a:hover {
    text-decoration: underline;
}

.success-redirect-note {
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

.success-redirect-note #redirectCountdown {
    font-weight: 700;
    color: var(--brand-red);
    font-style: normal;
}

/* Footer */
.site-footer {
    background: var(--text-dark);
    color: #ccc;
    text-align: center;
    padding: 1.25rem;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
    font-size: 0.9rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.65rem 0.75rem;
}

.footer-copy {
    margin: 0;
}

.footer-divider {
    color: #666;
    font-weight: 300;
    user-select: none;
}

.footer-link {
    display: inline-block;
    padding: 0;
    color: var(--white);
    background: transparent;
    border: none;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--brand-red);
}

.policy-content h2 {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.15rem;
    color: var(--text-dark);
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}

.policy-content h2:first-of-type {
    margin-top: 1.25rem;
}

.policy-content ul {
    margin: 0.75rem 0 0 1.25rem;
    line-height: 1.7;
}

.policy-content ul li {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.policy-content ul li strong {
    color: var(--text-dark);
}

.policy-content .contact-list {
    margin-left: 0;
}

.policy-content a {
    color: var(--brand-red);
    text-decoration: none;
    font-weight: 600;
}

.policy-content a:hover {
    text-decoration: underline;
}

/* Tablet */
@media (max-width: 768px) {
    .main-content {
        padding-top: 1.75rem;
        padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
    }

    .page-title {
        font-size: 1.65rem;
    }

    .page-subtitle {
        font-size: 1rem;
    }

    .checkout-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .checkout-summary {
        position: static;
    }

    .form-row {
        grid-template-columns: 1fr 1fr;
    }

    .book-detail {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .book-detail-image {
        max-width: 320px;
        margin: 0 auto;
        width: 100%;
    }

    .book-detail-title {
        font-size: 1.45rem;
    }

    .book-detail-price {
        font-size: 1.35rem;
    }

    .info-card {
        padding: 1.5rem;
    }

    .cart-summary {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .cart-summary-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-continue-shopping,
    .btn-secondary {
        width: 100%;
        text-align: center;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .header-inner {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "brand cart"
            "nav nav";
        gap: 0.75rem 0.5rem;
        padding: 0.65rem 1rem;
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .brand {
        grid-area: brand;
        gap: 0.65rem;
    }

    .brand-logo {
        width: 48px;
        height: 48px;
    }

    .brand-name {
        font-size: 0.82rem;
        max-width: none;
        line-height: 1.25;
    }

    .cart-button {
        grid-area: cart;
        width: 44px;
        height: 44px;
    }

    .main-nav {
        grid-area: nav;
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
        gap: 0.25rem;
    }

    .nav-link {
        flex: 1;
        text-align: center;
        padding: 0.55rem 0.35rem;
        font-size: 0.85rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-content {
        padding: 1.25rem 1rem;
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .page-title {
        font-size: 1.4rem;
    }

    .page-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }

    .search-bar {
        margin-bottom: 1.25rem;
    }

    .book-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .book-name {
        font-size: 0.68rem;
    }

    .book-price {
        font-size: 0.78rem;
    }

    .book-info {
        padding: 0.6rem 0.65rem 0.75rem;
    }

    .empty-state {
        padding: 2.5rem 1.25rem;
        margin-top: 1rem;
    }

    .empty-state-title {
        font-size: 1.25rem;
    }

    .empty-state-text {
        font-size: 0.95rem;
    }

    .book-detail {
        padding: 1rem;
        gap: 1.25rem;
    }

    .book-detail-image {
        max-width: 260px;
    }

    .book-detail-title {
        font-size: 1.25rem;
    }

    .book-detail-price {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .book-detail-placeholder {
        font-size: 3rem;
    }

    .btn-add-to-cart {
        max-width: none;
    }

    .cart-item {
        grid-template-columns: 64px 1fr;
        grid-template-areas:
            "image info"
            "total total";
        gap: 0.75rem;
    }

    .cart-item-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .cart-qty-btn {
        width: 44px;
        height: 44px;
    }

    .cart-qty-value {
        min-width: 44px;
    }

    .cart-remove-btn {
        min-height: 44px;
    }

    .cart-item-image {
        grid-area: image;
    }

    .cart-item-image img,
    .cart-item-placeholder {
        width: 64px;
        height: 80px;
    }

    .cart-item-info {
        grid-area: info;
        min-width: 0;
    }

    .cart-item-name {
        font-size: 0.92rem;
        word-break: break-word;
    }

    .cart-item-total {
        grid-area: total;
        text-align: right;
        padding-top: 0.25rem;
        border-top: 1px solid var(--border);
    }

    .info-card {
        padding: 1.25rem;
    }

    .message {
        font-size: 0.9rem;
    }

    .site-footer {
        font-size: 0.82rem;
        padding: 1rem;
    }
}

/* Small phones */
@media (max-width: 360px) {
    .brand-name {
        font-size: 0.75rem;
    }

    .nav-link {
        font-size: 0.78rem;
        padding: 0.5rem 0.2rem;
    }

    .book-grid {
        gap: 0.6rem;
    }
}

@media (hover: hover) {
    .book-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    }
}

@media (hover: none) {
    .book-card:hover {
        transform: none;
    }
}
