@import url("https://fonts.googleapis.com/css2?family=Jersey+25&display=swap");

:root {
  --measure: 980px;
  --border-thin: 1px;
  --ratio: 1.4;
  --s-5: calc(var(--s-4) / var(--ratio));
  --s-4: calc(var(--s-3) / var(--ratio));
  --s-3: calc(var(--s-2) / var(--ratio));
  --s-2: calc(var(--s-1) / var(--ratio));
  --s-1: calc(var(--s0) / var(--ratio));
  --s0: 1rem;
  --s1: calc(var(--s0) * var(--ratio));
  --s2: calc(var(--s1) * var(--ratio));
  --s3: calc(var(--s2) * var(--ratio));
  --s4: calc(var(--s3) * var(--ratio));
  --s5: calc(var(--s4) * var(--ratio));

  --font-small: 90%;
  --font-footer: 75%;

  --font-code:
    ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas,
    "DejaVu Sans Mono", monospace;
  --font-body: "Jersey 25", system-ui, sans-serif;
  --font-title: "Jersey 25", system-ui, sans-serif;

  --clr-bg: #10141f;
  --clr-text: #deceed;
  --clr-action: #b2d88f;
  --clr-secondary: #b0a7b8;
  --clr-inactive: #a6cb96;
  --clr-focus: #5dd2e4;
  --clr-outline: #4e4b5c;
  --clr-code: #17d9c9;
  --clr-em: #40a5ff;
}

* {
  font-family: "Jersey 25", sans-serif;
}

body {
  background-color: var(--clr-bg);
  color: var(--clr-text);
  font-size: clamp(1rem, 0.6875rem + 1vw, 1.25rem);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
}
body::before {
  content: "";
  display: block;
  height: min(70vh, 700px);
  overflow: hidden;
  width: 100%;
  background: url(gram_header_wide.svg) center no-repeat;
  background-size: cover;
}

/* ---------------------------------------- Inline Content */
/* [a, span, sup, sub, strong, em, q, kbd] */
a {
  color: var(--clr-action);
  text-underline-offset: 18%;
  text-decoration-thickness: 1px;
}
a:visited {
  color: var(--clr-inactive);
}
a:hover {
  color: var(--clr-focus);
}

sup a {
  text-decoration: none;
}

/* Inline Emphasis */
strong {
  font-weight: 700;
}

em {
  font-weight: 400;
  color: var(--clr-em);
  font-family: monospace;
}

q {
  font-style: italic;
}

kbd {
  border: 1px solid var(--clr-outline);
  border-radius: 8px;
  background: hsl(from var(--clr-outline) h s calc(l - 10));
  color: white;
  padding: 2px;
}

/* ---------------------------------------- Block Content */
/* [p, ul, ol, li, headings, blockquote, pre, code] */
h1,
h2,
h3,
h4 {
  text-wrap: balance;
  font-family: var(--font-title);
}
h1,
h2 {
  font-weight: 900;
  font-size: var(--s1);
}
h3 {
  font-weight: 700;
  font-size: var(--s2);
}
h4 {
  font-weight: 500;
  font-size: var(--s3);
}
h1 {
  font-size: var(--s4);
}
h2 {
  font-size: var(--s3);
}
h3 {
  font-size: var(--s2);
}
h4 {
  font-size: var(--s1);
}

p {
  margin-bottom: var(--s2);
}

ul ul {
  margin-inline-start: 1em;
}

ol.footnotes a.backlink {
  text-decoration: none;
}

blockquote {
  margin-top: var(--s1);
  padding-inline: var(--s2);
  font-weight: 500;
  font-style: italic;
  border-left: 4px solid var(--clr-outline);
}

pre,
code {
  font-size: var(--font-small);
  font-family: var(--font-code);
  overflow-x: auto;
}

code {
  color: var(--clr-code);
  background: #192830;
  padding: 0.25rem 0.5rem;
}

pre code {
  white-space: pre;
  padding: 1rem;
  margin: 0 0 1rem;
  display: block;
}

/* ---------------------------------------- Basic Structure/Sections */
/* [main, header, footer, article, section, div] */
main {
}

header {
  margin-block: var(--s1);
}

article {
  margin-block: var(--s2);
}
article .preamble {
  width: 100%;
  text-align: left;
  color: var(--clr-secondary);
}
article .preamble time {
  font-style: italic;
}
article p {
  margin-block: var(--s1);
}

section {
  display: block;
  margin-block: var(--s2);
}

footer {
  text-align: center;
  font-size: var(--font-footer);
  padding-block: var(--s1);
  border-top: 1px solid var(--clr-outline);
}
footer img {
  max-width: 32ch;
}
footer ul {
  list-style: none;

  & li {
    width: 100%;
    min-width: 16ch;
  }
}
footer a {
  font-weight: 400;
  text-decoration: none;
}
footer hr {
  margin-top: var(--s2);
  border: 0;
  height: 1px;
  background-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 0),
    var(--clr-outline),
    rgba(0, 0, 0, 0)
  );
}

/* ---------------------------------------- Tables */
/* [table, td, th, tr, tbody, thead, tfooter, col, colgroup, caption] */
table {
  display: block;
  margin-bottom: var(--s1);

  thead {
    border-bottom: 1px solid var(--clr-outline);
    color: var(--clr-inactive);
  }
}

td {
  padding-inline: var(--s-4);
}

/* ---------------------------------------- Section :: Home */
header#frontpage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 5rem 0 1rem;
  text-align: center;
}

#frontpage h1 {
  font-size: 5rem;
  margin: 0;
}

#frontpage h2 {
  font-size: 1.5rem;
  font-weight: normal;
  margin: 0 0 1rem;
}

#frontpage blockquote {
  border-left: none;
  margin: 0;
  padding: 0;
}

#frontpage figure {
  margin-block-start: 1rem;
}

#frontpage small {
  margin-block-end: 1rem;
}

#frontpage p {
  color: var(--clr-secondary);
  text-align: justify;
  margin: 0 0 1rem;
}

.download-callout {
  background-color: var(--clr-action);
  color: var(--clr-bg);
  font-size: var(--s0);
  padding: 0.75rem 2.5rem;
  border-radius: 12px;
  border: 2px solid var(--clr-inactive);
  text-decoration: none;
  font-weight: 700;
}

.download-callout:visited {
  color: var(--clr-bg);
  background-color: var(--clr-inactive);
}

.download-callout:hover {
  color: var(--clr-action);
  background-color: var(--clr-outline);
}

/* ---------------------------------------- Custom */
article h1,
h2,
h3,
h4 {
  margin-top: var(--s3);
  margin-bottom: var(--s2);
}

.news-article h1 {
  margin-bottom: var(--s4);
}

.page {
  margin-inline: auto;
  max-width: var(--measure);
}

.invert {
  -webkit-filter: invert(100%);
  filter: invert(100%);
}

#page-navbar a {
  text-decoration: none;
}

.page {
  padding-inline: 1em;
}

.center {
  display: block;
  box-sizing: content-box;
  margin-inline: auto;
  max-inline-size: var(--measure);
}

#foot-line {
  padding: var(--s1);
}

#happy-toad {
  border-radius: 6px;
}

.inline-img {
  display: inline;
  width: auto;
  height: 2ch;
  vertical-align: text-bottom;
}

.box {
  display: block;
  padding: var(--s1);
  border: var(--border-thin) solid var(--clr-outline);
  border-radius: var(--s-4);
  outline: var(--border-thin) solid transparent;
  outline-offset: calc(var(--border-thin) * -1);
}
.padded {
  display: block;
  padding: var(--s1);
}
.text-left {
  text-align: left;
}
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}
.text-justify {
  text-align: justify;
}

.author {
  margin-top: var(--s0);
  font-size: var(--font-small);
}

.theme-toggle {
  position: absolute;
  top: 0;
  right: 0;
  padding: var(--s-1);
}

[data-theme-toggle] {
  padding: var(--s-1);
  line-height: 1;
  text-align: justify;
  border: none;
  background: none;
  user-select: none;

  svg > path {
    fill: var(--clr-inactive);
    stroke: var(--clr-inactive);
  }
}

.theme-toggle:hover [data-theme-toggle] {
  cursor: pointer;
}

.theme-toggle:hover [data-theme-toggle] svg > path {
  cursor: pointer;
  fill: var(--clr-focus);
  stroke: var(--clr-focus);
}

[data-theme-toggle] svg {
  width: var(--s1);
  height: var(--s1);
}

.license {
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 14px;
  margin-block: var(--s2);
}

.bg {
  border: 2px solid var(--color-bg-dim);
  border-radius: 12px;
  background-color: var(--color-bg-dim);
}

@media (prefers-reduced-motion: no-preference) {
  html:focus-within {
    scroll-behavior: smooth;
  }
}

#nav-back {
  text-decoration: none;
  font-weight: 900;
}

.posts {
  margin-inline: var(--s1);
  line-height: 2;
}

.posts-date {
  padding-left: 1ch;
  color: var(--clr-secondary);
}

.breadcrumbs {
  font-weight: 900;
}

.breadcrumbs a {
  text-decoration: none;
}

.breadcrumbs a::after {
  content: " / ";
  color: var(--clr-outline);
}

.table-wrapper {
  overflow-x: auto;
}

.signature-toad {
  width: 175px;
  height: 150px;
}
