/* Font-face */

@font-face {
  font-family: 'Soehne';
  src: url('../fonts/soehne-buch.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Soehne';
  src: url('../fonts/soehne-buch-kursiv.woff2') format('woff2');
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SoleSerif';
  src: url('../fonts/SoleSerifRoundedSubhead-Regular.woff2') format('woff2'),
       url('../fonts/SoleSerifRoundedSubhead-Regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Variables */

:root {
  --body: 0.85rem;
  --prose: clamp(1.55rem, 1.1rem + 1.8vw, 1.85rem);
  --lead: clamp(1.9rem, 1.25rem + 2.4vw, 2.9rem);
  --serif: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  --ld: 1.2;
  --base: rgba(0, 0, 0, 0.85);
  --muted: rgba(0, 0, 0, 0.45);
  --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;
  gap: calc(var(--ld) * 1rem);
  padding: calc(var(--ld) * 0.5rem) calc(var(--ld) * 1rem);
  font: var(--body)/var(--ld) 'Soehne', sans-serif;
  color: var(--base);
  background: var(--bg);
  min-height: 100vh;
}

body > header {
  border-right: 0;
}

main {
  padding-bottom: calc(var(--ld) * 2rem);
}

img, figure {
  display: block;
  max-width: 100%;
  height: auto;
}

h1 {
  font-size: 1em;
  font-weight: normal;
  color: var(--muted);
}

h2 {
  font: var(--body)/var(--ld) 'Soehne', sans-serif;
  color: var(--muted);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--muted);
}

/* Typography */

p + p,
li + li {
  margin-top: calc((var(--ld) - 1) * 1em);
}

ul {
  list-style: none;
}

figcaption {
  margin-top: calc(var(--ld) * 0.25rem);
}

.prose {
  font: var(--prose)/var(--ld) 'SoleSerif', serif;
  max-width: 50ch;
  font-variant-numeric: oldstyle-nums;
  margin-top: calc(var(--ld) * -0.25rem);
}

.lead {
  font: var(--lead)/var(--ld) 'SoleSerif', serif;
  max-width: 40ch;
  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) 'SoleSerif', serif;
  font-variant-numeric: oldstyle-nums;
}

/* Layout */

.stack-vertical {
  display: flex;
  flex-direction: column;
  gap: calc(var(--ld) * 1rem);
}

.stack-one {
  display: grid;
  grid-template-columns: var(--cols, 1fr);
  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-four {
  display: grid;
  grid-template-columns: var(--cols, repeat(4, 1fr));
  gap: calc(var(--ld) * 1rem);
}

.stack-center {
  text-align: left;
  margin-inline: auto;
}

.stack-center.left {
  margin-inline: 0;
}

.extra-space {
  gap: calc(var(--ld) * 4rem);
}

.text-right {
  text-align: right;
  margin-left: auto;
}

.text-right figcaption {
  text-align: left;
}

.stack-center figcaption {
  text-align: center;
}

/* Components */

.masthead {
  min-height: 10vh;
  border-bottom: 0;
}

.site-title {
  display: inline-block;
}

/* 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-center {
    margin-inline: 0;
  }
  .text-right {
    text-align: left;
    margin-left: 0;
  }
}
