@charset "UTF-8";

/* ============================================================
   BASE STYLES — apply to every screen size
   ============================================================ */

html {
    background-color: hsl(205, 25%, 18%);
}

body {
    font-family: Verdana, Geneva, sans-serif;
    color: rgb(91, 91, 91);
    background-color: ivory;
}

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

header img {
    width: 100%;
}

/* Text shadow on h1 and h2 — gray, 4px X, 6px Y, 5px blur */
h1, h2 {
    text-shadow: 4px 6px 5px gray;
}

h2 {
    font-size: 1.3em;
}

/* Original nav block commented out (from assignment 3)
nav {
    background-color: hsl(205, 35%, 25%);
    padding: 15px;
    text-align: center;
}

nav a {
    padding-left: 10px;
    padding-right: 10px;
    text-decoration: none;
    color: hsl(40, 60%, 88%);
}

nav a:hover {
    text-decoration: underline;
    color: hsl(35, 80%, 65%);
}
*/

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

nav a {
    display: block;
    background-color: hsl(205, 35%, 25%);
    line-height: 2.8em;
    text-decoration: none;
    text-align: center;
    color: hsl(40, 60%, 88%);
    transition: background-color 0.5s ease-in 0.2s,
                color 0.5s ease-in 0.2s,
                font-size 1s ease;
}

nav a:hover {
    background-color: hsl(15, 65%, 55%);
    color: hsl(40, 90%, 96%);
    font-size: 1.2em;
}

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

body > footer {
    clear: both;
    background-color: hsl(205, 35%, 25%);
    color: rgba(102, 102, 102, 0.6);
    font-weight: bold;
    font-size: 0.9em;
    line-height: 3em;
    text-align: center;
    margin-top: 10px;
    padding: 10px;
}

ul {
    list-style-type: square;
}

/* ====================================
   Family table (family.html)
   ==================================== */
.family-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.family-table thead {
    background-color: hsl(205, 35%, 25%);
    color: hsl(40, 60%, 88%);
}

.family-table th {
    padding: 12px 14px;
    text-align: left;
    border: 1px solid hsl(205, 30%, 20%);
}

.family-table td {
    padding: 10px 14px;
    border: 1px solid hsl(205, 20%, 70%);
}

.family-table tbody tr:nth-child(even) {
    background-color: hsl(40, 60%, 96%);
}

.family-table tbody tr:hover {
    background-color: hsl(40, 70%, 90%);
}

.family-table tfoot {
    background-color: hsl(205, 35%, 25%);
    color: hsl(40, 60%, 88%);
    font-style: italic;
}

.family-table tfoot td {
    text-align: center;
    padding: 12px;
    border: 1px solid hsl(205, 30%, 20%);
}

/* Vacation gallery — flex layout, default desktop 4-column */
.gallery {
    display: flex;
    flex-wrap: wrap;
}

.gallery figure {
    flex: 0 0 25%;
    margin: 0;
    padding: 5px;
    box-sizing: border-box;
}

.gallery figure img {
    width: 100%;
    display: block;
    padding: 0;
    float: none;
}

.gallery figcaption {
    text-align: center;
    font-size: 0.9em;
    padding-top: 5px;
}


/* ============================================================
   MOBILE — max-width: 768px
   Assignment 4, steps 3, 5, 6, 7
   ============================================================ */
@media only screen and (max-width: 768px) {

    /* 5. Body — full width, no margin */
    body {
        width: 100%;
        margin: 0;
    }

    /* 6.a — nav li: no float, x-large font, full width */
    nav li {
        float: none;
        font-size: x-large;
        width: 100%;
    }

    /* 6.b — nav a: 1px solid black bottom border */
    nav a {
        border-bottom: 1px solid black;
    }

    /* 7. main > img: 90% width, no float */
    main > img {
        width: 90%;
        float: none;
    }

    /* Gallery — 1 column on mobile */
    .gallery figure {
        flex: 0 0 100%;
    }

    /* Family table — stack each row as a card on mobile */
    .family-table thead {
        display: none;
    }

    .family-table, .family-table tbody, .family-table tr {
        display: block;
        width: 100%;
    }

    .family-table tbody tr {
        margin-bottom: 14px;
        border: 2px solid hsl(205, 35%, 25%);
        background-color: ivory;
    }

    .family-table tbody tr:nth-child(even) {
        background-color: hsl(40, 60%, 96%);
    }

    .family-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
        padding: 8px 10px 8px 42%;
        position: relative;
        border: none;
        border-bottom: 1px solid hsl(205, 20%, 85%);
        min-height: 32px;
    }

    .family-table td:last-child {
        border-bottom: none;
    }

    .family-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        top: 8px;
        width: 35%;
        font-weight: bold;
        color: hsl(205, 35%, 25%);
    }

    .family-table tfoot, .family-table tfoot tr, .family-table tfoot td {
        display: block;
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        padding: 12px;
    }

    .family-table tfoot td::before {
        content: "";
    }
}


/* ============================================================
   TABLET — 769px to 1024px (middle gallery breakpoint)
   Required for the 3-view flex gallery
   ============================================================ */
@media only screen and (min-width: 769px) and (max-width: 1024px) {
    .gallery figure {
        flex: 0 0 50%;
    }
}


/* ============================================================
   DESKTOP — min-width: 769px
   Styles that should NOT load on mobile (e.g. background image)
   Assignment 4, step 4
   ============================================================ */
@media only screen and (min-width: 769px) {

    /* Background image on html — desktop only so mobile users don't download it */
    html {
        background-image: url("bg-pattern.svg");
        background-repeat: repeat;
        background-position: top left;
        background-attachment: fixed;
    }

    /* Body: 90% width centered (desktop layout) */
    body {
        width: 90%;
        margin-left: auto;
        margin-right: auto;
    }

    /* Nav li — 5-column float layout */
    nav li {
        display: block;
        width: 20%;
        float: left;
    }

    /* Main image — 25% width, padding, float right */
    main > img {
        width: 25%;
        padding: 25px;
        float: right;
    }
}
