html {
  overflow-y: scroll;
}

html,
body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
}

main {
  position: relative;
  flex: 1 0 auto;
}

body > header,
body > main,
body > footer {
  --pico-block-spacing-vertical: clamp(2rem, 5vw, 4rem);
}

@media (min-width: 1200px) {
  body > header,
  body > main,
  body > footer {
    max-width: 1130px;
  }
}

body > main > h1,
body > main > header {
  margin-bottom: 3rem;
  text-align: center;
}

body > main > header > h1 {
  margin-bottom: 0.75rem;
}

body > main > header > p {
  margin-bottom: 0;
}

article {
  --pico-block-spacing-horizontal: clamp(1rem, 2.5vw, 2rem);
}

a {
  --pico-text-decoration: none;
}

.download-link {
  --icon-size: 1em;

  display: inline-flex;
  align-items: center;
  gap: 0.375em;
}

h4,
h5,
h6 {
  --pico-color: var(--pico-h3-color);
}

.cv-section > h2 {
  margin-bottom: 2.625rem;
}

.cv-entry {
  margin-bottom: 2.5rem;
}

.cv-entry:last-child {
  margin-bottom: 0;
}

.cv-entry > h3 {
  --pico-font-size: 1.125rem;

  margin-bottom: 0.75rem;
}

.cv-entry > h3:has(a) {
  padding-inline-end: calc(var(--icon-size) + 0.25em);
}

.cv-entry > :where(h3) > a {
  position: absolute;
  margin-inline-start: 0.25em;
  margin-top: 0.15em;
}

.cv-entry > p {
  margin-bottom: 0.5rem;
}

.cv-entry > p:last-child {
  margin-bottom: 0;
}

figure {
  border-radius: 1rem;
  background-color: #fff;
  padding: 1rem;
}

.theme-transistion {
  transition:
    color var(--transition-speed),
    background-color var(--transition-speed);
}

.site-home > main > div {
  display: flex;
  margin: auto;
  min-height: 150px;
  max-width: 150px;
  height: 100%;
  background-image: var(--avatar);
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}

.site-404 main > .fa {
  background-color: var(--not-found-background-color);
  opacity: var(--not-found-background-opacity);
  position: relative;
  display: flex;
  margin: auto;
  min-height: 150px;
  max-width: 250px;
  height: 100%;
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-position: center;
  -webkit-mask-position: center;
}

.site-404 main > h1 {
  --pico-font-size: 1.5rem;

  position: absolute;
  top: 50%;
  width: 100%;
  text-align: center;
}

.site-footer {
  flex-shrink: 0;
}

.social-nav a {
  cursor: pointer;
  display: block;
  margin: 1rem;
}

.site-nav {
  --icon-size: clamp(0.875rem, 3vw, 1.2rem);
  --pico-nav-element-spacing-horizontal: clamp(0.25rem, 1vw, 0.5rem);

  justify-content: center;
}

.site-nav a {
  font-size: var(--icon-size);
  white-space: nowrap;
  user-select: none;
  margin-right: clamp(0rem, calc(4vw - 1rem), 0.8rem);
}

.site-title a,
.site-title a:is(:hover, :active, :focus) {
  text-decoration: none;
}

dialog article.email > a {
  cursor: pointer;
}

.article-grid > article > header > a {
  margin-top: auto;
  display: block;
}

.site-nav li.active a {
  color: var(--accent);
}

.site-nav span.fa {
  display: inline-block;
  margin-right: calc(0.2 * var(--icon-size));
  margin-bottom: -2px;
}

.site-nav li.active span.fa {
  background-color: var(--accent);
}

.site-nav span {
  cursor: pointer;
}

.site-header,
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-title {
  --pico-color: var(--accent);
  --parent-color: var(--pico-color);

  margin-bottom: 3rem;
  font-weight: 200;
  text-transform: lowercase;
}

.site-title::before {
  content: '{';
}

.site-title::after {
  content: '}';
}

.site-title span::after {
  color: var(--parent-color);
  margin-left: 1rem;
  content: '|';
}

.article-grid {
  /* https://css-tricks.com/an-auto-filling-css-grid-with-max-columns/ */
  --grid-layout-gap: 1rem;
  --grid-column-count: 3;
  --grid-item-min-width: 250px;
  --gap-count: calc(var(--grid-column-count) - 1);
  --total-gap-width: calc(var(--gap-count) * var(--grid-layout-gap));
  --grid-item-max-width: calc(
    (100% - var(--total-gap-width)) /
    var(--grid-column-count)
  );

  display: grid;
  grid-template-columns: repeat(
      auto-fill,
      minmax(max(var(--grid-item-min-width), var(--grid-item-max-width)), 1fr)
    );
  grid-gap: var(--grid-layout-gap);
}

.article-grid > article {
  display: flex;
  flex-direction: column;
  margin-top: 0;
  margin-bottom: 0;
}

.article-grid > article > header {
  --icon-size: 0.8rem;

  min-height: 13rem;
  display: flex;
  flex-direction: column;
}

.article-grid > article > footer {
  margin-top: auto;
}

dialog article.email {
  display: flex;
  align-items: center;
  width: auto;
}

dialog article.email > p {
  margin: 0 1rem;
  overflow-wrap: anywhere;
}
