:root {
  --preset--color--base: #fff;
  --preset--color--accent: #0096c4;
  --preset--color--contrast: #0b0b0d;
  --preset--color--muted: #57575e;
  --preset--color--rule: #b9b9bf71;
  --preset--color--neutral-lightest: #ededed;

  --preset--color-default: #373530;
  --preset--color-default-background: #ffffff;
  --preset--color-gray: #787774;
  --preset--color-gray-background: #f1f1ef;
  --preset--color-brown: #976d57;
  --preset--color-brown-background: #f3eeee;
  --preset--color-orange: #cc782f;
  --preset--color-orange-background: #f8ecdf;
  --preset--color-yellow: #c29343;
  --preset--color-yellow-background: #faf3dd;
  --preset--color-green: #548164;
  --preset--color-green-background: #eef3ed;
  --preset--color-blue: #487ca5;
  --preset--color-blue-background: #e9f3f7;
  --preset--color-purple: #8a67ab;
  --preset--color-purple-background: #f6f3f8;
  --preset--color-pink: #b35488;
  --preset--color-pink-background: #f9f2f5;
  --preset--color-red: #c4554d;
  --preset--color-red-background: #faecec;
  --preset--font--serif: Georgia, "Times New Roman", serif;
  --preset--font--mono: ui-monospace;
  --preset--font--sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --preset--spacing--small: 0.5rem;
  --preset--spacing--medium: 1rem;
  --preset--spacing--large: 3rem;

  --preset--layout--container--padding-x: 1rem;
  --preset--layout--container--width: 790px;
  --preset--layout--container--block-spacing: 1rem;

  @media (prefers-color-scheme: dark) {
  --preset--color--base: #141414;
  --preset--color--accent: #47bbff;
  --preset--color--contrast: #e3e3e4;
  --preset--color--muted: #d4d4d4;
  --preset--color--rule: #cccccc6e;
  --preset--color--neutral-lightest: #303030;

  --preset--color--default: #d4d4d4;
  --preset--color--default-background: #191919;
  --preset--color--gray: #9b9b9b;
  --preset--color--gray-background: #252525;
  --preset--color--brown: #a27763;
  --preset--color--brown-background: #2e2724;
  --preset--color--orange: #cb7b37;
  --preset--color--orange-background: #36291f;
  --preset--color--yellow: #c19138;
  --preset--color--yellow-background: #372e20;
  --preset--color--green: #4f9768;
  --preset--color--green-background: #242b26;
  --preset--color--blue: #447acb;
  --preset--color--blue-background: #1f282d;
  --preset--color--purple: #865dbb;
  --preset--color--purple-background: #2a2430;
  --preset--color--pink: #ba4a78;
  --preset--color--pink-background: #2e2328;
  --preset--color--red: #be524b;
  --preset--color--red-background: #332523;
  }
}

* {
  box-sizing: border-box;
}

html {
  color: var(--preset--color--contrast);
  background: var(--preset--color--base);
  font-family: var(--preset--font--sans);
  font-size: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

body {
  margin: 0;
  padding-bottom: env(safe-area-inset-bottom);
  padding-top: env(safe-area-inset-top);
}

html, body, p, ol, ul, li, dl, dt, dd, blockquote, figure, fieldset, form, legend, textarea, pre, iframe, hr, h1, h2, h3, h4, h5, h6 {
  padding: 0;
  margin: 0;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
}

figure {
  margin:0;
}
video {
  width: 100%;
  aspect-ratio: 16/9;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;

  &:hover,
  &:focus-visible,
  &[aria-current="page"] {
    color: var(--preset--color--accent);
  }

  &.hide-link-style {
    text-decoration: none;
  }
}

img {
  max-width: 100%;
  height: auto;
}

.has-global-padding {
  width: 100%;
  padding-left: max( var(--preset--layout--container--padding-x), env(safe-area-inset-left) );
  padding-right: max( var(--preset--layout--container--padding-x), env(safe-area-inset-right) );
  & > * {
    width: 100%;
    margin-inline: auto;
    max-width: var(--preset--layout--container--width);
  }
  .alignfull {
    margin-left: calc( -1 * var(--preset--layout--container--padding-x) );
    margin-right: calc( -1 * var(--preset--layout--container--padding-x) );
    max-width: unset;
  }
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2;
  padding: 0.5rem 0.75rem;
  background: var(--preset--color--contrast);
  color: #fff;
  transform: translateY(-200%);

  &:focus {
    transform: none;
  }
}

body > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 5.5rem;
  border-bottom: 1px solid var(--preset--color--rule);

  nav {
    display: flex;
    gap: clamp(1.25rem, 4vw, 3rem);
  }
  
  nav a {
    text-decoration: none;
  }

  .wordmark {
    font-size: 1.25rem;
    font-weight: 750;
    text-decoration: none;
  }
}

body > main {
  mark {
    padding: 3px;
    border-radius: 5px;
  }

  article > * {
    margin-block-start: var(--preset--layout--container--block-spacing);
    line-height: 1.7;
  }

  :where( h1, h2, h3, h4, h5, h6 ) {
    font-family: var(--preset--font--serif);
    font-weight: 500;
    letter-spacing: -0.2px;
    line-height: 1.25;
    margin-block-start: var(--preset--spacing--large);
  }
  strong {
    font-weight: 600;
  }

  & > *, .has-global-spacing > * {
    margin-block-start: 2rem;
  }

  ul, ol {
    padding-inline-start: 1rem;
  }
}

body > footer {
  margin-top: 2rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--preset--color--rule);
  color: var(--preset--color--muted);
  font-size: 0.85rem;
}

.post-collection {
  padding: 0;
  list-style: none;
  margin-top: var(--preset--layout--container--block-spacing);
  margin-bottom: var(--preset--layout--container--block-spacing);

  &.post-list {
    border-bottom: solid 1px var(--preset--color--rule);
    li a {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      padding: var(--preset--spacing--medium) 0rem;
      border-top: solid 1px var(--preset--color--rule);
      flex-wrap: nowrap;
      gap: var(--preset--spacing--small);
    }
    [class^="item-"] {
      flex-basis: 20%;
    }
    .item-title {
      flex-shrink: 0;
      flex-grow: 1;
    }
    .item-date, .item-categories {
      font-size: 0.8rem;
    }
    .item-arrow {
      text-align: end;
      flex-basis: 1.5rem;
    }
  }

  &.post-gallery {
    --local--gap: 1.5rem;
    --local--columns: 2;
    --local--min-width: calc( ( var(--preset--layout--container--width) / var(--local--columns) ) - var(--local--gap));
    &:has(li) {
      display: grid;
      align-items: stretch;
      grid-template-columns: repeat(auto-fit, minmax(var(--local--min-width), 1fr));
      gap: var(--local--gap);
    }
    li {
      display: block;
      max-width: 100%;
    }
    li a {
      display: flex;
      flex-direction: column;
      height: 100%;
    }
    img, .img {
      object-fit: cover;
      object-position: center;
      aspect-ratio: 4/3;
      background-color: var(--preset--color--neutral-lightest);
    }
    .item-title {
      margin-top: var(--preset--spacing--medium);
      margin-bottom: var(--preset--spacing--small);
    }
  }
}

article.post {
  .post-cover img {
    aspect-ratio: 4/3;
    object-fit: cover;
    object-position: center;
  }
  header {
    border-bottom: solid 1px var(--preset--color--rule);
  }
}

@media screen and (max-width: 850px) {
  .post-collection.post-gallery {
    --local--min-width:calc( 50% - var(--local--gap) );
  }
}

@media screen and (max-width: 685px) {
  .post-collection.post-gallery {
    --local--min-width:100%;
  }
  .d-md-none {
    display: none;
  }
}


body:where(.layout-project, .layout-post) {
  .site-header, .post-content, .post-heading {
    position: relative;
    z-index: 2;
  }
  .post-cover {
    z-index: 1;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    margin: 0;
    max-width: unset;
    height: 100%;
    max-height: 80vh;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));
    overflow: hidden;
    img {
      filter: blur(50px) brightness(1.8);
      height: 100%;
      width: 100%;
      object-fit: cover;
      transform: scale(1.1);
    }
  }
}

.notion-tabs {
  .notion-tab-panels:has(:target) .notion-tab-panel:not(:target),
  .notion-tab-panels:not(:has(:target)) .notion-tab-panel:not(:first-child) {
      display: none;
  }
  &:has(.notion-tab-panel:nth-child(1):target) nav a:nth-child(1),
  &:has(.notion-tab-panel:nth-child(2):target) nav a:nth-child(2),
  &:has(.notion-tab-panel:nth-child(3):target) nav a:nth-child(3),
  &:has(.notion-tab-panel:nth-child(4):target) nav a:nth-child(4),
  &:has(.notion-tab-panel:nth-child(5):target) nav a:nth-child(5),
  &:has(.notion-tab-panel:nth-child(6):target) nav a:nth-child(6),
  &:not(:has(.notion-tab-panel:target)) nav a:nth-child(1)
  {
    --tab--color: var(--preset--color--accent);
  }
  nav {
    position: sticky;
    top:0;
    padding-bottom: 0.5rem;
    border-bottom: solid 1px var(--preset--color--contrast);
    background-color: var(--preset--color--base);

    a {
      --tab--color: var(--preset--color--contrast);
      padding: 5px 8px;
      border-radius: 100px;
      background-color: var(--preset--color--base);
      border: solid 1px var(--tab--color);
      text-decoration: none;
      color: var(--tab--color);
    }
  }
}

.resume-item {
  summary {
    cursor: pointer;
  }
  .resume-item--title {
    margin-top: 0;
    display: inline-block;
  }
  .resume-item--dates {
    display: block;
  }
}