:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1b2a41;
  --muted: #5c6b80;
  --line: #dde3ea;
  --accent: #1b2a41;
  --sun: #f5b301;
  --rain-light: #86b6ef;
  --rain-moderate: #2a78d6;
  --rain-heavy: #104281;
  --rain-track: #eef2f7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141b26;
    --card: #1d2735;
    --ink: #e8edf4;
    --muted: #94a3b8;
    --line: #2b3849;
    --accent: #f5b301;
    --rain-light: #3987e5;
    --rain-moderate: #6da7ec;
    --rain-heavy: #b7d3f6;
    --rain-track: #243044;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  /* keeps content clear of the notch when installed on iOS */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url('/icons/glitter-pink.gif') repeat;
  background-size: 400px 400px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
}

body.glitter-mode::before {
  opacity: .45;
}

/* same pink as --accent below, kept literal since color-mix needs a plain
   color and this also carries its own alpha for the translucency */
body.glitter-mode .card,
body.glitter-mode select,
body.glitter-mode .icon-button {
  background: color-mix(in srgb, var(--card) 75%, rgb(196 106 148 / 55%) 25%);
}

body.glitter-mode {
  --accent: #c46a94;
}

body.glitter-mode #glitter-toggle[aria-pressed="true"] {
  box-shadow: 0 0 10px 2px var(--accent);
}

body.glitter-mode .temps img {
  filter: hue-rotate(300deg) saturate(1.4);
}

main {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

header {
  position: relative;
  padding-right: 5.2rem;
}

h1 {
  font-size: 1.4rem;
  margin: 0;
}

.header-buttons {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: .4rem;
}

#about ul {
  margin: .5rem 0 0;
}

#about p {
  margin: 0 0 .6rem;
}

h2 {
  font-size: 1rem;
  margin: 0 0 .5rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.place {
  margin: .25rem 0 1.25rem;
  color: var(--ink);
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .75rem;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}


button {
  font: inherit;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: 0;
  border-radius: .5rem;
  padding: .7rem 1.1rem;
  cursor: pointer;
  width: 100%;
}

button:disabled {
  opacity: .55;
  cursor: default;
}

button.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.icon-button {
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}

#about-toggle[aria-expanded="true"],
#glitter-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

ol, ul {
  padding-left: 1.2rem;
}

li {
  margin: .3rem 0;
}

a {
  color: inherit;
}

footer {
  margin-top: 2rem;
  font-size: .85rem;
  text-align: center;
}

select {
  font: inherit;
  width: 100%;
  padding: .6rem .7rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .5rem;
}

#area-note {
  margin: .6rem 0 0;
  font-size: .85rem;
}

#area-note:empty {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rain-strip {
  margin: 12px 0 6px;
}

.rain-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 72px;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--line);
}

.rain-bar {
  flex: 1 1 0;
  max-width: 24px;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--rain-track);
}

.rain-bar.rain-light { background: var(--rain-light); }
.rain-bar.rain-moderate { background: var(--rain-moderate); }
.rain-bar.rain-heavy { background: var(--rain-heavy); }

.rain-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Forecast: the day, then one line per period, then the conditions text. */
.forecast-day-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
}

.forecast-day {
  margin: 0;
  font-weight: 600;
}

.day-flip {
  flex: none;
  width: auto;
  padding: .3rem .6rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
}

@keyframes page-flip {
  from { transform: rotateY(-6deg) scale(.98); opacity: .4; }
  to { transform: none; opacity: 1; }
}

#forecast.page-flip {
  animation: page-flip .35s ease-out;
  transform-origin: left center;
}

.temps {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.temps li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.temps img {
  width: 1.6em;
  height: 1.6em;
  flex: none;
}

.temps .temp-label {
  color: var(--ink);
}

.temps .temp-value {
  font-variant-numeric: tabular-nums;
}

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

.conditions li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
}

.conditions .condition-mark {
  flex: none;
  width: 1.4em;
  text-align: center;
}

.conditions li[data-kind="uv"] {
  color: var(--muted);
}

.settings {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .75rem;
  margin-top: .75rem;
}

.settings:not(:has(.setting:not([hidden]))) {
  display: none;
}

.setting {
  display: contents;
}

.setting[hidden] {
  display: none;
}

.new-badge {
  display: inline-block;
  margin-right: .35rem;
  padding: 0 .45rem;
  border-radius: 999px;
  background: var(--sun);
  color: #4a3500;
  font-size: .75rem;
  font-weight: 700;
  vertical-align: middle;
}

body.glitter-mode .new-badge {
  background: #f3a6c8;
  color: #7d1d4f;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  justify-self: end;
  width: 2.75rem;
  height: 1.6rem;
  margin: 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: background .2s ease;
}

.switch::before {
  content: "";
  position: absolute;
  top: .2rem;
  left: .2rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 30%);
  transition: transform .2s ease;
}

.switch:checked {
  background: var(--accent);
}

.switch:checked::before {
  transform: translateX(1.15rem);
}

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

.switch:disabled {
  opacity: .55;
  cursor: default;
}

.inline-icon {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.key {
  padding: 0 .35rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  font-weight: 700;
  letter-spacing: .05em;
}

.in-app button + button {
  margin-top: .5rem;
}

#in-app-note {
  margin: .6rem 0 0;
  font-size: .85rem;
  overflow-wrap: anywhere;
}

#in-app-note:empty {
  display: none;
}
