@import url('https://fonts.googleapis.com/css2?family=Nanum+Myeongjo:wght@400;700&display=swap');

/* --------------------------------------------------
 * Pray Wall - Main Stylesheet
 * -------------------------------------------------- */

/* --- 1. 전체 레이아웃 --- */
.pw-wrap {
    --pw-bg: #2c2a2a;
    --pw-text: #e0e0e0;
    --pw-gold: #d4b978;
    --pw-border: #444;
    --pw-error: #ff8a80;
    --pw-success: #b9f6ca;

    background-color: var(--pw-bg);
    background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M 0 40 L 40 0 L 80 40 L 40 80 Z M 20 40 L 40 20 L 60 40 L 40 60 Z' stroke='rgba(212, 185, 120, 0.1)' stroke-width='1' fill='none'/%3E%3C/svg%3E");
    color: var(--pw-text);
    font-family: 'Nanum Myeongjo', serif;
    padding: 3rem 2.5rem;
    border-radius: 8px;
    max-width: 960px;
    margin: 2rem auto;
    text-align: center;
    border: 1px solid var(--pw-border);
}

.pw-hero h2 {
    font-size: 2rem;
    color: var(--pw-gold);
    margin: 0 0 0.5rem;
}

.pw-sub {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 2rem;
}

/* --- 2. 입력 폼 --- */
.pw-form {
    max-width: 500px;
    margin: 0 auto 2rem;
    display: grid;
    gap: 0.75rem; /* tighter */
}

.pw-color-selector {
    display: flex;
    justify-content: center;
    gap: 0.75rem; /* tighter */
    margin-top: 0.5rem;
}

.pw-candle-description {
    margin-top: 1rem;
    padding: 0.75rem; /* tighter */
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--pw-border);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: left;
}

.pw-candle-description p {
    margin: 0 0 0.5rem 0;
}

.pw-candle-description p:last-child {
    margin-bottom: 0;
}

.pw-candle-description strong {
    color: var(--pw-gold);
}

.pw-color-selector .pw-candle-svg {
    width: 30px;
    height: 60px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 4px;
    transition: border-color 0.2s;
}

.pw-color-selector .pw-candle-svg.selected {
    border-color: var(--pw-gold);
}


.pw-field {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.pw-field label {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    opacity: 0.9;
}

.pw-field input,
.pw-field textarea,
.pw-field select {
    background: #333;
    border: 1px solid var(--pw-border);
    color: var(--pw-text);
    padding: 0.6rem;
    border-radius: 4px;
    font-size: 1rem;
}
.pw-field textarea {
    resize: vertical;
}

.pw-field small {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 0.25rem;
}

.pw-controls {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem; /* tighter */
}
.pw-controls select {
    flex-basis: 120px;
}

.pw-btn {
    background-color: var(--pw-gold);
    color: #111;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
    flex-grow: 1;
}
.pw-btn:hover, .pw-btn:focus {
    background-color: #e8d1a1;
}
.pw-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
}

.pw-msg {
    min-height: 1.5rem;
    font-size: 0.875rem;
}
.pw-msg.error { color: var(--pw-error); }
.pw-msg.success { color: var(--pw-success); }


/* --- 3. 기도벽 (촛불 컨테이너) --- */
.pw-main-content {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
}

.pw-wall {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)); /* desktop: 5 per row */
  column-gap: 1rem;   /* tighter horizontal space */
  row-gap: 0.75rem;   /* tighter vertical space */
  padding: 1rem;      /* keep compact */
  justify-items: center;
  align-items: start; /* top align items in each cell */
}

.pw-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column; /* 세로 정렬 강제 */
    justify-content: flex-start; /* 위에서부터 정렬 */
    align-items: center;
}

/* --- 3.5. 촛불 받침대 --- */
.pw-altar-base {
    width: 100%;
    height: 50px; /* Adjust height as needed */
    background-color: #4a3f35; /* Dark brown, similar to marquee background */
    border: 1px solid var(--pw-border);
    border-top: 3px solid var(--pw-gold); /* A golden top border for altar feel */
    border-radius: 8px 8px 0 0; /* Rounded top corners */
    margin-top: 2rem; /* Space from content above */
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3); /* Shadow for depth */
    position: relative; /* For positioning candles on it later if needed */
    display: none; /* Hidden by default, controlled by JS */
}

.pw-image-container {
    padding: 0.75rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--pw-gold);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(212, 185, 120, 0.3);
}

.pw-mary-statue {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.pw-scripture {
    margin-top: 1.5rem;
    padding: 0.75rem; /* tighter */
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--pw-text);
    opacity: 0.8;
}

.pw-scripture p {
    margin: 0;
}

.pw-scripture-ref {
    margin-top: 1rem;
    font-style: italic;
    color: var(--pw-gold);
}

.pw-scripture-divider {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(212, 185, 120, 0), rgba(212, 185, 120, 0.5), rgba(212, 185, 120, 0));
    margin: 2rem 0;
}

.pw-scripture-lang-gr {
    font-family: 'Times New Roman', Times, serif; /* 그리스어에 적합한 폰트 */
    font-size: 1rem;
    color: #ccc;
    opacity: 0.7;
}

.pw-scripture-ref-gr {
    font-family: 'Times New Roman', Times, serif;
}


.pw-candle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    animation: gentleFloat 6s ease-in-out infinite, fadeIn 0.5s ease-out;
    position: relative;
}

.pw-candle-svg {
    width: 40px;
    height: 80px;
    cursor: pointer;
    transition: transform 0.2s;
    filter: drop-shadow(0 0 5px rgba(255, 223, 186, 0.3));
}
.pw-candle:hover .pw-candle-svg {
    transform: scale(1.1);
}

.pw-candle-name {
    font-size: 0.8rem;
    font-weight: bold;
}

.pw-candle-likes {
    font-size: 0.75rem;
    opacity: 0.7;
}

.pw-candle-days-left {
    font-size: 0.7rem;
    opacity: 0.8;
    color: var(--pw-gold);
}

/* 툴팁 */
.pw-candle .pw-tooltip {
    visibility: hidden;
    width: 180px;
    background-color: #111;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 110%;
    left: 50%;
    margin-left: -90px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
    line-height: 1.4;
}
.pw-candle:hover .pw-tooltip {
    visibility: visible;
    opacity: 1;
}


/* --- 4. 촛불 SVG 색상 & 애니메이션 --- */
.pw-candle-flame {
    animation: flicker 2.5s ease-in-out infinite;
    transform-origin: center bottom;
}

/* 전례색별 색상 정의 */
.pw-candle--white .pw-candle-body { fill: #f5f5dc; } /* Ivory */
.pw-candle--purple .pw-candle-body { fill: #8e44ad; } /* Deep Purple */
.pw-candle--green .pw-candle-body { fill: #27ae60; } /* Rich Green */
.pw-candle--red .pw-candle-body { fill: #c0392b; } /* Strong Red */
.pw-candle--blue .pw-candle-body { fill: #3498db; } /* Bright Blue */
.pw-candle--gold .pw-candle-body { fill: #f1c40f; } /* Gold */
.pw-candle--black .pw-candle-body { fill: #34495e; } /* Dark Slate */
.pw-candle--orange .pw-candle-body { fill: #e67e22; } /* Carrot Orange */

@keyframes flicker {
    0%, 100% { transform: scaleY(1) rotate(-0.5deg); opacity: 0.95; }
    25%      { transform: scaleY(1.05) rotate(0.5deg); opacity: 1; }
    50%      { transform: scaleY(0.95) rotate(-1deg); opacity: 0.9; }
    75%      { transform: scaleY(1.02) rotate(0.2deg); opacity: 0.98; }
}

@keyframes gentleFloat {
    0%, 100% {
        transform: translateY(0);
        filter: drop-shadow(0 0 5px rgba(255, 223, 186, 0.3));
    }
    50% {
        transform: translateY(-4px);
        filter: drop-shadow(0 0 12px rgba(255, 223, 186, 0.5));
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 5. 하단 --- */
.pw-foot {
    margin-top: 1.5rem;
    font-size: 0.875rem;
}
.pw-link {
    background: none;
    border: none;
    color: var(--pw-gold);
    text-decoration: underline;
    cursor: pointer;
    margin-left: 1rem;
}

/* ───────────── 6. 기도 목록 Marquee (고급형) ───────────── */
.pray-marquee-link {
    display: block;
    text-decoration: none;
}

.pray-marquee-container {
    background: #4a3f35; /* 차분한 갈색 배경 */
    background-image: linear-gradient(to right, #4a3f35, #605147, #4a3f35);
    border: 1px solid #c5b358; /* 금색 테두리 */
    border-radius: 4px;
    padding: 0.75rem 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    /* 아이디어 1: 양쪽 끝 페이드 효과 */
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.pray-marquee-container:hover {
    background: #5a4f45;
    border-color: #e8d1a1;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    transform: translateY(-2px);
}

/* 아이디어 2: 마우스 올리면 일시정지 */
.pray-marquee-container:hover .pray-marquee {
    animation-play-state: paused;
}

.pray-marquee {
    display: flex;
    animation: marquee 20s linear infinite; /* 속도를 60s -> 30s로 수정 */
    white-space: nowrap;
    color: #e0e0e0; /* 부드러운 흰색 텍스트 */
}

.pray-marquee-item {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 2.5rem; /* 아이템 간 간격 확장 */
    font-size: 0.95rem;
    font-family: 'Nanum Myeongjo', serif; /* 기존 폰트 유지 */
}

.pray-marquee-item strong {
    color: #e8d1a1; /* 밝은 금색으로 강조 */
    font-weight: 700;
}

.marquee-candle {
    width: 12px;
    height: 24px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 3px rgba(255, 223, 186, 0.4)); /* 촛불에 부드러운 그림자 효과 */
}

/* --- 7. 반응형 디자인 --- */
@media (max-width: 768px) {
    .pw-main-content {
        flex-direction: column;
    }

    .pw-sidebar {
        order: 2; /* 모바일에서는 맨 아래로 */
        margin-top: 2rem;
        margin-bottom: 0;
    }

    .pw-image-container {
        max-width: 200px; /* 모바일에서 이미지 크기 제한 */
        margin: 0 auto;
    }

    /* mobile-3cols */
    .pw-wall {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.75rem; /* tighter */
        justify-items: center;
        align-items: start;
        padding: 0.75rem; /* tighter */
    }
    .pw-candle { text-align: center; }
    .pw-candle-svg { width: 34px; height: 68px; }


    /* mobile-compact v2 */
    .pw-wrap { padding: 1.25rem 1rem; } /* was ~3rem 2.5rem */
    .pw-wall {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        column-gap: 0.75rem;
        row-gap: 0.4rem;           /* tighter vertical spacing */
        padding: 0.5rem;           /* tighter inner padding */
        justify-items: center;
        align-items: start;
    }
    .pw-candle-svg { width: 32px; height: 64px; } /* slightly smaller icon */
    .pw-candle-name { margin-bottom: 0.1rem; line-height: 1.1; font-size: 0.9rem; }
    .pw-candle-days-left { margin: 0.05rem 0; line-height: 1.08; font-size: 0.85rem; }
    .pw-candle-likes { margin-top: 0; line-height: 1.05; font-size: 0.8rem; }


    /* mobile top-align override */
    .pw-wall { align-items: start !important; }
    .pw-candle { margin-bottom: 4px !important; }
}




@keyframes marquee {
    from {
        transform: translateX(0%);
    }
    to {
        transform: translateX(-50%); /* 콘텐츠의 절반만큼만 이동하여 끊김 없이 연결 */
    }
}


/* --- Toggle: 촛불 켜기 --- */
.pw-ignite {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}
.pw-toggle-btn {
    font-weight: 700;
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
}
.pw-form.is-collapsed { display: none; }
.pw-form.is-open { display: block; animation: pwFadeIn 200ms ease-in; }

@keyframes pwFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* === Candle text spacing tuning (global) === */
.pw-candle-name {
  /* name → countdown: slightly tighter */
  margin-top: 0.35rem;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}
.pw-candle-days-left {
  /* countdown → likes: tighter than above */
  margin-top: 0.05rem;
  margin-bottom: 0.10rem;
  line-height: 1.15;
}
.pw-candle-likes {
  margin-top: 0;        /* minimize gap below countdown */
  line-height: 1.1;
}
/* Defensive reset: ensure paragraph defaults don't re-expand spacing */
.pw-candle-name, .pw-candle-days-left, .pw-candle-likes {
  padding: 0;
}


/* === Candle text spacing tuning v2 (tighter) === */
.pw-candle-name { margin-top: 0.25rem; margin-bottom: 0.15rem; line-height: 1.15; }
.pw-candle-days-left { margin-top: 0.05rem; margin-bottom: 0.05rem; line-height: 1.12; }
.pw-candle-likes { margin-top: 0; line-height: 1.05; }


/* === Top alignment & spacing overrides === */
.pw-wall { align-items: flex-start !important; } /* desktop/flex */
.pw-candle { margin-bottom: 8px !important; }


/* desktop candle spacing override */
.pw-candle { margin-bottom: 6px !important; }


/* Scripture wrapping improvements */
.pw-scripture { line-height: 1.8; }
.pw-scripture-ko {
  word-break: keep-all;
  text-wrap: balance; /* modern browsers */
  letter-spacing: 0.01em;
}
.pw-scripture-lang-gr {
  text-wrap: balance;
  hyphens: none;
  word-break: normal;
  letter-spacing: 0.01em;
}
.pw-scripture-ref { white-space: nowrap; margin-top: .75rem; }
.pw-scripture-divider { margin: 1rem 0; }



/* === Rounded panel for main content === */
.pw-main-content {
  border: 1px solid rgba(212,185,120,0.35);   /* soft gold */
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.02) inset,
    0 8px 24px rgba(0,0,0,0.25);
  margin-top: 1rem; /* extra space from the toggle button */
  background: transparent;
}

/* Slightly larger radius & spacing on mobile */
@media (max-width: 768px) {
  .pw-main-content {
    border-radius: 16px;
    margin-top: 1.25rem;
    padding: 1rem;
  }
}


/* final polish pack */
/* 1) Panel breathing space */
.pw-main-content { margin-top: 1.25rem !important; }

/* 2) Candle card normalization */
.pw-candle {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.pw-candle .pw-candle-svg { margin-bottom: .25rem; filter: drop-shadow(0 0 6px rgba(255,210,90,.25)); }

/* 3) One-line ellipsis for long names */
.pw-candle-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1.2em;   /* unify row height */
}

/* 4) Row-height consistency for meta rows */
.pw-candle-days-left { min-height: 1.2em; }
.pw-candle-likes { min-height: 1.2em; }

/* 5) Hover/Focus feedback (accessibility) */
.pw-candle:focus-visible,
.pw-candle:hover {
  outline: 2px solid rgba(212,185,120,.35);
  outline-offset: 2px;
  border-radius: 10px;
}

/* Touch devices often keep :hover; limit side effects on mobile via media if needed */
@media (hover: none) {
  .pw-candle:hover { outline: none; }
}


/* --- Marquee compact mode --- */
.pray-marquee-container.is-compact { padding: .35rem 0; border-radius: 6px; }
.pray-marquee-container.is-compact .pray-marquee-item { padding: 0 1rem; gap: .5rem; font-size: .9rem; }
.pray-marquee-container.is-compact .marquee-candle { width: 10px; height: 20px; }
.pray-marquee-link { margin: 0 !important; } /* neutralize external margins if any */

