/* Windchimes.
 *
 * The scene is the page. Chrome sits on top of it in translucent slabs and
 * gets out of the way; nothing here should compete with a chime moving in the
 * middle of the frame.
 */

:root {
  --ink: #f3ece0;
  --ink-dim: rgba(243, 236, 224, 0.62);
  --slab: rgba(16, 22, 28, 0.62);
  --slab-solid: rgba(14, 19, 25, 0.94);
  --edge: rgba(243, 236, 224, 0.16);
  --accent: #f0cd93;
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0d1218;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

.panel {
  position: fixed;
  background: var(--slab);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  z-index: 5;
}

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

.fine {
  font-size: 12px;
  line-height: 1.5;
}

/* Readout ---------------------------------------------------------------- */

.readout {
  top: 16px;
  top: calc(16px + env(safe-area-inset-top));
  left: 16px;
  left: calc(16px + env(safe-area-inset-left));
  padding: 12px 16px;
  max-width: min(420px, calc(100vw - 32px));
}

.place {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.place .muted {
  font-size: 13px;
  font-weight: 400;
}

.conditions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 13px;
}

.conditions b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.conditions span.label {
  color: var(--ink-dim);
}

#weather-status {
  margin-top: 6px;
}

/* Controls --------------------------------------------------------------- */

.controls {
  left: 50%;
  bottom: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100vw - 24px);
}

/* Thin rules that split the bar into its three jobs: what to listen to,
 * how it sounds, what to look at. Hidden once the bar wraps, where a
 * stretched divider lands mid-row and means nothing. */
.controls .divider {
  width: 1px;
  align-self: stretch;
  margin: 4px 2px;
  background: var(--edge);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

button.ghost {
  background: transparent;
  border-color: var(--edge);
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}

button.ghost:hover {
  background: rgba(243, 236, 224, 0.09);
}

button.ghost[aria-pressed="false"] {
  color: var(--ink-dim);
}

button.primary {
  background: var(--accent);
  color: #17202a;
  border: none;
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 999px;
}

button.primary:hover {
  background: #f8dcaa;
}

.field {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  padding: 0 6px;
}

.field > span {
  color: var(--ink-dim);
  white-space: nowrap;
}

.field.slider {
  min-width: 150px;
}

select {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 7px 8px;
  max-width: 190px;
}

select option {
  background: #131a21;
  color: var(--ink);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: rgba(243, 236, 224, 0.28);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* Overlays --------------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 16, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px;
}

.start-card {
  max-width: 520px;
  text-align: center;
}

.start-card h1 {
  font-size: clamp(34px, 7vw, 56px);
  margin: 0 0 6px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.start-card p {
  font-size: 15px;
  line-height: 1.65;
  margin: 0 0 14px;
}

.start-card .fine {
  margin-top: 14px;
}

.globe-card {
  background: var(--slab-solid);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 18px;
  width: min(940px, 100%);
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
}

.globe-head,
.details-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.globe-head h2,
.details-head h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
}

button.close {
  background: transparent;
  border: none;
  font-size: 26px;
  line-height: 1;
  padding: 0 6px;
  color: var(--ink-dim);
}

button.close:hover {
  color: var(--ink);
}

.globe-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  min-height: 0;
  flex: 1;
  margin: 10px 0;
}

#globe {
  width: min(46vh, 420px);
  height: min(46vh, 420px);
  flex: 0 0 auto;
  touch-action: none;
  cursor: grab;
}

.location-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-width: 220px;
  max-height: min(46vh, 420px);
}

.location-list li {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.location-list li:hover {
  background: rgba(243, 236, 224, 0.08);
}

.location-list li[aria-selected="true"] {
  background: rgba(240, 205, 147, 0.16);
  color: var(--accent);
}

.location-list em {
  font-style: normal;
  font-size: 12px;
  color: var(--ink-dim);
}

/* Details ---------------------------------------------------------------- */

.details {
  top: 16px;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  bottom: 88px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  width: min(400px, calc(100vw - 32px));
  padding: 16px;
  overflow-y: auto;
}

.details h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-dim);
  margin: 20px 0 8px;
  font-weight: 600;
}

.details h3:first-of-type {
  margin-top: 12px;
}

.details p {
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

th {
  text-align: right;
  font-weight: 500;
  color: var(--ink-dim);
  padding: 3px 6px;
  border-bottom: 1px solid var(--edge);
}

th:first-child,
td:first-child {
  text-align: left;
}

td {
  text-align: right;
  padding: 3px 6px;
  border-bottom: 1px solid rgba(243, 236, 224, 0.07);
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  font-size: 13px;
}

.kv dt {
  color: var(--ink-dim);
}

.kv dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.custom {
  right: 16px;
  bottom: 88px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  width: min(320px, calc(100vw - 32px));
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.custom .field.slider {
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  padding: 0;
}

.custom .field.slider > span {
  display: flex;
  justify-content: space-between;
}

.custom .field.slider b {
  color: var(--ink);
  font-weight: 600;
}

/* Lives inside the readout panel, under the weather it credits. It used to be
 * a fixed footer in the bottom-right corner, where the controls bar covered
 * it on any screen narrow enough to make the bar wrap. */
.credits {
  margin-top: 8px;
  font-size: 11px;
}

.credits a {
  color: var(--ink-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(243, 236, 224, 0.3);
}

.credits a:hover {
  color: var(--ink);
}

@media (max-width: 760px) {
  .readout {
    top: 8px;
    top: calc(8px + env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    max-width: none;
    padding: 8px 12px;
  }
  .controls {
    bottom: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    gap: 4px;
    padding: 6px;
  }
  .controls .divider {
    display: none;
  }
  .field.slider {
    min-width: 110px;
  }
  select {
    max-width: 150px;
  }
  .details {
    top: auto;
    right: 8px;
    left: 8px;
    bottom: 96px;
    bottom: calc(96px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 52vh;
  }
  .custom {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 96px;
    bottom: calc(96px + env(safe-area-inset-bottom));
  }
  .globe-body {
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
  }
  #globe {
    width: min(64vw, 300px);
    height: min(64vw, 300px);
  }
  .location-list {
    max-height: none;
    width: 100%;
  }
}
