/* ========================================
   AIポリシー（/ai-policy/）
   土台は common.css の .privacy-*（規程系ページ共通）。
   ここでは目次・原則カード・表・確認の流れだけを足す。
======================================== */

.aip-title { margin-bottom: 12px; }
.aip-updated {
  margin: 0 0 clamp(28px, 3.5vw, 40px);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--color-mute);
}

/* ---- 目次（基本方針／運用基準の2列） ---- */
.aip-toc {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 32px;
  margin: 0 0 clamp(56px, 7vw, 88px);
  padding: 24px 28px;
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
}
.aip-toc__head {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--color-primary);
}
.aip-toc ol { counter-reset: aip-toc; }
.aip-toc li {
  counter-increment: aip-toc;
  font-size: 14px;
  line-height: 2;
}
.aip-toc li::before {
  content: counter(aip-toc) ".";
  display: inline-block;
  min-width: 1.6em;
  color: var(--color-mute);
  font-family: var(--font-en);
}
.aip-toc a {
  color: var(--color-ink);
  text-decoration: none;
}
.aip-toc a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---- 第1部・第2部の小見出し ---- */
.aip-layer {
  margin: 0 0 6px !important;
  font-size: 13px !important;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--color-primary) !important;
  line-height: 1.6 !important;
}

/* アンカーで飛んだとき、固定ヘッダーに隠れないように */
.aip-page [id] { scroll-margin-top: 110px; }

/* ---- 原則カード ---- */
.aip-principles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: clamp(24px, 3vw, 32px);
}
.aip-principle {
  display: flex;
  flex-direction: column;
  padding: 22px 24px 20px;
  border: 1px solid var(--color-line);
  border-top: 3px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background: #fff;
}
.aip-principle__title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.6;
  letter-spacing: .04em;
  color: var(--color-ink);
}
.privacy-block .aip-principle p {
  flex: 1;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.9;
}
.privacy-block a.aip-principle__link {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}
.privacy-block a.aip-principle__link::after { content: " →"; }
.privacy-block a.aip-principle__link:hover { text-decoration: underline; opacity: 1; }

/* ---- 運用基準の小見出し ---- */
.aip-h3 {
  margin-top: clamp(40px, 5vw, 56px);
  padding-bottom: 8px;
  font-size: 17px;
  border-bottom: 1px solid var(--color-line);
}
.privacy-block .aip-note {
  margin-top: 12px;
  font-size: 14px;
  color: var(--color-ink-soft);
}

/* ---- 表 ---- */
.aip-table-wrap {
  margin: 16px 0 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.aip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.8;
  color: var(--color-ink);
}
.aip-table th,
.aip-table td {
  padding: 12px 14px;
  border: 1px solid var(--color-line);
  text-align: left;
  vertical-align: top;
}
.aip-table thead th {
  background: var(--color-primary-soft);
  font-weight: 700;
  letter-spacing: .04em;
}
.aip-table th span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-mute);
}
.aip-table tbody th {
  background: var(--color-bg-alt);
  font-weight: 700;
  width: 30%;
}
.aip-table--scope td { width: 50%; }
.aip-table--matrix { min-width: 600px; table-layout: fixed; }
.aip-table--matrix thead th:first-child { width: 30%; }
.aip-table--tools { min-width: 600px; }
.aip-table--tools td:first-child { font-weight: 700; white-space: nowrap; }

/* 入力可否の印 */
.aip-ok, .aip-ng, .aip-limit {
  display: block;
  margin-bottom: 2px;
  font-weight: 800;
}
.aip-ok    { color: #0f7a46; }
.aip-ng    { color: var(--color-cta); }
.aip-limit { color: var(--color-accent-dark); }
.aip-ok::before    { content: "○ "; }
.aip-ng::before    { content: "× "; }
.aip-limit::before { content: "△ "; }

/* ---- 品質確認の流れ（PCは横並び、SPは縦） ---- */
.aip-flow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 20px 0 4px;
  counter-reset: aip-flow;
}
.aip-flow__step {
  position: relative;
  counter-increment: aip-flow;
  padding: 16px 14px;
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
}
.aip-flow__step::before {
  content: counter(aip-flow);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-en);
  font-size: 13px;
  font-weight: 700;
}
.aip-flow__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -10px;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--color-primary);
  border-right: 2px solid var(--color-primary);
  transform: translateY(-50%) rotate(45deg);
}
.aip-flow__step b {
  display: block;
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-ink);
}
.aip-flow__step span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--color-ink-soft);
}

/* ---- 保有資格 ---- */
.aip-cert {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: #fff;
}
.aip-cert__badge { width: 140px; height: auto; display: block; }
.privacy-block .aip-cert__label {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--color-primary);
  line-height: 1.6;
}
.privacy-block .aip-cert__name {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.5;
}
.aip-cert__meta { margin: 0 0 12px; font-size: 14px; line-height: 1.8; color: var(--color-ink); }
.aip-cert__meta div { display: flex; gap: 12px; }
.aip-cert__meta dt { flex: 0 0 4.5em; color: var(--color-mute); font-weight: 600; }
.aip-cert__meta dd { margin: 0; }
.privacy-block .aip-cert__text { font-size: 14px; line-height: 1.9; color: var(--color-ink-soft); }

/* ---- 改定履歴 ---- */
.aip-history { margin-top: 24px; }
.privacy-block .aip-history__head {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 700;
}
.aip-history li { font-size: 14px; }

/* ========================================
   Responsive
======================================== */
@media (max-width: 860px) {
  .aip-flow { grid-template-columns: 1fr; gap: 14px; }
  .aip-flow__step { display: grid; grid-template-columns: 26px 1fr; column-gap: 12px; align-items: start; }
  .aip-flow__step::before { grid-row: span 2; margin: 0; }
  .aip-flow__step span { margin-top: 0; }
  .aip-flow__step:not(:last-child)::after {
    top: auto;
    bottom: -12px;
    right: auto;
    left: 23px;
    transform: rotate(135deg);
  }
}
@media (max-width: 640px) {
  .aip-toc { grid-template-columns: 1fr; padding: 20px; gap: 16px; }
  .aip-principles { grid-template-columns: 1fr; }
  .aip-cert { grid-template-columns: 1fr; justify-items: start; padding: 20px; gap: 16px; }
  .aip-cert__badge { width: 112px; }
  .aip-cert__meta { font-size: 13px; }
  .privacy-block .aip-cert__text { font-size: 13px; }
  .aip-principle { padding: 18px 18px 16px; }
  .aip-h3 { font-size: 15px; }
  .aip-table { font-size: 13px; }
  .aip-table th, .aip-table td { padding: 10px; }
  .aip-table--scope thead { display: none; }
  .aip-table--scope tr { display: block; margin-bottom: 10px; }
  .aip-table--scope td { display: block; width: auto; border-bottom: 0; }
  .aip-table--scope tr td:last-child { border-bottom: 1px solid var(--color-line); }
  .aip-table--scope td:first-child::before { content: "AIを使う："; font-weight: 700; color: var(--color-primary); }
  .aip-table--scope td:last-child::before { content: "人が担う："; font-weight: 700; color: var(--color-ink); }
  /* 入力可否の表・ツール表も SP はカード型に（横スクロールで右列を見落とさないように） */
  .aip-table--matrix, .aip-table--tools { min-width: 0; table-layout: auto; }
  .aip-table--matrix thead, .aip-table--tools thead { display: none; }
  .aip-table--matrix tr, .aip-table--tools tr { display: block; margin-bottom: 10px; border: 1px solid var(--color-line); }
  .aip-table--matrix th, .aip-table--matrix td,
  .aip-table--tools td { display: block; width: auto !important; border: 0; border-top: 1px solid var(--color-line); }
  .aip-table--matrix tr > :first-child, .aip-table--tools tr > :first-child { border-top: 0; }
  .aip-table--matrix td::before, .aip-table--tools td:not(:first-child)::before {
    display: block; font-size: 12px; font-weight: 700; color: var(--color-mute);
  }
  .aip-table--matrix td:nth-of-type(1)::before { content: "学習に使わないツール"; }
  .aip-table--matrix td:nth-of-type(2)::before { content: "それ以外のツール（無料版など）"; }
  .aip-table--tools td:first-child { background: var(--color-bg-alt); }
  .aip-table--tools td:nth-child(2)::before { content: "主な用途"; }
  .aip-table--tools td:nth-child(3)::before { content: "契約形態"; }
  .aip-table--tools td:nth-child(4)::before { content: "入力内容の学習利用"; }
  .privacy-block .aip-principle p,
  .privacy-block .aip-note { font-size: 13px; }
}
