/*
  히어로·행사 소개·행사 정보가 같은 가운데 열을 쓴다.
  구분은 박스가 아니라 여백과 얇은 divider 로만 만든다.
  색은 여행지 상세와 같은 중립 톤을 쓰고, 강조는 링크에만 아주 조금 준다.
*/
.festival-detail {
    --festival-accent: var(--tripbora-primary);
    --festival-accent-dark: var(--tripbora-primary-hover);
    --festival-accent-soft: var(--tripbora-soft);
    --festival-border: #e3e6ef;
    --festival-border-soft: #eef0f4;
    --festival-muted: #6b7686;
    width: min(1080px, calc(100% - 40px));
    margin: 28px auto 72px;
    color: #172033;
}

.festival-detail-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: clamp(26px, 3.2vw, 42px);
    align-items: start;
    padding-bottom: clamp(28px, 3vw, 38px);
    border-bottom: 1px solid var(--festival-border);
}

.festival-detail-media,
.festival-detail-heading,
.festival-detail-title-row,
.festival-detail-summary,
.festival-detail-info-row,
.festival-detail-info-row dd {
    min-width: 0;
}

.festival-detail-image-frame {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 12px;
    background: #f4f6f9;
}

.festival-detail-gallery-track,
.festival-detail-gallery-slide,
.festival-detail-gallery-open {
    width: 100%;
    height: 100%;
}

.festival-detail-gallery-slide {
    display: none;
    margin: 0;
}

.festival-detail-gallery-slide.is-active {
    display: block;
}

.festival-detail-gallery-open {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.festival-detail-gallery-open:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.92);
    outline-offset: -6px;
}

.festival-detail-gallery-open img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.festival-detail-gallery-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 50%;
    background: rgba(17, 24, 39, 0.46);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transform: translateY(-50%);
}

.festival-detail-gallery-nav.prev {
    left: 12px;
}

.festival-detail-gallery-nav.next {
    right: 12px;
}

.festival-detail-gallery-nav:focus-visible,
.festival-image-modal button:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.9);
    outline-offset: 2px;
}

.festival-detail-gallery-counter {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.5);
    color: #fff;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.festival-detail-image-placeholder {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    color: #64748b;
    text-align: center;
}

.festival-detail-image-placeholder span {
    font-size: 28px;
}

.festival-detail-image-placeholder strong {
    font-size: 14px;
}

/* 출처·라이선스는 이미지에 붙은 캡션처럼 조용하게 둔다 */
.festival-detail-attribution {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 7px;
    margin: 10px 2px 0;
    overflow-wrap: anywhere;
    color: var(--festival-muted);
    font-size: 12px;
    line-height: 1.5;
}

/* 이미지와 한 덩어리로 읽히도록 배경도 테두리도 두지 않는다 */
.festival-detail-heading {
    padding-top: clamp(2px, 1vw, 10px);
}

.festival-detail-category {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--festival-accent-soft);
    color: var(--festival-accent-dark);
    font-size: 11px;
    font-weight: 750;
}

.festival-detail-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
    gap: 12px;
}

.festival-detail-title {
    min-width: 0;
}

.festival-detail h1 {
    margin: 12px 0 0;
    overflow-wrap: anywhere;
    font-size: clamp(30px, 3.5vw, 40px);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.22;
}

.festival-detail-bookmark {
    display: inline-flex;
    min-width: 76px;
    min-height: 36px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    padding: 0 11px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.festival-detail-bookmark.is-bookmarked {
    border-color: #b9d4ee;
    background: var(--festival-accent-soft);
    color: var(--festival-accent-dark);
}

.festival-detail-bookmark:focus-visible,
.festival-detail-homepage:focus-visible,
.festival-detail-back:focus-visible {
    outline: 3px solid rgba(0, 102, 204, 0.28);
    outline-offset: 3px;
}

.festival-detail-bookmark:disabled {
    cursor: wait;
    opacity: 0.58;
}

.festival-detail-bookmark-icon {
    width: 18px;
    height: 18px;
    background: url('/uploads/icons/bookmark.png') center / contain no-repeat;
}

.festival-detail-bookmark.is-bookmarked .festival-detail-bookmark-icon {
    background-image: url('/uploads/icons/bookmark2.png');
}

.festival-detail-summary {
    display: grid;
    gap: 8px;
    margin-top: 18px;
    color: #374151;
}

.festival-detail-summary p {
    margin: 0;
    overflow-wrap: anywhere;
    line-height: 1.55;
}

.festival-detail-period {
    color: #1f2937;
    font-size: 17px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.festival-detail-location {
    color: #4b5563;
    font-size: 14px;
    font-weight: 600;
}

.festival-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 14px 0 0;
    overflow-wrap: anywhere;
    color: #7b8493;
    font-size: 12px;
    line-height: 1.5;
}

.festival-detail-meta time,
.festival-detail-meta span:last-child {
    font-variant-numeric: tabular-nums;
}

/* 섹션은 박스가 아니라 세로 리듬으로 나눈다 */
.festival-detail-section {
    padding: clamp(36px, 4vw, 52px) 0 0;
}

/* 제목 아래 얇은 선 하나로 영역을 열어 준다 (여행지 상세 정보 섹션과 같은 방식) */
.festival-detail-section h2 {
    margin: 0 0 22px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--festival-border);
    color: #243249;
    font-size: 20px;
    font-weight: 750;
    letter-spacing: 0.01em;
}

/* 본문은 섹션 폭을 그대로 쓴다. 좁은 열을 따로 두지 않는다 */
.festival-detail-content {
    overflow-wrap: anywhere;
    color: #263247;
    font-size: 16px;
    line-height: 1.8;
}

/* 문단 사이를 넉넉히 띄워 긴 소개도 읽기 쉽게 둔다 (여행지 상세 소개와 같은 간격) */
.festival-detail-content p + p,
.festival-detail-content p + ul,
.festival-detail-content p + ol,
.festival-detail-content ul + p,
.festival-detail-content ol + p {
    margin-top: 0.95em;
}

.festival-detail-content h2,
.festival-detail-content h3,
.festival-detail-content h4 {
    margin: 1.5em 0 0.5em;
    color: #1b2637;
    font-weight: 750;
    letter-spacing: -0.01em;
}

.festival-detail-content > :first-child {
    margin-top: 0;
}

.festival-detail-content > :last-child {
    margin-bottom: 0;
}

.festival-detail-content img {
    max-width: 100%;
    height: auto;
}

.festival-detail-content pre {
    max-width: 100%;
    overflow-x: auto;
}

.festival-detail-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

/*
  항목을 낱개 카드로 쪼개지 않는다. 하나의 정보 영역 안에서 2열로 읽히게만 정리한다.
  구분은 얇은 divider 와 여백이 맡는다.
*/
.festival-detail-info-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 clamp(28px, 4vw, 56px);
    margin: 0;
    padding: 0;
}

.festival-detail-info-row {
    display: block;
    padding: 16px 0;
    border-top: 1px solid var(--festival-border-soft);
}

/* 첫 줄 위에는 선을 두지 않는다. 제목 아래 선과 겹쳐 보인다 */
.festival-detail-info-row:nth-child(1),
.festival-detail-info-row:nth-child(2) {
    border-top: 0;
    padding-top: 4px;
}

.festival-detail-info-row.is-wide {
    grid-column: 1 / -1;
}

/* 라벨은 작고 조용하게, 값은 분명하게 */
.festival-detail-info-row dt {
    color: var(--festival-muted);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.4;
}

.festival-detail-info-row dd {
    margin: 5px 0 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    color: #27303c;
    font-size: 15px;
    font-weight: 550;
    line-height: 1.55;
    white-space: pre-line;
}

/*
  기간은 시작·끝 날짜가 한 줄로 읽혀야 한다.
  다른 값은 TourAPI 본문의 실제 줄바꿈을 살려야 해서 pre-line 을 그대로 둔다.
  좁은 화면에서는 공백에서 자연스럽게 접힌다.
*/
.festival-detail-info-row dd.is-period {
    white-space: normal;
    font-variant-numeric: tabular-nums;
}

/* 기관 전화번호처럼 값에 딸린 보조 정보 */
.festival-detail-info-row dd small {
    display: block;
    margin-top: 3px;
    color: var(--festival-muted);
    font-size: 12.5px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1.45;
}

/* 다른 값과 같은 흐름에 두고 링크라는 것만 색으로 알린다 */
.festival-detail-homepage {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--festival-accent-dark);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.festival-detail-homepage:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.festival-image-modal {
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
}

.festival-image-modal.is-open {
    position: fixed;
    inset: 0;
    display: flex;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.festival-image-modal::backdrop {
    background: rgba(0, 0, 0, 0.82);
}

.festival-image-modal.is-fallback.is-open {
    z-index: 2000;
    background: rgba(0, 0, 0, 0.82);
}

.festival-image-modal-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 92vw;
    max-height: 90vh;
    border-radius: 8px;
    background: #111;
}

.festival-image-modal-close,
.festival-image-modal-nav {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.48);
    color: #fff;
    cursor: pointer;
}

.festival-image-modal-close {
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    font-size: 27px;
}

.festival-image-modal-nav {
    top: 50%;
    width: 46px;
    height: 46px;
    font-size: 18px;
    transform: translateY(-50%);
}

.festival-image-modal-nav.prev {
    left: 20px;
}

.festival-image-modal-nav.next {
    right: 20px;
}

.festival-image-modal-nav[hidden] {
    display: none;
}

.festival-detail-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: clamp(36px, 4vw, 52px);
    padding-top: clamp(20px, 2.4vw, 26px);
    border-top: 1px solid var(--festival-border);
}

.festival-detail-back {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 1px solid #d5dae1;
    border-radius: 8px;
    background: #fff;
    color: #566171;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}

.festival-detail-back:hover {
    border-color: #aeb6c1;
    background: #f8f9fb;
    color: #303b4a;
}

/* 태블릿 가로: 히어로 2열은 유지하되 요약 열을 조금 좁힌다 */
@media (max-width: 1023px) {
    .festival-detail {
        width: min(100% - 40px, 900px);
    }

    .festival-detail-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        align-items: stretch;
        padding-bottom: 26px;
    }

    .festival-detail-image-frame {
        aspect-ratio: 16 / 10;
    }
}

@media (max-width: 767px) {
    .festival-detail {
        width: min(100% - 32px, 680px);
        margin-top: 20px;
    }

    .festival-detail-content [class*="ql-indent-"] {
        padding-left: min(3em, 12vw);
    }

    .festival-detail-section {
        padding-top: 32px;
    }

    /* 1열로 쌓이면 두 번째 줄부터도 divider 가 필요하다 */
    .festival-detail-info-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .festival-detail-info-row.is-wide {
        grid-column: auto;
    }

    .festival-detail-info-row:nth-child(2) {
        border-top: 1px solid var(--festival-border-soft);
        padding-top: 16px;
    }
}

@media (max-width: 520px) {
    .festival-detail {
        width: calc(100% - 24px);
    }

    .festival-detail-title-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .festival-detail h1 {
        font-size: 28px;
    }

    .festival-detail-bookmark {
        min-width: 70px;
        min-height: 44px;
        justify-self: start;
        margin-top: 0;
        padding: 0 9px;
    }

    .festival-detail-section h2 {
        font-size: 20px;
    }

    .festival-detail-info-row {
        padding: 14px 0;
    }

    .festival-detail-gallery-nav {
        width: 44px;
        height: 44px;
    }

    .festival-detail-gallery-nav.prev,
    .festival-image-modal-nav.prev {
        left: 10px;
    }

    .festival-detail-gallery-nav.next,
    .festival-image-modal-nav.next {
        right: 10px;
    }

    .festival-image-modal-image {
        max-width: 94vw;
        max-height: 78vh;
    }

    .festival-detail-footer {
        padding-top: 18px;
    }

    .festival-detail-back {
        min-height: 44px;
    }
}
