/**
 * Base Styles
 * 
 * This file contains foundational styles for the application including:
 * - Box sizing and reset
 * - Body and layout styles
 * - Typography
 * - Container and grid layouts
 * - Utility classes
 * - Responsive design
 */

/* === Box Sizing and Reset === */
html {
    box-sizing: border-box;
}
*, *:before, *:after {
    box-sizing: inherit;
}

/* === Body Layout === */
body { 
    font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    /* PWA safe area insets for iOS notch/status bar */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    background-color: var(--primary-bg);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh; /* Ensure body takes full viewport height */
    display: flex; /* Flexbox for sticky footer */
    flex-direction: column; /* Stack children vertically */
}

/* === Sticky Day Heading Override === */
/* Disable sticky positioning on non-event list pages */
body:not(.page-event-list) .day-heading {
    position: static !important;
    margin-top: 0 !important;
    padding-top: 10px;
    padding-bottom: 10px;
}
body:not(.page-event-list) .day-heading::after {
    display: none !important;
}

/* === Main Content Container === */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    flex-grow: 1;
    background: transparent;
    width: 100%;
}

/* Reduced top margin for static pages */
body.static-page .container {
    margin-top: 0px;
}

/* Add some padding back for heidelberg-guide specifically */
body.static-page .heidelberg-guide {
    padding-top: 20px;
}

/* === Two Column Layout === */
/* Used in event_list.html for main content and sidebar */
.main-content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: start;
}
.main-column {
    /* Main event list column */
}
.sidebar-column {
     position: sticky;
     top: 80px;
     background-color: var(--card-bg);
     padding: 25px;
     border-radius: 8px;
     box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

/* === Main Content Pusher === */
/* Flex container for content and footer */
#main-content-pusher {
    background: var(--primary-bg) !important;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif; 
    color: var(--text-dark);
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    font-weight: 700;
}
h1 {
    font-size: 2.2em; 
    border-bottom: 6px solid var(--text-dark);
    padding-bottom: 8px;
    margin-bottom: 25px;
    text-align: center; 
}
h2 {
    font-size: 1.6em;
    margin-bottom: 20px;
    margin-top: 0;
    font-family: 'Montserrat', sans-serif;
}
h3 {
    font-size: 1.3em;
    font-weight: 700;
}
p {
    margin: 0 0 1em 0;
    color: var(--text-light);
}
a {
    color: var(--accent-hover);
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover {
    color: var(--text-dark);
}

/* === Static Page Styles === */
body.static-page h1 {
    display: block;
    border-bottom: 6px solid var(--text-dark);
    padding-bottom: 8px;
    margin-bottom: 25px;
    text-align: center;
    margin-top: 0.5em;
    width: 100%;
}

/* === Buttons === */
/* Button styles moved to components/_buttons.css */

/* === Links === */
/* Style for clickable category link to remove default link appearance */
.event-category-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
}

/* === Utility Classes === */
.hidden {
    display: none;
}

/* === Responsive Design === */
@media (max-width: 768px) {
    body.static-page .heidelberg-guide .container,
    body.static-page .mannheim-guide .container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    body.static-page .heidelberg-guide .event-list-container,
    body.static-page .mannheim-guide .event-list-container {
        justify-items: center;
        padding-left: 0;
        padding-right: 0;
        margin: 0;
    }
    
    body.static-page .heidelberg-guide .event-card-wrapper,
    body.static-page .mannheim-guide .event-card-wrapper {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }
}

/* Extra fix for very small screens like iPhone 13 mini */
@media (max-width: 415px) {
    body.static-page .heidelberg-guide .container,
    body.static-page .mannheim-guide .container {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    body.static-page .heidelberg-guide .event-list-container,
    body.static-page .mannheim-guide .event-list-container {
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        padding-left: 20px;
        padding-right: 20px;
        box-sizing: border-box;
        gap: 12px;
    }
}

/* Match main events page spacing for heidelberg-guide and mannheim-guide */
@media (max-width: 768px) {
    body.static-page .heidelberg-guide .event-list-container,
    body.static-page .mannheim-guide .event-list-container {
        gap: 12px;
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 1200px) {
    /* Additional responsive styles can be added here */
}

/* === Dark Mode === */
[data-theme="dark"] body {
    background-color: #000;
}

[data-theme="dark"] .container {
    background: #000;
}

[data-theme="dark"] #main-content-pusher {
    background: #000 !important;
}
