@charset "utf-8";

/* 武蔵小金井クリニック インターネット予約（試作）
   スマートフォンを基準に組み、広い画面では余白を足すだけにしている。
   高齢の受診者が多いことを見込んで、本文は16px を下限にし、
   押せるものはすべて高さ44px 以上を確保する。 */

:root {
  --ink:       #1b2422;
  --ink-soft:  #4f5c58;
  --ink-faint: #77837f;
  --ground:    #f4f6f5;
  --surface:   #ffffff;
  --rule:      #d7ded9;
  --rule-soft: #e8ecea;

  --brand:     #1f6f6a;
  --brand-dk:  #175a56;
  --brand-bg:  #e8f2f0;

  --ok:        #1a7a4f;
  --few:       #9a6510;
  --bad:       #a33a2a;
  --bad-bg:    #fbeeec;

  --sun:       #b3453a;
  --sat:       #2f5f96;

  --radius: 6px;
  --gap: 1rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.75;
}

.wrap { max-width: 40rem; margin: 0 auto; padding: 0 1rem; }

h2 { font-size: 1.15rem; line-height: 1.5; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1.4rem 0 .5rem; }
p  { margin: 0 0 .8rem; }

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

/* ---------------- ヘッダー・フッター ---------------- */

header.site {
  background: var(--brand);
  color: #fff;
  padding: .9rem 0 1rem;
}
header.site .clinic { margin: 0; font-size: .8rem; opacity: .9; }
header.site .clinic span { font-size: .72rem; }
header.site h1 { margin: .1rem 0 0; font-size: 1.3rem; letter-spacing: .02em; }

footer.site {
  margin-top: 2.5rem;
  padding: 1.4rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  background: var(--surface);
  font-size: .85rem;
  color: var(--ink-soft);
}
footer.site .tel { margin: 0 0 .5rem; }
footer.site .tel b { display: block; font-size: 1.35rem; color: var(--brand-dk); letter-spacing: .02em; }
footer.site .note { margin: 0 0 .6rem; }
footer.site .dev {
  margin: 0; padding: .5rem .7rem;
  background: var(--ground); border-left: 3px solid var(--few);
  font-size: .8rem;
}

/* ---------------- 進み具合 ---------------- */

.steps { background: var(--surface); border-bottom: 1px solid var(--rule); }
.steps ol {
  display: flex; gap: .25rem;
  margin: 0; padding: .6rem 1rem; list-style: none;
}
.steps li {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  font-size: .68rem; color: var(--ink-faint); text-align: center;
}
.steps .n {
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--rule-soft); color: var(--ink-faint);
  font-size: .78rem; font-weight: bold;
}
.steps .now { color: var(--brand-dk); font-weight: bold; }
.steps .now .n { background: var(--brand); color: #fff; }
.steps .past .n { background: var(--brand-bg); color: var(--brand-dk); }

@media (max-width: 26rem) { .steps .t { font-size: .62rem; } }

/* ---------------- 面 ---------------- */

main.wrap { padding-top: 1.2rem; }

/* 月を移動すると読み込み直しになるため、カレンダーの位置に戻す（#cal）。
   見出しが画面の上端に貼り付かないよう余白を取る。 */
#cal { scroll-margin-top: 1rem; }

.panel, .chosen {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.1rem 1rem 1.3rem;
  margin-bottom: 1.1rem;
}
.chosen { background: var(--brand-bg); border-color: #bcdad5; }
.chosen h2 { font-size: .95rem; color: var(--brand-dk); }
.chosen dl { display: grid; grid-template-columns: 5.5rem 1fr; gap: .2rem .8rem; margin: 0; font-size: .92rem; }
.chosen dt { color: var(--ink-soft); }
.chosen dd { margin: 0; font-weight: bold; }

.lead { color: var(--ink-soft); }
.sub  { margin-top: -.4rem; color: var(--ink-soft); font-size: .9rem; }
.hint {
  margin: 1rem 0 0; padding: .7rem .8rem;
  background: var(--ground); border-radius: var(--radius);
  font-size: .85rem; color: var(--ink-soft);
}
.empty { color: var(--ink-soft); }
.back { margin: 0 0 .8rem; font-size: .9rem; }

a { color: var(--brand-dk); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, label:focus-within {
  outline: 3px solid var(--brand); outline-offset: 2px;
}

/* ---------------- コース選択 ---------------- */

.courses { display: flex; flex-direction: column; gap: .6rem; }

.course {
  display: grid;
  grid-template-columns: 1.3rem 1fr;
  grid-template-areas: "r name" "r price" ". summary";
  gap: .1rem .6rem;
  padding: .85rem .9rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
}
.course.on { border-color: var(--brand); background: var(--brand-bg); box-shadow: inset 0 0 0 1px var(--brand); }
.course input { grid-area: r; margin: .45rem 0 0; width: 1.15rem; height: 1.15rem; accent-color: var(--brand); }
.course .name { grid-area: name; font-weight: bold; }
.course .price { grid-area: price; color: var(--brand-dk); font-weight: bold; }
.course .price small { font-weight: normal; font-size: .78rem; color: var(--ink-soft); }
.course .summary { grid-area: summary; font-size: .84rem; color: var(--ink-soft); line-height: 1.6; }

/* ---------------- カレンダー ---------------- */

.monthnav {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; margin-bottom: .7rem;
}
.monthnav b { font-size: 1.05rem; }

table.cal {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
table.cal caption {
  caption-side: top; text-align: left;
  font-size: .85rem; color: var(--ink-soft); padding-bottom: .4rem;
}
table.cal th {
  padding: .3rem 0; font-size: .78rem; font-weight: normal;
  color: var(--ink-soft); border-bottom: 1px solid var(--rule);
}
table.cal th.w5 { color: var(--sat); }
table.cal th.w6 { color: var(--sun); }

table.cal td {
  border: 1px solid var(--rule-soft);
  padding: 0;
  height: 3.1rem;
  text-align: center;
  vertical-align: middle;
}
table.cal td.blank { border-color: transparent; background: transparent; }

table.cal .d { display: block; font-size: .72rem; color: var(--ink-faint); line-height: 1.3; }
table.cal .m { display: block; font-size: 1.05rem; line-height: 1.2; }
table.cal td.w5 .d { color: var(--sat); }
table.cal td.w6 .d { color: var(--sun); }

table.cal .m.ok  { color: var(--ok); }
table.cal .m.few { color: var(--few); }
table.cal .m.dim { color: #b3bbb8; }

table.cal td.open { padding: 0; }
table.cal td.open a {
  display: flex; flex-direction: column; justify-content: center;
  height: 100%; padding: .25rem 0;
  text-decoration: none; color: inherit;
  background: var(--brand-bg);
}
table.cal td.open a:hover { background: #d8e9e6; }

.legend {
  display: flex; flex-wrap: wrap; gap: .3rem .9rem;
  margin: .8rem 0 0; padding: 0; list-style: none;
  font-size: .8rem; color: var(--ink-soft);
}
.legend b { margin-right: .2rem; font-size: .95rem; }
.legend .ok { color: var(--ok); }
.legend .few { color: var(--few); }
.legend .dim { color: #b3bbb8; }

/* ---------------- 時間帯 ---------------- */

.slots { display: flex; flex-direction: column; gap: .55rem; margin: .8rem 0 0; padding: 0; list-style: none; }

.slot {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  align-items: center;
  gap: .6rem;
  min-height: 3.4rem;
  padding: .55rem .9rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}
a.slot:hover { border-color: var(--brand); background: var(--brand-bg); }
.slot.off { background: var(--ground); color: var(--ink-faint); }
.slot .time { font-size: 1.15rem; font-weight: bold; }
.slot .state { font-size: .85rem; }
.slot .state.ok { color: var(--ok); }
.slot .state.few { color: var(--few); }
.slot .state.dim { color: var(--ink-faint); }
.slot .go {
  padding: .3rem .8rem; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: .82rem; white-space: nowrap;
}

/* ---------------- フォーム ---------------- */

.field { margin-bottom: 1.1rem; }
.field label, .field .label { display: block; font-weight: bold; font-size: .92rem; margin-bottom: .25rem; }
.field .req {
  margin-left: .5rem; padding: .05em .45em;
  background: var(--bad); color: #fff;
  font-size: .68rem; font-weight: normal; border-radius: 3px;
  vertical-align: .1em;
}
.field .note { margin: 0 0 .35rem; font-size: .8rem; color: var(--ink-soft); font-weight: normal; }

.field input, .field textarea {
  width: 100%;
  min-height: 2.9rem;
  padding: .5rem .7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* iOS で拡大されないように */
}
.field textarea { min-height: 6rem; line-height: 1.7; resize: vertical; }

.field.bad input, .field.bad textarea { border-color: var(--bad); background: var(--bad-bg); }
.err { margin: .3rem 0 0; color: var(--bad); font-size: .85rem; font-weight: bold; }

.radios { display: flex; gap: .5rem; }
.pill {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 3rem; padding: .4rem .8rem;
  border: 1px solid var(--rule); border-radius: var(--radius);
  font-weight: normal; cursor: pointer;
}
.pill input { width: 1.15rem; height: 1.15rem; accent-color: var(--brand); }
.pill:has(input:checked) { border-color: var(--brand); background: var(--brand-bg); box-shadow: inset 0 0 0 1px var(--brand); }

.alert {
  padding: .8rem .9rem; margin-bottom: 1rem;
  border-left: 4px solid var(--bad); border-radius: var(--radius);
  background: var(--bad-bg); color: var(--bad); font-weight: bold;
}

/* ---------------- ボタン ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: .6rem 1.2rem;
  border: 1px solid var(--brand); border-radius: var(--radius);
  background: var(--surface); color: var(--brand-dk);
  font: inherit; font-size: 1rem; font-weight: bold;
  text-decoration: none; cursor: pointer;
}
.btn.primary { width: 100%; background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dk); }
.btn.ghost { font-size: .9rem; min-height: 2.6rem; padding: .4rem .9rem; }
.btn.ghost.off { color: var(--ink-faint); border-color: var(--rule); cursor: default; }

.actions { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.2rem; }
.actions form { margin: 0; }
.actions .btn { width: 100%; }

/* ---------------- 確認・完了 ---------------- */

dl.review {
  display: grid; grid-template-columns: 6rem 1fr;
  gap: 0; margin: 1rem 0 0;
  border-top: 1px solid var(--rule-soft);
}
dl.review dt, dl.review dd {
  padding: .6rem .2rem; margin: 0;
  border-bottom: 1px solid var(--rule-soft);
}
dl.review dt { color: var(--ink-soft); font-size: .88rem; }
dl.review dd { word-break: break-word; }
dl.review .kana { display: block; font-size: .8rem; color: var(--ink-soft); font-weight: normal; }

.done h2 { color: var(--brand-dk); }
.ticket {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  margin: 1rem 0; padding: 1rem;
  background: var(--brand-bg); border: 1px dashed var(--brand); border-radius: var(--radius);
}
.ticket span { font-size: .8rem; color: var(--ink-soft); }
.ticket b { font-size: 1.5rem; letter-spacing: .04em; color: var(--brand-dk); }

ol.flow { margin: .5rem 0 0; padding-left: 1.3rem; }
ol.flow li { margin-bottom: .4rem; }

/* ---------------- 広い画面 ---------------- */

@media (min-width: 40rem) {
  .wrap { padding: 0 1.5rem; }
  header.site h1 { font-size: 1.5rem; }
  .steps li { font-size: .78rem; }
  table.cal td { height: 3.6rem; }
  .actions { flex-direction: row-reverse; justify-content: flex-start; }
  .actions .btn, .actions form { width: auto; }
  .btn.primary { width: auto; min-width: 14rem; }
  form.panel .btn.primary { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------------- コース別の注意書き ---------------- */

/* インフルエンザのように、料金が年齢で変わるコースがある */
.pricenote { display: block; font-size: .82rem; font-weight: normal; color: var(--ink-soft); line-height: 1.6; }
.course .pn { display: block; font-size: .78rem; font-weight: normal; color: var(--ink-soft); }

.notices {
  background: var(--surface);
  border: 1px solid #e0c896;
  border-left: 4px solid var(--few);
  border-radius: var(--radius);
  padding: 1rem 1rem 1.1rem;
  margin-bottom: 1.1rem;
}
.notices h2 { font-size: .98rem; color: var(--few); }
.notices ul { margin: 0; padding-left: 1.2rem; }
.notices li { margin-bottom: .4rem; font-size: .9rem; line-height: 1.7; }

/* 選択肢が3つ以上あり、日本語のラベルが長い場合は縦に並べる。
   横に詰めると文字が折り返して読みにくくなるため。 */
.radios.stack { flex-direction: column; gap: .45rem; }
.radios.stack .pill { justify-content: flex-start; min-height: 3.1rem; padding: .5rem 1rem; }
