/* Depremİstatistik.com — stats.css
   İstatistik sayfaları: il sayfası (aylık grafik), Türkiye geneli (günlük grafik, büyüklük ve
   derinlik dağılımı) ve il sıralaması (sıra tablosu, değişim, sessiz iller). Özet şeridi,
   deprem listesi ve büyüklük renkleri quake-list.css'ten gelir. */

/* Aylık dağılım: çubuk yüksekliği satır içi --value (en yoğun ay = %100) ile verilir */
.month-chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.month-chart li {
    display: grid;
    grid-template-rows: auto 140px auto;
    justify-items: center;
    align-items: end;
    gap: 6px;
    min-width: 0;
}

.month-chart-count { font-size: 13px; font-weight: 800; color: var(--text); }

.month-chart-bar {
    width: 100%;
    max-width: 44px;
    height: max(var(--value), 2px);
    border-radius: 6px 6px 2px 2px;
    background: var(--accent-strong);
}

.month-chart-label { font-size: 12px; font-weight: 700; color: var(--text-muted); }

/* Günlük grafik (Türkiye geneli, 30 gün): çubuk yüksekliği --value (en yoğun gün = %100), rengi
   günün en büyük depreminin seviyesi; sayılar ipucunda ve ekran okuyucu metninde. Depremli
   günün çubuğu gün sayfasına bağlanır, tıklama alanı sütunun tamamıdır. Bugünden geriye
   haftada bir tarih yazılır, sonuncusu (bugün) sağa yaslanır. */
.day-chart {
    display: grid;
    grid-template-columns: repeat(30, minmax(0, 1fr));
    gap: 3px;
    height: 170px;
    margin: 0;
    padding: 0 0 26px;
    list-style: none;
}

.day-chart li { position: relative; display: flex; align-items: flex-end; min-width: 0; }

/* Sıfır değer: çubuk taban çizgisi renginde (2 px) kalır */
.mag-none { --mag-color: var(--line); }

.day-chart-bar {
    width: 100%;
    height: max(var(--value), 2px);
    border-radius: 3px 3px 1px 1px;
    background: var(--mag-color);
}

a.day-chart-bar::after { content: ""; position: absolute; inset: 0; }
.day-chart li:hover .day-chart-bar { filter: brightness(1.2); }

.day-chart-tick {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--text-muted);
}

.day-chart li:last-child .day-chart-tick { left: auto; right: 0; transform: none; }

/* Dağılımlar: aralık | çubuk (payı kadar) | sayı ve pay. Derinlik çubukları tek renk. */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
    align-items: start;
}

.dist-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }

.dist-list li {
    display: grid;
    grid-template-columns: 7.4em minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.dist-label { font-size: 14px; font-weight: 700; white-space: nowrap; color: var(--text-muted); }

.dist-bar {
    width: max(var(--value), 2px);
    height: 12px;
    border-radius: 2px 6px 6px 2px;
    background: var(--mag-color);
}

.dist-list.is-depth { --mag-color: #4f8fc6; }

.dist-count { font-size: 15px; font-weight: 800; text-align: right; white-space: nowrap; color: var(--text); }
.dist-count small { margin-left: 4px; font-size: 13px; font-weight: 700; color: var(--text-muted); }

/* Sıralama tablosu: başlık ve satırlar aynı ızgarayı paylaşır */
.rank-head, .rank-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 80px 70px 80px 80px;
    align-items: center;
    column-gap: 14px;
}

.rank-head {
    padding: 0 12px 8px;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
}

.rank-head span { white-space: nowrap; }
.rank-head span:nth-child(n+3) { text-align: right; }

.rank-list { margin: 0; padding: 0; list-style: none; }

.rank-row {
    position: relative;
    min-height: 48px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
}

.rank-row:hover { background-color: rgba(255, 255, 255, .04); }
.rank-row:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }

.rank-position { font-size: 15px; font-weight: 900; color: var(--text-muted); }
.rank-row:nth-child(-n+3) .rank-position { color: var(--accent-text); }

.rank-name { font-size: 16px; font-weight: 800; text-decoration: none; color: var(--text); overflow-wrap: anywhere; }
.rank-name:focus-visible { outline: none; }
.rank-name::after { content: ""; position: absolute; inset: 0; }

.rank-count, .rank-week, .rank-max { text-align: right; font-size: 15px; font-weight: 800; }
.rank-count { color: var(--text); }
.rank-week { color: var(--text-muted); }
.rank-max { color: var(--mag-text, var(--mag-color)); }

.rank-change { text-align: right; font-size: 13px; font-weight: 800; }
.rank-change.is-up { color: var(--accent-text); }
.rank-change.is-down, .rank-change.is-same { color: var(--text-muted); }
.rank-change.is-new { color: var(--mag-3); }

.rank-quiet {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.rank-quiet a { font-size: 14px; font-weight: 700; text-decoration: none; color: var(--text-muted); }
.rank-quiet a:hover { color: var(--text); }

/* Dar ekranda 12 sütuna dört-beş basamaklı sayılar sığmaz: grafik yatay çubuk listesine döner
   (ay | çubuk | sayı); sıralamada sayı sütunları içeriğe göre daralır, il adına yer kalır. */
@media (max-width: 860px) {
    .month-chart { grid-template-columns: minmax(0, 1fr); gap: 6px; }

    .month-chart li {
        grid-template-columns: 34px minmax(0, 1fr) 64px;
        grid-template-rows: none;
        grid-template-areas: "label bar count";
        align-items: center;
        justify-items: start;
        gap: 10px;
    }

    .month-chart-label { grid-area: label; }
    .month-chart-count { grid-area: count; justify-self: end; }

    .month-chart-bar {
        grid-area: bar;
        width: max(var(--value), 2px);
        max-width: none;
        height: 12px;
        border-radius: 2px 6px 6px 2px;
    }

    .rank-head, .rank-row { grid-template-columns: 36px minmax(0, 1fr) 64px 56px 56px 52px; column-gap: 10px; }

    .day-chart { gap: 2px; height: 150px; }
    .stats-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Telefonda il adı satırın tamamını alır; sayılar alt satırda, başlıktaki sütunların altında */
@media (max-width: 600px) {
    .rank-head, .rank-row { grid-template-columns: 28px minmax(0, 1fr) 64px 56px; column-gap: 8px; }
    .rank-head span:nth-child(4), .rank-head span:nth-child(6), .rank-week { display: none; }

    .rank-row {
        grid-template-areas: "pos name name name" "pos change count max";
        row-gap: 2px;
        padding: 8px 6px;
    }

    .rank-position { grid-area: pos; }
    .rank-name { grid-area: name; font-size: 15px; }
    .rank-count { grid-area: count; }
    .rank-max { grid-area: max; }
    .rank-change { grid-area: change; text-align: left; font-size: 12px; }

    .day-chart-tick { font-size: 11px; }

    /* Dağılım: aralık ve sayı üst satırda, çubuk altta tam genişlikte */
    .dist-list { gap: 12px; }
    .dist-list li { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label count" "bar bar"; row-gap: 6px; }
    .dist-label { grid-area: label; }
    .dist-count { grid-area: count; }
    .dist-bar { grid-area: bar; }
}
