/* Form & Function collection primitives; all selectors are namespaced. */
.ff-demo {
  --ff-bg: var(--cc-canvas, #e9eaed);
  --ff-text: var(--cc-ink, #1d1d1f);
  --ff-muted: var(--cc-muted, #55555d);
  --ff-accent: var(--cc-accent, #0066cc);
  --ff-outline: var(--cc-accent, #0066cc);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 210px;
  padding: 24px;
  overflow: hidden;
  font:
    14px/1.45 system-ui,
    sans-serif;
  color: var(--ff-text);
  isolation: isolate;

  font-family: var(--cc-font, system-ui, sans-serif);
}
.ff-demo * {
  box-sizing: border-box;
}
.ff-demo--glass {
  background: var(--cc-stage, linear-gradient(135deg, #f4f6f8, #dce3ea));
}
.ff-demo--soft {
  background: var(--cc-canvas, #e9eaed);
}
.ff-demo button,
.ff-demo input,
.ff-demo textarea,
.ff-demo select {
  font: inherit;
}
.ff-demo button {
  cursor: pointer;
}
.ff-demo :is(button, input, textarea, select, summary):focus-visible {
  outline: 3px solid var(--ff-outline);
  outline-offset: 3px;
}
.ff-c-surface {
  width: min(100%, 280px);
  padding: 20px;

  border-radius: var(--cc-radius-surface, 20px);
  color: var(--ff-text);
}
.ff-demo--glass .ff-c-surface {
  background: var(--cc-glass, linear-gradient(135deg, #ffffffeb, #edf3f9d9));
  border: 1px solid #ffffffdb;

  box-shadow: var(--cc-shadow, 0 10px 28px -14px #26344942, inset 0 1px 0 #fff);
  -webkit-backdrop-filter: blur(var(--cc-frost, 15px));
  backdrop-filter: blur(var(--cc-frost, 15px));

  border-color: var(--cc-glass-edge, #ffffffe0);
}
.ff-demo--soft .ff-c-surface {
  background: var(--ff-bg);

  box-shadow: var(--cc-shadow, 0 10px 28px -14px #26344942, inset 0 1px 0 #fff);
}
.ff-c-surface h3,
.ff-c-surface h4 {
  color: var(--ff-text);
  margin: 5px 0 8px;
  line-height: 1.2;
}
.ff-c-surface p {
  color: var(--ff-muted);
  font-size: 13px;
  margin: 0;
}
.ff-c-kicker {
  color: var(--cc-accent, #0066cc);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ff-c-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ff-c-spread {
  justify-content: space-between;
}
.ff-c-stack {
  display: grid;
  gap: 10px;
}
.ff-c-button {
  border: 1px solid transparent;

  border-radius: var(--cc-radius-control, 12px);
  padding: 10px 15px;
  background: var(--cc-accent, #0066cc);

  color: var(--cc-on-accent, #fff);
  font-weight: 700;
  transition:
    transform 0.25s,
    box-shadow 0.25s,
    background 0.25s;
}
.ff-c-button:hover {
  transform: translateY(-3px);

  box-shadow: 0 8px 20px
    color-mix(in srgb, var(--cc-accent, #0066cc) 22%, transparent);
}
.ff-c-button:active {
  transform: translateY(1px);
}
.ff-c-button--light {
  background: var(--cc-glass-fill, #f8f9fbe0);
  color: var(--cc-ink, #1d1d1f);
  border-color: #fff;
}
.ff-demo--soft .ff-c-button--light {
  background: var(--ff-bg);
  border: 0;
  box-shadow:
    5px 5px 10px #c6cbd6,
    -5px -5px 10px #fff;
}
.ff-demo--soft .ff-c-button--light:active,
.ff-demo--soft .ff-c-button--light[aria-pressed="true"] {
  box-shadow:
    inset 4px 4px 8px #c6cbd6,
    inset -4px -4px 8px #fff;
}
/* The existing tactile action keeps a fixed lower edge while its face presses
   down. Only the standalone action row uses this treatment; the companion
   toggle retains its distinct, persistent selected state. */
.ff-demo--soft > .ff-c-row > .ff-c-button:not(.ff-c-button--light) {
  --ff-button-edge: color-mix(
    in srgb,
    var(--cc-pop, var(--cc-accent, #0066cc)) 68%,
    var(--cc-shadow-ink, #263449)
  );
  transform: translateY(0);
  box-shadow:
    0 4px 0 var(--ff-button-edge),
    0 8px 12px -4px
      color-mix(in srgb, var(--cc-shadow-ink, #263449) 26%, transparent),
    inset 0 1px 0
      color-mix(in srgb, var(--cc-glass-edge, #fff) 40%, transparent);
  transition:
    transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 160ms cubic-bezier(0.16, 1, 0.3, 1),
    filter 160ms ease;
}
.ff-demo--soft
  > .ff-c-row
  > .ff-c-button:not(.ff-c-button--light):hover:not(
    :disabled,
    [aria-disabled="true"]
  ) {
  filter: brightness(1.05);
}
.ff-demo--soft
  > .ff-c-row
  > .ff-c-button:not(.ff-c-button--light):active:not(
    :disabled,
    [aria-disabled="true"]
  ) {
  transform: translateY(4px);
  box-shadow:
    0 0 0 var(--ff-button-edge),
    0 2px 3px -1px
      color-mix(in srgb, var(--cc-shadow-ink, #263449) 20%, transparent),
    inset 0 1px 0
      color-mix(in srgb, var(--cc-glass-edge, #fff) 25%, transparent);
  filter: brightness(0.98);
  transition-duration: 70ms;
}
.ff-demo--soft
  > .ff-c-row
  > .ff-c-button:not(.ff-c-button--light):is(
    :disabled,
    [aria-disabled="true"]
  ) {
  cursor: not-allowed;
  opacity: 0.5;
  filter: none;
  transition: none;
}
html:is([data-motion="paused"], [data-ff-motion="off"], .ff-preview-paused)
  .ff-demo--soft
  > .ff-c-row
  > .ff-c-button:not(.ff-c-button--light) {
  transform: none !important;
  transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .ff-demo--soft > .ff-c-row > .ff-c-button:not(.ff-c-button--light) {
    transform: none !important;
    transition: none !important;
  }
}
.ff-c-circle {
  border: 0;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;

  background: var(--cc-glass-fill, #f8f9fbe0);
  color: var(--cc-accent, #0066cc);
  font-size: 19px;
}
.ff-c-circle[aria-pressed="true"] {
  background: var(--cc-accent, #0066cc);

  color: var(--cc-on-accent, #fff);
}
.ff-c-avatar {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;

  background: linear-gradient(
    135deg,
    var(--cc-accent-soft, #e4effa),
    var(--cc-surface, #f8f9fb)
  );
  color: var(--cc-ink, #1d1d1f);
  font-weight: 800;
}
.ff-c-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 99px;

  background: var(--cc-success-soft, #e5f4ed);
  color: var(--cc-success, #187958);
  font-size: 11px;
  font-weight: 750;
}
.ff-c-label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--cc-ink, #1d1d1f);
}
.ff-c-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--cc-border, #cbd1d9);
  border-radius: 10px;
  padding: 10px 11px;

  background: var(--cc-surface, #f8f9fb);
  color: var(--cc-ink, #1d1d1f);
}
.ff-demo--soft .ff-c-input {
  border-color: var(--cc-border, #cbd1d9);
  background: var(--cc-canvas, #e9eaed);
  box-shadow:
    inset 4px 4px 8px #c6cbd6,
    inset -4px -4px 8px #fff;
}
.ff-c-note {
  min-height: 1.4em;
  font-size: 12px;
  color: var(--cc-success, #187958);
}
.ff-c-switch {
  appearance: none;
  width: 46px;
  height: 26px;
  border: 0;
  border-radius: 99px;
  background: #9ea9bd;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.ff-c-switch:after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.ff-c-switch:checked {
  background: var(--cc-accent, #0066cc);
}
.ff-c-switch:checked:after {
  transform: translateX(20px);
}
.ff-c-meter {
  height: 9px;
  border-radius: 20px;
  background: var(--cc-border, #cbd1d9);
  overflow: hidden;
}
.ff-c-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;

  background: linear-gradient(
    90deg,
    var(--cc-accent, #0066cc),
    color-mix(in srgb, var(--cc-accent, #0066cc) 36%, white)
  );
  transition: width 0.4s;
}
.ff-c-tabs {
  display: flex;
  gap: 4px;
  border-radius: 12px;
  padding: 4px;
  background: var(--cc-surface, #f8f9fb);
}
.ff-c-tab {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 9px;
  color: var(--cc-muted, #55555d);
  padding: 8px;
  font-size: 12px;
  font-weight: 700;
}
.ff-c-tab[aria-pressed="true"] {
  background: var(--cc-surface, #f8f9fb);
  color: var(--cc-accent, #0066cc);
  box-shadow: 0 2px 8px #25355020;
}
.ff-c-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.ff-c-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.ff-c-check {
  accent-color: var(--cc-accent, #0066cc);
  width: 17px;
  height: 17px;
}
/* A labelled choice selects the whole row; its native input remains accessible. */
@supports selector(:has(*)) {
  label.ff-c-row:has(> .ff-c-check) {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 44px;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--cc-glass-edge, #ffffffe0);
    border-radius: var(--cc-radius-control, 13px);
    background: var(--cc-glass, linear-gradient(135deg, #ffffffeb, #edf3f9d9));
    color: var(--cc-ink, #1d1d1f);
    box-shadow: var(--cc-shadow, 0 2px 7px #26344914);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    transition:
      background-color 0.25s,
      box-shadow 0.3s,
      color 0.25s;
  }
  label.ff-c-row:has(> .ff-c-check) > .ff-c-check {
    position: absolute;
    width: 1px;
    height: 1px;
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: -1px;
    border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  label.ff-c-row:has(> .ff-c-check) > .ff-c-check:focus-visible {
    outline: none;
  }
  label.ff-c-row:has(> .ff-c-check:checked) {
    background: var(--cc-accent-soft, #e4effa);
    color: var(--cc-accent-strong, #0056ad);
    font-weight: 650;
    box-shadow:
      inset 3px 0 var(--cc-accent, #0066cc),
      var(--cc-shadow, 0 2px 7px #26344914);
  }
  label.ff-c-row:has(> .ff-c-check:not(:disabled)):hover {
    box-shadow:
      inset 3px 0 var(--cc-border, #cbd1d9),
      0 5px 15px #26344920;
  }
  label.ff-c-row:has(> .ff-c-check:checked:not(:disabled)):hover {
    box-shadow:
      inset 3px 0 var(--cc-accent, #0066cc),
      0 5px 15px #26344920;
  }
  label.ff-c-row:has(> .ff-c-check:focus-visible) {
    box-shadow: var(--cc-focus, 0 0 0 3px #0066cc26);
  }
  label.ff-c-row:has(> .ff-c-check:checked:focus-visible) {
    box-shadow:
      inset 3px 0 var(--cc-accent, #0066cc),
      var(--cc-focus, 0 0 0 3px #0066cc26);
  }
  label.ff-c-row:has(> .ff-c-check:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
  }
  @media (forced-colors: active) {
    label.ff-c-row:has(> .ff-c-check) {
      border-color: ButtonText;
    }
    label.ff-c-row:has(> .ff-c-check:checked) {
      forced-color-adjust: none;
      background: Highlight;
      color: HighlightText;
      border-color: Highlight;
    }
    label.ff-c-row:has(> .ff-c-check:focus-visible) {
      outline: 2px solid Highlight;
      outline-offset: 3px;
    }
    label.ff-c-row:has(> .ff-c-check:disabled) {
      color: GrayText;
      border-color: GrayText;
    }
  }
}

.ff-c-range {
  width: 100%;
  accent-color: var(--cc-accent, #0066cc);
}
.ff-c-pop {
  animation: ff-c-pop 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ff-c-pulse {
  animation: ff-c-pulse 2s ease-in-out infinite;
}
.ff-c-tooltip {
  position: relative;
}
.ff-c-tooltip:after {
  content: attr(data-ff-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  white-space: nowrap;

  background: var(--cc-night, #142235);
  color: #fff;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
}
.ff-c-tooltip:hover:after,
.ff-c-tooltip:focus-visible:after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.ff-c-skeleton {
  height: 9px;

  background: linear-gradient(
    90deg,
    var(--cc-border, #cbd1d9),
    var(--cc-surface, #f8f9fb),
    var(--cc-border, #cbd1d9)
  );
  background-size: 200% 100%;
  border-radius: 10px;
  animation: ff-c-shimmer 1.5s linear infinite;
}
.ff-c-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #b2bbcf;
  border-top-color: var(--cc-accent, #0066cc);
  border-radius: 50%;
  animation: ff-c-spin 0.9s linear infinite;
}
.ff-c-details summary {
  cursor: pointer;
  font-weight: 750;
}
.ff-c-details p {
  padding-top: 10px;
}
.ff-c-counter {
  font-size: 24px;
  font-weight: 750;
  min-width: 38px;
  text-align: center;
}
.ff-c-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  border-radius: 12px;

  background: var(--cc-night, #142235);
  color: white;
  padding: 13px 18px;
  box-shadow: 0 10px 30px #15251f44;
  font: 600 14px system-ui;
}
.ff-c-menu {
  display: grid;
  gap: 4px;
}
.ff-c-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--cc-ink, #1d1d1f);
}
.ff-c-menu a:hover,
.ff-c-menu a:focus-visible {
  background: var(--cc-accent-soft, #e4effa);
}
.ff-c-price {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.05em;
}
.ff-c-step {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cc-accent, #0066cc);

  color: var(--cc-on-accent, #fff);
  font-size: 12px;
  font-weight: 800;
}
.ff-c-divider {
  border: 0;
  border-top: 1px solid var(--cc-border, #cbd1d9);
  margin: 14px 0;
}
@keyframes ff-c-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes ff-c-shimmer {
  to {
    background-position: -200% 0;
  }
}
@keyframes ff-c-pop {
  from {
    opacity: 0;
    translate: 0 8px;
    scale: 0.97;
  }
  to {
    opacity: 1;
    translate: 0 0;
    scale: 1;
  }
}
@keyframes ff-c-pulse {
  50% {
    box-shadow: 0 0 0 12px #0066cc20;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ff-demo *,
  .ff-demo *:before,
  .ff-demo *:after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Subtle ambient movement gives every preview a live backdrop. */
.ff-demo {
  width: 100%;
  transition: box-shadow 0.3s ease;
}
.ff-demo:before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  top: -45px;
  right: -30px;
  pointer-events: none;
  background: radial-gradient(circle, #fff9, transparent 70%);
  animation: ff-c-ambient 7s ease-in-out infinite alternate;
}
.ff-demo--soft:before {
  background: radial-gradient(circle, #ffffffc9, transparent 70%);
}
.ff-demo:focus-within,
.ff-demo:hover {
  box-shadow: inset 0 0 0 1px #ffffffa6;
}
.ff-demo .ff-c-surface {
  transition:
    transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.35s ease;
}
.ff-demo:hover .ff-c-surface,
.ff-demo:focus-within .ff-c-surface {
  transform: translateY(-4px);
}
.ff-demo .ff-c-circle,
.ff-demo .ff-c-tab,
.ff-demo .ff-c-input,
.ff-demo .ff-c-menu a {
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}
.ff-demo .ff-c-circle:hover {
  transform: scale(1.09) rotate(-6deg);
}
.ff-demo .ff-c-input:focus {
  box-shadow: 0 0 0 4px #0066cc26;
}
.ff-demo .ff-c-menu a:hover {
  transform: translateX(3px);
}
@keyframes ff-c-ambient {
  from {
    transform: translate(-5px, 2px) scale(1);
    opacity: 0.55;
  }
  to {
    transform: translate(-40px, 30px) scale(1.35);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ff-demo:before,
  .ff-demo:after,
  .ff-demo .ff-c-surface,
  .ff-demo .ff-c-circle,
  .ff-demo .ff-c-tab,
  .ff-demo .ff-c-input,
  .ff-demo .ff-c-menu a {
    animation: none !important;
    transition: none !important;
  }
  .ff-demo:hover .ff-c-surface,
  .ff-demo:focus-within .ff-c-surface,
  .ff-demo .ff-c-circle:hover,
  .ff-demo .ff-c-menu a:hover {
    transform: none;
  }
}
