@font-face {
  font-family: 'DM Sans';
  src: url('assets/fonts/dm-sans.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Serif';
  src: url('assets/fonts/instrument-serif.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Serif';
  src: url('assets/fonts/instrument-serif-italic.woff2') format('woff2');
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f6f5ee;
  --panel: #fdfcf7;
  --ink: #202c24;
  --muted: #535e53;
  --green: #37664e;
  --line: #dfdfd3;
  --serif: 'Instrument Serif', Georgia, serif;
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p { margin: 0; }
button { color: inherit; font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.wrap { width: min(1200px, calc(100% - 88px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); }
.header-content { min-height: 73px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 700; letter-spacing: -.75px; }
.brand-mark, .channel-icon, .preset-icon { display: grid; place-items: center; flex: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: #294b3c; color: #e4eee1; }
[data-icon]::before {
  content: '';
  display: block;
  width: var(--icon-size, 20px);
  height: var(--icon-size, 20px);
  background: currentColor;
  mask: url('assets/icons.png') center calc(var(--icon-index, 0) * 12.5%) / 100% 900% no-repeat;
}
[data-icon='droplets'] { --icon-index: 1; }
[data-icon='wind'] { --icon-index: 2; }
[data-icon='thunder'] { --icon-index: 3; }
[data-icon='volume'] { --icon-index: 4; }
[data-icon='reset'] { --icon-index: 5; --icon-size: 14px; }
[data-icon='drizzle'] { --icon-index: 6; }
[data-icon='forest'] { --icon-index: 7; }
[data-icon='window'] { --icon-index: 8; }
[data-icon='variation']::before {
  mask: none;
  background:
    linear-gradient(currentColor 0 0) 13% 57% / 2px 5px no-repeat,
    linear-gradient(currentColor 0 0) 37% 57% / 2px 10px no-repeat,
    linear-gradient(currentColor 0 0) 63% 57% / 2px 15px no-repeat,
    linear-gradient(currentColor 0 0) 87% 57% / 2px 8px no-repeat;
}
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid #dbded1;
  border-radius: 999px;
  color: #4c5c4d;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #899082; }
.status[data-playing='true'] { background: #e8eee3; }
.status[data-playing='true'] .status-dot { background: #437d56; }

main { padding-bottom: 48px; }
.intro { padding-block: 38px 27px; }
.headline { font: 400 clamp(64px, 7vw, 94px)/.96 var(--serif); letter-spacing: -.026em; }
.headline em { color: var(--green); }
.intro-copy { margin-top: 12px; font-size: 15px; line-height: 1.55; color: var(--muted); }

.console { display: grid; grid-template-columns: minmax(0, 1.74fr) minmax(345px, 1fr); gap: 20px; }
.player {
  isolation: isolate;
  position: relative;
  display: flex;
  align-items: end;
  min-height: 450px;
  overflow: hidden;
  border-radius: 18px;
  background: #17312c;
  color: #fffdf4;
}
.landscape, #surface, .player::after { position: absolute; inset: 0; width: 100%; height: 100%; }
.landscape { z-index: -3; object-fit: cover; object-position: center 55%; }
#surface { z-index: -2; pointer-events: none; opacity: .28; }
.player::after { content: ''; z-index: -1; background: linear-gradient(180deg, transparent 46%, #071711e8 100%); }
.player-controls { display: flex; justify-content: space-between; align-items: end; gap: 18px; padding: 28px 30px; width: 100%; }
.current-mix h2 { font: 400 clamp(46px, 5vw, 59px)/.94 var(--serif); letter-spacing: -.018em; }
.current-mix p { font-size: 14px; margin-top: 9px; color: #ebeee4; line-height: 1.4; }
.play-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 62px;
  height: 62px;
  margin-bottom: 1px;
  padding: 0;
  color: #282e25;
  background: #f5c3a9;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 5px #f6c0a329;
  transition: background .16s, box-shadow .16s;
}
.play-button:hover:not(:disabled) { background: #ffd1b8; box-shadow: 0 0 0 7px #f6c0a344; }
.play-button:focus-visible { outline-color: #fff5de; }
.play-button:disabled { opacity: .72; }
.play-icon {
  width: 18px;
  height: 21px;
  margin-left: 3px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.play-button[data-playing='true'] .play-icon {
  margin-left: 0;
  clip-path: polygon(0 0, 34% 0, 34% 100%, 0 100%, 0 0, 66% 0, 100% 0, 100% 100%, 66% 100%, 66% 0);
}
.startup-message { position: absolute; inset: 14px 14px auto auto; padding: 7px 12px; background: #0c251e; border-radius: 10px; font-size: 13px; }

.panel {
  display: flex;
  flex-direction: column;
  padding: 22px 25px 19px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 2px 5px #322c1810;
}
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 11px; }
.panel h2, .presets h2 { font: 400 33px/1.05 var(--serif); letter-spacing: -.01em; }
.reset-button {
  display: flex;
  gap: 5px;
  align-items: center;
  min-height: 36px;
  padding: 4px 9px;
  background: transparent;
  border: 1px solid #e6e6da;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.reset-button:hover:not(:disabled) { background: #eef1e7; border-color: #d8e0d4; }
#channels { display: grid; flex: 1; min-width: 0; padding: 0; margin: 0; border: 0; }
.channel {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  grid-template-rows: auto 22px;
  align-content: center;
  align-items: center;
  column-gap: 12px;
  min-height: 61px;
}
.channel-icon { grid-row: span 2; width: 38px; height: 38px; background: #edf1e8; color: #3a654f; border-radius: 10px; }
.channel label { font-size: 14px; font-weight: 650; }
.channel output { font-size: 12px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.channel input {
  grid-column: 2 / -1;
  appearance: none;
  background: transparent;
  width: 100%;
  height: 22px;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 999px;
  --slider-fill: linear-gradient(to right, var(--green) 0 var(--level), #e5e8df var(--level) 100%);
}
.channel input::-webkit-slider-runnable-track { height: 5px; background: var(--slider-fill); border-radius: 999px; }
.channel input::-moz-range-track { height: 5px; background: var(--slider-fill); border-radius: 999px; }
.channel input::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--green);
  background: var(--green);
}
.channel input::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--green);
  background: var(--green);
}
.master { margin-top: 8px; padding-top: 13px; border-top: 1px solid var(--line); }
.master .channel-icon { background: #f4ede1; color: #6c503c; }
.audio-error { color: #802e2d; margin-top: 10px; font-size: 14px; }

.presets { margin-top: 27px; }
.preset-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.preset {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  min-height: 79px;
  padding: 11px 29px 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  transition: background .16s, border-color .16s;
}
.preset:hover:not(:disabled) { border-color: #9cad99; }
.preset[aria-pressed='true'] { background: #e9eee3; border-color: #7e9e84; }
.preset-icon { width: 40px; height: 40px; background: #edf1e8; color: #426951; border-radius: 9px; }
.preset[aria-pressed='true'] .preset-icon { background: #d8e4d5; }
.preset-copy { display: grid; gap: 3px; }
.preset-copy strong { font-size: 14px; line-height: 1.2; font-weight: 700; }
.preset-copy > span { font-size: 12px; line-height: 1.3; color: var(--muted); }
.preset-check { display: none; position: absolute; top: 12px; right: 12px; width: 15px; height: 15px; background: var(--green); border-radius: 50%; }
.preset[aria-pressed='true'] .preset-check { display: grid; place-items: center; }
.preset-check::after { content: ''; width: 7px; height: 4px; border: solid #fff; border-width: 0 0 1.5px 1.5px; transform: translateY(-.75px) rotate(-45deg); }

@media (max-width: 980px) {
  .wrap { width: calc(100% - 48px); }
  .preset { padding-right: 20px; }
  .preset-check { top: 7px; right: 7px; width: 12px; height: 12px; }
}

@media (max-width: 760px) {
  .header-content { min-height: 62px; }
  .intro { padding-block: 34px 23px; }
  .console { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .player { min-height: clamp(275px, 65vw, 420px); }
  .panel { padding: 19px 22px; }
  .preset-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .wrap { width: calc(100% - 32px); }
  .headline { font-size: clamp(53px, 15vw, 64px); }
  .intro-copy { font-size: 14px; margin-top: 9px; }
  .player-controls { padding: 20px; }
  .current-mix h2 { font-size: 44px; }
  .current-mix p { font-size: 12px; }
  .play-button { width: 52px; height: 52px; }
  .play-icon { width: 15px; height: 17px; }
  .preset-list { gap: 8px; }
  .preset { padding: 9px 12px 9px 8px; gap: 7px; }
  .preset-icon { width: 31px; height: 32px; }
  .preset-icon { --icon-size: 17px; }
  .preset-copy strong { font-size: 13px; }
  .preset-copy > span { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
