/*
  여행정보 구조화 콘텐츠(STRUCTURED) 본문. 공개 상세와 관리자 상세 미리보기가 같은 규칙을 쓴다.

  흰 바탕 위에 블록들이 매거진 본문처럼 이어진다. 상자·그림자·둥근 모서리로 감싸지 않는다.
  섹션 제목·본문(기본형)·사진·슬라이더는 콘텐츠 폭의 같은 왼쪽 기준선에서 시작한다.
  본문 집중형(is-focused)과 강조 문구만 좁은 단을 가운데 둔다.
  블록 사이 여백은 블록 성격에 따라 이 파일이 정한다. 관리자가 여백·크기 값을 넣는 자리는 없다.
  그 여백은 아래 "블록 사이 여백" 규칙(다음 블록의 margin-top)만 정한다.
  각 블록 규칙은 자기 바깥 위아래 margin 을 건드리지 않는다. (건드리면 블록 사이 여백을 덮어쓴다)
*/
.structured-content {
    --structured-text-width: 680px;
    --structured-body-width: 880px;
    --structured-focused-width: 700px;
    --structured-ink: #1d2430;
    --structured-body: #3a4352;
    --structured-muted: #6b7180;
    --structured-caption-title: #5c616b;
    --structured-caption: #80858f;
    --structured-line: #e6e4ea;
    --structured-media-bg: #f2f1f4;
    --structured-callout-bg: #f7f5fb;
    --structured-accent: var(--tripbora-primary, #7657c8);
    /* 블록 사이 여백: 글↔글 / 글↔사진 / 사진↔사진 / 제목 다음 / 새 챕터 앞 */
    --structured-space-text: 30px;
    --structured-space-media: 40px;
    --structured-space-media-pair: 46px;
    --structured-space-title-text: 24px;
    --structured-space-title-media: 28px;
    --structured-space-chapter: 80px;
    color: var(--structured-body);
    font-size: 17px;
    line-height: 1.85;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

/*
  ---- 블록 사이 여백 ----
  블록 자신은 위아래 margin 0 이고, "앞 블록 + 다음 블록" 관계로 다음 블록의 margin-top 하나만 준다.
  그래서 여백이 겹치거나(앞 블록 아래 + 다음 블록 위) 사라지지 않는다.
  기본은 글↔사진 간격이고, 글끼리는 가깝게, 사진 블록끼리는 한 덩어리로 보이지 않게 조금 더 띄운다.
*/
.structured-content > * {
    margin-top: 0;
    margin-bottom: 0;
}

.structured-content > * + * {
    margin-top: var(--structured-space-media);
}

.structured-content > :is(.structured-text, .structured-callout) + :is(.structured-text, .structured-callout) {
    margin-top: var(--structured-space-text);
}

.structured-content > :is(.structured-figure, .structured-image-text, .structured-slider, .structured-grid)
    + :is(.structured-figure, .structured-image-text, .structured-slider, .structured-grid) {
    margin-top: var(--structured-space-media-pair);
}

/* 새 챕터는 크게 띄우고, 제목 바로 다음 블록은 제목에 붙인다 (글은 줄 간격만큼 덜 띄운다) */
.structured-content > * + .structured-section-title {
    margin-top: var(--structured-space-chapter);
}

.structured-content > .structured-section-title + * {
    margin-top: var(--structured-space-title-media);
}

.structured-content > .structured-section-title + :is(.structured-text, .structured-callout) {
    margin-top: var(--structured-space-title-text);
}

/* ---- 가운데 글 단 (강조 문구) ---- */
.structured-callout {
    max-width: var(--structured-text-width);
    margin-inline: auto;
}

/* ---- SECTION_TITLE : 왼쪽 세로 accent 선 + 제목. 카드·배경 없이 ---- */
.structured-section-title {
    padding-left: 16px;
    border-left: 3px solid var(--structured-accent);
}

.structured-section-title h2 {
    margin: 0;
    color: var(--structured-ink);
    font-size: 30px;
    font-weight: 750;
    line-height: 1.38;
    letter-spacing: -0.02em;
}

/* ---- RICH_TEXT : 기본은 왼쪽 기준선, 집중형은 좁은 단을 가운데. 글은 둘 다 왼쪽 정렬 ---- */
.structured-text {
    max-width: var(--structured-body-width);
    text-align: left;
}

.structured-text.is-focused {
    max-width: var(--structured-focused-width);
    margin-inline: auto;
}

.structured-text p {
    margin: 0;
    white-space: pre-line;
}

.structured-text p + p {
    margin-top: 1.1em;
}

/*
  서식을 쓴 일반 글(is-rich). 관리자 에디터의 프리셋만 그린다. (StructuredRichTextHtml 이 허용한 태그·class)
  글자 크기는 본문 기준 em 이라 휴대폰에서 본문이 줄면 함께 줄어든다.
*/
.structured-text.is-rich > * {
    margin: 0;
}

.structured-text.is-rich > * + * {
    margin-top: 1.1em;
}

.structured-text.is-rich :is(h3, h4) {
    color: var(--structured-ink);
    font-weight: 700;
    letter-spacing: -0.015em;
}

/* 크기 단계 (본문 17px 기준): 작은 글씨 ≈14px · 본문 17px · 큰 글씨 ≈20px · 소제목 ≈22px · 중제목 ≈26px */
.structured-text.is-rich h3 {
    font-size: 1.53em;
    line-height: 1.4;
}

.structured-text.is-rich h4 {
    font-size: 1.3em;
    line-height: 1.45;
}

.structured-text.is-rich > * + :is(h3, h4) {
    margin-top: 1.6em;
}

.structured-text.is-rich > :is(h3, h4) + * {
    margin-top: 0.5em;
}

.structured-text.is-rich .rt-size-small {
    color: var(--structured-muted);
    font-size: 0.82em;
}

.structured-text.is-rich .rt-size-large {
    color: var(--structured-ink);
    font-size: 1.18em;
}

.structured-text.is-rich :is(ul, ol) {
    padding-left: 1.4em;
}

.structured-text.is-rich li + li {
    margin-top: 0.3em;
}

.structured-text.is-rich blockquote {
    padding: 2px 0 2px 18px;
    border-left: 2px solid var(--structured-line);
    color: var(--structured-muted);
}

.structured-text.is-rich > * + blockquote,
.structured-text.is-rich > blockquote + * {
    margin-top: 1.4em;
}

.structured-text.is-rich strong {
    color: var(--structured-ink);
    font-weight: 700;
}

.structured-text.is-rich mark {
    padding: 0 2px;
    border-radius: 2px;
    background: #f1ebfb;
    color: inherit;
}

.structured-text.is-rich mark.rt-point {
    padding: 0;
    background: none;
    color: var(--structured-accent);
    font-weight: 650;
}

.structured-text.is-rich a {
    color: var(--structured-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.structured-text.is-rich .rt-font-sans {
    font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "Hiragino Sans", "Yu Gothic",
        "PingFang SC", "PingFang TC", "Microsoft YaHei", "Microsoft JhengHei", sans-serif;
}

.structured-text.is-rich .rt-font-serif {
    font-family: "Noto Serif KR", "Nanum Myeongjo", AppleMyungjo, Batang, "Hiragino Mincho ProN", "Yu Mincho",
        "Songti SC", "Songti TC", SimSun, PMingLiU, Georgia, serif;
}

/* ---- FULL_IMAGE ---- */
.structured-figure {
    margin-inline: 0;
}

.structured-figure img {
    display: block;
    width: 100%;
    height: auto;
    background: var(--structured-media-bg);
}

/* 세로 사진은 본문 폭 전체로 키우면 화면보다 길어진다. 폭을 줄여 가운데 둔다. */
.structured-figure.is-portrait img {
    width: min(100%, 560px);
    margin-inline: auto;
}

.structured-figure.is-portrait figcaption {
    width: min(100%, 560px);
    margin-inline: auto;
}

/* ---- IMAGE_TEXT : 사진 45 / 글 55 ---- */
.structured-image-text {
    display: grid;
    grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
    align-items: center;
    gap: 48px;
}

.structured-image-text.is-image-right {
    grid-template-columns: minmax(0, 55fr) minmax(0, 45fr);
}

.structured-image-text.is-image-right .structured-image-text-media {
    order: 2;
}

.structured-image-text-media img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 560px;
    object-fit: cover;
    background: var(--structured-media-bg);
}

.structured-image-text-body h3 {
    margin: 0 0 14px;
    color: var(--structured-ink);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.45;
    letter-spacing: -0.015em;
}

.structured-image-text-body p {
    margin: 0;
    white-space: pre-line;
}

.structured-image-text-body p + p {
    margin-top: 1em;
}

/* ---- IMAGE_SLIDER ---- */
.structured-slider-title {
    margin: 0 0 18px;
    color: var(--structured-ink);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.45;
    letter-spacing: -0.015em;
}

/* 한 장이 트랙 폭 전체를 쓰고, 넘길 때마다 한 장씩 멈춘다. JS 가 없어도 가로로 넘겨 볼 수 있다. */
.structured-slider-track {
    position: relative;
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

/* JS 가 붙어 버튼·키보드로 넘길 수 있게 되면 스크롤 막대를 감춘다 */
.structured-slider.is-enhanced .structured-slider-track {
    scrollbar-width: none;
}

.structured-slider.is-enhanced .structured-slider-track::-webkit-scrollbar {
    display: none;
}

.structured-slide {
    flex: 0 0 100%;
    min-width: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.structured-slide figure {
    margin: 0;
}

.structured-slide-media {
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: var(--structured-media-bg);
}

.structured-slide-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.structured-slider-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--structured-line);
}

.structured-slider-controls[hidden] {
    display: none;
}

.structured-slider-counter {
    display: flex;
    gap: 6px;
    margin: 0;
    color: var(--structured-muted);
    font-size: 13px;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
}

.structured-slider-counter [data-slider-current] {
    color: var(--structured-ink);
    font-weight: 700;
}

.structured-slider-buttons {
    display: flex;
    gap: 8px;
}

.structured-slider-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--structured-line);
    border-radius: 4px;
    background: #fff;
    color: var(--structured-ink);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.structured-slider-button:hover:not(:disabled) {
    border-color: var(--structured-accent);
    color: var(--structured-accent);
}

.structured-slider-button:disabled {
    opacity: 0.35;
    cursor: default;
}

.structured-slider-button:focus-visible,
.structured-slider-track:focus-visible {
    outline: 2px solid var(--structured-accent);
    outline-offset: 3px;
}

/* ---- IMAGE_GRID : 사진 2장(4:3) / 3장(1:1)을 한 줄에. 같은 비율 틀에 잘라 넣어 줄을 맞춘다 ---- */
.structured-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 20px;
    padding: 0;
    list-style: none;
}

.structured-grid.is-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px 16px;
}

.structured-grid-item {
    min-width: 0;
}

.structured-grid-item figure {
    margin: 0;
}

.structured-grid-media {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--structured-media-bg);
}

.structured-grid.is-three .structured-grid-media {
    aspect-ratio: 1 / 1;
}

.structured-grid-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/*
  ---- 사진 아래 제목·설명 (FULL_IMAGE / IMAGE_GRID 칸 / IMAGE_SLIDER 사진) ----
  본문 제목이 아니라 사진의 보조 정보다. 사진 가운데 기준으로, 본문보다 작고 연하게 둔다.
  제목은 중간 굵기의 회색, 설명은 그보다 한 단계 더 연하게. 글은 그 사진(칸) 폭 안에서만 줄바꿈한다.
*/
.structured-media-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    max-width: var(--structured-text-width);
    margin-inline: auto;
    padding-top: 12px;
    color: var(--structured-caption);
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.65;
    text-align: center;
    text-wrap: pretty;
}

.structured-media-title {
    color: var(--structured-caption-title);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
}

/*
  ---- 사진 출처표시 (모든 사진 블록) ----
  순서: 사진 → 출처 한 줄(사진 폭 기준 오른쪽) → 제목 → 설명. 출처는 제목·설명과 다른 줄이라 제목은 언제나 사진 가운데다.
  제목보다 확실히 작은 보조 글이다. 줄바꿈하지 않고, 배경·테두리 없이 캡션보다 조금 더 연하게 둔다.
  아주 긴 출처가 좁은 칸을 넘으면 옆 칸을 침범하지 않게 끝을 줄인다. (전체 글은 title 로 보인다)
  링크는 같은 색에 밑줄 없이 두고, 마우스를 올릴 때만 옅은 밑줄이 생긴다. URL 은 글로 보이지 않는다.
*/
.structured-media-credit {
    display: block;
    margin: 4px 0;
    overflow: hidden;
    color: #959aa3;
    font-size: 10px;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: -0.02em;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 출처 다음 제목·설명은 출처에 붙여 올린다. (출처가 없으면 예전 간격 그대로) */
.structured-media-credit + .structured-media-caption {
    padding-top: 4px;
}

/* 세로 사진은 사진 폭을 줄여 가운데 둔다. 출처도 그 사진 오른쪽 끝에 맞춘다. */
.structured-figure.is-portrait .structured-media-credit {
    width: min(100%, 560px);
    margin-inline: auto;
}

.structured-media-credit a {
    color: inherit;
    text-decoration: none;
}

.structured-media-credit a:hover,
.structured-media-credit a:focus-visible {
    color: var(--structured-caption-title);
    text-decoration: underline;
    text-decoration-color: rgba(128, 133, 143, 0.5);
    text-underline-offset: 2px;
}

/*
  ---- 본문 사진 확대 모달 (공개 상세, /js/structured-gallery.js) ----
  스크립트가 붙은 사진(role=button)만 누를 수 있게 보인다. 모달은 화면 전체를 어둡게 덮고, 사진은 비율 그대로
  화면 안에서 가장 크게 보인다. 사진 아래 제목·설명·출처는 작게. 좌우·닫기 버튼은 감상을 방해하지 않게 옅게 둔다.
  모달은 .structured-content 밖(페이지 끝)에 있어 본문 색 변수를 쓰지 않고 색을 직접 적는다.
*/
.structured-content [data-structured-gallery-image][role="button"] {
    cursor: zoom-in;
    transition: opacity 0.15s ease;
}

.structured-content [data-structured-gallery-image][role="button"]:hover {
    opacity: 0.94;
}

.structured-content [data-structured-gallery-image][role="button"]:focus-visible {
    outline: 2px solid var(--structured-accent);
    outline-offset: 3px;
}

.structured-gallery {
    position: fixed;
    inset: 0;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 60px 72px 24px;
    border: 0;
    background: rgba(12, 14, 18, 0.92);
    color: #fff;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.structured-gallery:not([open]) {
    display: none;
}

.structured-gallery[open] {
    display: flex;
}

.structured-gallery::backdrop {
    background: transparent;
}

.structured-gallery-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 100%;
    margin: auto;
}

.structured-gallery-image {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(100vw - 144px);
    max-height: calc(100vh - 150px);
    object-fit: contain;
    cursor: zoom-out;
}

.structured-gallery-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    max-width: min(680px, 100%);
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    line-height: 1.55;
    text-align: center;
    overflow-wrap: anywhere;
}

.structured-gallery-meta[hidden],
.structured-gallery-meta [hidden] {
    display: none;
}

.structured-gallery-title {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

/* 본문 출처 줄을 복사해 쓴다. 모달에서는 줄바꿈을 허용하고 가운데에 둔다. */
.structured-gallery-credit .structured-media-credit {
    margin: 2px 0 0;
    overflow: visible;
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    text-align: center;
    white-space: normal;
}

.structured-gallery-credit .structured-media-credit a:hover,
.structured-gallery-credit .structured-media-credit a:focus-visible {
    color: #fff;
    text-decoration-color: rgba(255, 255, 255, 0.6);
}

.structured-gallery-close,
.structured-gallery-nav {
    position: fixed;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.structured-gallery-close {
    top: 12px;
    right: 12px;
    font-size: 26px;
}

.structured-gallery-nav {
    top: 50%;
    transform: translateY(-50%);
}

.structured-gallery-nav.is-prev {
    left: 12px;
}

.structured-gallery-nav.is-next {
    right: 12px;
}

.structured-gallery-close:hover,
.structured-gallery-nav:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.structured-gallery-close:focus-visible,
.structured-gallery-nav:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.structured-gallery.is-single .structured-gallery-nav {
    display: none;
}

/* ---- CALLOUT : 본문 사이의 짧은 쉼표. 경고창처럼 보이지 않게 옅게 ---- */
.structured-callout {
    padding: 18px 22px;
    border-left: 2px solid var(--structured-accent);
    background: var(--structured-callout-bg);
    color: var(--structured-ink);
}

.structured-callout p {
    margin: 0;
    font-size: 16px;
    line-height: 1.75;
    white-space: pre-line;
}

/* ---- 태블릿 ---- */
@media (max-width: 960px) {
    .structured-image-text {
        gap: 32px;
    }

    .structured-content {
        --structured-space-chapter: 72px;
    }
}

/* ---- 휴대폰 ---- */
@media (max-width: 720px) {
    /* 여백은 데스크톱보다 약 20% 줄인다 */
    .structured-content {
        --structured-space-text: 24px;
        --structured-space-media: 32px;
        --structured-space-media-pair: 36px;
        --structured-space-title-text: 18px;
        --structured-space-title-media: 22px;
        --structured-space-chapter: 64px;
        font-size: 16px;
        line-height: 1.8;
    }

    .structured-section-title {
        padding-left: 12px;
    }

    .structured-section-title h2 {
        font-size: 24px;
    }

    /* 좁은 화면은 사진을 먼저, 글을 아래에 둔다. (이미지 위치와 상관없이) */
    .structured-image-text,
    .structured-image-text.is-image-right {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .structured-image-text.is-image-right .structured-image-text-media {
        order: 0;
    }

    .structured-image-text-media img {
        max-height: 420px;
    }

    .structured-image-text-body h3,
    .structured-slider-title {
        font-size: 20px;
    }

    .structured-slide-media {
        aspect-ratio: 4 / 3;
    }

    /* 2장·3장 배치 모두 한 줄에 한 장. 3장도 2열 + 1장보다 같은 크기로 쌓는 편이 자연스럽다. */
    .structured-grid,
    .structured-grid.is-three {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .structured-grid.is-three .structured-grid-media {
        aspect-ratio: 4 / 3;
    }

    .structured-media-caption {
        padding-top: 10px;
        font-size: 13px;
    }

    .structured-media-title {
        font-size: 14px;
    }

    .structured-slider-button {
        width: 44px;
        height: 44px;
    }

    /* 확대 모달: 사진을 화면 폭 가까이 쓰고, 좌우 버튼은 사진 가장자리 위에 옅은 어두운 바탕으로 둔다. */
    .structured-gallery {
        padding: 60px 12px 16px;
        /* 세로 읽기와 핀치 확대는 허용하고 가로 이동은 갤러리가 처리한다. */
        touch-action: pan-y pinch-zoom;
    }

    .structured-gallery-image {
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 160px);
        cursor: default;
    }

    .structured-gallery-nav {
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.35);
    }

    .structured-gallery-nav.is-prev {
        left: 6px;
    }

    .structured-gallery-nav.is-next {
        right: 6px;
    }

    .structured-callout {
        padding: 16px 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .structured-slider-track {
        scroll-behavior: auto;
    }
}
