/* css/style.css */
:root {
    --primary: #333;
    --accent: #d4a373; /* A nice magazine gold/beige */
    --light: #f9f9f9;
}

body {
    margin: 0;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--light);
    color: var(--primary);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px; /* Prevents content sticking to sides */
}

/* --- Header --- */
header {
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    padding: 20px 0;
}

.header-inner {
    display: flex;
    justify-content: space-between; /* Logo left, Nav right */
    align-items: center;
}

.logo img {
    height: 50px; /* Adjust based on your png */
}

nav a {
    text-decoration: none;
    color: var(--primary);
    margin-left: 20px;
    font-weight: 600;
    font-size: 16px;
}

nav a:hover { color: var(--accent); }

/* --- Main Content --- */
main {
    flex: 1; 
    
    /* CHANGE THIS LINE: */
    /* Top: 40px | Right: 0 | Bottom: 80px | Left: 0 */
    padding: 40px 0 80px 0; 
}

h1, h2 { text-align: center; margin-bottom: 30px; }

/* --- Grid System (3 Columns) --- */
/* css/style.css */

.magazine-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    
    /* ADD THIS LINE: */
    /* This forces a gap between the bottom of the last magazine and the Footer */
    margin-bottom: 80px; 
}

/* Mobile: Switch to 1 column */
@media (max-width: 768px) {
    .magazine-grid {
        grid-template-columns: 1fr;
    }
    .header-inner {
        flex-direction: column;
        gap: 15px;
    }
}

.mag-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.mag-card:hover { transform: translateY(-5px); }

.mag-card img {
    width: 100%;
    height: 300px;        /* 1. Creates a fixed-size frame */
    
    object-fit: contain;  /* 2. CRITICAL: Scales image to fit inside the frame 
                             without cropping and WITHOUT altering the ratio. 
                             It effectively adds 'whitespace' if needed. */
                             
    object-position: top center; /* 3. Aligns image to top (looks better for magazines) */
    
    margin-bottom: 15px;
    background-color: transparent; /* Ensures empty space is white/transparent */
}

/* --- Search Bar --- */
#search-bar {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    font-size: 16px;
    margin: 0 auto 30px auto;
    display: block;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* --- Buttons --- */
/* css/style.css */

.btn-primary {
    display: block;
    width: 200px;
    
    /* CHANGE THIS LINE: */
    /* Top: 40px | Left/Right: Auto | Bottom: 60px */
    margin: 40px auto 60px; 
    
    padding: 12px;
    background: var(--primary);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
}

/* --- Footer --- */
footer {
    background: #222;
    color: white;
    padding: 40px 0;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.social-links a {
    color: white;
    margin-left: 15px;
    text-decoration: none;
}

/* --- Book --- */
#book-area {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center; /* Centers Left/Right */
    align-items: center;     /* Centers Top/Bottom */
    overflow: hidden;        /* Cuts off anything that accidentally spills over */
}

#book {
    /* Smoothly animate the slide from center to side */
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* This class will be added by JS when the book is closed */
.closed-book-center {
    /* Moves the spine 25% to the left. 
       Since the book is 2 pages wide, 25% is exactly half a page. 
       This puts the Cover (Page 1) dead center. */
    transform: translateX(-25%);
}

/* MOBILE OVERRIDE: 
   On mobile, the book is always single-page view.
   We do NOT want to shift it, or it will fly off the screen. */
@media (max-width: 600px) {
    .closed-book-center {
        transform: none !important;
    }
}