/*
 * Страница острова — флагманский экран 3 (2.txt §44–§57, §222):
 * hero + KPI + график + правая панель метаданных.
 * HEX не пишем, только переменные из tokens.css.
 */

.island {
    padding: 8px 0 var(--section-gap);
}

.crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 20px 0 16px;
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

.crumbs a {
    color: var(--text-secondary);
}

.crumbs a:hover {
    color: var(--primary);
}

/* --- Hero --- */

.island__hero {
    display: grid;
    grid-template-columns: minmax(280px, 400px) minmax(0, 1fr) minmax(260px, 320px);
    gap: var(--gap);
    align-items: start;
}

.island__cover {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-panel);
    background: var(--bg-soft);
}

.island__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.island__cover-empty {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.island__main {
    padding-top: 4px;
}

.island__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.island__title {
    margin: 14px 0 8px;
    font-size: var(--fs-h1);
    line-height: var(--lh-tight);
    word-break: break-word;
}

.island__by {
    color: var(--text-secondary);
    font-size: var(--fs-sm);
}

.island__by a {
    color: var(--primary);
    font-weight: 700;
}

.island__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.island__code {
    padding: 9px 14px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: var(--fs-sm);
    font-weight: 700;
    letter-spacing: .04em;
}

.island__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.chip--muted {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* --- Правая панель --- */

.island__info {
    padding: var(--card-pad);
}

.island__info-title {
    font-size: var(--fs-h3);
    margin-bottom: 14px;
}

.island__facts {
    display: grid;
    gap: 10px;
}

.island__facts > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.island__facts > div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.island__facts dt {
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

.island__facts dd {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--fs-sm);
    font-weight: 700;
    text-align: right;
    word-break: break-word;
}

.island__source {
    margin-top: 14px;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    line-height: 1.5;
}

/* --- KPI --- */

.island__kpi {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
    margin: 28px 0;
}

/* Сама карточка `.kpi` — общий компонент, живёт в base.css. */

/* --- Секции --- */

.island__section {
    padding: var(--card-pad);
}

.island__section h2 {
    font-size: var(--fs-h3);
}

.island__section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--gap);
    margin-bottom: 18px;
}

.island__section-head p {
    margin-top: 6px;
    max-width: 62ch;
    font-size: var(--fs-sm);
}

.island__section-note {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

.island__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: var(--gap);
    margin-top: var(--gap);
}

.island__note {
    margin-top: 12px;
    font-size: var(--fs-xs);
}

.island__similar {
    margin-top: var(--section-gap);
}

.island__similar h2 {
    margin-bottom: 18px;
}

/* --- График --- */

.chart-box {
    padding: 8px 0 0;
}

.chart {
    display: block;
    width: 100%;
    height: 260px;
}

.chart__grid {
    stroke: var(--border);
    stroke-width: 1;
}

.chart__line {
    fill: none;
    stroke: var(--cyan);
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.chart__area {
    fill: url(#chartFill);
    stroke: none;
}

.chart__stop-top {
    stop-color: var(--cyan);
    stop-opacity: .22;
}

.chart__stop-bottom {
    stop-color: var(--cyan);
    stop-opacity: 0;
}

.chart__label {
    fill: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-sans);
}

/* --- Таблица --- */

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
}

.table th {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    white-space: nowrap;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover td {
    background: var(--bg-soft);
}

/* --- История --- */

.timeline {
    display: grid;
    gap: 14px;
}

.timeline__item {
    display: grid;
    gap: 4px;
    padding-left: 16px;
    border-left: 2px solid var(--bg-active);
}

.timeline__date {
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

.timeline__text {
    color: var(--text-primary);
    font-size: var(--fs-sm);
}

.empty--inline {
    padding: 28px 20px;
    border: 1px dashed var(--border);
    background: transparent;
}

/* --- Адаптив --- */

@media (max-width: 1279px) {
    .island__hero {
        grid-template-columns: minmax(260px, 1fr) minmax(0, 1fr);
    }

    .island__info {
        grid-column: 1 / -1;
    }

    .island__kpi {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1023px) {
    .island__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 767px) {
    .island__hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .island__title {
        font-size: var(--fs-h1);
    }

    .island__kpi {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .island__actions {
        gap: 10px;
    }

    .island__actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .chart {
        height: 220px;
    }

    /* Мобильный — не сжатый десктоп: таблица превращается в карточки. */
    .table thead {
        display: none;
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
        white-space: normal;
    }

    .table tr {
        margin-bottom: 12px;
        padding: 12px 14px;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        background: var(--bg-card);
    }

    .table tr:last-child {
        margin-bottom: 0;
    }

    .table td {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
        padding: 6px 0;
        border-bottom: 0;
        font-weight: 700;
    }

    .table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: var(--fs-xs);
        font-weight: 600;
    }

    .table tbody tr:hover td {
        background: transparent;
    }
}
