/* ===================================================
   테마 CSS — 기본형(default), 고급형(premium), 심플형(simple), 전통형(traditional)
   =================================================== */

/* ---- 고급형 (premium) ---- */
.theme-premium {
    --primary:   #1C1C2E;
    --primary-h: #0f0f1a;
    --bg:        #F0EDE8;
    --white:     #FAFAF8;
    --border:    #D4C9BC;
}
.theme-premium .deceased-card,
.theme-premium .tl-hero,
.theme-premium .np-header {
    background: linear-gradient(135deg, #1C1C2E 0%, #3D2B5E 100%);
}
.theme-premium .deceased-name,
.theme-premium .tl-name,
.theme-premium .np-name { font-family: 'Georgia', 'Batang', serif; letter-spacing: 2px; }
.theme-premium .card { border-top: 3px solid #3D2B5E; }
.theme-premium .card-title { color: #3D2B5E; }
.theme-premium .mourner-relation { background: #3D2B5E; }
.theme-premium .btn-primary { background: #3D2B5E; }
.theme-premium .btn-primary:hover { background: #2a1e42; }
.theme-premium .info-value.highlight { color: #3D2B5E; }

/* ---- 심플형 (simple) ---- */
.theme-simple {
    --primary:   #333333;
    --primary-h: #111111;
    --bg:        #FFFFFF;
    --white:     #FFFFFF;
    --border:    #EEEEEE;
}
.theme-simple .deceased-card,
.theme-simple .tl-hero {
    background: #333333;
}
.theme-simple .site-header { background: #333; }
.theme-simple .card { box-shadow: none; border: 1px solid #eee; border-radius: 4px; }
.theme-simple .card-title { font-size: .875rem; text-transform: uppercase; letter-spacing: 1px; color: #666; }
.theme-simple .mourner-relation { background: #555; border-radius: 2px; }
.theme-simple .deceased-name,
.theme-simple .tl-name { font-weight: 400; font-size: 1.6rem; }
.theme-simple .btn-map { border-radius: 2px; }

/* ---- 전통형 (traditional) ---- */
.theme-traditional {
    --primary:   #6B0F0F;
    --primary-h: #4a0a0a;
    --bg:        #FAF6F0;
    --white:     #FDF9F4;
    --border:    #DDD0C0;
}
.theme-traditional body { background: #FAF6F0; }
.theme-traditional .deceased-card,
.theme-traditional .tl-hero {
    background: linear-gradient(180deg, #6B0F0F 0%, #3D0A0A 100%);
    border: 3px solid #C8A96E;
}
.theme-traditional .deceased-name,
.theme-traditional .tl-name,
.theme-traditional .np-name {
    font-family: 'Noto Serif KR', 'Batang', 'GulimChe', serif;
    letter-spacing: 4px;
}
.theme-traditional .card {
    border-left: 4px solid #6B0F0F;
    border-radius: 0;
}
.theme-traditional .card-title {
    color: #6B0F0F;
    font-family: 'Noto Serif KR', serif;
    border-bottom-color: #C8A96E;
}
.theme-traditional .mourner-relation { background: #6B0F0F; border-radius: 0; }
.theme-traditional .info-value.highlight { color: #6B0F0F; }
.theme-traditional .btn-map {
    background: #FAF6F0;
    border-color: #6B0F0F;
    color: #6B0F0F;
}
.theme-traditional .site-header { background: #6B0F0F; border-bottom: 2px solid #C8A96E; }
.theme-traditional .rip-text,
.theme-traditional .tl-rip,
.theme-traditional .np-rip {
    font-family: 'Noto Serif KR', serif;
    font-style: italic;
    letter-spacing: 1px;
}

/* ===================================================
   레이아웃 — 타임라인 (timeline)
   =================================================== */
.layout-timeline .tl-hero {
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    padding: 28px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.layout-timeline .tl-photo {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.4);
    flex-shrink: 0;
}
.layout-timeline .tl-label { font-size: .75rem; opacity: .7; }
.layout-timeline .tl-name { font-size: 1.5rem; font-weight: 700; }
.layout-timeline .tl-age  { font-size: .875rem; opacity: .8; }
.layout-timeline .tl-rip  { font-size: .8rem; opacity: .75; margin-top: 6px; line-height: 1.5; }

.layout-timeline .tl-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.layout-timeline .tl-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1.5px solid var(--border);
}
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 8px; top: 12px; bottom: 12px;
    width: 2px;
    background: var(--border);
}
.tl-item { position: relative; margin-bottom: 24px; }
.tl-item:last-child { margin-bottom: 0; }
.tl-dot {
    position: absolute;
    left: -24px; top: 4px;
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 2px solid var(--white);
    box-shadow: 0 0 0 2px var(--primary);
}
.tl-dot--passed  { background: var(--primary); }
.tl-dot--funeral { background: #e74c3c; box-shadow: 0 0 0 2px #e74c3c; }
.tl-dot--burial  { background: #27ae60; box-shadow: 0 0 0 2px #27ae60; }
.tl-time   { font-size: .8rem; color: var(--text-sub); margin-bottom: 2px; }
.tl-event  { font-weight: 700; font-size: 1rem; color: var(--text); }
.tl-detail { font-size: .875rem; color: var(--text-sub); margin-top: 2px; line-height: 1.5; }
.tl-map-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: .8rem;
    color: var(--primary);
}

/* ===================================================
   레이아웃 — 신문형 (newspaper)
   =================================================== */
.layout-newspaper {
    font-family: 'Noto Serif KR', 'Batang', Georgia, serif;
}
.np-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 3px solid var(--text);
    border-bottom: 1px solid var(--text);
    padding: 6px 0;
    margin-bottom: 20px;
    font-size: .8rem;
    color: var(--text-sub);
}
.np-site { font-weight: 700; color: var(--text); font-size: .9rem; }
.np-title-area {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}
.np-photo {
    width: 90px; height: 110px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.np-notice {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 4px;
    margin-bottom: 4px;
}
.np-name {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
    line-height: 1.2;
    color: var(--text);
}
.np-age  { font-size: .9rem; color: var(--text-sub); margin-top: 4px; }
.np-rip  { font-size: .85rem; color: var(--text-sub); margin-top: 8px; line-height: 1.6; }
.np-divider { border: none; border-top: 1px solid var(--text); margin: 16px 0; }
.np-body { display: flex; gap: 20px; }
.np-col  { flex: 1; }
.np-col-title {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-sub);
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 2px;
}
.np-col p { font-size: .9rem; line-height: 1.7; }
.np-address { font-size: .8rem; color: var(--text-sub); }
.np-mourners { margin-top: 4px; }
.np-mourners-title {
    font-size: .875rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.np-mourner-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
}
.np-mourner-list li { font-size: .875rem; }
.np-relation {
    background: var(--primary);
    color: #fff;
    font-size: .7rem;
    padding: 1px 6px;
    margin-right: 4px;
    border-radius: 2px;
}
.np-phone { font-size: .8rem; color: var(--text-sub); margin-left: 4px; }
.np-message { font-size: .875rem; line-height: 1.8; color: var(--text); }

@media (max-width: 480px) {
    .np-body { flex-direction: column; gap: 12px; }
    .layout-timeline .tl-hero { flex-direction: column; text-align: center; }
}

/* ===================================================
   작성 폼 — 스타일 선택 UI
   =================================================== */
.style-section { background: var(--white); }

/* 종교 chip */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-size: .875rem;
    cursor: pointer;
    transition: all .15s;
}
.chip input { display: none; }
.chip:has(input:checked) {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 테마 그리드 */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.theme-card {
    cursor: pointer;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 4px;
    font-size: .8rem;
    transition: border-color .15s;
}
.theme-card input { display: none; }
.theme-card:has(input:checked),
.theme-card.active { border-color: var(--primary); }
.theme-preview {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}
.tp-header { height: 30%; }
.tp-body { padding: 6px 4px; }
.tp-line { height: 5px; border-radius: 2px; margin-bottom: 4px; }
.tp-line.short { width: 60%; }
/* 테마 미리보기 색상 */
.theme-preview--default .tp-header { background: #2C3E50; }
.theme-preview--default .tp-line   { background: #ddd; }
.theme-preview--premium  .tp-header { background: linear-gradient(135deg,#1C1C2E,#3D2B5E); }
.theme-preview--premium  .tp-line   { background: #c5b8d4; }
.theme-preview--simple   .tp-header { background: #333; }
.theme-preview--simple   .tp-line   { background: #eee; }
.theme-preview--traditional .tp-header { background: #6B0F0F; }
.theme-preview--traditional .tp-line   { background: #C8A96E; }

/* 레이아웃 그리드 */
.layout-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.layout-card {
    cursor: pointer;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 4px;
    font-size: .8rem;
    transition: border-color .15s;
}
.layout-card input { display: none; }
.layout-card:has(input:checked),
.layout-card.active { border-color: var(--primary); }
.layout-preview {
    height: 60px;
    border-radius: 4px;
    background: var(--bg);
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px;
}
.lp-card  { width: 100%; height: 14px; background: var(--border); border-radius: 2px; }
.lp-dot   { width: 10px; height: 10px; background: var(--primary); border-radius: 50%; }
.lp-line-v { width: 2px; height: 10px; background: var(--border); }
.layout-preview--newspaper { flex-direction: column; align-items: flex-start; }
.lp-title { width: 80%; height: 10px; background: var(--text); border-radius: 1px; margin-bottom: 4px; }
.lp-cols  { display: flex; gap: 4px; width: 100%; }
.lp-cols > div { flex: 1; height: 20px; background: var(--border); border-radius: 1px; }

/* 종교 안내 문구 */
.religion-rip {
    background: #f8f4ee;
    border-left: 3px solid var(--primary);
    padding: 10px 14px;
    font-size: .875rem;
    color: var(--text-sub);
    margin-bottom: 10px;
    border-radius: 0 4px 4px 0;
    line-height: 1.6;
}
