/* ============================================================
   Gold Parts (templates) - 共通CSS
   
   このファイルは以下のテンプレートで使用されます:
   - template-parts/gold-prices-ingot.php(インゴット相場)
   - template-parts/gold-prices-purity.php(純度別相場)
   - template-parts/gold-chart.php(チャート)
   - template-parts/gold-calc.php(計算ツール)
   
   functions.php で「これらのテンプレートが呼ばれるページ」だけ
   自動的に読み込まれるよう制御されています。
============================================================ */

/* ============================================================
   (4) 本日の参考買取価格表 — リニューアル版
============================================================ */
/* 共通の見出し帯 - 削除済み(.heading に統一) */
/* 価格表用の見出し補正 */
.gold-prices .heading,
.gold-prices .heading--two-lines {
  margin-top: 0;
  margin-bottom: 16px;
}
.gold-prices .heading + .gold-prices__updated {
  margin-top: -8px;
}
/* heading--two-lines: 上に大きい見出し + 下に小さい補足 */
.heading--two-lines span {
  line-height: 1.45;
}
.heading--two-lines span small {
  display: block;
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-top: 6px;
}

/* セクション間の余白 */
.gold-prices > .heading:not(:first-of-type) {
  margin-top: 36px;
}

/* 更新日時 */
.gold-prices__updated {
  text-align: center;
  font-size: 13px;
  color: var(--ink-2, #2a3450);
  background: #fff;
  padding: 14px 0;
  letter-spacing: 0.04em;
  margin: 0;
}

/* ============ ブロックA: インゴット 4種カード ============ */
.gold-prices__ingots {
  background: #fff;
}
.gold-prices__grid-ingot {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.ingot-card {
  border: 1px solid #8e8e8e;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: center;
}
.ingot-card__head {
  text-align: center;
  padding: 12px 8px 14px;
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 16px;
  color: #fff;
  line-height: 1.35;
}
.ingot-card__head .en {
  display: block;
  font-family: 'Cormorant Garamond', var(--sans);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.16em;
  margin-top: 2px;
  margin-left: 0;
  opacity: 0.9;
}
/* パラジウム個別調整は不要(改行で問題解決) */
.ingot-card__body {
  padding: 22px 12px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.ingot-card__price {
  font-family: 'Cormorant Garamond', var(--sans);
  font-size: 30px;
  font-weight: 700;
  color: var(--navy-800, #14213d);
  letter-spacing: 0.02em;
  line-height: 1.1;
  display: inline-flex;
  align-items: baseline;
}
.ingot-card__price .yen {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  margin-left: 2px;
}
.ingot-card__change {
  font-size: 12.5px;
  color: var(--ink-2, #2a3450);
  letter-spacing: 0.03em;
}
.ingot-card__change [data-change] {
  font-weight: 700;
  font-family: 'Cormorant Garamond', var(--sans);
  font-size: 13.5px;
}
.ingot-card__change [data-change].is-up { color: #c0392b; }
.ingot-card__change [data-change].is-up::before { content: '+'; font-size: 13px; margin-right: 1px; }
.ingot-card__change [data-change].is-down { color: #2566a8; }
.ingot-card__change [data-change].is-down::before { content: '-'; font-size: 13px; margin-right: 1px; }
.ingot-card__change [data-change].is-zero { color: var(--ink-2, #2a3450); }

/* 金属別カード装飾 */
.ingot-card--gold .ingot-card__head { background: #c9a961; color: #fff; }
.ingot-card--platinum .ingot-card__head { background: #5f9b9d; color: #fff; }
.ingot-card--silver .ingot-card__head { background: #8a8a8a; color: #fff; }
.ingot-card--palladium .ingot-card__head { background: #2d5f4e; color: #fff; }

/* 注釈 */
.gold-prices__note {
  font-size: 11.5px;
  color: var(--ink-2, #2a3450);
  line-height: 1.7;
  margin: 14px 0 0;
  padding: 0 4px;
}
.gold-prices__note p { margin: 2px 0; }

/* ============ ブロックB: 純度別 ============ */
.gold-prices__purity {
  background: #fff;
}
/* 純度別の本体:初期は最初の方が見えていて、下端がフェードアウト */
.gold-prices__purity-body {
  position: relative;
  overflow: hidden;
  max-height: 220px; /* 初期表示の高さ(金ブロックの最初の1行+見出しが見える程度) */
  transition: max-height 0.6s ease;
}
.gold-prices__purity-body.is-open {
  max-height: 4000px; /* 全部見えるよう十分な高さ */
}
/* フェードアウトのオーバーレイ(下端を白くフェード) */
.gold-prices__purity-body::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 120px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,1) 100%);
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.gold-prices__purity-body.is-open::after {
  opacity: 0;
}
.gold-prices__metal-block {
  padding: 0;
  margin-bottom: 16px;
  border: 1px solid #d9e2e4;
  border-radius: 6px;
  overflow: hidden;
}
.gold-prices__metal-block:last-of-type { margin-bottom: 0; }
.gold-prices__metal-title {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-800, #14213d);
  letter-spacing: 0.05em;
  margin: 0;
  padding: 14px 18px;
  background: #f5e9d3; /* デフォルト(金) - 見出しは少し濃いめ */
  border-bottom: 1px solid rgba(201, 169, 97, 0.3);
}

/* 純度の格子(3列) */
.purity-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 18px;
}
.purity-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: center;
  background: #fff;
  border-radius: 6px;
  padding: 6px 6px;
  box-shadow: 0 1px 3px rgba(20, 33, 61, 0.05);
  gap: 18px;
  border: 1px solid #ecdfc7;
}
.purity-row__label {
  background: #f3ead0; /* デフォルト(金) */
  color: var(--navy-800, #14213d);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  padding: 10px 4px;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  min-height: 36px;
}
.purity-row__price {
  background: transparent;
  font-family: 'Cormorant Garamond', var(--sans);
  font-weight: 700;
  font-size: 21px;
  color: var(--navy-800, #14213d);
  text-align: left;
  padding: 0;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.purity-row__price .yen {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
}

/* 金種別の色分け */
/* === 金(ゴールド)=== */
.gold-prices__metal-block[data-metal-group="gold"] {
  border-color: #ead8a8;
}
.gold-prices__metal-block[data-metal-group="gold"] .gold-prices__metal-title {
  background: #fbf5ee;
  border-bottom-color: rgba(201, 169, 97, 0.3);
}
.gold-prices__metal-block[data-metal-group="gold"] .purity-row__label {
  background: #fbf5ee;
  color: #5a4818;
}

/* === プラチナ === */
.gold-prices__metal-block[data-metal-group="platinum"] {
  border-color: #c5dcdd;
}
.gold-prices__metal-block[data-metal-group="platinum"] .gold-prices__metal-title {
  background: #edf2f3;
  border-bottom-color: rgba(95, 155, 157, 0.3);
}
.gold-prices__metal-block[data-metal-group="platinum"] .purity-row__label {
  background: #edf2f3;
  color: #224748;
}
.gold-prices__metal-block[data-metal-group="platinum"] li {
  border-color: #c5dcdd;
}

/* === 銀(シルバー)=== */
.gold-prices__metal-block[data-metal-group="silver"] {
  border-color: #d6d6d6;
}
.gold-prices__metal-block[data-metal-group="silver"] .gold-prices__metal-title {
  background: #e8e8e8;
  border-bottom-color: rgba(138, 138, 138, 0.3);
}
.gold-prices__metal-block[data-metal-group="silver"] .purity-row__label {
  background: #e7e7e7;
  color: #2e2e2e;
}
.gold-prices__metal-block[data-metal-group="silver"] li {
  border: 1px solid #cccccc;
}

/* === コンビ(金×プラチナ): ローズゴールド調 === */
.gold-prices__metal-block[data-metal-group="combi"] {
  border-color: #e5d4d0;
}
.gold-prices__metal-block[data-metal-group="combi"] .gold-prices__metal-title {
  background: #f5ece9;
  border-bottom-color: rgba(184, 138, 122, 0.3);
}
.gold-prices__metal-block[data-metal-group="combi"] .purity-row__label {
  background: #ebd9d3;
  color: #6b3a2c;
}
.gold-prices__metal-block[data-metal-group="combi"] li {
  border: 1px solid #d8c2bc;
}

/* ============ 開閉ボタン(FAQカード風) ============ */
.gold-prices__toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 300px;
  max-width: 100%;
  margin: 24px auto 0;
  padding: 16px 22px;
  background: #fff;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--navy-800, #14213d);
  letter-spacing: 0.04em;
  cursor: pointer;
  border: 2px solid #333333;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.gold-prices__toggle:hover {
  background: #fffdf8;
}
.gold-prices__toggle.is-open {
}

/* 左側のラベル(中央寄せのテキスト) */
.gold-prices__toggle__open,
.gold-prices__toggle__close {
  flex: 1;
  text-align: center;
}
.gold-prices__toggle__close { display: none; }
.gold-prices__toggle.is-open .gold-prices__toggle__open { display: none; }
.gold-prices__toggle.is-open .gold-prices__toggle__close { display: block; }

/* 右側のシェブロン(下向きの矢印) */
.gold-prices__toggle__icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--gold-600, #b08f4a);
  transition: transform 0.35s cubic-bezier(.68, -.4, .27, 1.4);
}
.gold-prices__toggle__icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}
.gold-prices__toggle.is-open .gold-prices__toggle__icon {
  transform: rotate(180deg);
  color: var(--gold-700, #9a7e3f);
}


/* ============================================================
   (5) チャートセクション ★メイン機能
============================================================ */
.gold-chart-section__sub {
  text-align: center;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
  margin: 0 0 22px;
}

/* チャート本体のラッパー */
.gold-chart {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 12px 12px;
  margin-bottom: 22px;
}
.gold-chart__container {
  position: relative;
  width: 100%;
  height: 480px;
}

/* チャート左上のツールチップ */
.gold-chart__tooltip {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(15, 26, 48, 0.08);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
.gold-chart__tooltip.is-active { opacity: 1; }
.gold-chart__tooltip-date {
  font-family: var(--display);
  font-style: italic;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--navy-800);
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}
.gold-chart__tooltip-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gold-chart__tooltip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--sans);
  font-size: 12px;
}
.gold-chart__tooltip-item-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
}
.gold-chart__tooltip-item-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gold-chart__tooltip-item-price {
  font-family: var(--display);
  font-weight: 700;
  color: var(--navy-800);
}


/* 品位選択 */
.gold-chart-controls {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  margin-bottom: 18px;
}
.gold-chart-controls__h {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-800);
  letter-spacing: 0.08em;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}
.gold-chart-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.gold-chart-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
  padding: 4px 0;
  transition: color .15s;
}
.gold-chart-checkbox:hover { color: var(--navy-800); }
.gold-chart-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.gold-chart-checkbox__box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  background: #fff;
  position: relative;
  flex-shrink: 0;
  transition: all .15s;
}
.gold-chart-checkbox__box::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .1s;
}
.gold-chart-checkbox input:checked ~ .gold-chart-checkbox__box {
  background: var(--metal-color, var(--gold-500));
  border-color: var(--metal-color, var(--gold-500));
}
.gold-chart-checkbox input:checked ~ .gold-chart-checkbox__box::after {
  transform: rotate(45deg) scale(1);
}
.gold-chart-checkbox__label {
  font-weight: 500;
}
.gold-chart-checkbox input:checked ~ .gold-chart-checkbox__label {
  color: var(--metal-color, var(--navy-800));
  font-weight: 700;
}


/* 期間選択 */
.gold-chart-period {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
}
.gold-chart-period__h {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-800);
  letter-spacing: 0.08em;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}
.gold-chart-period__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gold-chart-period__btn {
  border: 1px solid var(--border);
  background: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all .15s;
}
.gold-chart-period__btn:hover {
  border-color: var(--gold-500);
  color: var(--gold-700);
}
.gold-chart-period__btn.is-active {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #fff;
}



/* =========================================================
   (4-2) 参考買取価格相場 計算ツール
   ========================================================= */
.gold-calc {
  margin-top: 64px;
}
.gold-calc__panel {
  background: #f6f4ee;
  border-radius: 12px;
  padding: 28px 24px;
}
.gold-calc__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  max-width: 880px;
  margin: 0 auto;
}
.gold-calc__cell {
  display: flex;
  flex-direction: column;
}

/* ===== ラベル(品位 / 重さ / 参考買取価格相場) ===== */
.gold-calc__label {
  background: var(--navy-800, #14213d);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 8px 12px;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

/* ===== フィールド本体(白背景) ===== */
.gold-calc__field {
  background: #ffffff;
  border: 1px solid #d6d2c5;
  border-top: none;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  position: relative;
}
.gold-calc__field--with-suffix {
}
.gold-calc__field--result {
  background: #ffffff;
}

/* ===== セレクト・インプット共通 ===== */
.gold-calc__select,
.gold-calc__input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--navy-800, #14213d);
  letter-spacing: 0.02em;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
.gold-calc__select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314213d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 16px 16px;
  font-size: 16px;
  padding-right: 30px;
  text-align: center;
  font-weight: 700;
}
.gold-calc__input {
  text-align: right;
  font-weight: 600;
  font-size: 18px;
  padding-right: 15px;
}
.gold-calc__input::-webkit-outer-spin-button,
.gold-calc__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.gold-calc__input[type=number] {
  -moz-appearance: textfield;
}

/* ===== 単位(g, 円) ===== */
.gold-calc__suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #333333;
  font-family: var(--sans);
  font-weight: 600;
}
.gold-calc__suffix--result {
  font-size: 16px;
  color: var(--navy-800, #14213d);
  font-weight: 600;
  
}

/* ===== 結果の数字 ===== */
.gold-calc__result {
  width: 100%;
  text-align: right;
  font-family: var(--sans);
  font-size: 19px;
  font-weight: 700;
  color: var(--navy-800, #14213d);
  letter-spacing: 0.02em;
  padding-right: 20px;
}

/* ===== 演算子(×, =) ===== */
.gold-calc__op {
  font-size: 22px;
  font-weight: 600;
  color: #7a8094;
  text-align: center;
  padding-top: 28px; /* ラベル高さ分下に下げて中央揃え */
  font-family: var(--sans);
}

/* ===== 注釈 ===== */
.gold-calc__notes {
  margin-top: 16px;
  padding: 0 4px;
}
.gold-calc__notes p {
  margin: 0 0 4px;
  font-size: 12px;
  color: #5a6175;
  line-height: 1.7;
}
select#goldCalcMetal  option {
  text-align: center;
}
/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
  .gold-calc__panel {
    padding: 18px 14px;
  }
  .gold-calc__row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .gold-calc__op {
    padding-top: 0;
    font-size: 18px;
  }
  .gold-calc__field {
    height: 48px;
  }
  .gold-calc__label {
    font-size: 12px;
    padding: 6px 10px;
  }
  .gold-calc__input {
    font-size: 19px;
    text-align: center;
    font-weight: 600;
    padding-right: 0;
}
  .gold-calc__select {
    font-size: 18px;
    text-align: center;
    font-weight: 600;
}
  .gold-calc__result {
    font-size: 19px;
    text-align: center;
    padding-right: 0;
  }
  .gold-calc__notes p {
    font-size: 11px;
  }
}

/* ============================================================
   レスポンシブ — スマホ
============================================================ */
@media (max-width: 768px) {
  .gold-prices > .heading:not(:first-of-type) { margin-top: 28px; }
  .gold-prices__ingots { padding: 0; }
  .gold-prices__grid-ingot { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .ingot-card__head { font-size: 14px; padding: 10px 8px; letter-spacing: 0.02em; }
  .ingot-card__head .en { font-size: 11px; margin-left: 4px; letter-spacing: 0.1em; }
  .ingot-card__body { padding: 16px 8px 14px; gap: 8px; }
  .ingot-card__price { font-size: 22px; }
  .ingot-card__price .yen { font-size: 13px; }
  .ingot-card__change { font-size: 11.5px; }
  .ingot-card__change [data-change] { font-size: 12.5px; }
  .gold-prices__metal-block { padding: 0; margin-bottom: 12px; }
  .gold-prices__metal-title { padding: 12px 14px; font-size: 14.5px; }
  .purity-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 12px; }
  .purity-row { grid-template-columns: 56px 1fr; padding: 8px 10px; gap: 10px; }
  .purity-row__label { font-size: 12px; padding: 6px 2px; min-height: 28px; }
  .purity-row__price { font-size: 16px; padding: 0; }
  .purity-row__price .yen { font-size: 11px; }
  .gold-prices__toggle { width: 280px; padding: 14px 18px; font-size: 13px; margin-top: 18px; }
  .gold-chart { padding: 12px 8px 8px; }
  .gold-chart__container { height: 320px; }
  .gold-chart__tooltip {
    top: 12px;
    left: 12px;
    padding: 10px 12px;
    min-width: auto;
    max-width: calc(100% - 80px);
  }
  .gold-chart__tooltip-date { font-size: 11px; }
  .gold-chart__tooltip-item { font-size: 11px; }
  .gold-chart-period {
    padding: 18px 16px;
  }
  .gold-chart-checkboxes { gap: 6px 10px; }
  .gold-chart-checkbox { font-size: 12px; }
  .gold-chart-period__buttons { gap: 6px; }
  .gold-chart-period__btn {
    padding: 8px 14px;
    font-size: 12px;
    flex: 1 0 calc(33.333% - 4px);
  }
}

