/* CloudCell components on Basecoat's native HTML API. */
.system-page {
  background: var(--surface-canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  caret-color: var(--brand-text);
  scrollbar-color: var(--ink-muted) var(--surface-canvas);
}

.system-page :is(h1, h2, h3) { text-wrap: balance; }
.system-page :is(a, button, summary):focus-visible {
  outline: var(--focus-width) solid var(--ring);
  outline-offset: var(--focus-offset);
}
.system-page ::selection { background: var(--brand-tint); color: var(--ink); }
.system-page main :is(section, [id]) { scroll-margin-top: var(--scroll-offset); }

/* Button. No page stylesheet owns any part of its appearance. */
.btn {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: var(--space-8);
  min-width: var(--control);
  height: var(--control);
  min-height: var(--control);
  padding: var(--space-12) var(--space-20);
  border: 0;
  border-radius: var(--radius-control);
  background: linear-gradient(to bottom, var(--brand-action), var(--brand-action-hover));
  color: var(--primary-foreground);
  box-shadow: var(--shadow-primary-highlight), var(--shadow-brand-glow);
  font-family: var(--font-sans);
  font-size: var(--text-button);
  font-weight: var(--weight-strong);
  line-height: var(--lh-control);
  letter-spacing: var(--tracking-control);
  text-align: center;
  text-decoration: none;
  text-transform: none;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  transition: transform var(--duration-micro) var(--ease), opacity var(--duration-micro) var(--ease);
}
.btn:where(:not(:disabled):not([aria-disabled="true"])):hover {
  background: linear-gradient(to bottom, var(--brand-action-hover), var(--brand-action-active));
  color: var(--primary-foreground);
  box-shadow: var(--shadow-primary-highlight), var(--shadow-brand-glow-hover);
  transform: translateY(var(--lift-control));
}
.btn:where(:not(:disabled):not([aria-disabled="true"])):active {
  background: var(--brand-action-active);
  box-shadow: var(--shadow-primary-highlight), var(--shadow-contact);
  transform: translateY(0);
}
.btn:focus-visible { outline: var(--focus-width) solid var(--ring); outline-offset: var(--focus-offset); }
.btn svg {
  width: var(--icon-size);
  height: var(--icon-size);
  flex: 0 0 auto;
  color: inherit;
  overflow: visible;
}
.btn :is(strong, b) { font-weight: inherit; }
.btn :is(svg[data-icon="inline-end"], .btn-arrow) { transition: transform var(--duration-micro) var(--ease); }

.btn[data-variant="secondary"] {
  background: var(--secondary);
  color: var(--secondary-foreground);
  box-shadow: var(--shadow-secondary);
}
.btn[data-variant="secondary"]:where(:not(:disabled):not([aria-disabled="true"])):hover { background: var(--secondary-hover); }
.btn[data-variant="secondary"]:where(:not(:disabled):not([aria-disabled="true"])):active { background: var(--secondary); box-shadow: var(--shadow-contact); }

.btn[data-variant="outline"] {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-raised-sm);
}
.btn[data-variant="outline"]:where(:not(:disabled):not([aria-disabled="true"])):hover { box-shadow: var(--shadow-lifted); }
.btn[data-variant="outline"]:where(:not(:disabled):not([aria-disabled="true"])):active { box-shadow: var(--shadow-raised-sm); }

.btn[data-variant="ghost"] {
  background: var(--surface-clear);
  color: var(--ink);
  box-shadow: none;
}
.btn[data-variant="ghost"]:where(:not(:disabled):not([aria-disabled="true"])):hover { background: var(--accent); transform: none; }
.btn[data-variant="ghost"]:where(:not(:disabled):not([aria-disabled="true"])):active { background: var(--surface-inset); }

.btn[data-variant="link"] {
  justify-content: flex-start;
  padding-inline: 0;
  border-radius: 0;
  border-bottom: var(--rule-width) solid var(--surface-divider);
  background: var(--surface-clear);
  color: var(--ink);
  box-shadow: none;
}
.btn[data-variant="link"]:where(:not(:disabled):not([aria-disabled="true"])):hover { border-bottom-color: var(--brand); transform: none; }
.btn[data-variant="link"]:where(:not(:disabled):not([aria-disabled="true"])):hover :is(svg[data-icon="inline-end"], .btn-arrow) { transform: translateX(var(--shift-arrow)); }
.btn[data-variant="link"]:where(:not(:disabled):not([aria-disabled="true"])):active { border-bottom-color: var(--ink); }
.btn[data-variant="link"]:where(:not(:disabled):not([aria-disabled="true"])):active :is(svg[data-icon="inline-end"], .btn-arrow) { transform: none; }

.btn[data-size="sm"], .btn[data-size="icon-sm"] {
  height: var(--control-sm);
  min-height: var(--control-sm);
  min-width: var(--control-sm);
  font-size: var(--text-button-sm);
}
.btn[data-size="lg"], .btn[data-size="icon-lg"] {
  height: var(--control-lg);
  min-height: var(--control-lg);
  min-width: var(--control-lg);
  font-size: var(--text-button-lg);
}
.btn[data-size="icon-sm"] { width: var(--control-sm); }
.btn[data-size="icon"] { width: var(--control); }
.btn[data-size="icon-lg"] { width: var(--control-lg); }
.btn:is([data-size="icon-sm"], [data-size="icon"], [data-size="icon-lg"]) { padding: 0; }
.btn:is(:disabled, [aria-disabled="true"]) {
  background: var(--surface-inset);
  color: var(--ink-muted);
  box-shadow: none;
  border-color: var(--surface-clear);
  transform: none;
  opacity: 1;
  cursor: default;
  pointer-events: none;
}
.btn:is(:disabled, [aria-disabled="true"]) :is(svg, .btn-arrow) { transform: none; }

/* Card. Only a link card gets a lift; static panels stay still. */
.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: var(--space-24);
  padding: var(--card-padding);
  border: 0;
  border-radius: var(--radius-panel);
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-raised);
  text-decoration: none;
}
.card > :is(header, section, footer) { padding: 0; }
.card > :is(header, section, footer, h2, h3, p, figure) { margin: 0; }
.card > header { display: grid; gap: var(--space-8); }
.card :is(h2, h3) {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-h3);
  font-weight: var(--weight-heading);
  line-height: var(--lh-h3);
  letter-spacing: var(--tracking-h3);
}
.card p { color: var(--ink-muted); line-height: var(--lh-body); }
.card > footer { margin-top: auto; }
.card code { font-family: var(--font-mono); font-size: var(--text-spec); font-weight: var(--weight-label); color: var(--ink-muted); }
.card .card-measure { color: var(--ink); font-size: var(--text-plan-measure); font-weight: var(--weight-heading); line-height: var(--lh-h3); font-variant-numeric: tabular-nums; }
.card .card-measure > span { font-family: var(--font-mono); font-size: var(--text-label); font-weight: var(--weight-label); }
.card .card-price { color: var(--ink); font-size: var(--text-lead); font-weight: var(--weight-heading); font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-list { gap: 0; list-style: none; }
.card-list > li { padding-block: var(--space-16); }
.card-list > li + li { border-top: var(--rule-width) solid var(--surface-divider); }
a.card { transition: transform var(--duration-micro) var(--ease); }
a.card:is(:hover, :focus-visible) { color: var(--ink); box-shadow: var(--shadow-lifted); transform: translateY(var(--lift-card)); }
a.card:focus-visible { outline: var(--focus-width) solid var(--ring); outline-offset: var(--focus-offset); }
a.card:active { box-shadow: var(--shadow-raised); transform: none; }

/* Accordion: native details/summary; the chevron also conveys the state. */
.accordion { min-width: 0; }
.accordion > details { border: 0; border-bottom: var(--rule-width) solid var(--surface-divider); }
.accordion > details:first-child { border-top: var(--rule-width) solid var(--surface-divider); }
.accordion > details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-24);
  min-height: var(--control-sm);
  padding-block: var(--space-20);
  list-style: none;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-h3);
  font-weight: var(--weight-strong);
  line-height: var(--lh-h3);
  letter-spacing: var(--tracking-h3);
  cursor: pointer;
}
.accordion > details > summary::-webkit-details-marker { display: none; }
.accordion > details > summary:hover { background: var(--accent); }
.accordion > details > summary:active { background: var(--surface-inset); }
.accordion > details > summary:focus-visible { outline: var(--focus-width) solid var(--ring); outline-offset: var(--focus-offset); }
.accordion > details > summary > svg {
  width: var(--icon-size);
  height: var(--icon-size);
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--duration-micro) var(--ease);
}
.accordion > details[open] > summary > svg { transform: rotate(180deg); }
.accordion > details > section {
  padding: 0 0 var(--space-24);
  color: var(--ink-muted);
  font-size: var(--text-body);
  line-height: var(--lh-body);
}
.accordion > details > section > p { max-width: var(--reading-measure); margin: 0; }
.accordion > details > section .btn { margin-top: var(--space-16); margin-inline-end: var(--space-20); }

/* Frame: square rules own the page structure, never page-length rails. */
.frame {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: var(--max);
  margin-inline: auto;
  border-top: var(--rule-width) solid var(--surface-divider);
}
.frame[data-rule="strong"] { border-top-color: var(--ink); }
.frame-inset { padding-inline: var(--frame-inset); }
.frame-band {
  display: grid;
  grid-template-columns: repeat(var(--band-columns, 3), minmax(0, 1fr));
  min-width: 0;
  margin: 0;
  border-block: var(--rule-width) solid var(--surface-divider);
}
.frame-band-cells { display: contents; }
:is(.frame-band > :not(.frame-band-cells), .frame-band > .frame-band-cells > *) {
  min-width: 0;
  padding: var(--band-padding);
  border: 0;
  border-inline-start: var(--rule-width) solid var(--surface-divider);
}
:is(.frame-band > :not(.frame-band-cells):first-child, .frame-band > .frame-band-cells > :first-child) { border-inline-start: 0; }

/* Purchase surfaces on the pilot pages. */
.system-page .cart-float:not(.is-open) { width: auto; padding: var(--space-8); }
.system-page .cart-float.is-open > [data-cart-toggle] { display: none; }
.system-page .cart-float__label { display: none; }
.system-page .cart-dialog__primary { margin-top: var(--space-24); }
.system-page .order-launcher { position: fixed; z-index: 30; right: calc(var(--floating-offset) + var(--space-64) + var(--space-16)); bottom: var(--floating-offset); }
.system-page:has(.cart-float.is-open) .order-launcher { display: none; }
.system-page .order-launcher-list li > .btn { width: 100%; flex-direction: column; align-items: flex-start; gap: var(--space-4); white-space: normal; text-align: start; }
.btn [data-cart-count] {
  position: absolute;
  top: calc(-1 * var(--space-4));
  right: calc(-1 * var(--space-4));
  display: grid;
  place-items: center;
  min-width: var(--space-20);
  min-height: var(--space-20);
  padding: var(--space-4);
  border-radius: var(--radius-full);
  background: var(--ink);
  color: var(--primary-foreground);
  font-size: var(--text-label);
  line-height: var(--lh-label);
  font-variant-numeric: tabular-nums;
}
.system-page [tabindex="0"]:focus-visible { outline: var(--focus-width) solid var(--ring); outline-offset: var(--focus-offset); }



@media (max-width: 639px) {
  .frame-band { grid-template-columns: minmax(0, 1fr); }
  :is(.frame-band > :not(.frame-band-cells), .frame-band > .frame-band-cells > *) {
    border-inline-start: 0;
    border-top: var(--rule-width) solid var(--surface-divider);
  }
  :is(.frame-band > :not(.frame-band-cells):first-child, .frame-band > .frame-band-cells > :first-child) { border-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html:has(.system-page) { scroll-behavior: auto; }
  .system-page *, .system-page *::before, .system-page *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
