@layer pico, theme, base, components, resume;

@import url("https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible+Next:ital,wght@0,200..800;1,200..800&family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap");
@import url("https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css")
layer(pico);

@import url("./resume.css") layer(resume);

@layer theme {
  :root {
    --pico-font-family-sans-serif: "Atkinson Hyperlegible Next", "Segoe UI",
      Roboto, Oxygen, Ubuntu, Cantarell, Helvetica, Arial, "Helvetica Neue",
      sans-serif, var(--pico-font-family-emoji);
  }
}

@layer base {
  html {
    width: 100%;
  }
  body {
    width: 100%;
    max-width: 80ch;
  }

  @view-transition {
    navigation: auto;
  }

  main {
    padding: 0 5%;
  }

  /* Fluid images via https://www.zachleat.com/web/fluid-images/ */
  img {
    max-width: 100%;
  }
  img[width][height] {
    height: auto;
  }
  img[src$=".svg"] {
    width: 100%;
    height: auto;
    max-width: none;
  }
  video,
  iframe {
    width: 100%;
    height: auto;
  }
  iframe {
    aspect-ratio: 16/9;
  }
  /* -- Fluid Images */

  header {
    border-bottom: 1px dashed var(--color-gray-20);
  }

  footer {
    padding: 1rem;
  }

  .home-link {
    flex-grow: 1;
    font-size: 1em;
    font-weight: 700;
  }

  .home-link:link:not(:hover) {
    text-decoration: none !important;
  }
}

@layer components {
  /* https://www.a11yproject.com/posts/how-to-hide-content/ */
  .visually-hidden {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
  }

  .site-header {
    padding: 1rem 1rem;
    flex-wrap: wrap;
  }

  .links-nextprev {
    display: flex;
    justify-content: space-between;
    gap: 0.5em 1em;
    border-top: 1px dashed var(--color-gray-20);
    padding: 1em 0;
  }
  .links-nextprev > * {
    flex-grow: 1;
    list-style: none;
  }
  .links-nextprev-next {
    text-align: right;
  }

  /* Nav */
  .nav {
    display: flex;
    gap: 0.5em 1em;
    padding: 0;
    margin: 0;
    list-style: none;
  }
  .nav-item {
    display: inline-block;
  }
  .nav-item a[href]:not(:hover) {
    text-decoration: none;
  }
  .nav a[href][aria-current="page"] {
    text-decoration: underline;
  }

  /* Posts list */
  .postlist {
    list-style: none;
    padding: 0;
    padding-left: 1.5rem;
  }
  .postlist-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    counter-increment: start-from -1;
    margin-bottom: 1em;
  }
  .postlist-item:before {
    display: inline-block;
    pointer-events: none;
    content: "" counter(start-from, decimal-leading-zero) ". ";
    line-height: 100%;
    text-align: right;
    margin-left: -1.5rem;
  }
  .postlist-date,
  .postlist-item:before {
    font-size: 0.8125em; /* 13px /16 */
    color: var(--color-gray-90);
  }
  .postlist-date {
    word-spacing: -0.5px;
  }
  .postlist-link {
    font-size: 1.1875em; /* 19px /16 */
    font-weight: 700;
    flex-basis: calc(100% - 1.5rem);
    padding-left: 0.25em;
    padding-right: 0.5em;
    text-underline-position: from-font;
    text-underline-offset: 0;
    text-decoration-thickness: 1px;
  }
  .postlist-item-active .postlist-link {
    font-weight: bold;
  }

  /* Tags */
  .post-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-style: italic;
  }
  .postlist-item > .post-tag {
    align-self: center;
  }

  /* Tags list */
  .post-metadata {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5em;
    list-style: none !important;
    padding: 0;
    margin: 0;
  }
  .post-metadata time {
    margin-right: 1em;
  }

  .post-metadata li {
    list-style: none;
  }
}
