/* =====================================================================
   Timed sale campaign: top bar, homepage banner, popup, sale page header.
   Quiet, square and in the editorial palette.
   ===================================================================== */

.cser-sale-bar[hidden],
.cser-sale-banner[hidden],
.cser-sale-popup[hidden],
.cser-sale-page-header__time[hidden] {
  display: none !important;
}

/* ---------- Top bar (first row of the sticky header) ---------- */

.cser-sale-bar {
  position: relative;
  background: #192321;
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.25;
}

.cser-sale-bar__link {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 0 72px;
  color: #fff;
  text-decoration: none;
}

.cser-sale-bar__link:hover,
.cser-sale-bar__link:focus,
.cser-sale-bar__link:visited {
  color: #fff;
}

.cser-sale-bar :focus-visible {
  outline: 2px solid #fff !important;
  outline-offset: -4px !important;
}

.cser-sale-bar__label {
  color: #d7e5dc;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  white-space: nowrap;
}

.cser-sale-bar__text strong {
  font-weight: 700;
}

.cser-sale-bar__time {
  color: #d7e5dc;
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cser-sale-bar__cta {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  white-space: nowrap;
}

.cser-sale-bar__link:hover .cser-sale-bar__cta {
  text-decoration-thickness: 2px;
}

.cser-sale-bar__short,
.cser-sale-bar__time--short,
.cser-sale-bar__chevron {
  display: none;
}

.cser-sale-bar__close {
  position: absolute;
  top: 50%;
  right: 16px;
  display: flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  opacity: 0.7;
  transform: translateY(-50%);
}

.cser-sale-bar__close:hover {
  background: none;
  opacity: 1;
}

.cser-sale-bar.is-last-day .cser-sale-bar__label,
.cser-sale-bar.is-last-day .cser-sale-bar__time {
  color: #e9a998;
}

@media (max-width: 1180px) {
  .cser-sale-bar__link {
    gap: 20px;
    padding: 0 64px 0 24px;
  }

  .cser-sale-bar__label {
    display: none;
  }
}

/* ---------- Covers as books: square spine, a straight hinge line, soft shadow ---------- */

.cser-book {
  position: relative;
  display: block;
  background: #fff;
  box-shadow: 10px 16px 28px rgba(25, 35, 33, 0.24), 2px 3px 6px rgba(25, 35, 33, 0.14);
}

.cser-book img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Hinge of a square-backed cover: one thin dark and one thin light line,
   with hard edges so the spine reads flat, not rounded. */
.cser-book::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg,
      rgba(0, 0, 0, 0) 0,
      rgba(0, 0, 0, 0) calc(4% - 1px),
      rgba(0, 0, 0, 0.16) calc(4% - 1px),
      rgba(0, 0, 0, 0.16) 4%,
      rgba(255, 255, 255, 0.22) 4%,
      rgba(255, 255, 255, 0.22) calc(4% + 1px),
      rgba(255, 255, 255, 0) calc(4% + 1px));
  content: "";
  pointer-events: none;
}

.cser-book--small {
  box-shadow: 6px 10px 18px rgba(25, 35, 33, 0.22), 1px 2px 4px rgba(25, 35, 33, 0.14);
}

/* ---------- Homepage banner (under the Smart Slider) ---------- */

.cser-sale-banner {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 0 40px 40px;
}

.cser-sale-banner__inner {
  display: flex;
  min-height: 360px;
  align-items: center;
  gap: 56px;
  padding: 48px 56px;
  background: #e6dfd2;
  color: #192321;
}

.cser-sale-banner__copy {
  display: flex;
  flex: 0 1 470px;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.cser-sale-banner--no-covers .cser-sale-banner__copy {
  flex-basis: 640px;
}

.cser-sale-banner__eyebrow {
  color: #8a4638;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
}

.cser-sale-banner__title {
  margin: 0;
  color: #192321;
  font-family: var(--font-title);
  font-size: 44px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.cser-sale-banner__text {
  margin: 0;
  color: rgba(25, 35, 33, 0.75);
  font-size: 16px;
  line-height: 1.6;
}

.cser-sale-banner__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-top: 8px;
}

.cser-sale-banner__cta,
.cser-sale-popup__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  background: #14777a;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.cser-sale-banner__cta {
  height: 48px;
  padding: 0 26px;
  font-size: 15px;
}

.cser-sale-banner__cta:hover,
.cser-sale-banner__cta:focus,
.cser-sale-popup__cta:hover,
.cser-sale-popup__cta:focus {
  background: #0c575a;
  color: #fff;
}

.cser-sale-banner__time {
  color: rgba(25, 35, 33, 0.7);
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.cser-sale-banner__covers {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(var(--cser-covers, 4), minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cser-sale-banner__cover a {
  position: relative;
  display: block;
}

.cser-sale-banner__cover .cser-book {
  aspect-ratio: 0.7;
  transition: transform 0.2s ease;
}

.cser-sale-banner__cover a:hover .cser-book {
  transform: translateY(-4px) rotate(-1deg);
}

.cser-sale-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  background: #bd6e5e;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

@media (max-width: 1180px) {
  .cser-sale-banner__inner {
    gap: 40px;
    padding: 40px;
  }

  .cser-sale-banner__covers {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cser-sale-banner__cover:nth-child(n + 4) {
    display: none;
  }
}

/* ---------- Popup: corner card on desktop ---------- */

.cser-sale-popup__backdrop,
.cser-sale-popup__handle {
  display: none;
}

.cser-sale-popup__card {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 9050;
  display: flex;
  width: 400px;
  max-width: calc(100vw - 32px);
  flex-direction: column;
  border: 1px solid rgba(25, 35, 33, 0.12);
  background: #fff;
  box-shadow: 0 18px 42px rgba(25, 35, 33, 0.18);
  color: #192321;
  font-family: var(--font-body);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cser-sale-popup.is-open .cser-sale-popup__card {
  opacity: 1;
  transform: none;
}

.cser-sale-popup .cser-sale-popup__card:focus,
.cser-sale-popup .cser-sale-popup__card:focus-visible {
  outline: none !important;
}

body.single-product .cser-sale-popup__card {
  bottom: 104px;
}

.cser-sale-popup__head {
  display: flex;
  gap: 18px;
  padding: 24px 24px 0;
}

.cser-sale-popup__cover {
  width: 84px;
  height: 120px;
  flex-shrink: 0;
}

.cser-sale-popup__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  padding-right: 28px;
}

.cser-sale-popup__eyebrow {
  color: #8a4638;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.cser-sale-popup__title {
  margin: 0;
  color: #192321;
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.15;
}

.cser-sale-popup__text {
  margin: 0;
  color: rgba(25, 35, 33, 0.72);
  font-size: 14px;
  line-height: 1.5;
}

.cser-sale-popup__count {
  display: flex;
  gap: 6px;
  padding: 20px 24px 0;
}

.cser-sale-popup__unit {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  background: #f3efe7;
}

.cser-sale-popup__unit b {
  font-family: var(--font-mono);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.3;
}

.cser-sale-popup__unit span {
  color: rgba(25, 35, 33, 0.66);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.cser-sale-popup__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 24px;
}

.cser-sale-popup__cta {
  height: 46px;
  padding: 0 22px;
  font-size: 15px;
}

.cser-sale-popup__later,
.cser-sale-popup__close {
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  cursor: pointer;
}

.cser-sale-popup__later {
  height: 46px;
  padding: 0 8px;
  color: rgba(25, 35, 33, 0.66);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.cser-sale-popup__later:hover {
  background: none;
  color: #192321;
}

.cser-sale-popup__close {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #192321;
}

.cser-sale-popup__close:hover {
  background: rgba(25, 35, 33, 0.06);
}

/* ---------- Sale page header (sale product tag archive) ---------- */

.cser-sale-archive {
  padding-top: 32px;
}

.shop-header.cser-sale-page-header {
  position: relative;
  display: flex;
  min-height: 380px;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  margin-bottom: 40px;
  padding: 48px 56px;
  overflow: hidden;
  border-bottom: 0;
  background: #e6dfd2;
  color: #192321;
}

.cser-sale-page-header__copy {
  position: relative;
  z-index: 2;
  display: flex;
  max-width: 520px;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.cser-sale-page-header__eyebrow {
  color: #8a4638;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
}

.shop-header.cser-sale-page-header h1 {
  margin: 0;
  color: #192321;
  font-family: var(--font-title);
  font-size: clamp(2.8rem, 5.4vw, 4.6rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.cser-sale-page-header__text {
  margin: 0;
  color: rgba(25, 35, 33, 0.75);
  font-size: 17px;
  line-height: 1.55;
}

.cser-sale-page-header__time {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.cser-sale-page-header__time-label {
  color: rgba(25, 35, 33, 0.66);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.cser-sale-page-header__count {
  display: flex;
  gap: 6px;
}

.cser-sale-page-header__unit {
  display: flex;
  min-width: 64px;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  background: #fff;
}

.cser-sale-page-header__unit b {
  font-family: var(--font-mono);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.2;
}

.cser-sale-page-header__unit span {
  color: rgba(25, 35, 33, 0.66);
  font-size: 10px;
  letter-spacing: 0.12em;
}

/* A fan of covers on a soft sage disc, with a round price sticker. */
.cser-sale-page-header__art {
  position: relative;
  width: 500px;
  height: 300px;
  flex: 0 0 auto;
}

.cser-sale-page-header__art::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: #d7e5dc;
  content: "";
  transform: translate(-50%, -50%);
}

/* Each cover gets its place in the fan from inline custom properties
   (--cser-x, --cser-y, --cser-tilt, --cser-z), so any number of covers fits. */
.cser-sale-page-header__cover {
  position: absolute;
  top: var(--cser-y, 10%);
  left: var(--cser-x, 0);
  z-index: var(--cser-z, 1);
  width: 30%;
  height: auto;
  aspect-ratio: 0.7;
  transform: rotate(var(--cser-tilt, 0deg));
  animation: cser-sale-fan 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--cser-delay, 0s);
}

@keyframes cser-sale-fan {
  from {
    opacity: 0;
    transform: translateY(18px) rotate(0deg);
  }

  to {
    opacity: 1;
    transform: rotate(var(--cser-tilt, 0deg));
  }
}

.cser-sale-sticker {
  position: absolute;
  top: -6px;
  right: 6px;
  z-index: 6;
  display: flex;
  width: 124px;
  height: 124px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #bd6e5e;
  box-shadow: 0 10px 24px rgba(138, 70, 56, 0.35);
  color: #fff;
  line-height: 1;
  text-align: center;
  transform: rotate(-12deg);
  animation: cser-sale-pop 0.5s 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}

.cser-sale-sticker__lead {
  font-family: var(--font-title);
  font-size: 18px;
  font-style: italic;
}

.cser-sale-sticker__big {
  margin-top: 2px;
  font-family: var(--font-body);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

@keyframes cser-sale-pop {
  from {
    opacity: 0;
    transform: rotate(-30deg) scale(0.4);
  }

  to {
    opacity: 1;
    transform: rotate(-12deg) scale(1);
  }
}

.cser-sale-page-header--no-covers .cser-sale-page-header__art {
  width: 220px;
}

.cser-sale-page-header--no-covers .cser-sale-sticker {
  top: 50%;
  right: 50%;
  width: 160px;
  height: 160px;
  margin: -80px -80px 0 0;
}

@media (max-width: 1180px) {
  .shop-header.cser-sale-page-header {
    gap: 24px;
    padding: 40px;
  }

  .cser-sale-page-header__art {
    width: 400px;
    height: 270px;
  }
}

/* =====================================================================
   Tablet and mobile
   ===================================================================== */

@media (max-width: 900px) {
  .cser-sale-bar__link {
    min-height: 40px;
    gap: 10px;
    padding: 0 44px 0 12px;
    font-size: 13px;
  }

  .cser-sale-bar__label {
    display: inline;
    font-size: 10px;
    letter-spacing: 0.14em;
  }

  .cser-sale-bar__text,
  .cser-sale-bar__time:not(.cser-sale-bar__time--short),
  .cser-sale-bar__cta {
    display: none;
  }

  .cser-sale-bar__short {
    display: inline;
    font-weight: 600;
    white-space: nowrap;
  }

  .cser-sale-bar__time--short {
    display: inline;
    font-size: 12px;
  }

  .cser-sale-bar__chevron {
    display: inline;
  }

  .cser-sale-bar__close {
    top: 0;
    right: 0;
    width: 44px;
    height: 40px;
    transform: none;
  }

  .cser-sale-banner {
    padding: 0 20px 24px;
  }

  .cser-sale-banner__inner {
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 24px 20px;
  }

  .cser-sale-banner__copy {
    display: contents;
  }

  .cser-sale-banner__eyebrow {
    font-size: 11px;
    letter-spacing: 0.14em;
  }

  .cser-sale-banner__title {
    font-size: 30px;
    line-height: 1.12;
  }

  .cser-sale-banner__text {
    font-size: 15px;
    line-height: 1.55;
  }

  .cser-sale-banner__covers {
    order: 4;
    gap: 12px;
    margin: 6px 0 4px;
  }

  .cser-sale-banner__actions {
    order: 5;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 0;
  }

  .cser-sale-banner__cta {
    height: 50px;
  }

  .cser-sale-banner__time {
    font-size: 12px;
    text-align: center;
  }

  .cser-sale-badge {
    top: 6px;
    left: 6px;
    padding: 2px 6px;
    font-size: 11px;
  }

  /* Popup becomes a bottom sheet above the tab bar. */
  .cser-sale-popup__backdrop {
    position: fixed;
    inset: 0;
    z-index: 9990;
    display: block;
    background: rgba(25, 35, 33, 0.4);
    opacity: 0;
    transition: opacity 0.22s ease;
  }

  .cser-sale-popup.is-open .cser-sale-popup__backdrop {
    opacity: 1;
  }

  .cser-sale-popup__card,
  body.single-product .cser-sale-popup__card {
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9995;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 40px);
    gap: 14px;
    padding: 10px 20px calc(20px + var(--app-safe-bottom, 0px));
    overflow-y: auto;
    border: 0;
    box-shadow: 0 -12px 28px rgba(25, 35, 33, 0.16);
    opacity: 1;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .cser-sale-popup__handle {
    display: block;
    width: 40px;
    height: 4px;
    align-self: center;
    border-radius: 2px;
    background: rgba(25, 35, 33, 0.2);
  }

  .cser-sale-popup__head {
    align-items: center;
    gap: 16px;
    padding: 0 36px 0 0;
  }

  .cser-sale-popup__cover {
    width: 70px;
    height: 100px;
  }

  .cser-sale-popup__copy {
    gap: 6px;
    padding-right: 0;
  }

  .cser-sale-popup__title {
    font-size: 24px;
  }

  .cser-sale-popup__count {
    padding: 0;
  }

  .cser-sale-popup__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 0;
  }

  .cser-sale-popup__cta {
    height: 50px;
  }

  .cser-sale-popup__later {
    height: 44px;
  }

  .cser-sale-popup__close {
    top: 14px;
    right: 8px;
  }

  body.cser-sale-popup-open {
    overflow: hidden;
  }

  .cser-sale-archive {
    padding-top: 16px;
  }

  .shop-header.cser-sale-page-header {
    min-height: 0;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 24px;
    padding: 20px 20px 28px;
  }

  .cser-sale-page-header__art {
    width: 300px;
    height: 190px;
    align-self: center;
  }

  .cser-sale-page-header__art::before {
    width: 220px;
    height: 220px;
  }

  .cser-sale-sticker {
    top: -4px;
    right: -6px;
    width: 88px;
    height: 88px;
  }

  .cser-sale-sticker__lead {
    font-size: 14px;
  }

  .cser-sale-sticker__big {
    font-size: 24px;
  }

  .cser-sale-page-header__copy {
    gap: 10px;
  }

  .shop-header.cser-sale-page-header h1 {
    font-size: 44px;
  }

  .cser-sale-page-header__eyebrow {
    font-size: 11px;
    letter-spacing: 0.14em;
  }

  .cser-sale-page-header__text {
    font-size: 15px;
  }

  .cser-sale-page-header__time {
    align-self: stretch;
  }

  .cser-sale-page-header__unit {
    min-width: 0;
    flex: 1;
  }

  .cser-sale-page-header__unit b {
    font-size: 20px;
  }
}

@media (max-width: 359px) {
  .cser-sale-bar__label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cser-sale-popup__card,
  .cser-sale-popup__backdrop {
    transition: none;
  }

  .cser-sale-page-header__cover,
  .cser-sale-sticker {
    animation: none;
  }

  .cser-sale-banner__cover .cser-book {
    transition: none;
  }
}

/* ---------- Sale page: topic chips ---------- */

.cser-sale-topics {
  margin: 28px 0 0;
}

.cser-sale-topics .cser-chip.is-active {
  border-color: var(--app-teal);
  background: var(--app-teal);
  color: #fff;
}

.cser-chip__count {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  opacity: 0.7;
}

@media (max-width: 900px) {
  .cser-sale-topics {
    margin: 18px -20px 14px;
  }
}
