/* Haptempo — the app's own language on the web: black, greys, one white
   glow, rounded numerals, Marck Script only for the Italian tempo marking. */

@font-face {
  font-family: "Marck Script";
  src: url("/fonts/MarckScript-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --black: #000;
  --surface: #0d0d0d;
  --raised: rgba(255, 255, 255, 0.08);
  --raised-strong: rgba(255, 255, 255, 0.14);
  --hairline: rgba(255, 255, 255, 0.12);
  --text: #fff;
  --text-2: rgba(255, 255, 255, 0.72);
  --text-3: rgba(255, 255, 255, 0.55);
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --script: "Marck Script", "Snell Roundhand", cursive;
  --page: min(1180px, 100% - 48px);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  font: 18px/1.5 var(--rounded);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img, svg, canvas { display: block; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: #fff; color: #000; padding: 10px 16px; border-radius: 999px; text-decoration: none;
}
.skip:focus { top: 12px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── Header ─────────────────────────────────────────────── */

.site-header {
  position: sticky; top: 0; z-index: 5;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: saturate(140%) blur(16px);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--hairline); }
.site-header .inner {
  width: var(--page); margin: 0 auto; height: 64px;
  display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; white-space: nowrap; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.brand small { color: var(--text-3); font-weight: 500; font-size: 15px; }
.site-nav { display: flex; gap: 22px; margin-left: auto; font-size: 15px; }
.site-nav a { color: var(--text-2); text-decoration: none; }
.site-nav a:hover { color: var(--text); }
@media (max-width: 860px) { .site-nav { display: none; } .site-header .store { margin-left: auto; } }
/* The hero carries the store button on small phones. */
@media (max-width: 560px) { .site-header .store { display: none; } }

/* ── Buttons ───────────────────────────────────────────── */

.store {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 20px; border-radius: 999px;
  background: #fff; color: #000; text-decoration: none; font-weight: 600; font-size: 15px;
  white-space: nowrap;
}
.store svg { width: 16px; height: 16px; }
.store[aria-disabled="true"] { background: var(--raised-strong); color: var(--text-2); cursor: default; }
.store.large { min-height: 54px; padding: 0 26px; font-size: 17px; }
button.store { border: 0; font-family: inherit; cursor: pointer; }

/* ── Hero ──────────────────────────────────────────────── */

.hero {
  width: var(--page); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
  grid-template-areas: "intro app" "body app";
  grid-template-rows: 1fr 1fr;
  column-gap: 56px;
  padding: 56px 0 88px;
}
.hero-intro { grid-area: intro; align-self: end; }
.hero-body { grid-area: body; align-self: start; }
.hero .app { grid-area: app; align-self: center; }
.eyebrow { color: var(--text-3); font-size: 15px; font-weight: 500; margin: 0 0 14px; }
h1 {
  font-size: clamp(44px, 6vw, 76px); line-height: 1.02; letter-spacing: -0.03em;
  font-weight: 650; margin: 0 0 22px;
}
.lede { color: var(--text-2); font-size: 20px; max-width: 34em; margin: 0 0 30px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; }
.cta-note { color: var(--text-3); font-size: 15px; }

/* On a phone the metronome comes right after the headline: it is the point. */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; grid-template-areas: "intro" "app" "body"; grid-template-rows: auto; row-gap: 28px; padding-top: 28px; }
  .hero-body .lede { margin-top: 8px; }
  .hero .app { width: 100%; max-width: 560px; justify-self: center; }
}

/* ── The app on the page ───────────────────────────────── */

.app {
  background: radial-gradient(120% 70% at 50% 58%, #121212 0%, #000 70%);
  border: 1px solid var(--hairline);
  border-radius: 34px;
  padding: 22px 22px 20px;
  position: relative;
}
.app-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tempo { display: flex; align-items: baseline; gap: 8px; }
.tempo .note { color: var(--text-3); display: inline-flex; align-items: flex-end; gap: 4px; font-size: 26px; font-weight: 600; }
.tempo .note svg { height: 30px; width: auto; }
.tempo output {
  font-size: 60px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.marking { font-family: var(--script); font-size: 30px; color: rgba(255,255,255,.82); line-height: 1.1; margin-top: 2px; min-height: 1.1em; }
.marking small { font-family: var(--rounded); font-size: 13px; color: var(--text-3); margin-left: 8px; }

.meter-button {
  background: none; border: 0; padding: 4px 0 4px 8px; cursor: pointer; text-align: right;
  min-width: 44px; min-height: 44px;
}
.meter-button .sig { display: block; font-size: 60px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.meter-button .hint { display: inline-flex; gap: 6px; align-items: center; color: var(--text-3); font-size: 14px; font-weight: 500; margin-top: 6px; }
.meter-button:hover .hint { color: var(--text-2); }

.strip { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 14px 0 0; min-height: 22px; list-style: none; padding: 0; }
.strip .group { display: flex; gap: 8px; }
.strip .cell {
  width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.75);
  transition: transform .08s, background-color .08s, box-shadow .08s;
}
.strip .cell.accent { background: rgba(255,255,255,.9); }
.strip .cell.silent { width: 6px; height: 6px; border: 0; background: rgba(255,255,255,.4); align-self: center; }
.strip .cell.now { transform: scale(1.35); background: #fff; box-shadow: 0 0 12px rgba(255,255,255,.8); }
.strip.mini { margin: 6px 0 0; min-height: 0; gap: 4px 8px; }
.strip.mini .group { gap: 5px; }
.strip.mini .cell { width: 9px; height: 9px; border-width: 1.25px; }
.strip.mini .cell.silent { width: 4px; height: 4px; }

.platform {
  width: 100%; aspect-ratio: 1 / 0.82; margin: 6px 0 4px;
  cursor: pointer; border-radius: 18px; touch-action: manipulation;
}
.platform canvas { width: 100%; height: 100%; }

.controls { display: flex; justify-content: center; align-items: center; gap: 22px; }
.round {
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.10); display: grid; place-items: center;
}
.round:hover { background: rgba(255,255,255,.16); }
.round.play { width: 78px; height: 78px; background: rgba(255,255,255,.14); }
.round svg { width: 20px; height: 20px; fill: #fff; }
.round.play svg { width: 28px; height: 28px; }

.toggles { display: flex; justify-content: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.pill {
  min-height: 40px; padding: 0 16px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--raised); color: var(--text-2); font-size: 15px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.pill:hover { color: #fff; }
.pill[aria-pressed="true"] { background: #fff; color: #000; }
.pill svg { width: 16px; height: 16px; fill: currentColor; }
.app-caption { color: var(--text-3); font-size: 14px; text-align: center; margin: 14px 4px 0; }

/* ── Sections ──────────────────────────────────────────── */

.section { width: var(--page); margin: 0 auto; padding: 96px 0; border-top: 1px solid var(--hairline); }
.section h2 { font-size: clamp(32px, 4vw, 48px); line-height: 1.08; letter-spacing: -0.02em; font-weight: 650; margin: 0 0 16px; max-width: 18em; }
.section .intro { color: var(--text-2); font-size: 20px; max-width: 36em; margin: 0 0 48px; }

/* Two voices */
.voices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.voice { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 30px; }
.voice .glyph { font-size: 44px; line-height: 1; margin-bottom: 18px; }
.voice h3 { margin: 0 0 6px; font-size: 24px; }
.voice .preset { color: var(--text-3); font-size: 15px; margin: 0 0 12px; }
.voice p { margin: 0; color: var(--text-2); }
@media (max-width: 720px) { .voices { grid-template-columns: 1fr; } }

/* Meters */
.meters { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 48px; padding: 0; list-style: none; }
.meters button {
  min-width: 76px; min-height: 64px; border-radius: 18px; border: 1px solid var(--hairline);
  background: var(--surface); cursor: pointer; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.meters button:hover { background: #161616; }
.meters button[aria-pressed="true"] { background: #fff; color: #000; border-color: #fff; }
.meters .own { color: var(--text-3); font-size: 15px; align-self: center; padding-left: 6px; }

.rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; }
.row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 20px; padding: 24px 0; border-top: 1px solid var(--hairline); }
.row .sample { font-size: 22px; font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.row .sample svg { height: 26px; width: auto; }
.row .sample.script { font-family: var(--script); font-weight: 400; font-size: 26px; }
.row h3 { margin: 0 0 4px; font-size: 19px; }
.row p { margin: 0; color: var(--text-2); font-size: 17px; }
@media (max-width: 820px) { .rows { grid-template-columns: 1fr; } .row { grid-template-columns: 88px minmax(0, 1fr); } }

/* Together */
.together { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.scheme { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 30px; }
.scheme h3 { margin: 0 0 8px; font-size: 22px; }
.scheme p { margin: 0 0 22px; color: var(--text-2); }
.scheme svg { width: 100%; height: auto; }
.scheme .fine { color: var(--text-3); font-size: 15px; margin: 18px 0 0; }
@media (max-width: 820px) { .together { grid-template-columns: 1fr; } }

/* Presets */
.presets { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 56px; align-items: start; }
.preset-list { list-style: none; margin: 0; padding: 8px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); }
.preset-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 14px; text-decoration: none; }
.preset-list a:hover { background: var(--raised); }
.preset-list .name { font-weight: 600; }
.preset-list .music { color: var(--text-3); font-size: 15px; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.preset-list .music svg { height: 17px; width: auto; }
.share-ways { list-style: none; padding: 0; margin: 0; }
.share-ways li { padding: 18px 0; border-top: 1px solid var(--hairline); }
.share-ways strong { display: block; font-size: 19px; }
.share-ways span { color: var(--text-2); }
@media (max-width: 900px) { .presets { grid-template-columns: 1fr; } }

/* Pricing */
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.plan { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 32px; background: var(--surface); }
.plan.pro { background: #fff; color: #000; border-color: #fff; }
.plan h3 { margin: 0; font-size: 22px; }
.plan .price { font-size: 48px; font-weight: 650; letter-spacing: -0.02em; margin: 10px 0 2px; }
.plan .terms { margin: 0 0 22px; color: var(--text-3); font-size: 15px; }
.plan.pro .terms { color: rgba(0,0,0,.6); }
.plan ul { list-style: none; padding: 0; margin: 0; }
.plan li { padding: 10px 0 10px 26px; border-top: 1px solid var(--hairline); position: relative; }
.plan.pro li { border-top-color: rgba(0,0,0,.12); }
.plan li::before { content: "●"; position: absolute; left: 0; top: 10px; font-size: 12px; }
.plan li.off::before { content: "–"; font-size: 16px; top: 8px; }
.plan li.off { color: var(--text-3); }
@media (max-width: 720px) { .plans { grid-template-columns: 1fr; } }

/* Closing */
.closing { text-align: center; }
.closing h2 { margin: 0 auto 16px; }
.closing .intro { margin: 0 auto 32px; }
.closing img { width: 112px; height: 112px; border-radius: 26px; margin: 0 auto 28px; box-shadow: 0 0 80px rgba(255,255,255,.12); }

/* Footer */
.site-footer { border-top: 1px solid var(--hairline); }
.site-footer .inner { width: var(--page); margin: 0 auto; padding: 32px 0 48px; display: flex; flex-wrap: wrap; gap: 14px 28px; color: var(--text-3); font-size: 15px; }
.site-footer a { color: var(--text-2); text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer .legal { margin-left: auto; }
@media (max-width: 720px) { .site-footer .legal { margin-left: 0; width: 100%; } }

/* ── Preset page (/p) ──────────────────────────────────── */

.preset-page { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 40px 24px 64px; }
.preset-card { width: 100%; max-width: 440px; text-align: center; }
.preset-card .label { color: var(--text-3); font-size: 15px; }
.preset-card h1 { font-size: clamp(34px, 8vw, 46px); margin: 6px 0 26px; overflow-wrap: anywhere; }
.preset-card .music-big { display: flex; justify-content: center; align-items: flex-end; gap: 34px; }
.preset-card .music-big .num { font-size: 64px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.preset-card .music-big .note { display: inline-flex; align-items: flex-end; gap: 4px; color: var(--text-3); font-size: 28px; font-weight: 600; margin-right: 8px; }
.preset-card .music-big .note svg { height: 34px; width: auto; }
.preset-card .marking { margin: 8px 0 0; }
.preset-card .details { color: var(--text-2); margin: 14px 0 0; min-height: 1.5em; }
.preset-card .strip { justify-content: center; margin: 18px 0 32px; }
.preset-card .actions { display: grid; gap: 12px; }
.preset-card .actions .store { justify-content: center; }
.preset-card .secondary { background: var(--raised-strong); color: #fff; }
.preset-card .fine { color: var(--text-3); font-size: 14px; margin-top: 18px; }

/* ── Preset library (/presets) ─────────────────────────── */

.lib { width: var(--page); margin: 0 auto; padding: 24px 0 140px; }
.crumbs { color: var(--text-3); font-size: 15px; margin: 8px 0 0; }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: #fff; }
.lib-hero { padding: 40px 0 56px; max-width: 46em; }
.lib-hero h1 { margin-bottom: 18px; }

.lib-set { border-top: 1px solid var(--hairline); padding: 40px 0 28px; }
.lib-set-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 18px; }
.lib-set h2 { font-size: clamp(26px, 3vw, 34px); letter-spacing: -0.015em; margin: 0 0 6px; }
.lib-set-head p { margin: 0; color: var(--text-2); max-width: 40em; }
.lib-set .pill { text-decoration: none; }

.lib-list { list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); }
.lib-row { display: flex; align-items: center; gap: 16px; padding: 12px 10px 12px 16px; border-radius: 14px; }
.lib-row + .lib-row { border-top: 1px solid rgba(255,255,255,.06); }
.lib-row.playing { background: var(--raised); }
.lib-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.lib-text .name { font-weight: 600; font-size: 18px; }
.lib-text .by { color: var(--text-3); font-size: 15px; }
.lib-text .music { color: var(--text-2); font-size: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; font-variant-numeric: tabular-nums; }
.lib-text .script { font-family: var(--script); font-size: 21px; color: rgba(255,255,255,.75); margin-left: 4px; }
.note-glyph { display: inline-flex; align-items: flex-end; }
.note-glyph svg { height: 18px; width: auto; }
.badge { justify-self: start; margin-top: 4px; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #fff; color: #000; }
.lib-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.round.small { width: 44px; height: 44px; }
.round.small svg { width: 16px; height: 16px; }
.lib-actions .open {
  min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center;
  border-radius: 999px; background: var(--raised); color: var(--text-2); text-decoration: none; font-size: 15px; font-weight: 600;
}
.lib-actions .open:hover { color: #fff; background: var(--raised-strong); }

.lib-cats { list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); }
.lib-cats li + li { border-top: 1px solid rgba(255,255,255,.06); }
.lib-cat { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr) auto; gap: 6px 24px; align-items: center; padding: 18px 16px; border-radius: 14px; text-decoration: none; }
.lib-cat:hover { background: var(--raised); }
.lib-cat-name { font-size: 22px; font-weight: 650; display: grid; }
.lib-cat-name small { font-size: 14px; font-weight: 500; color: var(--text-3); }
.lib-cat-sets { color: var(--text-2); font-size: 16px; }
.lib-cat-count { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 15px; }
.lib-cat-count::after { content: " presets"; }
@media (max-width: 720px) {
  .lib-cat { grid-template-columns: 1fr auto; }
  .lib-cat-sets { grid-column: 1 / -1; grid-row: 2; }
}
.lib-note { color: var(--text-3); font-size: 15px; max-width: 46em; margin: 32px 0 0; }

.player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 0 12px calc(12px + env(safe-area-inset-bottom)); pointer-events: none; }
.player-inner {
  pointer-events: auto; width: min(760px, 100%); margin: 0 auto;
  display: flex; align-items: center; gap: 16px; padding: 12px 12px 12px 20px;
  background: rgba(20,20,20,.86); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--hairline); border-radius: 999px;
}
.player-info { min-width: 0; flex: 1; }
.player-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-music { color: var(--text-2); font-size: 15px; display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.player .strip { margin: 0; flex-wrap: nowrap; }
.round.play.small { width: 48px; height: 48px; }
@media (max-width: 560px) { .player .strip { display: none; } }
.library-link { margin-top: 14px; text-decoration: none; color: #fff; }
/* Library pages keep their two links on phones: there's no hero CTA to fall back on. */
@media (max-width: 860px) { .site-nav.compact { display: flex; gap: 14px; margin-left: auto; } }
@media (max-width: 420px) { .site-nav.compact a:first-child { display: none; } }
