/*
  1. Use a more-intuitive box-sizing model.
*/
*,
*::before,
*::after {
  box-sizing: border-box;
}
/*
  2. Remove default margin
*/
* {
  margin: 0;
}
/*
  Typographic tweaks!
  3. Add accessible line-height
  4. Improve text rendering
*/
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;

  position: relative;
  min-height: 100vh;
}
/*
  5. Improve media defaults
*/
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}
/*
  6. Remove built-in form typography styles
*/
input,
button,
textarea,
select {
  font: inherit;
}
/*
  7. Avoid text overflows
*/
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}
/*
  8. Create a root stacking context
*/
#root,
#__next {
  isolation: isolate;
}

:root {
  --text-color: black;
  --background-color: white;
  font-size: 18px;
}

@view-transition {
  navigation: auto;
}

code {
  background-color: #edeceb;
  color: #eb5757;
  font-family: "Nimbus Mono PS", "Courier New", monospace;
  padding: 0.1rem 0.2rem;
  font-weight: bold;
}

*.dark-only {
  display: none;
}
*.light-only {
  display: inherit;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #eeeeee;
    --background-color: rgb(26, 26, 26);
  }

  *.dark-only {
    display: inherit;
  }
  *.light-only {
    display: none;
  }

  body {
    background-color: var(--background-color);
    color: var(--text-color);
  }

  code {
    background-color: #292827;
  }
}

body {
  font-family: system-ui, sans-serif;
  font-weight: normal;
  text-wrap: pretty;
  padding: 3rem;
  min-height: 100dvh;

  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.1;
}

a {
  font-weight: bold;
  text-decoration: none;
  /* color: var(--text-color); */
  color: rgb(0, 102, 204);
  transition: color 0.2s ease-out;
}

header a {
  color: var(--text-color);
}
header a:hover {
  color: grey;
}

hgroup {
  width: 100%;
}

p,
details,
ul,
ol {
  margin: 0.75rem 0;
}
details {
  p,
  ul,
  ol {
    margin: 1.25rem 0;
  }
}

/* forget everything about "pre code" to not interfer with prism*/
pre {
  & code {
    all: unset;
  }
}

:not(pre) > code {
  white-space: nowrap;
}

main details > summary {
  padding: 0.5rem;
  user-select: none;
  background-color: #ffa70061;
}
main details[open] > summary {
  margin-bottom: 1rem;
}
main details[open] {
  border: 1px solid #ffa70061;
  padding-bottom: 1rem;
}
main details > *:not(summary) {
  padding: 0 1rem;
}

aside ul {
  padding-left: 1rem;
}

summary {
  cursor: pointer;
}
summary:has(:first-child)::-webkit-details-marker,
summary:has(:first-child)::marker {
  display: none;
  content: "";
}
details summary > *:first-child::before {
  content: "▶";
  margin-right: 0.6em;
  vertical-align: 0.15em;
}
details[open] summary > *:first-child::before {
  content: "▼";
}

blockquote {
  --tail-length: 15px;
  --tail-height: 20px;

  display: flex;
  gap: var(--tail-length);
  align-items: center;

  img {
    height: 80px;
    max-width: unset;
  }

  p::after {
    content: "";
    border: var(--tail-height) solid transparent;
    position: absolute;
    border-right-color: var(--quote-bg, rgb(228, 228, 228));
    border-left: 0;
    left: calc(var(--tail-length) * -1);
    top: 50%;
    margin-top: calc(var(--tail-height) * -1);
  }

  p {
    color: var(--quote-color, black);
    background-color: var(--quote-bg, rgb(228, 228, 228));
    padding: 1rem;
    border-radius: 0.25rem;
    position: relative;
    font-style: italic;
  }
}
blockquote[reply] {
  flex-direction: row-reverse;

  p::after {
    display: none;
  }

  img {
    scale: -1 1;
  }

  p::before {
    content: "";
    border: var(--tail-height) solid transparent;
    position: absolute;
    border-left-color: var(--quote-bg, rgb(228, 228, 228));
    border-right: 0;
    right: calc(var(--tail-length) * -1);
    top: 50%;
    margin-top: calc(var(--tail-height) * -1);
  }
}
blockquote[narrator] {
  p::before,
  p::after {
    display: none;
  }

  p {
    margin: 1rem auto;
  }
}

.stack {
  display: grid;
  place-items: center;

  > * {
    grid-area: 1/1;
  }
}

.flipX {
  scale: 1 -1;
}

.flipY {
  scale: -1 1;
}
