.box, .post {
  display: block;
  background-color: white;
  border-radius: 15px;
  margin-inline: max(50% - 375px, 5%);
}

body {
  font-family: Courier, monospace;
  background-color: #FFE0CD;
  margin: 0;
  min-width: 370px;
}

#custom-bg {
  position: fixed;
  top: 0;
  min-width: 100%;
  min-height: 100%;
  z-index: -1;
  background-size: cover;
}

button {
  outline: none;
  font: inherit;
  border: none;
  background-color: transparent;
  width: 100%;
}

#custom-bg {
  opacity: 0;
  transition: opacity 0.2s;
  --current-image: 0;
  background-position: center;
}
#custom-bg:has(~ * .post.active-post) {
  opacity: 1;
  background-image: var(--current-image);
}

header {
  margin-block: 10px;
}

.post {
  text-decoration: inherit;
  color: inherit;
  background-size: cover;
  background-position: center;
  margin-block: 17px;
  overflow: hidden;
  position: relative;
}
.post.active-post {
  box-shadow: 0 0 12px 3px #AAAAAA;
}
.post.active-post .post-inner {
  font-size: 24px;
  grid-template-columns: max(13%, 94px) auto;
}
.post.active-post .post-inner .post-person {
  display: none;
}

.post-inner {
  display: grid;
  gap: 6px;
  padding: 17px;
  align-items: center;
  grid-template-columns: max(10%, 75px) auto;
  font-size: 20px;
  transition: font-size 0.05s, grid-template-columns 0.05s;
  z-index: 2;
  position: relative;
}
.post-inner.post-inner-with-person {
  grid-template-columns: max(10%, 75px) auto 50px;
}
.post-inner.post-inner-with-search {
  grid-template-rows: auto 40%;
}

.post-cover {
  position: absolute;
  background-color: white;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.post-title {
  margin: 0;
  font-size: 30px;
}

.post-person {
  rotate: -10deg;
  font-weight: bold;
}

.post-event-date {
  font-weight: bold;
}

.post-edit-date {
  font-size: 0.7em;
}

.post-search-text {
  font-size: 12px;
  font-style: italic;
  grid-column: 1/span 3;
  font-family: Garamond, serif;
}

#title-and-subtitle {
  text-align: center;
  padding: 20px;
}

#title {
  font-weight: normal;
  font-size: 40px;
  margin: 5px 20px 20px;
}

#subtitle {
  font-style: italic;
  font-size: 17px;
  color: grey;
  padding-inline: 10px;
}

.main-content {
  margin-top: 30px;
}

#controls {
  display: flex;
  align-items: stretch;
  height: 40px;
  margin-top: 15px;
  overflow: auto;
}

#controls > * {
  height: 100%;
  font-size: 15px;
  flex-basis: 0;
  user-select: none;
}

#controls > button {
  flex-grow: 0;
  padding-inline: 15px;
  border-left: 1px solid #CCCCCC;
  text-wrap: nowrap;
}

#updown {
  margin: auto;
  transition: scale 0.1s;
  font-size: 17px;
}

input#search {
  background-color: transparent;
  flex-grow: 1;
  box-sizing: border-box;
  border: none;
  font-family: inherit;
  padding-left: 3%;
  display: block;
  box-sizing: border-box;
  border-bottom: 4px solid transparent !important;
  border-top: 4px solid transparent !important;
  min-width: 10px;
}
input#search:focus-visible {
  outline: none;
  border-bottom: 4px solid #EEAAEE !important;
}
