/* Cybercore style within WCAG 2.1 AA: text at 4.5:1 or more, graph lines and controls at 3:1 or more, no flashing,
   no decorative animation, and reflow from 320 px to 1920 px (GL-009; UX-005; UX-008). */
:root {
  --background: #0b0f1a;
  --surface: #131a2b;
  --text: #e8f1ff;
  --muted: #b4c2dc;
  --accent: #39f0ff;
  --line: #ff4fd8;
  --grid: #3a4766;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.site-header,
.page {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1rem;
}

.site-header h1 {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.tagline,
.explanation,
.status {
  color: var(--muted);
}

/* The one search field above the forecast (DEC-007): it wraps from 320 px, with accent borders and a focus outline at
   well over 3:1 on the background, and 44 px touch targets (GL-009; UX-001; UX-005). */
.search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-label {
  flex-basis: 100%;
}

.search-field {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 0.25rem 0.75rem;
  border: 2px solid var(--accent);
  border-radius: 0.25rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.search-field:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.search-submit {
  min-height: 44px;
  padding: 0.25rem 0.75rem;
  border: 2px solid var(--accent);
  border-radius: 0.25rem;
  background: var(--accent);
  color: var(--background);
  font: inherit;
  font-weight: bold;
  cursor: pointer;
}

.search-submit:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.forecast {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: 0.5rem;
  padding: 1rem;
}

.place-label {
  margin: 0;
}

/* "Change place" beside the place label (UX-003; DEC-007): an accent border and focus outline at well over 3:1 on the
   surface, and a 44 px touch target (GL-009; UX-001; UX-005). */
.forecast-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.change-place {
  min-height: 44px;
  padding: 0.25rem 0.75rem;
  border: 2px solid var(--accent);
  border-radius: 0.25rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.change-place:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* The °C/°F switch beside the graph (UX-006; DEC-003 (b)): accent borders and focus outline at well over 3:1 on the
   surface, a filled pressed state, and a 44 px touch target (GL-009; UX-001; UX-005). */
.unit-switch {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.unit-switch button {
  min-width: 44px;
  min-height: 44px;
  padding: 0.25rem 0.75rem;
  border: 2px solid var(--accent);
  border-radius: 0.25rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.unit-switch button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.unit-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--background);
  font-weight: bold;
}

.temperature-graph {
  margin: 1rem 0;
}

.graph {
  display: block;
  width: 100%;
  height: auto;
}

.graph text {
  fill: var(--muted);
  font-size: 12px;
}

.graph .axis-unit,
.graph .now-label {
  fill: var(--text);
}

.grid-line,
.hour-tick {
  stroke: var(--grid);
  stroke-width: 1;
}

.temperature-line {
  stroke: var(--line);
  stroke-width: 2;
}

.point {
  fill: var(--line);
}

.now-marker {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.temperature-table {
  width: 100%;
  border-collapse: collapse;
}

.temperature-table caption {
  text-align: left;
  color: var(--muted);
}

.temperature-table th,
.temperature-table td {
  text-align: left;
  padding: 0.125rem 0.5rem;
  border-bottom: 1px solid var(--grid);
}

.credit a,
a {
  color: var(--accent);
}

/* The "approximate" marker after a DB-IP city name (FR-002; DEC-004): muted text at well over 4.5:1 on the surface,
   smaller than the name, so the name itself is unchanged (GL-009). */
.approximate {
  margin-left: 0.25em;
  color: var(--muted);
  font-size: 0.6em;
  font-weight: normal;
  text-transform: lowercase;
}

/* "IP Geolocation by DB-IP" and "CC BY 4.0" (FR-016; GL-005): accent links at well over 4.5:1 on the surface and the
   background, and a visible focus outline (GL-009; UX-005). */
.credit-dbip a {
  color: var(--accent);
}

.credit-dbip a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* "°F converted from SMHI's °C data", next to the SMHI credit while °F is selected (FR-007; GL-005). */
.conversion-notice {
  margin-left: 0.5em;
  color: var(--muted);
}

.outcome {
  background: var(--surface);
  border-left: 4px solid var(--accent);
  padding: 0.5rem 1rem;
}

/* "Search for a place" beside the outcomes that need the search field (UX-007; DEC-010): accent text and a focus
   outline at well over 3:1 on the surface (GL-009; UX-005). */
.search-prompt {
  color: var(--accent);
  font-weight: bold;
}

.search-prompt:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* The place-search results (FR-003; DEC-007): one button per place, with an accent border and focus outline at well
   over 3:1 on the surface, a 44 px touch target, and the OpenStreetMap credit below (GL-005; GL-009; UX-001; UX-005). */
.place-results {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
}

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

.place-result-list li {
  margin: 0.25rem 0;
}

.place-result {
  width: 100%;
  min-height: 44px;
  padding: 0.25rem 0.75rem;
  border: 2px solid var(--accent);
  border-radius: 0.25rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.place-result:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
