@charset "utf-8";

/* ============================================================
   GLOBAL ELEMENT STYLES
   ============================================================ */

/* HTML element – sets page background */
html {
    background-color: rgb(0, 51, 160);
    background-image: url(RedTriangle.png);
    background-repeat: repeat;
    background-attachment: fixed;
}

/* Body element – main page container */
body {
    font-family: Verdana, Geneva, sans-serif;
    color: rgb(91, 91, 91);
    background-color: ivory;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
}

/* Headings */
h1 {
    text-shadow: gray 4px 6px 5px;
}

h2 {
    font-size: 1.3em;
    text-shadow: gray 4px 6px 5px;
}

/* Anchor links */
a {
    padding-left: 10px;
    padding-right: 10px;
    text-decoration: none;
    color: rgb(0, 51, 160);
}

/* ============================================================
   HEADER
   ============================================================ */

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

/* Header image */
header > img {
    width: 100%;
    height: 50%;
}

/* ============================================================
   NAVIGATION MENU
   ============================================================ */

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

/* Navigation list items */
nav li {
    display: block;
    width: 33%;
    float: left;
}

/* Navigation links */
nav a {
    display: block;
    background-color: #d4af37;
    line-height: 2.8em;
    text-decoration: none;
    text-align: center;
}

/* Hover effect for nav links */
nav a:hover {
    background-color: rgb(10, 49, 97);
    color: red;
    font-size: 1.2em;
    text-decoration: underline;
    transition: background-color 1.5s ease-in 0.5s,
                color 0.5s ease-in 0.5s,
                font-size 0.5s ease;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */

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

/* Images inside main */
main > img {
    width: 25%;
    padding: 25px;
    float: right;
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
    background-color: #d4af37;
    color: #0a3161;
    font-weight: bold;
    font-size: 0.9em;
    line-height: 3em;
    text-align: center;
    margin-top: 10px;
    padding: 10px;
    clear: both;
}

/* Ensures footer clears floats */
body > footer {
    clear: both;
}

/* ============================================================
   LIST STYLES
   ============================================================ */

ul {
    list-style-type: square;
    color: navy;
    font-weight: bold;
}

/* Nested UL */
ul ul {
    list-style-type: circle;
    color: teal;
}

/* ============================================================
   FLEXBOX GALLERY
   ============================================================ */

/* Gallery container (.gallery class) */
div.gallery {
    display: flex;
    flex-flow: wrap;
}

/* Individual gallery items (.imageGallery class) */
div.imageGallery {
    flex: 23%;
    max-width: 25%;
    padding: 0 4px;
}

/* Images inside gallery */
div.imageGallery img {
    width: 100%;
    height: auto;
}

/* ============================================================
   TABLE STYLES
   ============================================================ */

/* Table element */
table {
    border: 20px solid #0a3161;
    border-collapse: collapse;
}

/* Odd table rows */
tbody tr:nth-of-type(odd) {
    background-color: rgb(179, 25, 66);
    color: white;
}

/* Table headers */
th {
    border: 1px solid #0a3161;
    padding: 5px;
    text-align: center;
    vertical-align: top;
    background-color: #0a3161;
    color: white;
}

/* Table cells */
td {
    border: 1px solid gray;
    padding: 5px;
    text-align: left;
    vertical-align: top;
}

/* Table footer */
tfoot {
    background-color: #0a3161;
    color: white;
}

/* ============================================================
   FORM VALIDATION STYLES
   ============================================================ */

/* Focus highlight */
input:focus, select:focus, textarea:focus {
    background-color: rgb(220, 255, 220);
}

/* Invalid input */
input:invalid {
    background-color: rgb(255, 232, 233);
}

/* Valid input */
input:valid {
    background-color: rgb(220, 255, 220);
}

/* Valid icons for specific IDs */
input#name:focus:valid,
input#zip:focus:valid,
input#phone:focus:valid,
input#mail:focus:valid {
    background: rgb(220, 255, 220) url(rb_valid.png) bottom right/contain no-repeat;
}

/* Invalid icons for specific IDs */
input#name:focus:invalid,
input#zip:focus:invalid,
input#phone:focus:invalid,
input#mail:focus:invalid {
    background: rgb(255, 232, 233) url(rb_invalid.png) bottom right/contain no-repeat;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.clear {
    clear: both;
}

/* ============================================================
   MEDIA QUERIES
   ============================================================ */

/* ---------- Tablet (max-width: 1100px) ---------- */
@media only screen and (max-width: 1100px) {
    div.imageGallery {
        flex: 47%;
        max-width: 50%;
    }
}

/* ---------- Mobile (max-width: 768px) ---------- */
@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;
    }

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

    /* Mobile table stacking */
    table, tbody, tr, td, th {
        display: block;
    }

    thead, tfoot {
        display: none;
    }

    tbody td {
        position: relative;
        padding-left: 40%;
        height: auto;
    }

    td::before {
        content: attr(data-label);
        position: absolute;
        top: 0;
        left: 0;
        padding: 10px;
        width: 40%;
        white-space: nowrap;
    }

    /* Mobile form layout */
    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%;
    }

    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;
    }
}

/* ---------- Desktop (min-width: 769px) ---------- */
@media only screen and (min-width: 769px) {

    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%;
    }

    label {
        display: block;
        position: absolute;
        padding: 5px;
        width: 30%;
    }

    input[type="radio"] {
        display: inline;
        position: inherit;
        left: 0;
        width: auto;
    }

    label.radio {
        display: inline;
        position: inherit;
    }

    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;
    }

    textarea {
        position: relative;
        left: 30%;
        width: 60%;
    }
}