/* カード作成の選択肢を、表のマス目から「羅針盤の盤面」に変える。
   6つの希望を方角として置き、選ぶと針がその方角を向く。
   10項目の進み具合は、盤面の外周の目盛りで表す。
   影は使わない。動きは transition だけで、CSSアニメーションは使わない。 */

.dial-field { margin-top: 4px; }

.dial {
  --r: 120px;              /* 中心から選択肢までの距離。真鍮の輪の内側に収める */
  --size: 420px;
  position: relative;
  width: var(--size);
  height: var(--size);
  max-width: 100%;
  margin: 26px auto 10px;
  background: url(magazine-assets/dial-face.webp) center/contain no-repeat;
}

.dial-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* 針。盤面と同じ大きさの四角ごと回すので、中心まわりに回る */
.dial-arm {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: rotate(var(--deg, 0deg));
  transition: transform .45s cubic-bezier(.22,.61,.36,1);
}

/* 針。先の尖った本物の針にする。北側は赤茶、南側は黄土。 */
.dial-arm::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 11%;
  width: 20px;
  height: 39%;
  margin-left: -10px;
  background: #8b4938;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.dial-arm::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 17%;
  margin-left: -7px;
  background: #c9af78;
  clip-path: polygon(50% 100%, 100% 0, 0 0);
}

.dial[data-chosen="no"] .dial-arm { opacity: .3; }

.dial-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15px;
  height: 15px;
  margin: -7.5px 0 0 -7.5px;
  background: #fbf8f1;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

/* 方角に置いた6つの希望 */
.dial-opt {
  position: absolute;
  left: 50%;
  top: 50%;
  transform:
    translate(-50%, -50%)
    rotate(var(--a))
    translateY(calc(var(--r) * -1))
    rotate(calc(var(--a) * -1));
  display: block;
  min-width: 104px;
  padding: 7px 12px 9px;
  text-align: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}

.dial-opt span {
  font: 19px/1.7 var(--serif);
  letter-spacing: .04em;
  white-space: nowrap;
}

/* ラジオ本体は残す（入力値・解析・キーボード操作のため）。見た目だけ畳む */
.dial-opt input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.dial-opt:hover { border-bottom-color: #8b4938; color: #8b4938; }

.dial-opt:has(input:checked) {
  background: #8b4938;
  border-bottom-color: #8b4938;
  color: #fffaf0;
}

.dial-opt:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 3px; }

.dial-note {
  font-size: 13px;
  line-height: 2.05;
  color: var(--muted);
  text-align: center;
  margin: 2px 0 22px;
}

@media (max-width: 620px) {
  .dial { --r: 96px; --size: 330px; margin-top: 18px; }
  .dial-opt { min-width: 86px; padding: 7px 10px; }
  .dial-opt span { font-size: 16px; }
}

@media (max-width: 360px) {
  .dial { --r: 86px; --size: 296px; }
  .dial-opt span { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .dial-arm, .dial-opt { transition: none; }
}

/* 完成したカード。スマホでは横に長い表をやめ、項目ごとの縦並びにする。
   印刷（@media print）はこの指定が効かないので、A4の表はそのまま。 */
@media screen and (max-width: 620px) {
  /* style.css が #card-preview .intention-card に min-width:570px を掛けていて、
     390pxでは横スクロールしないと「補足・託す相手」まで見えなかった。画面表示だけ外す。 */
  #card-preview .intention-card { min-width: 0; padding: 18px; }
  #card-preview .intention-card table { display: block; width: 100%; table-layout: auto; }
  #card-preview .intention-card tbody { display: block; width: 100%; }
  #card-preview .intention-card thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #card-preview .intention-card tbody tr {
    display: block;
    border-bottom: 1px solid #dbd2bf;
    padding: 12px 0 10px;
  }
  #card-preview .intention-card tbody td {
    display: flex;
    min-width: 0;
    overflow-wrap: anywhere;
    gap: 12px;
    border: 0;
    padding: 2px 0;
    font-size: 13px;
    line-height: 2.05;
  }
  #card-preview .intention-card tbody td::before {
    content: attr(data-label);
    flex: 0 0 7.2em;
    color: #736b5c;
    font-size: 11px;
  }
  #card-preview .intention-card tbody td:nth-child(2) { font-size: 15px; width: auto; }
  #card-preview .intention-card td:first-child { font-weight: 600; }
}

/* 完成画面の、次の一歩。保存と確認のあとに置く。売り込みにはしない。 */
.result-next { font-size: 14px; line-height: 2.05; margin-top: 18px; color: var(--muted); }
.result-next a { border-bottom: 1px solid var(--line); color: var(--ink); }
.result-next a:hover { border-bottom-color: #8b4938; }

/* 見出しへ自動で移したフォーカスに、ブラウザ既定の青い枠が出ていた。
   キーボード操作のときだけ、ページの色で囲む。 */
#maker-title:focus,
#question-title:focus,
#result-title:focus { outline: none; }
#maker-title:focus-visible,
#question-title:focus-visible,
#result-title:focus-visible { outline: none; }
