body, html {
    margin: 0;
    padding: 0;
    background-color: #efeadf;
    font-family: 'Courier New', Courier, monospace;
    height: 100%;
    overflow: hidden; 
}

.main-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 100vw;
    height: 102vh;
    padding-top: 45px; 
    box-sizing: border-box;
    touch-action: none;  /*for touchscreen*/
}

.shelf-wrapper {
    display: flex;
    flex-direction: column;
    width: 90%;
    max-width: 1000px;
}

.page-header {
    font-family: "Playfair Display", serif;
    font-style: italic; 
    font-size: 2rem; 
    color: #A22633; 
    margin-bottom: -5px;
    filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.1));
    align-self: flex-start;
}


/* --- Trinket Board --- */
#visual-container {
    position: relative;
    width: 100%; 
    height: 45vh;
    background-image: url('https://www.transparenttextures.com/patterns/inflicted.png');
    background-size: auto;       /* stretch looks uglyyy */
    background-repeat: repeat;    /* tile pattern ftw */
    background-position: center;
    border: 1.5px solid #030303;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.1);
    z-index: 2;
    overflow: visible;
    margin-bottom: 15px;
}

/* --- Book Board --- */
#bookshelf-container {
    position: relative;
    width: 100%;
    height: 21vh; 
    background-color: #e6e0d5; 
    background-image: url("https://www.transparenttextures.com/patterns/gplay.png");
    border: 1.5px solid #030303;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.1);
    z-index: 2;
    margin-bottom: 15px;
    clip-path: inset(-500px -500px 0px -500px);
}

/* bookshelf lip */
#bookshelf-container::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6vh;
    background-color: #bab7a7;
    background-image: url("https://www.transparenttextures.com/patterns/retina-dust.png");
    border-top: 1.5px solid #030303;
    z-index: 50; 
    pointer-events: none;
}

/* --- Trinkets and Books --- */
.draggable-item {
    display: inline-flex;
    position: absolute;
    cursor: grab;
    user-select: none;
    z-index: 10;
}
.draggable-item:active {
    cursor: grabbing;
}
.draggable-item img {
    display: block;
    width: auto;
    pointer-events: none; 
    user-select: none;
    /* PNG-hugging outline */
    filter: drop-shadow(1px 0 0 white) drop-shadow(-1px 0 0 white) drop-shadow(0 1px 0 white) drop-shadow(0 -1px 0 white);
    transition: filter 0.2s;
}

/* trinkets jump to absolute front on hover to display text clearly */
.draggable-item.trinket:hover {
    z-index: 999;
}

/* to be seen above each other but without breaking through lip panel */
.draggable-item.book:hover {
    z-index: 20;  
}

.draggable-item:hover img {
    filter: drop-shadow(1px 0 0 #A22633) drop-shadow(-1px 0 0 #A22633) drop-shadow(0 1px 0 #A22633) drop-shadow(0 -1px 0 #A22633);
}


.book { height: 160px; } /* Proportional to 25vh bookshelf */
.trinket img, .book img { height: 100%; }


/* Hover Trinket Info */
.draggable-item .description {
    visibility: hidden;
    background-color: #fffdf5;
    color: #433838;
    text-align: center;
    border-radius: 2px;
    padding: 3px 6px;
    position: absolute;
    z-index: 2000;
    bottom: 110%; 
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.05);
    font-size: 0.82rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.draggable-item:hover .description {
    visibility: visible;
    opacity: 1;
}

.draggable-item.flippable {
    display: block; 
}

.item-flipped {
    transform: rotateY(180deg);
}

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    pointer-events: none; 
}

.item-front, .item-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(1px);
}
.item-back {
    transform: rotateY(180deg) translateZ(1px);
}

.flip-inner img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none; 
}

.flip-icon {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 100;
    pointer-events: auto; 
}

/*-----photobook & custom item buttons-----*/
.open-book-btn {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #A22633;
    color: white;
    border: none;
    font-family: 'Courier New', Courier, monospace; 
    font-size: 0.6rem;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 2px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    z-index: 200;
    white-space: nowrap; 
}
.open-book-btn:hover {
    background-color: #23517e; 
    transform: translateX(-50%) scale(1.1);
    color: #ffffff;
}
.top-book-btn {
    bottom: unset !important;
    top: -20px !important;
}

.flip-button {
    font-size: 0.55rem; 
    bottom: -17px;      
}

/* Base overlay styling shared across windows */
.shrine-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 15, 15, 0.8);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

/* Main windows container framework */
.book-content {
    position: relative;
    background: #efeadf;
    padding: 50px;
    border: 2px solid #030303;
    text-align: center;
    box-shadow: 10px 10px 0px #23517e;
    max-width: 90%;
}

/* --- Photobook / Showcase Interactive View --- */
.flip-card {
    width: 280px;
    height: 420px; 
    padding: 15px;
    perspective: 1000px;
}
.zoom-card-view {
    width: 220px !important;
    height: 330px !important;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flipped { 
    transform: rotateY(180deg); 
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.flip-card-front { 
    z-index: 2; 
    transform: rotateY(0deg); 
}

.flip-card-back { 
    transform: rotateY(180deg); 
}

.flip-card-front img, .flip-card-back img {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    display: block;
    background: #efeadf;
}

/* --- Expanded Postcard Grid Layout View --- */
.gallery-scroll-container {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 10px;
    margin-top: 15px;
}
.postcard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 1100px;
    padding: 10px;
    align-items: start;
}
@media (max-width: 600px) {
    .postcard-grid {
        grid-template-columns: 1fr;
    }
}
.gallery-item {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.gallery-item img {
    width: 80%;
    height: auto;
    object-fit: contain;
    border-bottom: none !important;
    padding-bottom: 0 !important;
    filter: drop-shadow(5px 5px 0px rgba(0,0,0,0.15));
}
.gallery-item span {
    font-size: 0.8rem;
    margin-top: 8px;
    color: #433838;
    font-family: 'Courier New', Courier, monospace;
    /*background: rgba(255, 253, 245, 0.8);*/
    padding: 2px 6px;
    border-radius: 2px;
}
/* Navigation Buttons */
.nav-btn, .close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    color: #918d84; /*#b5b0a5*/
    text-transform: lowercase;
    letter-spacing: 1px;
    transition: color 0.2s;
}

.nav-btn:hover, .close-btn:hover { color: #A22633; transform: scale(1.05) }
.close-btn { position: absolute; top: 15px; right: 15px; }
       
/*reset button*/
.reset-btn {
    align-self: flex-start; margin-top: 5px; font-size: 0.85rem;
    letter-spacing: 1px; text-transform: uppercase; color: #918d84; /*#b5b0a5*/
    cursor: pointer; transition: color 0.2s;
}
.reset-btn:hover { color: #A22633; transform: scale(1.01) }
.hidden {
    display: none !important;
}