/** Variables */

:root {
  --colour-primary-10: #060300;
  --colour-primary-15: #150800;
  --colour-primary-20: #1f1400;
  --colour-primary-30: #3c2b00;
  --colour-primary-40: #5c4300;
  --colour-primary-50: #7f5d00;
  --colour-primary-60: #a37800;
  --colour-primary-70: #c89500;
  --colour-primary-80: #efb300;
  --colour-primary-90: #ffd98c;
  --colour-primary-95: #ffecc8;

  --colour-hyperlink-10: #000409;
  --colour-hyperlink-20: #001829;
  --colour-hyperlink-30: #00314d;
  --colour-hyperlink-40: #004d75;
  --colour-hyperlink-50: #006a9f;
  --colour-hyperlink-60: #1388c9;
  --colour-hyperlink-70: #41a8ea;
  --colour-hyperlink-80: #78c7ff;
  --colour-hyperlink-90: #bfe3ff;
  --colour-hyperlink-95: #e0f1ff;

  --colour-primary-fg: var(--colour-primary-90);
  --colour-primary-fg-accent: var(--colour-primary-80);
  --colour-primary-bg: var(--colour-primary-10);
  --colour-primary-bg-accent: var(--colour-primary-20);
  --colour-code-fg: var(--colour-primary-90);
  --colour-code-bg: var(--colour-primary-15);
  --colour-hyperlink: var(--colour-hyperlink-80);

  --font-size-sm: 1rem;
  --font-size-base: 1.125rem;
  --font-size-md: 1.5rem;
  --font-size-lg: 2rem;
  --font-size-xl: 3rem;

  --spacing-block-xs: 0.5rem;
  --spacing-block-sm: 1.75rem;
  --spacing-block-md: 2.5rem;
  --spacing-block-lg: 3.5rem;
  --spacing-block-xl: 5rem;
  --spacing-inline-xs: 0.25rem;
  --spacing-inline-sm: 0.5rem;
  --spacing-inline-md: 1.5rem;
  --spacing-inline-lg: 3rem;
  --spacing-inline-xl: 6rem;
}

/** Light theme */
@media (prefers-color-scheme: light) {
  :root {
    --colour-primary-fg: var(--colour-primary-20);
    --colour-primary-fg-accent: var(--colour-primary-40);
    --colour-primary-bg: var(--colour-primary-95);
    --colour-primary-bg-accent: var(--colour-primary-90);
    --colour-hyperlink: var(--colour-hyperlink-40);
  }
}

/** Base typography */

body {
  font-size: var(--font-size-base);
  color: var(--colour-primary-fg);
  font-weight: light;
  background-color: var(--colour-primary-bg);
  line-height: 1.5;

  /* Geometric Humanist stack from https://modernfontstacks.com */
  font-family: Avenir, Montserrat, Corbel, 'URW Gothic', source-sans-pro, sans-serif;
}

small {
  font-size: var(--font-size-sm);
}

:is(p, h1, h2, h3, h4, h5, h6, hr, img, figure, ul, ol) {
  margin-block-start: var(--spacing-block-sm);
}

/** Base layout */

body {
  --body-margin-inline-start: var(--spacing-inline-lg);
  --body-margin-inline-end: var(--body-margin-inline-start);
  --body-margin-block-end: var(--spacing-block-xl);
  margin-inline: var(--body-margin-inline-start) var(--body-margin-inline-end);
  margin-block-end: var(--body-margin-block-end);
}

:is(h1, h2, h3, h4, h5, h6) {
  text-align: center;
}

img {
  margin-inline: auto;
  height: auto;
}

@media (min-width: 48rem) {
  body {
    display: grid;
    grid-template-columns:
      [media-start]
      var(--grid-margin-inline)
      [content-start]
      minmax(var(--grid-max-content-width), auto)
      [content-end];
            column-gap: var(--spacing-block-sm);
    max-width: var(--grid-total-width);

    --body-margin-inline-end: 6rem;
    --grid-margin-inline: 6rem;
    --grid-total-width: 48rem;
    --grid-max-content-width: calc(
      var(--grid-total-width)
        - var(--body-margin-inline-start)
        - var(--grid-margin-inline)
        - var(--spacing-block-sm)
        - var(--grid-margin-inline)
    );
  }

  :is(main, article, nav) {
    display: grid;
    grid-column: media-start / content-end;
    grid-template-columns: subgrid;
  }

  :is(section, header, aside) {
    grid-column: content-start / content-end;
  }

  :is(h1, h2, h3, h4, h5, h6) {
    text-align: start;
  }
}

/** Headings */

h1 {
  font-size: var(--font-size-xl);
  font-weight: 900;
  margin-block-start: 0;
}

h2 {
  font-size: var(--font-size-lg);
  font-weight: 900;
  margin-block-start: var(--spacing-block-xl);
}

h3, h4, h5, h6 {
  font-size: var(--font-size-md);
  font-weight: 600;
  margin-block-start: var(--spacing-block-lg);
}

/** Hyperlinks */

:is(:link, :visited) {
  color: var(--colour-hyperlink);
  text-decoration: underline;
  display: inline;
}

:hover {
  text-decoration: wavy;
}

/** Definition lists */
dl {
  margin-block-start: var(--spacing-block-md);
}

dl dt {
  font-weight: bold;
}

dl dd + dt {
  margin-block-start: var(--spacing-block-md);
}

/** figcaptions */

figcaption {
  font-size: var(--font-size-sm);
  font-style: italic;
  text-align: center;
}

/** Lists */

:is(ol, ul) {
  margin-inline-start: var(--spacing-inline-lg);
}

/** Navigation bar */

.navbar {
  margin-block: var(--spacing-block-sm);
}

.navbar ul {
  grid-column: media-start / content-end;
  display: flex;
  justify-content: center;
  gap: var(--spacing-inline-md);
  list-style: none;
  margin: 0;
}

@media (min-width: 36rem) {
  .navbar {
    display: grid;
    grid-template-columns: subgrid;
  }

  .navbar ul {
    justify-content: end;
  }
}

/** Emphasis */

strong {
  font-weight: bold;
  font-style: italic;
}

/** Blog feed */

.h-feed ul {
    list-style: none;
    margin-inline: 0;
}

/** Block quotes */
blockquote {
  padding-inline-start: var(--spacing-inline-lg);
  border-inline-start: 2px solid var(--colour-primary-fg);
  font-style: italic;
}

 blockquote footer {
  font-style: initial;
}

blockquote :is(b, strong) {
  font-style: italic;
  font-weight: bold;
}

blockquote :is(i, em) {
  font-style: normal;
}

/** Small caps */
.small-caps {
  font-variant: small-caps;
}

/** Pre-formatted blocks */
pre {
  border: 2px solid var(--colour-primary-fg);
  border-radius: 2px;
  background-color: var(--colour-code-bg) !important;
  margin-block-start: var(--spacing-block-sm);
  padding-inline: var(--spacing-inline-sm);
  padding-block: var(--spacing-block-xs);
}

/** Code blocks */
code {
  border: 2px solid var(--colour-primary-fg);
  border-radius: 2px;
  padding-inline: var(--spacing-inline-xs);
  color: var(--colour-code-fg);
  background-color: var(--colour-code-bg);
  font-size: var(--font-size-sm);
}
pre code {
  border: none;
  border-radius: none;
  padding: none;
}

/** Alerts */
.alert {
  border: 2px solid var(--colour-primary-fg);
  border-radius: 2px;
  padding-inline: var(--spacing-inline-xs);
  background-color: var(--color-primary-fg-accent);
}


.visually-hidden {
    position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      border: 0;
      padding: 0;

      white-space: nowrap;
      clip-path: inset(100%);
      clip: rect(0 0 0 0);
      overflow: hidden;

      outline: none;
      outline-offset: 0;
}
