/*
  ============================================================
  layout.css — 공통 레이아웃 (셸 / 헤더 / 본문 / 그리드)
  ------------------------------------------------------------
  [데모] layout.html
  [문서] docs/layout.md
  ------------------------------------------------------------
  ※ 가이드·데모 페이지 공통. 실서비스에서는 프로젝트 헤더로 교체해도 됨
  ※ 콘텐츠 폭: max-width 100% (좌우 --layout-pad-x)
  ※ 접근성: :focus-visible, aria-current / .on
  ※ 스킵: common.css (body 직계) · layout.css (#wrap 내부) · Tab(:focus-visible) 시만 노출
  ※ 셸 순서: 스킵 → 로고·유틸(한 줄) · GNB(좌측) + 본문(우측)
  ※ 상세 GNB/LNB: menu.html · 푸터: footer.html · 위치: breadcrumb.html
  ============================================================
*/

:root {
    --layout-max: 100rem;
    --layout-pad-x: 2rem;
    --layout-aside-w: 22rem;
    --layout-gnb-w: var(--layout-aside-w);
    --layout-gap: 3.2rem;
    --layout-border: var(--color-line, #e5e5e5);
}

#wrap {
    position: relative;
    display: grid;
    grid-template-columns: var(--layout-gnb-w) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 100vh;
    background: var(--krds-color-surface, #fff);
}

/* #wrap 그리드 밖으로 — 빈 행·푸터 아래 여백 방지 */
#wrap > #skipToContent {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100000;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
}
/* 키보드 Tab(:focus-visible)일 때만 패널 노출 — 여백 클릭·:focus 만으로 border 선 남는 것 방지 */
#wrap > #skipToContent:focus-within:has(a:focus-visible) {
    width: auto;
    height: auto;
    padding: 1rem 1.6rem;
    overflow: visible;
    clip: auto;
    clip-path: none;
    background: var(--krds-color-surface, #fff);
    border: 2px solid var(--krds-color-text-basic, #1e2124);
    box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.12);
}
#wrap > #skipToContent a {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--krds-color-text-basic, #1e2124);
    background: transparent;
}
#wrap > #skipToContent a:focus {
    outline: none;
}
#wrap > #skipToContent a:focus-visible {
    outline: 2px solid var(--krds-color-text-basic, #1e2124);
    outline-offset: 2px;
}

/* ---------- Header / GNB (상단 로고·유틸 한 줄 + 좌측 LNB) ---------- */
#header {
    display: contents;
}
#header > .header-inner {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.6rem 2.4rem;
    flex-wrap: wrap;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0.8rem var(--layout-pad-x);
    min-height: 7.2rem;
    border-bottom: 1px solid var(--layout-border);
    background: var(--krds-color-surface, #fff);
    box-sizing: border-box;
}
#header .logo {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border-bottom: none;
    background: transparent;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.3;
}
#header .logo a {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0;
    color: var(--krds-color-text-basic, #1e2124);
    text-decoration: none;
}
#header .logo img {
    display: block;
    height: 4rem;
    width: auto;
}
#header .logo a:focus-visible {
    outline: 2px solid var(--krds-color-text-basic, #1e2124);
    outline-offset: 2px;
}
#header .logo a[aria-current="page"] {
    /* box-shadow: inset 0 -2px 0 var(--krds-color-action-primary, #256ef4); */
}

/* 헤더 유틸 (로그인·검색 · 글자 크기) — 로고와 같은 줄 */
#header .header-util {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    gap: 1.6rem 2.4rem;
    flex-wrap: wrap;
    min-width: 0;
    margin: 0;
    position: relative;
    z-index: 100;
}
#header .header-util-nav {
    margin: 0;
}
#header .header-util-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}
#header .header-util-list > li {
    display: flex;
    align-items: center;
}
#header .header-util-list > li + li::before {
    content: '';
    display: inline-block;
    width: 1px;
    height: 1.2rem;
    margin: 0 0.4rem;
    background: var(--krds-color-border-subtle, #b1b8be);
}
#header .header-util-list a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 4.4rem;
    padding: 0 0.8rem;
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--krds-color-text-basic, #1e2124);
    text-decoration: none;
    box-sizing: border-box;
}
#header .header-util-list a:hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}
#header .header-util-list a:focus-visible {
    outline: 2px solid var(--krds-color-text-basic, #1e2124);
    outline-offset: 2px;
}
#header .header-util-list a img {
    width: 1.8rem;
    height: 1.8rem;
    flex: 0 0 auto;
}
#header .header-util .zoom-ctrl__btn {
    min-width: 3.2rem;
    min-height: 3.2rem;
    background: #fff;
}

#header .site-side {
    grid-column: 1;
    grid-row: 2 / 4;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-height: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
    max-height: 100vh;
    box-sizing: border-box;
    border-right: 1px solid var(--layout-border);
    background: var(--krds-color-surface, #fff);
}

/* 카테고리만 있는 사이드(웹개발·DB·AI 등) */
#header .site-side--cat-only .site-cat-nav {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    border-bottom: 0;
}

#header .site-side--cat-only .site-cat-nav__list {
    flex: 1 1 auto;
}

#header .site-side .site-cat-nav {
    flex: 0 0 auto;
    margin: 0;
    padding: 1.2rem 0 0.8rem;
    border-bottom: 1px solid var(--layout-border);
    background: var(--krds-color-surface-gray-subtler, #f4f5f6);
}

#header .site-side .site-cat-nav__label {
    margin: 0;
    padding: 0 1.6rem 0.6rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--krds-color-text-subtle, #58616a);
    text-transform: uppercase;
}

#header .site-side .site-cat-nav__list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0 0 0.4rem;
    list-style: none;
}

#header .site-side .site-cat-nav__list a {
    display: block;
    padding: 0.75rem 1.6rem;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--krds-color-text-basic, #1e2124);
    text-decoration: none;
}

#header .site-side .site-cat-nav__list a:hover {
    color: var(--krds-color-text-primary, #0b50d0);
    background: var(--krds-color-surface-primary-subtler, #ecf2fe);
}

#header .site-side .site-cat-nav__list .on > a,
#header .site-side .site-cat-nav__list a[aria-current="location"] {
    color: var(--krds-color-text-primary, #0b50d0);
    background: var(--krds-color-surface-primary-subtler, #ecf2fe);
}

#header .site-side .site-cat-nav__list a:focus-visible {
    outline: 2px solid var(--krds-color-text-basic, #1e2124);
    outline-offset: -2px;
}

#header nav[aria-label="주메뉴"] {
    flex: 1 1 auto;
    min-height: 0;
    box-sizing: border-box;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--krds-color-surface, #fff);
}
#header nav[aria-label="주메뉴"] > ul,
#gnb {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 0.8rem 0 1.6rem;
    list-style: none;
}
#gnb > li > a {
    display: block;
    padding: 0.9rem 1.6rem;
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--krds-color-text-basic, #1e2124);
    line-height: 1.35;
    letter-spacing: -0.02em;
    text-decoration: none;
    border-radius: 0;
    white-space: normal;
    word-break: keep-all;
}
#gnb > li > a:hover {
    color: var(--krds-color-text-primary, #0b50d0);
    background: var(--krds-color-surface-primary-subtler, #ecf2fe);
}
#gnb > li.on > a,
#gnb > li > a[aria-current="page"] {
    color: var(--krds-color-text-primary, #0b50d0);
    background: var(--krds-color-surface-primary-subtler, #ecf2fe);
    box-shadow: inset 3px 0 0 var(--krds-color-action-primary, #256ef4);
}
#gnb > li > a:focus-visible {
    outline: 2px solid var(--krds-color-text-basic, #1e2124);
    outline-offset: -2px;
}
#gnb > li > .gnb-label {
    margin: 0;
    padding: 0.9rem 1.6rem 0.2rem;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.02em;
    color: var(--krds-color-text-subtle, #58616a);
}
#gnb > li.on > .gnb-label {
    color: var(--krds-color-text-primary, #0b50d0);
}
#gnb .gnb-label[aria-expanded] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}
#gnb .gnb-label[aria-expanded]:hover {
    color: var(--krds-color-text-primary, #0b50d0);
    background: var(--krds-color-surface-primary-subtler, #ecf2fe);
}
#gnb .gnb-label[aria-expanded]:focus-visible {
    outline: 2px solid var(--krds-color-text-basic, #1e2124);
    outline-offset: -2px;
}
#gnb .gnb-label[aria-expanded]::after {
    content: "";
    flex: 0 0 auto;
    width: 0.55rem;
    height: 0.55rem;
    margin-top: -0.25rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}
#gnb li.is-open > .gnb-label[aria-expanded]::after {
    margin-top: 0.2rem;
    transform: rotate(-135deg);
}
#gnb ul {
    display: none;
    flex-direction: column;
    margin: 0;
    padding: 0 0 0.6rem;
    list-style: none;
}
#gnb li.is-open > ul {
    display: flex;
}
#gnb ul a {
    display: block;
    padding: 0.65rem 1.6rem 0.65rem 2.6rem;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.02em;
    color: var(--krds-color-text-basic, #1e2124);
    text-decoration: none;
}
#gnb ul a:hover {
    color: var(--krds-color-text-primary, #0b50d0);
    background: var(--krds-color-surface-primary-subtler, #ecf2fe);
}
#gnb ul .on > a,
#gnb ul a[aria-current="page"] {
    color: var(--krds-color-text-primary, #0b50d0);
    background: var(--krds-color-surface-primary-subtler, #ecf2fe);
    box-shadow: inset 3px 0 0 var(--krds-color-action-primary, #256ef4);
}
#gnb ul a:focus-visible {
    outline: 2px solid var(--krds-color-text-basic, #1e2124);
    outline-offset: -2px;
}
#gnb ul .gnb-label {
    margin: 0.8rem 0 0;
    padding: 0.7rem 1.6rem 0.2rem 2.6rem;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.02em;
    color: var(--krds-color-text-subtle, #58616a);
}
#gnb ul li.on > .gnb-label {
    color: var(--krds-color-text-primary, #0b50d0);
}
#gnb ul ul a {
    padding-left: 3.6rem;
}

/* ---------- 모바일 전체 메뉴 레이어 (≤900px · common.js) ---------- */
.mobile-nav-toggle,
.mobile-nav-backdrop,
.mobile-nav-drawer-head {
    display: none;
}

@media (max-width: 900px) {
    #wrap {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    #header > .header-inner {
        padding: 0.8rem var(--layout-pad-x);
        min-height: 5.6rem;
        gap: 1.2rem;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: stretch;
        flex: 0 0 auto;
        box-sizing: border-box;
        width: 4.4rem;
        height: 4.4rem;
        margin: 0 0 0 auto;
        padding: 1.1rem 0.9rem;
        border: 1px solid var(--layout-border);
        border-radius: 0.8rem;
        background: var(--color-white, #fff);
        cursor: pointer;
    }

    .mobile-nav-toggle__bar {
        display: block;
        width: 100%;
        height: 2px;
        border-radius: 1px;
        background: var(--color-ink, #222);
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    #header.is-nav-open .mobile-nav-toggle__bar:nth-child(1) {
        transform: translateY(0.55rem) rotate(45deg);
    }

    #header.is-nav-open .mobile-nav-toggle__bar:nth-child(2) {
        opacity: 0;
    }

    #header.is-nav-open .mobile-nav-toggle__bar:nth-child(3) {
        transform: translateY(-0.55rem) rotate(-45deg);
    }

    .mobile-nav-toggle:focus-visible {
        outline: 2px solid var(--color-primary, #006af4);
        outline-offset: 2px;
    }

    .mobile-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 999;
        margin: 0;
        padding: 0;
        border: 0;
        background: rgba(19, 58, 99, 0.45);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
        cursor: pointer;
    }

    body.is-mobile-nav-open .mobile-nav-backdrop {
        opacity: 1;
        visibility: visible;
    }

    body.is-mobile-nav-open {
        overflow: hidden;
    }

    #header .site-side {
        position: fixed;
        inset: 0;
        z-index: 1000;
        grid-column: unset;
        grid-row: unset;
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        max-height: none;
        margin: 0;
        padding: 0;
        border: 0;
        background: var(--color-white, #fff);
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.28s ease, visibility 0.28s ease;
        overflow: hidden;
    }

    #header.is-nav-open .site-side {
        transform: translateX(0);
        visibility: visible;
    }

    .mobile-nav-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex: 0 0 auto;
        gap: 1.2rem;
        padding: 1.2rem var(--layout-pad-x);
        border-bottom: 1px solid var(--layout-border);
        background: var(--color-white, #fff);
    }

    .mobile-nav-drawer-head__tit {
        margin: 0;
        font-size: 1.7rem;
        font-weight: 700;
        letter-spacing: -0.02em;
        color: var(--color-secondary, #133a63);
    }

    .mobile-nav-close {
        flex: 0 0 auto;
        min-height: 4.4rem;
        margin: 0;
        padding: 0.6rem 1.2rem;
        border: 1px solid var(--layout-border);
        border-radius: 0.8rem;
        background: var(--color-white, #fff);
        font-size: 1.4rem;
        font-weight: 600;
        color: var(--color-ink, #222);
        cursor: pointer;
    }

    .mobile-nav-close:focus-visible {
        outline: 2px solid var(--color-primary, #006af4);
        outline-offset: 2px;
    }

    #header .site-side .site-cat-nav {
        flex: 0 0 auto;
        padding: 1.2rem 0 0.8rem;
        border-bottom: 1px solid var(--layout-border);
    }

    #header .site-side .site-cat-nav__label {
        display: block;
        position: static;
        width: auto;
        height: auto;
        margin: 0;
        padding: 0 var(--layout-pad-x) 0.8rem;
        clip: auto;
        clip-path: none;
        overflow: visible;
        white-space: normal;
        font-size: 1.25rem;
        font-weight: 700;
        text-transform: none;
        color: var(--color-muted, #757575);
    }

    #header .site-side .site-cat-nav__list {
        flex-direction: column;
        flex-wrap: nowrap;
        overflow: visible;
        padding: 0 0 0.4rem;
    }

    #header .site-side .site-cat-nav__list a {
        padding: 0.85rem var(--layout-pad-x);
        white-space: normal;
        border-radius: 0;
    }

    #header .site-side .site-cat-nav__list .on > a,
    #header .site-side .site-cat-nav__list a[aria-current="location"] {
        box-shadow: inset 3px 0 0 var(--krds-color-action-primary, #256ef4);
    }

    #header nav[aria-label="주메뉴"] {
        flex: 1 1 auto;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        max-height: none;
        -webkit-overflow-scrolling: touch;
    }

    #header nav[aria-label="주메뉴"] > ul,
    #gnb {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0;
        padding: 0 0 1.6rem;
        overflow: visible;
    }

    #gnb > li > a {
        padding: 0.85rem var(--layout-pad-x);
        font-size: 1.4rem;
        white-space: normal;
    }

    #gnb > li.on > a,
    #gnb > li > a[aria-current="page"] {
        box-shadow: inset 3px 0 0 var(--krds-color-action-primary, #256ef4);
    }

    #gnb > li > .gnb-label {
        padding: 0.85rem var(--layout-pad-x);
        white-space: normal;
    }

    #gnb ul {
        flex-direction: column;
        padding: 0 0 0.4rem;
    }

    #gnb ul a {
        padding: 0.65rem var(--layout-pad-x) 0.65rem calc(var(--layout-pad-x) + 1rem);
        white-space: normal;
    }

    #gnb ul .on > a,
    #gnb ul a[aria-current="page"] {
        box-shadow: inset 3px 0 0 var(--krds-color-action-primary, #256ef4);
    }

    #gnb ul .gnb-label {
        margin: 0.4rem 0 0;
        padding: 0.65rem var(--layout-pad-x) 0.65rem calc(var(--layout-pad-x) + 1rem);
        white-space: normal;
    }

    #gnb ul ul {
        flex-direction: column;
        padding: 0 0 0.4rem;
    }

    #gnb ul ul a {
        padding: 0.6rem var(--layout-pad-x) 0.6rem calc(var(--layout-pad-x) + 2rem);
    }

    #container {
        grid-column: 1;
        grid-row: 2;
    }

    #footer {
        grid-column: 1;
        grid-row: 3;
    }
}

/* ---------- Location (breadcrumb) ---------- */
#location,
.breadcrumb {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 1.6rem var(--layout-pad-x) 0;
    box-sizing: border-box;
}
#location ol,
#location ul,
.breadcrumb ol,
.breadcrumb ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 1.4rem;
    line-height: 1.5;
    color: #666;
}
#location li,
.breadcrumb li {
    display: flex;
    align-items: center;
}
#location li + li::before,
.breadcrumb li + li::before {
    content: "";
    display: inline-block;
    width: 0.6rem;
    height: 1rem;
    margin: 0 1.2rem;
    background: url("../img/loc-arr.svg") no-repeat center / contain;
    flex-shrink: 0;
}
#location a,
.breadcrumb a {
    display: inline-flex;
    align-items: center;
    min-height: 4.4rem;
    padding: 0 0.2rem;
    color: #333;
    text-decoration: underline;
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
}
#location a:hover,
.breadcrumb a:hover {
    color: #000;
    text-decoration-thickness: 2px;
}
#location a:focus-visible,
.breadcrumb a:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}
#location [aria-current="page"],
#location span,
.breadcrumb [aria-current="page"],
.breadcrumb span {
    color: #000;
    font-weight: 600;
}
@media (max-width: 820px) {
    #location,
    .breadcrumb {
        padding: 1.2rem 1.6rem 0;
    }
    /* 좁은 화면: 첫 경로(홈)와 마지막만 표시, 사이는 말줄임 */
    #location li:not(:first-child):not(:last-child),
    .breadcrumb li:not(:first-child):not(:last-child) {
        display: none;
    }
    #location li:last-child:not(:nth-child(-n+2))::before,
    .breadcrumb li:last-child:not(:nth-child(-n+2))::before {
        content: "…";
        width: auto;
        height: auto;
        margin: 0 1.2rem;
        background: none;
        color: #555;
        font-size: 1.4rem;
        font-weight: 400;
        line-height: 1;
    }
}

/* ---------- Contents / page title ---------- */
#container {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

#contents {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 2.4rem var(--layout-pad-x) 3.2rem;
    box-sizing: border-box;
}
#contents .ptitle-head {
    margin: 0 0 2.8rem;
    padding: 0 0 1.6rem;
    border-bottom: 2px solid var(--color-primary, #006af4);
}
#contents .ptitle {
    margin: 0;
    padding: 0;
    border-bottom: none;
    font-size: 3.2rem;
    font-weight: 700;
    color: var(--color-secondary, #133a63);
    letter-spacing: -0.03em;
    line-height: 1.3;
}
#contents .ptitle-docs {
    margin: 0.8rem 0 0;
    font-size: 1.4rem;
    line-height: 1.5;
    color: #444;
}
#contents .ptitle-docs a {
    color: #000;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.25em;
}
#contents .ptitle-docs a:focus-visible {
    outline: 2px solid #000;
    outline-offset: 3px;
}
@media (max-width: 820px) {
    #contents {
        padding: 1.6rem 1.6rem 6rem;
    }
    #contents .ptitle-head {
        margin-bottom: 2rem;
        padding-bottom: 1.2rem;
    }
    #contents .ptitle {
        font-size: 2.4rem;
    }
    #contents .ptitle-docs {
        font-size: 1.3rem;
    }
}

/* ---------- Footer / quick ---------- */
#footer {
    grid-column: 2;
    grid-row: 3;
    align-self: start;
    min-width: 0;
    min-height: 0;
    border-top: 1px solid var(--krds-color-border, #cdd1d5);
    background: var(--krds-color-surface-gray-subtler, #f4f5f6);
    box-sizing: border-box;
}

#wrap:not(.site-portal-wrap) #footer .site-footer__inner {
    max-width: 100%;
    padding-left: var(--layout-pad-x);
    padding-right: var(--layout-pad-x);
}

/*
  좁은 화면 그리드 — #container / #footer 규칙이 이 파일 뒤쪽에 있어
  위쪽 @media(900px)보다 우선순위가 높음. 여기서 다시 1열로 맞춤.
*/
@media (max-width: 900px) {
    #container {
        grid-column: 1;
        grid-row: 2;
        width: 100%;
        max-width: 100%;
    }

    #footer {
        grid-column: 1;
        grid-row: 3;
    }
}

#quick {
    --quick-gap: 2rem;
    position: fixed;
    right: 2rem;
    bottom: var(--quick-gap);
    z-index: 500;
}
/* 스크롤 시 common.js가 footer 상단에서 멈추도록 bottom을 px로 조정 */
/* 맨 위로: a[href="#header"] · 텍스트 숨김 + img/gotop.svg 배경 */
#quick .gotop a {
    display: block;
    box-sizing: border-box;
    width: 4.8rem;
    height: 4.8rem;
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 0.4rem;
    font-size: 0;
    line-height: 0;
    color: transparent;
    text-decoration: none;
    background: #fff url("../img/gotop.svg") no-repeat center;
    background-size: 1.6rem auto;
    box-shadow: 0 0.2rem 0.8rem rgba(0, 0, 0, 0.08);
}
#quick .gotop a:hover {
    border-color: #000;
    opacity: 0.85;
}
#quick .gotop a:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}
@media (max-width: 820px) {
    #quick {
        --quick-gap: 1.2rem;
        right: 1.2rem;
    }

    :root {
        --layout-pad-x: 1.6rem;
    }
}

/* ---------- 본문 그리드 (1단 / 좌메뉴+본문) ---------- */
.layout-body {
    display: block;
}

.layout-body--aside {
    display: grid;
    grid-template-columns: var(--layout-aside-w) minmax(0, 1fr);
    gap: var(--layout-gap);
    align-items: start;
}

.layout-aside {
    position: sticky;
    top: 1.6rem;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.layout-aside__tit {
    margin: 0 0 1.2rem;
    padding: 0 0 1rem;
    border-bottom: 2px solid #000;
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.layout-aside__nav {
    margin: 0;
    padding: 0;
    list-style: none;
}

.layout-aside__nav a {
    display: block;
    padding: 1rem 0.4rem;
    border-bottom: 1px solid var(--layout-border);
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
}

.layout-aside__nav a:hover {
    color: #000;
}

.layout-aside__nav a[aria-current="page"] {
    color: #000;
    box-shadow: inset 3px 0 0 #000;
    padding-left: 1rem;
}

.layout-aside__nav a:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.layout-main {
    min-width: 0;
}

.layout-main__lead {
    margin: 0 0 1.6rem;
    font-size: 1.55rem;
    line-height: 1.7;
    color: #333;
    word-break: keep-all;
}

@media (max-width: 900px) {
    .layout-body--aside {
        grid-template-columns: 1fr;
        gap: 2.4rem;
    }

    .layout-aside {
        position: static;
    }
}

/* ---------- 데모: 셸 구조도 (layout.html 전용 느낌, 실서비스에도 재사용 가능) ---------- */
.layout-schematic {
    --sch-border: #ccc;
    margin: 0;
    padding: 0;
    border: 1px solid var(--sch-border);
    background: #f7f8fa;
    font-size: 1.35rem;
    line-height: 1.4;
    box-sizing: border-box;
}

.layout-schematic__row {
    display: grid;
    gap: 0;
    border-bottom: 1px solid var(--sch-border);
}

.layout-schematic__row:last-child {
    border-bottom: 0;
}

.layout-schematic__cell {
    margin: 0;
    padding: 1.2rem 1.4rem;
    border-right: 1px solid var(--sch-border);
    box-sizing: border-box;
}

.layout-schematic__cell:last-child {
    border-right: 0;
}

.layout-schematic__cell strong {
    display: block;
    margin: 0 0 0.4rem;
    font-size: 1.45rem;
    font-weight: 700;
    color: #000;
}

.layout-schematic__cell code {
    font-size: 1.25rem;
    color: #444;
}

.layout-schematic__row--skip {
    background: #fff8e6;
}

.layout-schematic__row--header {
    background: #fff;
}

.layout-schematic__row--body {
    grid-template-columns: 1fr;
    background: #fff;
}

.layout-schematic__row--body.is-aside {
    grid-template-columns: 18rem 1fr;
}

.layout-schematic__row--footer {
    background: #f0f0f0;
}

.layout-schematic__hint {
    margin: 0.8rem 0 0;
    color: #555;
    font-size: 1.3rem;
}

@media (max-width: 720px) {
    .layout-schematic__row--body.is-aside {
        grid-template-columns: 1fr;
    }

    .layout-schematic__row--body.is-aside .layout-schematic__cell {
        border-right: 0;
        border-bottom: 1px solid var(--sch-border);
    }

    .layout-schematic__row--body.is-aside .layout-schematic__cell:last-child {
        border-bottom: 0;
    }
}

/* ---------- 화면 확대/축소 (html rem · --page-zoom) ---------- */
.zoom-ctrl {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

.zoom-ctrl__label {
    margin: 0 0.4rem 0 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.zoom-ctrl__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.6rem;
    min-height: 3.6rem;
    margin: 0;
    padding: 0 0.8rem;
    border: 1px solid #ccc;
    border-radius: 0.4rem;
    background: #fff;
    color: #222;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
}

.zoom-ctrl__btn:hover:not(:disabled) {
    border-color: #999;
    background: #f5f5f5;
}

.zoom-ctrl__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.zoom-ctrl__btn--reset {
    min-width: auto;
    padding: 0 1rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.zoom-ctrl__value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5.2rem;
    margin: 0;
    padding: 0 0.4rem;
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #111;
    text-align: center;
}
