@layer components {
/*
 * The stage of the heynote! demonstration: the choice of the example, the
 * dictation on a dark card, the invoice template as a card below. The four
 * examples share one grid cell, so the stage always has the height of the
 * tallest one and nothing moves while words and lines appear. Colors from
 * the tokens only: the dark card is ink with surface as its text, so it fits
 * every family and scheme.
 */
.f-tool[data-tool='heynote-demo'] {
  --t-heynote-demo-text: var(--step-0);
}

.f-tool[data-tool='heynote-demo'] .f-tool__mount:empty {
  display: block;
  min-block-size: 50em;
}

/* The choice: a grid of equal fields, the one that plays shows a thin line. */
.f-tool[data-tool='heynote-demo'] .f-tool__choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@container (min-width: 30em) {
  .f-tool[data-tool='heynote-demo'] .f-tool__choices {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.f-tool[data-tool='heynote-demo'] .f-tool__choice {
  position: relative;
  overflow: hidden;
  gap: var(--space-2xs);
  min-block-size: max(3em, calc(var(--space-xl) + var(--space-xs)));
  padding-inline: var(--space-xs);
  white-space: nowrap;
}

/* The legend is a small label: the heading of the page stands beside the tool. */
.f-tool[data-tool='heynote-demo'] .f-tool__legend {
  margin: 0 0 var(--space-xs);
  font-family: var(--eyebrow-font);
  font-size: var(--step--1);
  font-weight: var(--weight-body-strong);
  letter-spacing: var(--eyebrow-tracking);
  text-transform: var(--eyebrow-case);
  color: var(--color-muted);
}

.f-tool[data-tool='heynote-demo'] .f-tool__form {
  gap: var(--space-xs);
}

.f-tool[data-tool='heynote-demo'] .f-tool__choice::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  block-size: calc(var(--border-width) * 2);
  background-color: var(--color-accent);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left center;
}

.f-tool[data-tool='heynote-demo'] .f-tool__choice[data-playing]::after {
  opacity: 1;
  transform: scaleX(var(--f-tool-at, 0));
  transition: transform var(--duration-fast) linear;
}

.f-tool[data-tool='heynote-demo'] .f-tool__demo {
  display: grid;
  gap: var(--space-s);
  min-inline-size: 0;
}

.f-tool[data-tool='heynote-demo'] .f-tool__stage {
  position: relative;
  display: grid;
  min-inline-size: 0;
}

/* The control: quiet, in the head row of the dark card, over the panels' cell. */
.f-tool[data-tool='heynote-demo'] .f-tool__stage > .f-tool__button {
  grid-area: 1 / 1;
  z-index: 1;
  align-self: start;
  justify-self: end;
  justify-content: center;
  inline-size: max(3.5em, calc(var(--space-xl) + var(--space-xs)));
  min-block-size: max(3.5em, calc(var(--space-xl) + var(--space-xs)));
  min-inline-size: 0;
  margin: var(--space-xs) var(--space-s) 0 0;
  padding: 0;
  border-radius: var(--radius-round);
  background-color: transparent;
  color: var(--color-surface);
  box-shadow: inset 0 0 0 var(--border-width) color-mix(in oklab, var(--color-surface) 45%, var(--color-ink));
  font-family: var(--font-body);
  font-size: var(--step--1);
  letter-spacing: 0;
  text-transform: none;
}

.f-tool[data-tool='heynote-demo'] .f-tool__stage > .f-tool__button:hover {
  background-color: color-mix(in oklab, var(--color-surface) 14%, var(--color-ink));
}

.f-tool[data-tool='heynote-demo'] .f-tool__stage > .f-tool__button::after {
  content: none;
}

.f-tool[data-tool='heynote-demo'] .f-tool__stage > .f-tool__button:focus-visible {
  outline: calc(var(--border-width) * 2) solid var(--color-surface);
  outline-offset: var(--border-width);
}

.f-tool[data-tool='heynote-demo'] .f-tool__button svg {
  flex: none;
  inline-size: 1.2em;
  block-size: 1.2em;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.f-tool[data-tool='heynote-demo'] .f-tool__button svg[hidden] {
  display: none;
}

@container (max-width: 30em) {
  .f-tool[data-tool='heynote-demo'] .f-tool__control-text {
    display: none;
  }

  .f-tool[data-tool='heynote-demo'] .f-tool__stage > .f-tool__button {
    min-inline-size: max(3.5em, calc(var(--space-xl) + var(--space-xs)));
    justify-content: center;
    padding: 0;
  }
}

.f-tool[data-tool='heynote-demo'] .f-tool__panel {
  grid-area: 1 / 1;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 0;
  min-inline-size: 0;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity var(--duration-base) var(--ease),
    visibility var(--duration-base) var(--ease);
}

.f-tool[data-tool='heynote-demo'] .f-tool__panel[data-active] {
  visibility: visible;
  opacity: 1;
}

/* The dictation. */
.f-tool[data-tool='heynote-demo'] .f-tool__say {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-xs) var(--space-s);
  padding: var(--space-s) var(--space-m) var(--space-m);
  border-radius: var(--radius-m);
  background-color: var(--color-ink);
  color: var(--color-surface);
}

.f-tool[data-tool='heynote-demo'] .f-tool__say::after {
  content: '';
  position: absolute;
  inset-inline-start: var(--space-l);
  inset-block-start: 100%;
  border: var(--space-xs) solid transparent;
  border-block-end: 0;
  border-block-start-color: var(--color-ink);
}

.f-tool[data-tool='heynote-demo'] .f-tool__mic {
  position: relative;
  display: grid;
  place-items: center;
  inline-size: 2.6em;
  block-size: 2.6em;
  border-radius: var(--radius-round);
  background-color: var(--color-accent);
  color: var(--color-on-accent);
}

.f-tool[data-tool='heynote-demo'] .f-tool__mic svg {
  inline-size: 1.3em;
  block-size: 1.3em;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.f-tool[data-tool='heynote-demo'] .f-tool__say[data-live] .f-tool__mic::after {
  content: '';
  position: absolute;
  inset: -0.3em;
  border: var(--border-width) solid var(--color-accent);
  border-radius: var(--radius-round);
  animation: t-heynote-demo-pulse var(--duration-slow) ease-out infinite;
}

@keyframes t-heynote-demo-pulse {
  from {
    opacity: 0.9;
    transform: scale(0.9);
  }

  to {
    opacity: 0;
    transform: scale(1.35);
  }
}

.f-tool[data-tool='heynote-demo'] .f-tool__who {
  margin: 0;
  padding-inline-end: 3.5em;
  font-size: var(--t-heynote-demo-text);
  line-height: var(--leading-body);
  color: color-mix(in oklab, var(--color-surface) 72%, var(--color-ink));
}

.f-tool[data-tool='heynote-demo'] .f-tool__said {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--step-1);
  font-weight: var(--weight-heading);
  line-height: 1.35;
  text-wrap: pretty;
}

.f-tool[data-tool='heynote-demo'] .f-tool__sentence {
  display: block;
}

.f-tool[data-tool='heynote-demo'] .f-tool__word,
.f-tool[data-tool='heynote-demo'] .f-tool__link,
.f-tool[data-tool='heynote-demo'] .f-tool__to {
  transition: opacity var(--duration-fast) var(--ease);
}

.f-tool[data-tool='heynote-demo'] .f-tool__line,
.f-tool[data-tool='heynote-demo'] .f-tool__material {
  transition:
    opacity var(--duration-base) var(--ease),
    transform var(--duration-base) var(--ease);
}

.f-tool[data-tool='heynote-demo'] [data-off] {
  opacity: 0;
}

.f-tool[data-tool='heynote-demo'] :is(.f-tool__line, .f-tool__material)[data-off] {
  transform: translateY(var(--space-3xs));
}

/* The line between: what heynote! does with it. */
.f-tool[data-tool='heynote-demo'] .f-tool__link {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin: 0;
  padding-block: var(--space-2xs);
  padding-inline-start: var(--space-l);
  font-family: var(--eyebrow-font);
  font-size: var(--t-heynote-demo-text);
  font-weight: var(--weight-body-strong);
  color: var(--color-heading);
}

.f-tool[data-tool='heynote-demo'] .f-tool__link::before {
  content: '';
  inline-size: calc(var(--border-width) * 2);
  block-size: var(--space-m);
  background-color: var(--color-accent);
}

/* The invoice template as a card. */
.f-tool[data-tool='heynote-demo'] .f-tool__invoice {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
  --t-heynote-demo-pad: var(--space-s);
  overflow: hidden;
  padding: var(--t-heynote-demo-pad) var(--t-heynote-demo-pad) 0;
  border: var(--border-width) solid var(--color-ink);
  border-radius: var(--radius-s);
  background-color: var(--color-surface);
  color: var(--color-ink);
}

.f-tool[data-tool='heynote-demo'] .f-tool__invoice-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2xs) var(--space-s);
  padding-block-end: var(--space-xs);
  border-block-end: var(--border-width) solid var(--color-ink);
}

.f-tool[data-tool='heynote-demo'] .f-tool__invoice-title {
  font-family: var(--eyebrow-font);
  font-size: var(--step--1);
  font-weight: var(--weight-body-strong);
  letter-spacing: var(--eyebrow-tracking);
  text-transform: var(--eyebrow-case);
  color: var(--color-accent);
}

.f-tool[data-tool='heynote-demo'] .f-tool__invoice-time {
  font-size: var(--t-heynote-demo-text);
  color: var(--color-muted);
}

.f-tool[data-tool='heynote-demo'] .f-tool__lines {
  display: grid;
  max-inline-size: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.f-tool[data-tool='heynote-demo'] .f-tool__line {
  display: grid;
  grid-template-columns: 1.6em minmax(0, 1fr);
  gap: 0 var(--space-2xs);
  padding-block: var(--space-2xs);
  border-block-end: var(--border-width) solid var(--color-line);
}

.f-tool[data-tool='heynote-demo'] .f-tool__line-n {
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  color: var(--color-accent);
}

.f-tool[data-tool='heynote-demo'] :is(.f-tool__line, .f-tool__material, .f-tool__to) {
  max-inline-size: none;
  font-size: var(--t-heynote-demo-text);
}

.f-tool[data-tool='heynote-demo'] .f-tool__line-title {
  font-weight: var(--weight-body-strong);
  line-height: var(--leading-heading);
  hyphens: manual;
}

.f-tool[data-tool='heynote-demo'] .f-tool__line-text {
  grid-column: 2;
  color: var(--color-muted);
  line-height: var(--leading-heading);
}

.f-tool[data-tool='heynote-demo'] .f-tool__material {
  display: flex;
  justify-content: space-between;
  gap: var(--space-s);
  padding-block: var(--space-2xs);
  padding-inline-start: calc(1.6em + var(--space-2xs));
  border-block-end: var(--border-width) solid var(--color-line);
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
}

.f-tool[data-tool='heynote-demo'] .f-tool__to {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs) var(--space-xs);
  margin: 0;
  margin-block: auto 0;
  margin-inline: calc(var(--t-heynote-demo-pad) * -1);
  padding: var(--space-xs) var(--t-heynote-demo-pad);
  border-block-start: var(--border-width) solid var(--color-line);
  background-color: var(--color-raised);
  color: var(--color-muted);
}

.f-tool[data-tool='heynote-demo'] .f-tool__target {
  padding: 0 var(--space-xs);
  border-radius: var(--radius-s);
  box-shadow: inset 0 0 0 var(--border-width) var(--color-line);
  font-weight: var(--weight-body-strong);
  color: var(--color-ink);
}


/* On a phone the text of the stage is not smaller than 16 px, whatever the family sets as body size. */
@media (max-width: 40em) {
  .f-tool[data-tool='heynote-demo'] {
    --t-heynote-demo-text: calc(var(--step-0) * 1.07);
  }

  .f-tool[data-tool='heynote-demo'] .f-tool__who {
    padding-inline-end: 3.5em;
  }

  .f-tool[data-tool='heynote-demo'] .f-tool__mount:empty {
    min-block-size: 68em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .f-tool[data-tool='heynote-demo'] * {
    animation: none;
    transition: none;
  }
}

/* The note is the smallest text of the family. */
.f-tool[data-tool='heynote-demo'] .f-tool__note {
  font-size: var(--step--2);
}

/* The choice that plays in the neutral loop: tinted, full ink, the others quiet; a checked choice stays filled. */
.f-tool[data-tool='heynote-demo'] .f-tool__choice[data-playing] {
  background-color: color-mix(in oklab, var(--color-accent) 14%, var(--color-surface));
  color: var(--color-ink);
}

.f-tool[data-tool='heynote-demo'] .f-tool__choices:has([data-playing]) .f-tool__choice:not([data-playing]) {
  color: var(--color-muted);
}

}