/* Comp calculator (templates/core/partials/_comp_calculator.html, also the base of the runway calculator's sections
   and cards). Design-system tokens only. The cc- prefix is this screen's. */

.cc {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-24);
  min-width: 0;
}

.cc-intro__title {
  margin: 0;
  max-width: 24em;
  color: var(--ds-text);
  font-size: var(--ds-type-h3-size);
  line-height: var(--ds-type-h3-leading);
  font-weight: 600;
}

.cc-intro__lead {
  margin: var(--ds-space-8) 0 0;
  max-width: 48em;
  color: var(--ds-text-muted);
  font-size: var(--ds-type-body-size);
  line-height: var(--ds-type-body-leading);
}

.cc-intro__badges {
  margin: var(--ds-space-12) 0 0;
}

.cc-intro .cc-section__eyebrow {
  margin-bottom: var(--ds-space-8);
}

/* --------------------------------------------------------------------------
   Sections (Step 1, Step 2)
   -------------------------------------------------------------------------- */

.cc-section {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-24);
  min-width: 0;
}

.cc-section__eyebrow {
  margin: 0;
  color: var(--ds-accent-strong);
}

.cc-section__title {
  margin: calc(-1 * var(--ds-space-16)) 0 0;
  color: var(--ds-text);
  font-size: var(--ds-type-app-h3-size);
  line-height: var(--ds-type-app-h3-leading);
  font-weight: 600;
}

.cc-section__lead {
  margin: calc(-1 * var(--ds-space-16)) 0 0;
  color: var(--ds-text-muted);
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
}

/* --------------------------------------------------------------------------
   Inputs
   -------------------------------------------------------------------------- */

.cc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ds-space-24) var(--ds-space-16);
  align-items: start;
}

.cc-grid > * {
  min-width: 0;
}

@media (min-width: 768px) {
  .cc-grid--2,
  .cc-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .cc-grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 640px) {
  .cc-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --------------------------------------------------------------------------
   Headline range, source, example scope
   -------------------------------------------------------------------------- */

.cc-headline {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-4);
}

.cc-headline__range {
  margin: 0;
  color: var(--ds-text);
  font-size: var(--ds-type-h3-size);
  line-height: var(--ds-type-h3-leading);
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.cc-headline__rates {
  margin: 0;
  color: var(--ds-text);
  font-size: var(--ds-type-body-size);
  line-height: var(--ds-type-body-leading);
}

.cc-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-8);
  margin: 0;
  color: var(--ds-text-muted);
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
}

.cc-source [hidden] {
  display: none;
}

.cc-scope {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-4);
}

.cc-scope__label {
  margin: 0;
  color: var(--ds-text-muted);
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
  font-weight: 600;
}

.cc-scope__text {
  margin: 0;
  color: var(--ds-text);
  font-size: var(--ds-type-body-size);
  line-height: var(--ds-type-body-leading);
}

/* --------------------------------------------------------------------------
   Collapsible panels (native details)
   -------------------------------------------------------------------------- */

.cc-details {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-12);
  min-width: 0;
  padding: var(--ds-space-16) var(--ds-space-24);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-12);
  background: var(--ds-surface-subtle);
  color: var(--ds-text);
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
}

.cc-details[hidden] {
  display: none;
}

.cc-details > summary {
  cursor: pointer;
  font-weight: 600;
}

.cc-details > summary:focus-visible {
  outline: 2px solid var(--ds-focus-ring);
  outline-offset: 2px;
}

/* The terms panel: air between the helper note, the field labels and the switch */
.cc-details > .cc-note + .cc-grid {
  margin-top: var(--ds-space-12);
}

.cc-details > .cc-grid + .ds-switch {
  margin-top: var(--ds-space-12);
}

.cc-details__values {
  display: block;
  margin-top: var(--ds-space-4);
  color: var(--ds-text-muted);
  font-weight: 400;
}

.cc-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--ds-space-4) var(--ds-space-16);
  margin: 0;
}

.cc-facts dt {
  color: var(--ds-text-muted);
}

.cc-facts dd {
  margin: 0;
  font-weight: 600;
}

.cc-prose {
  display: grid;
  gap: var(--ds-space-8);
  margin: 0;
  color: var(--ds-text-muted);
}

.cc-prose dt {
  color: var(--ds-text);
  font-weight: 600;
}

.cc-prose dd {
  margin: 0;
}

.cc-prose--list {
  padding-left: var(--ds-space-24);
}

.cc-note {
  margin: 0;
  color: var(--ds-text-muted);
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
}

.cc-note[hidden] {
  display: none;
}

.cc-note--tight {
  margin-top: calc(-1 * var(--ds-space-8));
}

.cc-disclaimer {
  margin-top: calc(-1 * var(--ds-space-8));
}

.cc-next__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-12);
}

.cc-next__actions .ds-btn {
  max-width: 100%;
  white-space: normal;
}

.cc-preview__text {
  margin: 0;
  color: var(--ds-text);
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cc-preview .cc-disclaimer {
  margin-top: 0;
}

.cc-footer {
  margin: 0;
  color: var(--ds-text-muted);
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
}

/* --------------------------------------------------------------------------
   Cards (also used by the runway calculator)
   -------------------------------------------------------------------------- */

.cc-structures {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ds-space-16);
}

@media (min-width: 1024px) {
  .cc-structures {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-8);
  min-width: 0;
  padding: var(--ds-space-16) var(--ds-space-24);
  border: 1.5px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-12);
  background: var(--ds-surface-subtle);
  color: var(--ds-text);
}

.cc-card--static {
  cursor: default;
}

.cc-card__title {
  margin: 0;
  color: var(--ds-text-muted);
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
  font-weight: 600;
}

.cc-card__figure {
  color: var(--ds-text);
  font-size: var(--ds-type-h3-size);
  line-height: var(--ds-type-h3-leading);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cc-structure {
  gap: var(--ds-space-16);
  background: var(--ds-surface);
  transition: border-color var(--ds-motion-hover) ease;
}

.cc-structure--selected {
  border-color: var(--ds-text);
  background: var(--ds-accent-soft);
}

.cc-structure .cc-card__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-8);
  color: var(--ds-text);
  font-size: var(--ds-type-app-h3-size);
  line-height: var(--ds-type-app-h3-leading);
}

.cc-structure .cc-card__title [hidden] {
  display: none;
}

.cc-structure__pick {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cc-structure__pick:focus-visible {
  outline: 2px solid var(--ds-focus-ring);
  outline-offset: 2px;
}

.cc-structure__facts {
  display: grid;
  gap: var(--ds-space-12);
  margin: 0;
}

.cc-structure__facts dt {
  color: var(--ds-text-muted);
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
}

.cc-structure__facts dd {
  margin: 0;
  color: var(--ds-text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.cc-structure__facts dd.cc-card__figure {
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Payment plan
   -------------------------------------------------------------------------- */

.cc-schedule {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-8);
}

.cc-schedule__title {
  margin: 0;
  color: var(--ds-text);
  font-size: var(--ds-type-app-h3-size);
  line-height: var(--ds-type-app-h3-leading);
  font-weight: 600;
}

.cc-schedule div[hidden] {
  display: none;
}

.cc-schedule__list {
  display: grid;
  gap: var(--ds-space-8);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ds-text);
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
}

.cc-schedule__list [hidden] {
  display: none;
}

.cc-schedule__name {
  display: block;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .cc-structure {
    transition: none;
  }
}
