:root {
  --dark-bg: rgb(20, 20, 20);
  --light-bg: rgb(255, 255, 255);
  --logo-dark: rgb(81, 81, 81);
  --logo-light: rgb(213, 213, 213);
}

body {
  font-family: Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif;
  font-weight: normal;
  font-size: 1.1rem;
  margin: 0;
  padding: 1em 0;
}

code {
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
  font-weight: normal;
  font-size: 1rem;
}

pre code {
  font-size: 0.9rem;
}

p,
li {
  line-height: 1.4;
}

p code,
li code {
  background: rgba(53, 167, 255, 0.1);
}

h2 {
  font-size: 1.2rem;
}

details summary,
p,
h2,
details div.code_sample,
ul,
ol,
hr {
  max-width: 34rem;
  margin: auto;
}

details div.code_sample {
  border-radius: 5px;
  overflow: hidden;
}

details hr {
  margin-bottom: 2rem;
}

h2 {
  margin: 1em auto;
}

p,
ul {
  margin: 1em auto;
}

summary::marker {
  color: rgb(127, 127, 127);
}

details summary {
  padding: 0.5rem 0;
}

details[open] summary:hover {
  background: none;
}

details:has(+ hgroup) summary,
details:last-of-type summary {
  border-bottom: none;
}

details[open] summary {
  border-bottom: none;
}

details p:first-of-type {
  margin-top: 0;
}

details p:last-child {
  padding-bottom: 1rem;
}

details summary h3 {
  font-size: 1.1rem;
  margin: 0;
  font-weight: normal;
  padding: 0.2rem 0;
  display: inline-block;
}

details[open] summary h3 {
  font-weight: bold;
}

.symmetric-parent {
  display: flex;
  justify-content: center;
  margin: 2em auto;
}

section.symmetric {
  display: inline-flex;
  justify-content: center;
  align-items: stretch;
  margin: auto;
  border-radius: 5px;
  overflow: hidden;
  flex-direction: column;
}

section.symmetric.noCollapse {
  flex-direction: row;
}

@media screen and (width >=66rem) {
  section.symmetric {
    margin: 1em 2em;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

.sided {
  flex-grow: 1;
}

section.symmetric .consumer-side.mirrored {
  transform: scale(-1, 1);
}

section.symmetric .consumer-side,
section.symmetric .producer-side {

  details,
  >p {
    margin: 1rem;
    max-width: 33rem;
  }
}

section.symmetric .logo {
  margin: 2rem 0 1.5rem 0;
}

section.symmetric .logo svg {
  width: 40%;
}

pre.shiki {
  font-size: 0.9rem;
  margin: 1rem 0;
  padding: 1rem;
  max-width: 32.5rem;
  overflow: hidden;
  border-radius: 5px;
}

section.symmetric .consumer-side pre.shiki {
  margin-left: auto;
}

#deco-consumer,
#deco-producer,
.beamed-consumer,
.beamed-producer {
  display: none;
}

@media screen and (width >=76rem) {

  #deco-consumer,
  #deco-producer,
  .beamed-consumer,
  .beamed-producer {
    display: flex;
  }
}

#deco-consumer,
#deco-producer {
  position: fixed;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  gap: 0.5rem;
  z-index: -1;
}

#deco-consumer {
  top: 0;
  left: calc(0.5 * calc(50vw - 23rem) - 70px);
}

#deco-producer {
  bottom: 0;
  right: calc(0.5 * calc(50vw - 23rem) - 70px);
}

#ufo-producer,
#ufo-consumer {
  width: 100px;
}

#beams-consumer,
#beams-producer {
  width: 60px;
}

#beams-consumer {
  left: 2.2rem;
  top: 5rem;
}

#beams-producer {
  right: 2.2rem;
  bottom: 5rem;
}

.beamed-consumer,
.beamed-producer {
  position: absolute;
  z-index: -2;
  width: 100px;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.beamed-consumer img,
.beamed-producer img {
  transform: scale(0.4, 0.4);
}

.beamed-consumer {
  left: calc(0.5 * calc(50vw - 23rem) - 70px);
}

.beamed-producer {
  right: calc(0.5 * calc(50vw - 23rem) - 70px);
}

details {
  position: relative;

  .beamed-consumer {
    top: min(50rem, 60%);
  }

  .beamed-producer {
    bottom: min(50rem, 60%);
  }
}

/* Selector from https://stackoverflow.com/a/5379820 */
a[href]:not(:where(

    /* exclude hash only links */
    [href^="#"],
    /* exclude relative but not double slash only links */
    [href^="/"]:not([href^="//"]),
    .itemrs,
  )):after {
  display: inline;
  content: "↗";
  font-family: ui-sans-serif;
  font-size: 0.9em;
  text-decoration: none;
  text-decoration-thickness: auto;
  text-decoration-thickness: 0;
}

nav a:before {
  background-size: 100% 100%;
  display: inline-block;
  width: 0;
  height: 1.3em;
  content: "";
  margin-right: 0.2em;
  transform: translateY(30%);
  background-color: transparent;
}

nav a[href="https://worm-blossom.org/"]:before {
  width: 1.3em;
  background-image: url('https://worm-blossom.org/assets/favicon.png');
}

header,
footer {
  >.symmetric-parent {
    margin: 1em auto;
  }

  ul {
    margin: 0 auto;
  }
}

footer {
  margin-top: 4rem;
}

nav {
  margin-bottom: 2rem;

  >ul {
    display: flex;
    justify-content: space-evenly;
    list-style-type: none;
  }
}

hgroup {
  padding-top: 1.5rem;

  a {
    text-decoration: none;
  }
}

@media (prefers-color-scheme: light) {
  h2>a {
    color: black;
  }

  body {
    background: rgb(244, 244, 244);
  }

  section.symmetric .consumer-side {
    color: white;
    background: var(--dark-bg);
  }

  section.symmetric .consumer-side.mirrored {
    color: rgb(52, 52, 52);
  }

  section.symmetric .producer-side {
    color: var(--dark-bg);
    background: var(--light-bg);
  }

  section.symmetric .consumer-side svg path,
  section.symmetric .consumer-side svg rect {
    fill: var(--logo-light)
  }

  section.symmetric .producer-side svg path,
  section.symmetric .producer-side svg rect {
    fill: var(--logo-dark);
  }

  a,
  code a {
    color: rgb(83, 124, 212)
  }

  details summary:hover {
    background: rgb(251, 251, 251);
  }

  details[open] hr {
    border: 1px solid rgb(191, 191, 191);
    border-top: none;
  }

  details summary {
    border-bottom: 1px solid rgb(191, 191, 191);
  }


  #deco-consumer {
    background-image: linear-gradient(rgb(244, 244, 244) 50%, rgba(255, 255, 255, 0));
  }

  #deco-producer {
    background-image: linear-gradient(rgba(255, 255, 255, 0), rgb(244, 244, 244) 50% 100%);
  }

  #ufo-consumer,
  #ufo-producer,
  #beams-consumer,
  #beams-producer {
    opacity: 0.1;
  }

  .beamed-consumer,
  .beamed-producer {
    opacity: 0.1;
  }
}

@media (prefers-color-scheme: dark) {
  h2>a {
    color: white;
  }

  body {
    color: white;
    background: rgb(56, 56, 56)
  }

  section.symmetric .consumer-side {
    color: var(--dark-bg);
    background: var(--light-bg);
  }

  section.symmetric .consumer-side.mirrored {
    color: rgb(226, 226, 226);
  }

  section.symmetric .producer-side {
    color: white;
    background: var(--dark-bg);
  }

  section.symmetric .consumer-side svg path,
  section.symmetric .consumer-side svg rect {
    fill: var(--logo-dark);
  }

  section.symmetric .producer-side svg path,
  section.symmetric .producer-side svg rect {
    fill: var(--logo-light)
  }

  a,
  code a {
    color: rgb(139, 176, 255)
  }


  details summary:hover {
    background: rgb(69, 69, 69);
  }

  details[open] hr {
    border: 1px solid rgb(103, 103, 103);
    border-top: none;
  }

  details summary {
    border-bottom: 1px solid rgb(103, 103, 103);
  }

  #deco-consumer {
    background-image: linear-gradient(rgb(56, 56, 56) 50%, rgba(255, 255, 255, 0));
  }

  #deco-producer {
    background-image: linear-gradient(rgba(255, 255, 255, 0), rgb(56, 56, 56) 50% 100%);
  }

  #ufo-consumer,
  #ufo-producer,
  #beams-consumer,
  #beams-producer {
    opacity: 0.1;
    filter: invert(1);
  }

  .beamed-consumer,
  .beamed-producer {
    opacity: 0.1;
    filter: invert(1);
  }

  .shiki,
  .shiki span {
    color: var(--shiki-dark) !important;
    background-color: var(--shiki-dark-bg) !important;
    /* Optional, if you also want font styles */
    font-style: var(--shiki-dark-font-style) !important;
    font-weight: var(--shiki-dark-font-weight) !important;
    text-decoration: var(--shiki-dark-text-decoration) !important;
  }
}

/*
* Start webtt styles.
*/

@keyframes fadeIn {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

.tooltipContainer {
  position: absolute;
  background: inherit;
  padding: 0.5rem;
  overflow: hidden;
  animation: fadeIn 0.4s;
  max-width: min(36rem, calc(100vw - 3rem));
  width: 100%;
}

iframe {
  display: block;
  border: none;
  width: inherit;
  height: inherit;
}

.tooltipFadeout {
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s 0.2s, opacity 0.2s linear;
}

*[data-tooltip-anchor] {
  text-decoration-line: underline;
  text-decoration-style: dotted;
}

mark {
  background: rgba(255, 228, 0, 0.31);
}

@media (prefers-color-scheme: dark) {
  .tooltipContainer {
    box-shadow: 0px 0px 6px 1px rgba(243, 243, 243, 0.8);
  }
}

@media (prefers-color-scheme: light) {
  .tooltipContainer {
    box-shadow: 5px 5px 10px 0px rgba(68, 68, 68, 0.80);
  }
}

/*
* End webtt styles.
*/

.nlnetnotice {
  margin-top: 2rem;
  color: var(--logo-dark);
}

@media (prefers-color-scheme: dark) {
  .nlnetnotice {
    color: var(--logo-light);
  }
}