/* Import Elegant Vintage & Historical Typography */
@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700&family=IM+Fell+English+SC&family=Pinyon+Script&family=EB+Garamond:ital,wght@0,400..700;1,400..700&display=swap');

/* The Deep Archival Study Backdrop */
body {
    background-color: #1c1510;
    background-image: 
	radial-gradient(rgba(0, 0, 0, 0.3) 15%, transparent 16%),
	linear-gradient(rgba(45, 35, 25, 0.4) 1px, transparent 1px);
    background-size: 60px 60px;
    margin: 0;
    padding: 60px 20px;
    display: flex;
    justify-content: center;
}

/* The Main Page Ledger Layer with Distinct Historical Borders */
.scrapbook-container {
    max-width: 1050px;
    width: 100%;
    background-color: #f2e6d0;
    background-image: 
	radial-gradient(rgba(139, 90, 43, 0.04) 1px, transparent 0),
	linear-gradient(to right, rgba(0,0,0,0.02) 1px, transparent 1px),
	linear-gradient(to bottom, rgba(0,0,0,0.02) 1px, transparent 1px);
    background-size: 30px 30px, 100% 4px, 4px 100%;
    font-family: 'EB Garamond', serif;
    font-size: 1.35rem;
    color: #3a2e2b;
    line-height: 1.6;
    letter-spacing: 0.02em;
    box-sizing: border-box;
    padding: 60px 50px;
    
    /* Classic Double Imperial Border */
    border: 4px double #4a2312;
    outline: 20px solid #e1d2b7;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(139, 90, 43, 0.15);
}

header {
    text-align: center;
    margin-bottom: 70px;
    position: relative;
}

header::after {
    content: "✍";
    display: block;
    font-size: 1.5rem;
    color: #8c2d19;
    margin-top: 15px;
    opacity: 0.7;
}

h1 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 3.2rem;
    color: #5c2c16;
    margin: 0;
    letter-spacing: 2px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

p.subtitle {
    font-family: 'Pinyon Script', cursive;
    font-size: 2.5rem;
    margin-top: 5px;
    color: #8c2d19;
}

/* --- SCRAPBOOK DIVISIONS & SECTIONS --- */
.scrapbook-section {
    margin-bottom: 90px;
}

/* Weathered Ornamental Divider Line */
.divider {
    border: none;
    border-top: 2px dashed #b39c82;
    border-bottom: 1px solid #9c846b;
    height: 3px;
    margin: 70px auto;
    width: 85%;
    opacity: 0.6;
}

/* Antique Document Section Title */
.section-title {
    font-family: 'IM Fell English SC', serif;
    background: #e8dcb9;
    display: inline-block;
    padding: 10px 30px;
    font-size: 2rem;
    color: #4a2312;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 50px;
    border: 1px solid #d1be9b;
    position: relative;
    transform: rotate(-1deg);
}

/* --- SIDE-BY-SIDE LAYOUT --- */
.scrapbook-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
    margin-bottom: 60px;
    flex-wrap: wrap; 
}

.row-reverse {
    flex-direction: row-reverse;
}

.photo-column {
    flex: 1.2;
    min-width: 320px;
    display: flex;
    justify-content: center;
    position: relative;
}

.text-column {
    flex: 1;
    min-width: 280px;
    padding: 25px;
    background: rgba(245, 235, 215, 0.4);
    border-left: 3px double #b59f83;
}

.text-column p::first-letter {
    font-family: 'IM Fell English SC', serif;
    font-size: 2.2rem;
    float: left;
    margin-right: 8px;
    line-height: 1;
    color: #8c2d19;
    font-weight: bold;
}

/* Standalone Decoupled Diary Note Box */
.middle-text-box {
    background: #fdf8eb;
    border: 1px solid #dcd1b4;
    box-shadow: inset 0 0 20px rgba(139,90,43,0.05), 5px 5px 15px rgba(0,0,0,0.05);
    padding: 30px 40px;
    margin: 50px auto;
    max-width: 720px;
    position: relative;
    transform: rotate(0.5deg);
}

.middle-text-box h3 {
    font-family: 'Pinyon Script', cursive;
    margin-top: 0;
    color: #8c2d19;
    font-size: 2.8rem;
    font-weight: normal;
    line-height: 0.8;
}

/* --- HISTORICAL FRAMES (NO SEALS/STAMPS) --- */
.polaroid {
    background: #fcfaf2;
    padding: 14px 14px 35px 14px;
    box-shadow: 5px 8px 18px rgba(40, 30, 20, 0.15);
    border: 1px solid #dcd1b4;
    /* Applies custom properties defined straight from the HTML markup */
    transform: rotate(var(--tilt, 0deg));
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s ease;
    position: relative;
    box-sizing: border-box;
    cursor: pointer;
}

/* Deep Antique Sepia Layer for Photos */
.polaroid img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; 
    object-fit: cover;
    /*filter: sepia(0.65) contrast(0.9) brightness(0.95);*/
}

.caption {
    text-align: center;
    margin-top: 14px;
    font-family: 'IM Fell English SC', serif;
    font-size: 1.3rem;
    letter-spacing: 1px;
    color: #4a3831;
}

/* Untilts and subtly magnifies strictly on mouse hover */
.polaroid:hover {
    transform: rotate(0deg) scale(1.05) !important;
    box-shadow: 10px 15px 30px rgba(40, 30, 20, 0.25);
    z-index: 15 !important;
}

/* --- PHOTO CLUSTER LAYOUTS --- */
.cluster-2 {
    display: flex;
    width: 100%;
    max-width: 400px;
    height: 290px;
    position: relative;
}
.cluster-2 .p1 { width: 68%; position: absolute; left: 0; top: 10px; z-index: 1; }
.cluster-2 .p2 { width: 62%; position: absolute; right: 0; top: 35px; z-index: 2; }

.cluster-3 {
    display: flex;
    width: 100%;
    max-width: 420px;
    height: 350px;
    position: relative;
}
.cluster-3 .p1 { width: 52%; position: absolute; left: 0; top: 10px; z-index: 1; }
.cluster-3 .p2 { width: 55%; position: absolute; right: 5px; top: 25px; z-index: 2; }
.cluster-3 .p3 { width: 52%; position: absolute; left: 24%; bottom: 10px; z-index: 3; }

.cluster-4 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    max-width: 450px;
    padding: 10px;
}
.cluster-4 .polaroid { width: 100%; }

/* Generic cluster engine container */
.photo-cluster {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    width: 100%;
    max-width: 420px;
    min-height: 340px; /* Gives the group safe boundaries to stack within */
    position: relative;
}

/* Force all polaroids inside the cluster to stack over the same coordinate space */
.photo-cluster .polaroid {
    grid-area: 1 / 1; 
    width: 40%; /* Safe scaling so items don't hide each other fully */
    height: auto;
    align-self: center;
    justify-self: center;
    z-index: 1;
}

/* --- Alignment Modifiers --- */
.photo-cluster .top-left     { align-self: start;  justify-self: start; }
.photo-cluster .top-right    { align-self: start;  justify-self: end; }
.photo-cluster .bottom-left  { align-self: end;    justify-self: start; }
.photo-cluster .bottom-right { align-self: end;    justify-self: end; }
.photo-cluster .center-left  { align-self: center; justify-self: start; }
.photo-cluster .center-right { align-self: center; justify-self: end; }

/* --- Stacking Order Modifiers --- */
.photo-cluster .layer-1 { z-index: 1; }
.photo-cluster .layer-2 { z-index: 2; }
.photo-cluster .layer-3 { z-index: 3; }
.photo-cluster .layer-4 { z-index: 4; }



/* --- LIGHTBOX MODAL EFFECT --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 14, 11, 0.92);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-img {
    max-width: 80%;
    max-height: 80%;
    box-shadow: 0 15px 50px rgba(0,0,0,0.7);
    border: 12px solid #fcfaf2; 
    transform: scale(0.92);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    filter: sepia(0.2) contrast(1.02);
}

.modal-overlay.active .modal-img {
    transform: scale(1);
}

.modal-close-hint {
    position: absolute;
    bottom: 30px;
    color: #e8dcb9;
    font-family: 'IM Fell English SC', serif;
    font-size: 1.2rem;
    letter-spacing: 2px;
    opacity: 0.6;
}
