/* === Stellimare Modern Stylesheet v2.0 === */

:root {
    /* Color Palette - Clean & High Contrast */
    --bg-body: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #585858;
    --accent-color: #3662A8; /* Stellimare Blue */
    --header-color: #505080;
    --accent-hover: #204070;
    --border-subtle: #eaeaea;
    --sidebar-bg: #fdfdfd; 
    
    /* Layout Variables */
    --sidebar-width: 240px;
    --container-max-width: 1100px;
    
    /* Fluid Typography: scales between 16px and 19px depending on screen width */
    --font-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    --font-h1: clamp(1.75rem, 1.5rem + 1.25vw, 2.5rem);
    --font-h2: clamp(1.5rem, 1.3rem + 1vw, 2rem);
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: var(--font-base);
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* === Layout Grid === */
.site-container {
    display: flex;
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    flex: 1; /* Pushes footer down */
}

/* === Sidebar Navigation === */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-subtle);
    padding: 2rem 1.5rem;
    flex-shrink: 0;
}

.logo-area {
    margin-bottom: 2rem;
}

/* Lists Reset */
.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
}

.sidebar li {
    margin-bottom: 0.5rem;
}

/* Primary Links Styling */
.sidebar a {
    display: block;
    padding: 0.25rem 0;
    font-weight: 500;
}

/* Sub-menus (nested lists) */
.sidebar ul ul {
    margin-left: 1rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    border-left: 2px solid var(--border-subtle);
    padding-left: 1rem;
}

.sidebar ul ul a {
    font-weight: 400;
    font-size: 0.95em;
    color: var(--text-secondary);
}

.sidebar-extras {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.9em;
}

/* === Main Content === */
.content {
    flex: 1;
    padding: 3rem 4rem; /* More breathing room */
    min-width: 0; /* Fixes flexbox overflow issues */
}

.content h1 { font-size: var(--font-h1); margin-top: 0; color: var(--header-color); }
.content h2 { font-size: var(--font-h2); margin-top: 2rem; }
.content p { margin-bottom: 1.5rem; }

/* === Header (Mobile Only) === */
.mobile-header {
    display: none; /* Hidden on desktop */
    padding: 1rem;
    background: #fff;
    border-bottom: 1px solid var(--border-subtle);
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.mobile-logo-text {
    font-weight: bold;
    font-size: 1.25rem;
    color: var(--accent-color);
}

/* Hamburger Button */
#menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    position: relative;
    transition: background 0.2s;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: transform 0.2s, top 0.2s;
}

.hamburger::before { top: -8px; }
.hamburger::after { top: 8px; }

/* Hamburger Active State (X shape) */
#menu-toggle.active .hamburger { background: transparent; }
#menu-toggle.active .hamburger::before { top: 0; transform: rotate(45deg); }
#menu-toggle.active .hamburger::after { top: 0; transform: rotate(-45deg); }

/* === Footer === */
.site-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 2rem;
    margin-top: auto;
    background-color: #fafafa;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.separator { margin: 0 0.5rem; color: #ccc; }

/* === Mobile / Tablet Responsive Styles === */
@media (max-width: 850px) {
    .site-container {
        flex-direction: column;
    }

    .content {
        padding: 2rem 1.5rem;
    }

    /* Show Mobile Header */
    .mobile-header {
        display: flex;
    }

    /* Transform Sidebar into Overlay Drawer */
    .sidebar {
        position: fixed;
        top: 60px; /* Below mobile header */
        left: 0;
        bottom: 0;
        width: 100%;
        max-width: 300px;
        background: #ffffff;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        transform: translateX(-100%); /* Hide off-screen left */
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        z-index: 999;
        overflow-y: auto;
    }

    .sidebar.active {
        transform: translateX(0); /* Slide in */
    }
    
    /* Overlay for clicking outside (Optional enhancement) */
    .sidebar.active::before {
        content: '';
        position: fixed;
        top: 0; right: -100vw; bottom: 0; left: 100%;
        background: rgba(0,0,0,0.5);
        z-index: -1;
    }
}
