/*
  Funding page styles.
*/

#fundUsForm, #progressIndicator, #thankYouMessage, #errorMessage {
  /* give form a max-width and center when it exceeds that width */
  margin: 1em auto;
  max-width: 21em;
}

#fundUsForm fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/* (for non-grid fallback) put gap between type of donation and tiers to make grouping clear */

#fundUsForm .patronType {
  margin-bottom: 1em;
}

#fundUsForm .option {
  margin-bottom: 0.5em;
}

@supports (display: grid) {
  #fundUsForm .patronType,
  #fundUsForm .paymentType,
  #fundUsForm .patronTier {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-gap: 0.5em;
  }

  #fundUsForm .option {
    grid-column: span 1; /* donation tier options span one column */
    grid-row: span 1; /* donation tier options span one row */
    margin-bottom: 0;
  }

  /* Type of payment */

  #fundUsForm .paymentType {
    margin-top: 1em;
    margin-bottom: 0em;
    grid-template-rows: 1fr; /* type of donation is one row */
  }

  #fundUsForm .paymentType label {
    padding: 0.15em 0;
    margin-bottom: 0.5em;
  }

  #fundUsForm .paymentType .option {
    grid-column: span 2; /* make type of donation span two columns of grid */
  }

  #fundUsForm .paymentType .option input {
    padding: 0;
    margin: 0;
    margin-bottom: 0.25em;
  }

  #fundUsForm .paymentType .selectButton:checked + label:before {
    border: 0.16rem solid rgb(193, 208, 221);
  }

  #fundUsForm .paymentType .selectButton:checked + label {
    background-color: #d8e5ef;
    color: rgb(48, 67, 73);
  }

  #fundUsForm input[name="paymentType"] {
    display: none;
  }

  /* Ethereum */

  #ethereum p {
    word-break: break-all;
    font-size: 1.25em;
    padding-left: 0.5em;
    padding-right: 0.5em;
  }

  /* Type of donation */

  #fundUsForm .patronType {
    margin-bottom: 0.5em;
    grid-template-rows: 1fr; /* type of donation is one row */
  }

  #fundUsForm .patronType .option {
    grid-column: span 2; /* make type of donation span two columns of grid */
  }

  /* Donation tier */
  #fundUsForm .patronTier {
    margin-bottom: 0;
    grid-template-rows: 1fr 1fr; /* donation tier is is two rows */
  }

  #fundUsForm .patronTier .option label {
    /* give options min-height to ensure numbers and custom options are same height on grid */
    min-height: 2em;
  }

  #fundUsForm .donationTierButtonLabel {
    font-size: 1.5em;
    line-height: 2;
    padding: 0.75em 0;
  }

  #fundUsForm #customDonationLabel {
    font-size: 1em;
    line-height: 1;
    /* give options min-height to ensure numbers and custom options are same height on grid */
    min-height: 3.75em; /* matched to number options */
    padding: 0.75em 0.4em 0.75em;
  }
}

#fundUsForm input, #fundUsForm label, #fundUsForm button {
  display: block;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1em;
  padding: 0.75em;
  position: relative;
  text-align: center;
  -webkit-appearance: none;
}

#fundUsForm input[name="donationType"] {
  display: none;
}

#fundUsForm label {
  background-color: #eee;
  border-radius: 0.5rem;
  border: 0;
  color: #304349;
}

/* Selected radio button/label */

#fundUsForm .selectButton:checked + label {
  background-color: var(--palestinian-flag-green);
  color: white;
}

#fundUsForm .selectButton:disabled+ label {
  opacity: 0.5;
  cursor:default;
}

/* Type of donation radio button/label */

#fundUsForm .donationTypeButtonLabel {
  background-color: #eee;
  border: 0;
  cursor: pointer;
}

#fundUsForm input[name="donationType"] + label {
  border: 0.12em solid #eee;
}

/* Donation tier radio button/label */

#fundUsForm .donationTierButtonLabel {
  cursor: pointer;
}

/* Custom donation option */

/* is disabled if not in use */

#fundUsForm input[type='text']:disabled {
  cursor: not-allowed;
}

#fundUsForm input[name="donationAmount"] + label {
  border: 0.12rem solid #eee;
}

#fundUsForm #customDonationLabel > input {

  /* ensure styles are consistent with that of other input types */
  background: #fff;
  border: 0.06em solid #AFAFAF;
  border-radius: 5px;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  color: #4d4d4d;
  margin-top: 0.5em;
  margin-bottom: 0;
  opacity: 0.5;
  padding: 0.25em;
  width: 100%;
}

#fundUsForm button {
  background-color: var(--palestinian-flag-green);
  border: 0;
  border-radius: 5px;
  color: white;
  cursor: pointer;
  font-family: 'Rutan Medium', Helvetica, Arial, sans-serif;
  font-size: 1.5em;
  margin-top: 0.5em;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
  width: 100%;
}

#fundUsForm button:hover {
  opacity: 0.75;
}

#fundUsForm button:disabled {
  background-color: #eee;
  color: #ccc;
  cursor: not-allowed;
}

/* Note below button */

#fundUsForm .donation-currency {
  color: #7d7d7d;
  font-size: 1em;
  display: block;
  font-style: italic;
  text-align: center;
}

/* Messages above form */

#testMessage {
  text-align: center;
  background-color: #82073B;
  color: white;
  text-align: center;
}

#errorMessage {
  transition: max-height 0.33s;
}

/* Generic functional classes */

.displayNone {
  display: none;
}

/* Accessibly hide elements, as per http://webaim.org/techniques/css/invisiblecontent/ */
#fundUsForm .hidden {
  position:absolute;
  left:-10000px;
  top:auto;
  width:0.06em;
  height:0.06em;
  overflow:hidden;
}

/* Courtesy: https://stackoverflow.com/a/2310809 */
.unselectable {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
