@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap");

:root {
  /* font sizes */
  --fs-large: clamp(2rem, 4vw + 1rem, 4rem);
  --fs-medium: clamp(1.75rem, 3vw + 1rem, 3.5rem);
  --fs-paragraph: clamp(1.25rem, 2.5vw + 0.75rem, 2.5rem);

  /* font weights */
  --fw-bold: 800;
  --fw-medium: 600;
  --fw-regular: 400;
  --fw-thin: 200;

  /* colors */
  --c-text: #333333;
  --c-background: #f7faf7;
  --c-primary: #386641;
  --c-secondary: #fff699;

  /* spaces */
  --s-tiny: 0.5em;
  --s-regular: 1em;
  --s-medium: 2em;
  --s-large: 3em;
  --s-huge: 4em; 
}

/* general elements, classes */
* {
  font-family: "Montserrat", sans-serif;

  margin: 0;
  padding: 0;
  box-sizing: border-box;

  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10 and IE 11 */
  user-select: none; /* Standard syntax */
}

body {
  background-color: var(--c-background);
}

/* OVERLAY STYLES */
.overlay {
  display: none;
}

@media screen and (min-width: 440px) {
  body {
    overflow: hidden;
  }

  .overlay {
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    text-align: center;

    position: relative;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    color: var(--c-background);
    font-size: var(--fs-paragraph);
    background-color: var(--c-text);
    z-index: 9000;
  }

  .overlay h1 {
    font-size: 1.4em;
  }
  
  .overlay p {
    margin-top: var(--s-regular);
    font-size: 0.5em;
  }
}

/* loader */
.loader {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--c-background);
  z-index: 9999;
}

.disappear {
  animation: vanish 1s forwards
}

@keyframes vanish {
  100% {
    opacity: 0;
    visibility: hidden;
    display: none;
  }
}

/* header, welcome */
.header {
  width: 100vw;
  height: 500px;
  background-color: var(--c-background);

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;     
  text-align: left;  
}

.header i {
  margin-top: var(--s-regular);
  font-weight: var(--fw-medium);
  color: var(--c-text);
}

.header h1:first-of-type {
  font-size: var(--fs-large);
  font-weight: var(--fw-regular);
}

.header h1:nth-of-type(2) {
  font-size: var(--fs-large);
  font-weight: var(--fw-bold);
  color: var(--c-primary);
}

/* add-grocery form */
.grocery-container {
  max-width: 100vw;
  min-height: 520px;
  margin-top: -25px;
  padding: var(--s-regular);
  color: var(--c-background);
  background-color: var(--c-primary);
  border-top-left-radius: 30px;
  border-top-right-radius: 30px;
}

.grocery-container h1:first-of-type {
  color: var(--c-secondary);
  padding-top: var(--s-tiny);
  padding-bottom: calc(var(--s-tiny))/1.5;
}

.grocery-container h1, 
.grocery-container p {
  text-align: left;
}

form {
  display: flex;
  flex-direction: column;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-group label {
  margin-bottom: 8px;
  font-weight: bold;
}

.form-group > :nth-child(1) {
  padding-top: var(--s-regular);
}

input[type="text"], 
input[type="number"], 
select {
  padding: 10px;
  font-size: 16px;
  border: 1px solid var(--c-text);
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
}

.form-row .form-group {
  flex: 1;
}

form button {
  font-size: 16px;
  font-weight: var(--fw-regular);
  margin-top: 35px;
  color: var(--c-text);
  background-color: var(--c-secondary);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: var(--fw-medium);

  width: 100%;
  min-width: 40px;
  height: 50px;
}

form button:nth-child(2) {
  font-weight: var(--fw-regular);
  color: var(--c-text);
  background-color: #fffbcc;
}

/* list of added groceries */
.list-container {
  max-width: 100vw;
  min-height: 320px;
  padding: var(--s-regular);
  margin-top: -45px;
  color: var(--c-text);
  background-color: var(--c-background);
  border-top-left-radius: 30px;
  border-top-right-radius: 30px;
}

#list h1 {
  color: var(--c-text);
  padding-top: var(--s-tiny);
  padding-bottom: calc(var(--s-tiny))/1.5;
}

#list ul li {
  margin: var(--s-tiny) var(--s-medium);
  font-size: 1.1em;
}

/* list buttons styles */
#list-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: -20px;
  padding-bottom: 50px;
}

#list-buttons button {
  font-size: 16px;
  font-weight: var(--fw-regular);
  margin-top: 10px;

  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#list-buttons button:nth-of-type(1) {
  color: var(--c-text); 
  background-color: var(--c-secondary);
  border-radius: 5px; 
  width: 100%;
  height: 50px;
  font-weight: var(--fw-medium);
  cursor: pointer; 
}

#list-buttons button:nth-of-type(2) {
  color: var(--c-background);
  background-color: var(--c-text);

  width: calc(50% - 3px);
  height: 50px;
}

#list-buttons button:nth-of-type(3) {
  color: var(--c-text);
  background-color: var(--c-background);
  border: 2px solid var(--c-text);

  width: calc(50% - 3px);
  height: 50px;
} 

/* thank you div styles */
#thankyou {
  position: relative;
  background-color: var(--c-background);
  text-align: center;
  padding: 15px;
  height: 52px; /* Initial height */
  background-color: var(--c-background);
  margin-top: -50px;
  border-top-left-radius: 25px;
  border-top-right-radius: 25px;
  display: flex; 
  justify-content: space-around;
}

#thankyou a {
  flex-grow: 1; 
  height: 20px;
  width: auto;
  cursor: pointer;
  text-decoration: underline;
  color: var(--c-text);
  text-align: center; 
}

#thankyou.clicked {
  position: fixed;
  overflow: hidden !important; 
  left: 0;
  width: 100vw;
  height: 40vh;
  border: 2px solid black;
  border-bottom: none;
  bottom: 0;
  background-color: var(--c-background);
  z-index: 1000;
}

#content {
  display: none;
  position: absolute;
  text-align: start;
  word-wrap: break-word;
  color: var(--c-text);
  max-width: 300px;
  margin-top: 45px; 
  padding: 10px;
}

/* pc-only styles */
@media screen and (min-width: 768px) {
  .form-group {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .form-group label {
    flex: 1;
    text-align: right;
    margin-right: 20px;
  }

  .form-group input,
  .form-group select {
    flex: 2;
  }
}

/* phone-only styles */
@media only screen and (max-width: 600px) {

  .header {
    padding-left: var(--s-regular);
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;     
    text-align: left;    
  }
}
