/*
 * Circle of Fifths (/tools/circle-of-fifths/). Loaded after site.css; uses its tokens only.
 * Mobile first: circle, then the key details; from 1100 px the details sit beside the circle.
 * SVG text keeps var(--text) on light fills in both themes (the layout test measures SVG text against
 * the box behind the SVG, so text never sits on a dark fill).
 */
.cf { display: grid; gap: var(--s-5); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .cf { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: var(--s-6); } }
.cf-stage { padding: var(--s-3) var(--s-2) var(--s-4); text-align: left; }
.cf-stage > :not(.cf-circle) { margin-left: var(--s-2); margin-right: var(--s-2); }
@media (min-width: 640px) { .cf-stage { padding: var(--s-5) var(--s-6); } }
.cf-circle { width: 100%; max-width: 36rem; margin: 0 auto; background: var(--surface); }
.cf-svg { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.cf-legend { margin: var(--s-3) 0 0; }
.cf-pick { margin-top: var(--s-4); }
.cf-pick select { width: 100%; max-width: 24rem; }

/* wedges */
.cf-w { cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; }
.cf-hit { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; transition: fill var(--t-fast); }
.cf-minor .cf-hit { fill: var(--bg); }
.cf-w:hover .cf-hit { fill: var(--surface-2); }
.cf-w.is-near .cf-hit { fill: var(--surface-2); }
.cf-w.is-rel .cf-hit { fill: var(--indigo-soft); }
.cf-w.is-sel .cf-hit { fill: var(--indigo-soft); }
.cf-sel-outline { fill: none; stroke: var(--indigo); stroke-width: 5; stroke-linejoin: round; pointer-events: none; }
.cf-circle.has-focus .cf-sel-outline { stroke: var(--focus); stroke-dasharray: 10 5; stroke-width: 6; }
.cf-name { fill: var(--text); font-family: var(--font-body); font-weight: 650; pointer-events: none; }
.cf-name-major { font-size: 24px; }
.cf-name-minor { font-size: 17px; }
.cf-name.cf-two.cf-name-major { font-size: 19px; }
.cf-name.cf-two.cf-name-minor { font-size: 15px; }
.cf-name.is-current { font-weight: 800; }
.cf-count { fill: var(--muted); font-family: var(--font-num); font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cf-hub { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1.5; }
.cf-hub-name { fill: var(--text); font-family: var(--font-body); font-size: 26px; font-weight: 650; }
.cf-hub-count { fill: var(--text); font-family: var(--font-num); font-size: 20px; font-weight: 650; }

/* details */
.acc { font-family: var(--font-body); font-weight: 600; }
.cf-info { display: grid; gap: var(--s-4); min-width: 0; }
.cf-panel { min-width: 0; }
.cf-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); }
.cf-title { margin: 0; font-size: var(--step-3); overflow-wrap: anywhere; }
.cf-respell { min-height: 44px; padding: 6px 16px; font-size: var(--step--1); box-shadow: 0 3px 0 var(--line-strong); }
.cf-play-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); margin-top: var(--s-3); }
.cf-play { min-width: 13rem; }
.cf-play-note { margin: 0; flex: 1 1 14rem; }
.cf-sig-line { margin: var(--s-3) 0 var(--s-2); }
.cf-sig { list-style: none; padding: 0; margin: 0 0 var(--s-2); display: flex; flex-wrap: wrap; gap: 6px; }
.cf-acc { display: inline-flex; flex-direction: column; align-items: center; min-width: 2.5rem; padding: 2px 6px 4px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); line-height: 1.1; }
.cf-acc-sym { font-size: 1.5rem; font-weight: 700; }
.cf-acc-letter { font-size: var(--step--1); font-weight: 650; color: var(--muted); }
.cf-theory { margin: 0 0 var(--s-3); color: var(--muted); }
.cf-scale { margin: 0 0 var(--s-2); }
.cf-h3 { font-size: var(--step-1); margin: var(--s-4) 0 var(--s-2); }
.cf-same { margin: var(--s-3) 0 0; }

.cf-links { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-2); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .cf-links { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cf-link {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; width: 100%; min-height: 48px; padding: 8px 14px;
  border-radius: var(--r-md); border: 2px solid var(--line-strong); background: var(--surface); color: var(--text); text-align: left; line-height: 1.25;
  transition: background-color var(--t-fast); -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.cf-link:hover { background: var(--surface-2); }
.cf-link-main { font-weight: 700; }
.cf-link-sub { font-size: .8125rem; color: var(--muted); font-weight: 500; }

.cf-indian { border-top: 1px solid var(--line); margin-top: var(--s-4); }
.cf-indian p { margin: 0 0 var(--s-2); max-width: 46em; }

.cf-chords-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); }
.cf-chords-head .cf-h3 { margin: 0; }
.cf-size { margin: 0; }
.cf-table-wrap { overflow-x: auto; }
.cf-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cf-table th, .cf-table td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.cf-table thead th { font-size: var(--step--1); color: var(--muted); font-weight: 650; }
.cf-roman { font-family: var(--font-display); font-weight: 650; font-size: 1.125rem; white-space: nowrap; }
.cf-sym { font-weight: 700; white-space: nowrap; }
.cf-minor { margin-bottom: 0; }

@media (max-width: 420px) {
  .cf-table th, .cf-table td { padding-right: 6px; }
}
@media (forced-colors: active) {
  .cf-hit { stroke: CanvasText; }
  .cf-sel-outline { stroke: Highlight; }
}
