/**** VARIABLES ****/

:root {
  --primary: hsl(190deg 100% 35%);

  --secondary: hsl(60deg 100% 50%);
  --secondary-hover: hsl(60deg 100% 40%);

  --text: hsl(0deg 0% 20%);
  --background: hsl(190deg 30% 99%);

  --now: hsl(240deg 67% 94%); /* lavendar */

  --day-tab: hsl(60deg 80% 90%); /* lightgoldenrodyellow */
  --day-tab-selected: hsl(50deg 95% 80%);

  --hour-breakdown: hsl(208, 100%, 97%); /* aliceblue */

  --color-dark-gray: hsl(0deg 0% 65%);
  --color-light-gray: hsl(0deg 0% 80%);
}

/**** RESETS ****/

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

html,
body {
  height: 100%;
}

body {
  font-family: 'Lato', sans-serif;
  background: var(--background);
  display: flex;
  flex-direction: column;
  color: var(--text);
}

a {
  text-decoration: none;
}

/**** GLOBAL CLASSES ****/

.row,
.column {
  display: flex;
}

.column {
  flex-direction: column;
}

.justify-center {
  justify-content: center;
}

.align-center {
  align-items: center;
}

.justify-space-between {
  justify-content: space-between;
}

.hide {
  display: none;
}

.text-center {
  text-align: center;
}

.wrapper {
  max-width: 81.25em; /* equiv to 1300px*/
  margin: 0 auto;
  padding: 10px 2%;
}

.main-content-structure {
  display: grid;
  grid-template-columns: 1fr 4fr;
  gap: 40px;
}

/**** CUSTOM STYLES ****/

/*** HEADER ***/
header {
  background: var(--primary);
  margin-bottom: 20px;
}

.header-structure {
  display: flex;
  align-items: center;
}

header .brand {
  color: var(--secondary);
  margin-right: auto;
}

header nav ul {
  list-style-type: none;
  display: flex;
  gap: 16px;
}

header nav i {
  color: var(--secondary);
  font-size: 1.4rem;
  transition: color 0.2s ease;
}

header nav i:hover {
  color: var(--secondary-hover);
}

/*** CONTENT ***/

/** Search Column **/
section.search-panel {
  grid-column: 1 / 2;
  grid-row: 1 / auto;
  gap: 20px;
}

/* Search form */
.search-panel form div.search-wrapper {
  display: grid;
  grid-template-columns: 1fr auto;
}

.search-panel form input.search {
  padding: 7px 15px;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  border: 2px solid var(--primary);
  outline: none;
}

.search-panel form .search-wrapper {
  transition: transform 0.2s ease-in-out;
  transform: scale(1);
}

.search-panel form .search-wrapper:hover {
  transform: scale(1.1);
}

.search-panel form input.search::placeholder {
  color: var(--primary);
}

.search-panel form button {
  width: 50px;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  background: var(--primary);
  color: var(--secondary);
  border: 0;
}

.search-panel form button:hover {
  cursor: pointer;
  color: var(--secondary-hover);
}

.search-panel form div.radio-container {
  justify-content: end;
  margin-top: 8px;
}

.search-panel form div.radio-item {
  padding-left: 15px;
}

.search-panel form .radio-item label {
  color: var(--primary);
  font-size: 0.8rem;
  margin-right: 4px;
}

.search-panel form .radio-item input[type='radio']:checked {
  accent-color: var(--primary);
}

/* Search History */
.search-panel div.search-history {
  gap: 10px;
}

.search-panel .recent-search-header {
  color: var(--color-dark-gray); /*darkgray;*/
  text-align: center;
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 1.2rem;
}

.search-history button.history-button {
  position: relative; /*needed to position the x */
  display: inline-block;
  padding: 12px 20px;
  border-radius: 4px;
  border: 1px dotted var(--color-light-gray);
  background: none;
  color: var(--color-dark-gray);
  cursor: pointer;
  transition: color 0.2s ease-in-out,
    background-color 0.2s ease-in-out;
}

/* cute way of adding a degree of tactileness or feedback when button is clicked */
.search-history .history-button:focus-within {
  border: 1px solid var(--primary);
}

.search-history .history-button:hover {
  color: var(--text);
  background: hsl(180deg 100%, 97%); /* azure */
}

.search-history .history-button span.button-text {
  display: inline-block;
}

.search-history .history-button span.close {
  position: absolute;
  top: 1px;
  right: 2px;
  color: var(--color-dark-gray);
  cursor: pointer;
  padding: 0 3px;
}

.search-history .history-button .close:hover {
  color: deeppink;
}

/** Weather Section **/
main {
  flex: 1;
}

main section.weather {
  grid-column: 2 / 3;
  gap: 40px;
}

.weather div.feedback {
  color: var(--primary);
  padding-top: 7px;
  padding-left: 10px;
  text-align: center;
  font-size: 0.9rem;
}

/* Current Section */
.weather section.current {
  display: grid;
  grid-template-columns: 1fr 1.1fr 0.9fr;
  gap: 20px;
}

/* overview panel */
.current .overview {
  position: relative;
  background: var(--now); /* lavender */
  /* border-left: 10px solid #ffdab9; peachpuff */
  padding: 10px 5%;
  gap: 10px;
}

.current .overview h1,
.current .overview p.temp {
  font-size: 2rem;
}

.current .overview img {
  position: absolute;
  top: 0px;
  right: 20px;
}

/* table panel */
.current table {
  padding: 10px 5%;
  width: 100%;
  border-collapse: collapse;
}

.current table td {
  padding: 10px;
}

.current table tr:not(:last-child) {
  border-bottom: 1px solid var(--color-light-gray);
}

/* Forecast Section */
.weather section.forecast {
  background: var(--background);
}

.forecast h1 {
  font-size: 2rem;
  margin-bottom: 20px;
  padding-left: 10px;
}

/* day tabs */
.forecast .days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: 0.6fr 1fr;
  text-align: center;
  gap: 5px;
  overflow-y: hidden;
}

.days .day-tab {
  grid-column: span 1;
  grid-row: 2/3;
  padding: 10px;
  cursor: pointer;
  background-color: var(--day-tab);
}

.days .day-tab.selected {
  grid-column: span 2;
  grid-row: 1/3;
  background-color: var(--day-tab-selected);
  cursor: revert;
}

.day-tab.selected p:first-child {
  font-size: 1.2rem;
}

.days .day-tab:hover {
  background: var(--day-tab-selected);
}

.day-tab .tab-details {
  flex: 1;
  display: flex;
  align-items: center;
}

.tab-details > * {
  flex: 1;
}

.day-tab .tab-description {
  padding-bottom: 4px;
}

/* day breakdowns */
.forecast div.day-breakdown {
  gap: 10px;
}

.day-breakdown h3.day-date {
  padding: 5px 5px;
}

.day-breakdown div.day {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
}

.day-breakdown .day div.hour {
  padding-left: auto;
  padding-right: auto;
  padding-top: 20px;
  padding-bottom: 20px;
  background: var(--hour-breakdown);
  text-align: center;
  gap: 20px;
}

.day-breakdown .day > *:not(:first-child):not(:last-child) {
  border-left: 1px solid var(--color-light-gray);
}

.day-breakdown .day > *:not(:last-child) {
  border-top: 1px solid var(--color-light-gray);
}

.day-breakdown .day .hour div.temp {
  min-height: 150px;
  position: relative;
}

.day-breakdown .day .hour .temp p {
  position: absolute;
  left: 50%;
  transform: translate(-50%);
  /* the following will be overwritten by the js logic */
  bottom: 25%;
}

.day-breakdown .day div.hour-details {
  justify-content: end;
  text-align: left;
  padding-left: 7px;
  background: var(--background);
  color: #999;
  min-width: 80px;
}

.attribution {
  color: darkgray;
  margin-top: 10px;
}

/*** FOOTER ***/

footer {
  margin-top: 20px;
  background: var(--primary);
}

footer p {
  text-align: center;
  color: var(--secondary);
}

/*** EXTRAS ***/

/* These arrow icons are mobile only features, so need to hide them on desktop */
#collapse-down-arrow,
#collapse-up-arrow {
  display: none;
}

/* The following two are for the forecast hour img tooltips */
.img-wrap {
  position: relative;
}
.tooltip {
  position: absolute;
  top: 105%;
  left: 50%;
  transform: translate(-50%, -10px);
  z-index: 9999;
  background-color: #007bff;
  color: #ffff00;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 14px;
  text-align: center;
  display: inline-block;
}

/* wind wrap */
.wind-wrap {
  height: 40px;
  position: relative;
  font-size: 1rem;
}
.wind-wrap p {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -55%);
  z-index: 1;
  color: var(--background);
}
.wind-wrap img {
  position: absolute;
  left: 50%;
  top: 50%;
  /* z-index: 1; */
  height: 50px;
  /* to black */
  /* filter: invert(1); */
  /* or to blue */
  /* filter: invert(0.5) sepia(1) saturate(5) hue-rotate(180deg); */
  filter: invert(0.3);
}

/**** MOBILE ****/

@media only screen and (max-width: 480px) {
  body {
    overflow-x: hidden;
  }

  #header-span-weather {
    display: none;
  }

  .main-content-structure {
    display: flex;
    flex-direction: column;
  }

  section.search-panel {
    gap: 15px;
  }

  .search-panel form input.search {
    font-size: 1.4rem;
    max-width: 250px;
  }

  .search-panel form {
    width: 85vw;
    margin: 0 auto;
  }

  .search-panel form div.search-wrapper {
    grid-template-columns: 0.8fr auto;
    margin: 0 auto;
  }

  .search-panel form div.radio-container {
    margin-top: 15px;
    margin-right: 10px;
  }
  .search-panel form .radio-item label {
    font-size: 1rem;
  }

  .search-history {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .search-history p {
    grid-column: span 2;
  }

  .search-panel .search-history button {
    display: none;
  }
  .search-panel .search-history .history-button.expanded {
    display: block;
  }
  #collapse-down-arrow,
  #collapse-up-arrow.expanded {
    display: inline;
  }
  #collapse-up-arrow,
  #collapse-down-arrow.expanded {
    display: none;
  }

  .weather h2 {
    text-align: center;
    font-size: 1.2rem;
  }
  .weather h2 .location {
    display: block;
    font-size: 2rem;
    padding-top: 10px;
  }

  .weather section.current {
    display: grid;
    grid-template-columns: 1fr;
  }

  .current .overview {
    /* margin: 0 20px; */
    gap: 15px;
    padding-bottom: 15px;
    margin: 0 20px;
  }
  .current .overview p.temp {
    font-size: 3rem;
  }

  .current .overview .img {
    width: 200px;
  }

  .current table {
    margin: 0 20px;
  }

  #map {
    margin: 0 auto;
  }

  .weather section.forecast {
    border: none;
    padding-left: 5px;
    padding-right: 5px;
  }
  .weather section.forecast h1 {
    padding-left: 0;
    text-align: center;
  }

  div.days {
    width: 350px;
    margin: 0 auto;
    overflow-x: scroll;
    white-space: nowrap;
    gap: 5px;
    grid-template-rows: 0.2fr 1fr;
  }
  .day-tab.selected p:first-child {
    font-size: 1.2rem;
    margin-bottom: 5px;
  }

  .days div.day-tab {
    border: none;
    width: 100px;
    background: lightgoldenrodyellow;
    display: inline-block;
  }

  .days .day-tab.selected {
    width: 150px;
    padding-top: 15px;
  }

  .forecast div.day-breakdown {
    margin-bottom: 20px;
  }

  .day-breakdown h3.day-date {
    padding-left: 10px;
    padding-bottom: 0;
    padding-top: 10px;
  }

  .forecast .day-breakdown {
    width: 350px;
    margin: 0 auto;
    overflow-x: scroll;
    white-space: nowrap;
  }

  .day div.hour {
    width: 70px;
  }

  .weather div.feedback {
    font-size: 1.3rem;
  }

  /* style the scrollbar thumb */
  /* ::-webkit-scrollbar-thumb {
    background-color: #bab8b8;
    border-radius: 10px;
  } */

  /* style the scrollbar track */
  /* ::-webkit-scrollbar-track {
    background-color: #f5f5f5;
    border-radius: 10px;
  } */

  /* style the scrollbar */
  /* ::-webkit-scrollbar {
    width: 12px;
    background-color: #f5f5f5;
  } */
}
