/* ========= 第1章 41節-1 専用（最小・安全版） ========= */

/* スコープ＆トークン */
.page-law-proc, .page-law-proc * { box-sizing: border-box; }
.page-law-proc{
  --container: min(1120px, calc(100% - 32px));
  --page-bg: #f5f7fb;
  --card-bg: #fff;
  --ink: #0b1f3a;
  --accent: #1f2a44;
  --head-bg: #f1f6ff;
  --border: #e5e7eb;
}
body.page-law-proc { background: var(--page-bg); color: var(--ink); }
.page-law-proc .breadcrumbs,
.page-law-proc .main-container { max-width: var(--container); margin-inline: auto; }

/* 見出し（統一） */
.page-law-proc .section-title{
  margin: 18px 0 12px !important;
  font: 700 clamp(22px,2.1vw,28px)/1.25 system-ui,"Noto Sans JP",sans-serif !important;
  color: var(--ink) !important;
  border-left: 5px solid var(--accent) !important;
  padding-left: 12px !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* テーブルカード（横スクロール親） */
/* ====== テーブル外側の白カードをやめる（フラット化） ====== */
.page-law-proc .table-wrap{
  position: relative;
  isolation: isolate;
  background: transparent !important;  /* ← 白背景やめる */
  border: 0 !important;                /* ← 枠線なし */
  box-shadow: none !important;         /* ← 影なし */
  padding: 0 !important;               /* ← 余白も外す */
  margin: 0;                           /* 任意：上下マージンもフラットに */
  overflow-x: auto;                    /* ← 横スクロールは維持（SP用） */
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
}


/* ====== テーブル基礎（そのまま。背景はセル側で白に） ====== */
.page-law-proc .procedures-table{
  width: 100%;
  min-width: 920px;                    /* SPは横スクロール */
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: transparent;             /* ← テーブル自体の背景は透明 */
  color: var(--ink);
}


/* セル塗り（sticky の透け防止） */
.page-law-proc .procedures-table th,
.page-law-proc .procedures-table td{
  background: #fff;                    /* ← セルを白で塗る */
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-break: auto-phrase;
}

/* ヘッダ固定 */
.page-law-proc .procedures-table thead th{
  position: sticky; top: 0; z-index: 40;
  background: var(--head-bg);
  border-bottom: 1px solid #d8e2ff;
  font-weight: 700;
}

/* 1列目固定＋潜り込み防止の白帯 */
.page-law-proc .procedures-table th[scope="rowgroup"]{
  position: sticky; left: 0; z-index: 10;
  background: #fff;
  box-shadow: 8px 0 0 #fff;            /* 右側のセルを隠す白帯 */
}
.page-law-proc .procedures-table thead th:first-child{
  position: sticky; left: 0; top: 0; z-index: 50;
  background: var(--head-bg);
}

/* ② 1列目（行見出し）を “row” と “rowgroup” の両方で固定 */
.page-law-proc .procedures-table tbody th.cell-proc,
.page-law-proc .procedures-table tbody th[scope="row"],
.page-law-proc .procedures-table tbody th[scope="rowgroup"]{
  position: sticky;
  left: 0;
  z-index: 45;                      /* ヘッダ(<th:first-child>)より下、本文より上 */
  background: #fff;                 /* 透け防止 */
  box-shadow: 8px 0 0 #fff;         /* 右側への白帯で潜り込み防止 */
}



/* 行グループの区切りは通常線（点線を無効化） */
.page-law-proc .procedures-table .group-sep td,
.page-law-proc .procedures-table .group-sep th{
  border-bottom: 1px solid var(--border) !important;
}

/* 列幅の目安（SP共通） */
/* 4列用の幅指定は「不交付」を除外する */
.page-law-proc .procedures-table:not(.defects-table) thead th:nth-child(1){ width: 80px; }
.page-law-proc .procedures-table:not(.defects-table) thead th:nth-child(2){ width: 200px; }
.page-law-proc .procedures-table:not(.defects-table) thead th:nth-child(3){ width: auto; }
.page-law-proc .procedures-table:not(.defects-table) thead th:nth-child(4){ width: 220px; }


/* 左列ラベルの見た目（お好みで） */
.page-law-proc .cell-proc{
  background:#f9fbff !important; color:#0b2b66 !important;
  font-weight:700 !important; text-align:center !important;
  border-right:1px solid #dfe6f7 !important;
}

/* === PCでは横スクロールをやめて列幅を詰める === */
@media (min-width: 1024px){
  .page-law-proc .table-wrap{ overflow-x: visible !important; }
  .page-law-proc .procedures-table{ min-width: unset !important; width:100%; }
}

  /* 手続=80 / 申請事項=200 / 申請先=auto / 添付するもの=220 */
@media (min-width: 1024px){
  .page-law-proc .procedures-table:not(.defects-table) thead th:nth-child(1){ width:80px !important; }
  .page-law-proc .procedures-table:not(.defects-table) thead th:nth-child(2){ width:200px !important; }
  .page-law-proc .procedures-table:not(.defects-table) thead th:nth-child(3){ width:auto  !important; }
  .page-law-proc .procedures-table:not(.defects-table) thead th:nth-child(4){ width:220px !important; }
}

/* ③ iOSのsticky描画ズレ対策（積層コンテキストを作る） */
.page-law-proc .table-wrap{ position: relative; }
.page-law-proc .procedures-table{ position: relative; }



/* ④ SP時の最小幅を少し広げ、潜り込みを減らす */
@media (max-width: 768px){
  .page-law-proc .procedures-table{ min-width: 880px !important; }
  .page-law-proc .procedures-table th,
  .page-law-proc .procedures-table td{ padding: 10px 8px !important; }
}

/* ⑤ 念のため：セル背景は常に白で塗る（stickyの下に回り込ませない） */
.page-law-proc .procedures-table th,
.page-law-proc .procedures-table td{
  background: #fff;
}

/* ===== 頻出ポイント（オレンジ・1列） ===== */
.page-law-proc .exam-notes{
  background: #FFF8E8;
  border: 2px dashed #F1C073;
  border-radius: 12px;
  box-shadow: none;
  padding: 18px 18px 16px;
  margin: 20px 0 18px;
}
.page-law-proc .exam-notes > h3{
  margin: 0 0 12px;
  font-size: clamp(18px,1.9vw,20px);
  font-weight: 700;
  color: #2B2B2B;
  border: 0; padding: 0;
}
.page-law-proc .exam-notes ul.compact{
  list-style: disc;
  margin: 0;
  padding: 0 0 0 1.2em;
}
.page-law-proc .exam-notes ul.compact li{
  margin: 8px 0;
  line-height: 1.7;
}
.page-law-proc .exam-notes ul.compact li::before{ content: none !important; }
@media (max-width: 768px){
  .page-law-proc .exam-notes{ padding: 16px 14px; }
}

.page-law-proc .main-container,
.page-law-proc .site-main,
.page-law-proc .summary-section{
  overflow: visible !important;
}

/* ===== SPのスクロール改善（縦も横も自然に） ===== */
@media (max-width: 768px){
  /* 横スクロールは維持しつつ、縦スクロールをブロックしない */
  .page-law-proc .table-wrap{
    overflow-x: auto !important;
    overflow-y: visible !important;      /* ← hidden を解除 */
    touch-action: pan-y pan-x !important;/* ← 縦横のパンを許可 */
    -webkit-overflow-scrolling: touch;   /* 慣性スクロール */
  }

  /* 列幅をさらにコンパクトに（手続/申請事由/申請先/添付するもの） */
  .page-law-proc .procedures-table:not(.defects-table){ min-width: 820px !important; }
  .page-law-proc .procedures-table:not(.defects-table) thead th:nth-child(1){ width: 80px  !important; }
  .page-law-proc .procedures-table:not(.defects-table) thead th:nth-child(2){ width: 200px !important; }
  .page-law-proc .procedures-table:not(.defects-table) thead th:nth-child(3){ width: auto   !important; }
  .page-law-proc .procedures-table:not(.defects-table) thead th:nth-child(4){ width: 220px !important; }


  /* 左固定列（許可 etc.）の見え方を保ちつつ最前面に */
  .page-law-proc .procedures-table th[scope="rowgroup"]{
    z-index: 10 !important;
    box-shadow: 8px 0 0 #fff;            /* 右側潜り込み防止の白帯 */
  }

  /* 余白を少し軽くして指操作しやすく */
  .page-law-proc .procedures-table th,
  .page-law-proc .procedures-table td{ padding: 10px 8px !important; }
}


/* iOS/Safariの自動拡大を禁止（このページだけ） */
.page-law-proc {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* テーブル内の文字サイズを明示して固定 */
.page-law-proc .procedures-table {
  font-size: 1rem;            /* 基本 */
  line-height: 1.6;
}

@media (max-width: 768px){
  .page-law-proc .procedures-table th,
  .page-law-proc .procedures-table td{
    font-size: .95rem;        /* SPはやや小さめ、列ごとの暴走防止 */
  }

  /* 折り返しを安定させ、拡大のトリガーを減らす */
  .page-law-proc .procedures-table td,
  .page-law-proc .procedures-table th{
    word-break: break-word;   /* auto-phrase が効かない環境の保険 */
    overflow-wrap: anywhere;
  }
}

/* ===== 免状の不交付テーブル専用：1列目を<td>のまま固定 ===== */

/* 1列目は <th scope="row"> を固定（td固定は無効化） */
.page-law-proc .defects-table tbody td:first-child{ position: static; left: auto; box-shadow: none; } /* ←残っていたら上書きで殺す */
.page-law-proc .defects-table tbody th[scope="row"]{
  position: sticky; left: 0; z-index: 50;
  background:#fff; box-shadow: 8px 0 0 #fff;
  font-weight: 700;
}
/* 左上セルも左固定＆被り防止 */
.page-law-proc .defects-table thead th:first-child{
  left: 0; z-index: 60; box-shadow: 8px 0 0 var(--head-bg);
}

/* PCの列幅（3列） */
@media (min-width: 1024px){
  .page-law-proc .defects-table{ min-width: unset; width: 100%; }
  .page-law-proc .defects-table thead th:nth-child(1){ width: 36ch !important; } /* 欠格事由 */
  .page-law-proc .defects-table thead th:nth-child(2){ width: 24ch !important; } /* 欠格期間 */
  .page-law-proc .defects-table thead th:nth-child(3){ width: auto !important; }  /* 補足ポイント */
}

/* ===== 不交付（defects-table）— SP最適化（幅を絞る） ===== */
@media (max-width: 768px){
  /* 最小幅を少しだけ縮める（900→840） */
  .page-law-proc .defects-table{ min-width: 840px; }

  /* 列幅：1列目をやや細く、2列目も少しだけ細く */
  .page-law-proc .defects-table thead th:nth-child(1){ width: 16ch !important; } /* ← 以前より細く */
  .page-law-proc .defects-table thead th:nth-child(2){ width: 18ch !important; }
  .page-law-proc .defects-table thead th:nth-child(3){ width: auto !important; }

  /* 行見出しは折り返しOK＆詰め気味に */
  .page-law-proc .defects-table tbody th[scope="row"]{
    white-space: normal;            /* 折り返し許可 */
    line-height: 1.55;
    padding-right: 6px;             /* 右を少し詰める */
  }

  /* セル内の分割・ハイフンを許可して詰まり軽減 */
  .page-law-proc .defects-table th,
  .page-law-proc .defects-table td{
    overflow-wrap: anywhere;
    hyphens: auto;
    font-size: .95rem;              /* 視認性を保ちつつ微縮小 */
  }
}

/* 「免状の不交付（欠格事由）」の前に余白を足す */
.page-law-proc #no-license-issuance{
  margin-top: 28px;            /* SP */
  scroll-margin-top: 84px;     /* 目次から飛んだ時にヘッダ下で見切れない保険（任意） */
}
@media (min-width: 1024px){
  .page-law-proc #no-license-issuance{ margin-top: 40px; }  /* PCは少し広め */
}


