/* Lumivuodet specific styles */

.beta-badge {
    display: inline-block;
    vertical-align: middle;
    background: var(--accent);
    color: #1a1304;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transform: translateY(-3px);
}

.controls-container {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--accent-soft);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 300px;
}

.control-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.year-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.5rem;
    max-width: 500px;
    max-height: 130px;
    /* Reduced height */
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--bg);
}

.year-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--accent-soft);
    color: var(--text);
    padding: 0.4rem 0.2rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
}

.year-checkbox:hover {
    background: var(--border);
}

/* Hide default checkbox */
.year-checkbox input {
    display: none;
}

/* Selected state */
.year-checkbox:has(input:checked) {
    background: var(--accent);
    color: #1a1304;
    /* Contrast text for saffron */
    border-color: rgba(0, 0, 0, 0.1);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Visualization Container */
.visualization-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 3rem;
    overflow-x: auto;
    /* Allow scrolling if years are wide, though vertical is preferred */
}

/* Year Row */
.year-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3.5rem;
    /* Increased space between rows for markers */
}

.year-label {
    width: 60px;
    flex-shrink: 0;
    text-align: right;
    font-weight: bold;
    color: var(--text);
}

.season-bar {
    flex-grow: 1;
    height: 120px;
    /* Increased height to preventing marker overlap */
    background: #334155;
    /* Slate 700 for better visibility in Dark Mode */
    border-radius: 6px;
    position: relative;
    /* overflow: hidden;  <-- REMOVED to show labels */
    min-width: 600px;
    /* display: flex; <-- REMOVED, using absolute children now */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Slight depth */
}

/* New inner track for the colored segments */
.bar-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    z-index: 2;
    /* Increased z-index */
}

/* Thermal Seasons Track (Background) */
.thermal-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    z-index: 0;
    /* Behind everything */
    opacity: 0.8;
}

.thermal-segment {
    height: 100%;
}

.thermal-winter {
    background: transparent;
}

/* Default gray/dark from parent */
.thermal-spring {
    background: #dcfce7;
}

/* Light green */
.thermal-summer {
    background: #fef9c3;
}

/* More Orange (was #ffedd5) */
.thermal-autumn {
    background: #fdba74;
}

/* Light orange/brown */

/* Segments within the bar */
.segment {
    height: 100%;
}

/* Segments */
.segment-snow {
    background: #3b82f6;
    /* Blue */
}

.segment-bare {
    background: transparent;
    /* Show gray background of bar */
}

.segment-missing {
    background: transparent;
    /* User requested no stripes. Treat missing data visually as bare ground. */
}

.segment-heat {
    background: #ef4444;
    /* Bright Red for Heat/Summer */
    opacity: 0.8;
}

.segment-dry {
    background: #d97706;
    /* Amber/Orange for dry spells to distinguish from yellow heat */
    /* Or maybe pattern? */
    background-image: linear-gradient(45deg, #d97706 25%, transparent 25%, transparent 50%, #d97706 50%, #d97706 75%, transparent 75%, transparent);
    background-size: 10px 10px;
    opacity: 0.6;
}

/* Markers */
.marker {
    position: absolute;
    /* Centered horizontally on the time point */
    transform: translateX(-50%);
    z-index: 100;
    pointer-events: auto;
    /* Allow hovering */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Edge handling for markers */
.marker.marker-left-edge {
    transform: translateX(0);
    /* Align left edge to point */
    align-items: flex-start;
    /* Text aligns left */
}

.marker.marker-right-edge {
    transform: translateX(-100%);
    /* Align right edge to point */
    align-items: flex-end;
    /* Text aligns right */
}

/* Common label style */
.marker-label {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* --- LANES (Vertical positioning) --- */
/* Positioning INSIDE the bar (janan sisään) - 4 Layers/Stacks */

/* LEVEL 1 (Top): Heat */
.marker-extreme-heat {
    top: 5px;
    bottom: auto;
    margin: 0;
    color: #ef4444;
    /* Bright Red */
    z-index: 102;
}

/* LEVEL 2 (Upper Middle): Dry Spell */
.marker-dry-spell {
    top: 40px;
    /* Below heat */
    bottom: auto;
    margin: 0;
    color: #d97706;
    z-index: 101;
}

/* LEVEL 3 (Lower Middle): First Snow */
.marker-first-snow {
    top: auto;
    bottom: 40px;
    /* Above cold */
    margin: 0;
    color: #0e7490;
    z-index: 101;
}

/* LEVEL 4 (Bottom): Cold */
.marker-extreme-cold {
    top: auto;
    bottom: 5px;
    /* Sticks to bottom */
    margin: 0;
    color: #1e40af;
    z-index: 102;
    /* Topmost in bottom group */
}


/* Connector lines - ensure none */
.marker::after {
    display: none;
}

/* Grid lines / Months */
.months-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none;
    z-index: 5;
    /* Above segments (2), below markers (10) */
}

.month-tick {
    flex: 1;
    /* Distribute evenly (simplified) */
    height: 100%;
    border-left: 1px dashed rgba(0, 0, 0, 0.2);
    /* Slightly darkening */
    position: relative;
    display: flex;
    justify-content: center;
}

/* Hide first border if needed, or keep for Jan 1 */
.month-tick:first-child {
    border-left: none;
}

.month-label {
    position: absolute;
    bottom: -20px;
    /* Below the bar */
    font-size: 0.75rem;
    color: var(--text-soft);
    font-weight: 500;
}

/* Year row adjusts for labels */
.year-row {
    margin-bottom: 2rem;
    /* More space for labels */
}


/* Legend */
.legend {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-soft);
}

.marker-icon {
    font-size: 1.2rem;
    line-height: 1;
    display: inline-block;
    width: 20px;
    text-align: center;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
    /* Prevent collapsing */
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.symbol {
    font-size: 1.2rem;
}

.bar-sample {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    display: inline-block;
}

.bar-snow {
    background-color: #3b82f6;
}

.bar-ground {
    background-color: #3f3f46;
}

/* Info Section */
.info-section {
    margin-top: 4rem;
    padding: 2.5rem;
    background: var(--accent-soft);
    /* Changed from #ffffff to variable for Dark Mode */
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.info-section h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text);
    border-bottom: 2px solid var(--accent);
    display: inline-block;
    padding-bottom: 0.5rem;
}

.info-block {
    margin-bottom: 2.5rem;
}

.info-block:last-child {
    margin-bottom: 0;
}

.info-block h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--text);
    /* Changed from #1a1304 */
}

.info-block p,
.info-block ul li {
    font-size: 1rem;
    color: var(--text-soft);
    line-height: 1.7;
}

.info-block ul {
    list-style-type: none;
    padding-left: 0;
    margin-top: 0.5rem;
}

.info-block ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.6rem;
}

.info-block ul li::before {
    content: "•";
    color: var(--accent);
    font-weight: bold;
    font-size: 1.2rem;
    position: absolute;
    left: 0;
    top: -2px;
}

.external-link {
    display: inline-block;
    margin-left: 0.5rem;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.external-link:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .info-section {
        padding: 1.5rem;
        margin-top: 2rem;
    }
}