/* Bar history (#271): how often a bar was open over the last year */

.history-length,
.history-boat,
.history-summary,
.history-year,
.history-months,
.history-method {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.history-length label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.history-length-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.history-length-row input {
    width: 7rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    background: var(--ocean-deep);
    color: var(--text-primary);
}

.history-h2 {
    font-size: var(--text-lg);
    margin: 0 0 0.75rem;
    color: var(--text-primary);
}

.history-hint {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin: 0.5rem 0 0;
}

.history-big {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
}

.history-big strong {
    font-size: 2rem;
    color: var(--text-primary);
    margin-right: 0.25rem;
}

.history-counts,
.history-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.history-legend { margin-bottom: 0.75rem; }

.hc-dot {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 3px;
    margin-right: 0.4rem;
    vertical-align: -1px;
}

/* One colour language for the dots and the day squares */
.hc-dot.open, .yc.open, .hc-dot.yes, .yc.yes { background: var(--status-open); }
.hc-dot.restricted, .yc.restricted { background: var(--status-restricted); }
.hc-dot.closed, .yc.closed, .hc-dot.no, .yc.no { background: var(--status-closed); }
.hc-dot.none, .yc.none { background: var(--card-border); }

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

.history-table th,
.history-table td {
    padding: 0.5rem 0.6rem;
    text-align: right;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}

.history-table th[scope="row"],
.history-table thead th:first-child {
    text-align: left;
    color: var(--text-primary);
}

.history-table thead th {
    color: var(--text-muted);
    font-weight: 600;
}

.history-partial,
.history-pct {
    color: var(--text-muted);
    font-weight: 400;
}

/* The year: one row per month, one square per day. 31 squares fit a phone. */
.year-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.year-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.year-month {
    width: 2rem;
    flex-shrink: 0;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.year-cells {
    display: grid;
    grid-template-columns: repeat(31, minmax(0, 1fr));
    gap: 2px;
    flex: 1;
    max-width: 31rem;
}

.yc {
    aspect-ratio: 1;
    border-radius: 2px;
    min-width: 0;
}

.yc.blank { background: transparent; }

.history-method ul {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.history-method li + li { margin-top: 0.4rem; }

@media (max-width: 480px) {
    .history-length,
    .history-boat,
    .history-summary,
    .history-year,
    .history-months,
    .history-method {
        padding: 0.875rem 1rem;
    }
    .year-cells { gap: 1px; }
}
