/* =================공통================== */
.main_sec .inner {
    display: flex;
    justify-content: space-between;
}
.main-title {
    color: white;
    text-align: left;
}
.main-sub_title {
    color: var(--primary-100);
    text-align: left;
}

.page_content-area {
    grid-template-columns: 260px 1fr;
}
.sec-header {
    margin-bottom: var(--con-gap);
    text-shadow: 0 0 20px #31363d;
}

/* bg */
.page-bg {
    position: fixed;
    top: 0;
    z-index: 0;
    width: 100%;
    height: 100dvh;
    background: linear-gradient(to bottom, #7A99C5, #C7DBEA);
    filter: brightness(0.8);
}
.page-bg .bg {
    width: 100%;
    height: 120%;
    mask: linear-gradient(to top, white 50%, transparent);
    -webkit-mask: linear-gradient(to top, white 50%, transparent);
    border-radius: 0;
}
.flower_bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* audio-player */
.audio-player {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 20px;
    /* transform: rotate(90deg) translateX(-100%); */
    /* mix-blend-mode: difference; */
    color: white;
    z-index: 4;
    font-size: var(--ft16);
    padding-bottom: 10vh;
    bottom: 0;
    width: fit-content;
    left: 60px;
    position: sticky;
}
.audio-title {
    writing-mode: vertical-rl;
}
.audio-btn {
    width: 32px;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid var(--primary-200);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transform: rotate(90deg);
}


.audio-btn .icon {
    width: 20px;
    height: 20px;
}

.audio-btn .icon img {
    display: none;
}

.audio-btn .icon .pause_icon {
    display: block;
}

.audio-btn.off .icon .pause_icon {
    display: none;
}

.audio-btn.off .icon .play_icon {
    display: block;
}

.audio-visualizer {
    width: 32px;
    height: 32px;
    padding: 8px 6px;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 2px;
}

.audio-visualizer span {
    display: block;
    width: 2px;
    height: 100%;
    background: var(--primary-100);
    animation: bounce 1s infinite ease-in-out;
    transform-origin: bottom;
    transform: scaleY(0.3);
}

.audio-visualizer span:nth-child(1) {
    animation-delay: 0s;
}

.audio-visualizer span:nth-child(2) {
    animation-delay: 0.2s;
}

.audio-visualizer span:nth-child(3) {
    animation-delay: 0.4s;
}

.audio-visualizer span:nth-child(4) {
    animation-delay: 0.6s;
}

.audio-player:has(.audio-btn.off) .audio-visualizer span {
    animation-play-state: paused;
}

@keyframes bounce {

    0%,
    100% {
        transform: scaleY(0.3);
    }

    50% {
        transform: scaleY(1);
    }
}

/* tribute */
.tribute_sec {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-shadow: 0 0 10px #31363d;
}

.tribute-flower {
    width: 120px;
    height: auto;
    margin-bottom: 20px;
}

.tribute-count {
    margin-bottom: 30px;
    text-align: center;
}

.tribute-count .count-num {
    font-size: var(--ft46);
    color: white;
    font-family: var(--ft-serif);
    font-weight: var(--bold);
}

.tribute-count .count-text {
    font-size: var(--ft16);
    color: var(--primary-100);
    margin-top: 10px;
}

.tribute-desc {
    font-size: var(--ft16);
    color: var(--gray-400);
    margin-bottom: 30px;
}

.tribute-btn {
    width: 100px;
    height: 100px;
    aspect-ratio: 1;
    background: #ffffffdd;
    box-shadow: 0 0 20px rgb(255 253 198 / 80%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 99px;
    padding: 10px 20px;
    transition: all .3s ease;
    animation: bubble 1s linear infinite;
}
@keyframes bubble {
    0%, 100% {transform: scale(1);}
    50% {transform: scale(.9);}
}

.tribute-btn.active {
    box-shadow: 0 0 20px rgb(255 253 198 / 0);
    animation-play-state: paused;
}
.tribute-btn > .img {
    object-fit: contain;
    filter: invert(1);
    transform: translateX(2%);
}
.tribute-btn .btn-icon {
    border: 0;
    width: 30px;
    height: 30px;
    rotate: -5deg;
    background: white;
    mask: url('/images/deco_f_1.svg') no-repeat center / contain;
    -webkit-mask: url('/images/deco_f_1.svg') no-repeat center / contain;
}

/* board */
.write-btn {
    width: 100%;
    height: 56px;
    max-width: 220px;
    background: var(--gray-600);
    color: var(--white);
    font-size: var(--ft16);
    font-weight: var(--semi-bold);
}
.write-btn:hover {
    transition: filter .3s ease;
    filter: opacity(.8);
}
.board_control {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 60px;
}

.board_control .input_box {
    width: 300px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--gray-600);
    padding-left: 10px;
}

.board_control .input_box .search-input {
    font-size: var(--ft18);
    flex: 1 0 0;
}

.board_control .input_box .search-btn {
    width: var(--icon-btn-sm);
    height: var(--icon-btn-sm);
    flex-shrink: 0;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.board_control .input_box .search-btn .icon {
    width: 20px;
    height: 20px;
}

/* ==== board 익명추모글 ==== */

.sec-content {
    display: flex;
    flex-direction: column;
}
.post_control {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: var(--con-gap);
}
.memorial-post {
    /* width: 100%; */
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 200px));
    justify-content: space-around;
    gap: var(--con-gap);
    grid-auto-rows: 100px;
    padding: 0 100px;
    /* 기본 row 높이 */
}

.mpost-item {
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-radius: 12px;
    
    /* 약간 랜덤 회전 */
    break-inside: avoid;
    grid-row: span 2;
}


.mpost-item:nth-child(3n + 1) {
    justify-content: center;
}
.mpost-item:nth-child(3n + 2) {
    justify-content: end;
}
.mpost-item:nth-child(3n) {
    justify-content: start;
}
.mpost-item:nth-child(4n + 1) {
    --i: 2;
}
.mpost-item:nth-child(4n + 2) {
    --i: 0;
}
.mpost-item:nth-child(4n + 3) {
    --i: 1;
}
.mpost-item:nth-child(4n) {
    --i: -1;
}


.mpost-box {
    padding: 30% 0;
    gap: 40px;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    cursor: pointer;
    background: url('/images/letter.svg') no-repeat center / contain;
    display: flex;
    align-items: start;
    justify-content: center;
    transform: rotate(calc(-5deg + 10deg * var(--i)));
    transition: transform .5s ease, filter .5s ease;
    filter: drop-shadow(14px 40px 20px #00000040);
}
.mpost-box.lock {
    background: url('/images/letter_lock.svg') no-repeat center / contain;
}
.mpost-item:hover .mpost-box {
    transform: scale(1.1) rotate(0) translate(-4px, -4px);
    filter: drop-shadow(6px 40px 20px #00000020);
}

.mpost-num {
    width: 60px;
    flex-shrink: 0;
    text-align: center;
    color: var(--primary-500);
    font-size: var(--ft16);
}

.mpost-title { 
    display: flex;
    align-items: center;
    flex-direction: column;
    min-width: 0;
    padding: 0 20px;
    text-align: center;
}
.mpost-title > div {
    width: 100%;
}
.mpost-title .title {
    color: var(--ft-main);
    font-size: var(--ft18);
    margin-bottom: 6px;
}
.mpost-title .name {
    color: var(--ft-main);
    font-size: var(--ft15);
}

.mpost-title .icon {
    width: 22px;
    height: auto;
    aspect-ratio: 1;
    display: inline-block;
    flex-shrink: 0;
    margin-top: 10px;
}



.memorial-board {
    width: 100%;
    border-top: 1px solid var(--primary-400);
}

.mboard-item {
    cursor: pointer;
}

.mboard-header {
    display: flex;
    align-items: center;
    padding: 30px 0;
    gap: 40px;
    border-bottom: 1px solid var(--primary-300);
}

.mboard-num {
    width: 60px;
    flex-shrink: 0;
    text-align: center;
    color: var(--primary-500);
    font-size: var(--ft16);
}

.mboard-title {
    font-size: var(--ft18);
    color: var(--ft-main);
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.mboard-title .icon {
    width: 22px;
    height: auto;
    aspect-ratio: 1;
    display: inline-block;
    opacity: .5;
}

.mboard-name {
    font-size: var(--ft18);
    color: var(--ft-sub);
    flex-shrink: 0;
}

.mboard-date {
    font-size: var(--ft16);
    flex-shrink: 0;
    color: var(--gray-400);
}


/* ===== room 하늘추모관 ==== */
.memorial-room {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-rows: 10px;
    gap: 100px;
    grid-auto-flow: dense;
    justify-content: center;
}

.mroom-item {
    height: fit-content;
}

.mroom-item a {
    background: var(--white);
    box-shadow: 16px 30px 40px 0 #5C403316;
    transition: all .3s ease;
}

.mroom-item a:hover {
    box-shadow: 16px 30px 40px 0 #5C403316, 0 0 0 1px var(--primary-400);
}

f .mroom-img {
    width: 100%;
    height: auto;
    /* aspect-ratio: 1; */
    background: var(--img);
}

/* 
.mroom-item:nth-child(2) {
    padding-top: calc(var(--con-gap) * 2);
}
.mroom-item:nth-child(3) {
    padding-top: var(--con-gap);
} */

/* .mroom-item:nth-child(4n+1) .mroom-img {
    aspect-ratio: 1 / 1.2;
}
.mroom-item:nth-child(5n+1) .mroom-img {
    aspect-ratio: 1.2 / 1;
} */

.mroom-text_box {
    padding: 30px 20px;
}

.mroom-name {
    font-size: var(--ft24);
    color: var(--ft-main);
    margin-bottom: 14px;
    font-family: var(--ft-serif);
    font-weight: var(--medium);
    text-align: center;
}

.mroom-date {
    color: var(--primary-400);
    font-size: var(--ft16);
    font-family: var(--ft-serif);
    text-align: center;
}



/* 하늘편지작성하기 폼 */
.popup-box.lg {
    max-width: var(--container-sm);
}

.popup-con {
    padding-bottom: 40px;
    max-height: 60vh;
    overflow-y: auto;
}

.form_list {
    display: flex;
    align-items: start;
    gap: 30px;
    flex-direction: column;
}

.form_item {
    width: 100%;
}

.form_title {
    margin-bottom: 6px;
    display: block;
    font-size: var(--ft16);
}

.input_wrap {
    display: flex;
    gap: 20px;
    align-items: center;
}

.popup-con .input_box {
    border: 1px solid var(--gray-300);
    width: 100%;
    height: var(--input-height-sm);
    padding: 0 20px;
}

.popup-con .input_box.editor {
    height: 300px;
}

.popup-con .input_box input {
    height: 100%;
}

.popup-con .input_box textarea {
    width: 100%;
    height: 100%;
    resize: none;
    padding: 20px 0;
}

.popup-con .input_box:has(textarea) {
    width: 100%;
    height: 200px;
}

.form_bot:not(.row) {
    flex-direction: column;
}

.form_secret {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.form_secret .input_box {
    flex: 0 0 200px;
}

.form_btn_wrap {
    width: 100%;
    display: flex;
}

.form_note {
    font-size: var(--ft14);
    color: var(--gray-400);
    margin-top: 20px;
}

.form_note li {
    list-style: inside;
}
/* .write_letter-popup::after {
    content: '';
    display: block;
    position: absolute;
    width: 20px;
    top: 20%;
    height: 20px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    z-index: 3;
    transform: scale(0);
    pointer-events: none;
    box-shadow: 0 0 20px #ffffff20, 0 0 10px #ffffff40;
} */
.write_letter-popup::after {
    content: '';
    display: block;
    position: absolute;
    top: 20%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, #fff 0%, #fff0 70%);
    border-radius: 50%;
    opacity: 0;
    z-index: 3;
    transform: scale(0);
    pointer-events: none;
    box-shadow: 0 0 20px #ffffff20, 0 0 10px #ffffff40;
}
.write_letter-popup.hide::after {
    animation: twinkle 1s ease-out .8s forwards;
    pointer-events: visible;
}
@keyframes twinkle {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    30% {
        opacity: 1;
        transform: scale(1.5);
    }
    1000% {
        opacity: 1;
        transform: scale(0);
    }
    /* 90% {
        opacity: 1;
        transform: scale(0);
        box-shadow:
        30px 40px 2px #fff,
        -25px 60px 1.5px #fff,
        50px 10px 2.5px #fff,
        -40px 80px 1.2px #fff,
        60px 50px 1.8px #fff;
    } */
    
}
/* 하늘편지 보기 */
.view_letter-popup .popup-title {
    font-size: var(--ft22);
}
.view_letter-popup .lettter_date {
    text-align: center;
    font-size: var(--ft14);
    color: var(--gray-400);
    text-align: right;
    margin-bottom: 20px;
}
.view_letter-popup .popup-con {
    padding-top: 10px;
    padding-bottom: 30px;
}

.view_letter-popup .letter_desc {
    font-size: var(--ft18);
    color: var(--ft-sub);
    padding-bottom: 30px;
}
.view_letter-popup .letter_name {
    font-size: var(--ft16);
}

/* 비밀번호입력모달 */
.modal .input_box {
    border: 1px solid var(--gray-300);
    width: 100%;
    height: var(--input-height-sm);
    margin-top: 20px;
}
.modal .input_box:has(input:focus) {
    border-color: var(--primary);
}
.modal .input_box input {
    height: 100%;
    padding: 0 20px;
}
.error-msg {
    color: var(--warning);
    font-size: 14px;
    margin-top: 10px;
    display: none;
}



@media all and (max-width: 1600px) {
    .memorial-post {
        padding: 0;
        /* grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); */
    }
}
@media all and (max-width: 1200px) {
    .audio-player  {
        left: 40px;
    }
}
@media all and (max-width: 960px) {
    
    .main_sec .inner {
        flex-direction: column;
        align-items: center;
    }
    .main-title,
    .main-sub_title {
        text-align: center;
    }
    .memorial-post {
        grid-template-columns: repeat(3, minmax(150px, 180px));
    }
}
@media all and (max-width: 600px) {
    .memorial-post {
        grid-template-columns: repeat(2, minmax(130px, 180px));
        gap: 20px;
    }
    
}
@media all and (max-width: 500px) {
    .page-bg {
        height: 100%;
    }
    .audio-player  {
        left: 10px;
    }
    .mpost-box {
        filter: drop-shadow(6px 14px 16px #00000020);
    }
    .form_secret {
        flex-direction: column;
        align-items: start;
    }
    .form_secret .input_box {
        flex: unset;
    }
    
}