/* 진료 상세 /treatments/{slug} — 클래스 접두사: tx-head, tx-crumb, tx-layout, tx-toc, tx-main, tx-doctor(s), tx-related, tx-pager */

/* ---------------------------------------------------------------- head */
.tx-head { padding: clamp(36px, 4.4vw, 64px) 0 clamp(40px, 5vw, 72px); border-bottom: 1px solid var(--line); }
.tx-head__grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--col-gap);
    row-gap: 32px;
    align-items: start;
}
.tx-head__intro { grid-column: 1 / span 7; align-self: center; }
.tx-head__figure { grid-column: 9 / span 4; }
.tx-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 600; color: var(--ink-3); }
.tx-crumb a { color: var(--accent); }
.tx-crumb a:hover { text-decoration: underline; text-underline-offset: 4px; }
.tx-head__title {
    margin-top: 16px;
    font-size: clamp(34px, 4vw, 56px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.045em;
}
.tx-head__en { margin-top: 8px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.tx-head__lead { max-width: 36em; margin-top: 20px; font-size: clamp(17px, 1.25vw, 19px); line-height: 1.75; color: var(--ink-2); }
.tx-head__doctors {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    margin-top: 20px;
    font-size: 15.5px;
}
.tx-head__doctors-label { font-weight: 700; color: var(--ink-3); }
.tx-head__doctors a { font-weight: 700; color: var(--accent); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.tx-head__board { color: var(--ink-2); }
.tx-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 28px; }

/* 한눈에 보기 — 머리 아래 세이지 띠, 다섯 칸 */
.tx-glance {
    margin-top: clamp(28px, 3.4vw, 44px);
    padding: clamp(20px, 2.4vw, 28px) clamp(20px, 2.6vw, 32px);
    border-radius: var(--radius);
    background: var(--sage);
}
.tx-glance__title { font-size: 16px; font-weight: 700; }
.tx-glance__list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    margin-top: 14px;
    border-top: 1px solid var(--sage-2);
}
.tx-glance__list > div { padding: 14px 18px 4px 0; }
.tx-glance__list > div + div { padding-left: 18px; border-left: 1px solid var(--sage-2); }
.tx-glance__list dt { font-size: 14px; font-weight: 600; color: var(--ink-3); }
.tx-glance__list dd { margin-top: 4px; font-size: 16px; font-weight: 700; line-height: 1.55; letter-spacing: -.015em; }
.tx-glance__note { margin-top: 14px; font-size: 14px; line-height: 1.65; color: var(--ink-2); }

/* ---------------------------------------------------------------- layout: 목차 | 본문 */
.tx-layout {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--col-gap);
    align-items: start;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: clamp(48px, 5vw, 80px) var(--gutter) var(--section-y);
}
.tx-toc {
    grid-column: 1 / span 3;
    position: sticky;
    top: calc(var(--header-h) + 32px);
    transition: top .45s var(--ease);
}
body:has(.site-header.is-hidden) .tx-toc { top: 32px; }
.tx-toc__title { margin-bottom: 10px; font-size: 13.5px; font-weight: 700; color: var(--ink-3); }
.tx-toc__list { border-left: 2px solid var(--line); }
.tx-toc__list a {
    position: relative;
    display: block;
    padding: 7px 0 7px 16px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink-2);
    transition: color .2s;
}
.tx-toc__list a::before {
    content: "";
    position: absolute;
    left: -2px; top: 6px; bottom: 6px;
    width: 2px;
    border-radius: 2px;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform .3s var(--ease);
}
.tx-toc__list a:hover { color: var(--ink); }
.tx-toc__list a.is-current,
.tx-toc__list a[aria-current="true"] { color: var(--accent); font-weight: 600; }
.tx-toc__list a.is-current::before,
.tx-toc__list a[aria-current="true"]::before { transform: scaleY(1); }

.tx-main { grid-column: 5 / span 8; min-width: 0; }
.tx-layout > .tx-main:first-child { grid-column: 3 / span 8; }   /* 목차가 없을 때 가운데 읽기 축 */
.tx-main > * + * { margin-top: clamp(56px, 6vw, 88px); }

/* ---------------------------------------------------------------- 담당 의료진 */
.tx-doctors__list { display: grid; gap: 16px; }
.tx-doctor {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    column-gap: 22px;
    align-items: start;
    padding: 18px;
    border-radius: var(--radius);
    background: var(--sage);
}
.tx-doctor--text { grid-template-columns: minmax(0, 1fr); }
.tx-doctor__photo .media { background: var(--sage-2); }
.tx-doctor__name { font-size: 21px; font-weight: 700; letter-spacing: -.03em; line-height: 1.4; }
.tx-doctor__name span { display: block; margin-top: 2px; font-size: 15px; font-weight: 600; color: var(--accent); letter-spacing: 0; }
.tx-doctor__specialty { margin-top: 10px; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.tx-doctor__specialty span { margin-right: 8px; font-weight: 700; color: var(--ink-3); }
.tx-doctor__quote { margin-top: 10px; font-size: 15.5px; line-height: 1.7; color: var(--ink); }
.tx-doctor__links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 12px; }

/* ---------------------------------------------------------------- 함께 보기 */
.tx-related__groups { display: grid; gap: 28px; }
.tx-related__label { font-size: 15px; font-weight: 700; color: var(--ink-3); }
.tx-related__group ul { margin-top: 8px; border-top: 1px solid var(--line); }
.tx-related__link {
    display: grid;
    grid-template-columns: minmax(130px, 32%) minmax(0, 1fr) 18px;
    column-gap: 16px;
    align-items: center;
    min-height: 52px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    transition: color .2s;
}
.tx-related__name { font-size: 16.5px; font-weight: 700; letter-spacing: -.02em; }
.tx-related__note { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.tx-related__link .arrow { grid-column: 3; color: var(--accent); transition: transform .3s var(--ease); }
.tx-related__link:hover .tx-related__name { color: var(--accent); }
.tx-related__link:hover .arrow { transform: translateX(3px); }

/* ---------------------------------------------------------------- 이전 · 다음 */
.tx-pager { padding-top: 24px; border-top: 1px solid var(--line); }
.tx-pager__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.tx-pager__label { font-size: 15px; font-weight: 700; }
.tx-pager__label .num { margin-left: 8px; font-weight: 500; color: var(--ink-3); }
.tx-pager__links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.tx-pager__link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 18px;
    border-radius: var(--radius-s);
    box-shadow: inset 0 0 0 1px var(--line-2);
    transition: box-shadow .2s;
}
.tx-pager__link:hover { box-shadow: inset 0 0 0 1.5px var(--accent); }
.tx-pager__link--next { grid-column: 2; text-align: right; }
.tx-pager__direction { font-size: 13.5px; font-weight: 600; color: var(--ink-3); }
.tx-pager__name { font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.tx-pager__link:hover .tx-pager__name { color: var(--accent); }

/* ---------------------------------------------------------------- tablet · mobile: 목차는 가로 서브내비 */
@media (max-width: 1099px) {
    .tx-head__intro { grid-column: 1 / span 8; }
    .tx-head__figure { grid-column: 9 / span 4; align-self: center; }
    .tx-glance__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tx-glance__list > div:nth-child(4) { padding-left: 0; border-left: 0; }
    .tx-glance__list > div:nth-child(n+4) { border-top: 1px solid var(--sage-2); margin-top: 10px; }

    .tx-layout { display: block; padding: 0 0 var(--section-y); }
    .tx-toc {
        position: sticky;
        top: var(--header-h);
        z-index: 40;
        margin-bottom: clamp(36px, 5vw, 56px);
        background: rgba(255, 255, 255, .96);
        -webkit-backdrop-filter: saturate(160%) blur(10px);
        backdrop-filter: saturate(160%) blur(10px);
        border-bottom: 1px solid var(--line);
    }
    body:has(.site-header.is-hidden) .tx-toc { top: 0; }
    .tx-toc__title { display: none; }
    .tx-toc__list {
        display: flex;
        gap: 22px;
        padding: 0 var(--gutter);
        border-left: 0;
        overflow-x: auto;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
    }
    .tx-toc__list::-webkit-scrollbar { display: none; }
    .tx-toc__list::after { content: ""; flex: 0 0 1px; }
    .tx-toc__list a { display: flex; align-items: center; min-height: 52px; padding: 0; white-space: nowrap; font-size: 15px; }
    .tx-toc__list a::before { left: 0; right: 0; top: auto; bottom: -1px; width: auto; height: 2px; transform: scaleX(0); }
    .tx-toc__list a.is-current::before,
    .tx-toc__list a[aria-current="true"]::before { transform: scaleX(1); }
    .tx-main { padding: 0 var(--gutter); }
    .tx-layout > .tx-main:first-child { padding-top: clamp(40px, 5vw, 64px); }
}
@media (max-width: 767px) {
    .tx-head__intro { grid-column: 1 / -1; }
    .tx-head__figure { grid-column: 1 / -1; width: 56%; justify-self: end; }
    .tx-glance__list { grid-template-columns: minmax(0, 1fr); }
    .tx-glance__list > div,
    .tx-glance__list > div + div,
    .tx-glance__list > div:nth-child(4) { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 12px; padding: 11px 0; border-left: 0; margin-top: 0; }
    .tx-glance__list > div + div { border-top: 1px solid var(--sage-2); }
    .tx-glance__list dd { margin-top: 0; font-size: 15.5px; }
    .tx-doctor { grid-template-columns: 96px minmax(0, 1fr); column-gap: 16px; padding: 14px; }
    .tx-related__link { grid-template-columns: minmax(0, 1fr) 18px; row-gap: 2px; }
    .tx-related__note { grid-column: 1; grid-row: 2; }
    .tx-related__link .arrow { grid-column: 2; grid-row: 1 / span 2; }
    .tx-pager__links { grid-template-columns: minmax(0, 1fr); }
    .tx-pager__link--next { grid-column: 1; }
}
@media (max-width: 640px) {
    /* 모바일: 오른쪽으로 치우친 좁은 액자 대신 본문 폭 전체, 낮은 4:3 (일러스트는 contain 이라 잘리지 않음) */
    .tx-head__figure { width: 100%; justify-self: stretch; }
    .tx-head__figure .media { aspect-ratio: 4 / 3; }
}

/* 설명도 — 좁은 본문 칸에서는 글 다음에 그림을 칸 전체 폭으로(라벨이 읽히게) */
.tx-main .block--image-text { display: flex; flex-direction: column; align-items: stretch; gap: 24px; }
.tx-main .block-image-text__body { order: -1; }
.tx-main .block-image-text__media { width: 100%; margin: 0; }
.tx-main .block-image-text__media + .block-image-text__body { margin-top: 0; }
.tx-main .block-image-text__body .block__heading { margin-bottom: 20px; }
