/* Duet Lab — landing page.
 *
 * Tokens are lifted from the app's DesignSystem.swift so the site and the app
 * can't drift. Like the app, this page is dark-only: the palette assumes a dark
 * ground, and a light variant would need its own colours rather than an
 * automatic inversion.
 *
 * The palette is monochrome — white *is* the accent. Primary actions are a white
 * fill with black content, and everything else is a translucent white overlay on
 * the near-black ground rather than an opaque grey, which is why the greys below
 * are rgba(255,255,255,·) instead of mixed hex values. The signal colours are the
 * one deliberate exception: note data has to stay legible as data. */

/* DM Sans carries everything with a voice; DM Mono is the label voice only —
   the small caption above a control. Both are the app's own bundled faces,
   copied from JamBuddyApp/Sources/JamBuddyApp/Resources/Fonts. DM Sans is the
   variable file, so one @font-face covers the whole weight axis. */
@font-face {
  font-family: "DM Sans";
  src: url("fonts/DMSans-Variable.ttf") format("truetype-variations");
  font-weight: 100 1000;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("fonts/DMMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  /* Palette */
  --background: #111111;
  --surface: rgba(255, 255, 255, 0.08);
  --surface-raised: rgba(255, 255, 255, 0.12);
  --accent: #ffffff;
  --on-accent: #111111;

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.5);
  --text-tertiary: rgba(255, 255, 255, 0.32);

  /* Hairline dividers, and the edge that is the only thing drawing an unfilled
     card. The card edge is deliberately much softer than the app's
     `borderStrong` (40%): on a page the art is what should carry the row, and a
     bright outline around five boxes competes with it. At 8% the card is barely
     more than a suggestion of an edge. */
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.08);

  /* Signal colours — green is you, amber is Duet Lab. Amber rather than the
     accent, since the accent is plain white and would not tell the two apart. */
  --signal-you: #96cb52;
  --signal-ai: #ffca45;

  /* 8pt grid */
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 40px;
  --space-xxl: 48px;
  --space-xxxl: 64px;

  --radius-card: 16px;
  --radius-stage: 24px;
  --radius-control: 12px;
  --radius-well: 8px;

  /* The design specifies tracking as a percentage of the type size, so display
     text sets its own em-based letter-spacing rather than a flat pixel value
     that would go slack as the headline grew. */
  --track-display: -0.02em;

  --display: "DM Sans", system-ui, sans-serif;
  --body: "DM Sans", system-ui, sans-serif;
  --label: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text-primary);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- Layout ---------- */

.fold {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(48px, 9vh, 80px) var(--space-md) var(--space-xxxl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(40px, 7vh, 72px);
}

.copy {
  text-align: center;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xxs);
}

/* The app icon over the wordmark. It ships as a finished tile — its own rounded
   corners and amber ground — so it needs no frame or background here.

   The margin is its own rather than the column's `gap`, which is the tight 4px
   holding the wordmark to its subtitle; at that spacing the tile would sit right
   on top of the title. */
.logo {
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-md);
}

/* The app's h1: DM Sans Bold, set tight. */
.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(40px, 7vw, 68px);
  letter-spacing: var(--track-display);
  line-height: 1.05;
  margin: 0;
}

/* The line under a screen title — the app's dsScreenSubtitle: secondary white,
   not a colour. */
.pitch {
  font-size: clamp(15px, 2vw, 19px);
  line-height: 1.3;
  color: var(--text-secondary);
  margin: 0;
  max-width: 42ch;
  text-wrap: balance;
}

/* ---------- Download ---------- */

.actions {
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

/* The app's primary action: a white capsule with black content. */
.download {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 var(--space-lg);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: var(--track-display);
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: transform 0.16s ease-out, box-shadow 0.16s ease-out,
              filter 0.16s ease-out;
}

.download:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(255, 255, 255, 0.18);
}

.download:active { transform: translateY(0); }

.download:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.download-mark { width: 16px; height: 16px; flex: none; }

/* Until DOWNLOAD_URL is filled in, the button says so rather than pretending to
   work. Faded rather than hidden, matching the app's disabled primary — the
   button is the page's next step, and removing it would leave a hole. */
.download[data-pending="true"] {
  opacity: 0.35;
  cursor: not-allowed;
}
.download[data-pending="true"]:hover {
  transform: none;
  box-shadow: none;
}

/* The caveat under the button — the app sets these in DM Mono at tertiary. */
.requirement {
  margin: 0;
  font-family: var(--label);
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ---------- Demo ---------- */

.demo { width: 100%; }

/* A recessed well, the app's dsWell, holding a 16:9 slot. The aspect ratio is
   declared now so dropping a video in later doesn't reflow the page.

   Capped in height as well as ratio: 16:9 across the full column runs to ~600px,
   which pushes the three cards off the fold and makes an empty box the largest
   thing on a page that is really asking for a download. The cap wins on a wide
   viewport and the ratio governs once the column is narrow enough. */
.demo-slot {
  aspect-ratio: 16 / 9;
  /* Width, not max-height: capping the height alone would keep the box
     full-width and squat, which is not a video's shape. Bounding the width lets
     the ratio set the height and centres what's left over. */
  max-width: calc(420px * 16 / 9);
  margin: 0 auto;
  border-radius: var(--radius-stage);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

/* ---------- Features ---------- */

/* Five cards over three columns leaves a ragged last row. Flex rather than grid
   so that row centres itself: the two leftovers sit under the middle of the
   three above instead of hugging the left edge with a hole beside them.
   `calc` reproduces the 3-up column width by hand, since flex has no
   equivalent of `1fr` once the gaps have to be subtracted. */
.features {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
}

/* The app's dsCard, unselected: no fill, drawn only by its edge. A grey card
   body would put a third value between the ground and the text and flatten the
   contrast the design is built on. */
.feature {
  flex: 0 1 calc((100% - var(--space-md) * 2) / 3);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xxs);
  padding: var(--space-md);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
}

/* The art, sized like the app's mode-card tiles: big enough to be the thing you
   see first, with the title reading as its caption.

   Height rather than width is what's fixed. The five pictures are a mix of
   square and 5:4 sources, so matching their widths would leave the square ones
   visibly taller and the row's baselines ragged; a common height makes them look
   like one set. `object-fit: contain` keeps each subject undistorted inside it.

   The gap below is the card's one big interval, and the title/blurb pair sits
   tight underneath — so the card reads as a picture over a block, rather than
   three evenly-spaced strangers. */
.feature-icon {
  /* Art hidden for now — text-only cards. Everything below is left intact
     deliberately: deleting this one line is all it takes to bring the pictures
     back, with their sizing and alignment already tuned. */
  display: none;

  width: 100%;
  height: 132px;
  margin-bottom: var(--space-sm);
  object-fit: contain;
  /* Left, not centred: the titles and blurbs are left-aligned, and a centred
     picture over left-aligned text leaves the card with two competing axes. */
  object-position: left center;
  /* The art files for the first two cards are cropped flush to their subject, so
     without this they would start hard against the text's left edge. A small
     inset gives them air without letting them drift back to looking centred.
     Applied to every card so the row keeps one left edge; the images that still
     carry their own transparent margin simply sit a touch further in. */
  padding-left: var(--space-xxs);
  /* A slight tilt, so the objects read as set down on the card rather than
     mechanically pasted square to it. The angle alternates and varies per card
     below — five identical tilts would look like a systematic error rather than
     a deliberate hand. `--tilt` is the per-card knob. */
  transform: rotate(var(--tilt, -3deg));
  transform-origin: 40% 60%;
}

/* Varied by position rather than by filename, so re-ordering the cards or
   swapping the art keeps the rhythm instead of moving an angle around with one
   particular picture. */
/* The guitar stands straight — it is tall and symmetrical enough that a tilt
   reads as a mistake rather than as a hand. */
.feature:nth-child(1) .feature-icon { --tilt: 0deg; }
.feature:nth-child(2) .feature-icon { --tilt: -3deg; }
.feature:nth-child(3) .feature-icon { --tilt: -2.5deg; }
.feature:nth-child(4) .feature-icon { --tilt: 3.5deg; }
.feature:nth-child(5) .feature-icon { --tilt: -3deg; }

/* The guitar file is cropped tight to its subject, with none of the transparent
   margin the other art carries. That makes `contain` scale the guitar itself to
   the full box, where the others are scaling their padding — so at an equal box
   height it draws noticeably larger. Shrinking its box is what puts it back in
   line with the row.
 *
 * If a tall, narrow subject is ever dropped in (an upright guitar, a mic stand),
 * the opposite applies: it fits by height and reads small, and wants a taller
 * box with a negative margin paying the growth back. The app does the same thing
 * for the same reason; see `Modality.artOverflow`. */
.feature-icon[src$="guitar.webp"] {
  height: 112px;
  margin-top: 10px;
  margin-bottom: calc(var(--space-sm) + 10px);
}

/* The violin runs the other way: its file keeps a margin all round, so it draws
   a little small against its neighbours. A slightly taller box brings it up,
   with the negative margin holding the card's title where it is. */
.feature-icon[src$="violin.webp"] {
  height: 148px;
  margin-top: -8px;
  margin-bottom: calc(var(--space-sm) - 8px);
}

.feature-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.25;
  color: var(--text-primary);
}

.feature-blurb {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
  text-wrap: pretty;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .features { gap: var(--space-sm); }
  /* One per row — a 5-card wrap at this width would leave a lone card stranded
     on the last line whatever the column count. */
  .feature { flex-basis: 100%; }
  /* Stacked, a full-height picture would push the copy well down the page for
     five cards in a row, so the art gives up some of its height. The two
     per-image overrides above are absolute, so they have to be restated here or
     the guitar and violin would keep their desktop size while everything else
     shrank around them. */
  .feature-icon { height: 96px; margin-bottom: var(--space-sm); }
  .feature-icon[src$="guitar.webp"] {
    height: 82px;
    margin-top: 7px;
    margin-bottom: calc(var(--space-sm) + 7px);
  }
  .feature-icon[src$="violin.webp"] {
    height: 108px;
    margin-top: -6px;
    margin-bottom: calc(var(--space-sm) - 6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .download { transition-duration: 0.01ms; }
}
