@import './reset.css';
@import './font.css';
@import './variables.css';

/* ------- Global ------- */
html,
body {
  width: 100%;
  height: 100%;
  scroll-behavior: smooth;
  background-color: var(--beige);
}

body {
  box-sizing: border-box;

  --background-colour: var(--beige);
  --text-colour: var(--grey);
  background: var(--background-colour);
  color: var(--text-colour);
  font-family: var(--font-serif);
}

.hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

:focus-visible,
a:focus-visible,
.focus-visible {
  position: relative;
  z-index: 10000 !important;
  outline: 3px solid var(--blue);
  box-shadow: 0 0 0 6px var(--lightBlue);
}

div:focus-visible {
  outline: none;
}

/* ------- Main ------- */
main.home {
  margin: auto;
  display: grid;
  grid-template-columns: repeat(4, 25%);
  position: relative;
  width: 80%;
  height: 100vh;
}

main.home a:nth-child(3n+1) {
  position: relative;
  bottom: calc(10% - 120px);
  left: 25px;
  width: 220px;
  justify-self: center;
}

main.home a:nth-child(3n+2) {
  position: relative;
  bottom: calc(25% - 40px);
  right: 20px;
  width: 220px;
  justify-self: start;
}

main.home a:nth-child(3n+3) {
  position: relative;
  bottom: calc(30% - 200px);
  left: -30px;
  width: 220px;
  justify-self: end;
}

/* ------- Subpages ------- */
main.subpage {
  margin: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 60%;
  height: 100%;
}

main.subpage .eye .iris:hover,
main.subpage .eye .iris:focus {
  height: 70px;
  cursor: auto;
}

main.subpage article {
  position: relative;
  font-size: var(--font-size--default);
}

main.subpage p {
  margin-top: 1.5rem;
  align-self: start;
  font-size: var(--font-size--medium);
}

main.subpage a,
main.subpage a:visited {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-style: wavy;
  text-decoration-thickness: 1px;
  color: var(--text-colour);
}

main.subpage a:hover,
main.subpage a:focus {
  text-decoration-color: var(--orange);
}

/* ------- Eye -------
CSS blinking eye animation from
https://codepen.io/creme/pen/rdjXav
*/
.eye {
  margin: 2rem;
  position: relative;
  width: 200px;
  height: 150px;
  z-index: 0;
}

.eye .iris {
  margin: auto;
  display: inline-block;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 190px;
  height: 70px;
  border-radius: 50%;
  overflow: hidden;
  transition: 700ms cubic-bezier(0.1, 0.2, 0.3, 0.4);
}

.eye .iris::before {
  content: '';
  margin: auto;
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
  width: 45px;
  height: 45px;
  border-radius: 50%;
}

.eye .iris.lightBlue {
  background: var(--lightBlue);
}

.eye .iris.green {
  background: var(--green);
}

.eye .iris.black {
  background: var(--black);
}

.eye .iris.navy {
  background: var(--navy);
}

.eye .iris.green {
  background: var(--green);
}

.eye .iris.lightGreen {
  background: var(--lightGreen);
}

.eye .iris.orange {
  background: var(--orange);
}

.eye .iris.purple {
  background: var(--purple);
}

.eye .iris.pink {
  background: var(--pink);
}

.eye .iris.red {
  background: var(--red);
}

.eye .iris.tan {
  background: var(--tan);
}

.eye .iris.yellow {
  background: var(--yellow);
}

.eye .iris.nude {
  background: var(--nude);
}

.eye .iris.blue {
  background: var(--blue);
}

.eye .iris.green::before {
  background: var(--green);
}

.eye .iris.black::before {
  background: var(--black);
}

.eye .iris.yellow::before {
  background: var(--yellow);
}

.eye .iris.tan::before {
  background: var(--tan);
}

.eye .iris.white::before {
  background: var(--white);
}

.eye .iris.red::before {
  background: var(--red);
}

.eye .iris.pink::before {
  background: var(--pink);
}

.eye .iris.purple::before {
  background: var(--purple);
}

.eye .iris.lightBlue::before {
  background: var(--lightBlue);
}

.eye .iris.mint::before {
  background: var(--mint);
}

.eye .iris.indigo::before {
  background: var(--indigo);
}

.eye .iris.rose::before {
  background: var(--rose);
}

.eye .iris.darkBlue::before {
  background: var(--darkBlue);
}

.eye .iris:hover,
.eye .iris:focus {
  height: 20px;
  cursor: pointer;
}


/* ------- Media Queries ------- */
@media screen and (max-width: 770px) {
  main.home, main.subpage {
    width: 90%;
  }
  main.home {
    grid-template-columns: repeat(1, 100%);
  }
  main.home a:nth-child(n) {
    margin: 0;
    bottom: 0;
    justify-self: center;
  }
  .eye {
    margin: 0;
  }
}

@media screen and (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.001ms !important;
  }
}

@media screen and (prefers-color-scheme: dark) {
  body {
    --background-colour: #000;
    --text-colour: #fff;
  }
}
