/*
 Theme Name:   Kadence Child
 Theme URI:    https://kadencewp.com
 Description:  Kadence Child Theme
 Author:       Your Name
 Author URI:   https://yourdomain.com
 Template:     kadence
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://gnu.org
 Text Domain:  kadence-child
*/

/* =====================================================
   변수
   ===================================================== */

:root {
    --m-text: #333;
    --m-strong: #555;
    --m-muted: #777;
    --m-soft: #888;
    --m-bg: #faf9f6;
    --m-border: #e3ded5;
    --m-white: #fff;
    --m-sub: #666;
    --m-body: #444;
}


/* =====================================================
   온라인 추모관 기본
   ===================================================== */

.memorial-container {
    max-width: 1050px;
    margin: 50px auto;
    padding: 50px;
    background: var(--m-white);
    border: 1px solid var(--m-border);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.07);
    box-sizing: border-box;
}

.memorial-header {
    text-align: center;
    margin-bottom: 45px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e5e1da;
}

.memorial-title {
    margin: 0;
    font-size: 38px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--m-text);
    letter-spacing: 2px;
}

.memorial-hanja {
    margin-top: 8px;
    font-size: 19px;
    color: var(--m-muted);
    letter-spacing: 2px;
}

.memorial-symbol {
    margin-top: 18px;
    font-size: 13px;
    color: #999;
    letter-spacing: 3px;
}


/* =====================================================
   영정사진 + 기본정보
   ===================================================== */

.memorial-profile {
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: 50px;
    align-items: start;
    margin-bottom: 50px;
}

.memorial-photo {
    text-align: center;
    padding: 10px;
}

.memorial-photo img {
    display: block;
    width: 280px;
    height: 350px;
    margin: 0 auto;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #d9d5cd;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.memorial-info {
    border-top: 2px solid var(--m-strong);
}

.memorial-row {
    display: flex;
    align-items: center;
    min-height: 55px;
    padding: 9px 15px;
    box-sizing: border-box;
    border-bottom: 1px solid #eee;
}

.memorial-row:nth-child(odd) {
    background: var(--m-bg);
}

.memorial-row span {
    flex: 0 0 125px;
    font-size: 15px;
    font-weight: 600;
    color: var(--m-muted);
}

.memorial-row strong {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: var(--m-text);
    word-break: keep-all;
}


/* =====================================================
   공통 섹션 (생전 약력 / 추모 사진)
   ===================================================== */

.memorial-biography,
.memorial-gallery {
    padding-top: 35px;
    border-top: 2px solid var(--m-strong);
}

.memorial-biography {
    margin-top: 45px;
}

.memorial-gallery {
    margin-top: 50px;
}

.memorial-biography h2,
.memorial-gallery h2 {
    margin: 0 0 25px;
    padding-left: 15px;
    border-left: 5px solid var(--m-muted);
    font-size: 23px;
    font-weight: 700;
    color: var(--m-text);
}

.biography-content {
    padding: 25px 30px;
    background: var(--m-bg);
    border: 1px solid #ebe7df;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.9;
    color: var(--m-body);
    word-break: keep-all;
}


/* =====================================================
   추모 사진 Gallery
   (!important: 테마/Elementor 이미지 스타일 덮어쓰기용으로 유지)
   ===================================================== */

.memorial-gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.memorial-gallery-item {
    overflow: hidden !important;
    border-radius: 6px;
    border: 1px solid #e1ddd5;
    background: var(--m-white);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
}

.memorial-gallery-item a {
    display: block !important;
}

.memorial-gallery-item img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 220px !important;
    margin: 0 !important;
    object-fit: cover !important;
    transition: transform 0.3s ease;
}

.memorial-gallery-item:hover img {
    transform: scale(1.04);
}


/* =====================================================
   Lightbox
   기본 상태에서는 반드시 숨기고, JS가 .active 를 붙일 때만 표시
   ===================================================== */

.memorial-lightbox-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999999;
}

.memorial-lightbox-overlay.active {
    display: flex;
}

body.memorial-lightbox-open {
    overflow: hidden;
}

.memorial-lightbox-content {
    width: 90vw;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.memorial-lightbox-image {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 85vw !important;
    max-height: 68vh !important;
    margin: 0 auto !important;
    object-fit: contain !important;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
}

/* 사진 번호 */
.memorial-lightbox-counter {
    margin-top: 10px;
    color: var(--m-white);
    font-size: 14px;
    text-align: center;
}

/* 썸네일 */
.memorial-lightbox-thumbnails {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 850px;
    margin-top: 15px;
    padding: 5px 10px 10px;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.45) rgba(255, 255, 255, 0.1);
}

.memorial-lightbox-thumb {
    flex: 0 0 auto;
    width: 90px;
    height: 70px;
    padding: 2px;
    border: 2px solid transparent;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    overflow: hidden;
    box-sizing: border-box;
    transition: border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.memorial-lightbox-thumb img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    object-fit: cover !important;
    border-radius: 2px;
}

.memorial-lightbox-thumb:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

.memorial-lightbox-thumb.active {
    border-color: var(--m-white);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}

/* 닫기 / 이전 / 다음 버튼 공통 */
.memorial-lightbox-close,
.memorial-lightbox-prev,
.memorial-lightbox-next {
    position: absolute;
    padding: 0;
    border: none;
    background: rgba(0, 0, 0, 0.45);
    color: var(--m-white);
    box-shadow: none;
    cursor: pointer;
    z-index: 1;
}

.memorial-lightbox-close:hover,
.memorial-lightbox-prev:hover,
.memorial-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
    color: var(--m-white);
    box-shadow: none;
}

.memorial-lightbox-close {
    top: 25px;
    right: 30px;
    width: 50px;
    height: 50px;
    font-size: 38px;
    line-height: 45px;
    border-radius: 50%;
}

.memorial-lightbox-prev,
.memorial-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 55px;
    height: 70px;
    font-size: 42px;
    border-radius: 5px;
}

.memorial-lightbox-prev {
    left: 25px;
}

.memorial-lightbox-next {
    right: 25px;
}


/* =====================================================
   온라인 추모관 검색 - 검색창 (PHP 숏코드 + Elementor 공용)
   ===================================================== */

.memorial-search-box {
    max-width: 800px;
    margin: 50px auto 40px;
    padding: 45px 40px;
    text-align: center;
    background: var(--m-bg);
    border: 1px solid var(--m-border);
    border-radius: 10px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.06);
}

.memorial-search-title {
    margin-bottom: 12px;
    font-size: 32px;
    font-weight: 700;
    color: var(--m-text);
}

.memorial-search-description {
    margin-bottom: 28px;
    font-size: 16px;
    color: var(--m-muted);
}

.memorial-search-form {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.memorial-search-form input {
    flex: 1;
    min-width: 0;
    height: 52px;
    padding: 0 18px;
    font-size: 16px;
    border: 1px solid #d5d0c7;
    border-radius: 5px;
    background: var(--m-white);
    box-sizing: border-box;
}

.memorial-search-form input:focus {
    outline: none;
    border-color: var(--m-muted);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.memorial-search-form button {
    width: 100px;
    height: 52px;
    padding: 0;
    border: none;
    border-radius: 5px;
    background: var(--m-strong);
    color: var(--m-white);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.memorial-search-form button:hover {
    background: var(--m-text);
    color: var(--m-white);
    box-shadow: none;
}

/* Elementor 검색 영역 */
.memorial-search-wrap {
    width: 70%;
    max-width: 900px;
    margin: 0 auto;
    box-sizing: border-box;
}

.memorial-search-wrap h2,
.memorial-search-wrap > p {
    text-align: center;
}

.memorial-search-wrap .memorial-search-form {
    width: 100%;
    margin: 20px auto;
}


/* =====================================================
   검색 결과 - 목록형 (PHP 숏코드 마크업)
   ===================================================== */

.memorial-search-results {
    max-width: 800px;
    margin: 0 auto 60px;
}

.memorial-search-results > h2 {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--m-strong);
    font-size: 22px;
    color: var(--m-text);
}

.memorial-search-result {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 18px;
    padding: 20px;
    background: var(--m-white);
    border: 1px solid var(--m-border);
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);
}

.memorial-search-photo {
    flex: 0 0 110px;
}

.memorial-search-photo img {
    display: block;
    width: 110px;
    height: 135px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ddd8d0;
}

.memorial-search-info {
    flex: 1;
}

.memorial-search-info h3 {
    margin: 0 0 8px;
    font-size: 22px;
    color: var(--m-text);
}

.memorial-search-info h3 a {
    color: var(--m-text);
    text-decoration: none;
}

.memorial-search-info h3 a:hover {
    text-decoration: underline;
}

.memorial-search-hanja {
    margin-left: 8px;
    font-size: 15px;
    font-weight: 400;
    color: var(--m-soft);
}

.memorial-search-date {
    margin-bottom: 6px;
    font-size: 15px;
    color: var(--m-sub);
}

.memorial-search-branch {
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--m-soft);
}

.memorial-search-field {
    margin: 5px 0;
    font-size: 14px;
    color: var(--m-sub);
}

.memorial-search-field span {
    display: inline-block;
    width: 45px;
    font-weight: 600;
    color: var(--m-soft);
}

.memorial-search-field strong {
    font-weight: 500;
    color: var(--m-body);
}

.memorial-search-button {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 4px;
    background: var(--m-strong);
    color: var(--m-white) !important;
    font-size: 14px;
    text-decoration: none !important;
}

.memorial-search-button:hover {
    background: var(--m-text);
}

/* 검색 결과 없음 */
.memorial-no-result {
    padding: 40px 20px;
    text-align: center;
    background: var(--m-bg);
    border: 1px solid var(--m-border);
    border-radius: 8px;
}

.memorial-no-result strong {
    display: block;
    margin-bottom: 8px;
    font-size: 18px;
    color: var(--m-strong);
}

.memorial-no-result p {
    margin: 0;
    color: var(--m-soft);
}

/* 검색 안내 / 오류 */
.memorial-search-message {
    max-width: 800px;
    margin: 25px auto;
    padding: 18px 20px;
    text-align: center;
    border-radius: 6px;
}

.memorial-search-message.error {
    background: #faf4f4;
    border: 1px solid #e4cccc;
    color: #844;
}


/* =====================================================
   검색 결과 - 카드형 (Elementor 마크업)
   .memorial-result-card 가 있는 결과 컨테이너에만 grid 적용
   → 목록형(PHP)과 충돌하지 않음
   ===================================================== */

.memorial-search-results:has(.memorial-result-card) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 24px;
    align-items: stretch;
}

.memorial-result-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    background: var(--m-white);
    box-sizing: border-box;
}

.memorial-result-image {
    display: block;
    flex: none;
    width: 100%;
}

.memorial-result-photo,
.memorial-no-photo {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 5px;
    box-sizing: border-box;
}

.memorial-no-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f1f1;
    color: var(--m-sub);
}

.memorial-result-info {
    width: 100%;
    min-width: 0;
}

.memorial-result-info h3 {
    margin: 0 0 8px;
    font-size: 18px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.memorial-result-info p {
    margin: 5px 0;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.memorial-detail-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
}


/* =====================================================
   고인 상세 페이지 - 이동 버튼
   ===================================================== */

.memorial-navigation {
    display: flex !important;
    justify-content: center !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    margin: 24px auto !important;
    text-align: center;
    box-sizing: border-box;
}

.memorial-navigation a {
    display: inline-block;
    padding: 11px 18px;
    border: 1px solid #c9c9c9;
    border-radius: 6px;
    background: #f7f7f7;
    color: var(--m-text);
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.5;
    transition: background-color 0.2s;
}

.memorial-navigation a:hover {
    background: #e9e9e9;
    color: #111;
}


/* =====================================================
   비밀번호 보호 화면
   ===================================================== */

.memorial-protected-shell {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 900px;
    min-height: 600px;
    margin: 35px auto;
    padding: 45px 24px;
    text-align: center;
    background: var(--m-white);
}

.memorial-protected-title {
    width: 100%;
    margin: 0 auto 24px;
    text-align: center;
}

.memorial-protected-title h1 {
    margin: 0 0 6px;
    padding: 0;
    font-size: clamp(28px, 4vw, 36px);
    line-height: 1.35;
    font-weight: 700;
    color: #222;
}

.memorial-protected-hanja {
    margin-top: 3px;
    color: var(--m-sub);
    font-size: 21px;
    line-height: 1.6;
    letter-spacing: 2px;
}

.memorial-protected-divider {
    width: 100%;
    max-width: 360px;
    margin: 12px auto 24px;
    border: 0;
    border-top: 1px solid #ddd;
}

.memorial-protected-message {
    margin: 0 0 20px;
    color: var(--m-strong);
    font-size: 16px;
    line-height: 1.7;
}

.memorial-password-area {
    box-sizing: border-box;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    padding: 25px;
    background: var(--m-white);
    border: 1px solid #ddd;
    border-radius: 8px;
}

.memorial-password-area form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
}

.memorial-password-area input[type="password"] {
    box-sizing: border-box;
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
}

.memorial-password-area input[type="submit"] {
    width: 100%;
    min-height: 48px;
    padding: 12px 18px;
    border: 0;
    border-radius: 6px;
    background: var(--m-text);
    color: var(--m-white);
    box-shadow: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.memorial-password-area input[type="submit"]:hover {
    background: var(--m-strong);
    color: var(--m-white);
    box-shadow: none;
}

@media (max-width: 600px) {
    .memorial-protected-shell {
        width: 94%;
        min-height: 520px;
        margin: 20px auto;
        padding: 32px 16px;
    }

    .memorial-protected-hanja {
        font-size: 19px;
    }
}


/* =====================================================
   Responsive (900 / 700 / 400 세 단계로 통합)
   ===================================================== */

@media (max-width: 900px) {

    .memorial-container {
        margin: 30px 20px;
        padding: 35px;
    }

    .memorial-profile {
        grid-template-columns: 260px 1fr;
        gap: 30px;
    }

    .memorial-photo img {
        width: 230px;
        height: 290px;
    }

    .memorial-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .memorial-search-results:has(.memorial-result-card) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .memorial-result-card .memorial-result-photo,
    .memorial-result-card .memorial-no-photo {
        height: 190px;
    }
}


@media (max-width: 700px) {

    /* 기본 */
    .memorial-container {
        margin: 20px 10px;
        padding: 25px 18px;
        border-radius: 8px;
    }

    .memorial-header {
        margin-bottom: 30px;
        padding-bottom: 25px;
    }

    .memorial-title {
        font-size: 29px;
        letter-spacing: 1px;
    }

    .memorial-hanja {
        font-size: 17px;
    }

    .memorial-profile {
        display: block;
        margin-bottom: 35px;
    }

    .memorial-photo {
        margin-bottom: 30px;
    }

    .memorial-photo img {
        width: 210px;
        height: 270px;
    }

    
    
  
    /* 모바일 고인 정보: 항목명과 내용을 한 줄에 배치 */
    .memorial-row {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        min-height: auto;
        padding: 12px 10px;
        box-sizing: border-box;
    }

    .memorial-row span {
        display: block;
        flex: 0 0 88px;
        width: auto;
        margin-bottom: 0;
        font-size: 14px;
        line-height: 1.7;
        word-break: keep-all;
    }

    .memorial-row strong {
        display: block;
        flex: 1 1 0;
        min-width: 0;
        font-size: 15px;
        line-height: 1.7;
        font-weight: 500;
        overflow-wrap: anywhere;
        word-break: normal;
    }
  
 
      
    
    

    /* 약력 / 갤러리 */
    .memorial-biography,
    .memorial-gallery {
        margin-top: 35px;
        padding-top: 28px;
    }

    .memorial-biography h2,
    .memorial-gallery h2 {
        font-size: 21px;
    }

    .biography-content {
        padding: 20px 15px;
        font-size: 15px;
        line-height: 1.8;
    }

    .memorial-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .memorial-gallery-item img {
        height: 150px !important;
    }

    /* Lightbox */
    .memorial-lightbox-content {
        width: 96vw;
    }

    .memorial-lightbox-image {
        max-width: 92vw !important;
        max-height: 62vh !important;
    }

    .memorial-lightbox-thumbnails {
        justify-content: flex-start;
        gap: 7px;
        max-width: 95vw;
        margin-top: 12px;
    }

    .memorial-lightbox-thumb {
        width: 70px;
        height: 55px;
    }

    .memorial-lightbox-prev,
    .memorial-lightbox-next {
        width: 42px;
        height: 55px;
        font-size: 30px;
    }

    .memorial-lightbox-prev {
        left: 7px;
    }

    .memorial-lightbox-next {
        right: 7px;
    }

    .memorial-lightbox-close {
        top: 10px;
        right: 10px;
        width: 42px;
        height: 42px;
        font-size: 30px;
        line-height: 37px;
    }

    .memorial-lightbox-counter {
        margin-top: 8px;
        font-size: 13px;
    }

    /* 검색창 */
    .memorial-search-box {
        margin: 30px 10px;
        padding: 30px 20px;
    }

    .memorial-search-title {
        font-size: 27px;
    }

    .memorial-search-form {
        flex-direction: column;
    }

    .memorial-search-form input,
    .memorial-search-form button {
        width: 100%;
    }

    .memorial-search-wrap {
        width: 100%;
    }

    /* 검색 결과 - 목록형 */
    .memorial-search-results {
        margin-left: 10px;
        margin-right: 10px;
    }

    .memorial-search-result {
        gap: 15px;
        padding: 15px;
    }

    .memorial-search-photo {
        flex: 0 0 80px;
    }

    .memorial-search-photo img {
        width: 80px;
        height: 100px;
    }

    .memorial-search-info h3 {
        font-size: 18px;
    }

    .memorial-search-hanja {
        display: block;
        margin: 3px 0 0;
        font-size: 14px;
    }

    /* 검색 결과 - 카드형: 1열, 가로 배치 */
    .memorial-search-results:has(.memorial-result-card) {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-left: 0;
        margin-right: 0;
    }

    .memorial-result-card {
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
        padding: 10px;
    }

    .memorial-result-image {
        flex: 0 0 105px;
        width: 105px;
    }

    .memorial-result-card .memorial-result-image {
        flex: 0 0 105px;
        width: 105px;
        height: 135px;
        min-width: 105px;
        min-height: 135px;
    }

    .memorial-result-card .memorial-result-photo,
    .memorial-result-card .memorial-no-photo {
        width: 105px !important;
        height: 135px !important;
        max-width: 100% !important;
        max-height: 100% !important;
    }

    .memorial-result-info h3 {
        font-size: 16px;
    }
}


@media (max-width: 400px) {

    .memorial-container {
        margin: 10px 5px;
        padding: 22px 12px;
    }

    .memorial-title {
        font-size: 25px;
    }

    .memorial-photo img {
        width: 180px;
        height: 230px;
    }

    .memorial-gallery-grid {
        grid-template-columns: 1fr;
    }

    .memorial-gallery-item img {
        height: auto !important;
        max-height: 300px;
    }
}



/* =====================================================
   검색 결과 이미지
   - 목록형 썸네일 크기는 기존 목록 규칙을 따름
   - 카드형 이미지는 프레임 안에서 잘리지 않도록 표시
   ===================================================== */

.memorial-search-results .memorial-result-image {
    display: flex !important;
    flex: 0 0 190px;
    align-items: center;
    justify-content: center;
    width: 190px;
    height: 190px;
    min-width: 190px;
    min-height: 190px;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #eee;
}

.memorial-search-results .memorial-result-image img,
.memorial-search-results .memorial-result-photo {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    object-fit: contain !important;
    object-position: center !important;
    background-color: transparent !important;
}

/* ==================================================
   온라인 추모관 - 스마트폰 전용 화면 개선
   PC 및 태블릿 화면은 기존 디자인 유지
   ================================================== */

@media screen and (max-width: 767px) {

    /* 검색 영역 */
    .memorial-search-wrap {
        width: 100%;
        max-width: 100%;
        padding: 12px;
        margin: 0 auto;
        box-sizing: border-box;
    }

    .memorial-search-wrap h2 {
        font-size: 23px;
        text-align: center;
        margin-bottom: 16px;
    }

    .memorial-search-wrap > p {
        font-size: 15px;
        line-height: 1.6;
        text-align: center;
        margin-bottom: 16px;
    }

    /* 검색 기준과 입력란을 2열로 배치 */
    .memorial-search-form {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 10px;
        width: 100%;
        align-items: stretch;
    }

    /* 검색 기준 선택 */
    .memorial-search-form select {
        width: 100%;
        min-width: 0;
        min-height: 48px;
        font-size: 15px;
        padding: 8px;
        box-sizing: border-box;
    }

    /* 고인 성명 입력란: 세로 높이 확대 */
    .memorial-search-form input[type="search"] {
        width: 100%;
        min-width: 0;
        height: 88px;
        min-height: 88px;
        font-size: 17px;
        padding: 12px;
        box-sizing: border-box;
    }

    /* 검색 버튼은 다음 줄 전체 폭 */
    .memorial-search-form button {
        grid-column: 1 / -1;
        width: 100%;
        min-height: 48px;
        font-size: 17px;
        margin: 0;
    }

    /* 검색 결과 카드 */
    .memorial-search-results {
        width: 100%;
        box-sizing: border-box;
    }

    /* ==============================================
       추모관 상세 화면
       ============================================== */

    .memorial-container {
        width: 100%;
        max-width: 100%;
        padding: 12px;
        margin: 0 auto;
        box-sizing: border-box;
    }

    .memorial-title {
        font-size: 25px;
        line-height: 1.4;
        overflow-wrap: anywhere;
    }

    .memorial-hanja {
        font-size: 17px;
        margin-top: 5px;
    }

    /* 영정사진과 인적사항: 스마트폰에서는 세로 배치 */
    .memorial-profile {
        display: flex;
        flex-direction: column;
        gap: 18px;
        width: 100%;
    }

    .memorial-photo {
        width: 100%;
        text-align: center;
    }

    .memorial-photo img {
        display: block;
        width: auto;
        max-width: 170px;
        max-height: 230px;
        height: auto;
        margin: 0 auto;
        object-fit: contain;
    }

    /* 인적사항: 항목명과 내용을 구분 */
    .memorial-info {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .memorial-row {
        display: grid;
        grid-template-columns: minmax(85px, 32%) minmax(0, 1fr);
        gap: 8px;
        padding: 11px 8px;
        border-bottom: 1px solid #e5e5e5;
        line-height: 1.6;
        font-size: 15px;
        overflow-wrap: anywhere;
        box-sizing: border-box;
    }

    .memorial-row span {
        font-weight: 600;
    }

    .memorial-row strong {
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: keep-all;
    }

    /* 생전 약력 */
    .memorial-biography {
        margin-top: 24px;
    }

    .memorial-biography h2,
    .memorial-gallery h2 {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .biography-content {
        font-size: 15px;
        line-height: 1.9;
        overflow-wrap: anywhere;
        word-break: normal;
    }

    /* 추모 사진: 스마트폰에서는 2열 */
    .memorial-gallery-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .memorial-gallery-item {
        min-width: 0;
    }

    .memorial-gallery-item img {
        display: block;
        width: 100%;
        height: 145px;
        object-fit: cover;
        border-radius: 5px;
    }

    /* 상세 화면 이동 버튼 */
    .memorial-navigation {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .memorial-navigation a {
        display: block;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    .memorial-search-results .memorial-result-image {
        flex: 0 0 105px;
        width: 105px;
        height: 135px;
        min-width: 105px;
        min-height: 135px;
    }

    .memorial-search-results .memorial-result-image img,
    .memorial-search-results .memorial-result-photo {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
    }
}


/* 검색시 괄호안 글자를 센타로 */

/* 온라인 추모관 검색 안내 문구 가운데 정렬 */
.memorial-search-wrap > p {
    width: 100%;
    text-align: center !important;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* 안내 문구 내부의 괄호 부분도 가운데 정렬 */
.memorial-search-wrap > p span,
.memorial-search-wrap > p strong {
    text-align: center;
}

/* 스마트폰 화면 크기에 따라 글자 크기 자동 조정 */

/* 화면 폭에 따라 글자 크기 자동 조정 */
.memorial-search-wrap h2 {
    font-size: clamp(20px, 5vw, 26px);
    line-height: 1.4;
}

.memorial-search-wrap > p {
    font-size: clamp(13px, 3.6vw, 16px);
    line-height: 1.7;
}

.memorial-search-form select,
.memorial-search-form input[type="search"] {
    font-size: clamp(14px, 3.8vw, 17px);
}

.memorial-search-form button {
    font-size: clamp(15px, 4vw, 18px);
}

/* 추모관 상세 화면 */
.memorial-title {
    font-size: clamp(22px, 5.5vw, 30px);
    line-height: 1.4;
}

.memorial-hanja {
    font-size: clamp(15px, 4vw, 19px);
}

.memorial-row {
    font-size: clamp(13px, 3.5vw, 16px);
    line-height: 1.65;
}

.memorial-biography,
.biography-content {
    font-size: clamp(14px, 3.7vw, 17px);
    line-height: 1.8;
}

.memorial-gallery h2,
.memorial-biography h2 {
    font-size: clamp(18px, 4.5vw, 23px);
}

/* 아주 좁은 스마트폰 */
@media screen and (max-width: 360px) {
    .memorial-search-wrap {
        padding-left: 8px;
        padding-right: 8px;
    }

    .memorial-search-form {
        gap: 6px;
    }

    .memorial-search-form select,
    .memorial-search-form input[type="search"] {
        padding-left: 6px;
        padding-right: 6px;
    }

    .memorial-row {
        grid-template-columns: minmax(72px, 30%) minmax(0, 1fr);
        gap: 6px;
    }
}


/* 온라인 추모관 검색 항목 및 입력창 정렬 */
.memorial-search-form select,
.memorial-search-form input[type="search"] {
    text-align: center !important;
    text-align-last: center;
    box-sizing: border-box;
}

/* 입력창의 안내 글자(고인 성명 입력)를 가운데 정렬 */
.memorial-search-form input[type="search"]::placeholder {
    text-align: center;
    opacity: 1;
}

/* 모바일 화면에서도 가운데 정렬 유지 */
@media screen and (max-width: 767px) {
    .memorial-search-form select,
    .memorial-search-form input[type="search"] {
        text-align: center !important;
        text-align-last: center;
        font-size: clamp(14px, 3.8vw, 17px);
    }

    .memorial-search-form input[type="search"]::placeholder {
        text-align: center;
    }
}


/* 남편 성명 - 다른 인적사항과 동일한 정렬 */
.memorial-husband-row {
    display: flex;
    align-items: baseline;
    width: 100%;
    box-sizing: border-box;
}

.memorial-husband-row .memorial-label {
    flex: 0 0 100px;
    min-width: 100px;
}

.memorial-husband-row .memorial-value {
    flex: 1 1 auto;
    min-width: 0;
}


/* 온라인 추모관 메인 홈 버튼 */
.memorial-home-button-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    margin: 24px auto;
    padding: 0 12px;
}

.memorial-home-button {
    display: inline-block;
    box-sizing: border-box;
    padding: 12px 28px;
    background-color: #526579;
    color: #ffffff !important;
    border: 1px solid #526579;
    border-radius: 8px;
    text-align: center;
    text-decoration: none !important;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    transition: background-color 0.2s ease;
}

.memorial-home-button:hover {
    background-color: #35495e;
    border-color: #35495e;
    color: #ffffff !important;
}

@media (max-width: 600px) {
    .memorial-home-button-wrap {
        margin: 20px auto;
        padding: 0 12px;
    }

    .memorial-home-button {
        max-width: 100%;
        padding: 11px 24px;
        font-size: 15px;
    }
}


/* 메인 홈 버튼의 기본·방문·포커스·클릭 상태 통일 */
.memorial-home-button,
.memorial-home-button:link,
.memorial-home-button:visited,
.memorial-home-button:hover,
.memorial-home-button:focus,
.memorial-home-button:active {
    background-color: #526579 !important;
    color: #ffffff !important;
    border-color: #526579 !important;
    text-decoration: none !important;
    opacity: 1 !important;
    box-shadow: none;
}

/* 키보드 포커스 표시 */
.memorial-home-button:focus-visible {
    outline: 2px solid #243b53;
    outline-offset: 3px;
}



/* 온라인 추모관 검색 화면 배경 */
body:has(.memorial-search-wrap) {
    background-image:
        linear-gradient(
            rgba(255, 255, 255, 0.35),
            rgba(255, 255, 255, 0.35)
        ),
        url("https://rip.sansuri.kr/wp-content/uploads/2026/10/IMG_3823-2.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}


/* 검색창 패널 크기 조정 */
.memorial-search-wrap {
    width: 100%;
    max-width: 760px;
    margin: 40px auto;
    padding: 28px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

@media (max-width: 768px) {
    .memorial-search-wrap {
        width: calc(100% - 24px);
        max-width: 100%;
        margin: 24px auto;
        padding: 20px 14px;
        border-radius: 12px;
    }
}







/* 고인 상세정보 화면 배경 */
body.single-memorial {
    background-image:
        linear-gradient(
            rgba(255, 255, 255, 0.35),
            rgba(255, 255, 255, 0.35)
        ),
        url("https://rip.sansuri.kr/wp-content/uploads/2026/10/IMG_3823-2.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

@media (max-width: 768px) {
    body:has(.memorial-search-wrap),
    body.single-memorial {
        background-attachment: scroll;
    }

    .memorial-search-wrap {
        padding: 18px 14px;
        border-radius: 12px;
    }
}



/* 온라인 추모관 검색 페이지의 바깥 흰색 배경 제거 */
body:has(.memorial-search-wrap) #primary,
body:has(.memorial-search-wrap) .content-bg,
body:has(.memorial-search-wrap) .content-container,
body:has(.memorial-search-wrap) article,
body:has(.memorial-search-wrap) .entry-content {
    background-color: transparent !important;
}

/* 검색 상자만 흰색 반투명으로 유지 */
body:has(.memorial-search-wrap) .memorial-search-wrap {
    width: calc(100% - 32px);
    max-width: 760px;
    margin: 40px auto;
    padding: 28px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

@media (max-width: 768px) {
    body:has(.memorial-search-wrap) .memorial-search-wrap {
        width: calc(100% - 24px);
        margin: 24px auto;
        padding: 20px 14px;
    }
}



/* 모바일에서 검색 및 고인 정보 상자 너비 확대 */
@media (max-width: 768px) {

    body:has(.memorial-search-wrap) .memorial-search-wrap {
        width: calc(100% - 12px) !important;
        max-width: none;
        padding-left: 10px;
        padding-right: 10px;
        box-sizing: border-box;
    }

    /* 고인 상세정보 영역의 좌우 여백 축소 */
    body.single-memorial .memorial-detail,
    body.single-memorial .memorial-container,
    body.single-memorial .memorial-info {
        box-sizing: border-box;
        max-width: 100%;
    }
}


/* 모바일 고인 상세정보 줄맞춤 - 최종 적용 규칙 */
@media screen and (max-width: 600px) {

    body.single-memorial .memorial-info {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    body.single-memorial .memorial-row {
        display: grid !important;
        grid-template-columns: 78px minmax(0, 1fr);
        column-gap: 6px;
        align-items: start;
        width: 100%;
        min-height: 0;
        padding: 10px 6px;
        box-sizing: border-box;
    }

    body.single-memorial .memorial-row > span {
        display: block;
        min-width: 0;
        margin: 0;
        font-size: 13px;
        line-height: 1.7;
        white-space: normal;
        word-break: keep-all;
    }

    body.single-memorial .memorial-row > strong {
        display: block;
        min-width: 0;
        margin: 0;
        font-size: 14px;
        line-height: 1.7;
        font-weight: 500;
        white-space: normal;
        word-break: keep-all;
        overflow-wrap: break-word;
    }
}


/* =====================================================
   [줄바꿈 수정] 스마트폰 화면 폭에 따른 줄바꿈 문제 - 최종 적용 규칙
   - 한글: 단어(어절) 단위로만 줄바꿈 (keep-all)
   - overflow-wrap: anywhere 는 글자 중간에서 끊기는 원인이라
     break-word 로 교체 (긴 영문/숫자/URL 만 강제 줄바꿈)
   - 인적사항 항목명/내용 열 너비 및 글자 크기를 한 곳에서 통일
   ===================================================== */

.memorial-title,
.memorial-hanja,
.memorial-row span,
.memorial-row strong,
.memorial-husband-row .memorial-label,
.memorial-husband-row .memorial-value,
.biography-content,
.memorial-search-wrap h2,
.memorial-search-wrap > p,
.memorial-search-info,
.memorial-result-info h3,
.memorial-result-info p {
    word-break: keep-all !important;
    overflow-wrap: break-word !important;
}

/* 제목/안내문구: 한 줄에 한두 글자만 남는 어색한 줄바꿈 방지 */
.memorial-title,
.memorial-search-wrap h2,
.memorial-search-wrap > p,
.memorial-result-info h3 {
    text-wrap: balance;
}

.biography-content,
.memorial-row strong {
    text-wrap: pretty;
}

@media screen and (max-width: 767px) {

    /* 인적사항: 항목명 열 고정 + 내용 열, 글자 크기 통일 */
    body .memorial-row,
    body .memorial-husband-row {
        display: grid !important;
        grid-template-columns: 7.2em minmax(0, 1fr);
        column-gap: 8px;
        align-items: start;
        width: 100%;
        min-height: 0;
        padding: 10px 8px;
        box-sizing: border-box;
        font-size: clamp(13px, 3.6vw, 16px);
        line-height: 1.65;
    }

    body .memorial-row > span,
    body .memorial-row > strong,
    body .memorial-husband-row .memorial-label,
    body .memorial-husband-row .memorial-value {
        display: block;
        flex: none;
        min-width: 0;
        min-height: 0;
        margin: 0;
        font-size: inherit;      /* 고정 px 대신 행의 clamp 크기를 따름 */
        line-height: inherit;
        white-space: normal;
    }

    body .memorial-row > strong,
    body .memorial-husband-row .memorial-value {
        font-weight: 500;
    }

    .memorial-title {
        letter-spacing: 0;
    }

    .biography-content {
        font-size: clamp(14px, 3.8vw, 16px);
        line-height: 1.85;
    }
}

@media screen and (max-width: 360px) {
    body .memorial-row,
    body .memorial-husband-row {
        grid-template-columns: 6.6em minmax(0, 1fr);
        column-gap: 6px;
    }
}



/* =====================================================
   [검색 결과 화면 수정]
   1) 한자이름 / 출생일 / 사망일 / 봉안위치 등을 왼쪽 정렬 (PC·스마트폰 공통)
   2) 스마트폰에서 출생일·사망일의 '년 월 일'이 다음 줄로 넘어가지 않게 처리
   ===================================================== */

/* 1) 왼쪽 정렬 - 테마/Elementor 의 가운데 정렬 상속을 차단 */
.memorial-search-results,
.memorial-search-results .memorial-result-card,
.memorial-search-results .memorial-result-info,
.memorial-search-results .memorial-result-info *,
.memorial-search-results .memorial-search-info,
.memorial-search-results .memorial-search-info *,
.memorial-search-results .memorial-search-result {
    text-align: left !important;
}

.memorial-search-results .memorial-result-info,
.memorial-search-results .memorial-search-info {
    justify-content: flex-start;
    align-items: flex-start;
}

/* 검색 결과 없음 / 안내 메시지는 기존처럼 가운데 유지 */
.memorial-search-results .memorial-no-result,
.memorial-search-results .memorial-no-result * ,
.memorial-search-results .memorial-no-photo {
    text-align: center !important;
}

/* 2) 날짜는 한 줄로 유지 (년·월·일 사이에서 줄바꿈 금지) */
.memorial-search-date,
.memorial-search-field,
.memorial-result-info [class*="birth"],
.memorial-result-info [class*="death"],
.memorial-result-info [class*="date"] {
    white-space: nowrap !important;
    word-break: keep-all !important;
}

/* 봉안위치 등 긴 내용은 필요할 때만 줄바꿈 (날짜 외 항목) */
.memorial-result-info [class*="location"],
.memorial-result-info [class*="place"],
.memorial-result-info [class*="position"] {
    white-space: normal !important;
}

@media screen and (max-width: 767px) {

    /* 카드 안쪽 공간 확보: 사진을 약간 줄이고 간격 축소 */
    .memorial-search-results .memorial-result-card {
        gap: 10px;
        padding: 10px 8px;
    }

    .memorial-search-results .memorial-result-card .memorial-result-image {
        flex: 0 0 88px !important;
        width: 88px !important;
        min-width: 88px !important;
        height: 112px !important;
        min-height: 112px !important;
    }

    /* 화면 폭에 따라 글자 크기 자동 축소 → 날짜가 한 줄에 들어감 */
    .memorial-search-results .memorial-result-info p,
    .memorial-search-results .memorial-search-field,
    .memorial-search-results .memorial-search-date {
        font-size: clamp(11px, 3.3vw, 14px);
        line-height: 1.55;
        letter-spacing: -0.02em;
    }

    .memorial-search-results .memorial-result-info h3 {
        font-size: clamp(15px, 4.3vw, 18px);
    }

    /* 목록형(PHP) 결과: 항목명 폭 축소 */
    .memorial-search-field span {
        width: auto;
        margin-right: 6px;
    }
}
