@font-face {
  font-family: 'Instrument Serif';
  src: url('/assets/instrument-serif.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
:root { color-scheme: dark; background: #17251c; color: #f4f0da; }
* { box-sizing: border-box; }
body { margin: 0; }
.forest {
  isolation: isolate;
  position: relative;
  display: grid;
  align-items: end;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
}
.forest picture, .landscape, .forest::before, .forest::after {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.forest picture { z-index: -3; overflow: hidden; }
.landscape { object-fit: cover; object-position: 55% 43%; }
.forest::before {
  content: '';
  pointer-events: none;
  z-index: -2;
  background: linear-gradient(to top, rgba(8,18,11,.66), rgba(12,20,13,.17) 24%, transparent 52%);
}
.forest::after { content: ''; z-index: -1; pointer-events: none; }
.edge {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding: 0 max(clamp(24px,5vw,90px), env(safe-area-inset-right))
           max(clamp(32px,7vh,84px), calc(env(safe-area-inset-bottom) + 20px))
           max(clamp(24px,5vw,90px), env(safe-area-inset-left));
}
h1 {
  margin: 0;
  font: 400 clamp(76px,11.5vw,190px)/.92 'Instrument Serif', Georgia, serif;
  letter-spacing: -.045em;
}
.dot { color: #d7c698; }
.sound {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-end;
  min-height: 44px;
  padding: 0 3px;
  margin-bottom: .12em;
  font: 500 13px/1.2 system-ui, sans-serif;
  letter-spacing: .035em;
  cursor: pointer;
}
.sound[hidden] { display: none; }
.sound:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; border-radius: 2px; }
.sound:hover .sound-label { text-decoration: underline; text-underline-offset: 4px; }
.levels { display: flex; gap: 2px; height: 15px; align-items: center; }
.levels i { background: currentColor; border-radius: 1px; width: 2px; height: 4px; }
.levels i:nth-child(2) { height: 9px; }
.levels i:nth-child(3) { height: 14px; }
.levels i:nth-child(4) { height: 7px; }
.levels i:nth-child(5) { height: 10px; }
.feedback { position: absolute; bottom: max(6px,env(safe-area-inset-bottom)); right: 5vw; font: 13px/1.3 system-ui,sans-serif; }
@media (max-width: 520px) {
  .landscape { object-position: 55% 50%; }
  .edge { gap: 5px; }
  h1 { font-size: clamp(62px,18vw,90px); }
  .sound { font-size: 12px; gap: 6px; margin-bottom: -3px; }
}
@media (prefers-reduced-motion: no-preference) {
  .forest::after { background: #13251e; animation: dawn 1.9s cubic-bezier(.16,.7,.28,1) both; }
  .landscape { animation: settle 3.4s cubic-bezier(.18,.7,.32,1) both; }
  .sound[aria-pressed='true'] i { animation: pulse .85s ease-in-out infinite alternate; }
  .sound[aria-pressed='true'] i:nth-child(2n) { animation-delay: -.3s; }
  .sound[aria-pressed='true'] i:nth-child(3n) { animation-delay: -.64s; }
  @keyframes dawn { from { opacity: .68; } to { opacity: 0; } }
  @keyframes settle { from { transform: scale(1.025); } to { transform: scale(1); } }
  @keyframes pulse { from { transform: scaleY(.45); } to { transform: scaleY(1); } }
}

.arrival { display: grid; justify-items: start; gap: clamp(9px,1.9vh,18px); }
.enter {
  border: 1px solid rgba(244,240,218,.5);
  border-radius: 2px;
  background: rgba(15,28,18,.46);
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 20px;
  min-height: 44px;
  padding: 8px 15px;
  font: 500 13px/1.25 system-ui,sans-serif;
  letter-spacing: .025em;
  cursor: pointer;
}
.enter[hidden], #clearing[hidden] { display: none; }
.enter .arrow { font-size: 19px; line-height: 1; }
.enter:hover { background: #e9e5cf; color: #1b3023; }
.enter:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
.in-clearing .arrival { display: none; }
.in-clearing .edge { pointer-events: none; justify-content: flex-end; }
.in-clearing .sound { position: relative; z-index: 8; pointer-events: auto; }
.in-clearing .feedback { z-index: 8; }

.forest picture::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  background-size: cover;
  background-position: 55% 43%;
  pointer-events: none;
}
.in-clearing .forest picture::after {
  background-image: url('/assets/blue-hour.webp');
  opacity: 1;
}
@media (max-aspect-ratio: 3/4) {
  .in-clearing .forest picture::after { background-image: url('/assets/blue-hour-portrait.webp'); }
}
@media (max-width: 520px) {
  .forest picture::after { background-position: 55% 50%; }
}
@media (prefers-reduced-motion: no-preference) {
  .forest picture::after { transition: opacity 1.15s ease; }
}
