/* --- Только страница персонажей / статьи (общие карточки — в common.css) --- */
@import url("special.css");

.char-author {
    color: #ccc;
    font-size: 20px;
    margin-top: 4px;
}

@media (max-width: 900px) {
    .char-author {
        font-size: 12px;
    }
}

/* --- Текст о персонаже --- */
.character-text {
    line-height: 1.6;
    font-size: 21px;
    text-align: left;
}

/* --- Картинки в тексте статьи --- */
.text-image {
    height: auto;
    margin: 1rem 1.5rem 1rem 0;
    border-radius: 12px;
}

.text-image.left {
    float: left;
    margin-right: 1.5rem;
    margin-left: 0;
}

.text-image.right {
    float: right;
    margin-left: 1.5rem;
    margin-right: 0;
}

.text-image.center {
    display: block;
    float: none;
    margin: 2rem auto;
}

.text-image.tiny { max-width: 120px; }
.text-image.small { max-width: 180px; }
.text-image.medium-small { max-width: 240px; }
.text-image.medium { max-width: 320px; }
.text-image.medium-large { max-width: 400px; }
.text-image.large { max-width: 520px; }
.text-image.largest { max-width: 600px; }
.clearfix { clear: both; }

@media (max-width: 768px) {
    .text-image.left,
    .text-image.right {
        float: none;
        display: block;
        margin: 1.5rem auto;
        max-width: 90%;
    }
}

/* --- Инфобокс персонажа (персональные цвета: data.infobox в info.json → --ib-*) --- */
.infobox {
    --ib-bg: rgba(15, 15, 15, 0.85);
    --ib-border: #333;
    --ib-section-border: #444;
    --ib-label: #aaa;
    --ib-text: #eee;
    --ib-heading: inherit;
    --ib-img-border: #333;
    --ib-img-bg: #111;
    --ib-link: #fbff00;
    --ib-tooltip-bg: #111;
    --ib-tooltip-border: #444;
    --ib-tooltip-text: #fff;
    --ib-tooltip-underline: #777;
    --ib-bar-track: #222;
    --ib-bar-grid: #444;

    max-width: 500px;
    width: 100%;
    background: var(--ib-bg);
    border: 1px solid var(--ib-border);
    color: var(--ib-text);
    padding: 14px;
    font-family: var(--font-determination);
    font-size: 20px;
    float: right;
    margin: 0 0 10px 10px;
}

.infobox-section {
    margin-top: 14px;
}

.infobox-section h3 {
    font-size: 22px;
    color: var(--ib-heading);
    border-bottom: 1px solid var(--ib-section-border);
    padding-bottom: 4px;
    margin-bottom: 8px;
}

.infobox-image {
    width: 100%;
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
}

.infobox-image img {
    max-width: 100%;
    max-height: 260px;
    object-fit: contain;
    border: 1px solid var(--ib-img-border);
    background: var(--ib-img-bg);
}

.infobox-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
}

.infobox-label {
    color: var(--ib-label);
}

.infobox-value {
    min-width: 0;
    display: flex;
    justify-content: flex-end;
    color: var(--ib-text);
}

.infobox .tooltip {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted var(--ib-tooltip-underline);
}

.infobox .tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 0;
    bottom: 75%;
    transform: translateX(-90%);
    background: var(--ib-tooltip-bg);
    color: var(--ib-tooltip-text);
    padding: 6px 8px;
    border: 1px solid var(--ib-tooltip-border);
    white-space: pre-line;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    width: 300px;
    z-index: 100;
    font-size: 16px;
    line-height: 1.4;
}

.infobox .tooltip:hover::after {
    opacity: 1;
}

/* шкалы */
.infobox .value-bar {
    position: relative;
    width: 100%;
    height: 10px;
    background-color: var(--ib-bar-track);
    margin-top: 6px;
    cursor: help;
    overflow: visible;
    display: block;
    transition: background 0.3s, width 0.3s;
}

/* значение 0: полоска медленно «дышит» белым */
.infobox .value-bar--zero {
    animation: valueBarZeroPulse 2.8s ease-in-out infinite;
}

@keyframes valueBarZeroPulse {
    0%, 100% {
        background-color: var(--ib-bar-track);
        box-shadow: none;
    }
    50% {
        background-color: color-mix(in srgb, var(--ib-bar-track) 35%, #fff);
        box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.45);
    }
}

.infobox .value-bar::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
            to right,
            var(--ib-bar-grid) 0,
            var(--ib-bar-grid) 1px,
            transparent 1px,
            transparent 10%
    );
    pointer-events: none;
    z-index: 2;
}

.infobox .value-bar span {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(156, 204, 51, 0.85);
    z-index: 1;
}

.infobox .value-bar span.rainbow-fill {
    background: linear-gradient(90deg, red, orange, yellow, green, blue, indigo, violet);
    background-size: 400% 100%;
    animation: rainbowShift 3s linear infinite;
    display: block;
    width: 100%;
    height: 100%;
}

@keyframes rainbowShift {
    0%   { background-position: 0 0; }
    50%  { background-position: 200% 0; }
    100% { background-position: 400% 0; }
}

@media (max-width: 600px) {
    .char-author {
        font-size: 11px;
    }

    .character-text {
        font-size: 15px;
    }

    .infobox {
        font-size: 14px;
        padding: 10px;
    }

    .infobox-section h3 {
        font-size: 17px;
    }

    .infobox .tooltip::after {
        font-size: 13px;
        width: min(280px, 85vw);
    }

    .character-text h2 {
        font-size: 18px;
        margin-top: 1.25em;
    }
}
