/* === PAGE HEAD / BAND NAME (replaces per-element inline styles) === */
.page-head-tight {
    margin-bottom: 14px;
}

.page-head-p-narrow {
    max-width: 44ch;
}

.band-name {
    font-family: var(--font-serif);
    font-size: 17px;
}

.band-name-lg {
    font-size: 18px;
}

/* === INTRO / ABOUT TOGGLE === */
.tr-intro {
    margin: 0 0 30px;
    padding-bottom: 26px;
    border-bottom: 1px solid var(--border-soft);
}

.tr-intro > p {
    margin: 0 0 14px;
    font-size: .95rem;
    line-height: 1.7;
    color: var(--text-soft);
    max-width: 74ch;
}

.tr-intro-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.about-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font: 600 13px/1 var(--font-sans);
    color: var(--accent);
}

.about-panel {
    margin-top: 24px;
}

.about-panel-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 36px;
    align-items: start;
}

.about-panel-grid p {
    margin: 0 0 18px;
    font-size: .95rem;
    line-height: 1.75;
    color: var(--text-soft);
}

.about-panel-grid ol {
    margin: 0;
    padding-left: 20px;
}

.about-panel-grid ol li {
    font-size: .875rem;
    line-height: 1.8;
    color: var(--text-soft);
    margin-bottom: 8px;
}

.about-panel-grid figure {
    margin: 0;
}

.about-panel-grid figure img {
    display: block;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.about-panel-grid figcaption {
    margin-top: 10px;
    font: italic 400 14px/1.5 var(--font-serif);
    color: var(--text-faint);
}

/* === KPI CARDS === */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.kpi-card {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 20px 22px;
}

.kpi-label {
    font: 600 10.5px/1 var(--font-sans);
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 14px;
}

.kpi-value {
    font: 400 44px/1 var(--font-serif);
    color: var(--text);
}

.kpi-value-accent {
    color: var(--accent);
}

.kpi-value-error {
    color: var(--text-faint);
}

/* Skeleton shown while the figure is still being fetched, so the card doesn't
   sit on an em dash that looks like a broken value. */
.kpi-value.is-loading,
.tr-preview-value.is-loading {
    color: transparent;
    position: relative;
}

.kpi-value.is-loading::after,
.tr-preview-value.is-loading::after {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    width: 2.6em;
    height: .6em;
    border-radius: 2px;
    background: rgba(33, 29, 22, .1);
    animation: kpi-pulse 1.4s ease-in-out infinite;
}

@keyframes kpi-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .45; }
}

.kpi-sub {
    font: 400 12px/1 var(--font-sans);
    color: var(--text-faint);
    margin-top: 8px;
}

/* === GENERIC TRANSLATIONS CARD === */
.tr-card {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 22px 24px;
    margin-bottom: 22px;
}

.tr-card-flush {
    display: flex;
    flex-direction: column;
}

.tr-card-label {
    font: 600 10.5px/1 var(--font-sans);
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 16px;
}

.tr-row {
    display: grid;
    gap: 22px;
    margin-bottom: 22px;
}

.tr-row .tr-card {
    margin-bottom: 0;
}

.tr-row-1-2 {
    grid-template-columns: 380px 1fr;
}

.tr-row-1-1 {
    grid-template-columns: 1fr 1fr;
}

.spotify-slot {
    flex: 1;
    min-height: 352px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spotify-iframe {
    border: none;
    border-radius: 4px;
}

/* === INFO / TECH POPOVER === */
.tech-popover-wrap {
    position: relative;
}

.info-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: .68rem;
    padding: .2rem .55rem;
    cursor: pointer;
    letter-spacing: .05em;
    line-height: 1;
    border-radius: 2px;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.info-btn:hover,
.info-btn:focus {
    background: var(--accent);
    color: var(--bg);
}

/* Suppress the ring only for mouse focus — keyboard focus keeps the global
   :focus-visible outline. */
.info-btn:focus:not(:focus-visible) {
    outline: none;
}

.tech-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
    width: 280px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px 18px;
    box-shadow: 0 6px 18px rgba(33, 29, 22, .12);
}

.tech-popover p {
    font-size: .8rem;
    line-height: 1.6;
    color: var(--text-soft);
    margin: 0 0 8px;
}

.tech-popover p:last-child {
    margin-bottom: 0;
}

/* === CHART CONTAINERS (lightweight, no external charting library) === */
.chart-container {
    width: 100%;
    height: 220px;
}

.chart-caption {
    font-size: .75rem;
    line-height: 1.5;
    color: var(--text-faint);
    margin: 12px 0 0;
}

.chart-empty {
    font: 400 13px var(--font-sans);
    color: var(--text-faint);
}

.chart-error {
    font: 400 13px/1.5 var(--font-sans);
    color: var(--accent);
    margin: 0;
}

/* === TOOLTIP ===
   Replaces the native SVG <title>, which had a long hover delay, couldn't be
   styled, and never appeared on touch devices. */
.chart-tooltip {
    position: fixed;
    z-index: 60;
    max-width: 260px;
    background: var(--text);
    color: var(--bg);
    border-radius: 3px;
    padding: 9px 12px;
    font: 500 12.5px/1.45 var(--font-sans);
    pointer-events: none;
    box-shadow: 0 6px 20px rgba(33, 29, 22, .22);
}

.chart-tooltip[hidden] {
    display: none;
}

.chart-tooltip-meta {
    display: block;
    margin-top: 3px;
    font: 400 11.5px/1.4 var(--font-mono);
    opacity: .75;
}

.chart-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.chart-gridline {
    stroke: rgba(33, 29, 22, .1);
    stroke-width: 1;
}

.chart-axis-line {
    stroke: rgba(33, 29, 22, .25);
    stroke-width: 1;
}

.chart-axis-label {
    font: 500 9px var(--font-mono);
    fill: var(--text-muted);
}

.chart-axis-title {
    font: 500 10px var(--font-mono);
    fill: var(--text-faint);
}

.chart-point {
    fill: var(--accent);
    cursor: pointer;
}

.chart-point-solid {
    fill: var(--text);
    cursor: pointer;
}

.chart-point:hover,
.chart-point-solid:hover {
    stroke: var(--accent);
    stroke-width: 6;
    stroke-opacity: .22;
}

.chart-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.5;
    stroke-linejoin: round;
}

/* Horizontal bar-list charts (time per song / efficiency) */
.chart-bars-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-bar-row {
    display: grid;
    grid-template-columns: 190px 1fr 46px;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.chart-bar-row:hover .chart-bar-fill {
    background: var(--text);
}

/* Wraps to two lines instead of truncating — Japanese titles were being cut to
   an ellipsis that made different songs indistinguishable. */
.chart-bar-label {
    font: 400 12px/1.35 var(--font-sans);
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chart-bar-track {
    display: block;
    height: 10px;
    border-radius: 2px;
    background: rgba(33, 29, 22, .08);
    overflow: hidden;
}

.chart-bar-fill {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 2px 0 0 2px;
}

.chart-bar-value {
    font: 500 11px var(--font-mono);
    color: var(--text-faint);
    text-align: right;
}

/* === STATUS NOTE === */
.tr-status {
    border-left: 2px solid var(--accent-soft);
    padding: 4px 0 4px 18px;
    margin-bottom: 28px;
    max-width: 680px;
}

.tr-status p {
    margin: 10px 0 0;
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.6;
}

.tr-status a {
    color: var(--accent);
}

/* === KANJI EXPLORER === */
.kx-lede {
    margin: 0 0 16px;
    max-width: 640px;
    color: var(--text-soft);
    font-size: 14.5px;
    line-height: 1.6;
}

.kx-levels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.kx-level {
    font: 500 13px/1 var(--font-mono);
    padding: 9px 14px;
    min-width: 52px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.kx-level:hover {
    border-color: var(--text);
    color: var(--text);
}

.kx-level[aria-pressed="true"] {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.kx-summary {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.kx-summary-value {
    font: 400 44px/1 var(--font-serif);
    color: var(--text);
}

.kx-summary-text {
    font-size: 14px;
    color: var(--text-muted);
    flex: 1 1 260px;
}

.kx-songs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kx-row {
    display: grid;
    grid-template-columns: 190px 1fr 46px;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 5px 0;
    border: 0;
    background: none;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.kx-row:hover .chart-bar-label,
.kx-row[aria-expanded="true"] .chart-bar-label {
    color: var(--text);
}

.kx-bar {
    display: flex;
    gap: 1px;
    height: 12px;
    border-radius: 2px;
    overflow: hidden;
}

.kx-seg {
    flex-basis: 0;
    background: rgba(33, 29, 22, .12);
}

.kx-seg.is-known {
    background: var(--green);
}

.kx-detail {
    display: grid;
    gap: 10px;
    padding: 10px 0 16px;
    margin-left: 200px;
}

.kx-detail[hidden] {
    display: none;
}

.kx-detail-level {
    display: grid;
    grid-template-columns: 110px 1fr;
    column-gap: 12px;
    align-items: baseline;
}

.kx-detail-name {
    font: 600 12px/1.4 var(--font-mono);
    color: var(--text);
}

.kx-detail-meta {
    font: 400 11px/1.4 var(--font-mono);
    color: var(--text-faint);
    white-space: nowrap;
}

.kx-detail-kanji {
    grid-column: 2;
    grid-row: 1 / span 2;
    font-size: 20px;
    line-height: 1.5;
    letter-spacing: .08em;
    word-break: break-all;
    color: var(--text);
}

.kx-detail-name,
.kx-detail-meta {
    grid-column: 1;
}

.kx-detail-level.is-known .kx-detail-kanji {
    color: var(--text-faint);
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .tr-row-1-2,
    .tr-row-1-1,
    .about-panel-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .kpi-value { font-size: 32px; }
    /* Taller than before so the axis text stays legible once scaled down. */
    .chart-container { height: 240px; }
    .chart-bar-row,
    .kx-row { grid-template-columns: 120px 1fr 42px; }
    .kx-detail { margin-left: 0; }
    .chart-bar-label { font-size: 11.5px; }
}
