@charset "utf-8";

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

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

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

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

nav {
  clear: both;
}

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

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

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

nav a:hover {
  background-color: #ccc;
  color: black;
  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 {
  padding: 20px;
  margin-top: 70px;
}

ul {
  list-style-type: square;
}

body > footer {
  background-color: #888888;
  color: rgba(80, 80, 80, 0.6);
  font-weight: bold;
  font-size: 0.9em;
  text-align: center;
  line-height: 3em;
  margin-top: 10px;
  padding: 10px;
  clear: both;
}

.clear {
  clear: both;
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gallery img {
  width: 23%;
  height: 200px;
  object-fit: cover;
}

/* Assignment 5 Table Styling */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

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

thead {
  background-color: #444;
  color: white;
}

tbody tr:nth-child(even) {
  background-color: #f2f2f2;
}

tfoot {
  background-color: #ddd;
  font-weight: bold;
  text-align: center;
}

/* Assignment 6 Focus + Valid/Invalid */
input:focus, select:focus, textarea:focus {
  background-color: rgb(255, 255, 210);
  outline: 2px solid #444;
}

input:valid, select:valid, textarea:valid {
  border: 2px solid green;
}

input:invalid, select:invalid, textarea:invalid {
  border: 2px solid red;
}

.radioQuestion {
  position: relative;
  left: 0;
  width: 100%;
  margin-top: 10px;
  margin-bottom: 5px;
}

label.radio {
  display: inline-block;
  position: relative;
  width: auto;
  padding-right: 20px;
}

textarea {
  height: 120px;
}

@media screen and (min-width: 769px) {
  html {
    background: url("background.png") no-repeat center center fixed;
    background-size: cover;
  }

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

  form {
    width: 90%;
  }

  fieldset {
    width: 90%;
    padding: 5px;
    margin-right: 10px;
    margin-bottom: 10px;
    position: relative;
  }

  input, select, textarea {
    display: block;
    position: relative;
    left: 30%;
    padding: 5px;
    height: auto;
    width: 60%;
    margin-bottom: 10px;
  }

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

  input[type="radio"] {
    display: inline;
    position: inherit;
    left: 0;
    width: 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;
  }
}

@media screen and (max-width: 768px) {
  body {
    width: 100%;
    margin: 0;
  }

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

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

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

  .gallery img {
    width: 48%;
    height: 200px;
    object-fit: cover;
  }

  form {
    width: 100%;
    font-size: large;
  }

  fieldset {
    width: 100%;
    padding: 5px;
    margin: 0;
  }

  input, select, textarea {
    position: inherit;
    display: block;
    height: 50px;
    padding: 5px;
    width: 90%;
    margin-bottom: 10px;
    left: 0;
  }

  label {
    position: inherit;
    display: block;
    height: 50px;
    width: 90%;
    padding: 5px;
  }

  input[type="submit"], input[type="reset"] {
    float: none;
    width: 90%;
    margin: 10px;
    font-size: 1.2em;
  }

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

  thead {
    display: none;
  }

  tr {
    margin-bottom: 15px;
    border: 1px solid #444;
    padding: 10px;
  }

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

  td:before {
    position: absolute;
    left: 10px;
    font-weight: bold;
  }

  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: "Interesting Fact(s)"; }
}

@media screen and (max-width: 480px) {
  .gallery img {
    width: 100%;
    height: 200px;
    object-fit: cover;
  }
}