|
1 | 1 | /* ========================================================================== |
2 | | - 1. ページヘッダー |
| 2 | + 1. フォームレイアウト |
3 | 3 | ========================================================================== */ |
4 | | -.page-header { |
5 | | - margin-bottom: 2rem; |
6 | | - padding-bottom: 1.5rem; |
7 | | - border-bottom: 1px solid var(--color-border-soft); |
| 4 | +.contact-form { |
| 5 | + max-width: 40rem; /* 640px */ |
| 6 | + margin: 0 auto; |
| 7 | + display: flex; |
| 8 | + flex-direction: column; |
| 9 | + gap: 1.5rem; |
| 10 | +} |
| 11 | + |
| 12 | +.form-field { |
| 13 | + display: flex; |
| 14 | + flex-direction: column; |
| 15 | + gap: 0.5rem; |
8 | 16 | } |
9 | 17 |
|
10 | | -.page-header h1 { |
11 | | - margin: 0 0 0.5rem; |
12 | | - font-size: 2rem; |
| 18 | +/* ========================================================================== |
| 19 | + 2. ラベル・バッジ |
| 20 | + ========================================================================== */ |
| 21 | +.form-label { |
| 22 | + font-weight: 600; |
13 | 23 | color: var(--color-heading); |
| 24 | + display: flex; |
| 25 | + align-items: center; |
| 26 | + gap: 0.5rem; |
| 27 | + font-size: 0.95rem; |
| 28 | +} |
| 29 | + |
| 30 | +.badge-required, |
| 31 | +.badge-optional { |
| 32 | + font-size: 0.75rem; |
| 33 | + padding: 0.15rem 0.5rem; |
| 34 | + border-radius: var(--radius-sm); |
| 35 | + font-weight: normal; |
14 | 36 | line-height: 1.2; |
15 | 37 | } |
16 | 38 |
|
17 | | -.page-header p { |
18 | | - margin: 0 0 0.8rem; |
19 | | - color: var(--color-text-muted); |
20 | | - font-size: 1rem; |
21 | | - line-height: 1.6; |
| 39 | +.badge-required { |
| 40 | + background: rgba(239, 68, 68, 0.15); /* Red-ish */ |
| 41 | + color: #ef4444; |
| 42 | + border: 1px solid rgba(239, 68, 68, 0.2); |
22 | 43 | } |
23 | 44 |
|
24 | | -.page-header a { |
25 | | - color: var(--color-accent); |
26 | | - text-decoration: none; |
27 | | - font-size: 1rem; |
| 45 | +.badge-optional { |
| 46 | + background: var(--color-surface); |
| 47 | + color: var(--color-text-muted); |
| 48 | + border: 1px solid var(--color-border); |
28 | 49 | } |
29 | 50 |
|
30 | 51 | /* ========================================================================== |
31 | | - 2. フォーム本体 |
| 52 | + 3. 入力フィールド |
32 | 53 | ========================================================================== */ |
33 | | -.contact-form { |
34 | | - max-width: 38rem; |
35 | | - margin: 0 auto 2.5rem; |
36 | | - background: var(--color-panel); |
37 | | - border-radius: var(--radius-lg); |
38 | | - padding: 2.5rem; |
| 54 | +.input { |
| 55 | + width: 100%; |
| 56 | + background: var(--color-bg); /* 入力欄は少し暗く */ |
39 | 57 | border: 1px solid var(--color-border); |
40 | | - box-shadow: var(--shadow-lg); |
| 58 | + border-radius: var(--radius-md); |
| 59 | + padding: 0.75rem 1rem; |
| 60 | + font-size: 1rem; |
| 61 | + color: var(--color-text); |
| 62 | + transition: var(--transition-smooth); |
| 63 | + font-family: inherit; |
41 | 64 | } |
42 | 65 |
|
43 | | -.form-field { |
44 | | - margin-bottom: 1.25rem; |
45 | | - display: flex; |
46 | | - flex-direction: column; |
47 | | - gap: 0.5rem; |
| 66 | +.input:focus { |
| 67 | + outline: none; |
| 68 | + border-color: var(--color-accent); |
| 69 | + box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb), 0.2); |
| 70 | + background: var(--color-surface); |
48 | 71 | } |
49 | 72 |
|
50 | | -.form-field label { |
51 | | - font-size: 0.95rem; |
52 | | - color: var(--color-text); |
53 | | - font-weight: 500; |
| 73 | +.input::placeholder { |
| 74 | + color: var(--color-text-muted); |
| 75 | + opacity: 0.6; |
54 | 76 | } |
55 | 77 |
|
56 | | -.form-field input, |
57 | | -.form-field textarea { |
58 | | - padding: 0.8rem 1rem; |
59 | | - border-radius: var(--radius-md); |
60 | | - border: 1px solid var(--color-border); |
61 | | - background: var(--color-surface); |
62 | | - color: var(--color-text); |
63 | | - font-size: 1rem; |
64 | | - transition: var(--transition-smooth); |
| 78 | +.input--textarea { |
| 79 | + resize: vertical; |
| 80 | + min-height: 8rem; |
| 81 | + line-height: 1.6; |
65 | 82 | } |
66 | 83 |
|
67 | | -.form-field textarea { |
68 | | - min-height: 8rem; |
69 | | - resize: vertical; |
| 84 | +/* ========================================================================== |
| 85 | + 4. ボタンエリア |
| 86 | + ========================================================================== */ |
| 87 | +.form-actions { |
| 88 | + margin-top: 1rem; |
| 89 | + display: flex; |
| 90 | + justify-content: center; |
70 | 91 | } |
71 | 92 |
|
72 | | -.form-field input::placeholder, |
73 | | -.form-field textarea::placeholder { |
74 | | - color: var(--color-text-muted); |
75 | | - opacity: 0.7; |
| 93 | +.btn-submit { |
| 94 | + min-width: 12rem; |
| 95 | + padding: 0.9rem 2rem; |
| 96 | + font-size: 1.1rem; |
| 97 | + position: relative; /* ローディングアイコン用 */ |
76 | 98 | } |
77 | 99 |
|
78 | | -.form-field input:focus, |
79 | | -.form-field textarea:focus { |
80 | | - outline: none; |
81 | | - border-color: var(--color-accent); |
82 | | - box-shadow: var(--shadow-glow); |
83 | | - background: var(--color-panel); |
| 100 | +/* ローディング時の状態 */ |
| 101 | +.btn-submit.is-loading { |
| 102 | + color: transparent; /* 文字を隠す */ |
| 103 | + pointer-events: none; |
| 104 | + opacity: 0.8; |
84 | 105 | } |
85 | 106 |
|
86 | | -.form-actions { |
87 | | - margin-top: 2rem; |
88 | | - text-align: right; |
| 107 | +.btn-loading-icon { |
| 108 | + position: absolute; |
| 109 | + top: 50%; |
| 110 | + left: 50%; |
| 111 | + transform: translate(-50%, -50%); |
| 112 | + width: 1.5rem; |
| 113 | + height: 1.5rem; |
| 114 | + border: 2px solid rgba(255, 255, 255, 0.3); |
| 115 | + border-top-color: #fff; |
| 116 | + border-radius: 50%; |
| 117 | + opacity: 0; |
| 118 | + transition: opacity 0.2s; |
89 | 119 | } |
90 | 120 |
|
91 | | -.form-actions button { |
92 | | - display: inline-flex; |
93 | | - align-items: center; |
94 | | - justify-content: center; |
95 | | - gap: 0.5rem; |
96 | | - padding: 0.8rem 1.6rem; |
97 | | - border-radius: var(--radius-md); |
98 | | - font-size: 1.05rem; |
99 | | - font-weight: 600; |
100 | | - border: 1px solid transparent; |
101 | | - cursor: pointer; |
102 | | - text-decoration: none; |
103 | | - background: linear-gradient( |
104 | | - 135deg, |
105 | | - var(--color-accent-dark) 0%, |
106 | | - var(--color-accent) 100% |
107 | | - ); |
108 | | - border-color: var(--color-accent-dark); |
109 | | - color: #fff; |
110 | | - box-shadow: var(--shadow-md); |
111 | | - transition: var(--transition-smooth); |
| 121 | +.btn-submit.is-loading .btn-loading-icon { |
| 122 | + opacity: 1; |
| 123 | + animation: spin 0.8s linear infinite; |
112 | 124 | } |
113 | 125 |
|
114 | | -.form-actions button:hover { |
115 | | - transform: translateY(-2px); |
116 | | - box-shadow: var(--shadow-lg), var(--shadow-glow); |
117 | | - background: linear-gradient( |
118 | | - 135deg, |
119 | | - var(--color-accent) 0%, |
120 | | - var(--color-accent-dark) 100% |
121 | | - ); |
| 126 | +@keyframes spin { |
| 127 | + to { |
| 128 | + transform: translate(-50%, -50%) rotate(360deg); |
| 129 | + } |
122 | 130 | } |
123 | 131 |
|
| 132 | +/* ========================================================================== |
| 133 | + 5. 結果メッセージ |
| 134 | + ========================================================================== */ |
124 | 135 | .contact-result { |
125 | 136 | margin-top: 1.5rem; |
| 137 | + padding: 1rem; |
| 138 | + border-radius: var(--radius-md); |
126 | 139 | font-size: 0.95rem; |
127 | 140 | text-align: center; |
128 | | - padding: 0.8rem 1rem; |
129 | | - border-radius: var(--radius-md); |
| 141 | + display: none; /* 初期非表示 */ |
130 | 142 | } |
131 | 143 |
|
132 | | -.contact-result--ok { |
133 | | - color: #84cc16; |
134 | | - background: rgba(132, 204, 22, 0.15); |
135 | | - border: 1px solid #84cc16; |
| 144 | +.contact-result.success { |
| 145 | + display: block; |
| 146 | + background: rgba(16, 185, 129, 0.1); |
| 147 | + border: 1px solid rgba(16, 185, 129, 0.2); |
| 148 | + color: #10b981; |
136 | 149 | } |
137 | 150 |
|
138 | | -.contact-result--ng { |
| 151 | +.contact-result.error { |
| 152 | + display: block; |
| 153 | + background: rgba(239, 68, 68, 0.1); |
| 154 | + border: 1px solid rgba(239, 68, 68, 0.2); |
139 | 155 | color: #ef4444; |
140 | | - background: rgba(239, 68, 68, 0.15); |
141 | | - border: 1px solid #ef4444; |
| 156 | +} |
| 157 | + |
| 158 | +/* リンクテキスト装飾(メールアドレスリンクなど) */ |
| 159 | +.link-text { |
| 160 | + text-decoration: underline; |
| 161 | + text-underline-offset: 4px; |
| 162 | +} |
| 163 | +.link-text:hover { |
| 164 | + color: var(--color-accent); |
142 | 165 | } |
143 | 166 |
|
144 | 167 | /* ========================================================================== |
145 | | - 3. レスポンシブデザイン |
| 168 | + 6. レスポンシブ |
146 | 169 | ========================================================================== */ |
147 | | -@media (max-width: 768px) { |
| 170 | +@media (max-width: 600px) { |
148 | 171 | .contact-form { |
149 | | - padding: 1.5rem; |
150 | | - } |
151 | | - .form-actions { |
152 | | - text-align: center; |
| 172 | + gap: 1.2rem; |
153 | 173 | } |
154 | | - .form-actions button { |
| 174 | + .btn-submit { |
155 | 175 | width: 100%; |
156 | 176 | } |
157 | 177 | } |
0 commit comments