@layer components {
  .ec-section {
    --section-px: var(--ec-section-px-sm);
    --section-py: var(--ec-section-py-md);

    padding-block: var(--section-py);
    padding-inline: var(--section-px);
  }

  .ec-section > * {
    max-inline-size: var(--ec-page-max);
    margin-inline: auto;
  }

  @media (width >= 60rem) {
    .ec-section {
      --section-px: var(--ec-section-px);
      --section-py: var(--ec-section-py);
    }

    .ec-section--px-lg {
      --section-px: var(--ec-section-px-lg);
    }

    .ec-section--px-xl {
      --section-px: var(--ec-section-px-xl);
    }
  }

  .ec-btn {
    --btn-padding-x: var(--ec-space-32);
    --btn-padding-y: 18px;
    --btn-font-size: var(--ec-size-lg);
    --btn-radius: var(--ec-radius);
    --btn-border-width: 1px;
    --btn-bg: var(--ec-bg-accent);
    --btn-fg: var(--ec-text-inverse);
    --btn-border: transparent;
    --btn-shadow: var(--ec-shadow-accent);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--btn-padding-y) - var(--btn-border-width))
      calc(var(--btn-padding-x) - var(--btn-border-width));
    border: var(--btn-border-width) solid var(--btn-border);
    border-radius: var(--btn-radius);
    background: var(--btn-bg);
    box-shadow: var(--btn-shadow);
    color: var(--btn-fg);
    font-family: var(--ec-font-body);
    font-size: var(--btn-font-size);
    font-weight: var(--ec-weight-medium);
    line-height: var(--ec-leading-flat);
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--ec-transition), box-shadow var(--ec-transition),
      color var(--ec-transition), border-color var(--ec-transition);
  }

  .ec-btn--md {
    --btn-padding-x: var(--ec-space-24);
    --btn-padding-y: var(--ec-space-16);
    --btn-font-size: var(--ec-size-md);
  }

  .ec-btn--sm {
    --btn-padding-x: var(--ec-space-20);
    --btn-padding-y: var(--ec-space-12);
    --btn-font-size: var(--ec-size-sm);
  }

  .ec-btn--xs {
    --btn-padding-x: var(--ec-space-16);
    --btn-padding-y: var(--ec-space-8);
    --btn-font-size: var(--ec-size-xs);
    --btn-radius: var(--ec-radius-sm);
  }

  .ec-btn:hover {
    --btn-bg: var(--ec-orange-hover);
    --btn-shadow: var(--ec-shadow-accent-hover);
  }

  .ec-btn--outline {
    --btn-bg: var(--ec-bg-white);
    --btn-fg: var(--ec-text-accent);
    --btn-border: var(--ec-stroke-accent);
    --btn-shadow: none;
  }

  .ec-btn--outline:hover {
    --btn-bg: var(--ec-bg-accent);
    --btn-fg: var(--ec-text-inverse);
    --btn-shadow: none;
  }

  .ec-btn--white {
    --btn-bg: var(--ec-bg-white);
    --btn-fg: var(--ec-text-accent);
    --btn-shadow: none;
  }

  .ec-btn--white:hover {
    --btn-bg: var(--ec-bg-light);
    --btn-fg: var(--ec-text-accent);
    --btn-shadow: var(--ec-shadow-soft);
  }

  .ec-btn:disabled,
  .ec-btn[aria-disabled="true"] {
    --btn-bg: var(--ec-bg-disabled);
    --btn-fg: var(--ec-text-inverse);
    --btn-border: transparent;
    --btn-shadow: none;
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
  }

  .ec-link {
    display: inline-flex;
    gap: var(--ec-space-4);
    align-items: center;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    color: var(--ec-text-accent);
    font-size: var(--ec-size-xs);
    font-weight: var(--ec-weight-medium);
    line-height: var(--ec-leading-flat);
    text-transform: uppercase;
    text-decoration: none;
    transition: color var(--ec-transition), border-color var(--ec-transition);
  }

  .ec-link::after {
    content: "";
    width: 16px;
    height: 16px;
    background: currentColor;
    mask: url("../icons/arrow-right.svg") center / contain no-repeat;
  }

  .ec-link:hover {
    color: var(--ec-text-hover);
    border-bottom-color: currentColor;
  }

  .ec-link[aria-disabled="true"] {
    color: var(--ec-text-disabled);
    border-bottom-color: transparent;
    pointer-events: none;
  }

  .ec-field {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-4);
  }

  .ec-field > label {
    color: var(--ec-text-primary);
    font-size: var(--ec-size-sm);
    font-weight: var(--ec-weight-bold);
    line-height: var(--ec-leading-default);
  }

  .ec-field > label[data-required]::after {
    content: "*";
    color: var(--ec-text-accent);
  }

  .ec-input,
  .ec-select {
    width: 100%;
    height: var(--ec-control-height);
    padding: 0 var(--ec-space-16);
    border: 1px solid var(--ec-stroke-default);
    border-radius: var(--ec-radius);
    background: var(--ec-bg-white);
    color: var(--ec-text-primary);
    font-family: var(--ec-font-body);
    font-size: var(--ec-size-md);
    line-height: var(--ec-leading-relaxed);
    transition: border-color var(--ec-transition);
  }

  .ec-input::placeholder {
    color: var(--ec-text-secondary);
  }

  .ec-input:focus-visible,
  .ec-select:focus-visible {
    border-color: var(--ec-stroke-accent);
    outline-offset: 0;
  }

  .ec-input:disabled,
  .ec-select:disabled {
    border-color: var(--ec-stroke-disabled);
    color: var(--ec-text-disabled);
    cursor: not-allowed;
  }

  .ec-select {
    appearance: none;
    padding-right: 48px;
    background-image: url("../icons/chevron.svg");
    background-repeat: no-repeat;
    background-position: right var(--ec-space-16) center;
    background-size: 24px 24px;
  }

  .ec-select:has(option[value=""]:checked) {
    color: var(--ec-text-secondary);
  }

  .ec-combobox {
    position: relative;
  }

  .ec-combobox__input {
    padding-right: 48px;
    background-image: url("../icons/chevron.svg");
    background-repeat: no-repeat;
    background-position: right var(--ec-space-16) center;
    background-size: 24px 24px;
  }

  .ec-combobox__control {
    position: relative;
  }

  .ec-combobox:has(.ec-combobox__clear:not([hidden])) .ec-combobox__input {
    background-image: none;
  }

  .ec-combobox__clear {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-end: var(--ec-space-12);
    display: flex;
    padding: var(--ec-space-4);
    border: 0;
    border-radius: var(--ec-radius-sm);
    background: none;
    color: var(--ec-text-secondary);
    cursor: pointer;
    transform: translateY(-50%);
  }

  .ec-combobox__clear:hover {
    color: var(--ec-text-primary);
  }

  .ec-combobox__list {
    position: absolute;
    z-index: 10;
    inset-inline: 0;
    inset-block-start: calc(100% + var(--ec-space-4));
    max-block-size: 16rem;
    margin: 0;
    padding: var(--ec-space-4);
    overflow-y: auto;
    border: 1px solid var(--ec-stroke-default);
    border-radius: var(--ec-radius);
    background: var(--ec-bg-white);
    box-shadow: var(--ec-shadow-soft);
    list-style: none;
  }

  .ec-combobox__option {
    padding: var(--ec-space-8) var(--ec-space-12);
    border-radius: var(--ec-radius-sm);
    color: var(--ec-text-primary);
    font-size: var(--ec-size-sm);
    line-height: var(--ec-leading-default);
    cursor: pointer;
  }

  .ec-combobox__option:hover,
  .ec-combobox__option[aria-selected="true"] {
    background: var(--ec-bg-accent-light);
    color: var(--ec-text-accent);
  }

  .ec-combobox__empty {
    color: var(--ec-text-secondary);
    font-size: var(--ec-size-sm);
    line-height: var(--ec-leading-default);
  }

  .ec-combobox__empty:empty {
    display: none;
  }

  .ec-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ec-space-4) var(--ec-space-16);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .ec-chip {
    display: flex;
    gap: var(--ec-space-6);
    align-items: center;
    font-size: var(--ec-size-xs);
    font-weight: var(--ec-weight-bold);
    line-height: var(--ec-leading-default);
  }

  .ec-chip__icon {
    --chip-icon-bg: var(--ec-bg-white);

    display: grid;
    flex-shrink: 0;
    place-content: center;
    inline-size: 24px;
    block-size: 24px;
    border-radius: var(--ec-radius-full);
    background: var(--chip-icon-bg);
    color: var(--ec-text-accent);
  }

  .ec-upload {
    --upload-bg: var(--ec-bg-white);

    position: relative;

    display: flex;
    flex-direction: column;
    gap: var(--ec-space-8);
    align-items: center;
    justify-content: center;
    padding: var(--ec-space-24);
    border: 1.5px dashed var(--ec-stroke-accent);
    border-radius: var(--ec-radius-xl);
    background: var(--upload-bg);
    text-align: center;
  }

  .ec-upload__icon {
    display: grid;
    flex-shrink: 0;
    place-content: center;
    inline-size: 48px;
    block-size: 48px;
    border-radius: var(--ec-radius-full);
    background: var(--ec-bg-accent-light);
    color: var(--ec-text-accent);
  }

  .ec-upload__text {
    display: flex;
    flex-direction: column;
  }

  .ec-upload__title {
    font-size: var(--ec-size-md);
    font-weight: var(--ec-weight-bold);
    line-height: var(--ec-leading-relaxed);
  }

  .ec-upload__hint {
    font-size: var(--ec-size-sm);
    line-height: var(--ec-leading-default);
  }

  .ec-upload__noscript {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-8);
  }

  .ec-upload--dragover {
    --upload-bg: var(--ec-bg-accent-light);

    border-style: solid;
  }

  .ec-upload--busy {
    cursor: progress;
  }

  .ec-upload--busy > :not(.ec-upload__captcha) {
    opacity: 0.6;
  }

  .ec-upload--rejected {
    border-style: solid;
    border-color: var(--ec-stroke-default);
  }

  .ec-upload--rejected .ec-upload__icon {
    background: var(--ec-bg-light);
    color: var(--ec-text-secondary);
  }

  .ec-upload__file {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .ec-upload:has(.ec-upload__file:focus-visible) .ec-upload__browse {
    outline: 2px solid var(--ec-stroke-accent);
    outline-offset: 2px;
  }

  .ec-upload__browse {
    color: var(--ec-text-accent);
    font-size: var(--ec-size-sm);
    line-height: var(--ec-leading-default);
    text-decoration: underline;
    cursor: pointer;
  }

  .ec-upload__preview {
    inline-size: 100%;
    max-block-size: 180px;
    border-radius: var(--ec-radius);
    object-fit: cover;
  }

  .ec-upload__status:empty {
    display: none;
  }

  .ec-upload__captcha:empty {
    display: none;
  }

  .ec-upload__status {
    opacity: 0.75;
    font-size: var(--ec-size-sm);
    line-height: var(--ec-leading-default);
  }

  .ec-upload__legal {
    opacity: 0.75;
    font-size: var(--ec-size-xs);
    line-height: var(--ec-leading-default);
  }
  .ec-upload--steps {
    gap: var(--ec-space-12);
    padding: var(--ec-space-20) var(--ec-space-24);
    border: 1px solid var(--ec-stroke-accent);
  }
  .ec-upload--steps .ec-upload__step--photo {
    display: flex;
    gap: var(--ec-space-12);
    align-items: center;
    inline-size: 100%;
    padding: var(--ec-space-24);
    border: 1.5px dashed var(--ec-stroke-default);
    border-radius: var(--ec-radius-xl);
    text-align: start;
  }
  .ec-upload--steps.ec-upload--dragover {
    --upload-bg: var(--ec-bg-white);
  }
  .ec-upload--steps.ec-upload--dragover .ec-upload__step--photo {
    border-color: var(--ec-stroke-accent);
    background: var(--ec-bg-accent-light);
  }
  .ec-upload--steps .ec-upload__icon {
    background: var(--ec-bg-accent);
    color: var(--ec-text-inverse);
  }
  .ec-upload--steps .ec-upload__browse {
    font-size: inherit;
    font-weight: var(--ec-weight-regular);
  }
  .ec-upload__head {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-4);
    align-items: center;
  }
  .ec-upload__heading {
    font-size: var(--ec-size-md);
    font-weight: var(--ec-weight-bold);
    line-height: var(--ec-leading-relaxed);
  }
  .ec-upload__step {
    display: contents;
  }
  .ec-upload__step--email {
    display: flex;
    flex-direction: column;
    gap: var(--ec-space-12);
    inline-size: 100%;
    text-align: start;
  }
  .ec-upload__step[hidden] {
    display: none;
  }
  .ec-upload__picked {
    display: flex;
    gap: var(--ec-space-12);
    align-items: center;
    padding: var(--ec-space-8) var(--ec-space-12);
    border-radius: 12px;
    background: var(--ec-bg-light);
  }
  .ec-upload__thumb {
    flex-shrink: 0;
    inline-size: 40px;
    block-size: 40px;
    border-radius: var(--ec-radius-full);
    object-fit: cover;
  }
  .ec-upload__name {
    flex: 1;
    min-inline-size: 0;
    overflow: hidden;
    font-size: var(--ec-size-sm);
    line-height: var(--ec-leading-default);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .ec-upload__change {
    display: flex;
    gap: var(--ec-space-4);
    align-items: center;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ec-text-accent);
    font: inherit;
    font-size: var(--ec-size-xs);
    font-weight: var(--ec-weight-medium);
    line-height: var(--ec-leading-title-lg);
    text-transform: uppercase;
    cursor: pointer;
  }
  .ec-stepper {
    display: flex;
    gap: var(--ec-space-8);
    margin: 0;
    padding: 2px;
    list-style: none;
  }
  .ec-stepper__step {
    display: flex;
    gap: var(--ec-space-4);
    align-items: center;
    padding: 2px var(--ec-space-8) 2px 2px;
    border-radius: var(--ec-radius-full);
    color: var(--ec-text-disabled);
    font-size: var(--ec-size-label);
    font-weight: var(--ec-weight-medium);
    line-height: var(--ec-leading-flat);
    text-transform: uppercase;
  }
  .ec-stepper__step[aria-current="step"] {
    background: var(--ec-bg-accent-light);
    color: var(--ec-text-accent);
  }
  .ec-stepper__nb,
  .ec-stepper__done {
    display: grid;
    place-content: center;
    inline-size: 16px;
    block-size: 16px;
    border-radius: var(--ec-radius-full);
    background: var(--ec-bg-light);
  }
  .ec-stepper__step[aria-current="step"] .ec-stepper__nb {
    background: var(--ec-bg-accent);
    color: var(--ec-text-inverse);
  }
  .ec-stepper__done {
    color: var(--ec-text-accent);
  }
  .ec-stepper__step:not([data-done]) .ec-stepper__done,
  .ec-stepper__step[data-done] .ec-stepper__nb {
    display: none;
  }

  .ec-compare {
    --compare-split: 41.83%;
    --hero-visual-shadow: 0 4px 20px rgb(0 0 0 / 0.08), 0 20px 60px rgb(0 0 0 / 0.15);
    --hero-split-shadow: 0 0 8px rgb(0 0 0 / 0.2);

    position: relative;
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
    aspect-ratio: var(--compare-ratio, 765 / 524);
    overflow: hidden;
    border-radius: var(--ec-radius-xl);
    background: var(--ec-bg-light);
    box-shadow: var(--hero-visual-shadow);
  }

  .ec-compare__photo {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
  }

  .ec-compare__before,
  .ec-compare__after {
    position: absolute;
    inset: 0;
  }

  .ec-compare__before {
    clip-path: inset(0 calc(100% - var(--compare-split)) 0 0);
  }

  .ec-compare__after {
    clip-path: inset(0 0 0 var(--compare-split));
  }

  .ec-compare__split {
    position: absolute;
    pointer-events: none;
    inset-block: 0;
    inset-inline-start: var(--compare-split);
    inline-size: 3px;
    background: var(--ec-bg-white);
    box-shadow: var(--hero-split-shadow);
    translate: -50% 0;
  }

  .ec-compare__handle {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 50%;
    display: grid;
    place-content: center;
    inline-size: 44px;
    block-size: 44px;
    border: 3px solid var(--ec-stroke-accent);
    border-radius: var(--ec-radius-full);
    background: var(--ec-bg-white);
    box-shadow: var(--ec-shadow-soft);
    color: var(--ec-text-accent);
    translate: -50% -50%;
    transition: scale 150ms, box-shadow 150ms;
  }

  .ec-compare:hover .ec-compare__handle {
    scale: 1.12;
    box-shadow: 0 4px 24px rgb(232 133 10 / 0.35);
  }

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

  .ec-compare__tag {
    position: absolute;
    pointer-events: none;
    inset-block-end: var(--ec-space-16);
    padding: var(--ec-space-6) var(--ec-space-12);
    border-radius: var(--ec-radius-sm);
    color: var(--ec-text-inverse);
    font-size: var(--ec-size-xs);
    font-weight: var(--ec-weight-medium);
    line-height: var(--ec-leading-title-lg);
    text-transform: uppercase;
  }

  .ec-compare__tag--before {
    inset-inline-start: var(--ec-space-16);
    background: var(--ec-bg-mid);
  }

  .ec-compare__tag--after {
    inset-inline-end: var(--ec-space-16);
    background: var(--ec-bg-accent);
  }

  .ec-checkbox {
    display: inline-flex;
    gap: var(--ec-space-12);
    align-items: center;
    color: var(--ec-text-primary);
    font-size: var(--ec-size-sm);
    line-height: var(--ec-leading-default);
  }

  .ec-checkbox input[type="checkbox"],
  .ec-checkbox input[type="radio"] {
    appearance: none;
    flex-shrink: 0;
    display: grid;
    place-content: center;
    width: 16px;
    height: 16px;
    margin: 0;
    border: 1px solid var(--ec-stroke-default);
    background: var(--ec-bg-white);
    cursor: pointer;
  }

  .ec-checkbox input[type="checkbox"] {
    border-radius: var(--ec-radius-sm);
  }

  .ec-checkbox input[type="radio"] {
    border-radius: var(--ec-radius-full);
  }

  .ec-checkbox input[type="checkbox"]:checked,
  .ec-checkbox input[type="radio"]:checked {
    border-color: var(--ec-stroke-accent);
    background: var(--ec-bg-accent);
  }

  .ec-checkbox input[type="checkbox"]:checked::before {
    content: "✓";
    color: var(--ec-text-inverse);
    font-size: var(--ec-size-xs);
    font-weight: var(--ec-weight-medium);
    line-height: var(--ec-leading-snug);
  }

  .ec-checkbox input[type="radio"]:checked::before {
    content: "";
    width: var(--ec-space-6);
    height: var(--ec-space-6);
    border-radius: var(--ec-radius-full);
    background: var(--ec-text-inverse);
  }

  .ec-checkbox:has(input:disabled) {
    color: var(--ec-text-secondary);
    opacity: 0.5;
  }

  .ec-checkbox:has(input:disabled) input {
    cursor: not-allowed;
  }
}
