/* Trim deal and product specimens */

.system-specimen :where(button, input, summary):focus-visible,
.specimen-dialog button:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: var(--focus-offset);
}

.system-specimen [hidden] {
  display: none;
}

.specimen-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: clip;
  clip-path: inset(50%);
  white-space: nowrap;
}

.specimen-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-block: var(--space-8) var(--space-5);
}

.system-specimen :where(.specimen-heading, .specimen-controls, .specimen-progress, .specimen-ticket) h3,
.specimen-dialog h3 {
  margin: 0;
  font-family: var(--font-family-heading);
  font-size: clamp(1.5rem, 2vw, 2rem);
  line-height: 1.12;
  font-weight: var(--font-weight-bold);
  min-width: 0;
  overflow-wrap: break-word;
}

.system-specimen :where(.specimen-heading, .specimen-controls, .specimen-progress, .specimen-ticket) h3 + p {
  margin: var(--space-2) 0 0;
}

.specimen-heading p,
.specimen-controls p,
.specimen-progress p {
  max-width: 54ch;
  color: var(--color-text-secondary);
}

.specimen-filters {
  display: flex;
  align-items: stretch;
  gap: var(--space-1);
  flex-wrap: wrap;
  padding: var(--space-1);
  background: var(--color-surface-paper);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-full);
}

.specimen-filters button {
  padding: var(--space-1) var(--space-4);
  min-height: var(--component-chip-interactive-height);
  border: 0;
  border-radius: var(--radius-full);
  background: var(--color-surface-paper);
  color: var(--color-text-primary);
  cursor: pointer;
  font: var(--typography-label);
  font-size: var(--font-size-md);
}

.specimen-filters button[aria-pressed="false"]:hover {
  background: var(--color-lilac-300);
}

.specimen-filters button[aria-pressed="true"] {
  color: var(--component-chip-selected-foreground);
  background: var(--component-chip-selected-background);
}

.specimen-deal-grid,
.specimen-pattern-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
}

.specimen-deal {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: clip;
  background: var(--component-deal-card-background);
  border: 1px solid var(--component-deal-card-border);
  border-radius: var(--component-deal-card-radius);
}

.specimen-deal img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--component-deal-card-media-ratio);
  object-fit: cover;
  object-position: center 43%;
  background: var(--color-lilac-300);
}

.specimen-deal[data-deal-category="local"] img {
  background: var(--color-sage-200);
  object-position: center 47%;
}

.specimen-deal-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(var(--space-6), 3vw, var(--space-8));
}

.specimen-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: var(--component-chip-height);
  max-width: 100%;
  padding: var(--space-1) var(--component-chip-padding-inline);
  margin: 0;
  color: var(--color-text-primary);
  border-radius: var(--component-chip-radius);
  font: var(--component-chip-label);
  font-size: var(--font-size-md);
}

.specimen-pill-app {
  background: var(--color-category-app-trial-background);
  color: var(--color-category-app-trial-foreground);
}

.specimen-pill-local {
  background: var(--color-category-store-promo-background);
  color: var(--color-category-store-promo-foreground);
}

.specimen-pill-ticket { background: var(--color-ochre-200); }

.specimen-deal h4 {
  margin: var(--component-deal-card-gap) 0 var(--space-2);
  font-size: var(--component-deal-card-title-font-size);
  line-height: var(--component-deal-card-title-line-height);
  letter-spacing: var(--component-deal-card-title-letter-spacing);
  overflow-wrap: break-word;
  min-width: 0;
}

.specimen-deal h4 + p {
  max-width: 48ch;
  margin: 0 0 var(--space-5);
  color: var(--color-text-secondary);
}

.specimen-deal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-self: stretch;
  padding-block-start: var(--space-4);
  margin-top: auto;
  border-block-start: 1px solid var(--color-border-default);
}

.specimen-deal-foot p { margin: 0; }

.specimen-deal-foot p + p {
  color: var(--color-text-secondary);
  font: var(--component-deal-card-metadata);
  font-size: var(--font-size-md);
}

.specimen-amount {
  color: var(--component-deal-card-payout-color);
  font: var(--component-deal-card-payout);
  letter-spacing: var(--component-deal-card-payout-letter-spacing);
  font-variant-numeric: lining-nums tabular-nums;
}

.specimen-button {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  min-height: var(--component-button-height);
  padding: var(--space-2) var(--component-button-padding-inline);
  border: 1px solid var(--component-button-primary-background);
  border-radius: var(--component-button-radius);
  cursor: pointer;
  font: var(--component-button-label);
  font-size: var(--font-size-md);
  text-align: center;
}

.specimen-button-primary {
  background: var(--component-button-primary-background);
  color: var(--component-button-primary-foreground);
}

.specimen-button-primary:hover { background: var(--component-button-primary-hover); }
.specimen-button-primary:active { background: var(--component-button-primary-pressed); }

.specimen-button-secondary,
.specimen-button-subtle {
  background: var(--component-button-secondary-background);
  color: var(--component-button-secondary-foreground);
  border-color: var(--component-button-secondary-border);
}

.specimen-button-secondary:hover,
.specimen-button-subtle:hover {
  background: var(--component-button-secondary-hover);
}

.specimen-button-secondary:active,
.specimen-button-subtle:active {
  background: var(--color-action-primary-pressed);
  color: var(--color-action-on-primary);
}

.specimen-button-subtle { border-color: var(--color-border-default); }

.specimen-button:disabled {
  background: var(--component-button-disabled-background);
  color: var(--component-button-disabled-foreground);
  border-color: var(--color-border-default);
  cursor: default;
}

.specimen-fallback {
  width: 100%;
  margin-block-start: var(--space-4);
}

.specimen-fallback summary {
  width: fit-content;
  padding: var(--space-3) var(--space-4);
  color: var(--color-action-primary);
  border: 1px solid var(--color-action-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 650;
}

.specimen-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  align-items: center;
  gap: var(--space-6);
  padding: clamp(var(--space-6), 3vw, var(--space-8));
  margin-block-start: var(--space-6);
  background: var(--color-surface-paper);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
}

.specimen-form label {
  display: block;
  margin-block-end: var(--space-1);
  font-weight: 700;
}

.specimen-field-hint,
.specimen-field-message {
  margin: 0;
  font: var(--typography-body);
}

.specimen-controls .specimen-field-hint { color: var(--component-field-hint); }

.specimen-form-row {
  display: flex;
  gap: var(--component-field-gap);
  align-items: center;
  flex-wrap: wrap;
  margin-block: var(--space-2);
}

.specimen-form input {
  flex: 1 1 10ch;
  min-width: 0;
  width: 100%;
  min-height: var(--component-field-height);
  padding-inline: var(--component-field-padding-inline);
  color: var(--component-field-foreground);
  background: var(--component-field-background);
  border: 1px solid var(--component-field-border);
  border-radius: var(--component-field-radius);
  font: var(--typography-body);
}

.specimen-form input:hover { border-color: var(--component-field-hover-border); }
.specimen-form input:disabled { background: var(--component-field-disabled-background); }

.specimen-form input[aria-invalid="true"] { border-color: var(--component-field-error-border); }
.specimen-form input[data-state="success"] { border-color: var(--component-field-success-border); }

.specimen-field-message {
  min-height: 1.4em;
  font-weight: 650;
}

.specimen-field-message[data-state="error"] { color: var(--component-field-error-text); }
.specimen-field-message[data-state="success"] { color: var(--color-feedback-success-foreground); }

.specimen-pattern-grid {
  margin-block-start: var(--space-7);
  align-items: stretch;
}

.specimen-progress,
.specimen-ticket {
  border-radius: var(--radius-xl);
}

.specimen-progress {
  padding: clamp(var(--space-6), 3vw, var(--space-8));
  background: var(--color-surface-paper);
  border: 1px solid var(--color-border-default);
}

.specimen-progress ol {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0 0;
}

.specimen-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-3);
  padding-block: var(--space-4);
  border-block-start: 1px solid var(--color-border-default);
}

.specimen-step:last-child { padding-block-end: 0; }

.specimen-step-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-full);
  color: var(--color-text-primary);
}

.specimen-step-done .specimen-step-icon {
  background: var(--color-sage-200);
  border-color: var(--color-sage-200);
}

.specimen-step-done .specimen-step-icon::after {
  content: "";
  width: 9px;
  height: 5px;
  border-inline-start: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: translateY(-1px) rotate(-45deg);
}

.specimen-step-current .specimen-step-icon {
  background: var(--color-lilac-300);
  border-color: var(--color-lilac-300);
}

.specimen-step-current .specimen-step-icon::after {
  content: "";
  width: 6px;
  height: 8px;
  border-inline-start: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: translate(2px, -2px);
}

.specimen-step h4 {
  margin: 0 0 var(--space-1);
  font-size: var(--font-size-lg);
  line-height: 1.35;
}

.specimen-step p {
  margin: 0;
}

.specimen-step-label {
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-full);
  line-height: 1.2;
  color: var(--color-text-primary);
  font-size: var(--font-size-md);
  font-weight: 700;
}

.specimen-step-done .specimen-step-label {
  border-color: var(--color-status-approved-background);
  background: var(--color-status-approved-background);
  color: var(--color-status-approved-foreground);
}

.specimen-step-current .specimen-step-label {
  border-color: var(--color-status-in-review-background);
  background: var(--color-status-in-review-background);
  color: var(--color-status-in-review-foreground);
}

.specimen-ticket {
  overflow: clip;
  color: var(--color-action-on-primary);
  background: var(--color-action-primary);
}

.specimen-ticket-top,
.specimen-ticket-bottom { padding: clamp(var(--space-6), 3vw, var(--space-8)); }

.system-specimen .specimen-ticket h3 {
  margin-block-start: var(--space-4);
  font-size: clamp(2rem, 3.15vw, 3rem);
}

.specimen-ticket-bottom {
  position: relative;
  border-block-start: 1px dashed var(--color-lilac-300);
}

.specimen-ticket-bottom::before,
.specimen-ticket-bottom::after {
  position: absolute;
  content: "";
  inset-block-start: -10px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--color-surface-canvas);
}

.specimen-ticket-bottom::before { inset-inline-start: -10px; }
.specimen-ticket-bottom::after { inset-inline-end: -10px; }

.specimen-ticket-code {
  display: block;
  width: fit-content;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-lilac-300);
  border-radius: var(--radius-sm);
  font-family: var(--font-family-body);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.05em;
}

.specimen-ticket-bottom p {
  max-width: 40ch;
  margin: var(--space-4) 0 0;
}

.specimen-dialog {
  box-sizing: border-box;
  width: min(calc(100% - 2rem), var(--component-dialog-width));
  max-height: calc(100% - 2rem);
  padding: 0;
  color: var(--color-text-primary);
  background: var(--component-dialog-background);
  border: 0;
  border-radius: var(--component-dialog-radius);
  box-shadow: var(--component-dialog-shadow);
}

.specimen-dialog::backdrop {
  background: var(--component-dialog-scrim);
}

.specimen-dialog-content { padding: var(--component-dialog-padding); }

.specimen-dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--component-dialog-gap);
}

.specimen-dialog-content > p {
  margin: var(--space-1) 0 0;
  color: var(--color-text-secondary);
}

.specimen-dialog dl,
.specimen-fallback dl { margin: var(--space-5) 0 0; }

.specimen-dialog dt,
.specimen-fallback dt { font-weight: var(--font-weight-bold); }

.specimen-dialog dd,
.specimen-fallback dd {
  max-width: 60ch;
  margin: var(--space-2) 0 var(--space-5);
  color: var(--color-text-secondary);
}

.specimen-dialog dd:last-child,
.specimen-fallback dd:last-child { margin-block-end: 0; }

.specimen-close {
  position: relative;
  width: var(--size-touch-target);
  height: var(--size-touch-target);
  background: var(--color-surface-paper);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-full);
  color: var(--color-action-primary);
  cursor: pointer;
}

.specimen-close:hover { background: var(--color-lilac-300); }

.specimen-close::before,
.specimen-close::after {
  position: absolute;
  inset: 50% auto auto 50%;
  content: "";
  width: 16px;
  height: 2px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}

.specimen-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

@media (max-width: 760px) {
  .specimen-deal-grid,
  .specimen-pattern-grid,
  .specimen-controls { grid-template-columns: minmax(0, 1fr); }

  .specimen-deal img { aspect-ratio: 1.85 / 1; }
}

@media (max-width: 400px) {
  .specimen-filters button { padding-inline: var(--space-3); }

  .specimen-deal-body,
  .specimen-controls,
  .specimen-progress,
  .specimen-ticket-top,
  .specimen-ticket-bottom,
  .specimen-dialog-content { padding: var(--space-4); }

  .specimen-step { grid-template-columns: auto minmax(0, 1fr); }
  .specimen-step-label { grid-column: 2; justify-self: start; }
}
