/* ==========================================================================
   Bellastone Catalog - Brochure Styles
   ========================================================================== */

/* View Transitions API - Smooth page transitions
   ========================================================================== */
@view-transition {
    navigation: auto;
}

/* CSS Variables
   ========================================================================== */
:root {
    --overlay-bg: rgba(0, 0, 0, 0.75);
    --overlay-height: 140px;
    --accent-color: #C2B59B;
    --accent-dark: #A69977;
    --accent-light: #D4C9B3;
    --text-light: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --text-dark: #192433;
    --text-dark-muted: #555;
    --bg-light: #ffffff;
    --bg-off-white: #f8f7f5;
}

/* Animations
   ========================================================================== */
@keyframes kenburns {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.08) translate(-1%, -1%);
    }
}

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

@keyframes subtlePulse {
    0%, 100% {
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 2px 20px rgba(194, 181, 155, 0.4);
    }
}

@keyframes progressGlow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Base Styles
   ========================================================================== */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Progress Bar
   ========================================================================== */
.catalog-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: var(--progress, 0%);
    background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
    z-index: 300;
    transition: width 0.3s ease;
}

.catalog-progress::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 20px;
    height: 100%;
    background: var(--accent-light);
    filter: blur(4px);
    animation: progressGlow 2s ease-in-out infinite;
}

/* Full Screen Image Background
   ========================================================================== */
.page-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    animation: kenburns 20s ease-out forwards;
}

/* Subtle texture overlay for premium feel */
.page-background::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    mix-blend-mode: overlay;
}

/* Product Info Overlay - Bottom Strip
   ========================================================================== */
.product-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 3.25rem 1.5rem;
    color: var(--text-light);
    z-index: 100;
    animation: fadeSlideUp 0.6s ease-out 0.3s both;
}

.product-overlay.hidden {
    transform: translateY(100%);
}

.product-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.product-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

.overlay-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.btn-details {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-details:hover {
    background: rgba(194, 181, 155, 0.2);
    border-color: var(--accent-color);
    color: var(--text-light);
}

/* Navigation Controls
   ========================================================================== */
.nav-controls {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 200;
    pointer-events: none;
    animation: fadeSlideUp 0.5s ease-out 0.1s both;
}

.nav-controls > * {
    pointer-events: auto;
}

.btn-menu {
    background: var(--overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    color: var(--text-light);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.btn-menu:hover {
    background: rgba(0, 0, 0, 0.85);
    color: var(--text-light);
    transform: scale(1.05);
}

/* Page Navigation Arrows (inline in nav-controls)
   ========================================================================== */
.nav-arrows {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    margin-right: 1rem;
}

.nav-arrows .btn {
    background: var(--overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    color: var(--text-light);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    text-decoration: none;
}

.nav-arrows .btn:hover {
    background: rgba(0, 0, 0, 0.85);
    color: var(--text-light);
    transform: scale(1.1);
    box-shadow: 0 4px 24px rgba(194, 181, 155, 0.5);
}

.nav-arrows .btn.disabled,
.nav-arrows .btn[aria-disabled="true"] {
    opacity: 0.3;
    pointer-events: none;
}

.page-indicator {
    background: var(--overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}

/* Legacy page-nav support (hide old standalone nav)
   ========================================================================== */
.page-nav {
    display: none;
}

/* Off-Canvas Menu (Table of Contents)
   ========================================================================== */
.offcanvas {
    --bs-offcanvas-bg: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
}

.offcanvas-title {
    color: var(--text-light);
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1.25rem;
}

.btn-close {
    filter: invert(1);
    opacity: 0.7;
}

.btn-close:hover {
    opacity: 1;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.toc-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.toc-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    padding-left: 2rem;
}

.toc-link.active {
    background: rgba(194, 181, 155, 0.15);
    border-left: 3px solid var(--accent-color);
}

.toc-number {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.toc-link.active .toc-number {
    background: var(--accent-color);
    color: var(--text-dark);
}

.toc-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.toc-title {
    font-weight: 500;
    display: block;
}

.toc-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.15rem;
}

/* Product Details Off-Canvas
   ========================================================================== */
.offcanvas-details {
    --bs-offcanvas-width: 420px;
}

.details-content {
    padding: 1.5rem;
    color: var(--text-light);
}

.details-content h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.details-content p {
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
    line-height: 1.7;
}

.details-specs {
    margin-top: 2rem;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: 'Inter', sans-serif;
}

.spec-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.spec-value {
    font-weight: 500;
    color: var(--accent-light);
}

/* Cover Page Specific
   ========================================================================== */
.cover-page .product-overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 3rem 1.5rem 2rem;
}

.cover-page .product-title {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.cover-page .product-subtitle {
    font-size: 1.1rem;
    color: var(--accent-light);
}

/* ==========================================================================
   NEW PAGE LAYOUTS
   ========================================================================== */

/* Shared Content Inner Styles
   ========================================================================== */
.content-inner {
    max-width: 500px;
    margin: 0 auto;
    padding: 3rem 2rem;
    text-align: left;
}

.content-inner h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.content-inner h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.content-inner p {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-dark-muted);
    margin-bottom: 1.25rem;
}

.content-inner p:last-child {
    margin-bottom: 0;
}

.content-inner .accent {
    color: var(--accent-dark);
}

/* Layout: 50/50 Vertical Split (Top/Bottom)
   ========================================================================== */
.layout-split-v {
    display: flex;
    height: 100vh;
    overflow: hidden;
    align-items: center;
    justify-content: center;
}

.layout-split-v .split-image {
    flex: 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    animation: kenburns 20s ease-out forwards;
    position: relative;
}

.layout-split-v .split-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

.layout-split-v .split-content {
    flex: 1;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeSlideUp 0.6s ease-out 0.3s both;
}

/* Layout: 50/50 Horizontal Split (Left/Right)
   ========================================================================== */
.layout-split-h {
    display: flex;
    height: 100vh;
    overflow: hidden;
    align-items: center;
    justify-content: center;
}

.layout-split-h .split-image {
    flex: 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    animation: kenburns 20s ease-out forwards;
    position: relative;
}

.layout-split-h .split-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

.layout-split-h .split-content {
    flex: 1;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeSlideUp 0.6s ease-out 0.3s both;
}

/* Layout: Two-Page Booklet Spread (Open Book)
   ========================================================================== */
.layout-spread {
    height: 100vh;
    overflow: hidden;
    background: var(--bg-off-white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.spread-container {
    display: flex;
    aspect-ratio: 2 / 1;
    max-height: calc(100vh - 4rem);
    max-width: calc((100vh - 4rem) * 2);
    width: 100%;
    margin: 0 auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 25px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.spread-page {
    flex: 1;
    position: relative;
    aspect-ratio: 1;
}

.spread-page.spread-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    animation: kenburns 20s ease-out forwards;
}

.spread-page.spread-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

.spread-page.spread-content {
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeSlideUp 0.6s ease-out 0.3s both;
}

/* Book spine effect */
.spread-page.left {
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset -10px 0 20px rgba(0, 0, 0, 0.05);
}

.spread-page.right {
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset 10px 0 20px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   PAGE FRAME - Bounded Container for Large Screens
   ========================================================================== */

/*
   The .page-frame wrapper creates a bounded "window" at larger viewports.
   On mobile/tablet: content fills viewport (no frame visible)
   On large screens: centered container with shadow, rounded corners
*/

/* Base page-frame - always a flex container */
.page-frame {
    width: 100%;
    height: 100%;
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Section inside page-frame is the flex container for split layouts */
.page-frame > section {
    width: 100%;
    height: 100%;
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Split-V frame direction (all screen sizes) */
.layout-split-v .page-frame > section {
    flex-direction: column;
}

.layout-split-v.image-bottom .page-frame > section {
    flex-direction: column-reverse;
}

/* Split-H frame direction (all screen sizes) */
.layout-split-h .page-frame > section {
    flex-direction: row;
}

.layout-split-h.image-right .page-frame > section {
    flex-direction: row-reverse;
}

/* Full-bleed framed layout (for product/cover pages) */
.layout-framed .page-frame {
    display: block;
}

.layout-framed .page-frame > section {
    display: block;
}

/* Large screens - add visual frame styling */
@media (min-width: 1500px) {
    body.layout-framed,
    body.layout-split-v,
    body.layout-split-h {
        background: var(--bg-off-white);
        padding: 2rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .page-frame {
        max-width: 1400px;
        max-height: calc(100vh - 4rem);
        width: 100%;
        height: calc(100vh - 4rem);
        flex: none;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 25px rgba(0, 0, 0, 0.1);
        border-radius: 4px;
        overflow: hidden;
    }

    .layout-framed .page-frame .page-background {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 4px;
    }

    .layout-framed .page-frame .product-overlay {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 0 0 4px 4px;
    }
}

@media (min-width: 1400px) {
    body.layout-framed,
    body.layout-split-v,
    body.layout-split-h {
        padding: 3rem;
    }

    .page-frame {
        max-height: calc(100vh - 6rem);
        height: calc(100vh - 6rem);
    }
}

/* Navigation adjustments for new layouts */
.layout-split-v .nav-controls,
.layout-split-h .nav-controls,
.layout-spread .nav-controls {
    position: fixed;
}

.layout-split-v .page-nav,
.layout-split-h .page-nav,
.layout-spread .page-nav {
    position: fixed;
}

/* Dark text on light backgrounds for split/spread */
.layout-split-v .btn-menu,
.layout-split-h .btn-menu,
.layout-spread .btn-menu {
    background: rgba(25, 36, 51, 0.75);
}

.layout-split-v .page-indicator,
.layout-split-h .page-indicator,
.layout-spread .page-indicator {
    background: rgba(25, 36, 51, 0.75);
}

.layout-split-v .page-nav .btn,
.layout-split-h .page-nav .btn,
.layout-spread .page-nav .btn {
    background: rgba(25, 36, 51, 0.75);
}

/* Responsive Adjustments
   ========================================================================== */
@media (max-width: 768px) {
    .product-overlay {
        padding: 1rem;
    }

    .product-title {
        font-size: 1.25rem;
    }

    .product-subtitle {
        font-size: 0.85rem;
    }

    .nav-controls {
        top: 1rem;
        left: 1rem;
        right: 1rem;
    }

    .btn-menu {
        width: 42px;
        height: 42px;
    }

    .page-nav .btn {
        width: 40px;
        height: 40px;
    }

    .cover-page .product-title {
        font-size: 2rem;
    }

    .offcanvas-details {
        --bs-offcanvas-width: 100%;
    }

    /* Stack horizontal split on mobile */
    .layout-split-h .page-frame > section {
        flex-direction: column;
    }

    .layout-split-h.image-left .page-frame > section {
        flex-direction: column;
    }

    .layout-split-h.image-right .page-frame > section {
        flex-direction: column-reverse;
    }

    /* Stack spread on mobile */
    .spread-container {
        flex-direction: column;
        box-shadow: none;
    }

    .spread-page.left,
    .spread-page.right {
        border: none;
        box-shadow: none;
    }

    .content-inner {
        padding: 2rem 1.5rem;
    }

    .content-inner h1 {
        font-size: 1.75rem;
    }

    .content-inner p {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .overlay-actions {
        width: 100%;
        margin-top: 0.75rem;
    }

    .btn-details {
        flex-grow: 1;
        text-align: center;
    }

    .cover-page .product-title {
        font-size: 1.75rem;
    }
}

/* Large screens - enhance spread layout */
@media (min-width: 1400px) {
    .layout-spread {
        padding: 3rem;
    }

    .spread-container {
        max-height: calc(100vh - 6rem);
        max-width: calc((100vh - 6rem) * 2);
    }

    .content-inner {
        max-width: 600px;
        padding: 4rem 3rem;
    }
}

/* Print / PDF Styles
   ========================================================================== */
@media print {
    html, body {
        height: auto;
        overflow: visible;
    }

    .page-background {
        position: relative;
        height: 100vh;
        page-break-after: always;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        animation: none;
    }

    .product-overlay {
        position: absolute;
        background: rgba(0, 0, 0, 0.8) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        animation: none;
    }

    .nav-controls,
    .page-nav,
    .offcanvas,
    .btn-details,
    .catalog-progress {
        display: none !important;
    }

    /* Print split layouts */
    .layout-split-v,
    .layout-split-h {
        page-break-after: always;
    }

    .layout-split-v .split-image,
    .layout-split-h .split-image,
    .spread-page.spread-image {
        animation: none;
    }

    .spread-container {
        box-shadow: none;
    }
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .page-background,
    .split-image,
    .spread-page.spread-image {
        animation: none;
    }

    .product-overlay,
    .nav-controls,
    .page-nav,
    .split-content,
    .spread-content {
        animation: none;
    }

    .page-nav .btn {
        animation: none;
    }

    @view-transition {
        navigation: none;
    }
}
