/* ==========================================================================
   SHARED SYSTEM VARIABLES
   Used across all layout grids to ensure uniform alignment and sizing.
   ========================================================================== */
:root {
    --sidebar-width: 200px;
    --symmetrical-gutter: 50px; 
    --content-block-width: 650px; 
    --specs-width: 280px;
    /* Harmonized Total Width for all layout grids = 980px */
    --total-content-width: calc(var(--content-block-width) + var(--symmetrical-gutter) + var(--specs-width));
}

/* ==========================================================================
   BASE RESET & TYPOGRAPHY
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-size: 16px; 
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Plus Jakarta Sans", "Inter", sans-serif;
    font-weight: 300;          
    line-height: 1.4;          
    letter-spacing: 0.03em;    
    color: #000000;          
    background-color: #fff;
    overflow-x: auto;
}

a {
    color: #000;
    text-decoration: none;
}

p {
    margin-bottom: 1.4em; 
}

/* Yellow highlight effect used for key section text */
.highlight {
    display: inline;
    background-color: #fff3cd;
    padding: 0.1em 0;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* ==========================================================================
   MAIN LAYOUT CONTAINER & SIDEBAR (#index)
   Relates to: ALL PAGES
   ========================================================================== */
#wrapper {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
    align-items: flex-start; 
}

/* Sticky Navigation Sidebar */
#index {
    position: sticky; 
    top: 0;
    flex-shrink: 0; 
    width: var(--sidebar-width);
    height: 100vh; 
    padding: 40px 0px 40px 40px; 
    display: flex;
    white-space: nowrap; 
    z-index: 100;
    background-color: #fff;
}

#index .container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: relative; 
}

#index .top {
    position: absolute;
    top: 0;
    left: 0;
}

#index .top-nav p {
    letter-spacing: 1px;
    line-height: 1.2;
}

/* Spacer ensuring navigation links sit below the site logo */
.sidebar-header-spacer {
    height: calc((1.4em * 2) + 1.4em);
    width: 100%;
    display: block;
}

#index nav {
    margin-top: 0; 
}

#index ul.section {
    list-style: none;
}

#index #section_2,
#index #section_8 {
    margin-bottom: 0;
}

#index .section_title {
    font-weight: normal;
    line-height: 1.4; 
}

/* Active link highlight state in sidebar */
#index .active_section .section_title a {
    background-color: #fff3cd;
    box-shadow: -4px 0 0 #fff3cd, 4px 0 0 #fff3cd, inset 0 0 0 #fff3cd;
    text-decoration: none;
    display: inline-block;
}

#index .bot {
    margin-top: auto; /* Anchors "About" link to bottom of sidebar */
}

/* Main Display Canvas */
#exhibit {
    flex-grow: 1;
    padding: calc(40px + (1.4em * 2) + 1.4em) 50px 40px 0; 
    margin-left: var(--symmetrical-gutter); 
    max-width: 1500px;
}

/* Header Title Block */
.title-group {
    margin-bottom: 1.4em; 
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    height: calc(1.4em * 2); 
}

.title-group p {
    margin-bottom: 0;
    line-height: 1.4;
}

.title-group p span.highlight {
    padding-left: 0; 
    box-shadow: 4px 0 0 #fff3cd; 
}

/* ==========================================================================
   PRODUCT PAGES & HOMEPAGE FEATURE
   Relates to: index.html, fridays-with-p.html, the-shipping-forecast.html, the-waste-land.html
   ========================================================================== */
.content-grid {
    display: grid;
    grid-template-columns: var(--content-block-width) var(--symmetrical-gutter) var(--specs-width);
    row-gap: 1.4em; 
    width: var(--total-content-width);
}

.grid-images { 
    grid-column: 1;
    width: var(--content-block-width); 
}

.grid-text { 
    grid-column: 1;
    width: var(--content-block-width); 
} 

.grid-specs { 
    grid-column: 3;
    color: #555; 
    white-space: normal;
    width: var(--specs-width);
}

.grid-specs a.buy-link-highlight {
    text-decoration: none;
    font-weight: normal;
}

.mobile-ellipsis {
    display: none;
    width: 100%;
}

/* Gallery Component */
.gallery-container {
    margin-bottom: 0px; 
    width: var(--content-block-width); 
}

.main-image-wrapper {
    width: var(--content-block-width); 
    margin-bottom: 10px;
    cursor: pointer;
    display: block;
}

.main-image-wrapper img {
    width: var(--content-block-width); 
    height: auto;
    display: block;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    width: var(--content-block-width); 
}

.thumbnail-grid img {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.thumbnail-grid img:hover, 
.thumbnail-grid img.active-thumb {
    opacity: 1;
}

/* Image Zoom Modal */
.modal {
    display: none; 
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(250, 250, 250, 0.95); 
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* ==========================================================================
   ABOUT PAGE LAYOUT
   Relates to: about.html
   ========================================================================== */
.about-grid {
    display: grid;
    grid-template-columns: var(--total-content-width);
    width: var(--total-content-width);
}

.about-text {
    grid-column: 1;
    max-width: var(--total-content-width);
}

/* ==========================================================================
   LIMITED EDITIONS PAGE LAYOUT
   Relates to: limited-editions.html
   ========================================================================== */
.edition-block-grid {
    display: grid;
    grid-template-columns: 180px var(--symmetrical-gutter) calc(var(--total-content-width) - 180px - var(--symmetrical-gutter));
    row-gap: 0px;
    width: var(--total-content-width);
    margin-bottom: 0px;
}

.edition-title-row {
    grid-column: 1 / span 3;
    margin-bottom: 1.4em; 
}

.edition-title-row .title-group {
    height: auto !important;
    margin-bottom: 0px !important;
}

.edition-img-col {
    grid-column: 1;
    width: 180px; 
}

.edition-img-col img {
    width: 100%;
    height: auto;
    display: block;
    cursor: default;
}

.edition-text-col {
    grid-column: 3;
    width: 100%;
}

.edition-delimiter {
    margin-top: 1.4em;
    margin-bottom: 0px;
    width: var(--total-content-width);
}

.edition-delimiter p {
    margin-bottom: 0px;
}

/* ==========================================================================
   DISPATCHES PAGE LAYOUT
   Relates to: dispatches.html
   ========================================================================== */
.dispatch-block-grid {
    display: grid;
    grid-template-columns: calc(var(--total-content-width) - 180px - var(--symmetrical-gutter)) var(--symmetrical-gutter) 180px;
    row-gap: 0px;
    width: var(--total-content-width);
    margin-bottom: 0px;
}

.dispatch-text-col {
    grid-column: 1;
    width: 100%;
}

.dispatch-img-col {
    grid-column: 3;
    width: 180px;
}

.dispatch-img-col img {
    width: 100%;
    height: auto;
    display: block;
    cursor: default;
}

/* ==========================================================================
   HOMEPAGE CUSTOM OVERRIDES
   Relates to: index.html
   ========================================================================== */
.index-hero-group {
    height: auto !important;
    margin-bottom: 0px !important;
    width: var(--content-block-width) !important;
    max-width: 100% !important;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1100px) {
    #index {
        position: sticky !important;
        padding: 40px 0px 40px 40px !important; 
    }
    
    .content-grid,
    .edition-block-grid,
    .dispatch-block-grid,
    .about-grid {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        row-gap: 0 !important;
    }
    
    /* Product Pages (Wasteland, Shipping Forecast, Fridays with P) */
    .content-grid .grid-images { 
        order: 1; 
        margin-top: 0 !important; 
        margin-bottom: 1.4em !important;
    }
    
    .grid-specs { 
        order: 2; 
        margin-bottom: 1.4em !important; 
        white-space: normal !important; 
        width: var(--content-block-width) !important;
        max-width: 100% !important;
    }
    
    .grid-specs p {
        margin-bottom: 0 !important; 
    }

    .mobile-ellipsis {
        display: block !important;
        order: 3;
        margin-top: 0 !important; 
        margin-bottom: 1.4em !important;
    }
    
    .mobile-ellipsis p {
        margin-bottom: 0 !important;
        line-height: 1.4 !important;
    }
    
    .grid-text { 
        order: 4;
        width: var(--content-block-width) !important; 
    }

    /* Limited Editions Page */
    .edition-title-row {
        order: 1;
        margin-bottom: 1.4em !important;
    }
    
    .edition-img-col {
        order: 2;
        width: 180px !important; 
        max-width: 100%;
        margin-bottom: 1.4em !important;
    }
    
    .edition-text-col {
        order: 3;
        width: var(--content-block-width) !important;
        margin-bottom: 0px !important;
    }
    
    .edition-text-col p:last-child {
        margin-bottom: 0px !important;
    }

    /* Dispatches Page */
    .dispatch-text-col {
        order: 1;
        width: var(--content-block-width) !important;
        margin-bottom: 1.4em !important;
    }
    
    .dispatch-img-col {
        order: 2;
        width: 180px !important;
        max-width: 100%;
        margin-bottom: 0px !important;
    }

    .edition-delimiter {
        width: 100% !important;
        margin-top: 1.4em !important;
        margin-bottom: 0px !important;
    }

    .about-text {
        width: 100% !important;
    }
}

@media (max-width: 550px) {
    #index {
        padding: 40px 0px 40px 40px !important; 
    }
}