@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

:root {
  --bg: #F8F8F8;
  --text: #2E2926;
  --tint1: #748873;
  --tint2: #E5E0D8;

  --gap: 8px;
  --sw: 0px;
  --font-size: 16px;

  --width: 90vw;
  --shadow: #00000020;
  --column: #ffffff7f;
  --shadow-margin: var(--gap);
  --shadow-width: calc(var(--gap) * 3); 

  --header-flex: row;

}

* { box-sizing: border-box;}

@media (max-width: 1023px) { /* can't user css variables in media queries */
  :root {
    --width: 100%;
  }
}

@media (max-width: 767px) {
  :root {
    --header-flex: column;
  }
  header > nav { margin: 0 0 .5rem 0 !important }
}

body {


  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

--neg: calc((50vw - var(--sw)) - (var(--width) / 2) - var(--shadow-margin));
--pos: calc((50vw - var(--sw)) + (var(--width) / 2) + var(--shadow-margin));

  background-color: var(--bg);
  color: var(--text);
  font-size: var(--font-size);
  margin: 0;
}

.site-nav {
  margin: 0 0 1rem 0;
  background-color: #748873;
  display: flex;
  align-items: center;
  color: white;
  ul {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    &:last-of-type,
    &:first-of-type {
      flex-grow: 0;
      white-space: nowrap;
    }
    &:last-of-type li {
      margin-right: 10px;
    }
  }
  ul, li { padding:0;margin:0;list-style-type:none;text-indent:0;}
  img {
    height: 2rem;
    margin: 10px;
  }
  a {
    color: inherit;
    text-decoration: none;
    border: 1px solid #ffffff20;
    background-color: transparent;
    transition: background-color .3s ease;
    padding: .5rem 1.5rem;
    border-radius: 2rem;
    &.active,
    &:hover {
      background-color: white;
      color: black;
    }
  }
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.tile {
  background: #DCD7C9;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s;
}

.tile:hover {
  transform: scale(1.02);
}

.tile img {
  width: 100%;
  display: block;
}

.tile figcaption {
  padding: 1rem;
  font-size: 1.25rem;
  font-weight: bold;
}

.breadcrumb {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 1rem;
}
.breadcrumb a {
  color: #0077cc;
  text-decoration: none;
}
.breadcrumb a:hover {
  text-decoration: underline;
}

a[download] {
  padding: .5rem 1.5rem;
  border-radius: 2rem;
  color: white;
  background-color: var(--tint1);
  border: 2px solid var(--tint1);
  transition: border .3s ease;
  text-decoration: none;
  display: inline-block;
  margin: 3rem auto;
  &:hover {
    border-color: var(--tint2);
  }
}
p:has(> a[download]) {
  text-align: center;
}


main {
  width: min(90%, 100ch);
  margin: 0 auto;
  padding: 1rem;
}

small > img {
  width: 50%;
  margin: 0 auto;
  box-shadow: 0 1rem 2rem var(--shadow);
}

footer {
  font-family: "Playfair Display", serif;
  font-optical-sizing: auto;
  font-weight: 300;
  font-style: normal;
  &:not(:empty) {
    text-align: center;
    border-top: 1px dashed var(--tint2);
  }
  a[href]:not(:last-of-type)::after {
    content: '-';
    text-decoration: none;
    display: inline-block;
    color: var(--text);
    opacity: 0.5;
    margin: 0 .25rem;
  }
}

main, article {
  font-family: "Source Sans 3", sans-serif;
  font-optical-sizing: auto;
  font-style: normal;
  > table {
    margin: 0 auto;
    background-color: white;
    border-collapse: collapse;
    border: 1px solid var(--tint1);
    thead tr {
      background-color: var(--tint2);
    }
    tbody {
      th, td {
        padding: .5rem;
        border: 1px solid var(--tint1);
      }
    }
  }
}

article {
  padding: var(--gap);
}

code {
  border: 1px solid var(--tint2);
  border-radius: var(--gap);
  overflow-x: auto;
}
p > code, li > code {
  border-radius: unset;
  background-color: #00000010;
  padding-left: .25rem;
  padding-right: .25rem;
  font-size: inherit;
  font-family: inherit;
}
img[src*='center'] { /* e.g. path.jpg#center */
  display: block;
  margin: 0 auto;
}
pre code.hljs {
  font-size: 0.9rem;
}
.article-body img:not([src*='#']) {
  max-width: 100%;
}
.img-zoom-container {
  border: 1px solid #00000010;
}
.img-zoom-container img {
  pointer-events: all;
  user-select: none;
}
/* img.natural {
  max-width: none;
  max-height: none;
} */

.gh-repo {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  width: 40px;
  img { max-width: 100%; }
}

.copy-btn {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  background: none;
  border: none;
  font-size: 1em;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
.copy-btn:hover {
  opacity: 1;
}
.pre-wrapper {
  position: relative;
}

/* .home nav {
  display: flex;
  flex-wrap: wrap;
  margin: 1rem 0;
  padding: 1rem;
  gap: 2rem;
  >* {
    flex: 0 1 30%;
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    background: white;
    box-shadow: 0 1rem 1rem var(--shadow);
    border-radius: 3px;
    > figure {
      display: flex;
      flex-direction: column;
      img {
        width: 100%;
        object-fit: cover;
        object-position: top left;
        aspect-ratio: 8 / 5;
      }
      height: 100%;
      > figcaption {
        flex: 1;
        text-align: center;
        line-height: 3rem;
        text-decoration: none;
        color: var(--text);
      }
    }
  } 
} */

nav.tabs {
  margin-top: 1rem;
  display: flex;
  flex-direction: row;
  position: relative;
  align-items: center;
  a {
    --edge: var(--tint2);
    --bottom: var(--tint1);
    display: block;
    text-decoration: none;
    padding: 0;
    &.active span {
      --edge: var(--tint1);
      --bottom: transparent;
      background: transparent;
      border-radius: 5px 5px 0 0;
    }
    > span {
      border: 1px solid var(--edge);
      border-bottom-color: var(--bottom);
      background: linear-gradient(to bottom, transparent 70%, #00000010);;
      padding: .5rem 1.5rem;
      border-radius: 5px 16px 0 0;
      display: inline-block;
    }
    &::before {
      content: '\00A0';
      padding: .5rem .25rem;
      border-bottom: 1px solid var(--tint1);
    }
    &:last-child {
      flex: 1;
      width: 100%;
      padding: .5rem 2rem;
      border-bottom: 1px solid var(--tint1);
    }
  }
}
