/* 規約類の本文（privacy / kiyaku / kiyaku-clip / tokushoho だけが読み込む）。
   条文の文言はHTML側でも変えない。ここでは組版・目次・表・印刷だけを決める。
   ヘッダー・フッターは各ページの共通CSS（サイト共通／Clip）に任せる。 */

.terms-container {
    max-width: 840px;
    margin: 0 auto;
    padding: 136px 40px 72px;
    box-sizing: border-box;
    color: var(--sky-ink, #193b50);
    line-height: 1.8;
    line-break: strict;
}

.terms-title {
    margin: 0 0 12px;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    color: var(--sky-ink, #193b50);
    text-wrap: balance;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

/* 制定日・改定日：本文より控えめに */
.terms-date {
    margin: 0 0 40px;
    font-size: .875rem;
    font-weight: 400;
    line-height: 1.6;
    text-align: center;
    color: var(--sky-muted, #526776);
}

.terms-intro {
    margin-bottom: 32px;
}

/* 目次：閉じた状態では1行。開くとPCは2列 */
.terms-toc {
    margin: 0 0 48px;
    border: 1px solid var(--sky-line, #c7dfee);
    border-radius: 12px;
    background: var(--sky-soft, #f3f8fc);
}
.terms-toc summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 10px 20px;
    font-size: .95rem;
    font-weight: 700;
    color: var(--sky-ink, #193b50);
    cursor: pointer;
    list-style: none;
}
.terms-toc summary::-webkit-details-marker { display: none; }
.terms-toc summary::after {
    content: "";
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-right: 4px;
    border-right: 2px solid var(--sky-link, #176fa8);
    border-bottom: 2px solid var(--sky-link, #176fa8);
    transform: translateY(-2px) rotate(45deg);
    transition: transform .2s ease;
}
.terms-toc[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.terms-toc summary:focus-visible {
    outline: 3px solid var(--sky-link, #176fa8);
    outline-offset: 2px;
    border-radius: 12px;
}
.terms-toc ol {
    margin: 0;
    padding: 4px 20px 16px;
    list-style: none;
    columns: 2;
    column-gap: 32px;
}
.terms-toc li {
    break-inside: avoid;
    padding: 3px 0;
    font-size: .9rem;
    line-height: 1.6;
}
.terms-toc a {
    color: var(--sky-link, #176fa8);
    text-decoration: none;
}
.terms-toc nav { display: block; }
.terms-toc a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* 条 */
.terms-section {
    margin-bottom: 48px;
}
.terms-section-title {
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #d9e6ef;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--sky-ink, #193b50);
    scroll-margin-top: 96px;
}
.terms-section > p {
    margin-bottom: 12px;
}

/* 項 */
.terms-item {
    margin-bottom: 16px;
    line-height: 1.8;
}
.terms-item-title {
    margin-bottom: 8px;
    font-weight: 400;
}
/* 後ろに本文が続く短い項見出しは太字にして、条→項→本文の3段を見分けられるようにする */
.terms-item:has(> .terms-item-content) > .terms-item-title:not(.terms-item-title--sentence) {
    font-weight: 700;
}
.terms-item-content {
    margin-left: 1.8em;
    line-height: 1.8;
}
.terms-item-content > p + p { margin-top: 4px; }

/* 番号のぶら下げ：番号の下に2行目以降が戻らないようにする */
.terms-num {
    padding-left: 1.8em;
}
.terms-no {
    display: inline-block;
    min-width: 1.8em;
    margin-left: -1.8em;
    font-variant-numeric: tabular-nums;
}
.terms-num--paren { padding-left: 2.4em; }
.terms-num--paren > .terms-no { min-width: 2.4em; margin-left: -2.4em; }

.terms-container ul {
    margin: 4px 0 0 1.25em;
    padding: 0;
    list-style-type: disc;
}
.terms-container ul li {
    margin-bottom: 4px;
    line-height: 1.8;
}
.terms-container strong { font-weight: 700; }

/* 本文中の参照リンク（他の規約・条） */
.terms-container :is(p, li, td, div) > a:not([class]):not(.terms-toc a, .terms-related a) {
    color: var(--sky-link, #176fa8);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.terms-footer {
    margin-top: 40px;
    text-align: right;
}

/* 末尾：関連する規約 */
.terms-related {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #d9e6ef;
    font-size: .9rem;
    line-height: 1.7;
    color: var(--sky-muted, #526776);
}
.terms-related h2 {
    margin: 0 0 8px;
    font-size: .9rem;
    font-weight: 700;
    color: var(--sky-ink, #193b50);
}
.terms-related ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.terms-related ul li { margin: 0; }
.terms-related a {
    color: var(--sky-link, #176fa8);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* 表（特商法表記・Clip 規約の利用プラン） */
.tokushoho-table,
.terms-plan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9375rem;
}
.terms-plan-table { margin: 8px 0 24px; }
.tokushoho-table th,
.tokushoho-table td,
.terms-plan-table th,
.terms-plan-table td {
    padding: 14px 16px;
    border: 1px solid #d9e6ef;
    text-align: left;
    line-height: 1.8;
    vertical-align: top;
}
.terms-plan-table th,
.terms-plan-table td { padding: 10px 14px; line-height: 1.7; }
.tokushoho-table th,
.terms-plan-table th {
    background-color: var(--sky-soft, #f3f8fc);
    font-weight: 700;
    color: var(--sky-ink, #193b50);
}
.tokushoho-table th { width: 220px; }
.tokushoho-table td { word-break: auto-phrase; } /* 住所・氏名を語の途中で折らない（対応ブラウザ） */
.tokushoho-table td ul { margin-top: 0; }
/* 日付行のないページ（特商法表記）は、見出しと表の間を日付行の分だけ空ける */
.terms-title:has(+ .tokushoho-table) { margin-bottom: 40px; }

@media (max-width: 1023px) {
    .terms-container { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 768px) {
    .terms-container { padding-top: 104px; padding-bottom: 56px; }
    .terms-title { font-size: clamp(1.375rem, 6.4vw, 1.625rem); }
    .terms-date,
    .terms-title:has(+ .tokushoho-table) { margin-bottom: 28px; }
    .terms-toc ol { columns: 1; }
    .terms-section { margin-bottom: 40px; }
    .terms-section-title { font-size: 1.125rem; scroll-margin-top: 80px; }
    .terms-item-content { margin-left: 1em; }
}

/* 狭い画面では表を「項目名→内容」の縦積みにする（文言と行の順は変えない） */
@media (max-width: 600px) {
    .tokushoho-table,
    .tokushoho-table tbody,
    .tokushoho-table tr,
    .tokushoho-table th,
    .tokushoho-table td {
        display: block;
        width: auto;
    }
    .tokushoho-table { border-top: 1px solid #d9e6ef; }
    .tokushoho-table th,
    .tokushoho-table td {
        border: 0;
        border-left: 1px solid #d9e6ef;
        border-right: 1px solid #d9e6ef;
    }
    .tokushoho-table th { padding: 10px 16px 4px; font-size: .875rem; }
    .tokushoho-table td { padding: 8px 16px 14px; border-bottom: 1px solid #d9e6ef; }

    .terms-plan-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
    .terms-plan-table,
    .terms-plan-table tbody,
    .terms-plan-table tr,
    .terms-plan-table td {
        display: block;
        width: auto;
    }
    .terms-plan-table tr {
        margin-bottom: 12px;
        border: 1px solid #d9e6ef;
        border-radius: 8px;
        overflow: hidden;
    }
    .terms-plan-table td { border: 0; padding: 8px 14px; }
    .terms-plan-table td + td { border-top: 1px solid #eef3f7; }
    .terms-plan-table td:first-child {
        background: var(--sky-soft, #f3f8fc);
        font-weight: 700;
    }
    .terms-plan-table td[data-label]:not(:first-child)::before {
        content: attr(data-label);
        display: block;
        font-size: .8125rem;
        font-weight: 700;
        color: var(--sky-muted, #526776);
    }
}

@media (max-width: 359px) {
    .terms-container { padding-left: 18px; padding-right: 18px; }
}

/* 印刷・PDF保存（稟議への添付など）：固定ヘッダーを本文に重ねない */
@media print {
    .header,
    .menu-toggle,
    .footer,
    .clip-footer,
    .terms-toc,
    .terms-related { display: none !important; }
    .terms-container { max-width: none; padding: 0; }
    .terms-section-title { break-after: avoid; }
    .tokushoho-table tr,
    .terms-plan-table tr,
    .terms-item { break-inside: avoid; }
}
