@charset "utf-8";

/* =========================================
   1. GLOBAL STYLES
   Styles that apply to ALL screen sizes.
   ========================================= */
body {
    font-family: Verdana, Geneva, sans-serif;
    color: rgb(91, 91, 91);
    background-color: ivory;
}

header {
    text-align: center;
    padding: 20px;
}

header img {
    width: 100%;
    display: block;
}

h1, h2 {
    text-shadow: 4px 6px 5px gray;
}

main {
    padding: 20px;
    margin-top: 35px;
}

/* Navigation Base Styles */
nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

nav a {
    display: block;
    background-color: #34495e;
    line-height: 2.8em;
    text-decoration: none;
    text-align: center;
    color: #ecf0f1;
}

nav a:hover {
    background-color: #f1c40f;
    color: #2c3e50;
}

/* Table Global Styles (Assignment 5) */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: #ffffff;
    border: 2px solid #34495e;
}

th, td {
    padding: 12px;
    border: 1px solid #bdc3c7;
    text-align: left;
}

thead {
    background-color: #34495e;
    color: #ecf0f1;
}

tfoot {
    font-style: italic;
    background-color: #f9f9f9;
}

/* Flex Gallery Base Styles (Assignment 4) */
.gallery {
    display: flex;
    flex-wrap: wrap;
}

/* General Footer */
footer {
    clear: both;
    background-color: #34495e;
    color: rgba(236, 240, 241, 0.6);
    text-align: center;
    padding: 10px;
}

/* Education Page List Marker */
main ul {
    list-style-type: square;
}

/* =========================================
   2. MOBILE STYLES (Max-width: 768px)
   Includes Table and Layout responsiveness.
   ========================================= */
@media only screen and (max-width: 768px) {
    body {
        width: 100%;
        margin: 0;
    }

    nav li {
        float: none;
        font-size: x-large;
        width: 100%;
    }

    nav a {
        border-bottom: 1px solid black;
    }

    main > img {
        width: 90%;
        float: none;
        display: block;
        margin: 0 auto;
    }

    /* Responsive Table (Stacked layout) */
    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        margin-bottom: 15px;
        border: 1px solid #34495e;
    }

    td {
        border: none;
        position: relative;
        padding-left: 50%;
    }

    td:before {
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
    }

    /* Table labels for mobile viewing */
    td:nth-of-type(1):before { content: "Name:"; }
    td:nth-of-type(2):before { content: "Relationship:"; }
    td:nth-of-type(3):before { content: "Birthday:"; }
    td:nth-of-type(4):before { content: "Fact:"; }

    /* Gallery (2 columns for tablets) */
    .gallery img {
        width: 50%;
    }
}

/* Extra small mobile (1 column gallery) */
@media screen and (max-width: 479px) {
    .gallery img {
        width: 100%;
    }
}

/* =========================================
   3. DESKTOP STYLES (Min-width: 769px)
   ========================================= */
@media only screen and (min-width: 769px) {
    html {
        background-image: url('background.jpg');
        background-repeat: no-repeat;
        background-position: center;
        background-size: cover;
    }

    body {
        width: 90%;
        margin-left: auto;
        margin-right: auto;
    }

    nav li {
        width: 20%;
        float: left;
    }

    main > img {
        width: 25%;
        float: right;
        padding: 25px;
    }

    .gallery img {
        width: 25%;
    }
}