/*
 * Core styles shared across the app. Propshaft serves every file in app/assets/stylesheets,
 * and `stylesheet_link_tag :app` includes them in alphabetical order, so feature files
 * (e.g. forecasts.css) load after this one and can build on it.
 */

:root {
  --color-accent: #2563eb;
  --color-accent-strong: #1d4ed8;
  --color-on-accent: #fff;
  --color-wash: #eff6ff;
  --color-border: #cbd5e1;
  --color-line: #e5e7eb;
  --color-ink: #1f2937;
  --color-muted: #6b7280;
  --color-page: #f4f7fb;
  --color-surface: #fff;
  --color-surface-hover: #f8fafc;
  --color-prose: #374151;
  --color-hairline: #e2e8f0;
  --hour-day: transparent;
  --hour-night: #f3f4f6;
  --hour-ink: var(--color-ink);
  --map-land-muted: color-mix(in srgb, var(--map-land) 72%, var(--map-label));
  --map-land-edge: color-mix(in srgb, var(--map-land) 82%, var(--map-label));
  --map-land-muted-edge: color-mix(in srgb, var(--map-land-muted) 70%, var(--map-label));
  --focus-ring: 2px solid var(--color-accent);

  /* Light blue at 32° holds through 32.5°, where yellow starts, so a 32°
     bar stays entirely blue. Colder readings darken through blue and
     purple to near-black at -20°. Warmer readings run amber, orange,
     and dark red at 105°. Pressure still uses blue, gray, and orange. */
  --scale-coldest: #140818;
  --scale-purple: #5b21b6;
  --scale-low: #2563eb;
  --scale-frost: #93c5fd;
  --scale-mid: #94a3b8;
  --scale-yellow: #fde047;
  --scale-amber: #f59e0b;
  --scale-high: #d97706;
  --scale-hot: #7f1d1d;

  /* EPA AQI bands. Official colors for the air-quality chip and map later. */
  --aqi-good: #00e400;
  --aqi-moderate: #ffff00;
  --aqi-usg: #ff7e00;
  --aqi-unhealthy: #ff0000;
  --aqi-very-unhealthy: #8f3f97;
  --aqi-hazardous: #7e0023;
  /* Solid EPA bands on the 0–500 index: 50, 100, 150, 200, 300, 500. */
  --aqi-scale: linear-gradient(
    to right,
    var(--aqi-good) 0 10%,
    var(--aqi-moderate) 10% 20%,
    var(--aqi-usg) 20% 30%,
    var(--aqi-unhealthy) 30% 40%,
    var(--aqi-very-unhealthy) 40% 60%,
    var(--aqi-hazardous) 60% 100%
  );
  --temp-scale: linear-gradient(
    to right,
    var(--scale-coldest) 0%,
    var(--scale-purple) 16%,
    var(--scale-low) 28%,
    var(--scale-frost) 41.6%,
    var(--scale-frost) 42%,
    var(--scale-yellow) 42%,
    var(--scale-yellow) 62.4%,
    var(--scale-amber) 76.8%,
    var(--scale-high) 88%,
    var(--scale-hot) 100%
  );
}

[data-theme="dark"] {
  color-scheme: dark;
  --color-accent: #3b82f6;
  --color-accent-strong: #93c5fd;
  --color-on-accent: #f8fafc;
  --color-wash: #1e3a5f;
  --color-border: #475569;
  --color-line: #334155;
  --color-ink: #e5e7eb;
  --color-muted: #94a3b8;
  --color-page: #0b1220;
  --color-surface: #152033;
  --color-surface-hover: #1c2a42;
  --color-prose: #f3f4f6;
  --color-hairline: #94a3b8;
  --hour-day: #8e99a8;
  --hour-night: #000;
  --hour-ink: #0b1220;
}

.scale-sample {
  background-image: var(--temp-scale);
  background-repeat: no-repeat;
  background-size: 401em 100%;
  background-position: calc(var(--temp) * -400em) 0;
}

.scale-pressure {
  max-width: 16rem;
}

.scale-pressure .forecast-pressure-track {
  width: 100%;
}

.scale-temperature {
  max-width: 24rem;
}

.scale-temperature-ramp {
  display: block;
  height: 0.75rem;
  border-radius: 999px;
  background: var(--temp-scale);
}

.scale-ticks {
  display: block;
  position: relative;
  height: 1rem;
  margin-top: 0.2rem;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--color-muted);
}

.scale-ticks span {
  white-space: nowrap;
}

.scale-ticks span:first-child {
  position: absolute;
  left: 0;
}

.scale-ticks span:last-child {
  position: absolute;
  right: 0;
}

.scale-ticks .is-freeze {
  position: absolute;
  transform: translateX(-50%);
}

.scale-aqi {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.scale-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.scale-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-ink);
}

.scale-swatch-bar {
  display: block;
  width: 1.15rem;
  height: 2.5rem;
  border-radius: 0.3rem;
}

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

a {
  color: var(--color-accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

input[type="search"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"] {
  box-sizing: border-box;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  font-size: 1rem;
  background: var(--color-surface);
  color: var(--color-ink);
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.notice {
  margin-top: 1.5rem;
  padding: 0.875rem 1rem;
  border-radius: 0.5rem;
}

.notice-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

[data-theme="dark"] .notice-error {
  background: #3f1a1a;
  color: #fecaca;
  border-color: #7f1d1d;
}

.notice-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

[data-theme="dark"] .notice-success {
  background: #052e24;
  color: #6ee7b7;
  border-color: #065f46;
}

.notice-caution {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

[data-theme="dark"] .notice-caution {
  background: #3b2a0a;
  color: #fde68a;
  border-color: #92400e;
}

.app-bar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0.75rem 1rem;
  pointer-events: none;
}

.app-bar a,
.app-bar button {
  pointer-events: auto;
}

.app-logo {
  display: flex;
  justify-content: center;
  margin: 0 1rem 3rem;
  line-height: 0;
}

.app-logo img {
  display: block;
  width: 15.625rem;
  max-width: 100%;
  height: auto;
}

.app-bar-link {
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.account-menu {
  position: relative;
  pointer-events: auto;
}

.account-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 50%;
  line-height: 0;
}

.account-link:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

@media (hover: hover) {
  .account-link:hover {
    background: rgb(15 23 42 / 6%);
  }
}

.menu-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgb(15 23 42 / 12%);
}

.account-menu-panel {
  position: absolute;
  z-index: 1;
  top: calc(100% + 0.125rem);
  right: 0;
  min-width: 11.5rem;
  max-width: calc(100vw - 1.5rem);
  margin: 0;
  padding: 0.25rem;
}

.account-menu-panel[hidden] {
  display: none;
}

.account-menu-sample .account-menu-panel {
  position: static;
  margin-top: 0.35rem;
}

.account-menu-form {
  margin: 0;
}

.account-menu-item {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  margin: 0;
  padding: 0.625rem 0.875rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.account-menu-item:focus-visible,
.account-menu-item:active {
  background: var(--color-wash);
  color: var(--color-ink);
  outline: var(--focus-ring);
  outline-offset: -2px;
}

@media (hover: hover) {
  .account-menu-item:hover {
    background: var(--color-wash);
    color: var(--color-ink);
  }
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1px solid var(--color-border);
  background: var(--color-line);
}

.user-avatar-fallback {
  background: var(--color-accent-strong);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 28px;
  text-align: center;
}

.flash-wrap {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0.75rem 1rem 0;
}

.auth-page {
  max-width: 24rem;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.auth-page h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}

.auth-page h2 {
  margin: 1.25rem 0 0.75rem;
  font-size: 1.125rem;
}

.auth-lead,
.auth-note {
  margin: 0 0 1rem;
  color: var(--color-muted);
}

.auth-divider {
  margin: 1rem 0;
  color: var(--color-muted);
  text-align: center;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"],
.auth-form select {
  width: 100%;
  margin-bottom: 0.75rem;
}

.google-form {
  margin: 0;
}

.google-logo {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.profile-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1.25rem;
  row-gap: 1rem;
  align-items: center;
}

.profile-email {
  grid-column: 1 / -1;
  margin: 0;
}

.profile-photo-manage {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

.profile-photo-label {
  margin-bottom: 0.35rem;
}

.profile-photo-manage .file-picker {
  margin: 0;
}

.profile-photo-manage .auth-note {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
}

.profile-photo {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  margin-right: 1rem;
}

.profile-form {
  grid-column: 1 / -1;
  grid-row: 3;
  width: 100%;
}

.profile-terms {
  margin-bottom: 0.75rem;
}

.profile-photo .user-avatar {
  width: 8rem;
  height: 8rem;
}

.profile-photo .user-avatar-fallback {
  line-height: 8rem;
  font-size: 2.5rem;
}

@media (max-width: 540px) {
  .profile-photo .user-avatar {
    width: 6.5rem;
    height: 6.5rem;
  }

  .profile-photo .user-avatar-fallback {
    line-height: 6.5rem;
    font-size: 2rem;
  }
}

.field-hint {
  display: block;
  margin-top: 0.15rem;
  color: var(--color-muted);
  font-size: 0.875rem;
  font-weight: 400;
}

.file-picker {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.visually-hidden,
input.visually-hidden {
  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;
  background: transparent;
}

.file-picker:focus-within .button {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.file-picker-name {
  min-width: 0;
  overflow: hidden;
  color: var(--color-muted);
  font-size: 0.875rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: 0.5rem;
}

.tile {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: 0.75rem;
  padding: 1rem;
}

.kicker {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.kicker-accent {
  color: var(--color-accent-strong);
}

.admin-style-section {
  margin: 0 0 1rem;
  padding: 1rem;
}

.admin-style-section h2 {
  margin-top: 0;
}

.admin-style-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.color-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  font-weight: 600;
  cursor: pointer;
}

.theme-toggle-track {
  position: relative;
  width: 2.5rem;
  height: 1.4rem;
  flex: none;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-line);
}

.theme-toggle-track::after {
  content: "";
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--color-surface);
  transition: transform 0.15s ease;
}

.theme-toggle:has(input:checked) .theme-toggle-track {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.theme-toggle:has(input:checked) .theme-toggle-track::after {
  transform: translateX(1.1rem);
}

.theme-toggle:focus-within .theme-toggle-track {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.account-menu-item.theme-toggle {
  justify-content: space-between;
  gap: 0.75rem;
}

.admin-style-note {
  margin: 0.75rem 0 0;
}

.admin-weather-icons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.admin-weather-icons li {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8125rem;
}

.admin-weather-icons .weather-icon svg {
  width: 3rem;
  height: 3rem;
}

.admin-map-pins {
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
}

.admin-map-pin {
  display: block;
  width: 40px;
}

.admin-pin-fill {
  display: block;
  width: 36px;
  height: 36px;
  background: linear-gradient(#38bdf8 0 58%, #4ade80 58% 100%);
}

.admin-weather-icons .picture-status-icon {
  width: 2.25rem;
  height: 2.25rem;
}

.admin-compass {
  display: inline-flex;
  width: 4rem;
  height: 4rem;
  color: var(--color-ink);
}

.admin-compass svg {
  width: 4rem;
  height: 4rem;
}

.account-section {
  margin: 0 0 0.75rem;
}

.account-section-toggle {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  background: var(--color-surface);
  color: var(--color-ink);
  border: 0;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
}

.account-section-toggle:hover {
  background: var(--color-surface-hover);
}

.account-section-toggle::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--color-muted);
  border-bottom: 2px solid var(--color-muted);
  transform: rotate(45deg);
}

.account-section-toggle[aria-expanded="true"] {
  border-radius: 0.5rem 0.5rem 0 0;
}

.account-section-toggle[aria-expanded="true"]::after {
  transform: rotate(-135deg);
}

.account-section-panel {
  padding: 0.25rem 1rem 1rem;
  border-top: 1px solid var(--color-line);
}

.account-section-panel h2 {
  margin-top: 0.75rem;
}

.account-places {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.account-place {
  border: 1px solid #bfdbfe;
  border-radius: 0.5rem;
  padding: 0.75rem 0.875rem;
}

.account-place + .account-place {
  margin-top: 0.75rem;
}

.account-place-primary {
  background: var(--color-wash);
}

.account-place-mark {
  margin-bottom: 0.5rem;
}

.account-place-where {
  margin: 0 0 0.75rem;
  color: var(--color-muted);
}

.account-place-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.account-place-name {
  flex: 1 1 12rem;
  min-width: 0;
}

.account-place-name input[type="text"] {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.account-place-save {
  white-space: nowrap;
}

.account-place-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.account-place-action {
  display: inline-block;
  margin: 0;
}

.zodiac-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.zodiac-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.5rem 0.25rem;
  border: 1px solid var(--color-hairline);
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  cursor: pointer;
}

.zodiac-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.choice:has(:checked),
.choice-selected {
  border-color: var(--color-accent);
  background: var(--color-wash);
}

.zodiac-choice:focus-within {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.zodiac-none {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-weight: 600;
}

.zodiac-none input {
  margin: 0;
}

[data-theme="dark"] .forecast-horoscope-symbol,
[data-theme="dark"] .zodiac-choice img,
[data-theme="dark"] img[src*="zodiac/"] {
  filter: invert(1) brightness(2.2);
}

.auth-page-wide {
  max-width: 40rem;
}

.terms-section {
  margin: 0 0 1rem;
  padding: 0.75rem 0.875rem;
}

.terms-section h2,
.terms-disclosure summary {
  font-size: 1rem;
  font-weight: 700;
}

.terms-disclosure summary {
  cursor: pointer;
}

.terms-copy p {
  margin: 0.75rem 0 0;
  color: var(--color-ink);
  font-size: 0.9375rem;
}

.terms-agreement {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  margin: 0.75rem 0 0;
  font-weight: 600;
}

.terms-agreement input {
  margin-top: 0.25rem;
  flex: none;
}

.terms-reaccept.button {
  margin-top: 0.5rem;
}
