/* ==========================================================================
   芳名帳作成ツール専用スタイル
   ========================================================================== */

body {
  background: #f7f8fa;
}

/* ── パンくず・ページ見出し ────────────────────────────────────────── */
.gb-breadcrumb {
  max-width: 1180px;
  margin: 14px auto 0;
  padding: 0 20px;
}

.gb-seo-header {
  max-width: 1180px;
  margin: 6px auto 0;
  padding: 0 20px 10px;
}

.gb-seo-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 8px;
}

.gb-seo-lead {
  color: #374151;
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0 0 6px;
}

.gb-seo-lead-sub {
  color: #6b7280;
  font-size: 0.82rem;
  margin: 0;
}

/* ── 2カラムレイアウト ────────────────────────────────────────────── */
.gb-main-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 20px 40px;
}

.gb-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

@media (min-width: 992px) {
  .gb-main-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: start;
  }
  .gb-col-preview {
    position: sticky;
    top: 20px;
  }
}

.gb-section-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  padding: 20px 20px 22px;
}

/* ── 設定フォーム ─────────────────────────────────────────────────── */
.gb-setting-section {
  margin-bottom: 22px;
}
.gb-setting-section:last-child { margin-bottom: 0; }

.gb-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eef0f3;
}

.gb-form-field { margin-bottom: 14px; }
.gb-form-field:last-child { margin-bottom: 0; }

.gb-form-field label,
.gb-form-field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}

.gb-form-field input[type="text"],
.gb-form-field input[type="date"],
.gb-form-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #111827;
  background: #fff;
}

.gb-form-field input:focus,
.gb-form-field select:focus {
  outline: 2px solid #2f6fb0;
  outline-offset: 1px;
  border-color: #2f6fb0;
}

.gb-field-row { margin-bottom: 14px; }
.gb-field-row:last-child { margin-bottom: 0; }

.gb-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.gb-two-col .gb-form-field { margin-bottom: 0; }

.gb-total-count {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: #eef4fb;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1f4f8a;
}

.gb-checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gb-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  cursor: pointer;
}

.gb-checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #2f6fb0;
  cursor: pointer;
}

.gb-checkbox-field input[type="text"],
.gb-checkbox-field input[type="date"] {
  flex: 1 1 180px;
  min-width: 140px;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.92rem;
  color: #111827;
}

.gb-checkbox-field input:disabled {
  background: #f3f4f6;
  color: #9ca3af;
}

.gb-hint {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 4px 0 12px;
  line-height: 1.6;
}

/* ── 記入項目リスト ───────────────────────────────────────────────── */
.gb-column-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gb-column-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafbfc;
}

.gb-column-row label.gb-checkbox-label {
  flex: 0 0 auto;
  min-width: 128px;
}

.gb-column-row input[type="text"] {
  flex: 1 1 auto;
  box-sizing: border-box;
  padding: 7px 9px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.88rem;
  color: #111827;
  background: #fff;
}

.gb-column-row input[type="text"]:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
}

/* ── 用紙の向き（セグメント切替） ─────────────────────────────────── */
.gb-segmented {
  display: inline-flex;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
}

.gb-segmented-option {
  position: relative;
  padding: 8px 22px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  background: #fff;
}
.gb-segmented-option + .gb-segmented-option {
  border-left: 1px solid #d1d5db;
}

.gb-segmented-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.gb-segmented-option:has(input:checked) {
  background: #2f6fb0;
  color: #fff;
}

.gb-segmented-option:has(input:focus-visible) {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

/* ── 保存状態・ボタン ─────────────────────────────────────────────── */
.gb-bottom-section {
  padding-top: 16px;
  border-top: 1px solid #eef0f3;
}

.gb-save-status {
  min-height: 1.1em;
  font-size: 0.78rem;
  color: #2f7d4f;
  margin: 0 0 4px;
}

.gb-privacy-note {
  font-size: 0.76rem;
  color: #6b7280;
  margin: 0 0 14px;
  line-height: 1.6;
}

.gb-btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.gb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #f8f9fb;
  color: #374151;
  cursor: pointer;
  min-height: 44px;
}
.gb-btn:hover { background: #eef2f7; }
.gb-btn:focus-visible { outline: 2px solid #2f6fb0; outline-offset: 2px; }

.gb-btn-primary {
  background: #2f6fb0;
  border-color: #2f6fb0;
  color: #fff;
}
.gb-btn-primary:hover { background: #245a91; }

.gb-btn-outline {
  background: #fff;
  border-color: #2f6fb0;
  color: #2f6fb0;
}
.gb-btn-outline:hover { background: #eaf2fb; }

.gb-btn-text-danger {
  background: transparent;
  border-color: transparent;
  color: #b3261e;
  padding-left: 6px;
  padding-right: 6px;
}
.gb-btn-text-danger:hover { color: #7a1f1f; text-decoration: underline; }

/* ── プレビューツールバー ─────────────────────────────────────────── */
.gb-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.gb-print-note {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 0 0 12px;
}

/* ── A4プレビュー ─────────────────────────────────────────────────── */
.gb-paper-scale-wrap {
  overflow-x: auto;
  padding: 4px 0 6px;
}

.gb-paper-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.gb-page {
  position: relative;
  flex: none;
  width: 210mm;
  height: 297mm;
  box-sizing: border-box;
  background: #fff;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.15);
  outline: 1px solid #e4e9f0;
  outline-offset: -1px;
  padding: 16mm 15mm 12mm;
  color: #111827;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  zoom: 1;
  transform-origin: top center;
}

.gb-page[data-orientation="landscape"] {
  width: 297mm;
  height: 210mm;
}

/* 用途に応じたフォント（一般・結婚式・葬儀法要＝明朝系／式典・セミナー・展示会＝ゴシック系） */
.gb-page[data-font="mincho"] {
  font-family: "游明朝体", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "HiraMinProN-W3", "MS PMincho", serif;
}

.gb-page[data-font="gothic"] {
  font-family: "游ゴシック体", "Yu Gothic", "YuGothic", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
}

.gb-page-number {
  position: absolute;
  top: -22px;
  left: 0;
  font-size: 0.75rem;
  color: #6b7280;
}

/* ── ページヘッダー（見出し・日付・主催者名） ────────────────────── */
.gb-page-header {
  flex: none;
  text-align: center;
  margin-bottom: 8mm;
}

.gb-page-heading {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0 0 2mm;
  padding-bottom: 1.5mm;
  border-bottom: 1px solid #333;
  display: inline-block;
  min-width: 60%;
}

.gb-page-meta {
  margin: 4mm 0 0;
  text-align: right;
  font-size: 13px;
  line-height: 1.8;
  color: #1f2937;
}

.gb-page-meta p { margin: 0; }

/* ── 表 ───────────────────────────────────────────────────────────── */
.gb-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
}

.gb-table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.gb-table th,
.gb-table td {
  border: 1px solid #333;
  padding: 0 6px;
}

.gb-table thead th {
  height: 11mm;
  font-size: 13px;
  font-weight: 700;
  background: #f0f2f5;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.gb-table tbody td {
  font-size: 13px;
}

.gb-table tbody td.gb-col-no {
  text-align: center;
  color: #444;
}

/* ── 使い方ステップ・関連リンク（他ツールと統一） ────────────────── */
.gb-steps {
  list-style: none;
  counter-reset: gb-step;
  padding: 0;
  margin: 0 0 14px;
}

.gb-steps li {
  position: relative;
  padding: 8px 0 10px 34px;
  margin-bottom: 0;
  border-bottom: 1px solid #f3f4f6;
}
.gb-steps li:last-child { border-bottom: none; }

.gb-steps li::before {
  counter-increment: gb-step;
  content: counter(gb-step);
  position: absolute;
  left: 0;
  top: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2f6fb0;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.related-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-link-list li {
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.92rem;
}
.related-link-list li:last-child { border-bottom: none; }

.related-link-list a {
  color: #2f6fb0;
  font-weight: 600;
  text-decoration: none;
}
.related-link-list a:hover { text-decoration: underline; }

.gb-note { color: #6b7280; font-size: 0.85rem; }

.faq-box {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 12px;
  background: #fff;
}
.faq-box h3 { margin-top: 0; }
.faq-box p:last-child { margin-bottom: 0; }

.seo-content {
  max-width: 1180px;
  margin: 30px auto 0;
  padding: 0 20px 40px;
}

.seo-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 40px 0 14px;
  color: #111827;
  border-left: 4px solid #2f6fb0;
  padding-left: 10px;
}
.seo-content h2:first-of-type { margin-top: 0; }

.seo-content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 20px 0 8px;
  color: #1f4f8a;
  border-left: 3px solid #a9c8e8;
  padding-left: 8px;
}

.seo-content p,
.seo-content li {
  color: #374151;
  font-size: 0.92rem;
  line-height: 1.85;
}
.seo-content p { margin: 0 0 12px; }

/* ── モバイル固定アクションバー ───────────────────────────────────── */
.gb-mobile-action-bar {
  display: none;
}

@media (max-width: 991px) {
  .gb-mobile-action-bar {
    display: flex;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    z-index: 20;
  }
  .gb-mobile-action-bar .gb-btn { flex: 1 1 0; }
}

@media (max-width: 640px) {
  .gb-two-col { grid-template-columns: 1fr; }
  .gb-section-card { padding: 16px 14px 18px; }
  .gb-column-row { flex-wrap: wrap; }
  .gb-column-row input[type="text"] { flex-basis: 100%; }
}

/* ── 印刷 ─────────────────────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }

  body { background: #fff; }

  .gb-main-container {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .gb-main-grid { display: block; }

  .gb-col-preview .gb-section-card {
    box-shadow: none !important;
    border: none;
    border-radius: 0;
    padding: 0;
  }

  .gb-paper-scale-wrap {
    overflow: visible;
    padding: 0;
  }

  .gb-paper-stage {
    gap: 0;
  }

  .gb-page {
    zoom: 1 !important;
    box-shadow: none !important;
    outline: none;
    margin: 0 auto;
    /* ちょうど1ページ分の高さだと丸め誤差で空白の2枚目が
       印刷されることがあるため、印刷時だけわずかに余裕を持たせる */
    height: calc(297mm - 2mm) !important;
    break-after: page;
    page-break-after: always;
  }
  .gb-page[data-orientation="landscape"] {
    height: calc(210mm - 2mm) !important;
  }
  .gb-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .gb-page-number { display: none; }

  .gb-table tbody tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }
}


/* ── 用途選択ボタン ───────────────────────────────────────────────── */
.gb-purpose-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gb-purpose-btn {
  min-height: 44px;
  padding: 9px 8px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.gb-purpose-btn:hover {
  background: #f3f6fa;
  border-color: #aebdcc;
}

.gb-purpose-btn.is-active {
  background: #2f6fb0;
  border-color: #2f6fb0;
  color: #fff;
}

.gb-purpose-btn:focus-visible {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

.gb-purpose-select-sr {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.gb-hint-first {
  margin-top: -2px;
}

/* ── その他の設定 ─────────────────────────────────────────────────── */
.gb-advanced-settings {
  margin: 2px 0 22px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fafbfc;
}

.gb-advanced-settings summary {
  position: relative;
  padding: 12px 40px 12px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #374151;
  cursor: pointer;
  list-style: none;
}

.gb-advanced-settings summary::-webkit-details-marker {
  display: none;
}

.gb-advanced-settings summary::after {
  content: "＋";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 1rem;
}

.gb-advanced-settings[open] summary::after {
  content: "−";
}

.gb-advanced-inner {
  padding: 2px 14px 14px;
  border-top: 1px solid #eef0f3;
}

.gb-advanced-inner .gb-two-col {
  margin-top: 12px;
}

@media (max-width: 640px) {
  .gb-purpose-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
