/* ==========================================================================
   Registration form of Muchamed Arsakaew
   ========================================================================== */

/* Font (Geologica, SIL Open Font License 1.1)
   ========================================================================== */

@font-face {
  font-display: swap;
  font-family: Geologica;
  font-style: normal;
  font-weight: 400;
  src: url('../../font/geologica/geologica-v5-latin-regular.woff2')
    format('woff2');
}

@font-face {
  font-display: swap;
  font-family: Geologica;
  font-style: normal;
  font-weight: 700;
  src: url('../../font/geologica/geologica-v5-latin-700.woff2') format('woff2');
}

body {
  font-family: Geologica, Arial, 'Helvetica Neue', Helvetica, sans-serif;
}

/* Page header (always visible at the top of the window)
   ========================================================================== */

html {
  scroll-padding-top: 110px;
}

header {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Links
   ========================================================================== */

a {
  color: #007cb7;
}

a:hover {
  color: #005680;
}

.back-link {
  font-weight: bold;
  margin: 0 0 20px;
}

.back-link::before {
  content: '> ' / '';
}

.back-link a {
  text-decoration: none;
}

/* Admission container
   ========================================================================== */

.admission {
  background-color: #f6f7f8;
  border: 1px solid #d6d8db;
  border-radius: 5px;
  margin-bottom: 20px;
  padding: 20px;
}

.admission p {
  hyphens: auto;
  text-align: justify;
}

.admission p:last-child {
  margin-bottom: 0;
}

/* Form container
   ========================================================================== */

.registration {
  background-color: #fff;
  border: 1px solid transparent;
  padding: 20px;
}

.registration h2 {
  margin-bottom: 40px;
  text-align: center;
}

/* Form fields
   ========================================================================== */

input:not([type='checkbox'], [type='radio']),
select,
textarea {
  background-color: #fff;
  border: 1px solid #868e96;
  border-radius: 5px;
  color: inherit;
  padding: 5px 8px;
  width: 100%;
}

/* Date of birth field
   ========================================================================== */

input[type='date'] {
  cursor: pointer;
}

/* Chrome, Edge and Safari: date field as high as the other fields */
input::-webkit-datetime-edit-fields-wrapper,
input::-webkit-calendar-picker-indicator {
  padding: 0;
}

/* NPA field without arrows (Firefox, then Chrome, Edge and Safari)
   ========================================================================== */

input[type='number'] {
  appearance: textfield;
}

input::-webkit-inner-spin-button {
  appearance: none;
}

/* Civil status list
   ========================================================================== */

select {
  appearance: none;
  background: #fff url('../../img/icon-arrow-down.svg') no-repeat right 8px
    center / 20px;
  cursor: pointer;
}

/* Comment field
   ========================================================================== */

textarea {
  height: 150px;
  resize: vertical;
}

/* Form grid
   ========================================================================== */

.registration-form {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 1fr;
}

.form-item {
  align-items: center;
  border: 0;
  column-gap: 20px;
  display: grid;
  grid-template-columns: 3fr 5fr;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.form-item-wide {
  grid-column: 1 / -1;
  grid-template-columns: 3fr 5fr 3fr 5fr;
}

.form-item-wide textarea {
  grid-column: 2 / -1;
}

/* Labels and group titles
   ========================================================================== */

label {
  cursor: pointer;
}

.form-item > label,
.form-item > legend {
  color: #007cb7;
  font-weight: bold;
  text-align: right;
}

.form-item > legend {
  float: left;
  padding: 0;
}

.optional {
  color: #5c6166;
  display: block;
  font-weight: normal;
}

/* Radio buttons and checkboxes
   ========================================================================== */

.options {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.option {
  align-items: center;
  display: flex;
  gap: 10px;
}

.option input {
  margin: 0;
}

/* Address and AVS number format
   ========================================================================== */

.address {
  display: grid;
  gap: 5px;
  grid-template-columns: 90px 1fr;
}

.address > :first-child {
  grid-column: 1 / -1;
}

.hint {
  color: #5c6166;
  font-size: 1.4rem;
  margin: 5px 0 0;
}

/* Validation indicators (HTML and CSS only)
   ========================================================================== */

input:user-valid,
select:user-valid {
  border-left-color: #218838;
}

input:user-invalid,
select:user-invalid {
  border-left-color: #c82333;
}

input:required:not([type='radio']),
select:required {
  border-left-width: 5px;
}

/* Error messages (HTML and CSS only)
   ========================================================================== */

.error {
  color: #c82333;
  display: none;
  font-size: 1.4rem;
  margin: 5px 0 0;
}

.form-item:has(:user-invalid) .error {
  display: block;
}

/* Submit button
   ========================================================================== */

.registration-form button {
  background-color: #007cb7;
  border: 2px solid #000;
  border-radius: 5px;
  color: #fff;
  cursor: pointer;
  font-weight: bold;
  grid-column: 1 / -1;
  justify-self: center;
  margin-top: 20px;
  padding: 10px 50px;
}

.registration-form button:hover {
  background-color: #005680;
}

/* ==========================================================================
   Tablet and smartphone landscape (max: 768px)
   ========================================================================== */

@media (width <= 768px) {
  .form-item {
    align-content: start;
    align-items: start;
    grid-template-columns: 1fr;
    row-gap: 5px;
  }

  .form-item-wide textarea {
    grid-column: auto;
  }

  .form-item > label,
  .form-item > legend {
    text-align: left;
  }

  .optional {
    display: inline;
  }
}

/* ==========================================================================
   Smartphone portrait (max: 480px)
   ========================================================================== */

@media (width <= 480px) {
  .registration-form {
    grid-template-columns: 1fr;
  }

  .form-item {
    align-items: center;
    grid-template-columns: 1fr 2fr;
    row-gap: 20px;
  }

  .form-item-wide {
    grid-template-columns: 1fr;
  }

  .optional {
    display: block;
  }
}

/* ==========================================================================
   Small smartphone portrait (max: 430px)
   ========================================================================== */

@media (width <= 430px) {
  .form-item {
    align-items: start;
    grid-template-columns: 1fr;
    row-gap: 5px;
  }

  .optional {
    display: inline;
  }
}
