/* レビュー欄（商品詳細の下・関連商品の上の全幅セクション）と、投稿フォーム。
 *
 * ## 意匠の決めごと（スペックシート）
 *
 *   - カード・影・角丸を使わない。区切りは 1px の罫線だけ
 *   - 数字・ラベル・日付は Source Code Pro（等幅）で桁を揃える
 *   - ★と分布バーだけがアクセントのシアン #4EC3E1
 *   - レビューは #001 の通し番号を持つ（商品名の #01 と同じ採番の記号）
 *
 * サイトの他の面（.astra-section-title の 32x8px の箱・アコーディオンの
 * `1px solid rgba(var(--color-foreground), .15)`・数量ボタンの hover 色）と
 * 同じ材料だけで組んである。新しい色や角丸を足さないこと。
 *
 * ## 色の出どころ
 *
 *   文字      rgb(var(--color-foreground))   = #fff（astra-theme.css の上書き）
 *   淡い文字  rgba(..., .55) / .45           ≒ #8C8C8C 相当
 *   罫線      rgba(..., .15) / .12
 *   アクセント #4EC3E1
 */

/* =========================================================================
 * セクションの枠
 * ====================================================================== */

.astra-reviews {
  padding-block: 7rem 4rem;
  background-color: transparent;
}

.astra-reviews__inner {
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: 12px;
}

/* =========================================================================
 * 集計（平均点・★別の分布）＋「レビューを書く」
 * ====================================================================== */

.astra-reviews__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 32px 48px;
  margin-top: 3.2rem;
  padding-bottom: 3.2rem;
  border-bottom: 1px solid rgba(var(--color-foreground), 0.15);
}

.astra-reviews__summary {
  display: flex;
  align-items: center;
  gap: 56px;
  flex-wrap: wrap;
  /* 余った幅を分布バーに渡す（渡さないと min-width の 300px で止まり、
   * 画面が広いほどバーの右側だけが空いて見える）。伸びる上限は
   * .astra-reviews__bars の max-width で止めている。 */
  flex: 1 1 auto;
}

/* --- 平均点 --- */

.astra-reviews__score {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.astra-reviews__score-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-family: var(--astra-source-code-pro), monospace;
  color: rgb(var(--color-foreground));
}

.astra-reviews__score-num {
  font-size: 56px;
  font-weight: var(--astra-font-weight-light);
  line-height: 1;
  letter-spacing: 0.02em;
}

.astra-reviews__score-of {
  font-size: 15px;
  color: rgba(var(--color-foreground), 0.45);
}

/* 平均点の下の★。数字の左端に揃えたいので、行の高さを詰める。 */
.astra-reviews__score .rating-star {
  --color-rating-star: #4EC3E1;
  --font-size: 1.8;
  --letter-spacing: 0.9;
  line-height: 1;
}

.astra-reviews__total {
  margin: 0;
  font-family: var(--astra-source-code-pro), monospace;
  font-size: 14px;
  letter-spacing: 0.14em;
  color: rgba(var(--color-foreground), 0.5);
}

/* --- ★別の分布バー --- */

.astra-reviews__bars {
  display: grid;
  gap: 8px;
  min-width: 300px;
  flex: 1 1 300px;
  max-width: 460px;
}

.astra-reviews__bar-row {
  display: grid;
  grid-template-columns: 34px 1fr 44px;
  align-items: center;
  gap: 14px;
  font-family: var(--astra-source-code-pro), monospace;
  /* ★ここだけ本文の下限（14px）を適用していない。左右の列が 34px / 44px の
   * 決め打ちで、字を大きくすると「100%」が列からはみ出して棒グラフが折れる。
   * 数字は隣の星の本数と同じことを言っているので、読めなくても情報は落ちない。 */
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(var(--color-foreground), 0.55);
}

.astra-reviews__bar-track {
  display: block;
  height: 2px;
  background-color: rgba(var(--color-foreground), 0.15);
}

.astra-reviews__bar-fill {
  display: block;
  height: 100%;
  background-color: #4ec3e1;
}

.astra-reviews__bar-count {
  text-align: right;
}

/* --- 「レビューを書く」 --- */

.astra-reviews__actions {
  flex: 0 0 auto;
}

.astra-reviews__action {
  display: inline-block;
  padding: 15px 32px;
  border: 1px solid rgba(var(--color-foreground), 0.3);
  color: rgb(var(--color-foreground));
  font-family: var(--astra-source-code-pro), monospace;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.astra-reviews__action:hover {
  border-color: #4ec3e1;
  color: #4ec3e1;
}

/* =========================================================================
 * 一覧
 * ====================================================================== */

.astra-reviews__empty {
  margin: 3.2rem 0 0;
  font-size: 14px;
  line-height: 1.9;
  color: rgba(var(--color-foreground), 0.55);
}

.astra-review {
  padding-block: 2.8rem;
  border-bottom: 1px solid rgba(var(--color-foreground), 0.12);
}

/* SHOW MORE で開くまで隠す行。★隠すのは JS が付けるこのクラスだけ
 * （JS が読み込まれなければ全件が出る）。 */
.astra-review.is-hidden {
  display: none;
}

/* 投稿直後・承認待ちの自分のレビュー。他のお客様には見えていないことを示す。 */
.astra-review.is-pending {
  border-left: 1px solid #4ec3e1;
  padding-left: 18px;
}

/* --- 1件の見出し行（#001 ★★★★★ 2026.08.12 VERIFIED） --- */

.astra-review__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-family: var(--astra-source-code-pro), monospace;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: rgba(var(--color-foreground), 0.5);
}

.astra-review__no {
  color: rgba(var(--color-foreground), 0.35);
}

.astra-review__rating {
  display: inline-flex;
  line-height: 1;
}

.astra-review__rating .rating-star {
  --color-rating-star: #4EC3E1;
  --font-size: 1.4;
  --letter-spacing: 0.7;
}

/* 日付は右端に寄せず、★のすぐ隣に置く（1行の情報として読ませる）。 */
.astra-review__date {
  letter-spacing: 0.06em;
}

.astra-review__badge {
  padding: 3px 8px;
  border: 1px solid rgba(78, 195, 225, 0.5);
  color: #4ec3e1;
  font-size: 12px;
  letter-spacing: 0.14em;
}

.astra-review__pending {
  padding: 3px 8px;
  border: 1px solid rgba(var(--color-foreground), 0.25);
  font-size: 12px;
  letter-spacing: 0.14em;
}

/* --- 本文 --- */

.astra-review__title {
  margin: 1.4rem 0 0;
  font-family: var(--astra-roboto), sans-serif;
  font-size: 16px;
  font-weight: var(--astra-font-weight-medium);
  line-height: 1.6;
  color: rgb(var(--color-foreground));
}

.astra-review__body {
  margin-top: 1rem;
  font-size: 14px;
  line-height: 1.95;
  color: rgba(var(--color-foreground), 0.85);
}

.astra-review__body p {
  margin: 0 0 0.8em;
}

.astra-review__body p:last-child {
  margin-bottom: 0;
}

.astra-review__author {
  margin: 1.4rem 0 0;
  font-family: var(--astra-source-code-pro), monospace;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: rgba(var(--color-foreground), 0.45);
}

/* --- ショップからのコメント --- */

.astra-review__reply {
  margin-top: 1.8rem;
  padding: 16px 18px;
  border-left: 1px solid #4ec3e1;
  background-color: rgba(var(--color-foreground), 0.03);
}

.astra-review__reply-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 8px;
  font-family: var(--astra-source-code-pro), monospace;
  font-size: 14px;
  letter-spacing: 0.12em;
}

.astra-review__reply-label {
  color: #4ec3e1;
}

.astra-review__reply-date {
  color: rgba(var(--color-foreground), 0.45);
}

.astra-review__reply-body {
  font-size: 14px;
  line-height: 1.9;
  color: rgba(var(--color-foreground), 0.75);
}

.astra-review__reply-body p {
  margin: 0 0 0.8em;
}

.astra-review__reply-body p:last-child {
  margin-bottom: 0;
}

/* 3行で畳む。is-clamped を付けるのは JS だけ（付かなければ全文が出る）。 */
.astra-review__reply.is-clamped .astra-review__reply-body {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.astra-review__reply-more {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(var(--color-foreground), 0.6);
  font-family: var(--astra-source-code-pro), monospace;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-decoration: underline;
  cursor: pointer;
}

.astra-review__reply-more:hover {
  color: #4ec3e1;
}

/* --- SHOW MORE --- */

.astra-reviews__more {
  /* input[type=submit] と同じ理由で appearance を殺す（下の送信ボタンの注記を参照）。 */
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
  display: block;
  width: 100%;
  margin-top: 3.2rem;
  padding: 18px;
  border: 1px solid rgba(var(--color-foreground), 0.3);
  background: transparent;
  color: rgb(var(--color-foreground));
  font-family: var(--astra-source-code-pro), monospace;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.astra-reviews__more:hover {
  border-color: #4ec3e1;
  color: #4ec3e1;
}

/* =========================================================================
 * 投稿フォーム
 * ====================================================================== */

.astra-review-form-wrap {
  padding-block: 0 7rem;
}

.astra-review-form-wrap__inner {
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: 12px;
}

/* フォーム本体は読む幅に収める（入力欄が 1440px 幅に伸びると書きにくい）。 */
.astra-review-form,
.astra-review-form__title,
.astra-review-form__status,
.astra-review-form__gate {
  max-width: 640px;
}

.astra-review-form__title {
  display: block;
  margin-bottom: 2.4rem;
  font-family: var(--astra-source-code-pro), monospace;
  font-size: 20px;
  font-weight: var(--astra-font-weight-regular);
  letter-spacing: 0.06em;
  color: rgb(var(--color-foreground));
}

.astra-review-form__gate {
  font-size: 14px;
  line-height: 1.9;
  color: rgba(var(--color-foreground), 0.55);
}

.astra-review-form__row {
  margin: 0 0 2rem;
}

.astra-review-form__row label,
.astra-review-form__label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--astra-source-code-pro), monospace;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(var(--color-foreground), 0.7);
}

.astra-review-form__row .required {
  color: #4ec3e1;
}

.astra-review-form__row input[type='text'],
.astra-review-form__row input[type='email'],
.astra-review-form__row textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(var(--color-foreground), 0.3);
  background-color: rgba(var(--color-foreground), 0.04);
  color: rgb(var(--color-foreground));
  font-family: var(--astra-roboto), sans-serif;
  font-size: 14px;
  line-height: 1.7;
}

.astra-review-form__row input:focus,
.astra-review-form__row textarea:focus {
  outline: none;
  border-color: #4ec3e1;
}

.astra-review-form__note {
  display: block;
  margin-top: 8px;
  font-family: var(--astra-roboto), sans-serif;
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(var(--color-foreground), 0.55);
}

/* --- 星の選択 --- */

/*
 * ★DOM は 5→1 の順に並べ、`row-reverse` で見た目だけ 1→5 に戻す。
 *   こうすると「選んだ星より左（＝DOM 上の後続）」を `~` だけで塗れる。
 *   :has() を使わないのは、そこまでする必要が無いのと、
 *   古い Safari で丸ごと効かなくなるのを避けるため。
 */
.astra-review-form__stars {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 6px;
}

.astra-review-form__stars input[type='radio'] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.astra-review-form__stars label {
  /* 上の `.astra-review-form__row label`（項目名の見出し）を打ち消す。
   * あちらは display:block / margin-bottom / uppercase を持っている。 */
  display: inline-flex;
  margin: 0;
  font-size: 26px;
  line-height: 1;
  color: rgba(var(--color-foreground), 0.2);
  cursor: pointer;
  transition: color 0.15s ease;
}

/* 選んだ星と、その左にある星（DOM 上の後続）を塗る。 */
.astra-review-form__stars input[type='radio']:checked ~ label,
.astra-review-form__stars label:hover,
.astra-review-form__stars label:hover ~ label {
  color: #4ec3e1;
}

/* キーボード操作でどれを選んでいるか分かるようにする。 */
.astra-review-form__stars input[type='radio']:focus-visible + label {
  outline: 1px solid #4ec3e1;
  outline-offset: 3px;
}

/* ハニーポット。人間には見せない（display:none にすると入力を疑うボットがいるので位置で隠す）。 */
.astra-review-form__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- 「ブラウザーに保存する」チェックボックス --- */

/*
 * comment_form() が標準で足す行（`show_comments_cookies_opt_in` が ON のとき）。
 * fields を差し替えても**この行だけは Woo / WP 側が組み立てる**ので、
 * こちらのクラス（.astra-review-form__row）は付かない。素の見た目のまま
 * 残さないよう、標準のクラス名で拾って整える。
 */
.astra-review-form .comment-form-cookies-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 2rem;
  max-width: 640px;
}

.astra-review-form .comment-form-cookies-consent input {
  margin-top: 3px;
  accent-color: #4ec3e1;
}

.astra-review-form .comment-form-cookies-consent label {
  margin: 0;
  font-family: var(--astra-roboto), sans-serif;
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(var(--color-foreground), 0.55);
}

/* --- 送信ボタン --- */

.astra-review-form .form-submit {
  margin: 0;
}

/*
 * ★!important が要る。WooCommerce 本体（woocommerce-general.css）が
 *   `.woocommerce #respond input#submit { padding:.618em 1em; background:#ebe9eb;
 *   color:#515151; font-size:100%; border-radius:3px; }` を当てており、
 *   ID を2つ含む (2,1,1) にクラスだけのセレクタでは勝てない。
 *   厄介なことに font-family と appearance だけはこちらが効くので、
 *   **「Source Code Pro の小さな灰色ボタン」という中途半端な見た目**になり、
 *   当たっていないことに気づきにくい（実際に一度そうなった）。
 *   astra-woo.css の主要 CTA と同じ手当て。
 *   docs/migration-notes.md「WooCommerce の CSS は specificity が高い」も参照。
 *
 * ★appearance も殺す。macOS の Chrome / Safari は input[type=submit] を OS の
 *   プッシュボタンとして描き、background-color も padding も無視することがある。
 */
.astra-review-form input[type='submit'] {
  appearance: none;
  -webkit-appearance: none;
  padding: 16px 44px !important;
  border: 1px solid rgb(var(--color-foreground)) !important;
  border-radius: 0 !important;
  background-color: rgb(var(--color-foreground)) !important;
  color: #000 !important;
  font-family: var(--astra-source-code-pro), monospace;
  font-size: 14px !important;
  font-weight: var(--astra-font-weight-bold);
  line-height: 1.2 !important;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.astra-review-form input[type='submit']:hover:not(:disabled) {
  background-color: transparent !important;
  color: rgb(var(--color-foreground)) !important;
}

.astra-review-form input[type='submit']:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* --- 送信中・エラーの表示 --- */

.astra-review-form__status {
  margin: 1.6rem 0 0;
  font-size: 14px;
  line-height: 1.8;
}

.astra-review-form__status:empty {
  display: none;
}

.astra-review-form__status.is-busy {
  color: rgba(var(--color-foreground), 0.6);
}

.astra-review-form__status.is-error {
  color: #ff7a7a;
}

/* =========================================================================
 * 投稿完了のポップアップ
 * ====================================================================== */

/*
 * ★暗幕はこの要素自身の background で描く。
 *   中身の無い <div> を重ねる作りにすると、base.css の
 *   `div:empty { display: none }` に消される。
 */
.astra-review-done {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: rgba(0, 0, 0, 0.85);
}

/* [hidden] のほうを後に、かつ詳細度を高くして確実に隠す
 * （上の display:flex に負けないようにするため）。 */
.astra-review-done[hidden] {
  display: none;
}

.astra-review-done__dialog {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 40px 32px 32px;
  border: 1px solid rgba(var(--color-foreground), 0.25);
  background-color: #000;
  text-align: center;
}

.astra-review-done__close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: none;
  color: rgba(var(--color-foreground), 0.6);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.astra-review-done__eyebrow {
  margin: 0 0 10px;
  font-family: var(--astra-source-code-pro), monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #4ec3e1;
}

.astra-review-done__title {
  margin: 0 0 16px;
  font-family: var(--astra-roboto), sans-serif;
  font-size: 20px;
  font-weight: var(--astra-font-weight-light);
  line-height: 1.5;
  color: rgb(var(--color-foreground));
}

.astra-review-done__text {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.9;
  color: rgba(var(--color-foreground), 0.75);
}

.astra-review-done__note {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.8;
  color: rgba(var(--color-foreground), 0.5);
}

.astra-review-done__ok {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
  width: 100%;
  padding: 15px;
  border: 1px solid rgb(var(--color-foreground));
  background-color: rgb(var(--color-foreground));
  color: #000;
  font-family: var(--astra-source-code-pro), monospace;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

/* モーダルを開いているあいだは背面をスクロールさせない。 */
html.astra-review-done-open,
html.astra-review-done-open body {
  overflow: hidden;
}

/* =========================================================================
 * レスポンシブ
 * ====================================================================== */

@media screen and (max-width: 989px) {
  .astra-reviews__summary {
    gap: 32px;
    width: 100%;
  }

  .astra-reviews__bars {
    min-width: 0;
  }
}

@media screen and (max-width: 768px) {
  .astra-reviews {
    padding-block: 4rem 2rem;
  }

  .astra-reviews__inner,
  .astra-review-form-wrap__inner {
    padding-inline: 18px;
  }

  .astra-reviews__head {
    align-items: stretch;
    gap: 24px;
  }

  .astra-reviews__summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }

  .astra-reviews__bars {
    width: 100%;
    max-width: none;
    /* ★縦積みになると flex の主軸が縦になり、上で付けた flex-grow が
     *   「余った高さを埋める」意味に変わる（★別の行が間延びする）。ここで戻す。 */
    flex: 0 0 auto;
  }

  .astra-reviews__score-num {
    font-size: 44px;
  }

  /* SP では「レビューを書く」を全幅のボタンにする（親指で押す位置に置く）。 */
  .astra-reviews__actions,
  .astra-reviews__action {
    width: 100%;
    text-align: center;
  }

  .astra-review-form-wrap {
    padding-block: 0 5rem;
  }
}
