/* Shared by the storefront and the editor's resizable preview. */
[data-ammc-countdown] {
  --ammc-detail: #147461;
  container: ammc-promo / inline-size;
  width: 100%;
  margin: 0;
  min-width: 0;
  color: #26332e;
  font: 500 13px/1.2 "Work Sans", system-ui, sans-serif;
  text-align: center;
}

[data-ammc-countdown], [data-ammc-countdown] * { box-sizing: border-box; }
[data-ammc-countdown][hidden], [data-ammc-countdown] [hidden] { display: none; }

[data-ammc-countdown] .ammc-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px 12px;
  max-width: 1328px;
  min-height: 35px;
  margin: auto;
  padding: 2px 0;
}

[data-ammc-countdown] .ammc-message {
  min-width: 0;
  max-width: min(100%, 48ch);
  font-weight: 600;
  overflow-wrap: anywhere;
}

[data-ammc-countdown] .ammc-message::before {
  content: "";
  display: inline-block;
  width: 21px;
  height: 21px;
  margin-inline-end: 6px;
  vertical-align: middle;
  background: var(--ammc-detail);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M3 3h8l10 10-8 8L3 11z'/%3E%3Ccircle cx='7.8' cy='7.8' r='1.1'/%3E%3C/svg%3E") center / contain no-repeat;
}

[data-ammc-countdown] a.ammc-cta:not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  max-width: min(100%, 36ch);
  min-height: 26px;
  padding: 2px 11px;
  border: 1px solid var(--ammc-detail);
  border-radius: 999px;
  background-color: transparent;
  color: var(--ammc-detail);
  font: 700 14px/1.2 "Work Sans", system-ui, sans-serif;
  text-decoration: none;
}

[data-ammc-countdown] [data-ammc-cta-label] { overflow-wrap: anywhere; }
[data-ammc-countdown] .ammc-cta > [aria-hidden="true"] { display: inline-block; flex: none; }
[data-ammc-countdown] a.ammc-cta:not([hidden]):focus-visible {
  background-color: var(--ammc-detail);
  color: #fff;
  outline: 2px solid var(--ammc-detail);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  [data-ammc-countdown] a.ammc-cta:not([hidden]):hover {
    background-color: var(--ammc-detail);
    color: #fff;
    box-shadow: 0 2px 4px rgb(12 42 34 / 15%);
  }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  [data-ammc-countdown] a.ammc-cta { transition: background-color 140ms ease-out, color 140ms ease-out, box-shadow 160ms ease-out; }
  [data-ammc-countdown] .ammc-cta > [aria-hidden="true"] { transition: transform 160ms ease-out; }
  [data-ammc-countdown] .ammc-cta:hover > [aria-hidden="true"] { transform: translateX(3px); }
}

[data-ammc-countdown] a.ammc-cta:not([hidden]):active {
  background-color: var(--ammc-detail);
  color: #fff;
  box-shadow: inset 0 1px 3px rgb(0 0 0 / 22%);
}

[data-ammc-countdown] .ammc-clock:not([hidden]) {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 2px 6px;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
}

[data-ammc-countdown] .ammc-part:not([hidden]) {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}

[data-ammc-countdown] .ammc-part:not([hidden]) ~ .ammc-part:not([hidden])::before {
  content: ":" / "";
  margin-inline-end: 3px;
  color: var(--ammc-detail);
}

[data-ammc-countdown] .ammc-part b { font: inherit; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
[data-ammc-countdown] .ammc-part small { font-size: 12px; }

[data-ammc-countdown][data-state="expired"] .ammc-message::before { content: none; }

@container ammc-promo (max-width: 650px) {
  [data-ammc-countdown] .ammc-inner { gap: 2px 8px; }
  [data-ammc-countdown] .ammc-message { max-width: 100%; font-size: 13px; }
  [data-ammc-countdown] a.ammc-cta:not([hidden]) { padding-inline: 10px; }
  [data-ammc-countdown] .ammc-clock:not([hidden]) { font-size: 13px; }
}

@container ammc-promo (max-width: 425px) {
  [data-ammc-countdown] .ammc-clock:not([hidden]) { flex-basis: 100%; }
}

@container ammc-promo (max-width: 570px) {
  [data-ammc-countdown] .ammc-inner { column-gap: 6px; }
  [data-ammc-countdown] .ammc-message::before { width: 18px; height: 18px; margin-inline-end: 4px; }
  [data-ammc-countdown] a.ammc-cta:not([hidden]) { padding-inline: 8px; gap: 5px; }
}

@container ammc-promo (min-width: 426px) and (max-width: 550px) {
  [data-ammc-countdown] .ammc-message::before { margin-inline: -5px 3px; }
  [data-ammc-countdown] .ammc-clock:not([hidden]) { column-gap: 3px; }
  [data-ammc-countdown] .ammc-part:not([hidden]) ~ .ammc-part:not([hidden])::before { margin-inline-end: 0; }
}

@container ammc-promo (max-width: 320px) {
  [data-ammc-countdown] .ammc-inner { column-gap: 4px; }
  [data-ammc-countdown] .ammc-message { font-size: 12px; }
  [data-ammc-countdown] .ammc-message::before { content: none; }
}

@media (min-width: 901px) { [data-ammc-countdown][data-desktop="0"] { display: none; } }
@media (max-width: 900px) { [data-ammc-countdown][data-mobile="0"] { display: none; } }

/* Clamp light legacy campaign colors to readable tones on the native light bar. */
@supports (color: oklch(from red min(l, .5) c h)) {
  [data-ammc-countdown] {
    color: oklch(from var(--ammc-color, #26332e) min(l, .49) c h);
    --ammc-detail: oklch(from var(--ammc-accent, #147461) min(l, .53) c h);
  }
}

/* Equal side tracks keep the promotion centered even when the two sides differ. */
@media (min-width: 901px) {
  .amz5-top-inner:has(> [data-ammc-countdown]:not([hidden], [data-desktop="0"])) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, min(720px, calc(100% - 310px))) minmax(0, 1fr);
    gap: 10px;
    height: auto;
    min-height: 35px;
  }

  .amz5-top-inner:has(> [data-ammc-countdown]:not([hidden], [data-desktop="0"])) > .amz5-shipping {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .amz5-top-inner:has(> [data-ammc-countdown]:not([hidden], [data-desktop="0"])) > .amz5-utilities {
    justify-self: end;
  }
}

@media (max-width: 900px) {
  .amz5-top:has(> .amz5-top-inner > [data-ammc-countdown]:not([hidden], [data-mobile="0"])) {
    display: block;
  }

  .amz5-top-inner:has(> [data-ammc-countdown]) {
    height: auto;
  }

  .amz5-top-inner:has(> [data-ammc-countdown]) > :is(.amz5-shipping, .amz5-utilities) {
    display: none;
  }
}
