@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600&family=Playfair+Display:ital,wght@1,600&display=swap');

:root {
  color-scheme: light;
  --paper: #efe5d2;
  --ink: #152920;
  --muted: #6e756b;
  --wood: #783724;
  --wood-dark: #3e1b14;
  --brass: #d7a83f;
  --cream: #f7efd9;
}

* { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 13% 22%, rgba(255,255,255,.32) 0 1px, transparent 2px),
    linear-gradient(100deg, rgba(255,255,255,.12), transparent 35%),
    var(--paper);
  background-size: 19px 19px, auto, auto;
  color: var(--ink);
  font-family: Manrope, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .15;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.4'/%3E%3C/svg%3E");
}

button, input { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: auto;
  display: flex;
  flex-direction: column;
}

.masthead {
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(21,41,32,.28);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  letter-spacing: .16em;
}

.brand { display: flex; align-items: center; gap: 13px; font-weight: 500; }
.brand-mark { width: 26px; height: 26px; border: 1px solid; border-radius: 50%; position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: var(--ink); }
.brand-mark::before { width: 1px; height: 16px; left: 12px; top: 4px; }
.brand-mark::after { width: 16px; height: 1px; left: 4px; top: 12px; }
.masthead > p { color: var(--muted); }

.hero {
  flex: 1;
  display: grid;
  grid-template-columns: .85fr 1.35fr;
  align-items: center;
  gap: clamp(50px, 8vw, 120px);
  padding: 76px 0 62px;
}

.eyebrow, .hint, footer, .status, .track-info span, .tempo span {
  font-family: "DM Mono", monospace;
  font-size: 10px;
  letter-spacing: .18em;
}

.eyebrow { margin: 0 0 23px; color: #935035; }
h1 { margin: 0; font-size: clamp(64px, 7.2vw, 106px); line-height: .82; letter-spacing: -.065em; font-weight: 500; }
h1 em { font-family: "Playfair Display", serif; font-weight: 600; color: #9a4d31; }
.lede { max-width: 380px; margin: 43px 0 0; color: #56645b; line-height: 2; font-size: 13px; }

.instrument-wrap { width: 100%; }
.instrument {
  position: relative;
  overflow: hidden;
  border: 1px solid #301510;
  border-radius: 3px;
  background:
    linear-gradient(105deg, rgba(255,255,255,.07), transparent 30%),
    repeating-linear-gradient(4deg, transparent 0 13px, rgba(43,13,7,.08) 14px 15px),
    var(--wood);
  box-shadow: 0 28px 50px rgba(57,29,16,.18), inset 0 0 0 5px rgba(105,47,31,.9);
}

.lid-line { position: absolute; z-index: 2; left: 5px; right: 5px; top: 52%; height: 2px; background: rgba(45,14,9,.45); box-shadow: 0 2px rgba(255,255,255,.08); pointer-events: none; }
#visualizer { display: block; width: 100%; height: 360px; touch-action: none; cursor: pointer; }
.comb { position: absolute; z-index: 3; left: 50%; top: 43%; width: 53%; height: 40px; transform: translateX(-50%); display: flex; align-items: flex-start; justify-content: center; gap: 2px; pointer-events: none; }
.tooth { width: calc(100% / 17); height: 23px; border-radius: 0 0 2px 2px; background: linear-gradient(90deg, #8a7442, #f0d783 45%, #806a37); transform-origin: 50% 0; box-shadow: 0 2px 3px rgba(0,0,0,.3); }
.tooth.active { animation: pluck .22s ease-out; }
@keyframes pluck { 25% { transform: rotate(8deg); filter: brightness(1.6); } 65% { transform: rotate(-4deg); } }

.controls { min-height: 88px; display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 18px; padding: 14px 24px 16px; background: rgba(55,21,15,.38); border-top: 1px solid rgba(255,230,190,.12); color: var(--cream); }
.play { width: 48px; height: 48px; padding: 0; border: 1px solid rgba(255,244,211,.75); border-radius: 50%; background: transparent; color: inherit; cursor: pointer; transition: .2s; }
.play:hover { background: rgba(255,255,255,.1); transform: scale(1.04); }
.play-icon { display: block; width: 0; height: 0; margin: auto; border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 11px solid currentColor; transform: translateX(2px); }
.playing .play-icon { width: 12px; height: 14px; border: 0; border-left: 4px solid; border-right: 4px solid; transform: none; }
.track-info { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.track-info select { width: 100%; max-width: 270px; padding: 0 22px 2px 0; border: 0; border-bottom: 1px solid rgba(247,239,217,.28); border-radius: 0; outline: none; background: transparent; color: var(--cream); font-family: "Playfair Display", serif; font-style: italic; font-size: 18px; letter-spacing: .01em; cursor: pointer; }
.track-info select option { color: var(--ink); background: var(--paper); font-family: Manrope, sans-serif; font-style: normal; }
.track-info span { color: #d1ba8a; font-size: 8px; }
.tempo { display: grid; grid-template-columns: auto 88px 24px; align-items: center; gap: 10px; color: #d1ba8a; }
.tempo span, .tempo output { font-family: "DM Mono", monospace; font-size: 8px; }
.tempo output { color: var(--cream); }
input[type="range"] { appearance: none; height: 2px; background: #a88758; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 9px; height: 9px; border-radius: 50%; background: #f3d88a; }
.hint { margin: 19px 0 0; text-align: center; color: var(--muted); font-size: 8px; }

footer { height: 68px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(21,41,32,.28); color: var(--muted); font-size: 8px; }
footer a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }
footer p:last-child { max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }

@media (max-width: 820px) {
  .shell { width: min(100% - 28px, 620px); }
  .masthead { height: 82px; }
  .hero { grid-template-columns: 1fr; gap: 52px; padding: 58px 0; }
  h1 { font-size: clamp(62px, 20vw, 96px); }
  .lede { margin-top: 32px; }
  #visualizer { height: 320px; }
}

@media (max-width: 520px) {
  .masthead > p, .tempo span { display: none; }
  .controls { grid-template-columns: 50px 1fr; padding-inline: 16px; }
  .tempo { grid-column: 2; grid-template-columns: 1fr 24px; width: 100%; }
  #visualizer { height: 300px; }
  footer { height: 58px; }
  footer p:first-child { display: none; }
  footer p:last-child { max-width: 100%; margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
