/* Font-face */

@font-face {
  font-family: 'Nitti';
  src: url('../fonts/nitti-regular.woff2') format('woff2'),
       url('../fonts/nitti-regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Roslindale';
  src: url('../fonts/roslindale-regular.woff2') format('woff2');
  src: url('../fonts/roslindale-regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Roslindale';
  src: url('../fonts/roslindale-italic.woff2') format('woff2');
  src: url('../fonts/roslindale-italic.woff') format('woff');
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Roslindale';
  src: url('../fonts/roslindale-bold.woff2') format('woff2'),
       url('../fonts/roslindale-bold.woff') format('woff');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

/* Variables */

:root {
  --body: 0.85rem;
  --prose: clamp(1rem, 0.8rem + 0.5vw, 1.1rem);
  --serif: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  --ld: 1.5;
  --base: rgba(0, 0, 0, 0.85);
  --muted: rgba(0, 0, 0, 0.40);
  --line: rgba(0, 0, 0, 0.15);
  --bg: #fffff8;
}

/* Reset */

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base elements */

body {
  display: grid;
  grid-template-columns: 1fr 4fr;
  gap: calc(var(--ld) * 1rem);
  padding: calc(var(--ld) * 0.5rem) calc(var(--ld) * 1rem);
  font: var(--body)/var(--ld) 'Nitti', monospace;
  color: var(--base);
  background: var(--bg);
  min-height: 100vh;
}

body > header {
  border-right: 1px solid var(--line);
}

main {
  flex: 1;
  padding-bottom: calc(var(--ld) * 2rem);
}

footer {
  padding-top: calc(var(--ld) * 0.5rem);
  border-top: 1px solid var(--line);
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

h1, h2 {
  font-size: 1em;
  font-weight: normal;
}

ul {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: underline solid var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: calc(var(--ld) * 0.15rem);
  transition: color 0.2s ease;
}

a:hover {
  color: var(--muted);
}

/* Typography */

p + p {
  margin-top: calc(var(--ld) * 1rem);
}

figcaption {
  margin-top: calc(var(--ld) * 0.25rem);
}

.caption {
  margin-top: calc(var(--ld) * 0.25rem);
  max-width: 40ch;
}

.prose {
  font: var(--prose)/var(--ld) 'Roslindale', serif;
  max-width: 45ch;
  font-variant-numeric: oldstyle-nums;
  margin-top: calc(var(--ld) * -0.25rem);
}

.serif {
  margin-top: calc(var(--ld) * 0.25rem);
  font: var(--serif)/var(--ld) 'Roslindale', serif;
  font-variant-numeric: oldstyle-nums;
}

/* Layout */

.stack-vertical {
  display: flex;
  flex-direction: column;
  gap: calc(var(--ld) * 1rem);
}

.stack-two {
  display: grid;
  grid-template-columns: var(--cols, 1fr 1fr);
  gap: calc(var(--ld) * 1rem);
}

.stack-three {
  display: grid;
  grid-template-columns: var(--cols, repeat(3, 1fr));
  gap: calc(var(--ld) * 1rem);
}

.stack-three-two {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(var(--ld) * 1rem);
}

.stack-four {
  display: grid;
  grid-template-columns: var(--cols, repeat(4, 1fr));
  gap: calc(var(--ld) * 1rem);
}

.stack-three-two > div {
  text-align: center;
}

.stack-three-two a {
  border-bottom: none;
}

.stack-three-two img {
  aspect-ratio: 1;
  object-fit: cover;
}

.stack-center {
  text-align: center;
  margin-inline: auto;
}

.extra-space {
  gap: calc(var(--ld) * 2rem);
}

.text-right {
  text-align: right;
  margin-left: auto;
}

.text-right figcaption,
.text-right .img-caption {
  text-align: left;
}

/* Components */

.masthead {
  min-height: 10vh;
  border-bottom: 1px solid var(--line);
}

.masthead > :last-child {
  margin-left: auto;
}

.masthead nav {
  display: flex;
  gap: 1ch;
}

.pagination {
  align-self: start;
}

.site-title,
.clock {
  display: inline-block;
  border-bottom: none;
}

.data dt {
  margin-top: calc(var(--ld) * 1rem);
}

.data dt:first-child {
  margin-top: 0;
}

.data dt::before {
  content: "> ";
}

.data dd {
  margin-left: 2ch;
}

.data-heading::before {
  content: "> ";
}

.filters li {
  padding-left: 2ch;
}

.filters li::before {
  content: "";
  display: inline-block;
  margin-left: -2ch;
  width: 2ch;
}

.filters li.is-active::before {
  content: "> ";
}

.clock {
  position: fixed;
  bottom: calc(var(--ld) * 0.5rem);
  left: calc(var(--ld) * 1rem);
}

/* Media queries */

@media (max-width: 768px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  body > header {
    border-right: none;
  }
  .stack-two,
  .stack-three,
  .stack-four {
    grid-template-columns: 1fr;
  }
  .stack-three-two {
    grid-template-columns: 1fr 1fr;
  }
  .masthead {
    min-height: 0;
    border-bottom: none;
    gap: 0;
  }
  .masthead > :last-child {
    margin-left: 0;
  }
  .text-right {
    text-align: left;
    margin-left: 0;
  }
  .clock {
    display: none;
  }
}