/**
 * 共通スタイル
 * 全ページで使用する共通スタイル
 *
 * タイポグラフィ: rem 基準（html 16px）、Noto Sans JP + system-ui フォールバック
 */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&display=swap');

:root {
  /* フォント */
  --font-sans: 'Noto Sans JP', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans',
    'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;

  /* サイズ（rem、html=16px 基準） */
  --text-h1: 1.75rem;
  --text-h2: 1.375rem;
  --text-h3: 1.125rem;
  --text-body: 1rem;
  --text-small: 0.875rem;
  --text-caption: 0.8125rem;

  /* 行間 */
  --leading-tight: 1.35;
  --leading-snug: 1.45;
  --leading-body: 1.7;
  --leading-small: 1.55;

  /* 字間 */
  --tracking-heading: 0.02em;
  --tracking-body: 0;

  /* 色（design.md と整合） */
  --color-text: #333;
  --color-text-muted: #666;

  /* 余白・角丸（UI のリズム統一用） */
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --radius: 8px;
  --border-subtle: 1px solid #e0e0e0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  color: var(--color-text);
  background-color: #f5f5f5;
  text-rendering: optimizeLegibility;
}

/* デフォルト見出し（ページ CSS で上書き可能） */
h1 {
  font-size: var(--text-h1);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-heading);
}

h2 {
  font-size: var(--text-h2);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: var(--tracking-heading);
}

h3 {
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: var(--leading-snug);
  letter-spacing: 0.01em;
}

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

small,
.text-small {
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

.text-caption {
  font-size: var(--text-caption);
  line-height: 1.45;
  color: var(--color-text-muted);
}

.text-tabular {
  font-variant-numeric: tabular-nums;
}

.font-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

a {
  color: #0066cc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

input,
textarea,
select,
button {
  font-family: inherit;
}

button {
  padding: 8px 16px;
  background-color: #0066cc;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.4;
}

button:hover {
  background-color: #0052a3;
}

.error-message {
  color: #d32f2f;
  margin-top: 8px;
  padding: 8px;
  background-color: #ffebee;
  border-radius: 4px;
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

.form-group {
  margin-bottom: var(--space-4);
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: var(--text-small);
  font-weight: 600;
  line-height: var(--leading-snug);
  color: var(--color-text);
}

/* 単一行は 2.5rem 前後に抑え、タップしやすい余白で 44px 未満に見えすぎないよう調整 */
.form-group input:not([type='checkbox']):not([type='radio']):not([type='file']),
.form-group select {
  width: 100%;
  padding: 10px var(--space-3);
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: var(--text-body);
  line-height: var(--leading-snug);
  min-height: 2.5rem;
}

.form-group textarea {
  width: 100%;
  padding: 10px var(--space-3);
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: var(--text-body);
  line-height: var(--leading-snug);
  min-height: 6rem;
}
