/*
 * Site-wide family contract and authored-content spacing contract.
 * The family section owns font-family only. The final spacing section owns
 * paragraph and outer visual-block margins only; existing weight, size,
 * line-height, alignment, width and authored font choices stay with their
 * current owners.
 */

:root {
    --rara-font-global: "Roboto", "Inter", "Noto Sans KR", Pretendard, sans-serif;
    --rara-font-quote-serif: "Nanum Myeongjo", serif;
    --rara-font-monospace: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    --jd-font-default: var(--rara-font-global);
}

html,
body {
    font-family: var(--rara-font-global);
}

/* Native controls and their generated text do not consistently inherit. */
button,
input,
select,
textarea,
optgroup,
option,
input::placeholder,
textarea::placeholder,
input::file-selector-button,
input::-webkit-file-upload-button,
svg text {
    font-family: inherit;
}

/* Legacy inline families in application chrome are defaults, not authored
 * choices. The authored/semantic boundaries below remain untouched. */
html body :where([style*="font-family" i]):not(:where(
    [data-rara-font-scope="authored"],
    [data-rara-font-scope="authored"] *,
    [data-explicit-font],
    [data-explicit-font] *,
    pre,
    pre *,
    code,
    code *,
    kbd,
    kbd *,
    samp,
    samp *,
    .rara-mini-quote,
    .rara-quote-mark,
    .material-symbols-rounded,
    .material-symbols-outlined,
    .material-icons,
    .material-icons-outlined,
    .fa,
    .fas,
    .far,
    .fab,
    .fal,
    .fad,
    .fa-solid,
    .fa-regular,
    .fa-brands,
    .fa-light,
    .fa-duotone
)) {
    font-family: var(--rara-font-global) !important;
}

/* Published/editor/builder roots use data-rara-font-scope="authored" only as
 * an exception boundary. They inherit by default; no rule here can overwrite
 * an explicit family selected on the root or one of its descendants. */

/* Intentional authored quotes remain serif, including descendants and marks. */
[data-rara-font-scope="authored"] :is(
    blockquote,
    .rara-quote,
    .rara-feature-quote,
    [class*="rara-quote-style-"],
    .se-module-quotation,
    [data-rara-quote-style]
),
[data-rara-font-scope="authored"] :is(
    blockquote,
    .rara-quote,
    .rara-feature-quote,
    [class*="rara-quote-style-"],
    .se-module-quotation,
    [data-rara-quote-style]
) *,
[data-rara-font-scope="authored"] .rara-quote-mark,
[data-rara-font-scope="authored"] .rara-quote-mark *,
.rara-selection-toolbar .rara-mini-quote {
    font-family: var(--rara-font-quote-serif) !important;
}

/* Semantic code, tokens and generated credentials remain monospace. */
pre,
pre *,
code,
code *,
kbd,
kbd *,
samp,
samp *,
.code_input,
.sitecode,
.ace_editor,
.ace_editor *,
.CodeMirror,
.CodeMirror *,
.jodit-source__mirror,
.jodit-source__mirror *,
[data-rara-font-role="code"],
[data-rara-font-role="code"] *,
[data-rara-font-role="token"],
[data-rara-font-role="token"] *,
.rara-account-manager__clone-password input,
.rara-account-manager__create-password input {
    font-family: var(--rara-font-monospace) !important;
}

/* Material ligature glyphs must not inherit an ordinary text family. */
.material-symbols-rounded,
.material-symbols-rounded::before,
.material-symbols-rounded::after {
    font-family: "Material Symbols Rounded" !important;
}

.material-symbols-outlined,
.material-symbols-outlined::before,
.material-symbols-outlined::after {
    font-family: "Material Symbols Outlined" !important;
}

.material-icons,
.material-icons::before,
.material-icons::after {
    font-family: "Material Icons" !important;
}

.material-icons-outlined,
.material-icons-outlined::before,
.material-icons-outlined::after {
    font-family: "Material Icons Outlined" !important;
}

/* Font Awesome 4. */
.fa,
.fa::before,
.fa::after {
    font-family: FontAwesome !important;
}

/* Font Awesome 5/6. Their existing font-weight declarations remain owners. */
:is(.fas, .fa-solid),
:is(.fas, .fa-solid)::before,
:is(.fas, .fa-solid)::after,
:is(.far, .fa-regular),
:is(.far, .fa-regular)::before,
:is(.far, .fa-regular)::after {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome !important;
}

:is(.fab, .fa-brands),
:is(.fab, .fa-brands)::before,
:is(.fab, .fa-brands)::after {
    font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands" !important;
}

:is(.fal, .fa-light),
:is(.fal, .fa-light)::before,
:is(.fal, .fa-light)::after {
    font-family: "Font Awesome 6 Pro", "Font Awesome 5 Pro" !important;
}

:is(.fad, .fa-duotone),
:is(.fad, .fa-duotone)::before,
:is(.fad, .fa-duotone)::after {
    font-family: "Font Awesome 6 Duotone", "Font Awesome 5 Duotone" !important;
}

/*
 * Unified article/editor rhythm.
 *
 * Keep this root list limited to authored post bodies and their live preview.
 * In particular, the homepage builder is an authored font boundary but not a
 * post body: its user-configurable component margins must remain untouched.
 */
html body :is(
    #bo_v_con,
    .member-view-content,
    .member-notice-content,
    .rara-link-preview-content,
    #bo_w.rara-write-page .jodit-wysiwyg,
    .jodit-wysiwyg[data-rara-font-scope="authored"],
    [data-rara-content-spacing="1"]
) p:not(:root) {
    margin: 0 !important;
}

/*
 * A visual block can contain other elements that also look like standalone
 * blocks (a card contains an image, a collage contains figures, and so on).
 * The final :not() selects only the outer representative, preserving every
 * component's internal layout while normalising its vertical contact space.
 */
html body :is(
    #bo_v_con,
    .member-view-content,
    .member-notice-content,
    .rara-link-preview-content,
    #bo_w.rara-write-page .jodit-wysiwyg,
    .jodit-wysiwyg[data-rara-font-scope="authored"],
    [data-rara-content-spacing="1"]
) :is(
    figure,
    blockquote,
    .se-module-quotation,
    .rara-feature-quote,
    .rara-quote,
    .rara-v3-image-block,
    .rara-paste-img-wrap,
    .rara-image-wrap,
    .rara-photo-single,
    .rara-photo-slider,
    .rara-photo-collage,
    .rara-collage,
    [data-rara-collage],
    .rara-naver-collage,
    .rara-link-collage,
    .rara-naver-paste-collage,
    .rara-prepared-naver-collage,
    .se-module-image,
    .se-imagegrid,
    .se-imagegroup,
    .se-imagestrip,
    .rara-link-card,
    .rara-post-card,
    .se-oglink-frame,
    .se-module-oglink,
    .rara-naver-place-card,
    .rara-place-card,
    [data-rara-block="naver-place"],
    .rara-map-card,
    .rara-naver-map-card,
    .se-module-map,
    .se-map,
    .se-placesmap,
    .rara-link-table-naver-wrap,
    .rara-link-table-scroll,
    table,
    .rara-feature-table,
    .se-table,
    .se-module-table,
    .rara-divider,
    hr,
    iframe,
    video,
    audio,
    object,
    embed,
    canvas,
    .rara-embed,
    .rara-video,
    .se-module-video,
    .se-module-embed,
    a.rara-link-contact-banner,
    pre,
    img
):not(p):not(:root):not(:where(
    :is(
        figure,
        blockquote,
        .se-module-quotation,
        .rara-feature-quote,
        .rara-quote,
        .rara-v3-image-block,
        .rara-paste-img-wrap,
        .rara-image-wrap,
        .rara-photo-single,
        .rara-photo-slider,
        .rara-photo-collage,
        .rara-collage,
        [data-rara-collage],
        .rara-naver-collage,
        .rara-link-collage,
        .rara-naver-paste-collage,
        .rara-prepared-naver-collage,
        .se-module-image,
        .se-imagegrid,
        .se-imagegroup,
        .se-imagestrip,
        .rara-link-card,
        .rara-post-card,
        .se-oglink-frame,
        .se-module-oglink,
        .rara-naver-place-card,
        .rara-place-card,
        [data-rara-block="naver-place"],
        .rara-map-card,
        .rara-naver-map-card,
        .se-module-map,
        .se-map,
        .se-placesmap,
        .rara-link-table-naver-wrap,
        .rara-link-table-scroll,
        table,
        .rara-feature-table,
        .se-table,
        .se-module-table,
        .rara-divider,
        hr,
        iframe,
        video,
        audio,
        object,
        embed,
        canvas,
        .rara-embed,
        .rara-video,
        .se-module-video,
        .se-module-embed,
        a.rara-link-contact-banner,
        pre,
        img
    ):not(p) *
)) {
    margin-block-start: var(--rara-content-adjacent-special-start, 28px) !important;
    margin-block-end: 28px !important;
}

/*
 * Treat a media-only paragraph (and known imported section shell) as a
 * transparent flow unit. The custom property is inherited by its inner visual
 * representative, so the paragraph itself remains margin:0 in every shape.
 * This single adjacency rule covers direct/direct, direct/p, p/direct and p/p
 * pairs for every ordered combination in the special-block taxonomy.
 */
html body :is(
    #bo_v_con,
    .member-view-content,
    .member-notice-content,
    .rara-link-preview-content,
    #bo_w.rara-write-page .jodit-wysiwyg,
    .jodit-wysiwyg[data-rara-font-scope="authored"],
    [data-rara-content-spacing="1"]
) :is(
    :is(
    figure,
    blockquote,
    .se-module-quotation,
    .rara-feature-quote,
    .rara-quote,
    .rara-v3-image-block,
    .rara-paste-img-wrap,
    .rara-image-wrap,
    .rara-photo-single,
    .rara-photo-slider,
    .rara-photo-collage,
    .rara-collage,
    [data-rara-collage],
    .rara-naver-collage,
    .rara-link-collage,
    .rara-naver-paste-collage,
    .rara-prepared-naver-collage,
    .se-module-image,
    .se-imagegrid,
    .se-imagegroup,
    .se-imagestrip,
    .rara-link-card,
    .rara-post-card,
    .se-oglink-frame,
    .se-module-oglink,
    .rara-naver-place-card,
    .rara-place-card,
    [data-rara-block="naver-place"],
    .rara-map-card,
    .rara-naver-map-card,
    .se-module-map,
    .se-map,
    .se-placesmap,
    .rara-link-table-naver-wrap,
    .rara-link-table-scroll,
    table,
    .rara-feature-table,
    .se-table,
    .se-module-table,
    .rara-divider,
    hr,
    iframe,
    video,
    audio,
    object,
    embed,
    canvas,
    .rara-embed,
    .rara-video,
    .se-module-video,
    .se-module-embed,
    a.rara-link-contact-banner,
    pre,
    img
    ):not(p),
    p:has(:is(
        figure,
        blockquote,
        .se-module-quotation,
        .rara-feature-quote,
        .rara-quote,
        .rara-v3-image-block,
        .rara-paste-img-wrap,
        .rara-image-wrap,
        .rara-photo-single,
        .rara-photo-slider,
        .rara-photo-collage,
        .rara-collage,
        [data-rara-collage],
        .rara-naver-collage,
        .rara-link-collage,
        .rara-naver-paste-collage,
        .rara-prepared-naver-collage,
        .se-module-image,
        .se-imagegrid,
        .se-imagegroup,
        .se-imagestrip,
        .rara-link-card,
        .rara-post-card,
        .se-oglink-frame,
        .se-module-oglink,
        .rara-naver-place-card,
        .rara-place-card,
        [data-rara-block="naver-place"],
        .rara-map-card,
        .rara-naver-map-card,
        .se-module-map,
        .se-map,
        .se-placesmap,
        .rara-link-table-naver-wrap,
        .rara-link-table-scroll,
        table,
        .rara-feature-table,
        .se-table,
        .se-module-table,
        .rara-divider,
        hr,
        iframe,
        video,
        audio,
        object,
        embed,
        canvas,
        .rara-embed,
        .rara-video,
        .se-module-video,
        .se-module-embed,
        a.rara-link-contact-banner,
        pre,
        img
    ):not(p)),
    .se-component:has(:is(
        .se-module-image,
        .se-module-quotation,
        .se-module-oglink,
        .se-module-map,
        .se-module-table,
        .se-module-video,
        .se-module-embed
    )),
    .se-section-map,
    .se-section-oglink,
    .se-section-placesmap,
    .se-section-table
) + :is(
    :is(
    figure,
    blockquote,
    .se-module-quotation,
    .rara-feature-quote,
    .rara-quote,
    .rara-v3-image-block,
    .rara-paste-img-wrap,
    .rara-image-wrap,
    .rara-photo-single,
    .rara-photo-slider,
    .rara-photo-collage,
    .rara-collage,
    [data-rara-collage],
    .rara-naver-collage,
    .rara-link-collage,
    .rara-naver-paste-collage,
    .rara-prepared-naver-collage,
    .se-module-image,
    .se-imagegrid,
    .se-imagegroup,
    .se-imagestrip,
    .rara-link-card,
    .rara-post-card,
    .se-oglink-frame,
    .se-module-oglink,
    .rara-naver-place-card,
    .rara-place-card,
    [data-rara-block="naver-place"],
    .rara-map-card,
    .rara-naver-map-card,
    .se-module-map,
    .se-map,
    .se-placesmap,
    .rara-link-table-naver-wrap,
    .rara-link-table-scroll,
    table,
    .rara-feature-table,
    .se-table,
    .se-module-table,
    .rara-divider,
    hr,
    iframe,
    video,
    audio,
    object,
    embed,
    canvas,
    .rara-embed,
    .rara-video,
    .se-module-video,
    .se-module-embed,
    a.rara-link-contact-banner,
    pre,
    img
    ):not(p),
    p:has(:is(
        figure,
        blockquote,
        .se-module-quotation,
        .rara-feature-quote,
        .rara-quote,
        .rara-v3-image-block,
        .rara-paste-img-wrap,
        .rara-image-wrap,
        .rara-photo-single,
        .rara-photo-slider,
        .rara-photo-collage,
        .rara-collage,
        [data-rara-collage],
        .rara-naver-collage,
        .rara-link-collage,
        .rara-naver-paste-collage,
        .rara-prepared-naver-collage,
        .se-module-image,
        .se-imagegrid,
        .se-imagegroup,
        .se-imagestrip,
        .rara-link-card,
        .rara-post-card,
        .se-oglink-frame,
        .se-module-oglink,
        .rara-naver-place-card,
        .rara-place-card,
        [data-rara-block="naver-place"],
        .rara-map-card,
        .rara-naver-map-card,
        .se-module-map,
        .se-map,
        .se-placesmap,
        .rara-link-table-naver-wrap,
        .rara-link-table-scroll,
        table,
        .rara-feature-table,
        .se-table,
        .se-module-table,
        .rara-divider,
        hr,
        iframe,
        video,
        audio,
        object,
        embed,
        canvas,
        .rara-embed,
        .rara-video,
        .se-module-video,
        .se-module-embed,
        a.rara-link-contact-banner,
        pre,
        img
    ):not(p)),
    .se-component:has(:is(
        .se-module-image,
        .se-module-quotation,
        .se-module-oglink,
        .se-module-map,
        .se-module-table,
        .se-module-video,
        .se-module-embed
    )),
    .se-section-map,
    .se-section-oglink,
    .se-section-placesmap,
    .se-section-table
) {
    --rara-content-adjacent-special-start: 0px;
}
