@charset "utf-8";

/* Color variables - tuned to match header image accents */
:root {
    --bg-page: #f6f2fb; /* light lavender */
    --accent: #7b4bbd; /* medium purple */
    --accent-dark: #5a2f8d; /* darker purple for hover */
    --text: #2b2b2b; /* primary text */
    --muted: #6b6b6b; /* secondary text */
}

/* Body element styles */
body {
    font-family: Verdana, Geneva, sans-serif;
    color: var(--text);
    background-color: var(--bg-page);
}

/* Header section styles */
header {
    text-align: center;
    padding: 20px;
}

/* H2 element styles */
h2 {
    font-size: 1.3em;
    text-shadow: 4px 6px 5px gray;
}

/* Nav section styles */
/* nav {
    background-color: var(--accent);
    padding: 15px;
    text-align: center;
} */

/* Nav ul styles */
nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Nav link styles */
nav a {
    display: block;
    background-color: var(--accent);
    line-height: 2.8em;
    text-decoration: none;
    text-align: center;
    color: #ffffff;
    font-weight: bold;
}

/* Nav link hover styles */
nav a:hover {
    background-color: var(--accent-dark);
    color: #ffffff;
    font-size: 1.2em;
    transition: background-color 0.5s ease-in 0.2s, color 0.5s ease-in 0.2s, font-size 1s ease;
}

/* Main element styles */
main {
    padding: 20px;
    margin-top: 70px;
}

/* Header image styles */
header img {
    width: 100%;
}

/* Header title color */
header h1 {
    color: var(--accent-dark);
    margin-top: 10px;
    text-shadow: 4px 6px 5px gray;
}

/* Footer styles */
body > footer {
    background-color: var(--accent);
    color: #ffffff;
    font-weight: bold;
    font-size: 0.9em;
    line-height: 3em;
    text-align: center;
    margin-top: 10px;
    padding: 10px;
    clear: both;
}

body > footer a { color: #ffffff; }

/* Ordered list styles */
ol {
    list-style-type: upper-roman;
}

/* Focus styles for form elements */
input:focus, select:focus, textarea:focus {
    background-color: #ffd699;
    color: #000000;
}

/* Valid field styles */
input:valid, select:valid, textarea:valid {
    background-color: #74e393;
}

/* Invalid field styles */
input:invalid, select:invalid, textarea:invalid {
    background-color: #db6377;
}

/* Table styles */
table {
    width: 90%;
    margin: 20px auto;
    border-collapse: collapse;
    background-color: #ffffff;
    border: 3px solid var(--accent);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Table header styles */
thead {
    background-color: var(--accent);
    color: #ffffff;
}

thead th {
    padding: 15px;
    text-align: left;
    border: 2px solid var(--accent-dark);
    font-weight: bold;
}

/* Table body styles */
tbody tr {
    background-color: #ffffff;
}

tbody tr:nth-child(even) {
    background-color: var(--bg-page);
}

tbody tr:hover {
    background-color: #e8d9f5;
}

tbody td {
    padding: 12px 15px;
    border: 1px solid #ddd;
}

/* Table footer styles */
tfoot {
    background-color: var(--accent-dark);
    color: #ffffff;
    font-weight: bold;
}

tfoot td {
    padding: 12px 15px;
    text-align: center;
    border: 2px solid var(--accent);
}

/* Image Grid Styles */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.grid-item {
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.grid-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.grid-item p {
    padding: 15px;
    text-align: center;
    font-weight: bold;
    color: var(--accent);
    margin: 0;
}

/* Desktop Styles */
@media only screen and (min-width: 769px) {
    /* HTML element - subtle accent background */
    html {
        /* full-page background image with a subtle gradient fallback layer */
        background-image: url('https://images.unsplash.com/photo-1503264116251-35a269479413?auto=format&fit=crop&w=1600&q=80'),
                          linear-gradient(180deg, #efe7fb 0%, #f8f6ff 100%);
        background-size: cover, cover;
        background-repeat: no-repeat, no-repeat;
        background-position: center top, center top;
        background-attachment: fixed;
    }
    
    /* Body element - desktop width */
    body {
        width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Nav li styles - horizontal layout */
    nav li {
        display: block;
        width: 20%;
        float: left;
    }
    
    /* Image element styles - only for images in main section */
    main > img {
        width: 25%;
        padding: 25px;
        float: right;
    }
    
    /* Form styles - desktop */
    form {
        width: 90%;
    }
    
    fieldset {
        width: 90%;
        padding: 5px;
        margin-right: 10px;
        margin-bottom: 10px;
    }
    
    input, select {
        display: block;
        position: relative;
        left: 30%;
        padding: 5px;
        height: auto;
        width: 60%;
    }
    
    textarea {
        display: block;
        position: relative;
        left: 30%;
        padding: 5px;
        width: 60%;
        height: 100px;
        resize: vertical;
    }
    
    label {
        display: block;
        position: absolute;
        padding: 5px;
        width: 30%;
        pointer-events: none;
    }
    
    input[type="radio"] {
        display: inline;
        position: inherit;
        left: 0;
        width: auto;
        margin-right: 5px;
        z-index: 100;
    }
    
    label.radio {
        display: inline;
        position: inherit;
        margin-left: 30%;
        margin-right: 20px;
        padding: 5px;
        z-index: 100;
        cursor: pointer;
        pointer-events: auto;
    }
    
    input[type="submit"], input[type="reset"] {
        display: block;
        float: left;
        left: 0;
        text-align: center;
        width: 40%;
        padding: 10px;
        margin-left: 5%;
        margin-right: 5%;
        margin-bottom: 10px;
    }
}

/* Tablet/Mobile Styles */
@media only screen and (max-width: 768px) {
    body {
        width: 100%;
        margin: 0;
    }
    
    /* Mobile form styles */
    form {
        width: 100%;
        font-size: large;
    }
    
    fieldset {
        width: 100%;
        padding: 5px;
        margin: 0;
    }
    
    input, select {
        position: inherit;
        display: block;
        height: 50px;
        padding: 5px;
        width: 90%;
    }
    
    textarea {
        position: inherit;
        display: block;
        height: 150px;
        padding: 5px;
        width: 90%;
        resize: vertical;
    }
    
    label {
        position: inherit;
        display: block;
        height: 50px;
        width: 90%;
    }
    
    input[type="submit"], input[type="reset"] {
        float: none;
        width: 90%;
        margin: 10px;
        font-size: 1.2em;
    }
    
    /* Mobile menu - list items */
    nav li {
        float: none;
        font-size: x-large;
        width: 100%;
    }
    
    /* Mobile menu - links */
    nav a {
        border-bottom: 1px solid black;
    }
    
    /* Main section images */
    main > img {
        width: 90%;
        float: none;
    }
    
    /* Responsive table styles for mobile */
    table {
        width: 100%;
        margin: 10px 0;
        border: 2px solid var(--accent);
    }
    
    /* Hide table headers on mobile */
    thead {
        display: none;
    }
    
    /* Display table body as blocks */
    tbody, tr, td {
        display: block;
        width: 100%;
    }
    
    /* Style each row as a card */
    tbody tr {
        margin-bottom: 15px;
        border: 2px solid var(--accent);
        background-color: #ffffff !important;
    }
    
    /* Add labels before each cell using data attributes */
    tbody td {
        text-align: right;
        padding: 10px;
        position: relative;
        border: 1px solid var(--accent);
        border-bottom: 1px solid var(--accent);
    }
    
    tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        font-weight: bold;
        color: var(--accent);
    }
    
    tbody td:last-child {
        border-bottom: 1px solid var(--accent);
    }
    
    /* Table footer styles for mobile */
    tfoot td {
        display: block;
        padding: 10px;
        border: 2px solid var(--accent);
    }
}
