@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap");
@import url("checkbox.css");

/*
  Reset CSS from https://www.joshwcomeau.com/css/custom-css-reset/
*/

*,
*::after,
*::before {
  box-sizing: border-box;
}
* {
  margin: 0;
}
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
canvas,
img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
}
button,
input,
select,
textarea {
  font: inherit;
}
h1,
h2,
h3,
h4,
h5,
h6,
p {
  overflow-wrap: break-word;
}
p {
  text-wrap: pretty;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}
#__next,
#root {
  isolation: isolate;
}

/*
  Actual CSS
*/

:root {
  --border-radius: 1ex;
  --shadow-size: var(--border-radius);
  --shadow-color: rgba(0, 0, 0, 0.1);
  --spacing: 4rem;
  --color-hr: #ccc;
  --color-text: #333;
  --content-padding: 3ex;
  --header-grid: 1fr 3fr;
  --main-padding: 5rem;

  --background: linear-gradient(120deg, #ffcfcf, #7ec7e4);
  --main-background: white;
  --main-border: #f0f0f0;
  --color-link: black;
  --inner-shadow-color: #ddd;
}

@media (max-width: 680px) {
  :root {
    --border-radius: 0.5ex;
    --content-padding: 1ex;
    --header-grid: 1fr;
    --main-padding: 2rem;
  }
}

html {
  background: var(--background);
  font-family: "Montserrat", sans-serif;
  font-size: clamp(11pt, 3.5vw, 14pt);
}
html,
body {
  min-height: 100vh;
  padding: var(--content-padding);
}

html:has(body.allow-transitions),
body.allow-transitions,
body.allow-transitions main,
body.allow-transitions article {
  transition: background .5s, color 1s;
}

main {
  margin: 0 auto 0 auto;
  max-width: 900px;
  background-color: var(--main-background);
  border-radius: var(--border-radius);
  box-shadow: 0em 0em var(--shadow-size) var(--shadow-color);
  border: 1px solid var(--main-border);
  padding: var(--main-padding);
  position: relative;
}

header {
  display: grid;
  justify-items: center;
  grid-template-columns: var(--header-grid);
  padding-bottom: var(--spacing);
  border-bottom: 1px solid var(--color-hr);
  margin-bottom: var(--spacing);
  text-shadow: 0 0 1ex rgba(0, 0, 0, 0.15);

  img {
    border-radius: 50%;
    grid-row-start: 1;
    grid-column: 1;
    grid-row-end: 4;
    max-height: 100%;
    max-width: clamp(100px, 150px, 100%);
    overflow: hidden;
    padding: .5ex;
    background-color: var(--main-background);
    box-shadow: 0 0 3ex var(--inner-shadow-color);
  }

  h1,
  h2,
  h3 {
    text-align: center;
    color: var(--color-text);
  }

  h1 {
    text-transform: uppercase;
    font-size: 200%;
    letter-spacing: 0.3ex;
    font-weight: 300;

    &:after {
      content: "";
      display: block;
      width: 2rem;
      height: 1px;
      background-color: var(--color-hr);
      margin: 0.5em auto;
    }
  }
  h2 {
    font-size: 100%;
    font-weight: 600;
    letter-spacing: 0.4ex;
    opacity: 0.8;
  }
  h3 {
    font-size: 100%;
    font-weight: 300;
    letter-spacing: 0.5ex;
  }
}

article {
  color: var(--color-text);
  text-align: justify;
  
  p {
    margin-bottom: calc(var(--spacing) / 3);
    line-height: 1.7;
    font-weight: 400;
    hyphens: auto;
    text-shadow: 0 0 0.2ex rgba(0, 0, 0, 0.1);
  }

  a {
    color: var(--color-link);

    &:hover {
      text-decoration: none;
    }
  }
  h4 {
    margin: 4ex 0 2ex 0;
  }
  ul {
    padding-left: 1.6em;
    list-style-type: none;
    text-align: left;
    li {
      margin-bottom: 0.5em;
    }
    li:first-letter {
      margin-left: -1.6em;
    }
    a {
      font-weight: bold;
      opacity: .8;
    }
  }
}

footer {
  border-top: 1px solid var(--color-hr);
  padding-top: var(--spacing);
  margin-top: var(--spacing);
  text-align: center;
  font-size: 80%;
  color: var(--color-text);
  display: flex;
  justify-content: center;

  > a {
    --icon-margin: 2.5em;
    --icon-pos: calc(var(--icon-margin) / 2);
    --icon-size: 64px;

    width: var(--icon-size);
    height: var(--icon-size);
    border: 1px solid;
    border-radius: 50%;
    margin: 0 1rem;

    span {
      display: none;
    }
    background-size: calc(100% - var(--icon-margin));
    background-repeat: no-repeat;
    background-position: var(--icon-pos) var(--icon-pos);
    opacity: 0.5;
    filter: contrast(0);
    line-height: 0;

    &.link-x {
      color: #00aaec;
      background-image: url(twitter.svg);
    }

    &.link-gh {
      color: black;
      background-image: url(github.svg);
    }

    &.link-in {
      color: #007ebb;
      background-image: url(linkedin.svg);
    }

    &.link-bsk {
      color: #1185fe;
      background-image: url(bluesky.svg);
    }

    &:hover {
      opacity: 1;
      filter: none;
    }
  }
}

:root {
  --intensify-size: 3px;
  --intensify-size-neg: calc(0 - var(--intensify-size));
}

@media (min-width: 900px) {
  a:has(> img) {
    &:hover {
      &:after,
      &:before {
        content: "💥 💥 ";
        opacity: 0.4;
        position: absolute;
        top: 51px;
        left: 45px;
      }
      &:before {
        transform: flipX(180deg);
      }
      animation: intensifies 0.1s infinite;
    }
  }
}

@keyframes intensifies {
  0% {
    transform: translate(var(--intensify-size), 0);
  }
  25% {
    transform: translate(var(--intensify-size-neg), 0);
  }
  50% {
    transform: translate(0, var(--intensify-size));
  }
  75% {
    transform: translate(0, var(--intensify-size-neg));
  }
  100% {
    transform: translate(var(--intensify-size), 0);
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-hr: #555;
    --color-text: #ddd;
    --shadow-color: rgba(0, 0, 0, 0.8);
    --color-link: white;
    --background: linear-gradient(120deg, #2c3e50, #4ca1af);
    --main-background: #333;
    --main-border: #444;
    --inner-shadow-color: #555;
  }

  footer {
    a:hover {
      background-color: #aaaaaa;
    }
  }
}

html:has(body.dark-mode) {
  --color-hr: #555;
  --color-text: #ddd;
  --shadow-color: rgba(0, 0, 0, 0.8);
  --color-link: white;
  --background: linear-gradient(120deg, #2c3e50, #4ca1af);
  --main-background: #333;
  --main-border: #444;
  --inner-shadow-color: #555;

  footer {
    a:hover {
      background-color: #aaaaaa;
    }
  }
}

html:has(body.light-mode) {
  --shadow-color: rgba(0, 0, 0, 0.1);
  --color-hr: #ccc;
  --color-text: #333;

  --background: linear-gradient(120deg, #ffcfcf, #7ec7e4);
  --main-background: white;
  --main-border: #f0f0f0;
  --color-link: black;
  --inner-shadow-color: #ddd;

  footer {
    a:hover {
      background-color: #fff;
    }
  }
}

