/* A Modern CSS Reset | Piccalilli */
/* Reference: https://piccalil.li/blog/a-modern-css-reset/ */
/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
  line-height: calc(0.25rem + 1em + 0.25rem);
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul,
ol {
  list-style: none;
}

/* Set core root defaults */
html:focus-within {
  scroll-behavior: smooth;
}

html {
  min-height: 100%;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  text-rendering: optimizeSpeed;
  line-height: 1.5;
}

a {
  color: inherit;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Make images easier to work with */
img,
picture,
svg {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }
  *,
*::before,
*::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
/* Variables */
:root {
  --font-main: Cambria, Cochin, Georgia, Times, "Times New Roman", serif;
  --color-dark: black;
  --color-dark-light: hsl(0, 1%, 27%);
  --color-light: white;
}

/* Base Styles */
body {
  font-size: 18px;
  font-family: var(--font-main);
  background-color: var(--color-light);
  color: var(--color-dark);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

h1 {
  font-size: clamp(2rem, 1rem + 5vw, 2.5rem);
  transition: 500ms;
}
h1 a {
  text-decoration: none;
}
h1:hover {
  transform: rotate(360deg);
}

h2 {
  font-size: clamp(3rem, 1rem + 5vw, 5rem);
  line-height: 1;
  max-width: 1000px;
  margin-inline: auto;
}

h3 {
  font-size: clamp(2rem, 1rem + 3vw, 2.5rem);
}

h4 {
  font-size: clamp(0.5rem, 1rem + 3vw, 1.75rem);
  letter-spacing: 0.05em;
}

p, ul:not([class]) {
  width: 100%;
  max-width: 70ch;
  margin-inline: auto;
}

a[class] {
  text-decoration: none;
}

img {
  width: 100%;
  height: auto;
}

audio {
  width: 100%;
}

/* Base Layout */
#header {
  padding: 0.5em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.5);
}

#main {
  padding: 2em 1em;
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
}

#main-title .uno {
  display: inline-block;
  transform: rotate(5deg);
  transition: 1000ms ease-in-out;
}
#main-title:hover .uno {
  transform: rotate(730deg);
}

#footer {
  color: var(--color-dark-light);
  font-size: 16px;
  letter-spacing: 1ch;
  text-align: right;
  padding: 1em;
  background-color: rgba(255, 255, 255, 0.75);
}
#footer p {
  max-width: 100%;
}

/* Utilities */
.skew {
  background-color: var(--color-dark);
  color: var(--color-light);
  padding: 1em;
  clip-path: polygon(calc(0% + 0em) calc(100% - 0.75em), calc(100% - 0em) calc(100% - 0em), calc(100% - 0.25em) calc(0% + 1em), calc(0% + 1em) calc(0% + 0.5em));
}

.center {
  max-width: 80ch;
  margin-inline: auto;
}

.flex {
  display: flex;
}

.column {
  flex-direction: column;
}

.right {
  align-items: flex-end;
}

.gap-100 {
  gap: 0.5rem;
}

.gap-200 {
  gap: 0.75rem;
}

.space-between {
  justify-content: space-between;
}

.align-center {
  align-items: center;
}

/* Layout */
.stack > * + * {
  margin-top: var(--stack-space, 2em);
}

.grid {
  display: grid;
  grid-auto-flow: dense;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  align-items: start;
  gap: 2rem;
}

.grid-2 {
  display: grid;
  grid-auto-flow: dense;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  align-items: start;
  gap: 2rem;
}
@media (min-width: 800px) {
  .grid-2 {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  max-width: 800px;
  margin-inline: auto;
  aspect-ratio: 1;
}
.image-grid > *:not(.image-grid-a) img {
  transition: 1500ms ease;
}
.image-grid > *:not(.image-grid-a) :checked + img {
  transform: rotateX(180deg) rotateY(360deg);
}
.image-grid-a {
  animation: image-animation 5000ms;
  animation-timing-function: ease;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  grid-column: 3/13;
  grid-row: 3/13;
}
.image-grid-a img {
  transition: 2000ms ease;
}
.image-grid-a :checked + img {
  transform: rotateX(180deg) rotateY(360deg);
}
.image-grid-b {
  animation: image-movement 10000ms;
  animation-timing-function: ease;
  animation-iteration-count: infinite;
  grid-column: 1/6;
  grid-row: 1/6;
}
.image-grid-c {
  animation: image-animation 10000ms;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  -webkit-animation-delay: 500ms;
  animation-delay: 500ms;
  grid-column: 11/15;
  grid-row: 1/5;
}
.image-grid-d {
  animation: image-animation 10000ms;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  -webkit-animation-delay: 1000ms;
  animation-delay: 1000ms;
  grid-column: 11/15;
  grid-row: 6/10;
}
.image-grid-e {
  animation: image-animation 10000ms;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  -webkit-animation-delay: 2000ms;
  animation-delay: 2000ms;
  grid-column: 11/15;
  grid-row: 11/15;
}

.imageness {
  transition: 500ms ease;
  animation: image-animation 25000ms;
  animation-timing-function: ease;
  animation-iteration-count: infinite;
  animation-direction: alternate-reverse;
}
.imageness:nth-child(2n) {
  transform: rotate(2deg);
  animation-direction: alternate;
}
.imageness:nth-child(3n) {
  animation: image-animation 50000ms;
  transform: rotate(-5deg);
}
.imageness:nth-child(5n) {
  grid-column: span 2;
  grid-row: span 2;
}

/* Components */
.navigation {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  max-width: 600px;
  margin-inline: auto;
  gap: 1em;
}
.navigation a {
  background-color: var(--color-dark);
  text-decoration: none;
  color: var(--color-light);
  padding-block: 0.5em;
  padding-inline: 2.5em;
  clip-path: polygon(calc(0% + 0em) calc(100% - 0em), calc(100% - 2em) calc(100% - 0em), calc(100% - 0em) calc(0% + 0em), calc(0% + 2em) calc(0% + 0em));
  max-width: 30ch;
  transition: 500ms ease;
}
.navigation a:nth-child(even) {
  transform: rotate(-5deg);
}
.navigation a:nth-child(even):hover {
  transform: scale(1.25) rotate(5deg);
  z-index: 100;
}
.navigation a:nth-child(odd) {
  transform: rotate(5deg);
}
.navigation a:nth-child(odd):hover {
  transform: scale(1.25) rotate(-5deg);
  z-index: 100;
}

.image {
  border: 1px solid var(--color-dark);
  transform: rotate(var(--image-rotation));
  transition: 1000ms ease;
}

.image-link {
  display: inline-block;
}

.image.twisted {
  --image-rotation: 2deg;
}
.image.twisted:nth-of-type(even) {
  --image-rotation: -2deg;
}

.card {
  border: 1px solid var(--color-dark);
  transform: rotate(var(--card-rotation));
  transition: 1000ms ease;
  max-width: 500px;
  margin-inline: auto;
}
.card .content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1em;
  padding: 1em;
}
.card .banner {
  display: block;
  padding: 1.5em;
}
.card:hover {
  box-shadow: 10px 10px var(--shadow-primary), -10px -10px var(--shadow-secondary);
}
.card:nth-child(odd) {
  --card-rotation: 1deg;
  --image-rotation: 3deg;
}
.card:nth-child(odd):hover {
  --card-rotation: -2deg;
  --image-rotation: -4deg;
}
.card:nth-child(even) {
  --card-rotation: -1deg;
  --image-rotation: -3deg;
}
.card:nth-child(even):hover {
  --card-rotation: 2deg;
  --image-rotation: 4deg;
}
@media (min-width: 700px) {
  .card {
    display: flex;
    max-width: 1000px;
  }
  .card .banner {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 300px;
    padding: 1em;
  }
  .card .banner img {
    max-height: 300px;
    aspect-ratio: 1;
  }
  .card .content {
    flex-grow: 1;
    padding: 1em;
  }
}

.card.programacion {
  --image-max-width: 350px;
}

.libro {
  --stack-space: 0.25em;
  display: flex;
  gap: 1em;
  flex-direction: column;
  text-align: center;
}
.libro p {
  font-size: 18px;
  line-height: 1.2;
}
.libro img {
  order: -1;
  border: 1px solid black;
  transition: 1000ms ease;
}
.libro img:hover {
  transform: rotate(-5deg);
}
.libro:nth-child(even) img:hover {
  transform: rotate(-5deg);
}
.libro:nth-child(odd) img:hover {
  transform: rotate(5deg);
}

.p5Canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  margin: 0;
  z-index: -1;
}

@keyframes image-movement {
  0% {
    transform: translateY(0) rotate(-20deg);
  }
  30% {
    transform: translateY(100%) rotateX(180deg);
  }
  60% {
    transform: translateY(200%) rotate(1turn) rotateX(360deg) rotateY(180deg);
  }
  100% {
    transform: rotate(-20deg);
  }
}
@keyframes image-animation {
  from {
    transform: rotate(0turn);
  }
  to {
    transform: rotate(1turn) rotateX(360deg) rotateY(180deg);
  }
}