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

/* Remove default margin */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* Set core root defaults */
html:focus-within {
  scroll-behavior: smooth;
}

/* Set core body defaults */
body {
  min-height: 100vh;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
}

:root {
  --ratio: 1.125;

  --color-background: white;
  --color-code-background: #f9f9f9;
  --color-text: #222;
  --color-border: #000;
  --color-blue: mediumblue;
  --color-red: crimson;

  --size-xs: calc(var(--size-s) / var(--ratio));
  --size-s: calc(var(--size-m) / var(--ratio));
  --size-m: 1em;
  --size-l: calc(var(--size-m) * var(--ratio));
  --size-xl: calc(var(--size-l) * var(--ratio));
  --size-2xl: calc(var(--size-xl) * var(--ratio));
  --size-3xl: calc(var(--size-2xl) * var(--ratio));
  --size-4xl: calc(var(--size-3xl) * var(--ratio));
  --size-5xl: calc(var(--size-4xl) * var(--ratio));
  --size-6xl: calc(var(--size-5xl) * var(--ratio));
  --size-7xl: calc(var(--size-6xl) * var(--ratio));

  --flow-space: 1em;

  /* font-family: jaf-facitweb, sans-serif; */
  font-family: Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans",
    source-sans-pro, sans-serif;
  font-size: 1.2em;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-background);
}

.flow h1 {
  font-size: var(--size-7xl);
  margin-top: 2em;
}

h2 {
  --flow-space-top: 2em;
  font-size: var(--size-3xl);
}

h3 {
  font-size: var(--size-xl);
  --flow-space-bottom: 0.5em;
  --flow-space-top: 2em;
}

h4 {
  font-size: var(--size-m);
}

a {
  color: blue;
  text-underline-offset: 0.15em;
}

pre,
code {
  tab-size: 2;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas,
    "DejaVu Sans Mono", monospace;
  font-variant-ligatures: none;
  background: var(--color-code-background);
}

code {
  padding: 0 0.25em;
  line-height: 1.6;
  position: relative;
  font-size: 0.9em;
  display: inline-block;
  text-decoration: none;
  border-radius: 3px;
  border: 1px solid var(--color-border);
  word-break: break-all;
}

.highlight {
  --flow-space-bottom: var(--size-8xl);
  --flow-space-top: var(--size-3xl);
  padding: var(--size-l) var(--size-2xl);
  border: 1px solid var(--color-border);
  border-bottom: 3px solid var(--color-border);
  position: relative;
  border-radius: 5px;
  white-space: pre-wrap;
  overflow: scroll;
  font-size: 0.85em;
}

a {
  color: var(--color-blue);
}

.highlight[data-lines="1"] {
  padding-top: var(--size-s);
  padding-bottom: var(--size-s);
}

.highlight[data-language="ruby"]:after {
  color: var(--color-red);
}
.highlight[data-language="html"]:after {
  color: var(--color-blue);
}
.highlight[data-language="erb"]:after {
  color: green;
}
.highlight[data-language="bash"]:after {
  color: black;
}

.highlight[data-language]:after {
  display: block;
  position: absolute;
  top: 0;
  right: 0;
  content: attr(data-language);
  border-left: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--size-xs);
  padding: 0.1em 0.5em;
  text-transform: uppercase;
  border-bottom-left-radius: 3px;
}

.highlight:has(+ .highlight) {
  --flow-space-bottom: 0;
  border-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.highlight + .highlight {
  --flow-space-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.tabs input[type="radio"]:checked + label {
  background: #f8f8f8;
  z-index: 1;
  margin-bottom: -1px;
  padding-bottom: 1px;
}

.tabs input[type="radio"]:focus + label {
  --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0
    var(--tw-ring-offset-width) var(--tw-ring-offset-color);
  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0
    calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow),
    var(--tw-shadow, 0 0 #0000);
}

.tabs input[type="radio"]:checked + label + .tab {
  display: block;
}

.top {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  border-top: 2px solid var(--color-border);
}

body {
  margin: 0;
}

main {
  margin: auto;
  max-width: 40rem;
  padding: 1.5rem;
}

.highlight .k {
  color: var(--color-red);
}
.highlight .nc,
.highlight .no,
.highlight .n,
.highlight .nt,
.highlight .o {
  color: var(--color-blue);
}
.highlight .c1 {
  color: slategrey;
}
.highlight .ss,
.highlight .na,
.highlight .vi,
.highlight .nb {
  color: green;
}
.highlight .si,
.highlight .kp {
  color: purple;
}

.flow > * + * {
  margin-block-start: var(--flow-space-top, var(--flow-space, 1em));
  margin-block-end: var(--flow-space-bottom, var(--flow-space, 1em));
}
