/*
 * このサイトだけの部品（tokens.css の変数だけを使う）
 *
 * 共通の部品は components.css。ここには、はぎ保険設計サービスのページにしか無いもの
 * （会社情報・取扱保険・お問い合わせ・事故時の連絡先・方針類・記事）を置く。
 * クラス名は固定ページ・記事の本文（DB 内の HTML）に合わせている。
 */

/* ===== 内部ページの土台 ===== */
.page-hero { overflow: hidden; background: var(--color-surface-tint); }
.page-hero-img { display: block; width: 100%; height: clamp(11rem, 26vw, 20rem); object-fit: cover; object-position: center; }
/* PC（会社情報・お問い合わせ）: 上部の画像の上にヘッダーを重ねる（components.css）。画像の暗い部分でも文字が読めるよう、上端に白いぼかしを敷き、画像を少し高くする */
@media (min-width: 769px) {
  .has-page-hero .page-hero { position: relative; }
  .has-page-hero .page-hero::before { content: ""; position: absolute; inset: 0 0 auto; height: 11rem; background: linear-gradient(rgba(255, 255, 255, .94) 0, rgba(255, 255, 255, .86) 55%, rgba(255, 255, 255, 0)); pointer-events: none; }
  .has-page-hero .page-hero-img { height: clamp(20rem, 34vw, 30rem); }
}

/* トップは最後の帯（当社について）をフッターに付ける */
.home .container { padding-bottom: 0; }

/* トップ以外はセクションの間を詰め、細い線で区切る */
body:not(.home) .container section { padding: var(--space-4) 0; border-top: 1px solid var(--color-line); }
body:not(.home) .container section:first-of-type { border-top: 0; }
/* :where() で詳細度を上げない（部品ごとの指定が勝つように） */
:where(body:not(.home)) .container h2 { margin: 0 0 var(--space-3); font-size: var(--text-xl); }
:where(body:not(.home)) .container h3 { margin: var(--space-3) 0 var(--space-1); font-size: var(--text-lg); }
:where(body:not(.home) .container) :is(ul, ol) { padding-left: 1.4rem; }
:where(body:not(.home) .container) li { margin-bottom: .35rem; }
.mt-2 { margin-top: var(--space-4); }
.policy-page section > .btn-outline { margin-top: var(--space-2); }

/* 下線を付けない見出し（アイコンの横・カードの中・記事の中） */
:is(.service-heading, .contact-method-card, .booking-section, .contact-alt, .blog-card, .blog-post, .faq-section, .accident-section) h2::after { display: none; }

/* ===== 会社情報 ===== */
.info-table { max-width: 40rem; margin: var(--space-2) 0 var(--space-4); font-size: .95rem; }
.info-table th { border-left: 3px solid var(--blue-600); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: var(--space-2) 0 var(--space-4); }
.table-scroll .info-table { margin: 0; }
.kpi-table th { white-space: normal; width: auto; }
.kpi-table :is(th, td):nth-child(n + 2) { text-align: center; }
@media (max-width: 600px) {
  .info-table th { width: 6.5rem; white-space: normal; }
  .kpi-table { min-width: 30rem; }
}

.company-info-row { display: flex; align-items: flex-start; gap: var(--space-4); }
.company-info-main { flex: 1; min-width: 0; }
.company-logo-wrap { flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding-top: var(--space-4); }
.company-logo-img { width: 12rem; max-width: 100%; height: auto; }
.intro-logo-img { display: block; max-width: 100%; height: auto; }
@media (max-width: 768px) {
  .company-info-row { flex-direction: column; gap: var(--space-3); }
  .company-logo-wrap { padding-top: 0; }
  .company-logo-img { width: 9.5rem; }
}

.building-photo { margin: var(--space-2) 0 var(--space-3); border-radius: var(--radius); overflow: hidden; }
.building-photo-img { display: block; width: 100%; max-height: 16rem; object-fit: cover; object-position: center 75%; }
@media (max-width: 600px) { .building-photo-img { object-position: bottom; } }

address {
  display: table;
  margin-bottom: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-soft);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  font-style: normal;
  line-height: 2;
}

.map-link-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 32rem;
  padding: var(--space-2) var(--space-3);
  background: var(--white);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-rest);
  color: inherit;
  text-decoration: none;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.map-link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.map-link-body { flex: 1; display: flex; flex-direction: column; gap: .15rem; }
.map-link-label { color: var(--blue-700); font-size: var(--text-xs); font-weight: 700; letter-spacing: .04em; }
.map-link-address { font-size: var(--text-sm); }
.map-link-cta { display: flex; align-items: center; gap: .2rem; flex-shrink: 0; color: var(--blue-700); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }
.map-link-cta svg { width: .9rem; height: .9rem; }
@media (max-width: 560px) {
  .map-link-card { flex-wrap: wrap; }
  .map-link-cta { width: 100%; justify-content: flex-end; }
}
.map-container { margin-top: var(--space-2); border: 1px solid var(--color-line); border-radius: var(--radius); overflow: hidden; }
.map-container iframe { display: block; max-width: 100%; }
.map-iframe { border: 0; }

/* ===== アイコンの台（共通の .card-icon と同じ絵柄を、置き場所に合わせた大きさで）===== */
:is(.service-icon, .contact-method-icon, .map-link-icon) {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 4rem;
  height: 4rem;
  margin: 0;
  border-radius: 16px;
  background: linear-gradient(150deg, var(--blue-100), var(--gray-50));
  color: var(--blue-700);
}
:is(.service-icon, .contact-method-icon, .map-link-icon) svg { width: 3.1rem; height: 3.1rem; }
.map-link-icon { width: 3.25rem; height: 3.25rem; border-radius: 12px; }
.map-link-icon svg { width: 2.5rem; height: 2.5rem; }

/* ===== 取扱保険 ===== */
.service-tabs { display: flex; gap: .5rem; margin: var(--space-3) 0; border-bottom: 2px solid var(--color-line); }
.tab-btn {
  min-height: var(--tap);
  margin-bottom: -2px;
  padding: .6rem 1.4rem;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--color-text-soft);
  font: inherit;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.tab-btn:hover { background: var(--color-surface-soft); color: var(--blue-700); }
.tab-btn.active { color: var(--blue-700); border-bottom-color: var(--blue-700); font-weight: 700; }
@media (max-width: 560px) { .tab-btn { flex: 1; padding: .6rem .5rem; } }
/* JavaScript が動かないとき: タブを出さず、個人向け・法人向けを続けて見せる */
html:not(.js) .service-tabs { display: none; }
html:not(.js) .tab-panel[hidden] { display: block; }
.tab-visual { display: block; width: 100%; max-height: 20rem; margin-bottom: var(--space-3); border-radius: var(--radius); object-fit: cover; }
.service-heading { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.service-heading h2 { margin: 0; }

/* ===== お問い合わせ ===== */
.contact-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin: var(--space-4) 0; }
.contact-method-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  min-width: 0;
  padding: var(--space-3);
  background: var(--white);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-rest);
  text-align: center;
}
@media (max-width: 820px) { .contact-methods { grid-template-columns: 1fr; gap: var(--space-2); } }
.contact-method-card--line { border-color: var(--blue-600); }
.contact-method-card h2 { margin: 0; font-size: var(--text-lg); }
.contact-method-card p { flex: 1; margin: 0; color: var(--color-text-soft); font-size: var(--text-sm); line-height: 1.8; }
.contact-method-card :is(.btn, .btn-outline) { width: 100%; }
.line-note { flex: none; margin: 0; font-size: var(--text-xs); }
.line-note a { display: inline-block; padding: .5rem 0; color: var(--color-text-soft); }
.line-note a:hover { color: var(--blue-700); }
.line-guide { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--color-line); text-align: left; }
.line-guide-head { margin: 0 0 .4rem; font-size: var(--text-xs); font-weight: 700; }
.line-guide-head--ok { color: var(--blue-700); }
.line-guide-head--tel { color: var(--color-text-soft); }
.line-guide ul { list-style: none; margin: 0; padding: 0; color: var(--color-text-soft); font-size: var(--text-xs); line-height: 1.9; }
.line-guide li { margin: 0; }
.line-guide li::before { content: '・'; }
@media (max-width: 600px) { .line-guide { grid-template-columns: 1fr; } }

.contact-tel-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-tint);
  border-radius: var(--radius);
}
.contact-tel-label { color: var(--color-text-soft); font-size: var(--text-sm); }
.contact-tel-num { display: inline-block; padding: .3rem 0; color: var(--blue-700); font-size: 1.5rem; font-weight: 700; letter-spacing: .03em; text-decoration: none; }
.contact-tel-num:hover { text-decoration: underline; }
.contact-tel-hours { color: var(--color-text-soft); font-size: var(--text-sm); }

.booking-section { margin: var(--space-3) 0; padding: var(--space-3) var(--space-4); background: var(--color-surface-soft); border: 1px solid var(--color-line); border-radius: var(--radius); }
.booking-section h2, .contact-alt h2 { margin-top: 0; }
.btn-calendly { margin-top: var(--space-1); }
.contact-alt { margin: var(--space-3) 0 var(--space-1); }
.calendly-fab { display: none; }

.contact-form-section { max-width: 40rem; }
.contact-form-section h2 { margin-bottom: var(--space-2); }
.contact-section { margin-top: var(--space-4); padding: var(--space-5) 0; background: var(--color-surface-soft); border-top: 1px solid var(--color-line); }
.contact-section .wrap { max-width: 40rem; }
.contact-section h2 { margin-top: 0; }

/* フォームのメッセージ（Contact Form 7）。完了は青、エラーだけ赤 */
#formMessage, .wpcf7-response-output { margin: .75rem 0 1em; min-height: 1.2em; color: var(--color-text-soft); font-size: var(--text-sm); }
#formMessage.success,
.wpcf7-form.sent .wpcf7-response-output,
.wpcf7-form.resetting .wpcf7-response-output { color: var(--blue-700); font-weight: 700; }
#formMessage.error,
.wpcf7-form:is(.invalid, .unaccepted, .spam, .aborted, .failed) .wpcf7-response-output { color: var(--error); font-weight: 700; }
.wpcf7 .hidden-fields-container, .wpcf7-not-valid-tip { display: none; }
.wpcf7 .screen-reader-response { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.wpcf7-form-control-wrap { display: contents; }
form .btn:disabled { opacity: .6; cursor: default; box-shadow: none; }

/* お問い合わせ・事故時の連絡先・方針類では、画面に留まる LINE ボタンを出さない */
:is(.contact-page, .accident-page, .policy-page) .line-fab { display: none; }
/* 右下に reCAPTCHA のマーク（本番だけ出る。高さ 60px）が来るので、先頭へ戻るボタンはその上に置く */
.contact-page #back-to-top { bottom: 5.5rem; }

/* ===== 方針類 ===== */
.line-policy-note,
.action-plan {
  margin: var(--space-2) 0;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-tint);
  border-left: 4px solid var(--blue-700);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.8;
}
.action-plan { background: var(--color-surface-soft); border-left-color: var(--blue-600); }
.action-plan strong { color: var(--blue-700); }

/* ===== 事故時の連絡先 ===== */
.btn-emergency { background: var(--white); color: var(--blue-700); border: 2px solid var(--blue-700); }
.btn-emergency:hover { background: var(--blue-700); color: var(--white); }
.accident-agency-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-tint);
  border-left: 4px solid var(--blue-700);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.accident-agency-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.accident-section h2 { margin-bottom: var(--space-1); padding-left: .75rem; border-left: 4px solid var(--blue-600); }
.accident-section-note { margin: 0 0 var(--space-3); color: var(--color-text-soft); font-size: var(--text-sm); }
.accident-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--space-2); }
.accident-card { position: relative; padding: var(--space-3); background: var(--white); border: 1px solid var(--color-line); border-radius: var(--radius); box-shadow: var(--shadow-rest); }
.accident-card--emergency { border-top: 4px solid var(--blue-700); }
.accident-card-badge { display: inline-block; margin-bottom: .6rem; padding: .15em .8em; background: var(--blue-700); color: var(--white); border-radius: 2em; font-size: var(--text-xs); font-weight: 700; letter-spacing: .04em; }
.accident-card h3 { margin: 0 0 .4rem; font-size: var(--text-md); }
.accident-card p { margin: 0 0 .75rem; color: var(--color-text-soft); font-size: var(--text-sm); line-height: 1.8; }
.accident-tel { display: flex; align-items: center; gap: .4rem; min-height: var(--tap); color: var(--blue-700); font-size: 1.45rem; font-weight: 700; letter-spacing: .02em; text-decoration: none; }
.accident-tel:hover { text-decoration: underline; }
.accident-tel svg { flex-shrink: 0; width: 1.15rem; height: 1.15rem; }
.accident-tel-free { display: inline-block; margin-top: .2rem; color: var(--color-text-soft); font-size: var(--text-xs); }
.accident-card .accident-hours { margin: .5rem 0 0; font-size: var(--text-xs); }
@media (max-width: 600px) {
  .accident-cards { grid-template-columns: 1fr; }
  .accident-agency-bar { flex-direction: column; align-items: flex-start; }
  .accident-agency-actions, .accident-agency-actions > * { width: 100%; }
}

/* ===== よくある質問 ===== */
.faq-section h2 { padding-left: .75rem; border-left: 4px solid var(--blue-600); font-size: var(--text-lg); }
.faq-list { margin: 0; padding: 0; }

/* ===== 記事の一覧 ===== */
.blog-hero { margin: var(--space-3) 0 var(--space-4); border-radius: var(--radius); overflow: hidden; }
.blog-hero-img { display: block; width: 100%; max-height: 17rem; object-fit: cover; }
@media (max-width: 600px) { .blog-hero-img { max-height: 11rem; } }
.blog-grid { display: flex; flex-direction: column; gap: var(--space-3); margin: var(--space-3) 0; }
.blog-card {
  padding: var(--space-3);
  background: var(--white);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-rest);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.blog-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.blog-card-meta, .blog-post-meta { display: flex; align-items: center; gap: .75rem; margin-bottom: .6rem; color: var(--color-text-soft); font-size: var(--text-sm); }
.blog-card-title { margin: 0 0 .6rem; font-size: var(--text-lg); }
.blog-card-title a { color: var(--color-heading); text-decoration: none; }
.blog-card-title a:hover { color: var(--blue-700); text-decoration: underline; }
.blog-card-excerpt { margin: 0 0 var(--space-1); color: var(--color-text-soft); font-size: .95rem; line-height: 1.8; }
.blog-read-more { display: inline-block; padding: .5rem 0; font-size: var(--text-sm); font-weight: 700; text-decoration: none; }
.blog-read-more:hover { text-decoration: underline; }
.blog-cta { margin-top: var(--space-3); padding: var(--space-3); background: var(--color-surface-soft); border: 1px solid var(--color-line); border-radius: var(--radius); text-align: center; }
.blog-cta p { margin: 0 0 var(--space-2); color: var(--color-text-soft); }

/* ページ送り */
.pagination { margin: var(--space-3) 0; }
.pagination .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 .8rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  color: var(--blue-700);
  font-size: var(--text-md);
}
.pagination .page-numbers.current { background: var(--blue-700); border-color: var(--blue-700); color: var(--white); font-weight: 700; }
.pagination .page-numbers.dots { border: 0; color: var(--color-text-soft); }
.screen-reader-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* ===== 記事 ===== */
.breadcrumb { margin-bottom: var(--space-3); color: var(--color-text-soft); font-size: var(--text-sm); }
.breadcrumb a { display: inline-block; padding: .5rem 0; border-radius: 0; color: var(--blue-700); font-size: inherit; }
.breadcrumb a:hover { background: none; text-decoration: underline; }
.blog-post { max-width: 44rem; }
.blog-post h1 { margin: 0 0 var(--space-3); font-size: var(--text-2xl); }
.blog-post h2 { margin: var(--space-4) 0 var(--space-2); padding-bottom: .4rem; border-bottom: 1px solid var(--color-line); font-size: var(--text-lg); }
.blog-post-cta { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: var(--space-5); padding: var(--space-3); background: var(--color-surface-soft); border: 1px solid var(--color-line); border-radius: var(--radius); }
.blog-post-cta p { flex: 1 1 100%; margin: 0; color: var(--color-text-soft); }
@media (max-width: 560px) { .blog-post-cta :is(.btn, .btn-outline) { width: 100%; } }

/* ===== 取扱保険のタブの切り替え（押して切り替えたときだけ動かす。読み込み時は動かさない） ===== */
@media (prefers-reduced-motion: no-preference) {
  .tab-panel.is-switched { animation: tab-in var(--dur) var(--ease); }
}
@keyframes tab-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===== 印刷（方針類を紙や PDF にするとき）===== */
@media print {
  .site-header, .site-footer, .line-fab, #back-to-top, .nav-backdrop { display: none !important; }
  .policy-page { background: #fff; color: #000; }
  .policy-page .container { max-width: 100%; margin: 0; padding: 0; }
  .policy-page a { color: #000; text-decoration: none; }
  .policy-page :is(section, .info-table, .action-plan, .line-policy-note) { break-inside: avoid; }
  .policy-page :is(h1, h2, h3) { break-after: avoid; }
  .policy-page :is(.action-plan, .line-policy-note, .info-table th) { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
