/* Copyright (c) 2026 Neil Fluhr. All rights reserved. */

:root,
[data-theme="dark"] {
  --page: #111;
  --bg: #1c1c1e;
  --bg-elevated: #2c2c2e;
  --text: #f2f2f7;
  --muted: #8e8e93;
  --blue: #0a84ff;
  --orange: #ff9f0a;
  --green: #34c759;
  --icon: #c7c7cc;
  --unit: #aeaeb2;
  --forecast-text: #d1d1d6;
  --gauge-track: #3d3d42;
  --toast-bg: #3a3a3c;
  --toast-text: #fff;
  --phone-ring: #2c2c2e;
  --phone-shadow: rgba(0, 0, 0, 0.45);
  --row: 46px;
  color-scheme: dark;
}

[data-theme="light"] {
  --page: #d8d8de;
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --blue: #007aff;
  --orange: #ff9500;
  --green: #34c759;
  --icon: #636366;
  --unit: #8e8e93;
  --forecast-text: #3a3a3c;
  --gauge-track: #d1d1d6;
  --toast-bg: #3a3a3c;
  --toast-text: #fff;
  --phone-ring: #c7c7cc;
  --phone-shadow: rgba(60, 60, 67, 0.22);
  color-scheme: light;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
}

.phone {
  width: min(430px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  padding: calc(10px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
}

.top-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  margin-bottom: 28px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 2px;
}

.top-bar h1 {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  letter-spacing: -0.2px;
}

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.theme-icon-moon {
  display: none;
}

[data-theme="light"] .theme-icon-sun {
  display: none;
}

[data-theme="light"] .theme-icon-moon {
  display: block;
}

.house-switch {
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 0;
}

.house-switch .icon-btn {
  color: var(--muted);
}

.house-switch .icon-btn[aria-selected="true"] {
  color: var(--blue);
}

.now {
  text-align: center;
  padding-bottom: 8px;
}

.kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.hero {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.hero-icon {
  width: 78px;
  height: 64px;
  color: var(--icon);
}

.hero-icon svg {
  width: 100%;
  height: 100%;
}

.hero-temp {
  display: flex;
  align-items: flex-start;
  color: var(--orange);
  font-weight: 300;
  line-height: 0.9;
  letter-spacing: -2px;
}

.hero-temp #temp {
  font-size: 76px;
}

.hero-temp .degree {
  font-size: 42px;
  margin-top: 6px;
  letter-spacing: 0;
}

.hero-temp .unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 16px 0 0 4px;
  color: var(--unit);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
}

.hero-temp .unit svg {
  width: 11px;
  height: 18px;
  margin-bottom: 2px;
}

.feels {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}

.condition {
  margin-top: 16px;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.4px;
}

.place {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.details {
  margin-top: 4px;
}

.details-toggle {
  appearance: none;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 2px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.details-toggle .chevron {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: var(--blue);
}

.details.is-collapsed .row {
  display: none;
}

.row {
  min-height: var(--row);
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) max-content;
  column-gap: 10px;
  align-items: center;
  padding: 1px 0;
}

.glyph {
  width: 30px;
  height: 30px;
  color: var(--icon);
}

.glyph svg {
  width: 30px;
  height: 30px;
  display: block;
}

.label {
  font-size: 16px;
  letter-spacing: -0.2px;
}

.label.stacked {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.label small {
  color: var(--muted);
  font-size: 12px;
}

.value {
  font-size: 16px;
  font-weight: 600;
  text-align: right;
  letter-spacing: -0.2px;
  white-space: nowrap;
  justify-self: end;
  font-variant-numeric: tabular-nums;
}

.tonight {
  margin-top: 18px;
}

.forecast-card {
  margin-top: 14px;
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 16px 16px 18px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 6%, transparent);
}

.forecast-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.forecast-name {
  font-size: 15px;
  font-weight: 600;
}

.forecast-short {
  margin-top: 3px;
  color: var(--muted);
  font-size: 15px;
}

.forecast-temp {
  color: var(--orange);
  font-size: 34px;
  font-weight: 300;
  letter-spacing: -1px;
  line-height: 1;
}

.forecast-detail {
  margin-top: 12px;
  color: var(--forecast-text);
  font-size: 15px;
  line-height: 1.45;
}

.week {
  margin-top: 18px;
}

.day-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.day-strip.is-expanded {
  grid-template-columns: repeat(4, 1fr);
}

.day-card {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 10px 4px 12px;
  text-align: center;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 6%, transparent);
}

.day-card .name {
  font-size: 12px;
  font-weight: 600;
}

.day-card .wx-icon {
  width: 28px;
  height: 24px;
  margin: 8px auto 6px;
  color: var(--icon);
}

.day-card .wx-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.day-card .hi {
  color: var(--orange);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}

.day-card .lo {
  color: var(--muted);
  font-size: 13px;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

.week-toggle {
  appearance: none;
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--blue);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 6%, transparent);
}

.updated {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.copyright {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: var(--toast-text);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  z-index: 10;
}

.is-loading .value,
.is-loading .condition,
.is-loading #temp {
  opacity: 0.45;
}

@media (min-width: 520px) {
  body {
    padding: 24px 0;
    background: var(--page);
  }

  .phone {
    min-height: calc(100vh - 48px);
    border-radius: 28px;
    box-shadow: 0 0 0 1px var(--phone-ring), 0 30px 80px var(--phone-shadow);
  }
}
