html {
  box-sizing: border-box;
}

*, *::after, *::before {
  box-sizing: inherit;
}

:root {
  --color-dark: #181818;
  --color-gray: #787878;
  --color-orange: #FF7A00;
}

html {
  background-color: var(--color-dark);
  height: 100%;
}

body {
  margin: 0;
  padding: 6px 12px;

  color: white;
  font-family: Arial, Helvetica, sans-serif;
}

#above-the-fold {
  display: flex;
  position: relative;
  justify-content: space-around;
  
  height: 100%;
  min-height: -webkit-fill-available;
  min-height: -moz-available;
  min-height: fill-available;
}

/* For mobile devices on landscape mode or with the keyboard open, prevent the calculator */
/* section from being to small and collapsing the header and footer: */
#above-the-fold.sharing-visible {
  min-height: 600px;
}

main {
  opacity: 0;
  transform: translateY(4px);
}

.main-fade-in {
  opacity: 1;
  transform: none;
  transition: 0.3s;
}

header {
  position: absolute;
  width: 100%;

  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 48px;
}

header h1 strong {
  grid-column: 1;
  grid-row: 1 / 3;
  font-size: 50px;
  line-height: 52px;
}

header h1 sup {
  grid-column: 2;
  grid-row: 1;
  color: var(--color-orange);
  font-size: 20px;
  line-height: 30px;
}

header h1 sub {
  grid-column: 2;
  grid-row: 2;
  color: var(--color-orange);
  font-size: 20px;
  line-height: 10px;
}

#loading-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--color-dark);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#loading-overlay.hidden {
  display: none;
}

#loading-overlay h1 {
  margin: 0;
  margin-left: 40px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 124px;
  opacity: 0;
  animation: loading-logo 0.5s 0.2s forwards;
}

#loading-overlay h1 strong {
  grid-column: 1;
  grid-row: 1 / 3;
  font-size: 150px;
  line-height: 156px;
}

#loading-overlay h1 sup {
  grid-column: 2;
  grid-row: 1;
  color: var(--color-orange);
  font-size: 60px;
  line-height: 90px;
}

#loading-overlay h1 sub {
  grid-column: 2;
  grid-row: 2;
  font-size: 60px;
  line-height: 30px;
}

.loading-subtitle {
  color: var(--color-gray);
  font-style: italic;
  opacity: 0;
  animation: loading-subtitle 0.5s 1s forwards;
}

.loading-error {
  color: red;
}

.header-options {
  display: flex;
  gap: 12px;
}

.options-toggle {
  font-size: 16px;
  font-weight: bold;
  border-radius: 8px;
  border: 1px solid white;
  display: flex;
  padding: 2px;
  cursor: pointer;
}

.options-toggle > .toggle {
  padding: 4px 8px;
}

.options-toggle > .toggle:first-of-type {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}
.options-toggle > .toggle:last-of-type {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

.options-toggle > .toggle.selected {
  background-color: white;
  color: var(--color-dark);
}

main {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.calculator {
  display: flex;
  gap: 88px;
  font-size: 36px;
  margin: 20px auto;
  justify-content: center;
}

.currency {
  display: flex;
  align-items: center;
}

.conversion-amount {
  font-size: 22px;
  color: var(--color-gray);
  font-style: italic;
  margin-top: 12px;
}

input.amount {
  width: 212px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: inherit;
  padding-bottom: 6px;
  background-color: transparent;
  border: none;
  border-bottom: 2px solid white;
  color: white;
  margin-inline-end: 20px;
  transition: 0.2s border-color;
}

input.amount.large-numbers {
  padding-top: 10px;
  font-size: 28px;
}


input.amount:focus {
  outline: none;
  border-block-color: var(--color-orange);
}

.hidden {
  display: none;
}

.unit {
  font-weight: bold;

  /* to avoid "Sats" / "BTC" text width changes */
  min-width: 80px;
}

.refetch-info {
  margin: 0 auto;
  font-style: italic;
  color: var(--color-gray);
}

.invisible {
  visibility: hidden;
}

#refetch-exchange {
  color: white;
  background-color: inherit;
  padding: 0;
  margin: 0;
  font-family: inherit;
  border: none;
  font-size: inherit;
  font-style: italic;
}

#refetch-exchange:hover {
  text-decoration: underline;
  cursor: pointer;
}

#section-share {
  width: 96%;
  max-width: 480px;

  margin: 0 auto;
  text-align: center;

  max-height: 0;
  overflow: hidden;

  opacity: 0;
  transition: 0.3s opacity, 0.5s max-height 0.1s;
}

#section-share.section-share-reveal {
  opacity: 1;
  max-height: 280px;
  overflow: visible;

  transition: 0.5s max-height, 0.5s opacity 0.3s;
}

#section-share p {
  font-size: 18px;
  line-height: 26px;
  margin-top: 30px;
}

#section-share div[role=button] {
  cursor: pointer;
  display: inline-block;
}

#section-share div[role=button]:hover {
  color: var(--color-orange);
}

.share-url {
  display: flex;
  background-color: white;
  border-radius: 12px;
  padding: 4px;
  margin: 24px auto 8px;
}

#share-link-copied {
  color: var(--color-orange);
  margin-bottom: 16px;
  visibility: hidden;
  transform: translateY(3px);
  opacity: 0;
  transition: 0.3s;
}

#share-link-copied.link-copied-reveal {
  visibility: visible;
  opacity: 1;
  transform: none;
}

#share-input {
  flex: 1;
  border: none;
  font-family: unset;
  color: var(--color-dark);
  padding: 4px 8px;
  font-size: 18px;
}

#share-input:focus {
  outline: none;
}

#share-copy-link {
  background-color: var(--color-dark);
  color: white;
  text-transform: uppercase;
  font-weight: bold;
  cursor: pointer;
  border: none;
  padding: 12px 12px;
  border-radius: 10px;
  transition: 0.2s opacity;
}

#share-copy-link:hover {
  opacity: 0.9;
}

footer {
  position: absolute;
  bottom: 0;
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
}

footer a {
  text-decoration: none;
}

footer div[role=button] {
  cursor: pointer;
}

footer div[role=button]:hover, footer a:hover {
  text-decoration: underline;
}

#below-the-fold {
  min-height: 100%;
  margin-top: 32px;
}

.about {
  width: 1200px;
  max-width: 100%;
  margin: 0 auto;
  padding-top: 20px;
}

.about h2 {
  text-align: center;
  font-size: 48px;
  overflow: hidden;
  margin: 0 auto 44px;
}

.about h2 > span {
  position: relative;
  display: inline-block;
}

.about h2 > span:before, .about h2 > span:after {
  content: '';
  position: absolute;
  top: 50%;
  border-bottom: 1px solid white;
  width: 50vw;
  margin: 0 80px;
}

.about h2 > span:before {
  right: 100%;
}

.about h2 > span:after {
  left: 100%;
}

.created-by {
  font-size: 18px;
  font-weight: bold;
  text-align: center;
}

.created-by a {
  color: var(--color-orange);
}

.powered-by {
  font-size: 18px;
  text-align: center;
  font-style: italic;
}

.powered-by a {
  color: white;
}

.project-info {
  margin: 72px 0 96px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px 4vw;
}

.info-title {
  grid-row: 1;
  font-size: 24px;
  font-weight: bold;
  text-transform: uppercase;
  text-align: center;
}

.info-title strong {
  color: var(--color-orange);
}

.info-description {
  grid-row: 2;

  font-size: 16px;
  line-height: 30px;
}

.github-link {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
  gap: 12px;
  font-size: 15px;
}

.github-link img {
  height: 32px;
}

.github-link a {
  color: white;
}

.donate-button {
  display: inline-block;
  border: 2px solid var(--color-orange);
  color: var(--color-orange);
  padding: 4px 16px;
  text-decoration: none;
  border-radius: 8px;
  font-size: 18px;
  margin: 8px 0;
}

.donate-button:hover {
  filter: brightness(1.3);
  transition: 0.3s;
}

p.donate-caption {
  font-size: 14px;
  line-height: 22px;
  font-style: italic;
  text-align: center;
}

.center {
  text-align: center;
}

a {
  color: white;
}

.not-your-keys-not-your-coins {
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  width: 900px;
  max-width: 100%;
  margin: 0 auto 20px;
}

@media screen and (max-width: 820px) {
  .calculator {
    flex-direction: column;
    gap: 40px;
  }

  .equal-sign {
    display: none;
  }

  #section-share p {
    font-size: 16px;
    line-height: 24px;
  }

  #share-input {
    font-size: 14px;
  }

  #share-copy-link {
    font-size: 12px;
  }

  .about h2 {
    font-size: 42px;
    margin-bottom: 36px;
  }

  .about h2 > span:before, .about h2 > span:after {
    margin: 0 28px;
  }

  .created-by, .powered-by {
    font-size: 15px;
  }

  .project-info {
    display: block;
    margin-top: 60px;
  }
  
  .info-title {
    margin: 44px 0 20px;
  }

  .not-your-keys-not-your-coins {
    font-size: 13px;
  }
}

@media screen and (max-width: 1024px) {
  .github-link {
    gap: 8px;
    font-size: 13px;
  }

  .github-link img {
    height: 24px;
  }
}

@keyframes loading-logo {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loading-subtitle {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
