/*
 * きくち皮膚科クリニック - リセットCSS・ベーススタイル
 * Pattern B: エレガント・洗練（Noto Serif JP × Playfair Display）
 *
 * 読み込み順: variables.css → base.css → components.css → utilities.css
 */

/* =============================================
 * @font-face / Google Fonts
 * WordPress functions.php の wp_enqueue_style で読み込む想定。
 * ここではフォールバックスタックのみ定義。
 * =============================================
 * 必要なGoogle Fontsエンドポイント（functions.php参照）:
 * Noto Serif JP: wght@400;500;700
 * Noto Sans JP:  wght@400;500;700
 * Playfair Display: wght@400;700;900
 * Inter: wght@400;500;600
 * ============================================= */

/* =============================================
 * リセット（modern-normalize ベース + カスタマイズ）
 * ============================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* ルートフォントサイズ: 16px固定（remの基準） */
  font-size: 16px;
  /* スクロール挙動 */
  scroll-behavior: smooth;
  /* テキストサイズ自動調整を無効化 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* スクロールバーによるレイアウトシフトを防止 */
  scrollbar-gutter: stable;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans-ja);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  /* テキストレンダリング最適化 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 横スクロール防止 */
  overflow-x: hidden;
}

/* =============================================
 * フォーカス管理（アクセシビリティ）
 * ============================================= */

/* マウスクリック時はフォーカスリングを非表示 */
:focus:not(:focus-visible) {
  outline: none;
}

/* キーボードフォーカス時はリングを明示表示 */
:focus-visible {
  outline: 3px solid var(--color-border-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* =============================================
 * タイポグラフィ - 見出し
 * Noto Serif JP（日本語主体）× Playfair Display（英語アクセント）
 * ============================================= */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif-ja);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-normal);
  color: var(--color-text);
}

h1 {
  font-size: var(--text-5xl); /* 40px */
  letter-spacing: var(--tracking-tight);
}

h2 {
  font-size: var(--text-4xl); /* 36px */
}

h3 {
  font-size: var(--text-3xl); /* 30px */
}

h4 {
  font-size: var(--text-2xl); /* 24px */
}

h5 {
  font-size: var(--text-xl); /* 20px */
}

h6 {
  font-size: var(--text-lg); /* 18px */
}

/* 英語アクセント見出し（Playfair Display使用クラス） */
.heading-en {
  font-family: var(--font-serif-en);
  letter-spacing: var(--tracking-wider);
}

/* セクション見出しの英語サブテキスト（装飾用） */
.section__label-en {
  display: block;
  font-family: var(--font-serif-en);
  font-size: var(--text-sm); /* 14px */
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-wider);
  color: var(--color-primary);
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

/* セクション見出し共通パターン */
.section__heading {
  font-family: var(--font-serif-ja);
  font-size: var(--text-3xl); /* 30px */
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-normal);
  color: var(--color-text);
}

@media (max-width: 767px) {
  h1 {
    font-size: var(--text-4xl); /* 36px → SP */
  }

  h2 {
    font-size: var(--text-3xl); /* 30px → SP */
  }

  h3 {
    font-size: var(--text-2xl); /* 24px → SP */
  }

  .section__heading {
    font-size: var(--text-2xl); /* 24px → SP */
  }
}

/* =============================================
 * タイポグラフィ - 本文・インライン要素
 * ============================================= */

p {
  font-family: var(--font-sans-ja);
  font-size: var(--text-base); /* 16px */
  line-height: var(--leading-normal); /* 1.75 */
  color: var(--color-text);
  /* 欧文混在時のオーファン対策 */
  overflow-wrap: break-word;
  word-break: break-word;
}

/* リード文（セクション冒頭の説明文） */
.lead {
  font-size: var(--text-lg); /* 18px */
  line-height: var(--leading-relaxed); /* 1.85 */
  color: var(--color-text);
}

/* キャプション・注釈 */
.caption {
  font-size: var(--text-sm); /* 14px */
  line-height: var(--leading-snug);
  color: var(--color-text-light);
  /* ※ --color-text-light は small text基準でAA未満の可能性があるため
   *   必ず14px以上・通常ウェイトで使用すること。
   *   12px以下での使用は禁止。 */
}

strong,
b {
  font-weight: var(--weight-bold);
}

em {
  font-style: italic;
  color: var(--color-primary);
}

small {
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

/* =============================================
 * リンク
 * ============================================= */

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition-hover);
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration-color: var(--color-primary-dark);
}

/* ナビゲーション等、装飾なしリンク */
a:where([class]) {
  text-decoration: none;
}

/* =============================================
 * リスト
 * ============================================= */

ul,
ol {
  padding-left: var(--space-3);
}

li {
  line-height: var(--leading-normal);
  margin-bottom: calc(var(--space-1) / 2); /* 4px */
}

ul li::marker {
  color: var(--color-primary);
}

/* =============================================
 * テーブル
 * ============================================= */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

th {
  font-family: var(--font-sans-ja);
  font-weight: var(--weight-medium);
  text-align: left;
  padding: var(--space-2) var(--space-3);
  background-color: var(--color-bg-subtle);
  border-bottom: 2px solid var(--color-primary);
  color: var(--color-text);
}

td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

/* =============================================
 * フォーム基本スタイル
 * ============================================= */

input,
textarea,
select {
  font-family: var(--font-sans-ja);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: calc(var(--space-1) + 4px) var(--space-2); /* 12px 16px */
  width: 100%;
  line-height: var(--leading-normal);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
  appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(123, 94, 167, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-light);
  opacity: 1;
}

label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  margin-bottom: calc(var(--space-1) / 2); /* 4px */
}

/* =============================================
 * 画像・メディア
 * ============================================= */

img,
video,
picture {
  display: block;
  max-width: 100%;
  height: auto;
}

/* オブジェクトフィット指定画像 */
img[data-object-fit='cover'] {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

figure {
  margin: 0;
}

figcaption {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  margin-top: var(--space-1);
  text-align: center;
}

/* =============================================
 * 水平線
 * ============================================= */

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--element-gap) 0;
}

/* =============================================
 * コード
 * ============================================= */

code,
kbd,
samp {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875em;
  background-color: var(--color-bg-subtle);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

/* =============================================
 * コンテナ・レイアウト基盤
 * ============================================= */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding-sp);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--container-padding);
  }
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--wide {
  max-width: var(--container-wide);
}

/* =============================================
 * セクション基底
 * ============================================= */

.section {
  padding-block: var(--section-gap-sp);
}

@media (min-width: 768px) {
  .section {
    padding-block: var(--section-gap);
  }
}

/* 交互背景色 */
.section--alt {
  background-color: var(--color-bg-subtle);
}

/* ダーク背景セクション */
.section--dark {
  background-color: var(--color-bg-inverse);
  color: var(--color-text-on-dark);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark h5,
.section--dark h6 {
  color: var(--color-text-on-dark);
}

/* セクション見出しブロック */
.section__header {
  text-align: center;
  margin-bottom: var(--space-8); /* 64px */
}

@media (max-width: 767px) {
  .section__header {
    margin-bottom: var(--space-6); /* 48px */
  }
}

.section__desc {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-text);
  max-width: 640px;
  margin-inline: auto;
  margin-top: var(--space-2);
  text-align: center;
}

/* =============================================
 * グリッドシステム
 * ============================================= */

.grid {
  display: grid;
  gap: var(--grid-gap);
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1023px) {
  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
    gap: var(--grid-gap-sm);
  }
}

/* =============================================
 * モーション設定（アクセシビリティ）
 * ============================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* フェードインアニメーション（通常モード） */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-fade-up {
  animation: fade-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.animate-fade-in {
  animation: fade-in 0.4s ease both;
}

/* =============================================
 * スクリーンリーダー専用
 * ============================================= */

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

/* =============================================
 * プリント
 * ============================================= */

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  .nav,
  .footer,
  .btn,
  .cta-banner {
    display: none;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 10pt;
  }
}
