/* Hero: the keyboard is the page. */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr minmax(300px, 380px);
  grid-template-areas: "title side" "desk desk";
  column-gap: 48px;
  row-gap: 34px;
  padding: 44px 0 72px;
}
.hero > * { min-width: 0; }
.hero-title { grid-area: title; }
.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(64px, 11vw, 158px);
  line-height: 0.8;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.hero h1 .for {
  display: inline-block;
  margin: 0 0.06em;
  font-size: clamp(28px, 4.6vw, 66px);
  color: var(--tomato);
  letter-spacing: 0;
  transform: rotate(-12deg) translateY(-0.55em);
}
.char { display: inline-block; will-change: transform; }
.tagline { margin-top: 14px; font-size: clamp(24px, 2.4vw, 34px); line-height: 1.1; color: var(--ink-soft); }
.scribble { position: relative; color: var(--ink); }
.scribble::after { /* hand-drawn underline */
  content: "";
  position: absolute;
  left: -4px;
  right: -6px;
  bottom: -4px;
  height: 10px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 10' preserveAspectRatio='none'><path d='M2 6 C 30 2, 60 9, 90 4 S 116 5, 118 6' fill='none' stroke='%23d9573a' stroke-width='3' stroke-linecap='round'/></svg>") center / 100% 100% no-repeat;
}

.hero-side { grid-area: side; align-self: end; display: flex; flex-direction: column; gap: 22px; padding-bottom: 8px; }
.lede { font-size: var(--t-lede); line-height: 1.45; max-width: 36ch; }
.lede b { font-weight: 600; background: linear-gradient(transparent 58%, var(--butter) 58%); }
.cta { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }

/* stickers slapped around the hero; they jiggle when you type */
.sticker { position: absolute; z-index: 3; pointer-events: none; }
.stk-burst { top: 6px; right: 31%; width: 112px; height: 112px; display: grid; place-items: center; rotate: 12deg; }
.stk-burst svg { position: absolute; inset: 0; overflow: visible; }
.stk-burst polygon { fill: var(--butter); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.stk-burst b { position: relative; font: 400 19px/0.95 var(--display); text-align: center; letter-spacing: -0.01em; }
.stk-stamp {
  top: 150px;
  left: 716px;
  padding: 10px 14px;
  border: 3px double var(--red-ink);
  border-radius: 8px;
  color: var(--red-ink);
  font: 700 15px/1.3 var(--tech);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  rotate: 8deg;
  background: rgba(255, 250, 240, 0.7);
}
.stk-stamp small { font-size: 11px; }
.stk-tape {
  left: -18px;
  bottom: 92px;
  padding: 6px 18px;
  background: rgba(246, 184, 200, 0.9);
  border: 2px solid var(--ink);
  font: 600 15px var(--ui);
  rotate: -7deg;
  clip-path: polygon(0 10%, 4% 0, 96% 4%, 100% 0, 98% 50%, 100% 100%, 4% 96%, 0 100%, 2% 50%);
}

/* ---------- the desk ---------- */

.desk {
  --u: 50px;
  position: relative;
  padding: 92px 36px 32px;
  border: var(--line);
  border-radius: 28px;
  background:
    linear-gradient(var(--mat-line) 1px, transparent 1px) 0 0 / 25px 25px,
    linear-gradient(90deg, var(--mat-line) 1px, transparent 1px) 0 0 / 25px 25px,
    linear-gradient(33deg, transparent 49.85%, rgba(214, 239, 226, 0.16) 50%, transparent 50.15%),
    var(--mat);
  box-shadow: 8px 8px 0 var(--ink);
}
.desk-tab {
  position: absolute;
  top: -2.5px;
  left: 30px;
  padding: 6px 14px 7px;
  border: var(--line);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: var(--butter);
}
.desk-wrap { grid-area: desk; position: relative; }
.desk { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* the rig is a size container so keycaps can be sized from the space actually available (cqi) */
.rig { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; container-type: inline-size; }
.rig > * { min-width: 0; }

.keyboard {
  flex: none;
  touch-action: pan-y; /* vertical swipes scroll the page, sideways ones glide across keys */
  padding: 10px;
  border: var(--line);
  border-radius: 18px;
  background: var(--tomato);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.16), 0 8px 0 rgba(0, 0, 0, 0.3);
}
.row { display: flex; }
.key {
  position: relative;
  width: calc(var(--w) * var(--u) - 6px);
  height: calc(var(--u) * 0.84);
  margin: 3px;
  padding: 5px 7px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--cream);
  box-shadow: 0 4px 0 var(--ink);
  font: 400 12px/1 var(--tech);
  text-align: left;
  vertical-align: top;
  color: var(--ink-soft);
  transition: transform 0.22s var(--spring), box-shadow 0.22s var(--spring), background-color 0.5s ease;
}
.key.down {
  transform: translateY(4px) scale(1.02, 0.94);
  box-shadow: 0 0 0 var(--ink);
  background-color: var(--butter);
  color: var(--ink);
  transition-duration: 0.03s;
}

.mouse { flex: none; width: 96px; height: 150px; overflow: visible; cursor: pointer; }
.mouse .cable { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.mouse-body { fill: var(--cream); stroke: var(--ink); stroke-width: 2.5; }
.mouse-btn { fill: var(--cream); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; transition: fill 0.4s; }
.mouse-btn[data-button="middle"] { fill: var(--butter); stroke-width: 2; }
.mouse-btn.down { fill: var(--sky); transition-duration: 0s; }

.voices { display: grid; grid-template-columns: repeat(2, minmax(118px, 1fr)); gap: 10px; align-self: center; }
.voice {
  --c: var(--butter);
  padding: 8px 12px 9px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--c);
  text-align: left;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.25s var(--spring), box-shadow 0.25s var(--spring);
}
.voice b { display: block; font-size: 15px; font-weight: 600; line-height: 1.15; }
.voice span { font: 400 11px var(--tech); letter-spacing: 0.06em; }
@media (hover: hover) { .voice:hover { transform: translate(-2px, -2px) rotate(-1.5deg); box-shadow: 4px 4px 0 var(--ink); } }
.voice:active { transform: translate(1px, 1px) rotate(-1deg); box-shadow: 1px 1px 0 var(--ink); transition-duration: 0.05s; }
.voice[aria-pressed="true"] { box-shadow: 4px 4px 0 var(--tomato), 4px 4px 0 2px var(--ink); transform: rotate(-2deg); }

/* ---------- HUD ---------- */

.hud { position: absolute; top: 18px; right: 36px; left: 40%; display: flex; align-items: flex-end; justify-content: flex-end; gap: 26px; color: var(--cream); }
.combo {
  margin-right: auto;
  font: 400 34px/1 var(--display);
  white-space: nowrap;
  letter-spacing: -0.01em;
  color: var(--butter);
  text-shadow: 3px 3px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink);
  opacity: 0;
  transform-origin: left bottom;
  transition: opacity 0.3s;
}
.combo b { font: 700 1em/1 var(--ui); }
.combo span { font-size: 0.55em; color: var(--pink); }
.combo.on { opacity: 1; }
.meter { display: flex; align-items: flex-end; gap: 10px; }
.meter svg { width: 84px; height: 49px; overflow: visible; }
.meter-arc { fill: none; stroke: var(--cream); stroke-width: 6; stroke-linecap: round; }
.meter-hot { fill: none; stroke: var(--tomato); stroke-width: 6; stroke-linecap: round; }
.meter-needle { stroke: var(--butter); stroke-width: 3.5; stroke-linecap: round; transform-origin: 50px 52px; transform: rotate(-80deg); transition: transform 0.6s var(--spring); }
.meter circle { fill: var(--butter); stroke: var(--ink); stroke-width: 2; }
.meter p, .keys { color: var(--mint-soft); }
.meter b, .keys b { font: 700 28px/1 var(--ui); letter-spacing: 0; color: var(--cream); margin-right: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Clacky ---------- */

.buddy { position: absolute; top: -84px; left: 44%; display: flex; align-items: flex-start; gap: 6px; z-index: 4; }
.mascot { width: 104px; height: 104px; overflow: visible; }
.m-shadow { fill: rgba(0, 0, 0, 0.22); }
.m-body { transform-origin: 50px 90px; transform-box: view-box; }
.m-cap { fill: var(--mustard); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.m-top { fill: var(--butter); stroke: var(--ink); stroke-width: 3; }
.m-foot { fill: var(--ink); }
.m-pupils ellipse { fill: var(--ink); }
.m-glint { fill: #fff; }
.m-pupils { transition: transform 0.2s var(--out); }
.m-eyes { transform-origin: 50px 41px; transform-box: view-box; }
.m-blush { fill: var(--pink); }
.m-smile, .m-dizzy path { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.m-ooh ellipse { fill: var(--ink); }
.m-ooh .m-tongue { fill: var(--tomato); }
.m-dizzy, .m-ooh { display: none; }
.mascot.is-happy .m-smile, .mascot.is-dizzy .m-smile, .mascot.is-dizzy .m-open { display: none; }
.mascot.is-happy .m-ooh, .mascot.is-dizzy .m-ooh, .mascot.is-dizzy .m-dizzy { display: inline; }
.bubble {
  max-width: 230px;
  margin-top: 8px;
  padding: 9px 14px 10px;
  border: var(--line);
  border-radius: 18px 18px 4px 18px;
  background: var(--cream);
  box-shadow: 3px 3px 0 var(--ink);
  font: 400 21px/1.3 var(--hand);
  transform-origin: 100% 100%;
  transition: opacity 0.25s, transform 0.35s var(--spring);
}
.bubble.hide { opacity: 0; transform: scale(0.6) rotate(6deg); }

/* ---------- sound gate + pops ---------- */

.gate {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 6;
  padding: 18px 30px 19px;
  translate: -50% -50%;
  rotate: -2.5deg;
  border: var(--line);
  border-radius: 6px;
  background: var(--butter);
  box-shadow: 6px 6px 0 var(--ink);
  font: 400 24px/1.1 var(--display);
  letter-spacing: -0.01em;
  transition: transform 0.2s var(--spring), opacity 0.3s, scale 0.35s var(--spring);
}
.gate i { font-style: normal; }
@media (hover: hover) { .gate:hover { transform: rotate(1.5deg) scale(1.04); } }
.gate-tape { position: absolute; top: -14px; left: 50%; width: 90px; height: 26px; translate: -50% 0; rotate: 4deg; background: rgba(246, 184, 200, 0.85); border: 2px solid var(--ink); }
.desk.on .gate { opacity: 0; scale: 0.4; pointer-events: none; }

.pops { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.pop { position: absolute; display: grid; place-items: center; translate: -50% -100%; }
.pop svg { grid-area: 1 / 1; width: 92px; height: 62px; overflow: visible; }
.pop polygon { stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; }
.pop b { grid-area: 1 / 1; font: 400 17px var(--display); white-space: nowrap; }

/* ---------- responsive ---------- */

@media (max-width: 1260px) {
  .desk { --u: 42px; }
  .stk-stamp { left: auto; right: 34%; top: 250px; }
  .stk-burst { right: 36%; }
}

/* tablets + foldables: one column; keyboard and mouse share a row, switches below */
@media (max-width: 1060px) {
  .hero { grid-template-columns: 1fr; grid-template-areas: "title" "desk" "side"; }
  .stk-burst { top: 0; right: 4%; }
  .stk-stamp, .stk-tape { display: none; }
  .desk { --u: min(42px, (100cqi - 25px - 72px - 20px) / 15); padding-inline: 24px; }
  .hud { left: 24px; right: 24px; }
  .buddy { left: auto; right: 30px; }
  .rig { display: grid; grid-template-columns: auto auto; justify-content: center; align-items: end; gap: 22px 20px; }
  .mouse { width: 72px; height: 112px; }
  .voices { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
}

@media (max-width: 760px) {
  .hero { padding-top: 28px; row-gap: 26px; }
  .hero h1 { font-size: clamp(54px, 17vw, 96px); }
  .stk-burst { display: none; }
  .desk-wrap { margin-top: 34px; }
  .desk { --u: calc((100cqi - 19px - 60px - 14px) / 15); padding: 112px 12px 16px; border-radius: 20px; box-shadow: 5px 5px 0 var(--ink); }
  .desk-tab { left: 16px; font-size: 11px; letter-spacing: 0.08em; }
  .keyboard { padding: 7px; border-radius: 12px; }
  .key { margin: 1.5px; width: calc(var(--w) * var(--u) - 3px); border-width: 1.5px; border-radius: 5px; box-shadow: 0 2px 0 var(--ink); font-size: 11px; padding: 2px 4px; letter-spacing: 0; overflow: hidden; }
  .key.down { transform: translateY(2px) scale(1.02, 0.94); }
  .key.glyph { font-size: 15px; line-height: 1; padding-top: 1px; }
  .mouse { width: 60px; height: 94px; }
  .rig { gap: 14px; }
  /* switches become a swipeable strip that runs out to the mat's edge */
  .voices {
    display: grid; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 132px; gap: 10px;
    width: auto; margin-inline: -12px; padding: 6px 12px 10px; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity; scroll-padding-inline: 12px; scrollbar-width: none;
  }
  .voices::-webkit-scrollbar { display: none; }
  .voice { scroll-snap-align: start; min-height: var(--tap); }
  .buddy { top: -66px; right: 8px; }
  .mascot { width: 78px; height: 78px; }
  .bubble { display: none; }
  .hud { top: 40px; left: 14px; right: 14px; gap: 14px; }
  .combo { font-size: 24px; }
  .meter svg { width: 60px; height: 35px; }
  .meter b, .keys b { font-size: 22px; }
  .gate { font-size: 19px; padding: 14px 20px; width: max-content; max-width: 86%; }
}

/* phones: a phone-shaped board. 4 rows, 10 keys wide, full-height caps you can actually hit. */
@media (max-width: 599px) {
  .hero { padding-bottom: 56px; }
  .desk { padding: 98px 8px 12px; }
  .desk-tab { left: 14px; padding: 5px 10px 6px; }
  .rig { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .mouse { display: none; }
  .voices { margin-inline: -8px; padding-inline: 8px; scroll-padding-inline: 8px; }
  .buddy { top: -58px; right: 4px; }
  .mascot { width: 66px; height: 66px; }
  .hud { top: 38px; left: 12px; right: 12px; }
  /* before sound is on, the tape sits over the meters, never over the keys */
  .gate { top: 34px; translate: -50% 0; font-size: 17px; padding: 11px 16px 12px; box-shadow: 4px 4px 0 var(--ink); }
  .gate-tape { width: 64px; height: 20px; top: -11px; }
  .hud { transition: opacity 0.3s; }
  .desk:not(.on) .hud { opacity: 0; } /* meters appear once sound is on and the tape is gone */

  .keyboard.is-compact { --u: calc((100cqi - 15px) / 10); width: 100%; padding: 5px; border-radius: 14px; }
  .is-compact .row { justify-content: center; }
  .is-compact .key {
    display: grid; place-items: center;
    width: calc(var(--w) * var(--u) - 5px);
    height: clamp(44px, 12.5vw, 54px);
    margin: 2.5px;
    padding: 0;
    border-width: 2px;
    border-radius: 7px;
    box-shadow: 0 3px 0 var(--ink);
    font: 500 clamp(14px, 4.4vw, 17px)/1 var(--tech);
    letter-spacing: 0;
    text-align: center;
    color: var(--ink);
  }
  .is-compact .key.mod { font-size: 12px; color: var(--ink-soft); background-color: var(--paper-2); }
  .is-compact .key.mod.glyph { font-size: 20px; }
  .is-compact .key.mod.down { background-color: var(--butter); color: var(--ink); }
  .is-compact .key.down { transform: translateY(3px) scale(1.06, 0.9); box-shadow: 0 0 0 var(--ink); }
  .key-gap { flex: none; width: calc(var(--w) * var(--u)); }
}

/* landscape phones: everything has to fit one short screen. Switches go in a scrolling column beside the board. */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 600px) {
  .hero { padding-top: 20px; row-gap: 20px; }
  .desk-wrap { margin-top: 40px; }
  .desk {
    --u: min(42px, (100cqi - 25px - 150px - 16px) / 15, (100dvh - 150px) / 6.1);
    padding: 64px 16px 14px;
  }
  .keyboard { padding: 10px; border-radius: 16px; }
  .key { font-size: 11px; padding: 3px 5px; }
  .key.glyph { font-size: 15px; }
  .hud { top: 12px; right: 18px; left: 45%; }
  .meter svg { width: 56px; height: 33px; }
  .rig { grid-template-columns: auto 150px; justify-content: space-between; gap: 16px; }
  .mouse { display: none; }
  .voices {
    grid-column: auto; grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr;
    align-self: stretch; contain: size; margin: 0; padding: 4px 6px 4px 2px;
    overflow: hidden auto; scroll-snap-type: y proximity; overscroll-behavior: contain;
  }
  .buddy { top: -60px; }
  .mascot { width: 66px; height: 66px; }
}
