/* цвета и шрифт */

:root {

  --font-main:
    'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
    Arial, sans-serif;
  --font-weight: 500;

  --paper: #e6e7e5;
  --instrument: #f4f4f2;
  --ink: #000000;
  --graphite: #73746f;
  --line: #c5c6c2;
  --hover: #e8e8e5;

  --still-1: #d4d6d8;
  --still-2: #a7abb0;
  --still-3: #f0f0f1;

  --fog-1: #cbd2e2;
  --fog-2: #a7b5d1;
  --fog-3: #e5e4ec;
  --fog-4: #b9b7cf;
  --drizzle-1: #a4b9d4;
  --drizzle-2: #718ec5;
  --drizzle-3: #d9dfed;
  --drizzle-4: #9699c5;
  --storm-1: #303346;
  --storm-2: #677197;
  --storm-3: #1c2031;
  --storm-4: #494364;
  --clear-1: #f7ecd6;
  --clear-2: #f2d64a;
  --clear-3: #f0ab5f;
  --clear-4: #f2bfc7;
}

/* страница */

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

html {
  background: var(--paper);
}

body {
  min-height: 100vh;
  font-family: var(--font-main);
  font-weight: var(--font-weight);
  font-size: 14px;
  line-height: 1.3;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.Station {
  display: grid;
  gap: 12px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 20px;
}

.Station,
.Station * {
  -webkit-user-select: none;
  user-select: none;
}

/* курсор */

.Cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: difference;
  will-change: transform;
}

.Cursor--visible {
  opacity: 1;
}

.Cursor__dot {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  transform: translate(-50%, -50%);
  transition: transform 0.12s ease;
}

.Cursor--interactive .Cursor__dot {
  transform: translate(-50%, -50%) scale(1.7);
}

@media (any-hover: hover) and (any-pointer: fine) {
  body[data-cursor='true'],
  body[data-cursor='true'] * {
    cursor: none !important;
  }
}

/* панель */

.Header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  padding: 14px 16px 14px 22px;
  background: var(--instrument);
  border-radius: 14px;
}

.Logo {
  margin-right: auto;
}

.Logo__name {
  font-size: 22px;
  font-weight: var(--font-weight);
  letter-spacing: -0.01em;
}

.Logo__note {
  margin-top: 2px;
  font-size: 12px;
  color: var(--graphite);
}

.WeatherSwitch {
  display: flex;
  flex-wrap: wrap;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
}

.WeatherSwitch__option {
  padding: 8px 14px;
  transition: background-color 0.2s;
}

.WeatherSwitch__option[aria-checked='true'] {
  background: var(--ink);
  color: var(--instrument);
}

.WeatherSwitch__option[aria-checked='false']:hover {
  background: var(--hover);
}

.WeatherSwitch__option[data-pending='true'] {
  box-shadow: inset 0 -2px var(--ink);
  background: var(--hover);
}

/* время */

.Time {
  display: flex;
  align-items: center;
  gap: 10px;
}

.Time__label {
  font-size: 12px;
  color: var(--graphite);
}

.Steps {
  display: flex;
  gap: 4px;
}

.Step {
  width: 10px;
  height: 10px;
  border: 1px solid var(--line);
}

.Step--beat {
  border-color: var(--graphite);
}

.Step--now {
  background: var(--ink);
  border-color: var(--ink);
}

/* старт и стоп */

.StartButton {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 112px;
  padding: 11px 18px 11px 16px;
  background: var(--ink);
  color: var(--instrument);
  border-radius: 6px;
  font-size: 15px;
}

.StartButton__icon {
  width: 0;
  height: 0;
  border-left: 10px solid currentColor;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

body[data-playing='true'] .StartButton__icon {
  width: 10px;
  height: 10px;
  border: 0;
  background: currentColor;
}

/* небо */

.Sky {
  position: relative;
  isolation: isolate;
  height: clamp(240px, 36vh, 360px);
  overflow: hidden;
  border-radius: 28px;
  background: var(--still-3);
  color: var(--ink);
  transition: color 1.8s ease;
}

body[data-playing='true'][data-weather='storm'] .Sky {
  color: #f4f4f2;
}

.Sky__weather {
  position: absolute;
  inset: -12%;
  transform-origin: 62% 55%;
  will-change: transform;
}

.Sky__layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.8s ease;
  will-change: transform;
}

.Sky__layer--still {
  --sky-cloud-a: var(--still-2);
  --sky-cloud-b: var(--still-3);
  --sky-cloud-c: var(--still-2);
  opacity: 1;
  background: linear-gradient(180deg, var(--still-3) 0%, var(--still-1) 100%);
}

.Sky__layer--fog {
  --sky-cloud-a: var(--fog-4);
  --sky-cloud-b: var(--fog-1);
  --sky-cloud-c: var(--fog-4);
  --sky-cloud-d: var(--fog-2);
  background: linear-gradient(170deg, var(--fog-3) 0%, var(--fog-1) 80%);
}

.Sky__layer--drizzle {
  --sky-cloud-a: var(--drizzle-4);
  --sky-cloud-b: var(--drizzle-1);
  --sky-cloud-c: var(--drizzle-4);
  --sky-cloud-d: var(--drizzle-2);
  background: linear-gradient(170deg, var(--drizzle-3) 0%, var(--drizzle-1) 80%);
}

.Sky__layer--storm {
  --sky-cloud-a: var(--storm-4);
  --sky-cloud-b: var(--storm-1);
  --sky-cloud-c: var(--storm-4);
  --sky-cloud-d: var(--storm-2);
  background: linear-gradient(170deg, var(--storm-3) 0%, var(--storm-1) 100%);
}

.Sky__layer--clear {
  --sky-cloud-a: var(--clear-3);
  --sky-cloud-b: var(--clear-4);
  --sky-cloud-c: var(--clear-2);
  --sky-cloud-d: var(--clear-2);
  background: linear-gradient(170deg, var(--clear-1) 0%, #fbf3e3 100%);
}

body[data-playing='true'] .Sky__layer--still {
  opacity: 0;
}

body[data-playing='true'][data-weather='fog'] .Sky__layer--fog,
body[data-playing='true'][data-weather='drizzle'] .Sky__layer--drizzle,
body[data-playing='true'][data-weather='storm'] .Sky__layer--storm,
body[data-playing='true'][data-weather='clear'] .Sky__layer--clear {
  opacity: 1;
}

/* облака */

.Cloud {
  position: absolute;
  border-radius: 50%;
  animation: drift 30s ease-in-out infinite alternate;
  will-change: transform;
}

.Cloud--a {
  left: -6%;
  top: -40%;
  width: 58%;
  height: 150%;
}

.Cloud--b {
  right: -6%;
  top: -10%;
  width: 52%;
  height: 130%;
  animation-duration: 38s;
  animation-delay: -14s;
}

.Cloud--c {
  left: 22%;
  bottom: -60%;
  width: 56%;
  height: 120%;
  animation-duration: 33s;
  animation-delay: -7s;
}

.Cloud--d {
  left: 50%;
  top: 14%;
  width: 30%;
  height: 80%;
  opacity: 0.5;
  animation-duration: 26s;
  animation-delay: -19s;
}

.Sky__layer .Cloud--a {
  background: radial-gradient(closest-side, var(--sky-cloud-a, var(--still-2)), transparent);
}
.Sky__layer .Cloud--b {
  background: radial-gradient(closest-side, var(--sky-cloud-b, var(--still-3)), transparent);
}
.Sky__layer .Cloud--c {
  background: radial-gradient(closest-side, var(--sky-cloud-c, var(--still-2)), transparent);
}
.Sky__layer .Cloud--d {
  background: radial-gradient(closest-side, var(--sky-cloud-d, var(--still-3)), transparent);
}

@keyframes drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(7%, 9%) scale(1.12);
  }
}

/* изобары */

.Sky__isobars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  pointer-events: none;
  will-change: transform;
}

.Sky__isobars path {
  stroke-width: 1;
  stroke-opacity: 0.22;
  vector-effect: non-scaling-stroke;
}

.Isobars__center circle {
  fill: currentColor;
  stroke: none;
}

.Isobars__center text {
  fill: var(--instrument);
  stroke: none;
  font-size: 20px;
  font-family: var(--font-main);
  text-anchor: middle;
  dominant-baseline: central;
}

body[data-playing='true'][data-weather='storm'] .Isobars__center text {
  fill: var(--storm-3);
}

/* зерно */

.Sky__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: multiply;
  will-change: transform;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.45 0 0 0 0 0.45 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* прогноз */

.Forecast {
  position: absolute;
  left: 30px;
  top: 26px;
}

.Forecast__weather {
  font-size: 48px;
  font-weight: var(--font-weight);
  line-height: 1;
  letter-spacing: -0.025em;
}

.Forecast__tempo {
  margin-top: 10px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.Sky__hint {
  position: absolute;
  left: 30px;
  bottom: 24px;
  font-size: 13px;
  color: var(--graphite);
  transition: opacity 0.4s;
}

body[data-playing='true'] .Sky__hint {
  opacity: 0;
}

/* приборы */

.Instruments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.Instrument {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 18px;
  min-height: 372px;
  padding: 18px 16px 20px 22px;
  background: var(--instrument);
  border-radius: 14px;
}

.Instrument__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.Instrument__title {
  margin-right: auto;
}

.Instrument__name {
  font-size: 20px;
  font-weight: var(--font-weight);
  letter-spacing: -0.01em;
}

.Instrument__role {
  margin-top: 2px;
  font-size: 12px;
  color: var(--graphite);
}

.Instrument__controls {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 22px 12px;
  margin-top: auto;
}

.Fader + .Knob {
  margin-left: auto;
}

.Instrument__controls > :last-child {
  margin-right: auto;
}

.Instrument--drops .Instrument__controls {
  justify-content: center;
  margin-left: -6px;
}

.Instrument--drops .Knob {
  margin-inline: 0;
}

.WavePicker,
.Instrument__controls,
.Gusts {
  transition: opacity 0.3s;
}

.Instrument--muted .WavePicker,
.Instrument--muted .Instrument__controls,
.Instrument--muted .Gusts {
  opacity: 0.32;
}

/* подписи */

.Control__caption {
  display: flex;
  align-items: center;
  gap: 6px;
}

.Control__label {
  font-size: 13px;
}

.Control__value {
  min-width: 34px;
  padding: 2px 6px;
  border: 1.2px solid var(--ink);
  border-radius: 999px;
  font-size: 11px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ползунки */

.Fader {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.Fader__body {
  width: 62px;
  height: 182px;
  margin-left: -7px;
  touch-action: none;
  cursor: ns-resize;
}

.Fader__body svg,
.Knob__dial svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.Fader__tube {
  fill: var(--instrument);
  stroke: var(--ink);
  stroke-width: 1.2;
}

.Fader__mercury,
.Fader__bulb,
.Fader__thumb {
  fill: var(--ink);
}

.Fader__tick {
  stroke: var(--graphite);
  stroke-width: 1;
}

.Fader__tick--major {
  stroke: var(--ink);
  stroke-width: 1.4;
}

.Fader__num {
  fill: var(--graphite);
  font-size: 10px;
  font-family: var(--font-main);
  dominant-baseline: central;
}

/* ручки */

.Knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.Knob__dial {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  touch-action: none;
  cursor: ns-resize;
}

.Knob--lg .Knob__dial {
  width: 138px;
  height: 138px;
}

.Knob--xl .Knob__dial {
  width: 184px;
  height: 184px;
}

.Knob__dial line,
.Knob__face {
  vector-effect: non-scaling-stroke;
}

.Knob__face {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
}

.Knob__tick {
  stroke: var(--line);
  stroke-width: 1.1;
}

.Knob__tick--major {
  stroke-width: 1.7;
}

.Knob__tick--lit {
  stroke: var(--ink);
}

.Knob__needle line {
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.Knob__hub {
  fill: var(--ink);
}

/* волны */

.WavePicker {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  margin-left: -6px;
}

.WaveButton {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 4px;
}

.WaveButton:hover {
  background: var(--hover);
}

.WaveButton svg {
  width: 20px;
  height: 20px;
  overflow: visible;
}

.WaveButton svg * {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.WaveButton[aria-checked='true'] svg * {
  fill: var(--ink);
}

.WavePicker__name {
  margin-left: 8px;
  font-size: 12px;
  color: var(--graphite);
}

/* вкл и выкл */

.Mute {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  min-width: 60px;
  height: 30px;
  margin: -2px -4px 0 0;
  border-radius: 4px;
}

.Mute__label {
  font-size: 11px;
}

.Mute::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--ink);
}

.Mute[aria-pressed='true']::before {
  background: var(--ink);
}

.Mute:hover {
  background: var(--hover);
}

/* лампы */

.Lamp {
  flex: none;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  transition: background-color 0.25s;
}

.Lamp--on {
  background: var(--ink);
  transition: none;
}

.Lamp--drop,
.Lamp--cloud {
  margin-top: 8px;
}

.Gusts {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 34px;
  font-size: 12px;
  color: var(--graphite);
}

.Gust {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* адаптив */

@media (max-width: 1100px) {
  .Instruments {
    grid-template-columns: 1fr 1fr;
  }

  .Instrument--wind {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .Station {
    padding: 12px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    -webkit-tap-highlight-color: transparent;
  }

  .Header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'logo start'
      'weather weather'
      'time time';
    gap: 14px 10px;
    padding: 16px;
  }

  .Logo {
    grid-area: logo;
    min-width: 0;
    margin-right: 0;
  }

  .Logo__name {
    font-size: 20px;
  }

  .Logo__note {
    font-size: 11px;
  }

  .StartButton {
    grid-area: start;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 48px;
    padding: 10px 12px;
    font-size: 14px;
    touch-action: manipulation;
  }

  .WeatherSwitch {
    grid-area: weather;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .WeatherSwitch__option {
    min-width: 0;
    min-height: 44px;
    padding: 8px 4px;
    font-size: 13px;
    touch-action: manipulation;
  }

  .Time {
    grid-area: time;
    justify-content: space-between;
    gap: 10px;
  }

  .Steps {
    display: grid;
    flex: 1;
    grid-template-columns: repeat(16, minmax(0, 1fr));
    gap: 4px;
    max-width: 256px;
  }

  .Step {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  .Sky {
    height: clamp(200px, 28vh, 240px);
    height: clamp(200px, 28svh, 240px);
    border-radius: 22px;
  }

  .Forecast {
    top: 20px;
    left: 20px;
  }

  .Forecast__weather {
    font-size: 36px;
  }

  .Forecast__tempo {
    font-size: 14px;
  }

  .Sky__hint {
    right: 20px;
    bottom: 20px;
    left: 20px;
    font-size: 12px;
    line-height: 1.4;
  }

  .Instruments {
    grid-template-columns: 1fr;
  }

  .Instrument--wind {
    grid-column: auto;
  }

  .Instrument {
    gap: 16px;
    min-height: 0;
    padding: 16px 18px 20px;
  }

  .Instrument__head {
    align-items: center;
  }

  .Instrument__head .Lamp {
    margin-top: 0;
  }

  .Mute {
    min-width: 64px;
    height: 44px;
    margin-top: 0;
    touch-action: manipulation;
  }

  .Mute__label {
    font-size: 12px;
  }

  .WavePicker {
    flex-wrap: wrap;
    gap: 4px;
    margin-left: -4px;
  }

  .WaveButton {
    flex: none;
    width: 44px;
    height: 44px;
    touch-action: manipulation;
  }

  .WavePicker__name {
    flex-basis: 100%;
    margin-left: 4px;
  }

  .Instrument__controls {
    justify-content: space-between;
    gap: 16px 12px;
    margin-top: 8px;
  }

  .Instrument__controls > * {
    margin-inline: 0;
  }

  .Instrument--drops .Instrument__controls {
    gap: 16px;
    margin-left: 0;
  }

  .Knob--xl .Knob__dial {
    width: clamp(136px, 40vw, 184px);
    height: clamp(136px, 40vw, 184px);
  }

  .Instrument--wind .Knob__dial {
    width: clamp(76px, 22vw, 92px);
    height: clamp(76px, 22vw, 92px);
  }

  .Control__caption {
    gap: 4px;
  }

  .Control__label {
    font-size: 12px;
  }

  .Gusts {
    flex-wrap: wrap;
    gap: 10px 16px;
  }
}

@media (max-width: 360px) {
  .Header {
    padding: 14px;
  }

  .Logo__name {
    font-size: 18px;
  }

  .WeatherSwitch__option {
    font-size: 12px;
  }
}

/* меньше движения */

@media (prefers-reduced-motion: reduce) {
  .Cursor__dot {
    transition: none;
  }

  .Cloud {
    animation: none;
  }

  .Sky__weather {
    transform: none;
  }

  .Sky__layer {
    transition: none;
  }
}
