/* packages.css — project request (#start-a-project; #services in Upwork mode). Script: js/packages.js
   The accent red is used here only, on "Request a quote". */

.builder__intro {
  margin-bottom: var(--space-content);
}

.builder__grid {
  display: grid;
  gap: var(--space-7);
}

/* Split layout: options left, summary right and kept in view while choosing */
@media (min-width: 1024px) {
  .builder--split .builder__grid {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    column-gap: var(--space-8);
    align-items: start;
  }

  .builder--split .builder__summary {
    position: sticky;
    top: var(--space-6);
  }
}

/* Stacked layout: summary below the options, kept to a readable width */
.builder--stacked .builder__summary {
  max-width: 28rem;
}

/* ---------- Options: one row of choices per group ---------- */

.choice {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.choice[hidden] {
  display: none;
}

.choice + .choice {
  margin-top: var(--space-6);
}

.choice__legend {
  margin-bottom: var(--space-3);
  padding: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.choice__options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.choice__item {
  position: relative;
}

/* The radio stays focusable and readable; its label is the visible control */
.choice__input {
  position: absolute;
  inset: 0;
  /* Stays above the label: the label's :active transform would otherwise lift it
     over the input mid-click, and the click would miss the radio (desktop mouse) */
  z-index: 1;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice__label {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-sm);
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

/* Phones: slightly narrower padding keeps a row of four options on one line
   now that each option reserves its bold width (below) */
@media (max-width: 639px) {
  .choice__label {
    padding-inline: var(--space-3);
  }
}

/* The selected option turns bold. A hidden bold copy of the text (data-text)
   sets the width from the start, so choosing never shifts the row. */
.choice__text {
  display: inline-grid;
}

.choice__text::after {
  content: attr(data-text) / "";
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: var(--weight-bold);
  pointer-events: none;
  user-select: none;
}

/* Starting price, shown only when an option in data/packages.json has "from".
   It sits on its own line under the label text. */
.choice__label:has(.choice__from) {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding-block: var(--space-2);
}

.choice__from {
  font-size: var(--text-xs);
  opacity: 0.7;
}

.choice__input:hover + .choice__label {
  border-color: var(--color-text);
}

.choice__input:checked + .choice__label {
  border-color: var(--color-action);
  background: var(--color-action);
  color: var(--color-action-contrast);
}

.choice__input:checked + .choice__label .choice__text {
  font-weight: var(--weight-bold);
}

.choice__input:focus-visible + .choice__label {
  outline: 2px solid var(--color-action);
  outline-offset: 2px;
}

.choice__input:active + .choice__label {
  transform: translateY(1px);
}

.choice__input:disabled + .choice__label {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Summary ---------- */

.builder__summary {
  padding: var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
}

.summary__title {
  margin: 0 0 var(--space-4);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
}

.summary__list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-4);
  margin: 0 0 var(--space-5);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

.summary__list dt {
  color: var(--color-text-muted);
}

.summary__list dd {
  margin: 0;
}

/* The one accent-colored element on the site */
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

/* Upwork mode: "Copy summary" is a button, not a link */
button.cta {
  width: 100%;
  font-family: inherit;
  line-height: inherit;
}

.cta:hover {
  background: var(--color-bg);
  color: var(--color-accent);
}

.cta:active {
  transform: translateY(1px);
}

.cta:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.cta[aria-disabled="true"] {
  border-color: var(--color-line);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: not-allowed;
  transform: none;
}

.summary__message {
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
}

.summary__message:empty {
  display: none;
}

.summary__note {
  margin: var(--space-3) 0 0;
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  color: var(--color-text-muted);
}

.summary__note a {
  color: var(--color-text);
}
