@layer layout {
  .stage {
    --stage-max: 700px;
  }
}

@layer components {
  .demo-card {
    /* (container - 30rem) is negative when narrow, positive when wide; *1000 forces clamp()
       to saturate at exactly 0px or 1px rather than easing through the middle */
    --switch: clamp(0px, (100cqi - 30rem) * 1000, 1px);
    /* dividing by 1px turns the 0px/1px snap into a plain 0/1 number so it can scale other properties below */
    --wide: calc(var(--switch) / 1px);
    display: grid;
    /* each clamp() ranges from its narrow value to its wide value; --wide picks the endpoint, 0 or 1 */
    gap: clamp(var(--space-5), calc(var(--space-5) + var(--wide) * var(--space-5)), var(--space-10));
    padding: clamp(var(--space-10), calc(var(--space-10) + var(--wide) * var(--space-10)), var(--space-13));
    border-radius: clamp(var(--space-5), calc(var(--space-5) + var(--wide) * var(--space-10)), var(--space-12));
    background: var(--color-surface);
    border: 1px solid var(--color-border);

    strong {
      font-size: 1.25rem;
    }

    small {
      color: var(--color-muted);
    }
  }
}
