/* =========================================================
   保証できすぎくん 利用規約
   Bootstrap → 共通フッター → 本ファイルの順に読み込みます。
========================================================= */
html:root {
  scroll-behavior: auto;
  scroll-padding-top: 0;
}

body.terms-page {
  --terms-accent: #896007;
  --terms-pale: #faf8f3;
  margin: 0;
  color: #333;
  background: #fff;
  font-family: "Yu Gothic", Meiryo, sans-serif;
}

.terms-page [hidden] {
  display: none !important;
}

.terms-page h1,
.terms-page h2,
.terms-page h3 {
  font-family: inherit;
}

/* ヘッダー */
.imi-terms-header {
  border-bottom: 1px solid #e3d9c8;
  background: #fff;
}

.imi-terms-header-inner {
  display: flex;
  align-items: center;
  max-width: 1180px;
  padding: 18px 28px;
}

.imi-terms-header picture,
.imi-terms-header img {
  display: block;
}

.imi-terms-header img {
  width: 78px;
  height: auto;
}

/* 本文エリア */
.terms-main {
  max-width: 1000px;
  margin: 42px auto 80px;
  padding: 0 28px;
  font-size: 16px;
  line-height: 1.95;
  overflow-wrap: anywhere;
}

.terms-main a {
  color: var(--terms-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.terms-main a:hover {
  opacity: .8;
}

.terms-page a:focus-visible,
.terms-page button:focus-visible,
.terms-table-wrap:focus-visible {
  outline: 3px solid #b68726;
  outline-offset: 4px;
}

.terms-breadcrumb {
  margin-bottom: 28px;
  font-size: 14px;
}

.terms-main h1 {
  margin: 16px 0 18px;
  padding: 22px;
  border: 1px solid #c8b28a;
  color: var(--terms-accent);
  font-size: 30px;
  line-height: 1.5;
  letter-spacing: .03em;
  text-align: center;
}

.terms-main h1 span,
.terms-pdf-meta {
  white-space: nowrap;
}

.terms-edition {
  margin: 0 0 24px;
  color: #596570;
  font-size: 14px;
}

/* 全文PDF */
.terms-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0 30px;
}

.terms-main .terms-download {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 4px;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid var(--terms-accent);
  border-radius: 4px;
  background: #fff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

/* 規約目次 */
.terms-toc {
  margin: 0 0 50px;
  padding: 16px 28px;
  border: 1px solid #dce3e8;
  border-radius: 5px;
  background: var(--terms-pale);
  scroll-margin-top: 24px;
}

.terms-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.terms-toc li {
  margin: 9px 0;
}

.terms-toc a {
  display: block;
  padding: 5px 0;
}

/* 追従目次：元の目次が画面上方へ完全に隠れた後に表示 */
.terms-floating-toc {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  border-bottom: 1px solid #d9c7a7;
  background: #fffdf8;
  box-shadow: 0 2px 8px #49360812;
}

.terms-floating-inner {
  max-width: 1000px;
  margin: auto;
  padding: 0 28px;
}

#terms-toc-toggle {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: #795507;
  font: 700 14px/1.5 "Yu Gothic", Meiryo, sans-serif;
  text-align: left;
  cursor: pointer;
}

#terms-floating-links {
  max-height: calc(100dvh - 50px);
  margin: 0;
  padding: 0 0 10px;
  overflow-y: auto;
  list-style: none;
}

#terms-floating-links a {
  display: block;
  padding: 9px 0;
  color: #574628;
  font-size: 14px;
  line-height: 1.6;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 規約本文 */
.terms-section {
  margin: 0 0 64px;
  scroll-margin-top: 64px;
}

.terms-section:focus {
  outline: none;
}

.terms-section h2 {
  margin: 0 0 25px;
  padding: 0 0 15px;
  border-bottom: 2px solid var(--terms-accent);
  color: var(--terms-accent);
  font-size: 23px;
  line-height: 1.7;
}

.terms-section h3 {
  margin: 30px 0 12px;
  color: #263748;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.8;
  scroll-margin-top: 64px;
}

.terms-section p {
  margin: 0 0 13px;
  font-size: 16px;
  line-height: 1.95;
  letter-spacing: 0;
}

.terms-section .terms-annex {
  margin-bottom: 6px;
  color: var(--terms-accent);
  font-weight: 700;
}

.terms-annex-link {
  font-weight: 500;
}

/* 規約内の表：狭い画面では表の内側だけ横スクロール */
.terms-table-wrap {
  max-width: 100%;
  margin: 22px 0 28px;
  overflow-x: auto;
  border: 1px solid #ccd3d9;
  border-radius: 3px;
  overscroll-behavior-x: contain;
}

.terms-table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  color: #263748;
  font-size: 15px;
  line-height: 1.85;
  table-layout: auto;
}

.terms-table th,
.terms-table td {
  padding: 13px 15px;
  border: 1px solid #ccd3d9;
  background: #fff;
  font-weight: 400;
  text-align: left;
  vertical-align: top;
}

.terms-table th {
  background: var(--terms-pale);
  font-weight: 700;
}

.terms-table p {
  margin: 0;
}

.terms-table.table-0 { min-width: 680px; }
.terms-table.table-1 { min-width: 0; }
.terms-table.table-3 { min-width: 510px; }
.table-3 td:first-child { min-width: 110px; }

.terms-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.terms-end {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding-top: 24px;
  border-top: 1px solid #dce3e8;
}

/* フッター：既存のIMI共通クラスを使用 */
.imi_footer .container { max-width: 1180px; }
.imi_footer a { color: #fff; text-decoration: none; }
.imi_footer p { font-size: 14px; line-height: 1.8; }
.imi_footer .imi_footer_company { width: 30%; }
.imi_footer .imi_footer_contents { width: 70%; }
.imi_footer .imi_footer_logo { height: auto; }

.imi_footer .imi_footer_bottom {
  flex-wrap: wrap;
  gap: 4px;
  font-size: 12px;
}

.imi_footer .copyright { white-space: nowrap; }

/* SP */
@media (max-width: 767px) {
  .imi-terms-header-inner { padding: 14px 20px; }
  .imi-terms-header img { width: min(290px, 80vw); }
  .terms-main { margin-top: 28px; padding: 0 20px; }
  .terms-main h1 {
    padding: 20px 12px;
    font-size: 26px;
    line-height: 1.65;
    letter-spacing: 0;
  }
  .terms-main h1 span { display: block; }
  .terms-breadcrumb { margin-bottom: 20px; }
  .terms-downloads { display: grid; grid-template-columns: 1fr; }
  .terms-main .terms-download { flex-direction: column; padding: 12px 14px; }
  .terms-pdf-meta { font-size: 14px; }
  .terms-toc { margin-bottom: 38px; padding: 16px 20px; }
  .terms-floating-inner { padding: 0 20px; }
  #terms-floating-links a { padding: 10px 0; font-size: 13px; }
  .terms-section h2 { font-size: 21px; }
  .terms-table th,
  .terms-table td { padding: 10px 12px; }
  .imi_footer { padding: 30px 20px 60px; }
  .imi_footer .imi_footer_company,
  .imi_footer .imi_footer_contents { width: 100%; padding: 0; }
  .imi_footer .imi_footer_bottom { margin-bottom: 0; line-height: 2.5; }
  .imi_footer .imi_footer_bottom span:not(.copyright) { display: none; }
  .imi_footer .imi_footer_bottom a { display: inline-block; margin-right: 12px; }
  .imi_footer .imi_footer_logo { width: 90px; }
}

/* 印刷 */
@media print {
  .imi-terms-header,
  .terms-floating-toc,
  .imi_footer,
  .terms-downloads,
  .terms-toc,
  .terms-breadcrumb,
  .terms-end {
    display: none !important;
  }
  .terms-main { max-width: none; margin: 0; padding: 0; font-size: 10pt; }
  .terms-section { margin: 0 0 20px; }
  .terms-section p { font-size: 10pt; }
  .terms-table-wrap { overflow: visible; }
  .terms-table { min-width: 0 !important; font-size: 9pt; }
  .terms-section h2,
  .terms-section h3 { break-after: avoid; }
  .terms-table tr { break-inside: avoid; }
  .terms-main a { color: inherit; text-decoration: none; }
}
