:root {
  --background-body: #202122;
  --text-main: #fff;
  --text-secondary: #ccc;
  --primary-color: #548e9b;
  --font-family-serif: Merriweather, serif;
  --font-family-sans: 'Fira Sans', sans-serif;
  --wrap: 1400px;
}

@view-transition {
  navigation: auto;
}

html {
  overflow-y: scroll;
  scroll-behavior: smooth;
  @media (min-resolution: .001dpcm) {
    *:has(:popover-open) {
      pointer-events: none;
      touch-action: none;
      [popover] {
        pointer-events: auto;
        touch-action: auto;
      }
      ::backdrop {
        pointer-events: all;
        touch-action: manipulation;
      }
    }
  }

}

::selection {
  background-color: var(--primary-color);
  color: #fff;
}

/* evil hack. this will run for all browsers but safari and similar */
@media (min-resolution: .001dpcm) and (pointer: coarse) {
  [popover] {
    &::after {
      content: "";
      position: fixed;
      inset: 0;
      width: 100%;
      height: 100%;
      z-index: -1;
    }
  }
}

p {
  text-wrap: pretty;
}

@supports (scrollbar-gutter: stable) {
  html {
    overflow-y: auto;
    scrollbar-gutter: stable;
    scrollbar-color: var(--primary-color) transparent;
  }
}

*,
*:before,
*:after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family-serif);
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--background-body);
  color: var(--text-main);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-family-sans);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

h1 {
  font-family: var(--font-family-serif);
  font-size: 4em;
  margin: 0 0 1em 0;
}

h2 {
  margin: 1.6em 0 0 0;
  font-size: 1.8em;
}

h3 {
  font-size: 1.5em;
}

h4 {
  font-size: 1.4em;
}

h5 {
  font-size: 1.3em;
}

h6 {
  font-size: 1.2em;
}

p,
ul,
ol {
  font-size: 1.3rem;
  line-height: 2.25rem;
  margin: 1.2em 0;
}

.writing {
  p {
    margin: 0;
  }
}

ol,
ul {
  padding-left: 2rem;
  -webkit-padding-start: 5%;
  -webkit-padding-end: 5%;
}

li {
  margin: 1rem 0;
}

li p {
  margin-bottom: 0.5rem;
  margin-top: 0.5rem;
}

a {
  color: inherit;
  transition: color linear 0.15s;
  display: inline-block;
}

a:hover {
  color: var(--primary-color);
}

p a {
  text-decoration: none;
  box-shadow: inset 0 -0.12em 0 var(--primary-color);
  -webkit-transition: box-shadow 0.2s ease-in-out, color 0.2s ease-in-out;
  transition: box-shadow 0.2s ease-in-out, color 0.2s ease-in-out;
}

p a:hover {
  box-shadow: inset 0 -1.5em 0 var(--primary-color);
  color: #fff;
}

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

hr {
  padding: 0;
  border: 0;
  height: 10px;
  margin: 40px auto;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='20' height='10'  viewBox='0 0 20 10' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' clip-rule='evenodd' stroke-miterlimit='10'%3e%3cpath fill='none' d='M0 0h20v10H0z'/%3e%3cclipPath id='a'%3e%3cpath d='M0 0h20v10H0z'/%3e%3c/clipPath%3e%3cg clip-path='url(%23a)'%3e%3cpath d='M20 7.384c-4.999-.001-5-4.768-9.999-4.768C5 2.616 5 7.384 0 7.384' fill='none' stroke-width='3' stroke='%23548E9B'/%3e%3c/g%3e%3c/svg%3e");
}

code {
  font-family: 'SF Mono', menlo, inconsolata, monospace;
  font-size: calc(1em - 2px);
  color: #dadada;
  padding: 0.2em 0.4em;
  border-radius: 2px;
  background-color: rgba(255, 255, 255, 0.1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

pre {
  border-radius: 8px !important;
  margin: 1.2em 0 !important;
  padding: 1.2em;
}

pre code {
  padding: 0;
}

blockquote {
  border-left: 4px solid #cccccc;
  font-size: 1.4em;
  font-style: italic;
  margin: 2rem 0;
  padding-left: 2rem;
  padding-right: 2rem;
}

blockquote p {
  padding-bottom: 6px;
}

blockquote footer {
  font-size: 1.1rem;
  text-align: right;
}

figure {
  padding: 0;
  border: 0;
  font-size: 100%;
  vertical-align: baseline;
  -webkit-margin-start: 0;
  -webkit-margin-end: 0;
  margin: 0 0 3em 0;
}

table {
  border-collapse: collapse;
  font-family: var(--font-family-sans);
  font-size: 1.125em;
  margin: 2em 0;
}

th {
  border-bottom: 2px solid #cccccc;
  padding: 0.4em 0.8em;
}

td {
  padding: 0.4em 0.8em;
}

.container {
  margin: 0 auto;
  max-width: 42em;
  width: 100%;
}

.content h1 {
  font-size: 3em;
  margin: 1em 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding-block: 0.2rem;
}

span.tag {
  padding: 0.25rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  text-transform: lowercase;
}

span.tag::before {
  content: '#';
}

iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: 0;
}

button {
  display: inline-block;
  background: none;
  border: none;
  cursor: pointer;
}

[popover]::backdrop {
  background-color: rgba(49, 49, 49, 0.5);
  backdrop-filter: blur(2px);
}

@media (max-width: 1020px) {
  h1 {
    font-size: 3em;
  }

  .content h1 {
    font-size: 2.4em;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  p,
  ul,
  ol {
    font-size: 1.2rem;
    margin: 1em 0;
  }
}

.window {
  border: 2px solid #d0d0d0;
  flex-direction: column;
  position: relative;
  overflow-y: hidden;
  padding-top: 1.5rem;
  min-width: 10rem;
  background-color: rgba(17, 17, 17, 0.95);
  backdrop-filter: blur(4px);
  color: #f3f3f3;
  container-type: normal;
  &::before {
    content: attr(data-title);
    position: absolute;
    top: 0;
    left: 0;
    height: 1.75rem;
    width: 100%;
    border-bottom: #d0d0d0 solid 2px;
    display: flex;
    flex-direction: row;
    padding-inline: 0.5rem;
  }

  &[popover] {
    max-width: calc(100% - 2rem);
    max-height: 100vh;
    overflow-y: auto;
    padding: 1rem;
  }

  .buttons {
    position: absolute;
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    top: 0;
    right: 0;
    font-size: 0.75rem;
    height: 1.6rem;
  }
}
