/* Basic BBC style inspired layout and typography */

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f0f0f0;
    color: #222;
    margin: 0;
    padding: 0;
    width: max-content;
    min-width: 100%;
}

header, footer {
    background-color: #bb1919;
    color: white;
    padding: 1rem 2rem;
    box-sizing: border-box;
}

header h1, footer p {
    margin: 0;
}

main {
    padding: 2rem;
    /* max-width: 800px; */
    margin: 0 auto;
    background-color: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

#forecast h2 {
    border-bottom: 2px solid #bb1919;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

#forecast-data p {
    font-size: 1.2rem;
}

/* Forecast day blocks */
.forecast-day {
    border: 1px solid #e6e6e6;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: 4px;
    background: #fafafa;
}

.forecast-day h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: #bb1919;
}

.forecast-row {
    display: grid;
    /* Fixed label column width based on longest label ("Forecast:") */
    grid-template-columns: 10rem 1fr;
    gap: 1rem;
    padding: 0.25rem 0;
    border-top: 1px dashed #eee;
    align-items: start;
    position: relative;
}

.forecast-row:first-of-type {
    border-top: none;
}

.forecast-row .label,
.label {
    color: #555;
    font-weight: 600;
    white-space: nowrap;
    text-align: left;
    position: relative;
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fafafa;
    padding-right: 0.75rem;
    box-shadow: 6px 0 8px -6px rgba(0,0,0,0.12);
}
.forecast-row .tides-sublabels {
    display: grid;
    grid-template-rows: auto auto auto;
    row-gap: 0;
    margin-top: 6px;
    padding-left: 48px;
    transform: translateY(-30px);
    font-size: 0.95rem;
    font-weight: 600;
    color: #555;
    pointer-events: none;
}
.forecast-row .tides-sublabels span {
    line-height: 1.2;
}
.forecast-row .tides-sublabels .tides-spacer {
    font-weight: 700;
    padding-bottom: 6px;
    visibility: hidden;
}
.forecast-row .tides-sublabels .tides-time {
    padding: 4px 0;
}
.forecast-row .tides-sublabels .tides-metres {
    padding: 4px 0;
}
.forecast-row .waves-sublabels {
    display: block;
    margin-top: 6px;
    padding-left: 48px;
    transform: translateY(-2px);
    font-size: 0.95rem;
    font-weight: 600;
    color: #555;
    pointer-events: none;
}
.forecast-row .waves-sublabels .waves-metres {
    line-height: 1.2;
}
.forecast-row .weather-sublabels {
    --weather-label-offset: 50px;
    display: grid;
    grid-template-rows: auto auto auto auto;
    row-gap: 0;
    margin-top: 0;
    padding-left: 48px;
    transform: translateY(-20px);
    font-size: 0.95rem;
    font-weight: 600;
    color: #555;
    pointer-events: none;
}
.forecast-row .weather-sublabels span {
    line-height: 1.2;
    padding: 4px 0;
}
.forecast-row .weather-sublabels .weather-spacer {
    font-weight: 700;
    padding-bottom: 6px;
    visibility: hidden;
}
.forecast-row .weather-sublabels .weather-mph {
    position: relative;
    top: 40px;
}
.forecast-row .weather-sublabels .weather-rain,
.forecast-row .weather-sublabels .weather-temp {
    position: relative;
    top: 60px;
}
.forecast-row .weather-sublabels .weather-icon {
    font-weight: 700;
    padding-bottom: 2px;
}
.forecast-row .weather-icon-image {
    display: block;
}

.forecast-row .value {
    color: #222;
    text-align: left;
}

/* Ensure all numeric forecast values use the same font size and weight
   This normalizes wave heights, wind speeds and rain probabilities so
   they appear visually consistent and aligned. */
.forecast-row .value,
.forecast-row .value * {
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.2;
}

.forecast-row .waves-direction-icon-wrap {
    display: inline-flex;
    align-items: center;
}

.forecast-row .waves-direction-icon-wrap .wind-direction-icon {
    width: 53px;
    height: 53px;
    display: block;
}

.forecast-row .waves-direction-icon-wrap .wind-direction-icon .wind-direction-speed {
    fill: #0074d9;
    font-size: 9.13px;
    font-weight: 700;
    font-family: Arial, Helvetica, sans-serif;
}

/* Info button and popup */
.info-btn {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    background: #bb1919;
    color: #fff;
    border: none;
    font-size: 12px;
    cursor: pointer;
    margin-right: 8px;
    position: relative;
    z-index: 1;
}
.info-btn:focus {
    outline: 2px solid #333;
}
.info-popup {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    max-width: 220px;
    font-size: 0.9rem;
}
.weather-icon-popup {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    max-width: 220px;
    font-size: 0.9rem;
    line-height: 1.2;
}

/* Wind section spacing */
#wind {
    margin-bottom: 1rem;
}

/* Live wind lines layout */
#wind-data .live-wind-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
#wind-data .live-wind-layout {
    display: flex;
    align-items: flex-start;
    gap: 74px;
    flex-wrap: wrap;
}
#wind-data .live-wind-line {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: 1rem;
    align-items: start;
}
#wind-data .live-wind-line--units .label {
    position: relative;
    top: 15px;
}
#wind-data .live-wind-value {
    text-align: left;
    color: #222;
}
#wind-data .live-wind-value--icon {
    display: inline-flex;
    align-items: center;
}
#wind-data .wind-direction-icon {
    width: 44px;
    height: 44px;
    color: #111;
    display: block;
}
#wind-data .wind-direction-icon .wind-direction-speed {
    fill: #111;
    font-size: 11px;
    font-weight: 700;
    font-family: Arial, Helvetica, sans-serif;
}
#wind-data .wind-stats-table {
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 240px;
}
#wind-data .wind-stats-table th,
#wind-data .wind-stats-table td {
    border: 1px solid #e0e0e0;
    padding: 6px 10px;
    text-align: center;
}
#wind-data .wind-stats-table th[scope="row"] {
    text-align: left;
    font-weight: 600;
    color: #444;
}
#wind-data .wind-stats-table thead th {
    background: #f7f7f7;
    font-weight: 700;
}

/* Forecast grid columns - alternate column shading for readability */
.forecast-grid {
    border-radius: 4px;
    overflow: hidden;
}
.forecast-grid .forecast-col {
    padding: 6px 8px;
}
.forecast-grid .forecast-col:nth-child(odd) {
    background: rgba(0,0,0,0.03);
}
.forecast-grid .hour {
    font-weight: 700;
}
.forecast-grid .speed, .forecast-grid .direction, .forecast-grid .rain {
    font-size: 0.95rem;
}
.forecast-grid .forecast-wind-icon-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
}
.forecast-grid .wind-direction-icon {
    width: 44px;
    height: 44px;
    color: #111;
    display: block;
}

.forecast-row .waves-direction-icon-wrap .wind-direction-icon {
    color: #0074d9;
}

.forecast-row .waves-direction-icon-wrap .wind-direction-icon use {
    color: #0074d9;
    fill: #0074d9;
    stroke: #0074d9;
}
.forecast-grid .wind-direction-icon .wind-direction-speed {
    fill: #111;
    font-size: 11px;
    font-weight: 700;
    font-family: Arial, Helvetica, sans-serif;
}

/* Tides grid column striping (odd columns shaded) */
.tide-grid > :nth-child(4n+1),
.tide-grid > :nth-child(4n+3) {
    background: rgba(0,0,0,0.03);
}
.tide-grid > * {
    padding: 2px 4px;
    border-radius: 2px;
}

/* Wind circle and arrow (used for live wind and forecast columns) */
.wind-circle {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #333;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
    font-weight: 700;
    font-size: 0.85rem;
}
.wind-circle .wind-speed {
    z-index: 2;
}
.wind-circle .wind-arrow {
    position: absolute;
    left: 50%;
    top: -18px;
    width: 2px;
    height: 24px;
    background: #111;
    transform-origin: 50% 100%;
    z-index: 1;
}
.wind-circle .wind-arrow:after {
    content: '';
    position: absolute;
    left: 50%;
    top: -8px;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 7px solid #111;
}

#wind h2 {
    border-bottom: 2px solid #bb1919;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
    main {
        padding: 1rem;
        margin: 0 1rem;
    }
}