/* ===========================
   공통 변수
=========================== */
:root {
    --sidebar-width: 250px;
    --sidebar-inner-width: 230px;
    --sidebar-gap: 10px;

    --content-desktop-padding: 40px;

    --color-background: #ffffff;
    --color-text: #333333;
    --color-muted: #777777;
    --color-light-muted: #999999;
    --color-border: #dddddd;
    --color-light-border: #eeeeee;

    --color-accent: #d28a2e;
    --color-accent-background: #ffdea8;

    --color-error: #ff3d3d;
}

/* ===========================
   기본 초기화
=========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;

    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family:
        "Noto Sans KR",
        sans-serif;

    background:
        var(--color-background);

    color:
        var(--color-text);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;

    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

/* ===========================
   공통 레이아웃
=========================== */
#layout {
    display: flex;

    width: 100%;
    min-height: 100vh;
}

#content {
    flex: 1;

    position: relative;

    min-width: 0;
    min-height: 100vh;

    padding:
        var(--content-desktop-padding);

    background:
        var(--color-background);

    overflow-y: auto;
}

/* ===========================
   HOME 로고
=========================== */
.main-logo {
    display: none;
}

body.is-home
.main-logo {
    position: fixed;

    top: 50%;

    left:
        calc(
            var(--sidebar-width) +
            (
                100vw -
                var(--sidebar-width)
            ) / 2
        );

    z-index: 10;

    display: flex;
    align-items: center;
    justify-content: center;

    transform:
        translate(-50%, -50%);

    text-align: center;
}

.main-logo img {
    width: 800px;

    max-width:
        min(80vw, 800px);

    height: auto;
}

body.is-home
#content > * {
    display: none;
}

body:not(.is-home)
.main-logo {
    display: none;
}

/* ===========================
   글 본문
=========================== */
.post-wrap,
.guest-wrap,
.tag-wrap {
    max-width: 900px;

    margin: 0 auto;
}

body.is-character-post
.post-wrap {
    max-width: 1500px;
}

.post-header {
    margin-bottom: 28px;
}

.post-wrap h1,
.guest-wrap h1,
.tag-wrap h1 {
    margin-bottom: 15px;

    font-size: 32px;
    line-height: 1.35;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;

    gap: 8px;

    margin-bottom: 28px;

    color:
        var(--color-muted);

    font-size: 14px;
}

.post-edit,
.post-edit-link,
.post-delete-link {
    color: inherit;
}

.post-edit-link:hover,
.post-delete-link:hover,
.post-edit-link:focus-visible,
.post-delete-link:focus-visible {
    color:
        var(--color-accent);
}

.post-delete-link {
    margin-left: 0;

    text-decoration: none;
}

.post-edit-divider {
    margin: 0 6px;

    color:
        var(--color-light-muted);
}

.post-body {
    min-width: 0;

    font-size: 16px;
    line-height: 1.8;
}

.post-body img {
    max-width: 100%;

    height: auto;
}

.post-body iframe,
.post-body video {
    max-width: 100%;
}

.post-body table {
    max-width: 100%;
}

.post-tags {
    margin-top: 40px;
    padding-top: 20px;

    border-top:
        1px solid
        var(--color-light-border);
}

.post-comments {
    margin-top: 40px;
}

/* ===========================
   보호글 비밀번호 화면
=========================== */
.protected-wrap {
    width: 100%;

    min-height:
        calc(100vh - 80px);

    display: flex;
    align-items: center;
    justify-content: center;
}

.protected-box {
    width: 100%;
    max-width: 320px;

    display: flex;
    flex-direction: column;
    align-items: center;

    text-align: center;
}

.protected-message {
    margin: 0 0 14px;

    color: #555555;

    font-size: 15px;
    line-height: 1.6;
}

.protected-input {
    width: 100%;
    height: 38px;

    padding: 8px 10px;

    border:
        1px solid #cccccc;

    border-radius: 4px;

    background:
        var(--color-background);

    color:
        var(--color-text);

    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.protected-input.is-error {
    border-color:
        var(--color-error);
}

.protected-input.is-error:focus {
    outline:
        2px solid
        rgba(255, 61, 61, 0.25);

    outline-offset: 2px;
}

.protected-error-message {
    width: 100%;

    margin: 8px 0 0;

    color:
        var(--color-error);

    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
}

.protected-error-message[hidden] {
    display: none;
}

.protected-button {
    width: 100%;
    height: 38px;

    margin-top: 10px;

    border:
        1px solid
        var(--color-accent-background);

    border-radius: 4px;

    background:
        var(--color-accent-background);

    color:
        var(--color-text);

    font-size: 14px;
    line-height: 1.5;
}

.protected-button:hover {
    opacity: 0.82;
}

.protected-button:focus-visible,
.protected-input:focus-visible {
    outline:
        2px solid
        var(--color-accent);

    outline-offset: 2px;
}

body.is-list-page
.protected-wrap,

body.is-person-category
.protected-wrap,

body.is-simple-list-category
.protected-wrap {
    display: none;
}

/* ===========================
   태그
=========================== */
.tag-list {
    display: flex;
    flex-wrap: wrap;

    gap: 10px;

    list-style: none;
}

.tag-list a {
    display: inline-block;

    padding: 8px 12px;

    border-radius: 999px;

    background: #f5f5f5;

    font-size: 14px;
}

.tag-list a:hover,
.tag-list a:focus-visible {
    color:
        var(--color-accent);
}

/* ===========================
   페이징
=========================== */
.paging {
    margin-top: 40px;

    text-align: center;
}

.paging a {
    display: inline-block;

    margin: 0 4px;
    padding: 6px 10px;

    border:
        1px solid
        var(--color-border);

    border-radius: 4px;

    color:
        var(--color-text);
}

.paging a:hover,
.paging a:focus-visible {
    border-color:
        var(--color-accent);

    color:
        var(--color-accent);
}

.paging .no-more-prev,
.paging .no-more_next,
.paging .no-more-next {
    display: none;
}

/* ===========================
   관리자 새 글 버튼
=========================== */
.list-title-row {
    display: flex;
    align-items: baseline;

    gap: 8px;
}

.list-write-link {
    color:
        var(--color-light-muted);

    font-size: 12px;
    font-weight: 400;
}

.list-write-link:hover,
.list-write-link:focus-visible {
    color:
        var(--color-accent);
}

.admin-only-write {
    display: none;
}

body.is-admin
.admin-only-write {
    display: inline-block;
}

/* ===========================
   상단 이동 버튼
=========================== */
#scroll-top-btn {
    position: fixed;

    right: 24px;
    bottom: 88px;
    z-index: 3900;

    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    border:
        1px solid
        var(--color-border);

    border-radius: 999px;

    background:
        rgba(255, 255, 255, 0.92);

    color:
        var(--color-text);

    box-shadow:
        0 6px 18px
        rgba(0, 0, 0, 0.14);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform:
        translateY(8px);

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.2s ease,
        border-color 0.2s ease,
        background-color 0.2s ease,
        color 0.2s ease;
}

#scroll-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform:
        translateY(0);
}

#scroll-top-btn:hover {
    border-color:
        var(--color-accent);

    background:
        var(--color-accent-background);

    color:
        var(--color-text);
}

#scroll-top-btn:focus-visible {
    outline:
        2px solid
        var(--color-accent);

    outline-offset: 3px;
}

.scroll-top-text {
    position: absolute;

    width: 1px;
    height: 1px;

    overflow: hidden;

    clip:
        rect(0, 0, 0, 0);

    white-space: nowrap;
}

.scroll-top-icon {
    font-size: 22px;
    line-height: 1;

    transform:
        translateY(-1px);
}

body.is-home
#scroll-top-btn {
    display: none;
}

/* ===========================
   접은글 툴팁
=========================== */
.btn-toggle-moreless.has-moreless-tooltip {
    position: relative;

    display: inline-block;

    overflow: visible;
}

.btn-toggle-moreless.has-moreless-tooltip::after {
    content:
        attr(data-moreless-tooltip);

    position: absolute;

    left:
        calc(100% + 10px);

    top: 50%;
    z-index: 9999;

    width: max-content;

    max-width:
        min(320px, 70vw);

    margin: 0;
    padding: 8px 10px;

    border:
        1px solid
        var(--color-text);

    border-radius: 0;

    background: #fffcf0;

    color:
        var(--color-text);

    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: normal;
    text-align: left;
    text-decoration: none;
    white-space: pre-line;

    box-shadow: none;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform:
        translate(4px, -50%);

    transition:
        opacity 0.16s ease,
        transform 0.16s ease,
        visibility 0s linear 0.16s;
}

.btn-toggle-moreless.has-moreless-tooltip:not(.is-moreless-open):hover::after,
.btn-toggle-moreless.has-moreless-tooltip:not(.is-moreless-open):focus-visible::after {
    opacity: 1;
    visibility: visible;

    transform:
        translate(0, -50%);

    transition:
        opacity 0.16s ease,
        transform 0.16s ease,
        visibility 0s linear 0s;
}

.btn-toggle-moreless.has-moreless-tooltip.is-moreless-open::after {
    content: none;

    opacity: 0;
    visibility: hidden;
}

/* ===========================
   티스토리 구독 버튼
=========================== */
html body
.btn_menu_toolbar.btn_subscription,

html body
.menu_toolbar
.btn_subscription,

html body
.btn_subscription {
    position: fixed;

    right: 24px;
    bottom: 24px;
    z-index: 99999;

    visibility: visible;
    opacity: 1;
}

/* ===========================
   모바일 공통·게시글
=========================== */
@media (max-width: 768px) {
    body.is-home
    .main-logo {
        top: 50%;
        left: 50%;

        width: 100%;

        padding: 0 20px;

        transform:
            translate(-50%, -50%);
    }

    body.is-home
    .main-logo img {
        width: 100%;
        max-width: 420px;
    }

    .post-wrap h1,
    .guest-wrap h1,
    .tag-wrap h1 {
        font-size: 26px;
    }

    .post-header {
        margin-bottom: 22px;
    }

    .post-meta {
        margin-bottom: 22px;
    }

    .post-body {
        font-size: 15px;
        line-height: 1.75;
    }

    .protected-wrap {
        min-height:
            calc(100dvh - 120px);

        padding: 20px;
    }

    .protected-box {
        max-width: 300px;
    }

    .btn-toggle-moreless.has-moreless-tooltip::after {
        left:
            calc(100% + 8px);

        max-width:
            min(240px, 62vw);

        padding: 7px 9px;

        font-size: 14px;
    }

    html body
    .btn_menu_toolbar.btn_subscription,

    html body
    .menu_toolbar
    .btn_subscription,

    html body
    .btn_subscription,

    html body
    .mobile-custom-subscribe,

    html body
    .mobile-subscribe-btn {
        display: none;
    }
}

/* ===========================
   작은 모바일
=========================== */
@media (max-width: 480px) {
    .post-wrap h1,
    .guest-wrap h1,
    .tag-wrap h1 {
        font-size: 23px;
    }

    .post-body {
        font-size: 15px;
    }

    #scroll-top-btn {
        right: 16px;
        bottom: 24px;

        width: 42px;
        height: 42px;
    }
}

/* ===========================
   모션 감소 환경
=========================== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    #scroll-top-btn,
    .btn-toggle-moreless.has-moreless-tooltip::after {
        transition: none;
    }
}