/*
 * Stylesheet for the OECS weather and hurricane tracker.
 *
 * The design prioritises readability on both desktop and mobile devices and
 * uses a dark colour palette inspired by GitHub’s dark mode.  Feel free
 * to adjust colours to suit your preference.  For accessibility the font
 * sizes are generous and contrast levels are high.
 */

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #0d1117;
    color: #c9d1d9;
}

/* Unit toggle styles */
.unit-toggle {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #6e7681;
}
.unit-toggle select {
    background-color: #161b22;
    color: #c9d1d9;
    border: 1px solid #30363d;
    padding: 0.25rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

/* Hide metric or imperial values based on data-units attribute */
body[data-units="metric"] .imperial {
    display: none;
}
body[data-units="imperial"] .metric {
    display: none;
}

header {
    background-color: #161b22;
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid #30363d;
}

/* Back link within island headers */
.back-link {
    text-align: left;
    margin-bottom: 0.5rem;
}
.back-link a {
    color: #58a6ff;
    text-decoration: none;
    font-size: 0.9rem;
}
.back-link a:hover {
    text-decoration: underline;
}

header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.6rem;
    color: #58a6ff;
}

header p {
    margin: 0;
    font-size: 0.9rem;
    color: #8b949e;
}

/* Secondary navigation bar */
.secondary-nav {
    margin-top: 0.5rem;
    text-align: center;
}
.secondary-nav a {
    color: #58a6ff;
    text-decoration: none;
    margin: 0 0.5rem;
    font-size: 0.9rem;
}
.secondary-nav a:hover {
    text-decoration: underline;
}

/* Year navigation for historical page */
.year-nav {
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: #6e7681;
}
.year-nav a {
    color: #9ecbff;
    text-decoration: none;
    margin: 0 0.25rem;
}
.year-nav a:hover {
    text-decoration: underline;
}
.year-nav strong {
    color: #ffffff;
    margin: 0 0.25rem;
}

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem;
}

h2 {
    color: #58a6ff;
    font-size: 1.3rem;
    margin-top: 1.5rem;
}

.storms article.storm {
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 5px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.storm h3 {
    margin: 0 0 0.3rem 0;
    font-size: 1.2rem;
    color: #79c0ff;
}

.storm .classification {
    font-weight: normal;
    color: #8b949e;
}

.storm p {
    margin: 0.3rem 0;
    line-height: 1.4;
}

.storm .links a {
    color: #58a6ff;
    text-decoration: none;
    font-size: 0.9rem;
}

.storm .links a:hover {
    text-decoration: underline;
}

/* Label prefix for NHC links */
.storm .links .source-label {
    margin-right: 0.25rem;
    color: #6e7681;
    font-weight: bold;
}

.islands .island-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.islands .island {
    flex: 1 1 calc(50% - 1rem);
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 5px;
    padding: 1rem;
    text-align: center;
    min-width: 140px;
}

.islands .island h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #58a6ff;
}

/* Smaller styling for capital city under the island name */
.islands .island .capital {
    margin: 0.2rem 0;
    font-size: 0.9rem;
    color: #8b949e;
}

/* Capital city text used outside island cards (e.g. island detail page) */
.capital {
    margin: 0.2rem 0;
    font-size: 1rem;
    color: #8b949e;
}

.islands .island p {
    margin: 0.2rem 0;
    font-size: 0.9rem;
    color: #8b949e;
}

.islands .temperature {
    font-size: 1.4rem;
    margin: 0.5rem 0;
    color: #79c0ff;
}

/* Combined temperature and conditions line on the home page */
.islands .temp-cond {
    font-size: 1.1rem;
    margin: 0.5rem 0;
    color: #c9d1d9;
}

.islands .conditions {
    font-size: 0.9rem;
    color: #c9d1d9;
}

.islands .small {
    font-size: 0.75rem;
    color: #6e7681;
}

.audio audio {
    width: 100%;
    margin-top: 0.5rem;
}

/* Met Office discussion section */
.met-office {
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 5px;
    padding: 1rem;
    margin-top: 1.5rem;
}

/* Map section styles */
.map-section {
    margin-top: 1.5rem;
}
.map-section #map {
    width: 100%;
    height: 400px;
    border: 0px;
    border-radius: 0px;
    margin-top: 0.5rem;
}

/* Map usage information box */
.map-info {
    margin-top: 1.5rem;
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 5px;
    padding: 1rem;
    color: #c9d1d9;
}
.map-info h2 {
    margin-top: 0;
    font-size: 1.3rem;
    color: #58a6ff;
}
.map-info p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #8b949e;
}
.met-office .small-date {
    font-size: 0.75rem;
    color: #6e7681;
    margin: 0 0 0.5rem 0;
}
.met-office .forecast-text {
    font-size: 0.9rem;
    color: #c9d1d9;
    line-height: 1.4;
}

/* Credits section */
footer .credits {
    margin: 0.5rem 0 0.2rem 0;
    font-size: 0.8rem;
    color: #6e7681;
}
footer .credits a {
    color: #58a6ff;
    text-decoration: none;
}
footer .credits a:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: #6e7681;
    border-top: 1px solid #30363d;
}

/* Island page styles */
.metrics {
    list-style: none;
    padding: 0;
}

.metrics li {
    margin: 0.3rem 0;
}

.trend-chart canvas {
    width: 100% !important;
    height: auto !important;
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 5px;
    padding: 1rem;
}

.storm-distances ul {
    list-style: none;
    padding: 0;
}

.storm-distances li {
    margin: 0.3rem 0;
}

/*
 * Global link colours for better contrast on dark backgrounds.  These
 * settings apply to links within the main content areas and the footer.
 * Header navigation links retain their original colour for branding.
 */
main a, footer a {
    color: #9ecbff;
    text-decoration: none;
}
main a:visited, footer a:visited {
    color: #bfa5ff;
}
main a:hover, footer a:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .islands .island {
        flex: 1 1 100%;
    }
}

/* Ring labels on the map */
.ring-label {
    color: #c9d1d9;
    font-size: 0.7rem;
    font-weight: bold;
    white-space: nowrap;
    text-shadow: 0 0 2px #0d1117, 0 0 2px #0d1117;
}

/* Note below trend charts */
.data-note {
    font-size: 0.8rem;
    color: #6e7681;
    margin-top: 0.5rem;
}

/* Prevent wrapping of certain labels (e.g., "Island proximity") on narrow screens */
.nowrap {
    white-space: nowrap;
}