@charset "utf-8";

body {
    font-family: Verdana, Geneva, sans-serif;
    color: rgb(91, 91, 91);
    background-color: ivory;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
}

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

h2 {
    font-size: 1.3em;
}
 
/* Navicon Menu Display on Desktop */
#navicon {
    display: none; 
}
 
nav ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

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

nav a {
    display: block;
    background-color: hsl(212, 45%, 45%);
    line-height: 2.8em;    
    text-decoration: none; 
    text-align: center;   
    color: white;
}

nav a:hover {
    background-color: hsl(212, 55%, 35%);
    color: yellow;
}

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

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

header img {
    width: 100%;
}

body > footer {
    clear:both;
    background-color: hsl(220, 45%, 85%);
    color: rgb(70, 70, 70);
    font-weight: bold;
    font-size: 0.9em;
    line-height: 3em;
    text-align: center;
    margin-top: 10px;
    padding: 10px;
}

/* Flexbox styles for Vacation images*/
div.gallery {
    display: flex;
    flex-flow: row wrap;
}

div.imgGallery {
    flex: 23%;
    max-width: 25%;
    padding: 0 4px;
}

div.imgGallery img {
    width: 100%;
}

ul {
    list-style-type: square;
}

/* Table styles for family tree */
table {
    width: 100%;
    border: 10px inset hsl(220, 45%, 85%);
    border-collapse: collapse;
}

caption {
    font-size: 1.5em;
    font-weight: bold;
    padding: 10px;
}

th, td {
    height: 50px;
    border: 1px solid black;
    text-align: center;
    padding: 10px; 
}

thead, tfoot {
    background-color: hsl(220, 45%, 85%);
    color: rgb(70, 70, 70);
}

tfoot td {
    height: auto;       
    text-align: left;  
    padding: 15px;       
}

tfoot p {
    margin: 0;          
    line-height: 1.6;   
}

tbody tr:nth-child(even) {
    background-color: hsl(220, 45%, 95%);
}

/* Media Query for Flexbox 50% width */
@media screen and (max-width: 1100px) {
    div.imgGallery {
        flex: 48%;
        max-width: 50%;
    }
}

/* Media Query for Mobile Screen sizes 0px - 768px */
@media screen and (max-width: 768px) {
    html {
        background-color: hsl(210, 50%, 80%);
    }
    body {
        width: 100%;
        margin: 0;
    }
    main>img {
        width: 90%;
        float: none;
    }

    nav ul {
        display: none;
    }

    #navicon {
        display: block;
        background-color: hsl(212, 45%, 45%);
        color: white;
        text-align: center;
        font-size: 2em;
        line-height: 2em;
        text-decoration: none;
    }

    nav:hover ul {
        display: block;   
    }
    
    nav li {
        float: none;
        font-size: x-large;
        width: 100%;
    }
    nav a {
        border-bottom: 1px solid black;
    }

    div.imgGallery {
        flex: 100%;
        max-width: 100%;
    }

    article p {
        font-size: 1.1em;
    }

   /* Responsive table styles (moved from 480px to match mobile breakpoint) */
    table, thead, tbody, th, td, tr {
        display: block;
    }

    /* Hide the original horizontal title bar because it doesn't fit the mobile screen */
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    /* Turn each <tr> row into a box containing distinct information */
    tr {
        margin-bottom: 1em;
    }

    /* Apply a large left padding only to data cells in the table body */
    tbody td {
        border: none;
        position: relative;
        padding-left: 50%;
        text-align: left;
        height: auto;
    }

    /* Extract the text from data-label and turn it into the left-hand column */
    tbody td::before {
        content: attr(data-label);
        position: absolute;
        left: 0px;
        top: 0px;
        padding: 10px;
        width: 45%;
        font-weight: bold;
    }

    tfoot td {
        padding: 15px;
        text-align: justify;
    }
    tfoot td::before {
        display: none; 
    }
}

/* Media Query for Desktop sizes greater than 769px */
@media screen and (min-width: 769px) {
    html {
        background: hsl(210, 50%, 80%) url('beige-texture.jpg') center center / cover no-repeat fixed;
    }
    article {
        column-count: 2;
        column-gap: 40px;
        column-rule: 1px solid hsl(220, 45%, 85%);
        margin-top: 20px;
    }
    article h2 {
        column-span: all;
        text-align: center;
        margin-bottom: 15px;
        widows: 3;
        font-weight: bold;
        color: hsl(212, 45%, 45%);        
        border-bottom: 2px solid hsl(220, 45%, 85%); 
        padding-bottom: 8px;
        letter-spacing: 1px;             
        text-transform: uppercase;
    }

    article p {
        text-align: justify;
        line-height: 1.8;
        margin: 0;
        padding:0 10px;
        orphans: 3;
        font-size: 1.1em;
    }              
}                  