@import '../global.css';

body {
  text-align: center;

  @media (width > 500px) {
    font-size: 20px;
  }
}

::selection {
  background: #af8126;
  color: var(--black);
}

main {
  width: 100svw;
  height: 100svh;
  overflow: hidden;
  display: block;
  position: relative;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

p {
  margin: 1rem;
  background: var(--bg);
}

.egg-shell, button#crack, .half {
  display: block;
  width: 200px;
  height: 160px;

  @media (width < 500px) {
    width: 150px;
    height: 120px;
  }
}
.egg-shell {
  margin: auto;
  position: relative;
}
button#crack, .half {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 1;
}
button#crack {
  background: transparent;
  background-size: contain;
  border: none;
  cursor: pointer;
  z-index: 2;
}
.half {
  transition: left 400ms, opacity 500ms 200ms;
  
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10 and IE 11 */
  user-select: none; /* Standard syntax */
}
.egg-shell.cracked {
  button#crack {
    display: none;
    pointer-events: none;
  }

  .half {
    opacity: 0;
  }
  .half.left {
    left: -100px;
  }
  .half.right {
    left: 100px;
  }
}

.scramble-text {
  opacity: 0;
  pointer-events: none;
  transition: opacity 100ms 500ms;
}
.scramble-text.show {
  opacity: 1 ;
  pointer-events: auto;
}

.pan {
  width: 400px;
  height: 400px;
  background: #303030;
  border-radius: 50%;
  margin: auto;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
}
.pan-handle {
  width: 400px;
  height: 400px;
  border: 30px solid #222;
  border-radius: 50%;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(33deg);
}
.pan-handle:after {
  content: '';
  display: block;
  position: absolute;
  background: #af8126;
  width: 40px;
  height: 50vh;
  top: 369px;
  left: calc(50% - 20px);
  z-index: -1;
}

.egg {
  display: none;
  width: 300px;
  height: 300px;
  position: relative;
  opacity: 0;
  
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10 and IE 11 */
  user-select: none; /* Standard syntax */
}
body:has(.egg-shell.cracked) .egg {
  opacity: 1;
  display: block;

  .sunny {
      cursor: pointer;
  }
}
.scramble, .sunny {
  display: block;
  position: absolute;
  opacity: 1;
  width: 300px;
  height: 300px;
  top: 0;
  left: 0;
}
.sunny {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.egg.done {
  .sunny {
    opacity: 0;
    cursor: default !important;
  }
}

.done-text {
  text-align: center;
  margin: 1rem;
  display: none;
}

body:has(.egg.done) .scramble-text {
  display: none;
}
body:has(.egg.done) .done-text {
  display: block;
}

a.linkback {
  position: absolute;
  bottom: 5px;
  right: 5px;
  color: #af8126;
  font-size: 1rem;
}
a.linkback:hover {
  color: #303030;
}