:root,
:root.light-mode {
  --action-text: #2396d1;
  --primary-text: #6a470b;
  --accent: #da7f09;
  --background: #eaebe5;
  --background-bright: #fff;
  --polaroid-dark: #000;
  --polaroid-light: #fff;
}

:root.dark-mode {
  --action-text: #2396d1;
  --primary-text: #da7f09;
  --accent: #da7f09;
  --background: #3e3e37;
  --background-bright: #191914;
  --polaroid-dark: #000;
  --polaroid-light: #a9a9a9;
}

@view-transition {
  navigation: auto;
}

::view-transition-group(root) {
  animation-duration: 0.65s;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  ::view-transition-group(root) {
    animation-duration: 0s;
  }
}

html {
  box-sizing: border-box;
}

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

html,
body {
  font-size: 18px;
  line-height: 1.3;
  color: var(--primary-text);
  font-family: "Ysabeau", Verdana, Geneva, Tahoma, sans-serif;
  font-weight: 400;
  font-style: normal;
  font-optical-sizing: auto;
}

body {
  background-color: var(--background);
}

img {
  max-width: 100%;
}

a {
  color: var(--action-text);
  text-decoration: none;
  border-bottom: 2px solid var(--action-text);
  background: transparent;
  transition: all 0.5s;

  &:hover {
    text-decoration: none;
    color: hsl(from var(--action-text) h s calc(l + 15));
    border-bottom: 2px dashed hsl(from var(--action-text) h s calc(l + 15));
  }
}

li {
  line-height: normal;
}

h1,
h2,
h3 {
  font-family: "TikTok Sans", "Ysabeau", Verdana, Geneva, Tahoma, sans-serif;
  line-height: 1.2;
  font-optical-sizing: auto;
  font-weight: 600;
  font-style: normal;
  font-variation-settings:
    "slnt" 0,
    "wdth" 100;
}

.svg-names {
  width: 575px;
  max-width: 90%;
  text-align: center;
  margin: 0 auto;

  &:hover #svgGroup {
    fill: hsl(from var(--action-text) h s calc(l + 15)) !important;
  }
}

h1 {
  margin: 0;
  padding: 0;
  font-size: 1.875rem;
  text-align: center;
  color: hsl(from var(--action-text) h s calc(l - 10));
  text-shadow:
    -3px -3px 0 var(--background-bright),
    3px -3px 0 var(--background-bright),
    -3px 3px 0 var(--background-bright),
    3px 3px 0 var(--background-bright);
}

h2 {
  font-size: 1.5rem;
  text-align: center;
  color: hsl(from var(--action-text) h s calc(l - 10));
}

h3 {
  font-size: 1.125rem;
  color: hsl(from var(--accent) h s calc(l + 5));
}

hr {
  height: 0;
  border-top: 1px solid hsl(from var(--accent) h s calc(l + 10));
  border-bottom: 1px solid hsl(from var(--accent) h s calc(l - 5));
}

::selection {
  background: hsl(from var(--action-text) h s calc(l + 20));
  color: var(--primary-text);
  text-shadow: 2px 1px 0
    color-mix(in srgb, var(--background-bright) 50%, transparent);
}

strong {
  font-weight: 700;
}

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

.contents-wrapper {
  margin: 1.875rem auto 0 auto;
  min-height: 18.75rem;
  background-color: color-mix(
    in srgb,
    var(--background-bright) 75%,
    transparent
  );
  border-radius: 5px;
  border: 5px solid var(--background-bright);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
  padding: 5px;
}

.navigation {
  margin: 0 auto;
  padding: 0;
  text-align: center;
  list-style: none;
  width: 17.1875rem;

  ul {
    padding: 0;
  }

  & li {
    display: inline-block;
    list-style: none;
  }

  & li + li {
    margin-left: 1.125rem;
  }

  a,
  a:hover {
    color: var(--action-text);
  }

  a > .active {
    border-bottom: 2px solid hsl(from var(--action-text) h s calc(l + 20));
    font-weight: bold;
  }

  a[aria-current="page"] {
    cursor: default;
  }
}

a.highlighter {
  transition: none;
}

a.highlighter:hover,
a.highlighter:focus {
  color: var(--primary-text);
  border-bottom: 1px solid transparent;
  background: repeat-x center/100% url("/assets/highlight.svg");
  margin: -5px -11px -5px -7px;
  padding: 5px 11px 5px 7px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.dark-mode a.highlighter:hover,
.dark-mode a.highlighter:focus {
  background: repeat-x center/100% url("/assets/highlight-dark.svg");
}

.polaroid {
  padding: 2rem;
  padding-bottom: 3rem;
  background: var(--polaroid-light);
  background: linear-gradient(
    135deg,
    var(--polaroid-light),
    hsl(from var(--polaroid-light) h s calc(l - 7)) 67%
  );
  transform: rotate(5deg);
  display: block;
  width: calc(500px + 0.5rem); /* img width + img border */
  max-width: 85%;
  margin: 2rem auto;
  box-shadow:
    1px -1px 10px 0px color-mix(in srgb, var(--polaroid-dark) 60%, transparent),
    inset 2px 2px 5px 0
      color-mix(in srgb, var(--polaroid-dark) 10%, transparent);
  font-family:
    "Comic Sans MS", "Comic Sans", "Ysabeau", Verdana, Geneva, Tahoma,
    sans-serif;
  font-style: italic;
  text-align: center;
  text-transform: uppercase;
  transition: all 0.5s ease-in-out;
}

.polaroid .image {
  width: 480px;
  height: auto !important;
  object-position: center;
  object-fit: scale-down;
  border: 0.25rem solid hsl(from var(--polaroid-dark) h s calc(l + 25));
  transition: all 0.5s ease-in-out;
}

.polaroid figcaption {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--polaroid-dark);
  transition: margin 0.5s ease-in-out;
}

.polaroid:hover {
  transform: rotate(0deg);
  padding: 0;
  box-shadow: none;
  background: transparent;
  padding-bottom: 1rem;
}

.polaroid:hover .image {
  width: 552px;
  border: 0.25rem solid transparent;
}

.polaroid:hover figcaption {
  margin-top: 0;
}

.dark-mode .polaroid:hover figcaption {
  color: var(--polaroid-light);
}

@media (prefers-reduced-motion: reduce) {
  .polaroid {
    transform: rotate(0deg);
    transition: none;
    padding: 2rem;
  }

  .polaroid .image {
    transition: none;
  }

  .polaroid .figcaption {
    transition: none;
  }

  .polaroid:hover {
    transform: rotate(0deg);
    padding: 2rem;
    background: var(--polaroid-light);
    background: linear-gradient(
      135deg,
      var(--polaroid-light),
      hsl(from var(--polaroid-light) h s calc(l - 7)) 67%
    );
    box-shadow:
      1px -1px 10px 0px
        color-mix(in srgb, var(--polaroid-dark) 60%, transparent),
      inset 2px 2px 5px 0
        color-mix(in srgb, var(--polaroid-dark) 10%, transparent);
  }

  .polaroid:hover .image {
    width: 480px;
    border: 0.25rem solid hsl(from var(--polaroid-dark) h s calc(l + 25));
  }

  .polaroid:hover figcaption {
    margin-top: 1rem;
  }
}

.project {
  position: relative;
}

.project strong {
  text-transform: uppercase;
}

.project + .project {
  margin-top: 2rem;
}

.project-links {
  position: absolute;
  top: 0;
  right: 0;
}

.project-description {
  margin-top: 0.25rem;
  padding-left: 0.75rem;
  border-left: 5px dotted var(--background);
  text-align: justify;
}

footer {
  margin: 1rem 0;
  text-align: center;
}

.button {
  --width: 250px;
  --timing: 2s;
  --button-text: #ccc;
  --button-text-hover: #fff;
  --button-background: #333;
  --button-border: #999;
  --button-border-hover: #999;
  --button-color-1: #222;
  --button-color-2: #444;
  --button-color-3: #555;
  --button-color-4: #666;
  --button-color-5: #777;
  --button-color-6: #999;
  border: 2px solid var(--button-border);
  width: var(--width);
  padding-block: 0.25rem;
  color: var(--button-text);
  font-weight: bold;
  font-size: 1rem;
  background: var(--button-background);
  transition: all 0.2s;
  border-radius: 10rem;
  cursor: pointer;
  display: inline-block;
  text-align: center;
}

a.button {
  text-decoration: none;
  --width: 125px;
}

.button.rainbow {
  --button-text: #fff;
  --button-text-hover: #fff;
  --button-background: #2396d1;
  --button-color-1: rgb(250, 82, 82);
  --button-color-2: rgb(190, 75, 219);
  --button-color-3: rgb(76, 110, 245);
  --button-color-4: rgb(64, 192, 87);
  --button-color-5: rgb(250, 176, 5);
  --button-color-6: rgb(253, 126, 20);
  border: 2px solid transparent;
  background: var(--button-background);
}

.button:hover {
  color: var(--button-text-hover);
  border-color: var(0--button-border-hover);
  background-image: linear-gradient(
    to right,
    var(--button-color-1),
    var(--button-color-1) 16.65%,
    var(--button-color-2) 16.65%,
    var(--button-color-2) 33.3%,
    var(--button-color-3) 33.3%,
    var(--button-color-3) 49.95%,
    var(--button-color-4) 49.95%,
    var(--button-color-4) 66.6%,
    var(--button-color-5) 66.6%,
    var(--button-color-5) 83.25%,
    var(--button-color-6) 83.25%,
    var(--button-color-6) 100%,
    var(--button-color-1) 100%
  );
  animation: var(--timing) linear dance infinite;
  transform: scale(1.1) translateY(-1px);
}

@keyframes dance {
  to {
    background-position: var(--width);
  }
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }

  .button:hover,
  .button.rainbow:hover {
    animation: none;
    transform: none;
    background-image: none;
    background-color: var(--button-color-6);
  }
}

.links {
  list-style: none;
  text-align: center;
  margin: 0;
  padding: 0;
}

.links li + li {
  margin-top: 0.33rem;
}

.links li > span {
  display: block;
  margin-bottom: 1rem;
}

.links .separator,
.links .break {
  display: none;
}

.extra-description {
  display: none;
}

.content-404 {
  margin: 0 auto 3rem auto;
  position: relative;
}

.content-404 .image {
  max-width: 100%;
  height: auto !important;
}

.content-404 .caption {
  position: absolute;
  top: calc(100% - 3rem);
  right: 12%;
  bottom: 1rem;
  left: 12%;
  font-size: 1rem;
  font-weight: bold;
  font-family: "Helvetica Neue", Helvetica, Arial, serif;
  color: var(--polaroid-light);
  -webkit-text-stroke: 2px var(--polaroid-dark);
  text-align: center;
  text-transform: uppercase;
  width: 76%;
  height: 3.25rem;
  line-height: 1.15;
}

@media (min-width: 568px) {
  html,
  body {
    font-size: 24px;
  }

  h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.7rem;
  }

  .page-wrapper {
    width: 80%;
    max-width: 42rem;
    margin: 2rem auto;
  }

  .contents-wrapper {
    padding: 6px 24px;
  }

  .navigation ul li + li {
    margin-left: 1rem;
  }

  .content-404 {
    margin-bottom: 1.67rem;
  }
}

@media (min-width: 668px) {
  .navigation {
    width: 100%;
  }

  .links {
    text-align: left;
  }

  .links li > span {
    display: inline;
    margin-bottom: 0;
  }

  .links .separator {
    display: inline;
    font-weight: bold;
    color: var(--accent);
    font-size: 1.25rem;
    padding: 0 0.25rem;
  }

  .links .button:hover + span .separator {
    color: var(--action-text);
  }

  .links .break {
    display: inline-block;
    padding-left: 168px;
  }
}

@media (min-width: 768px) {
  .svg-names {
    transition: width 0.5s;
    max-width: none;

    &:hover {
      /* initial width = 575px * scale of 1.1 below + 48px left-margin of 2nd svg*/
      width: 681px;
    }

    svg,
    #svgGroup {
      transition: all 0.5s;
    }
    &:hover svg {
      transform: scale(1.1);
    }

    &:hover svg:first-of-type {
      animation: wobble1 0.35s infinite 0.75s;
    }

    &:hover svg:last-of-type {
      animation: wobble2 0.35s infinite 0.75s;
    }

    &:hover svg + svg {
      margin-left: 48px;
    }
  }

  @keyframes wobble1 {
    0% {
      transform: translate(0, 0) rotate(0deg);
    }
    25% {
      transform: translate(5px, 5px) rotate(5deg);
    }
    50% {
      transform: translate(0, 0) rotate(0deg);
    }
    75% {
      transform: translate(-5px, 5px) rotate(-5deg);
    }
    100% {
      transform: translate(0, 0) rotate(0deg);
    }
  }

  @keyframes wobble2 {
    0% {
      transform: translate(5px, 5px) rotate(5deg);
    }
    25% {
      transform: translate(0, 0) rotate(0deg);
    }
    50% {
      transform: translate(-5px, 5px) rotate(-5deg);
    }
    75% {
      transform: translate(0, 0) rotate(0deg);
    }
    100% {
      transform: translate(5px, 5px) rotate(5deg);
    }
  }

  span.extra-description {
    display: inline;
  }
  div.extra-description {
    display: block;
    padding-left: 168px;
  }

  .content-404 .caption {
    font-size: 1.25rem;
  }

  .content-404 .caption {
    top: calc(100% - 4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .svg-names {
    transition: none;

    &:hover {
      width: 575px;
    }

    svg,
    #svgGroup {
      transition: none;
    }

    &:hover svg {
      transform: none;
    }

    &:hover svg + svg {
      margin-left: 0;
    }

    &:hover svg:first-of-type {
      animation: none;
    }

    &:hover svg:last-of-type {
      animation: none;
    }
  }
}

@media (min-width: 1024px) {
  .content-404 .caption {
    font-size: 1.5rem;
    top: calc(100% - 5rem);
    -webkit-text-stroke: 3px var(--polaroid-dark);
  }
}
