/*
  File: styles.css
  Author: [Your Name]
  Date: [Current Date]
  Description: Chapter 7 redesign using CSS Grid and new semantic elements.
*/

/* --- GLOBAL STYLES & CSS RESET --- */
*, *::before, *::after {
    box-sizing: border-box; /* Chapter 7 Concept: Box Sizing */
    margin: 0;
    padding: 0;
}

body {
    background-color: #f4f4f4; /* Soft gray background for a modern feel */
    font-family: 'Roboto Slab', serif;
    color: #333;
    line-height: 1.6;
}

/* --- HEADER & NAVIGATION --- */
header {
    text-align: center;
    padding: 1rem 0;
    background: linear-gradient(to right, #2a9d8f, #264653); /* Modern gradient */
}

header h1 {
    font-family: 'Francois One', sans-serif;
    font-size: 2rem;
    color: #fff;
    font-weight: 400;
}

nav {
    background-color: #252525;
    padding: 0.5rem 1rem;
}

nav ul {
    list-style-type: none;
    text-align: center;
}

nav li {
    display: block;
    padding: 0.25rem 0;
}

nav a {
    display: block;
    color: #fff;
    text-decoration: none;
    font-family: 'Francois One', sans-serif;
    font-size: 1.1rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease-in-out;
}

/* --- MAIN CONTENT AREA --- */
main {
    padding: 1.5rem;
    background-color: #fff;
}

h2 {
    font-family: 'Francois One', sans-serif;
    color: #2a9d8f;
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 2.2rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1); /* Chapter 7 Concept: Text Shadow */
}

.intro {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.tel-num {
    color: #e76f51; /* Coral accent color */
    font-weight: bold;
    text-decoration: none;
}

/* --- HERO IMAGE --- */
#hero {
    margin: -1.5rem -1.5rem 1.5rem -1.5rem; /* Pull image to edges of the container */
}

#hero img {
    width: 100%;
    height: auto;
    display: block;
}

/* --- HOME PAGE GRID --- */
.home-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile: Single column */
    gap: 1.5rem;
}

figure {
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Chapter 7 Concept: Box Shadow */
    overflow: hidden; /* Keeps image corners rounded */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

figure:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    opacity: 0.9; /* Chapter 7 Concept: Opacity */
}

figure img {
    width: 100%;
    display: block;
}

figcaption {
    font-family: 'Francois One', sans-serif;
    font-size: 1.25rem;
    text-align: center;
    padding: 1rem;
    background-color: #f9f9f9;
}

/* --- NUTRITION PAGE GRID --- */
.nutrition-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile: Single column */
    gap: 1.5rem;
}

article, aside {
    background-color: #fdfdfd;
    padding: 1.5rem;
    border: 1px solid #eee;
    border-radius: 8px;
}

article h3, aside h4 {
    font-family: 'Francois One', sans-serif;
    margin-bottom: 0.5rem;
    color: #264653;
}

article img.round {
    border-radius: 50%;
    width: 100px;
    height: 100px;
    object-fit: cover;
    float: left;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
}

aside ul {
    list-style-position: inside;
    padding-left: 0.5rem;
}

aside li {
    margin-bottom: 0.5rem;
}

/* --- FOOTER --- */
footer {
    padding: 1.5rem;
    text-align: center;
    background-color: #252525;
    color: #ccc;
    font-size: 0.9rem;
}

footer a {
    color: #fff;
    text-decoration: none;
}

/* =================================================================== */
/* --- MEDIA QUERY FOR TABLET VIEWPORT (768px and up) --- */
/* =================================================================== */
@media (min-width: 768px) {
    /* Horizontal navigation */
    nav li {
        display: inline-block;
    }

    nav a {
        padding: 0.5rem 1rem;
    }

    /* Home Page: 3-column grid */
    .home-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Nutrition Page: 3-column grid */
    .nutrition-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Course Concept: Span `aside` across all columns */
    aside {
        grid-column: 1 / -1; /* This makes the element span from the 1st grid line to the last */
        text-align: center;
    }
}

/* =================================================================== */
/* --- MEDIA QUERY FOR DESKTOP VIEWPORT (1024px and up) --- */
/* =================================================================== */
@media (min-width: 1024px) {
    /* Constrain width and center layout */
    header, nav, main, footer {
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }
    
    main {
        border-radius: 8px;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
        margin-top: 2rem;
        margin-bottom: 2rem;
    }

    /* Course Concept: Dynamic pseudo-classes for link states */
    nav a:hover {
        background-color: #fff;
        color: #252525;
    }
}

/* =================================================================== */
/* --- MEDIA QUERY FOR PRINT --- */
/* =================================================================== */
@media print {
    body {
        background-color: #fff;
        color: #000;
        font-family: 'Times New Roman', Times, serif;
    }
    header, nav, footer, .map, #hero {
        display: none;
    }
    main {
        box-shadow: none;
        margin: 0;
        padding: 0;
    }
}