/* ひよこファミリー歯科 共通CSS
   値は docs/DESIGN_SYSTEM.md のものだけを使う。DEV（site/）と WordPress テーマで共有する。 */

:root {
  /* 色 */
  --color-bg: #ffffff;
  --color-text: #222222;
  --color-text-sub: #555555;
  --color-accent: #176b65;
  --color-accent-hover: #0f524d;
  --color-point: #f4c95d;
  --color-line: #d6d6d6;

  /* 余白 */
  --space-xs: 8px;
  --space-s: 16px;
  --space-m: 24px;
  --space-l: 48px;
  --space-xl: 80px;

  /* グリッド */
  --content-max: 1080px;
  --gutter: 20px;
  --column-gap: 24px;
  --text-max: 40em; /* 長い本文の1行の最大幅（40文字分） */

  /* 文字 */
  --font-base: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  --fs-h1: 32px;
  --fs-h2: 24px;
  --fs-h3: 20px;
  --fs-body: 16px;
  --fs-small: 14px;

  /* UI */
  --radius: 8px;
  --border: 1px solid var(--color-line);
  --button-height: 48px;

  /* スマホ下部固定CTAの高さ（ボタン48px＋上下8px＋罫線1px） */
  --fixed-cta-height: calc(var(--button-height) + var(--space-xs) * 2 + 1px);
}

@media (min-width: 768px) {
  :root {
    --gutter: 24px;
    --fs-h1: 40px;
    --fs-h2: 28px;
  }
}

@media (min-width: 1024px) {
  :root {
    --gutter: 32px;
    --fs-h1: 48px;
    --fs-h2: 32px;
  }
}

/* ---------- 基本 ---------- */

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-base);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: 0.02em;
}

h1,
h2,
h3,
p,
ol,
ul,
figure {
  margin: 0;
}

/* 見出しは文節の途中で折り返さない（非対応ブラウザは通常の折り返し） */
h1,
h2,
h3 {
  word-break: auto-phrase;
}

/* <wbr> で折り返し位置を指定した見出し。収まらない幅では文字単位で折り返す */
.heading-phrase {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

h1 {
  font-size: var(--fs-h1);
  font-weight: 700;
  line-height: 1.4;
}

h2 {
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.5;
}

h3 {
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.5;
}

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

a {
  color: var(--color-accent);
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: calc(var(--content-max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--space-xl);
}

.section--ruled {
  border-top: var(--border);
}

.section__action {
  margin-top: var(--space-l);
}

.text-link {
  font-weight: 700;
}

.text-link:hover {
  color: var(--color-accent-hover);
}

/* 接続先が未確定のため操作できない導線（DEV） */
.text-link.is-disabled {
  color: var(--color-text-sub);
  font-weight: 400;
}

.bullet-list {
  margin-top: var(--space-s);
  padding-left: 1.5em;
}

/* 項目の一覧（診療案内・通院環境）。カードにせず罫線で区切る */
.plain-list {
  margin-top: var(--space-l);
  padding: 0;
  list-style: none;
  border-top: var(--border);
}

.plain-list li {
  padding-block: var(--space-s);
  border-bottom: var(--border);
}

.plain-list__name {
  display: block;
}

.plain-list--names .plain-list__name {
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.5;
}

.plain-list__desc {
  margin-top: var(--space-xs);
}

/* 補足の長さが項目ごとに違う一覧（通院環境）は1列で読ませる */
.plain-list--detail {
  max-width: var(--text-max);
}

.plain-list--detail .plain-list__name {
  font-weight: 700;
}

@media (min-width: 1024px) {
  .plain-list--names {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: var(--column-gap);
    border-top: 0;
  }

  /* 2列の1行目にだけ上罫線を付ける */
  .plain-list--names li:nth-child(-n + 2) {
    border-top: var(--border);
  }
}

.small {
  font-size: var(--fs-small);
  line-height: 1.6;
}

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

.skip-link {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  z-index: 100;
  padding: var(--space-xs) var(--space-s);
  background: var(--color-bg);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--button-height);
  padding: var(--space-xs) var(--space-m);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  font-size: var(--fs-body);
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

/* スマホでは本文中のボタンを全幅にそろえる */
@media (max-width: 767px) {
  main .button {
    width: 100%;
  }
}

.button--primary {
  background: var(--color-accent);
  color: #ffffff;
}

.button--primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.button--secondary {
  background: var(--color-bg);
  color: var(--color-accent);
}

.button--secondary:hover {
  text-decoration: underline;
}

/* ---------- DEV表示（本番には出さない） ---------- */

.dev-banner {
  padding: var(--space-xs) var(--gutter);
  border-bottom: var(--border);
  color: var(--color-text-sub);
  font-size: var(--fs-small);
  line-height: 1.6;
}

.dev-note {
  margin-top: var(--space-xs);
  color: var(--color-text-sub);
  font-size: var(--fs-small);
  line-height: 1.6;
}

.prov-heading {
  font-weight: 700;
}

/* 制作見本（デモ）サイトであることの注記。医院の本番では使わない（公開前チェックが「デモサイト」「デモのため」を検出） */
.demo-note {
  margin-top: var(--space-xs);
  color: var(--color-text-sub);
  font-size: var(--fs-small);
  line-height: 1.6;
}

/* DEV：制作見本データの読み込み失敗の案内（site/dev/apply-provisional.js が表示） */
.data-error .button {
  margin-top: var(--space-s);
}

/* 架空料金・デモ画面などの注意書き（常に表示） */
.notice {
  margin-top: var(--space-s);
  padding: var(--space-s) var(--space-m);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  font-weight: 700;
}

/* ---------- ヘッダー ---------- */

.site-header {
  border-bottom: var(--border);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-m);
  padding-block: var(--space-xs);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-text);
  font-size: var(--fs-body);
  font-weight: 700;
  text-decoration: none;
}

.logo__mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.nav-toggle {
  display: none;
  min-height: var(--button-height);
  padding: var(--space-xs) var(--space-s);
  border: var(--border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: var(--fs-small);
  cursor: pointer;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-m);
  padding: 0;
  list-style: none;
}

.site-nav__list a {
  display: inline-flex;
  align-items: center;
  min-height: var(--button-height);
  color: var(--color-text);
  text-decoration: none;
}

.site-nav__list a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

/* 狭い画面（1024px未満）
   基本はボタンを出さず、ナビを縦並びで表示する（JS無効・main.js 読み込み失敗時もリンクを使える）。
   main.js の準備が終わって .nav-ready が付いたときだけ開閉式にする。
   読み込み中（.nav-pending）は閉じた状態と同じ見た目にして、ずれを防ぐ */
@media (max-width: 1023px) {
  .site-nav {
    flex-basis: 100%;
  }

  .nav-pending .nav-toggle,
  .nav-ready .nav-toggle {
    display: inline-flex;
    align-items: center;
  }

  .nav-pending .site-nav,
  .nav-ready .site-nav {
    display: none;
  }

  .nav-ready .site-nav.is-open {
    display: block;
  }

  .site-nav__list {
    flex-direction: column;
    gap: 0;
    padding-bottom: var(--space-xs);
  }

  .site-nav__list li + li {
    border-top: var(--border);
  }

  .site-nav__list a {
    width: 100%;
  }
}

/* ---------- FIRST VIEW ---------- */

.hero {
  padding-block: var(--space-l) var(--space-xl);
}

.hero__lead {
  margin-top: var(--space-s);
}

.hero__action {
  margin-top: var(--space-m);
}

.hero__media {
  margin-top: var(--space-m);
}

/* 最初の画面の画像：元画像と同じ 3:2 で表示し、人物・器具を切らない */
.hero__image {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  border-radius: var(--radius);
}

.image-frame {
  aspect-ratio: 4 / 3;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-frame--pending {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-s);
  border: 1px dashed var(--color-line);
  color: var(--color-text-sub);
  font-size: var(--fs-small);
  line-height: 1.6;
  text-align: center;
}

.image-caption {
  margin-top: var(--space-xs);
  color: var(--color-text-sub);
  font-size: var(--fs-small);
  line-height: 1.6;
}

@media (min-width: 1024px) {
  .hero__inner {
    display: grid;
    grid-template-columns: 6fr 5fr;
    gap: var(--column-gap);
    align-items: center;
  }

  .hero__media {
    margin-top: 0;
  }
}

/* ---------- 3つの取り組み ---------- */

.steps__list {
  position: relative;
  margin-top: var(--space-l);
  padding: 0;
  list-style: none;
}

.steps__item {
  position: relative;
  padding-left: var(--space-l);
}

.steps__item + .steps__item {
  margin-top: var(--space-l);
}

/* 黄色の目印 */
.steps__item::before {
  content: "";
  position: absolute;
  top: calc((var(--fs-h3) * 1.5 - var(--space-s)) / 2);
  left: 0;
  width: var(--space-s);
  height: var(--space-s);
  border-radius: 50%;
  background: var(--color-point);
}

/* 目印どうしをつなぐ細い線（最後の項目の下には伸ばさない） */
.steps__item:not(:last-child)::after {
  content: "";
  position: absolute;
  top: calc((var(--fs-h3) * 1.5 + var(--space-s)) / 2 + var(--space-xs));
  bottom: calc((var(--space-l) + (var(--fs-h3) * 1.5 - var(--space-s)) / 2 - var(--space-xs)) * -1);
  left: calc(var(--space-s) / 2 - 0.5px);
  border-left: var(--border);
}

.steps__action {
  margin-top: var(--space-l);
}

.steps__action .button {
  margin-top: var(--space-s);
}

@media (min-width: 1024px) {
  .steps__inner {
    display: grid;
    grid-template-columns: 5fr 6fr;
    gap: var(--column-gap);
  }

  .steps__list {
    margin-top: 0;
  }
}

/* ---------- 初診の流れ（番号付き4段階） ---------- */

.flow {
  margin-top: var(--space-l);
  padding: 0;
  list-style: none;
}

.flow__item {
  display: flex;
  align-items: baseline;
  gap: var(--space-s);
  padding-block: var(--space-s);
  border-top: var(--border);
}

.flow__item:last-child {
  border-bottom: var(--border);
}

.flow__num {
  color: var(--color-accent);
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.5;
}

.flow__label {
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.5;
}

@media (min-width: 1024px) {
  .flow {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--column-gap);
  }

  .flow__item {
    flex-direction: column;
    gap: var(--space-xs);
    padding-block: var(--space-s) 0;
  }

  .flow__item:last-child {
    border-bottom: 0;
  }
}

/* ---------- FAQ（DEVの確認待ち表示） ---------- */

.image-frame--note {
  aspect-ratio: auto;
  margin-top: var(--space-l);
  padding: var(--space-m);
  justify-content: flex-start;
  text-align: left;
}

/* ---------- 料金（DEVの架空料金） ---------- */

.price-block {
  margin-top: var(--space-l);
}

.table-scroll {
  max-width: var(--text-max);
  margin-top: var(--space-s);
  overflow-x: auto;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  border-top: var(--border);
}

.price-table th,
.price-table td {
  padding: var(--space-s) var(--space-xs);
  border-bottom: var(--border);
  text-align: left;
  vertical-align: top;
}

.price-table thead th {
  color: var(--color-text-sub);
  font-size: var(--fs-small);
  font-weight: 400;
  line-height: 1.6;
}

.price-table__price {
  font-weight: 700;
  white-space: nowrap;
}

/* スマホでは表を行ごとの縦積みにする（項目・料金を1行目、説明を2行目） */
@media (max-width: 767px) {
  .price-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .price-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: var(--space-s);
    padding-block: var(--space-s);
    border-bottom: var(--border);
  }

  .price-table th,
  .price-table td {
    padding: 0;
    border-bottom: 0;
  }

  .price-table__note {
    grid-column: 1 / -1;
    margin-top: var(--space-xs);
  }
}

.price-note {
  margin-top: var(--space-xs);
  color: var(--color-text-sub);
}

/* ---------- FAQ ---------- */

.faq-list {
  margin: var(--space-l) 0 0;
  border-top: var(--border);
}

.faq-list > div {
  padding-block: var(--space-m);
  border-bottom: var(--border);
}

.faq-list dt {
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.5;
}

.faq-list dd {
  margin: var(--space-xs) 0 0;
}

/* ---------- 医院情報・アクセス／項目と値の一覧 ---------- */

.info-list {
  margin: var(--space-l) 0 0;
  border-top: var(--border);
}

.pair-list {
  margin: var(--space-xs) 0 0;
  border-top: var(--border);
}

.info-list > div,
.pair-list > div {
  display: grid;
  grid-template-columns: 6em 1fr;
  gap: var(--space-s);
  padding-block: var(--space-s);
  border-bottom: var(--border);
}

.pair-list > div {
  grid-template-columns: 7em 1fr;
  padding-block: var(--space-xs);
}

.info-list dt,
.pair-list dt {
  font-weight: 700;
}

.info-list dd,
.pair-list dd {
  margin: 0;
}

.hours-line {
  display: block;
}

.hours-line + .hours-line {
  margin-top: var(--space-xs);
}

.hours-days {
  display: block;
  font-weight: 700;
}

.hours-range {
  white-space: nowrap;
}

.image-frame--wide {
  aspect-ratio: 16 / 9;
}

.access__map {
  margin-top: var(--space-l);
}

.access-map__image {
  width: 100%;
  height: auto;
  border: var(--border);
  border-radius: var(--radius);
}

.access-map__route {
  margin-top: var(--space-xs);
}

/* ---------- 院長紹介（文章のみ） ---------- */

.director {
  max-width: var(--text-max);
  margin-top: var(--space-l);
}

.director__name {
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.5;
}

.director__message {
  margin-top: var(--space-s);
}

@media (min-width: 1024px) {
  .access__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--column-gap);
  }

  .access__map {
    margin-top: var(--space-l);
  }
}

/* ---------- 予約・相談 ---------- */

.contact__lead {
  margin-top: var(--space-s);
}

.contact__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-s) var(--space-m);
  margin-top: var(--space-m);
}

@media (max-width: 767px) {
  .contact__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .contact__actions .text-link {
    align-self: flex-start;
  }
}

/* ---------- フッター ---------- */

.site-footer {
  padding-block: var(--space-l);
  border-top: var(--border);
}

.site-footer__inner {
  display: grid;
  gap: var(--space-xs);
}

.site-footer__name {
  font-weight: 700;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-m);
  padding: 0;
  list-style: none;
}

.site-footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--button-height);
}

/* ---------- 本文ページ（プライバシーポリシー） ---------- */

.document__body {
  max-width: var(--text-max);
}

.document__body section {
  margin-top: var(--space-l);
}

.document__body h2 + * {
  margin-top: var(--space-s);
}

/* ---------- スマホ下部固定CTA ---------- */

.fixed-cta {
  display: none;
}

@media (max-width: 767px) {
  body.has-fixed-cta {
    padding-bottom: calc(var(--fixed-cta-height) + env(safe-area-inset-bottom, 0px));
  }

  /* キーボード操作などでフォーカス先へスクロールするとき、固定CTAの裏に隠れないよう下側に余白を取る */
  html:has(body.has-fixed-cta) {
    scroll-padding-bottom: calc(var(--fixed-cta-height) + env(safe-area-inset-bottom, 0px) + var(--space-xs));
  }

  .fixed-cta {
    display: block;
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    padding: var(--space-xs) var(--gutter) calc(var(--space-xs) + env(safe-area-inset-bottom, 0px));
    border-top: var(--border);
    background: var(--color-bg);
  }

  .fixed-cta .button {
    width: 100%;
  }
}

/* ---------- 動きを減らす設定 ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
