/* Saish site. Measurements on the sound card and pad are the app's own, in points
   (MixEditorSheet.chosenSoundCard, SoundPadControl, SoundGridCell). */

@font-face {
  font-family: "Poppin";
  src: url("fonts/Poppin-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Cal Sans UI";
  src: url("fonts/CalSansUI-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --page: #fafbfc;
  --ink: #16181d;
  --ink-soft: #3a3d44;
  --tile-empty: #dadada;
  --system: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --cal: "Cal Sans UI", var(--system);

  --sheet-ease: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--system);
  -webkit-font-smoothing: antialiased;
}
body.editing { overflow: hidden; }

/* ---------- Top ---------- */

.hero {
  margin: 64px 96px 0;
  padding: 160px 24px;
  border-radius: 64px;
  background: #0033ca;   /* the app's brand blue */
  color: #fff;
  text-align: center;
}
.hero-logo { margin: 0; line-height: 0; }
.hero-logo img { width: 198px; height: auto; }
.hero-tagline {
  margin: 12px 0 0;
  font-family: var(--cal);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.024em;
}
.hero-body {
  max-width: 480px;
  margin: 56px auto 0;
  font-size: 16px;
  line-height: 1.5;
}
.hero-platform { margin-top: 18px; }
.coming-soon {
  display: inline-block;
  margin-left: 4px;
  padding: 4px 8px;
  background: #1d1d1f;
  color: #fff;
  transform: rotate(-1.5deg);
}

/* ---------- Bottom ---------- */

.site-footer {
  padding: 40px 16px 96px;
  transition: padding 0.5s var(--sheet-ease);
  text-align: center;
  font-family: var(--cal);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.024em;
  color: var(--ink-soft);
}
body:not(.tray-away) .site-footer { padding-bottom: 260px; }   /* room to scroll clear of the tray */
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px; }
.site-footer a { color: inherit; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--ink); }

@media (max-width: 640px) {
  .hero { margin: 16px 16px 0; padding: 56px 20px 64px; border-radius: 36px; }
  .hero-logo img { width: 160px; }
  .hero-body { margin-top: 40px; }
}

/* ---------- Try a mix ---------- */

.try {
  padding: 96px 96px 80px;
}
.try-title {
  margin: 0;
  text-align: center;
  font-family: "Poppin", var(--system);
  letter-spacing: -0.07em;
  font-weight: 400;
  font-size: clamp(44px, 6vw, 68px);
  line-height: 1.1;
  color: #1b1b1b;
}
.try-subtitle {
  margin: 6px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
}

/* Tabs on the left, as the app's sound library (SoundCategoryPillRow); suggest on the right. */
.grid-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
}
.category-tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0;
}
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.08);
  color: rgba(29, 29, 31, 0.6);
  font-family: var(--cal);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0.024em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.category-tab:hover { background: rgba(29, 29, 31, 0.13); }
.category-tab[aria-pressed="true"] { background: #1d1d1f; color: #fff; }
.category-tab:focus-visible { outline: 3px solid #0033ca; outline-offset: 2px; }
/* The app's hand-drawn category marks, coloured like the label. */
.category-icon {
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.suggest {
  flex-shrink: 0;
  padding: 8px 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}
.suggest:hover { background: rgba(0, 0, 0, 0.05); }
.suggest:disabled { opacity: 0.35; cursor: default; }
.suggest:focus-visible { outline: 3px solid #0033ca; outline-offset: 3px; }

.sound-grid {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  /* Edge to edge: as many tiles across as fit at about the mock's size, stretched to fill. */
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
@media (max-width: 640px)  { .sound-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; } .try { padding: 64px 16px 48px; } }
@media (max-width: 420px)  { .sound-grid { grid-template-columns: repeat(2, 1fr); } }

.tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 22px;
  overflow: hidden;
  background: var(--tile-empty);
  cursor: pointer;
  isolation: isolate;
  /* A soft overshoot, so the tilt settles rather than stops. */
  transition: transform 0.45s cubic-bezier(0.34, 1.45, 0.64, 1), box-shadow 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.tile::after { /* the app's hairline, drawn over the artwork */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(0, 0, 0, 0.1);
  pointer-events: none;
  z-index: 4;
}
.tile img,
.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile img { opacity: 0; transition: opacity 0.3s ease; }
.tile img.loaded { opacity: 1; }
.tile video { opacity: 0; transition: opacity 0.2s ease; z-index: 1; }
.tile.video-on video { opacity: 1; }

/* Gradient for the name, as SoundGridCell: clear at the middle to black 55% at the foot. */
.tile-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
  z-index: 2;
}
.tile-name {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 11px;
  z-index: 3;
  color: #fff;
  text-align: left;
  font-family: var(--cal);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: 0.024em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 640px) { .tile { border-radius: 16px; } .tile-name { font-size: 14px; left: 10px; bottom: 9px; } }

.tile-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
  z-index: 3;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
/* Choosing a sound turns its + into a ✕, offering to take it out again: three-eighths of
   a turn rather than the nearest eighth, so the turn reads as a movement. */
.tile-mark .icon-plus { transition: transform 0.5s cubic-bezier(0.34, 1.45, 0.64, 1); }
.tile.selected .tile-mark .icon-plus { transform: rotate(135deg); }


.sound-grid li[hidden] { display: none; }
.tile.selected { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14); }
.tile.unavailable { opacity: 0.35; cursor: default; }

@media (hover: hover) {
  /* Lifts and tips a little; app.js picks the angle and side afresh on every hover. */
  .tile:not(.unavailable):hover { transform: translateY(-4px) rotate(var(--tilt, 2deg)) scale(1.03); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25); }
  .tile:not(.unavailable):hover .tile-mark { opacity: 1; transform: scale(1); }
}
.tile:focus-visible { outline: 3px solid #0033ca; outline-offset: 3px; }
.tile:not(.unavailable):focus-visible .tile-mark { opacity: 1; transform: scale(1); }

/* ---------- The tray ---------- */

.tray {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 5;
  width: min(355px, calc(100vw - 32px));
  padding: 16px;
  border-radius: 22px;
  background: #2b2b2b;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
  transition: transform 0.5s var(--sheet-ease);
}
body.editing .tray,
body.tray-away .tray { transform: translate(-50%, calc(100% + 40px)); }

.tray-slots {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.tray-slot {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

.tray-slot button {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #444;
  cursor: pointer;
}
.tray-slot.filled { border: 0; }
.tray-slot video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* The grid's ✕ in its white circle, at the size the grid shows it. */
.tray-slot-remove {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.tray-slot button:hover .tray-slot-remove,
.tray-slot button:focus-visible .tray-slot-remove { opacity: 1; transform: scale(1); }
.tray-slot button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

.tray-button {
  display: block;
  width: 100%;
  height: 64px;
  margin-top: 16px;
  border: 0;
  border-radius: 32px;
  background: #fff;
  color: #2b2b2b;
  font-family: var(--cal);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.024em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.tray-button:disabled { background: #8e8e8e; color: #3c3c3c; cursor: default; }
.tray-button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ---------- Edit levels ---------- */

.editor-scrim {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.6s var(--sheet-ease);
}
.editor-scrim[hidden] { display: none; }
.editor-scrim.shown { opacity: 1; }

.editor {
  position: fixed;
  inset: 16px;
  z-index: 10;
  overflow-y: auto;
  border-radius: 44px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 64px 35px 44px;
  transform: translateY(calc(100% + 32px));
  transition: transform 0.6s var(--sheet-ease);
  /* A card is a third of the width, held down so the whole page fits the window. */
  --card: max(240px, min(calc((100vw - 134px) / 3), calc(100vh - 452px), 460px));
}
.editor[hidden] { display: none; }
.editor.shown { transform: translateY(0); }

.editor-close {
  position: absolute;
  top: 27px;
  right: 29px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #2b2b2b;
  display: grid;
  place-items: center;
  cursor: pointer;
}
/* Turns on hover the way a grid tile's + turns into its ✕: one smooth move that overshoots
   and settles, further than the nearest matching angle (a half turn, where a quarter would
   do), shrinking a little; it turns back the same way when the pointer leaves. */
.editor-close svg {
  transition: transform 0.5s cubic-bezier(0.34, 1.45, 0.64, 1);
}
.editor-close:hover svg { transform: rotate(180deg) scale(0.8); }
.editor-close:focus-visible { outline: 2px solid #2b2b2b; outline-offset: 2px; }

.editor-head { text-align: center; }
.editor-title {
  margin: 0;
  font-family: "Poppin", var(--system);
  letter-spacing: -0.07em;
  font-weight: 400;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.1;
  color: #1b1b1b;
}
.editor-subtitle { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }

.mix-cards {
  list-style: none;
  margin: 48px 0 40px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, var(--card));
  gap: 16px;
}
.mix-slot { display: flex; flex-direction: column; align-items: center; }

/* One sound: its video blurred at 40% on black, the app's pad in the middle. */
.mix-card {
  position: relative;
  width: var(--card);
  height: var(--card);
  border-radius: 44px;
  background: #000;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
  container-type: inline-size;
}
.card-backdrop {
  position: absolute;
  inset: -60px;
  width: calc(100% + 120px);
  height: calc(100% + 120px);
  object-fit: cover;
  filter: blur(40px);
  opacity: 0.4;
  z-index: -1;
  pointer-events: none;
}
.card-title {
  position: absolute;
  top: 6.5%;
  left: 20px;
  right: 20px;
  margin: 0;
  text-align: center;
  font-family: var(--cal);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0.024em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The pad keeps the app's proportions at whatever size the card is: puck a quarter of
   the pad (56 on 225), dot 12 on 56, corners 14 on 225. */
.mixer {
  --pad-size: 41cqw;
  --puck: calc(var(--pad-size) * 56 / 225);
  --puck-dot: calc(var(--puck) * 12 / 56);
  --pad-radius: calc(var(--pad-size) * 14 / 225);
  --pad-surround: 56px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% + var(--pad-surround) / 2));
  display: grid;
  grid-template-columns: var(--pad-surround) var(--pad-size) var(--pad-surround);
  grid-template-rows: var(--pad-size) var(--pad-surround);
}
.readout {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  justify-self: center;
  align-self: center;
}
.readout-label { font-size: 13px; font-weight: 600; color: #fff; }
.readout-value {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}
.readout-volume { grid-column: 1; grid-row: 1; transform: rotate(-90deg); }
.readout-warmth { grid-column: 2; grid-row: 2; }

.pad {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  width: var(--pad-size);
  height: var(--pad-size);
  border-radius: var(--pad-radius);
  overflow: hidden;
  background: #222;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.pad.dragging { cursor: grabbing; }
.pad:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.pad-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.pad-dots {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* iOS 26 clear glass, as near as a browser gets: a lens over the video with a lit rim. */
.puck {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--puck);
  height: var(--puck);
  margin: calc(var(--puck) / -2) 0 0 calc(var(--puck) / -2);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08) 70%);
  -webkit-backdrop-filter: blur(3px) saturate(1.6) brightness(1.12);
  backdrop-filter: blur(3px) saturate(1.6) brightness(1.12);
  box-shadow:
    inset 0 1px 1.5px rgba(255, 255, 255, 0.75),
    inset 0 -1px 1.5px rgba(255, 255, 255, 0.28),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
  pointer-events: none;
  will-change: transform;
}
.puck-dot {
  width: var(--puck-dot);
  height: var(--puck-dot);
  border-radius: 50%;
  background: #fff;
}

.card-actions { display: flex; gap: 24px; margin-top: 12px; }
.text-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border: 0;
  background: none;
  color: #2b2b2b;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  border-radius: 8px;
}
.text-button:hover { color: #000; text-decoration: underline; text-underline-offset: 3px; }
.text-button:focus-visible { outline: 2px solid #2b2b2b; outline-offset: 2px; }

.add-card {
  width: var(--card);
  height: var(--card);
  border: 0;
  border-radius: 44px;
  background: #e4e4e4;
  color: #2b2b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: var(--cal);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.024em;
  cursor: pointer;
  transition: background 0.2s ease;
}
.add-card:hover { background: #dadada; }
.add-card:focus-visible { outline: 3px solid #2b2b2b; outline-offset: 3px; }

.editor-actions {
  flex-shrink: 0;
  margin-top: auto;
  display: flex;
  gap: 16px;
  width: min(662px, 100%);
}
.pill-button {
  flex: 1;
  height: 64px;
  border: 2px solid #2f2f2f;
  border-radius: 32px;
  background: #2f2f2f;
  color: #fff;
  font-family: var(--cal);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.024em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.pill-button:hover { background: #1f1f1f; border-color: #1f1f1f; }
.pill-button.ghost { background: transparent; color: #2f2f2f; }
.pill-button.ghost:hover { background: rgba(0, 0, 0, 0.05); border-color: #2f2f2f; }
.pill-button:focus-visible { outline: 3px solid #2f2f2f; outline-offset: 3px; }

@media (max-width: 900px) {
  .editor { padding: 72px 16px 32px; --card: min(100%, 420px); }
  .mix-cards { grid-template-columns: minmax(0, 420px); width: 100%; justify-content: center; margin-top: 32px; gap: 24px; }
  .mix-card, .add-card { width: 100%; height: auto; aspect-ratio: 1; }
  .editor-actions { margin-top: 32px; }
  .editor-close { top: 14px; right: 12px; }
}
@media (max-width: 640px) {
  .editor { border-radius: 32px; }
  .pill-button { height: 56px; font-size: 20px; }
  .mix-card, .add-card { border-radius: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .editor, .editor-scrim { transform: none; opacity: 0; transition: opacity 0.3s ease; }
  .editor-scrim.shown { opacity: 1; }
  .editor.shown { opacity: 1; }
  .tray { transition: none; }
  .tile, .tile-mark { transition: none; }
  .editor-close svg { transition: none; }
  .tile-mark .icon-plus { transition: none; }
  .tile:hover, .tile.selected { transform: none; }
}
