/* Apply consistent box model across all elements */
* {
    box-sizing: border-box; /* Includes padding and border in element width/height */
}

/* Base page styling */
body {
    margin: 0; /* Removes default browser margin */
    font-family: Arial, Helvetica, sans-serif; /* Sets readable font stack */
    font-size: 100%; /* Uses default browser font size */
    line-height: 1.5; /* Improves text readability */
    color: #000000; /* Default text colour */
    background-color: #ffffff; /* Page background */
}

/* Responsive images */
img {
    max-width: 100%; /* Prevents images from overflowing containers */
    height: auto; /* Maintains aspect ratio */
    border: 0; /* Removes default border on linked images */
}

/* Default link styling */
a {
    color: #003366; /* Dark blue link colour */
}

/* Remove underline on hover/focus */
a:hover,
a:focus {
    text-decoration: none;
}

/* Header container */
.site-header {
    min-height: 140px; /* Ensures header meets height requirement */
    padding: 0 1rem; /* Horizontal spacing */
    background-color: #ef9a9a; /* Red background */
    border: 2px solid #000000; /* Black border */
    border-bottom: 0; /* Removes bottom border */
}

/* Inner header layout using Flexbox */
.header-inner {
    display: flex; /* Enables horizontal layout */
    align-items: flex-start; /* Align items to top */
    gap: 1rem; /* Space between logo and nav */
    padding-top: 0.75rem; /* Top spacing */
}

/* Logo styling */
.site-logo {
    width: 190px; /* Fixed logo width */
    margin: 0; /* Remove default margin */
    padding: 0.75rem 1rem; /* Inner spacing */
    color: #ffffff; /* White text */
    background-color: #f4b6b6; /* Light red background */
    font-size: 2rem; /* Large text size */
    line-height: 1.1; /* Compact line height */
}

/* Navigation container grows to fill space */
.site-nav {
    flex: 1; /* Takes remaining horizontal space */
}

/* Navigation list layout */
.site-nav ul {
    display: flex; /* Horizontal menu */
    flex-wrap: wrap; /* Allows wrapping on small screens */
    margin: 0;
    padding: 0;
    list-style: none; /* Removes bullet points */
    background-color: #f6b6b6;
    border: 1px solid #cc8f8f;
}

/* Navigation links */
.site-nav a {
    display: block; /* Makes entire area clickable */
    padding: 0.75rem 1.25rem; /* Clickable spacing */
    color: #555555;
    text-decoration: none;
    font-weight: bold;
}

/* Hover and focus styles for accessibility */
.site-nav a:hover,
.site-nav a:focus {
    color: #000000;
    background-color: #ffffff;
    outline: 2px solid #000000; /* Visible keyboard focus */
    outline-offset: -2px;
}

/* Main content wrapper */
.site-main {
    padding: 1rem;
    background-color: #dddddd; /* Grey middle background */
    border-left: 2px solid #000000;
    border-right: 2px solid #000000;
}

/* Layout for content and sidebar */
.main-layout {
    display: flex; /* Side-by-side layout */
    align-items: stretch;
    gap: 1rem;
}

/* Left content area */
.content-area {
    flex: 1 1 auto; /* Flexible width */
    min-width: 0; /* Prevents overflow issues */
    padding: 1rem;
    background-color: #ffffff; /* White background */
}

/* Shared panel styling */
.heading-panel,
.articles-panel,
.sidebar-panel {
    padding: 1rem;
    background-color: #b8b6ff; /* Light purple background */
}

/* Space below heading panel */
.heading-panel {
    margin-bottom: 1rem;
}

/* Minimum height for article section */
.articles-panel {
    min-height: 340px;
}

/* Sidebar (right column) */
.sidebar {
    width: 250px; /* Fixed width */
    flex: 0 0 250px; /* Prevent resizing */
    margin-left: auto; /* Pushes sidebar to right */
    padding: 1rem;
    background-color: #ffffff;

    display: flex;
    flex-direction: column;
}

/* Space between sidebar sections */
.controls-panel {
    margin-bottom: 1rem;
}

/* Minimum height for second sidebar section */
.supplementary-panel {
    min-height: 340px;
    flex-grow: 1;
}

/* Headings styling */
.heading-panel h2,
.articles-panel h2,
.sidebar-panel h2,
.site-footer h2 {
    margin: 0;
    font-size: 1.25rem;
}

/* Individual article styling */
.news-article {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #ffffff;
    border: 1px solid #cccccc;
}

/* Article title */
.news-article h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.15rem;
}

/* Article header layout */
.article-header {
    display: flex; /* Align date and meta horizontally */
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

/* Date box styling */
.article-date-box {
    flex: 0 0 60px; /* Fixed width */
    margin: 0;
    text-align: center;
    font-weight: bold;
}

/* Day and month display */
.article-day,
.article-month {
    display: block;
}

/* Large day number */
.article-day {
    font-size: 1.8rem;
    line-height: 1;
}

/* Month styling */
.article-month {
    margin-top: 0.25rem;
    font-size: 0.95rem;
}

/* Article metadata (date and author) */
.article-meta {
    margin: 0;
    font-size: 0.95rem;
}

/* Footer styling */
.site-footer {
    min-height: 300px; /* Meets requirement */
    padding: 1rem;
    color: #ffffff;
    background-color: #555555; /* Dark grey */
    border: 2px solid #000000;
    border-top: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {

    .header-inner {
        flex-direction: column; /* Stack logo and nav */
    }

    .site-logo {
        width: 100%; /* Full width logo */
    }

    .main-layout {
        flex-direction: column; /* Stack content and sidebar */
    }

    .sidebar {
        width: 100%; /* Sidebar becomes full width */
        flex: 1 1 auto;
    }

    .article-header {
        flex-direction: column; /* Stack date and meta */
    }

    .article-date-box {
        text-align: left; /* Align date for mobile */
    }
}