:root {
    --bg-dark: #121212; 
    --bg-card: #1e1e1e; 
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0; 
    --accent: #c49a6c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; 
}

body { 
    font-family: 'Lato', sans-serif; 
    background-color: var(--bg-dark); 
    color: var(--text-main); 
    line-height: 1.6; 
    overflow-x: hidden; 
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* HEADER - Default State */
.site-header { 
    background: rgba(30, 30, 30, 0.98); 
    border-bottom: 1px solid #333; 
    position: fixed; 
    width: 100%;
    top: 0; 
    z-index: 1000; 
    backdrop-filter: blur(5px);
}

/* HOME PAGE SPECIFIC OVERRIDE */
.body-home .site-header {
    background: transparent;
    border-bottom: none;
    border-top: none;
}

/* INTERNAL PAGE BANNER - GLOBAL SURGICAL SHRINK */
.page-header-banner {
    background-image: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('../images/site-images/texture.jpg');
    background-size: cover;
    background-position: center;
    background-color: #1a1a1a;
    margin-top: 70px !important; 
    padding: 0 20px !important; 
    height: 160px; /* Forced uniform height for all internal pages */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-top: 2px solid var(--accent) !important; 
    border-bottom: 2px solid var(--accent) !important;
    width: 100%;
    position: relative;
    z-index: 1;
}

.page-header-banner h1 { 
    font-family: 'Cinzel', serif; 
    font-size: 1.6rem; 
    color: #fff; 
    margin: 0; 
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.1;
}

.page-header-banner p {
    font-family: 'Lato', sans-serif;
    color: var(--accent);
    font-size: 0.85rem;
    max-width: 600px;
    margin: 8px auto 0;
}

/* --- NAVIGATION SYSTEM (STRICT LAYOUT) --- */
.header-flex { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; }
.header-logo { max-height: 50px; width: auto; display: block; }
.branding { display: flex; align-items: center; gap: 15px; }
.branding h1 { font-size: 1.2rem; color: var(--accent); font-family: 'Cinzel', serif; margin: 0; white-space: nowrap; }

.mobile-nav-toggle {
    display: none; 
    background: none;
    border: none;
    color: var(--accent);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1100;
}

.nav-links { display: flex; gap: 20px; list-style: none; margin: 0; }
.nav-links a { color: #fff; text-decoration: none; text-transform: uppercase; font-size: 0.8rem; font-weight: 700; transition: 0.3s; }
.nav-links a:visited { color: #fff; }
.nav-links a:hover { color: var(--accent); }

/* Header Search Styles */
.header-search {
    display: flex;
    align-items: center;
    border: 1px solid #444;
    border-radius: 20px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.3);
    margin-left: 20px; 
}

.header-search input {
    background: transparent;
    border: none;
    color: #fff;
    outline: none;
    font-size: 0.85rem;
    width: 140px;
    font-family: 'Lato', sans-serif;
}

.header-search button {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 0 5px;
    font-size: 0.9rem;
}

/* DESKTOP LAYOUT ENFORCEMENT */
@media (min-width: 851px) {
    .main-nav {
        display: flex !important; 
        flex-direction: row !important; 
        align-items: center !important; 
    }
    .mobile-nav-toggle { display: none !important; }
}

/* MOBILE NAVIGATION OVERRIDE */
@media (max-width: 850px) {
    .mobile-nav-toggle { display: block; }
    
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 250px;
        height: 100vh;
        background: #1a1a1a;
        z-index: 1050;
        transition: 0.4s ease-in-out;
        padding: 80px 30px;
        box-shadow: -5px 0 15px rgba(0,0,0,0.5);
        display: flex;
        flex-direction: column !important; 
        align-items: flex-start !important;
        gap: 20px;
    }
    
    .main-nav.nav-active { right: 0; }
    
    .nav-links { 
        flex-direction: column; 
        gap: 30px; 
        width: 100%;
    }
    .nav-links a { font-size: 1.1rem; }
    
    .header-search {
        margin-left: 0;
        width: 100%;
        margin-top: 10px;
        padding: 8px 15px;
        background: rgba(255, 255, 255, 0.05);
    }
    .header-search input { width: 100%; }

    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0,0,0,0.7);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: 0.3s;
    }
    .mobile-overlay.nav-active { opacity: 1; visibility: visible; }
}

/* HERO */
.hero { 
    height: 100vh; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    text-align: center; 
    background-size: cover; 
    background-position: center; 
}
.hero-content { z-index: 5; max-width: 900px; padding-top: 60px; }
.hero-content h2 { font-family: 'Lato', sans-serif; font-size: 1.5rem; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; }

/* BUTTONS */
.btn { 
    display: inline-block; 
    padding: 10px 25px; 
    border: 2px solid var(--accent); 
    color: var(--accent); 
    text-decoration: none; 
    font-weight: bold; 
    transition: 0.3s; 
    cursor: pointer;
}
.btn:hover { background: var(--accent); color: #000; }

/* SECTIONS & GRIDS */
.about-section, .gallery-section, .journal-section, .contact-section, .calculator-section { padding: 80px 0; }
.about-section { background-color: rgba(26, 26, 26, 0.75); border-bottom: 1px solid #333; }
.journal-section { background-color: rgba(26, 26, 26, 0.75); }

.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }

/* --- GRID SYSTEM --- */
.gallery-grid, .journal-grid, .journal-grid-5 {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 20px;
    margin-top: 40px;
}

/* Responsive Columns */
@media (min-width: 550px) {
    .gallery-grid, .journal-grid, .journal-grid-5 { 
        grid-template-columns: repeat(2, minmax(0, 1fr)); 
    }
}
@media (min-width: 800px) {
    .gallery-grid, .journal-grid, .journal-grid-5 { 
        grid-template-columns: repeat(3, minmax(0, 1fr)); 
    }
}
@media (min-width: 1050px) {
    .gallery-grid, .journal-grid, .journal-grid-5 { 
        grid-template-columns: repeat(5, minmax(0, 1fr)); 
        gap: 15px; 
    }
}

/* FOOTER */
.site-footer { background-color: #000; border-top: 1px solid #333; padding: 60px 0 20px; margin-top: 80px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; text-align: center; }
.footer-col h3 { color: var(--accent); font-family: 'Cinzel', serif; margin-bottom: 20px; font-size: 1.1rem; }
.footer-links { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-links a { color: var(--text-muted); text-decoration: none; transition: 0.3s; }
.footer-links a:hover { color: var(--accent); }
.social-icons { display: flex; gap: 15px; font-size: 1.5rem; justify-content: center; }
.footer-bottom { text-align: center; border-top: 1px solid #222; padding-top: 20px; margin-top: 40px; font-size: 0.8rem; color: #666; width: 100%; }

/* RESPONSIVE MISC */
@media (max-width: 768px) {
    .hero-content h2 { font-size: 1.2rem; }
    .about-grid { grid-template-columns: 1fr; gap: 40px; }
}

/* CARD CONTENT WRAPPING FIX */
.journal-grid-5 > div,
.journal-grid-5 a,
.journal-grid-5 p,
.journal-grid-5 h3 {
    min-width: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important; 
    word-break: break-word !important;
    max-width: 100%;
}