#posts {
  --post_content_card_parent_background_color: var(--background_color_container);
  --post_content_card_background_color: var(--block_background_color);
  --post_content_card_text_color_secondary: var(--text_color_secondary);
  --post_content_card_splitline_color: var(--splitline_color);
  --post_content_card_button_text_color: var(--text_color_highlight);
  --post_content_card_button_background_color: var(--button_background_color);
  --post_content_card_pw_form_input_base_height: 6px;
  --post_content_card_pw_form_input_base_offset: 5px;
  --post_content_card_pw_form_transition_param: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

#posts {
  --inherit_post_lr_offset: 25px;
  --inherit_post_avatar_offset: 50px;
  --post_content_gallery_item_spacing: 4px;
}
:root.mobile #posts {
  --inherit_post_lr_offset: 20px;
}

/* post-content-card */

*.post-content-card {
  display: block;
  box-sizing: border-box;
  width: calc(100% * 2 / 3);
  min-width: calc(320px - (var(--inherit_post_lr_offset) * 2) - var(--inherit_post_avatar_offset));
  border-radius: 5px;
  background-color: var(--post_content_card_background_color);
}

*.post-content-card::after {
  display: block;
  clear: both;
  content: '';
}

/* post-content-gallery */

div.post-content-gallery {
  box-sizing: border-box;
  margin: 4px 0 0;
}

div.post-content-gallery.grid-1 {
  display: block;
  width: calc(100% * 2 / 3);
}

div.post-content-gallery.grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--post_content_gallery_item_spacing);
  width: calc(100% * 2 / 3);
}

div.post-content-gallery.grid-9 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--post_content_gallery_item_spacing);
  width: 100%;
}

div.post-content-gallery > figure.gallery-thumbnail {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  cursor: zoom-in;
}

div.post-content-gallery > figure.gallery-thumbnail > img.thumbnail-image {
  position: absolute;
  left: 0;
  top: 0;
}

/* post-content-gallery gallery-view */

figure.gallery-view {
  position: fixed;
  z-index: 2147483647;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  cursor: zoom-out;
}

figure.gallery-view > span.view-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
  width: 120px;
  height: 1.75rem;
  color: #eaeaea;
  font: bold calc(1rem * 0.875)/1.75rem 'Rounded Mplus 1c', sans-serif;
  text-align: center;
  overflow: hidden;
}

@keyframes view-loading-anim {
  0% {transform: translateX(-100%);}
  100% {transform: translateX(100%);}
}
figure.gallery-view > span.view-loading::after {
  position: absolute;
  left: 0;
  bottom: 0;
  transform: translateX(-100%);
  width: 100%;
  height: 1px;
  background-color: #0267ff;
  animation: view-loading-anim 0.75s ease-in-out infinite;
  content: '';
}

@keyframes view-image-anim {
  0% {opacity: 0;}
  100% {opacity: 1;}
}
figure.gallery-view > img.view-image {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  pointer-events: none;
  animation: view-image-anim 0.25s linear;
}

/* post-content-video */

figure.post-content-video {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 4px 0 0 !important;
  background-color: var(--post_content_card_background_color);
}

figure.post-content-video.vertical,
figure.post-content-video.square {
  width: calc(100% * 2 / 3);
}

figure.post-content-video > video {
  display: block;
  width: 100%;
  object-fit: contain;
}

/* post-content-card content-password-form */

form.content-password-form {
  padding: calc(var(--post_content_card_pw_form_input_base_offset) * 2);
  border: 1px solid var(--post_content_card_parent_background_color);
  background-image: repeating-linear-gradient(135deg, var(--post_content_card_splitline_color) 0, var(--post_content_card_splitline_color) 15px, transparent 0, transparent 30px);
  transition: background-position-x var(--post_content_card_pw_form_transition_param);
}
form.content-password-form:focus-within {
  border-color: var(--post_content_card_button_text_color);
  background-position-x: -20px;
  caret-color: var(--post_content_card_button_text_color);
}

form.content-password-form > div.input {
  position: relative;
}

form.content-password-form > div.input > input {
  display: block;
  width: 100%;
  height: calc(var(--post_content_card_pw_form_input_base_height) * 4);
  padding: calc(var(--post_content_card_pw_form_input_base_height) * 3) 0 calc(var(--post_content_card_pw_form_input_base_height) * 1);
  line-height: calc(var(--post_content_card_pw_form_input_base_height) * 4);
}

form.content-password-form > div.input > input::placeholder {
  color: transparent;
}

form.content-password-form > div.input > label {
  position: absolute;
  left: 0;
  top: calc(var(--post_content_card_pw_form_input_base_height) * 3 + var(--post_content_card_pw_form_input_base_height) * 1 / 2);
  display: block;
  width: 100%;
  height: calc(var(--post_content_card_pw_form_input_base_height) * 3);
  line-height: calc(var(--post_content_card_pw_form_input_base_height) * 3);
  transform-origin: 0 0;
  transition: transform var(--post_content_card_pw_form_transition_param);
  pointer-events: none;
}

form.content-password-form > div.input > input:focus ~ label,
form.content-password-form > div.input > input:not(:placeholder-shown) ~ label {
  transform: scale(0.857) translate(0, calc(var(--post_content_card_pw_form_input_base_height) * 4 * -1));
  color: var(--post_content_card_text_color_secondary);
}

form.content-password-form > div.input > hr {
  position: absolute;
  left: 0;
  bottom: 0;
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--post_content_card_button_text_color);
  transform: scaleX(0);
  opacity: 0;
  transition: transform var(--post_content_card_pw_form_transition_param), opacity var(--post_content_card_pw_form_transition_param);
}

form.content-password-form > div.input > input:focus ~ hr,
form.content-password-form > div.input > input:not(:placeholder-shown) ~ hr {
  transform: scaleX(1);
  opacity: 1;
}

form.content-password-form > div.submit {
  float: right;
  margin: calc(var(--post_content_card_pw_form_input_base_offset) * 2) 0 0;
}

form.content-password-form > div.submit > input {
  display: block;
  padding: calc(var(--post_content_card_pw_form_input_base_height) * 1) calc(var(--post_content_card_pw_form_input_base_height) * 2);
  border-radius: 4px;
  color: var(--post_content_card_button_text_color);
  font-weight: 500;
  background-color: var(--post_content_card_button_background_color);
}

/* post-content-externallink */

div.post-content-externallink {
  width: 100%;
  height: 22px;
  margin: 8px 0 0;
  color: var(--post_content_card_button_text_color);
  font-weight: 500;
  line-height: 22px;
}

div.post-content-externallink::before {
  display: inline;
  float: left;
  width: 18px;
  height: 20px;
  margin: 0 0 2px;
  background-position: 0 50%;
  background-repeat: no-repeat;
  content: '';
}

div.post-content-externallink::before {
  background-image: url(../img/post.externallink.light.svg);
}
:root.darkmode div.post-content-externallink::before {
  background-image: url(../img/post.externallink.dark.svg);
}