/* ============================================================
   Chords toolbar (v2) — the only toolbar on single chords posts.
   Fully namespaced under .ctb2-*; driven directly by the engine
   scripts via the legacy class names/ids on its elements
   (see chordsworld_display_chord_toolbar_v2 in functions.php).

   Layout — one white card (.chord-controls-wrapper) holds both rows:
   ┌──────────────────────────────────────────────────────────────┐
   │ [ CAPO 3rd fret → TRANSPOSE − 0 + ] [A− 16 A+] [Guitar v] …  │
   │ ─────────────────── divider ──────────────────────────────── │
   │ [ chord-diagram strip (#chords-box, plugin-rendered) ]       │
   └──────────────────────────────────────────────────────────────┘
   The strip's right-edge fade in chord-tranpose.css is WHITE to match
   this card — it no longer tracks the page background.
   ============================================================ */

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

/* The card. Only exists on single posts (this file is enqueued behind
   is_singular('post')), so the guitar CPT keeps its legacy look. The `div.`
   prefix outranks chord.css's legacy .chord-controls-wrapper rule (8px
   radius, stray padding) regardless of stylesheet load order. */
div.chord-controls-wrapper {
    background: #ffffff;
    border: 1px solid #e7e9ec;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    padding: 10px 14px 12px;
    margin: 20px 0;
}

/* Strip sits flush inside the card — Simple CSS gives .chord-song-tabs a
   22px mobile margin-bottom that would double the card's bottom padding. */
.chord-controls-wrapper .chord-song-tabs {
    margin: 0;
}

/* ---------- Strip vertical geometry (deterministic) ----------
   Three separate sources of dead air above/below the diagrams, all fixed
   here so the strip shares the toolbar row's 12px rhythm around the divider:
   1. The strip is a <pre> — GP's default `pre` gives it 20px padding on all
      four sides (and a 20px left misalignment vs the toolbar row).
   2. abcchords nests .chord-diagram > .chord_container > .chord_bg as
      inline-blocks; every level adds baseline/line-height strut space.
      Each wrapper holds exactly one child and everything inside .chord_bg
      is absolutely positioned, so display: block removes it all.
   3. .chord_bg carries 10px vertical margins and the tiles 20px name
      headroom. Replaced by ONE explicit number: .chord-diagram's 26px
      padding-top, matching .chordName's top: -26px exactly, so the name
      lands flush at the tile top. */

.chord-controls-wrapper pre.chords-area-style {
    padding: 0;
}

.chord-controls-wrapper .chords-area-style .chord {
    padding-top: 0;
}

/* Simple CSS's 5px tile margin-bottom is row spacing — only needed when
   the strip is expanded to multiple rows. */
#chords-box.chords-collapsible:not(.chords-expanded) .chords-area-style .chord {
    margin-bottom: 0;
}

.chord-controls-wrapper .chord-diagram {
    padding-top: 26px; /* = .chordName's -26px offset: the name band */
}

.chord-controls-wrapper .chord-diagram .chord_container,
.chord-controls-wrapper .chord-diagram .chord_bg {
    display: block;
}

.chord-controls-wrapper .chord-diagram .chord_bg {
    margin: 0 5px;
}

/* Fade-in placeholder = the real collapsed height: 26px name band + 54px
   diagram box (52px grid + 2 borders). Overrides the plugin's 97px/83px,
   which included the old padding/margins. */
.chord-controls-wrapper .chords-area-style {
    min-height: 80px;
}

.ctb2 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 12px;
    padding: 0 0 12px;
    border-bottom: 1px solid #eef1f4; /* divider between toolbar row and strip */
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    color: #1c1c1e;
    line-height: 1;
    /* No double-tap zoom / text selection on fast repeated taps anywhere in
       the toolbar (same treatment chord.css gives .font-size-plus/-minus). */
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.ctb2 button {
    font-family: inherit;
    border: 0;
    margin: 0;
    padding: 0;
    background: none;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ctb2 button:focus {
    outline: none;
}

.ctb2 button:focus-visible {
    outline: 2px solid #007aff;
    outline-offset: 2px;
}

.ctb2 svg {
    display: block;
    flex: none;
}

/* ---------- Shared: round icon buttons ---------- */

.ctb2 .ctb2-icon-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #3a3f46;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ctb2 .ctb2-icon-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.ctb2 .ctb2-icon-btn:active {
    background: rgba(0, 0, 0, 0.1);
}

.ctb2 .ctb2-icon-btn-accent {
    color: #007aff;
    background: #ffffff;
    border: 1px solid #e0e4e8;
    box-shadow: 0 1px 1.5px rgba(16, 24, 40, 0.06);
}

.ctb2 .ctb2-icon-btn-accent:hover {
    background: #f0f7ff;
    border-color: #b8d8ff;
}

.ctb2 .ctb2-icon-btn-accent:active {
    background: #e3f0ff;
}

/* ---------- Hero unit: Transpose + Capo, married ---------- */

.ctb2-key {
    display: flex;
    align-items: stretch;
    height: 44px; /* same as the other pills */
    background: #f5f7f9;
    border: 1px solid #e7e9ec;
    border-radius: 10px;
    padding: 0 6px;
    cursor: default;
}

.ctb2-key-seg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0 14px;
}

/* Compact steppers inside the key unit (the font pill keeps 28px) */
.ctb2 .ctb2-key .ctb2-icon-btn {
    width: 24px;
    height: 24px;
}

.ctb2-microlabel {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #8a8f98;
    white-space: nowrap;
}

.ctb2-stepper {
    display: flex;
    align-items: center;
    gap: 2px;
}

.ctb2-transpose-value {
    min-width: 34px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #1c1c1e;
}

.ctb2-key-connector {
    display: flex;
    align-items: center;
    color: #9aa1a9;
    padding-top: 12px; /* visually centers the chain icon on the values row */
}

.ctb2-capo-value {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Reserve the widest value ("11th Fret") up front: without a fixed box
       the text swaps ("None" ↔ "3rd Fret") resize the capo segment on every
       transpose click and push/pull the rest of the toolbar row (owner
       report 2026-07-04). Centered, matching the segment's centered column. */
    min-width: 90px;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 7px;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.ctb2-capo-value.ctb2-pulse {
    animation: ctb2-capo-pulse 0.7s ease;
}

@keyframes ctb2-capo-pulse {
    0% {
        background: rgba(0, 122, 255, 0.18);
        color: #006ae0;
    }
    100% {
        background: transparent;
        color: #1c1c1e;
    }
}

/* ---------- Plain pills (text size) ---------- */

.ctb2-pill {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 5px;
    background: #ffffff;
    border: 1px solid #e7e9ec;
    border-radius: 10px;
}

.ctb2-font-value {
    min-width: 28px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #1c1c1e;
}

.ctb2-a {
    font-weight: 700;
    line-height: 1;
}

.ctb2-a-small {
    font-size: 11px;
}

.ctb2-a-big {
    font-size: 16px;
}

/* ---------- Instrument dropdown ---------- */

.ctb2-instrument {
    position: relative;
}

.ctb2 .ctb2-instrument-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 12px 0 14px;
    background: #ffffff;
    border: 1px solid #e7e9ec;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ctb2-instrument-toggle:hover {
    border-color: #d2d7dc;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

.ctb2-chevron {
    color: #8a8f98;
    transition: transform 0.15s ease;
}

.ctb2-instrument.ctb2-open .ctb2-chevron {
    transform: rotate(180deg);
}

.ctb2-instrument-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 100%;
    padding: 4px;
    background: #ffffff;
    border: 1px solid #e7e9ec;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.14);
    display: none;
    z-index: 60;
}

.ctb2-instrument.ctb2-open .ctb2-instrument-menu {
    display: block;
}

.ctb2-instrument-menu button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: #1c1c1e;
    text-align: left;
    white-space: nowrap;
}

.ctb2-instrument-menu button:hover {
    background: #f3f5f7;
}

.ctb2-instrument-menu button .ctb2-check {
    color: #007aff;
    visibility: hidden;
}

.ctb2-instrument-menu button.ctb2-active {
    font-weight: 600;
}

.ctb2-instrument-menu button.ctb2-active .ctb2-check {
    visibility: visible;
}

/* ---------- Voice ---------- */

.ctb2 .ctb2-mic {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e7e9ec;
    border-radius: 10px;
    color: #007aff;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ctb2 .ctb2-mic:hover {
    border-color: #b8d8ff;
    background: #f0f7ff;
}

.ctb2 .ctb2-mic.listening {
    background: #007aff;
    border-color: #007aff;
    color: #ffffff;
    animation: ctb2-mic-pulse 1.6s ease-in-out infinite;
}

@keyframes ctb2-mic-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Match the original toolbar: voice control hidden below 1200px */
@media (max-width: 1200px) {
    .ctb2 .ctb2-mic {
        display: none;
    }
}

/* ---------- Reset ---------- */

.ctb2 .ctb2-reset {
    margin-left: auto;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #8a8f98;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.ctb2-reset:hover {
    color: #1c1c1e;
    background: #f3f5f7;
}

/* ---------- Mobile ---------- */

@media (max-width: 768px) {
    div.chord-controls-wrapper {
        padding: 8px 10px 10px;
    }

    .ctb2 {
        gap: 8px;
        margin: 0 0 10px;
        padding: 0 0 8px;
    }

    .ctb2-key {
        width: 100%;
        justify-content: center;
    }

    .ctb2-key-seg {
        padding: 0 10px;
    }

    .ctb2-transpose-value,
    .ctb2-capo-value {
        font-size: 14px;
    }

    .ctb2 .ctb2-instrument-toggle {
        font-size: 12px;
    }

    .ctb2 .ctb2-reset {
        font-size: 12px;
        padding: 8px 10px;
    }
}
