:root {
  --page: #f4f0e6;
  --ink: #1a1814;
  --secondary: #5e584e;
  --hairline: #ddd6c8;
  --line: #8a8174;
  --card: #fffdf8;
  --action: #0f6e6b;
  --action-text: #ffffff;
  --link: #0f6e6b;
  color-scheme: light;
  font-size: 100%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #161410;
    --ink: #f3efe6;
    --secondary: #c8c0b2;
    --hairline: #3f3a33;
    --line: #6e675c;
    --card: #221f1a;
    --action: #0f6e6b;
    --action-text: #ffffff;
    --link: #4aa9a5;
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--page);
  color: var(--ink);
  border-top: 0.4rem solid var(--action);
}

body {
  margin: 0 auto;
  max-width: 40rem;
  padding: 1.25rem 1rem 3rem;
  background: var(--page);
  color: var(--ink);
  font-family: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}

:focus {
  outline: 3px solid #0f6e6b;
  outline-offset: 2px;
}

@media (prefers-color-scheme: dark) {
  :focus {
    outline-color: #9ee0dc;
  }
}

.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.65rem 0.9rem;
  overflow: visible;
  clip: auto;
  clip-path: none;
  white-space: normal;
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

a:visited {
  color: var(--link);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.site-name {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
}

.support-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 44px;
  padding: 0.25rem 0;
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration-thickness: 2px;
}

h1 {
  margin: 1.35rem 0 0.75rem;
  font-size: clamp(1.75rem, 4vw, 2.3rem);
  font-weight: 700;
  line-height: 1.25;
  text-wrap: balance;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
}

p {
  margin: 0;
}

.lead {
  font-size: 1.125rem;
}

section {
  margin-top: 2.25rem;
}

.feel-sentence {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  font-weight: 400;
  line-height: 1.35;
  text-wrap: balance;
}

.example-advice,
.feel-advice {
  margin-top: 0.65rem;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: 1.2rem;
  line-height: 1.45;
}

.place-name {
  margin: 0 0 0.65rem;
  font-size: 1.125rem;
  font-weight: 700;
}

.match-note,
.bank-note {
  margin-top: 0.75rem;
  color: var(--secondary);
}

.citation {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--hairline);
}

.note {
  margin-top: 0.85rem;
  color: var(--secondary);
}

ol {
  margin: 0;
  padding-left: 1.35rem;
}

li + li {
  margin-top: 0.45rem;
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

input[type="text"] {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  appearance: none;
}

input::placeholder {
  color: var(--secondary);
  opacity: 1;
}

button {
  font: inherit;
  font-size: 1rem;
  line-height: 1.2;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 2px;
  cursor: pointer;
  appearance: none;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

#place-form button {
  width: 100%;
  color: var(--action-text);
  background: var(--action);
  border: 2px solid var(--action);
}

#place-form button:hover,
#place-form button:active {
  background: #0c5c59;
  border-color: #0c5c59;
}

#place-form button#use-location {
  color: var(--link);
  background: var(--card);
  border-color: var(--link);
}

#place-form button#use-location:hover,
#place-form button#use-location:active {
  color: var(--link);
  background: var(--card);
  border-color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

button:disabled {
  cursor: default;
  opacity: 1;
}

#place-form button:disabled {
  color: var(--action-text);
  background: #0c5c59;
  border-color: #0c5c59;
}

#place-form button#use-location:disabled {
  color: var(--link);
  background: var(--card);
  border-color: var(--link);
  text-decoration: none;
}

@media (min-width: 36rem) {
  .form-actions {
    flex-direction: row;
    align-items: stretch;
  }

  .form-actions button {
    width: auto;
    flex: 1 1 0;
  }
}

#reading-status:not(:empty) {
  margin-top: 0.85rem;
  font-weight: 600;
}

#reading {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow-wrap: break-word;
}

#reading-output:empty + #place-choices:empty + .reading-hint {
  margin-top: 0;
}

#reading-output:not(:empty) ~ .reading-hint {
  display: none;
}

.reading-hint {
  margin: 0.85rem 0 0;
  color: var(--secondary);
}

#place-choices {
  list-style: none;
  margin: 0;
  padding: 0;
}

#place-choices:not(:empty) {
  margin-top: 0.85rem;
}

#place-choices li + li,
#place-choices button + button {
  margin-top: 0.5rem;
}

#place-choices button {
  display: block;
  width: 100%;
  min-height: 44px;
  height: auto;
  padding: 0.55rem 0.75rem;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
}

#place-choices button:hover,
#place-choices button:active {
  border-color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

#place-choices button:disabled {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
  text-decoration: none;
}

.facts {
  display: grid;
  grid-template-columns: minmax(8.5rem, 12rem) minmax(0, 1fr);
  column-gap: 1rem;
  margin: 1rem 0 0;
}

.facts dt,
.facts dd {
  margin: 0;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--hairline);
}

.facts dt {
  font-weight: 700;
}

@media (max-width: 32rem) {
  .facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .facts dt {
    padding-bottom: 0;
    border-bottom: 0;
    color: var(--secondary);
  }

  .facts dd {
    padding-top: 0.1rem;
  }
}

/* Border plus a text label. Color is not the only signal. */
.aqi-low,
.aqi-moderate,
.aqi-high,
.aqi-very_high {
  border-left: 0.35rem solid var(--line);
  padding-left: 0.75rem;
}

.aqi-low {
  border-left-color: #0f6e6b;
}

.aqi-moderate {
  border-left-color: #7a5410;
}

.aqi-high {
  border-left-color: #8f3b12;
}

.aqi-very_high {
  border-left-color: #8c1f1f;
}

.aqi-low::before,
.aqi-moderate::before,
.aqi-high::before,
.aqi-very_high::before {
  display: block;
  margin-bottom: 0.15rem;
  font-weight: 700;
}

.aqi-low::before {
  content: "Low";
}

.aqi-moderate::before {
  content: "Moderate";
}

.aqi-high::before {
  content: "High";
}

.aqi-very_high::before {
  content: "Very high";
}

footer {
  margin-top: 2.75rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
}

.attribution {
  margin-top: 0.35rem;
}

@media (prefers-color-scheme: dark) {
  .aqi-low {
    border-left-color: #7dccc8;
  }

  .aqi-moderate {
    border-left-color: #e6c98a;
  }

  .aqi-high {
    border-left-color: #f2b89a;
  }

  .aqi-very_high {
    border-left-color: #f3b0b0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  :focus {
    outline: 3px solid Highlight;
  }

  button,
  input[type="text"] {
    border: 1px solid ButtonText;
  }
}
