:root {
  --container-width: 700px;
  --content-width: 960px;

  min-width: 320px;

  font-family: "PT Sans", sans-serif;
}

body {
  min-width: inherit;

  padding-left: 15px;
  padding-right: 15px;

  margin-bottom: 120px;
}

header {
  min-width: inherit;
}

p a {
  display: inline-block;

  text-decoration: none;

  background-image: repeating-linear-gradient(
      90deg,
      currentColor,
      currentColor 5px,
      transparent 5px,
      transparent 10px
    ),
    linear-gradient(currentColor, currentColor);
  background-position: 0% 90%;
  background-repeat: no-repeat;
  background-size: 100% 1px, 0% 1px;
  transition: background-size 0.3s;
}

p a:focus,
p a:hover {
  background-size: 100% 1px, 100% 1px;
}

.youtube-lazy {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  cursor: pointer;

  margin-top: 2rem;
  margin-bottom: 3rem;
}

.post-content p > img:last-child {
  margin-bottom: 3rem;
}

.youtube-lazy iframe,
.youtube-lazy .youtube-lazy-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.youtube-lazy-placeholder {
  background-size: cover;
  background-position: center;
}

.play-button {
  width: 7vmax;
  height: 7vmax;
  background: url("/images/youtube.png") no-repeat;
  background-size: contain;
  position: absolute;

  bottom: 2vmax;
  right: 2vmax;
  pointer-events: none;
}

.agent {
  position: relative;
  cursor: help;
  display: inline-block;

  background-size: 100% 1px;
  transition: background-size 0.3s;

  margin-right: 0.1rex;

  text-decoration: none;
  background-image: linear-gradient(white, white),
    repeating-linear-gradient(
      90deg,
      var(--accent-color),
      var(--accent-color) 5px,
      transparent 5px,
      transparent 10px
    );
  background-position: 100% 90%;
  background-repeat: no-repeat;
  background-size: 0% 1px, 100% 1px;
  transition: background-size 0.3s;
}

.agent:hover {
  /* background-size: 0% 1px; */
  background-size: 0% 1px, 0% 1px;
}

.agent:after {
  content: "";
  position: absolute;
  right: -0.5rex;
  top: 0.2rex;

  height: 0.8rex;
  width: 0.8rex;

  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 31"><path fill="%23b40000" d="m0 14 2-7 12 5-1-12h7l-1 12 11-5 2 7-12 3 9 9-6 4-7-10-6 10-6-4 8-9-12-3"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
}

.quote-author a .agent {
    line-height: 1.1;
}

.quote-author a .agent:after {
    top: -0.4rex;
}

.flickity-gallery {
  margin: 2rem 0;
  min-height: 60px;
  position: relative;
  margin-bottom: 3rem;
}

.gallery-cell {
  width: 80%;
  margin: 0 10%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}

.gallery-image {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 8px;
  cursor: zoom-in;
  transition: transform 0.3s;
}

.flickity-viewport.is-pointer-down .gallery-image {
  cursor: grabbing;
}

/* Кнопки навигации слайдера */
.flickity-prev-next-button {
  width: 50px;
  height: 50px;
  background: #1a0dab;
  border-radius: 50%;
  transition: all 0.3s;
  opacity: 0.9;
}

.flickity-prev-next-button:hover {
  opacity: 1;
  transform: scale(1.1);
}

.flickity-prev-next-button .arrow {
  fill: white;
  width: 25px;
  height: 25px;
}

.flickity-page-dots {
  bottom: -35px;
}

.flickity-page-dots .dot {
  background: rgba(26, 13, 171, 0.3);
  width: 14px;
  height: 14px;
  margin: 0 10px;
}

.flickity-page-dots .is-selected {
  background: #1a0dab;
}

.flickity-gallery .flickity-button {
  background: rgba(26, 13, 171, 0.3);
}
.flickity-gallery .flickity-button:hover {
  background: rgba(26, 13, 171, 1);
  transform: translateY(-50%) scale(1.1);
}

/* Стили лайтбокса */
.lightbox-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.97);
  z-index: 9999;
  cursor: zoom-out;
}

.lightbox-container {
  position: relative;
  width: 90%;
  height: 90vh;
  margin: 5vh auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 25px;
  right: 25px;
  background: none;
  border: none;
  color: white;
  font-size: 3.5rem;
  cursor: pointer;
  z-index: 10001;
  opacity: 0.8;
  transition: opacity 0.2s;
  line-height: 1;
}

.lightbox-close:hover {
  opacity: 1;
}

@media (max-width: 768px) {
  .gallery-cell {
    width: 90%;
    margin: 0 5%;
  }

  .flickity-prev-next-button {
    width: 40px;
    height: 40px;
  }

  .lightbox-close {
    font-size: 2.5rem;
    top: 15px;
    right: 15px;
  }
}

.ps__rail-y {
  width: 4px !important;
}

.post-toc .ps__thumb-y {
  background-color: var(--light-tertiary-color);
  width: 4px !important;
}

.post-toc .ps__rail-y:hover > .ps__thumb-y {
  background-color: var(--accent-color-darker);
}

#toc {
  padding-right: 20px;
  scroll-behavior: smooth;

  box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px;
  padding: 5px 15px 15px 15px;
}

#toc li a .agent {
  display: inline-block;
  background-position: 100% 100%;
}

#toc li a .agent:after {
  top: -0.1rex;
}

#toc ul li a.level-2 {
  font-weight: 600;
}

#tooltip {
  position: fixed;
  z-index: 2000;
  background: var(--accent-color, #333);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  pointer-events: none;
  display: none;
  max-width: 320px;
  word-wrap: normal;
  white-space: pre-line;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
  transition: opacity 0.2s;
}

#tooltip::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background: inherit;
  transform: rotate(45deg);
}

#tooltip[data-position="top"]::after {
  bottom: -5px;
  left: 50%;
  margin-left: -5px;
}
#tooltip[data-position="bottom"]::after {
  top: -5px;
  left: 50%;
  margin-left: -5px;
}
#tooltip[data-position="left"]::after {
  right: -5px;
  top: 50%;
  margin-top: -5px;
}
#tooltip[data-position="right"]::after {
  left: -5px;
  top: 50%;
  margin-top: -5px;
}

@media screen and (max-width: 980px) {
  .youtube-lazy {
    margin-top: 1.2rem;
    margin-bottom: 2rem;
  }
}

@media screen and (max-width: 820px) {
  main#content {
    padding: 0 1rem;
  }

  body {
    padding-left: unset;
    padding-right: unset;
  }

  .nav-link a svg {
    margin: -7px auto;
  }
}

.header {
  width: 100vw;
}

.tweet-link-section {
  text-align: right;
  margin: 0;
  margin-top: 0rem;
  margin-bottom: 0.5rem;
  margin-left: 0.5rem;
  opacity: 0.3;
  float: right;
  transition: opacity 0.18s ease;

  position: relative;
  z-index: 1;
}

.tweet-link-section:hover {
  opacity: 1;
}

.tweet-anchor {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  text-decoration: none;
  color: #0f1419;
  border-radius: 4px;
  background: rgba(15, 20, 25, 0.05);
  border: 1px solid rgba(15, 20, 25, 0.08);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1.4;
}

.tweet-anchor:hover {
  background: #0f1419;
  color: #fff;
  border-color: #0f1419;
}

.tweet-anchor::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' aria-hidden='true' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z'/%3E%3C/svg%3E");
  filter: invert(0.3);
  transition: inherit;
}

.tweet-anchor:hover::before {
  filter: invert(1) brightness(2);
}

.tweet-label {
  letter-spacing: -0.01em;
}

@media (max-width: 640px) {
  .tweet-link-section {
    margin: -0.5rem -0.2rem 0.2rem 0.4rem;
    float: none;
  }

  .tweet-anchor {
    padding: 0.2rem 0.4rem;
  }

  .post-title .post-link{
    width: 100%;
  }

  .list-posts .post-title{
    margin-left: 0;
  }
}

.nav-brand.section-findings:after {
  opacity: 0.2;
  /* content: "/ Находки 🕵️"; */
  content: attr(data-subtitle);
  text-transform: lowercase;
  margin-left: 10px;
}
.home-posts .post-title .post-link[href*="/findings/"]:before {
  /* content: "🕵️ "; */
  opacity: 0.4;
}

.nav-brand.section-posts:after {
  opacity: 0.2;
  /* content: "/ Своё"; */
  content: attr(data-subtitle);
  text-transform: lowercase;
  margin-left: 10px;
}


ul.nav-hamburger-list {
  text-align: right;
  padding-right: 20px;
  line-height: 40px;
}

.post-title .post-link,
.post-title .post-date{
  vertical-align: top;
  
  line-height: 1.7;
  letter-spacing: .5px;
  font-size: .9rem;
}

.post-author {
  display: flex;
  align-items: center;
  margin: 0;
  font-size: 1.1rem;
}

.author-avatar {
  border-radius: 50%;
  margin-right: 12px;
}


.prev-next {
  margin-top: 30px;
}
.prev-next:after {
  content: "";
  display: table;
  clear: both;
}

.prev-next .prev-post,
.prev-next .next-post {
  max-width: 48%;
}

.prev-next p a {
  line-height: 1.7;
  letter-spacing: .5px;
}

.quote-author cite a:hover {
    text-decoration: underline;
}

.expandable-quote-container {
  position: relative;
  margin-bottom: 3rem;
}

.expandable-quote-blockquote{
  font-size: .8em;
  /* padding-bottom: 40px; */
}

.quote-hidden-part {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
}

.quote-author {
  text-align: right;
}

.quote-toggle-button {
    position: absolute;
    bottom: 5px;
    /* background-color: #007bff; */
    background: none;
    color: var(--light-secondary-color);
    
    border: none;
    margin-left: 20px;
    padding: 0;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 0.8em;
    cursor: pointer;
    border-radius: 3px;
    transition: color 0.3s ease;
}

.text-expand:before {
  content: "⇣";
  margin-right: 5px;
}

.text-collapse:before {
  content: "⇡";
  margin-right: 5px;
}

.quote-toggle-button:hover {
    color: var(--accent-color);
}