body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;

    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    color: '#6c7279';
    /* -webkit-font-smoothing: anti-aliased; */

    background-color: #fff;
}

*,
*:before,
*:after {
    box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;

}

p {
    margin: 0 0 10px 0;
}   


/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;

    width: 100%;
    height: 100px;
    border-bottom: 2px solid #424242;
    background: #e5e5e5b3;

    box-shadow: 0px 5px 20px #42424250;
}

/* Подложка для устранения просвечивания */
.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #e5e5e5;
    z-index: -1;
}

.header__logo {
    max-width: 80px;
    max-height: 80px;
    margin: 15px 0 15px 30px;
}

.header__title {
    font-family: sans-serif;
    font-size: 33px;
    font-style: italic;
}

.header__inner {
    display: flex;
    align-items: center;
}


/* Preview */
.preview {
    display: flex;
    align-items: center;
    color: #000;
    text-decoration: none;
}



/* Collections */
.collections {
    display: flex;
    justify-content: center;
    margin-left: auto;
    margin-right: 300px;
}

.collection__item {
    position: relative;
    display: inline-block;
    text-decoration: none;

    font-size: 19px;
    color: #333;
    font-weight: bold;

    top: 7px;
    margin-right: 70px;
    padding-bottom: 5px;

    transition: 0.2s;
}

.collection__item:hover {
    transform: scale(1.02);
}

.collection__item::after {
    content: "";
    position: absolute;

    bottom: 0;
    left: 50%;
    width: 0;
    height: 2.5px;

    background-color: #e84545;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.collection__item:hover::after {
    width: 100%;
}

/* User */
.user__actions {
    display: flex;
    max-width: 100px;
    width: 100%;
    justify-content: center;
}

.collections__toggle, .collections__dropdown {
    display: none;
}

.user__action__item img{
    transition: 0.2s;
    margin-left: auto;
    margin-right: 90px;
}

.user__action__item:hover img {
    transform: scale(1.1);
}

/* Recommendations */

.recommendations__title {
    font-size: 24px;
    font-weight: bold;
    font-family:sans-serif;
    text-align: center;

    margin: 80px 0;
    margin-top: 180px;
}


/* Poems */
.poems {
    display: flex;
    flex-wrap: wrap;
}

.poems__item {
    height: 380px;
    width: 27%;
    margin: 0 35px 50px 35px;

    border: 2px solid #ccc0cc;
    border-radius: 10%;

    background-color: #e5e5e5b3;
}

.poems__item:first-child {
    width: 28%;
}

.poem__title {
    font-size: 18px;
    font-family:'Times New Roman', Times, serif;
    font-style: italic;
    font-weight: 600;

    padding: 10px;
    text-align: center;

    display: block;
    width: 100%;
    border-bottom: 2px solid #ccc0cc;
}

.poem__text {
    font-size: 17px;
    line-height: 1.5;
    font-family:'Times New Roman', Times, serif;
    font-style: italic;
    padding: 15px 0 0 20px;
}

.poem__container {
    width: 100%;
    height: 290px;
    border-bottom: 2px solid #ccc0cc;

    overflow: hidden;
    position: relative;
    line-height: 1.5;
}

.poem__container::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 7em;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #ffffffd2);
    pointer-events: none;
}

.poem-container:not(.overflowed)::after {
  display: none;
}

.under__poem {
    display: flex;
    flex-wrap: wrap;
    align-items: center;

    text-align: right;
}

.poem__date {
    font-size: 18px;
    font-family:'Times New Roman', Times, serif;
    font-style: italic;
    color: #000000a0;

    display: flex;
    margin: 12px 0 20px 40px;
}

.poem__actions {
    display: flex;
    align-items: center;

    margin-left: auto;
    padding-right: 30px;
}

.poem__show-more {
    margin-bottom: 5px;
    margin-left: 15px;
    cursor: pointer;
}


/* Затемнение основного экрана (отдельный слой) */
body.overlay-active::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7); /* Полупрозрачный чёрный */
  z-index: 999;
}

/* Раскрытие стихотворения */
.poem-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;

  pointer-events: none;

  box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
}

.poem-overlay:active {
    display: block;
    pointer-events: auto;
}

/* Содержимое */
.poem-content {
  position: relative;
  width: 80%;
  max-width: 720px;
  max-height: 90vh;
  border-radius: 7%;
  overflow-y: auto;
  background: rgb(220, 220, 220);
  opacity: 1;
  border: 3px solid rgb(170, 170, 170);
  pointer-events: auto;

  justify-items: center;
}


.poem-content::-webkit-scrollbar {
    display: block;
    width: 5px;
}
.poem-content::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}
    
.poem-content::-webkit-scrollbar-thumb {
    background-color: #424242;
    border-radius: 4px;
}

.poem-content::-webkit-scrollbar-track-piece:end {
    background: transparent;
    margin-bottom: 12vh;
}

.poem-content::-webkit-scrollbar-track-piece:start {
    background: transparent;
    margin-top: 12vh;
}

/* "Закрыть" */
.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
}

/* Анимация */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.poem-overlay.active {
  display: flex;
  animation: fadeIn 0.3s ease;
  opacity: 1;
}


.poem-inner {
    margin: 25px 0;
    padding: 20px;
    justify-items: center;
    width: 60%;
    line-height: 1.6;

    background: #fff5;
    border-radius: 10px;
    border: 1px solid rgb(170, 170, 170);
}

.poem-title {
    margin-bottom: 16px;
    font-size: 20px;
    font-weight: 600;
    font-family: 'Times New Roman', Times, serif;
    font-style: italic;
}

.poem-text {
    font-family: 'Times New Roman', Times, serif;
    font-style: italic;
    font-size: 19px;
}

.poem-date {
    display: inline-block;
    position: relative;

    margin-top: 25px;

    font-size: 20px;
    font-family:'Times New Roman', Times, serif;
    font-style: italic;
    color: #000000a0;

    /* border-top: 1px solid rgb(170, 170, 170); */
    /* padding-top: 10px; */
}

.poem-date::before {
    content: "";
    position: absolute;
    top: -10px;
    left: -90px;
    right: -90px;

    height: 1px;
    background: rgb(170, 170, 170);
}




/* Media */

@media (max-width: 1140px) {

    /* Header */
    .collections {
        margin-left: 50px;
   }

   .collection__item {
        font-size: 18px;
   }

   /* Poems */
   .poems__item {
        margin-right: 15px;
        width: 300px;
   }

   .poems__item:first-child {
    width: 320px;
    }

   .poem__title {
    font-size: 17px;
   }

   .poem__text {
    font-size: 15px;
   }

   .poem__date {
    font-size: 16px;
   }

   .poem-content {
    max-width: 640px;
   }

   .poem-title {
    font-size: 18px;
   }

   .poem-text {
    font-size: 17px;
   }

   .poem-date {
    font-size: 18px;
   }
}

@media (max-width: 1000px) {

    /* Header */

    .header__logo img{
        width: 55px;
        height: 55px;
    }

    .header__title {
        font-size: 27px;
    }
    .collections {
        margin-left: 50px;
   }

   .collection__item {
        width: 90px;
        font-size: 17px;
   }

   .user__actions {
    position: absolute;
    right: 0;
    top: 25px;
   }

   /* Poems */

   .recommendations__title {
    font-size: 22px;
    margin: 60px 0;
   }

   .poems__item {
        margin-right: -5px;
        width: 340px;
   }

   .poems__item:first-child {
    width: 340px;
    }

   .poem__title {
    font-size: 17px;
   }

   .poem__text {
    font-size: 13px;
   }

   .poem__date {
    font-size: 15px;
   }

   .poem-content {
    max-width: 550px;
   }

   .poem-title {
    font-size: 16px;
   }

   .poem-text {
    font-size: 15px;
   }

   .poem-date {
    font-size: 17px;
   }
}

@media (max-width: 800px) {
    /* Header */

    .header {
        height: 90px;
    }

    .preview {
        margin-top: 5px;
    }

    .header__logo img{
        width: 45px;
        height: 45px;
    }

    .header__title {
        font-size: 24px;
    }

    .collections {
        margin-left: 40px;
   }

   .collection__item {
        font-size: 16px;
   }

   /* Poems */

   .recommendations__title {
    font-size: 22px;
    margin: 60px 0;
   }

   .poems__item {
        margin-right: 10px;
        margin-bottom: 40px;
        width: 310px;
   }

    .poems__item:first-child {
    width: 310px;
    }

   .poem__title {
    font-size: 15px;
   }

   .poem__text {
    font-size: 14px;
   }

   .poem__date {
    font-size: 15px;
   }

   .poem-content {
    max-width: 460px;
   }

   .poem-inner {
    width: 70%;
   }

   .poem-title {
    font-size: 16px;
   }

   .poem-text {
    font-size: 14px;
   }

   .poem-date {
    font-size: 15px;
   }
}

@media (max-width: 414px) {
    /* Header */

    .header {
        height: 70px;
    }

    .header__logo {
        margin-left: 7px;
        margin-right: 5px;
    }

    .header__logo img{
        width: 35px;
        height: 35px;
    }

    .header__title {
        font-size: 18px;
    }

    .collections {
        position: relative;
        margin: 0;
        margin-left: 50px;
   }

    .collection__item:first-child {
    display: inline-block;
    font-size: 18px;
    margin-right: 40px;
   }

    .collection__item {
    display: none;
    }

    /* Стили для кнопки бургер-меню */
    .collections__toggle {
        cursor: pointer;
        font-size: 20px;
        font-weight: bold;
        display: block;
        border: none;
        background: none;
    }

    /* Стили для выпадающего меню */
    .collections__dropdown {
        position: fixed;
        top: 69px;
        right: 0;
        width: 100%;
        background: #fff;
        flex-direction: column;
        align-items: center;
        z-index: 1000;
        overflow: hidden;
        border: 1px solid #ccc0cc;
        border-radius: 5px;
        
        /* Начальное состояние - скрыто */
        max-height: 0;
        opacity: 0;
        transform: translateY(-20px);
        transition: max-height 0.3s ease, opacity 0.2s ease, 
        transform 0.3s ease;
        visibility: hidden;
        display: flex;
    }

    /* Класс для открытого меню */
    .collections__dropdown.active {
        max-height: 200px;
        opacity: 1;
        transform: translateY(0);
        visibility: visible;
    }

    /* Стили для элементов меню */
    .dropdown__item {
        font-family: 'Times New Roman', Times, serif;
        font-size: 18px;
        font-weight: 600;
        padding: 15px 10px;
        color: #333;
        text-decoration: none;
        transition: color 0.3s ease;
        border: 1px solid #ccc0cc;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    .dropdown__item:first-child {
        border-top-left-radius: 5px;
        border-top-right-radius: 5px;
        border-bottom: none;
    }

    .dropdown__item:last-child {
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
    }

    .dropdown__item:hover {
        color: #007bff;
    }

    .user__action__item img {
    margin: 0;
    margin-right: 15px;
    width: 30px;
    height: 30px;
   }


   /* Poems */

   .recommendations__title {
    font-size: 21px;
    margin: 120px 0 50px 0;
   }

   .poems {
    align-items: center;
   }

   .poems__item {
        justify-content: center;
        margin-right: 10px;
        margin-left: 10px;
        margin-bottom: 40px;
        width: 350px;
   }

    .poems__item:first-child {
        width: 350px;
    }

   .poem__title {
    font-size: 14px;
   }

   .poem__text {
    font-size: 13px;
   }

   .poem__date {
    font-size: 15px;
   }

   .poem-content {
    width: 320px;
    max-height: 520px;
   }

   .poem-inner {
    width: 90%;
   }

   .poem-title {
    font-size: 14px;
   }

   .poem-text {
    font-size: 13px;
   }

   .poem-date {
    font-size: 14px;
   }
}