/* Global Styles */
*,
*::before,
*::after{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  text-decoration: none;
}

:root {
  --main-font: "Roboto", sans-serif;
  --secondary-font: "Open Sans", sans-serif;
  --body-font: "Open Sans", sans-serif;
  --main-color: #000000;
  --secondary-color: #ffffff;
  --tertiary-color: #222222;
}

html {
  font-family: var(--body-font);
  font-size: 10px;
  color: var(--main-color);
  scroll-behavior: smooth;
}

body {
  background-color: #fafafa;
  height: 100vh;
  width: 100%;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ############################################################ */
/* Everything above this line is just standard CSS boilerplate */
/* ############ Everything below is the GOOD STUFF ############ */
/* ############################################################ */

form {
  width: 100%;
  padding: 40px;
}

.form-input {
  width: clamp(740px, 50vw, 420px);
  height: 120px;
  padding: 0 20px;
  color: var(--main-color);
  font-family: var(--body-font);
    font-size: 80px;
  border: 5px solid var(--tertiary-color); /* Basic border styling */
  border-radius: 1px 1px 2px 2px;
  margin: 0 auto 10px auto;
  transition: all 500ms; /* This is used to animate the border later */
}

/* By default, an outline appears around form fields when they're in focus.
This disables outlines when form fields are in focus. */
/* Also, it makes the top border disappear when the field in focus. */
.form-input:focus {
  outline: none;
  border-top-color: rgba(0, 0, 0, 0.1);
}

/* Note: I'm using rems here with a base of 10px. 
So this means 1.4rem is 14px. */
.form-label {
  font-size: 4.0rem;
  color: rgb(117, 117, 117);
  display: block;
  /* Moves the label on TOP of the placeholder */
  /* You'll need to change this as needed */
  transform: translate(2rem,-4rem);
  transform-origin: 0 0; /* Used later for transitions */
  transition: all 500ms;
  
  /* Prevents users from highlighting the label. */
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10 and IE 11 */
  user-select: none; /* Standard syntax */
  
  /* THIS PART IS IMPORTANT! */
  /* This line prevents the label from being selected.*/
  /* This is crucial because if we want to select the form field,
     we want to click THROUGH the label. */
  pointer-events: none; 
}

/* THIS PART IS ALSO IMPORTANT!! */
/* The block below hides the placeholder entirely. */
/* For all intents and purposes, the placeholder no longer exists. */
/* What shows on the input field is only the label*. */
/* HOWEVER, the input fields still recognizes that the placeholder exists!*/
/* The placeholder is just invisible. We need the placeholder to exist for some weird CSS stuff. If we skip this step, we can't make this CSS-only. */
.form-input::placeholder {
  display: none;
  color: transparent;
  
/* Prevents users from highlighting the placeholder. */
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10 and IE 11 */
  user-select: none; /* Standard syntax */
}

/* How to read this: */
/* When the input field (.form-input) is in focus, 
   STYLE the .form-label accordingly */
/* ALSO, if the placeholder is NOT shown,
   STYLE the .form-label accordingly */

/* Basically, if there's text inside the input field,
   by default, the placeholder should disappear.
   When this happens, the label translates ABOVE the input field and scales down. */

.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label {
  transform: translateY(-6.75rem) scale(0.8);
}

/* When the placeholder is NOT shown,
   STYLE the top border accordingly. */
/* This makes the top border fade-out to grey when the placeholder disappears. */
.form-input:not(:placeholder-shown) {
  border-top-color: rgba(0, 0, 0, 0.5);
}