/* Katlanan İndirim: the page that explains the second-and-third-item
   discount step by step. Loaded after theme.css on that page only. Every
   screen holds one thing: the hero, then one basket with its heading and
   text per step, then a worked example and the closing call. */

.ashwickers-katlanan-indirim,
.ca-hero {
  --ca-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ca-screen: calc(100svh - var(--header-height));
}

.ashwickers-katlanan-indirim {
  --ca-ink: var(--color-foreground);
  --ca-muted: var(--color-muted);
  --ca-line: var(--color-divider);
  --ca-cream: var(--color-palette-4);
  --ca-accent: var(--color-palette-1);
  --ca-play: 2.4s;

  overflow-x: clip;
}

.ashwickers-katlanan-indirim h1,
.ashwickers-katlanan-indirim h2,
.ashwickers-katlanan-indirim h3,
.ashwickers-katlanan-indirim p,
.ca-hero h1,
.ca-hero p {
  margin: 0;
}

.ashwickers-katlanan-indirim [id] {
  scroll-margin-top: var(--header-height);
}

/* Hero: a dark olive band with the campaign picture and the promise,
   centred. On a phone the picture fills the screen; on wider screens the
   copy sits in the empty olive at the left of the wide picture. */

.ca-hero {
  --ca-hero-ink: #f3ebdd;
  --ca-hero-soft: rgb(243 235 221 / 78%);
  --ca-hero-gold: #e2c36c;
  --ca-bar: 0px; /* The announcement bar's height, when one shows; set by the script. */

  position: relative;
  isolation: isolate;
  display: grid;
  align-content: start;
  min-height: calc(var(--ca-screen) - var(--ca-bar));
  padding: 32px 0 96px;
  overflow: hidden;
  color: var(--ca-hero-ink);
  text-align: center;
  /* Behind the picture: the photo's own empty olive, stretched and blurred,
     so the light falls the same way on the picture and around it. */
  background: #3f3f22 url("../images/katlanan-indirim/hero-phone-backdrop.webp") center / cover no-repeat;
}

/* On a phone the picture stands a little narrower than the screen and
   anchored to the bottom, so the baskets begin well under the copy; its
   sides fade into the band's own olive. */
.ca-hero__art {
  position: absolute;
  inset: 0 7% 0;
  z-index: -1;
  margin: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent), linear-gradient(180deg, transparent, #000 14%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent), linear-gradient(180deg, transparent, #000 14%);
  mask-composite: intersect;
}

.ca-hero__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.ca-hero__copy {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.ca-hero__title {
  max-width: 14ch;
  font-size: clamp(2.125rem, 1.4rem + 3vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.06;
  text-wrap: balance;
}

.ca-hero__lede {
  max-width: 36ch;
  color: var(--ca-hero-soft);
  font-size: clamp(0.9375rem, 0.9rem + 0.3vw, 1.0625rem);
  line-height: 1.5;
  text-wrap: pretty;
}

/* The front page's way to the page: a link under the promise. */
.ca-hero__more {
  display: inline-block;
  padding: 0 0 6px;
  color: var(--ca-hero-ink);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: opacity 200ms;
}

.ca-hero__more:hover {
  color: var(--ca-hero-ink);
  opacity: 0.75;
}

/* The way down: a round frosted-glass pill at the foot of the screen that
   drifts slowly, label and arrow together, and scrolls to the first step. */

.ca-hero .ca-hero__cue {
  position: absolute;
  bottom: clamp(18px, 3svh, 32px);
  left: 50%;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 0;
  padding: 13px 20px 13px 22px;
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: 999px;
  background: rgb(255 255 255 / 12%);
  color: var(--ca-hero-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: none;
  white-space: nowrap;
  box-shadow: 0 10px 30px -14px rgb(0 0 0 / 60%), inset 0 1px 0 rgb(255 255 255 / 18%);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  cursor: pointer;
  transform: translateX(-50%);
  animation: ca-cue 3.2s ease-in-out infinite;
  transition: background 200ms, border-color 200ms;
}

.ca-hero .ca-hero__cue:hover {
  background: rgb(255 255 255 / 20%);
  border-color: rgb(255 255 255 / 42%);
  opacity: 1;
}

.ca-hero .ca-hero__cue:focus-visible {
  outline: 2px solid var(--ca-hero-gold);
  outline-offset: 3px;
}

.ca-hero .ca-hero__cue svg {
  width: 14px;
  height: 14px;
  flex: none;
}

@keyframes ca-cue {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -8px); }
}

/* Steps: one screen each. The basket on top, the step counter, heading
   and text underneath. */

.ca-steps {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ca-step {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 20px;
  box-sizing: border-box;
  min-width: 0;
  min-height: var(--ca-screen);
  padding: 16px 0 28px;
  scroll-snap-align: start;
}

.ca-step__visual {
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: clamp(16px, 2.5vw, 32px);
  border-radius: 4px;
  background: var(--ca-cream);
}

.ca-step__copy {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.ca-step__meter {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ca-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ca-step__meter ol {
  display: flex;
  gap: 4px;
  width: 120px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ca-step__meter li {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--ca-line);
}

.ca-step__meter li.is-done {
  background: var(--ca-ink);
}

.ca-step__meter li.is-current {
  background: var(--ca-accent);
}

.ca-step__title {
  font-size: var(--font-size-section-title);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
}

.ca-step__text {
  max-width: 38ch;
  color: var(--ca-muted);
  line-height: 1.55;
  text-wrap: pretty;
}

.ca-step__next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--ca-ink);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.ca-step__next svg {
  width: 14px;
  height: 14px;
  transition: transform 300ms var(--ca-ease);
}

.ca-step__next:hover svg {
  transform: translateY(3px);
}

/* The scene: a white card inside the beige panel with one basket. The
   basket lands, its discount stamps on, and the price under it changes;
   the scene plays again every few seconds while its step is on screen. */

.ca-scene {
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: clamp(16px, 2.5vw, 28px);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}

.ca-focus {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}

.ca-focus__frame {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(100%, 44svh, 360px);
  margin: 0;
  opacity: 0;
  transform: translateY(-18px) scale(0.96);
}

.ca-focus__frame > img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

.ca-focus__name {
  display: grid;
  gap: 2px;
  text-align: center;
}

.ca-focus__product {
  color: var(--ca-muted);
  font-size: 13px;
}

.ca-focus__price {
  display: inline-flex;
  justify-content: center;
  gap: 10px;
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
}

.ca-focus__price del {
  color: var(--ca-muted);
}

.ca-focus__price ins {
  font-weight: 600;
  text-decoration: none;
  opacity: 0;
}

.ca-stamp {
  position: absolute;
  top: 4%;
  right: 2%;
  display: grid;
  place-items: center;
  min-width: 64px;
  padding: 11px 14px;
  border-radius: 999px;
  background: var(--ca-accent);
  color: #fff;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  box-shadow: 0 10px 24px -12px rgb(157 89 77 / 70%);
  opacity: 0;
  transform: scale(1.5) rotate(-8deg);
}

.ca-stamp--full {
  background: #fff;
  color: var(--ca-ink);
  box-shadow: inset 0 0 0 1px var(--ca-ink);
  font-size: 13px;
}

/* Played once, on one timeline, the first time the step comes on screen:
   the basket lands, the stamp hits, the new price appears, and the scene
   stays like that. */

.ca-step.is-active .ca-focus__frame {
  animation: ca-land var(--ca-play) var(--ca-ease) 1 forwards;
}

.ca-step.is-active .ca-stamp {
  animation: ca-stamp var(--ca-play) var(--ca-ease) 1 forwards;
}

.ca-step.is-active .ca-focus__price ins {
  animation: ca-settle var(--ca-play) var(--ca-ease) 1 forwards;
}

@keyframes ca-land {
  0% { opacity: 0; transform: translateY(-18px) scale(0.96); }
  22%, 100% { opacity: 1; transform: none; }
}

@keyframes ca-stamp {
  0%, 42% { opacity: 0; transform: scale(1.5) rotate(-8deg); }
  58%, 100% { opacity: 1; transform: scale(1) rotate(-6deg); }
}

@keyframes ca-settle {
  0%, 66% { opacity: 0; transform: translateY(4px); }
  82%, 100% { opacity: 1; transform: none; }
}

/* How it is counted: a worked example and the rules, on a beige panel. */

.ca-rules {
  margin-top: clamp(24px, 4vw, 56px);
  padding: clamp(32px, 5vw, 72px) 0;
  background: var(--ca-cream);
}

.ca-rules__inner {
  display: grid;
  gap: clamp(24px, 3vw, 48px);
}

.ca-rules h2 {
  font-size: var(--font-size-section-title);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.ca-rules__intro {
  max-width: 48ch;
  margin-top: 10px;
  color: var(--ca-muted);
  line-height: 1.55;
}

.ca-example {
  padding: clamp(16px, 2vw, 28px);
  border-radius: 4px;
  background: #fff;
}

.ca-example__caption {
  margin-bottom: 12px;
  color: var(--ca-muted);
  font-size: 13px;
}

.ca-example__rows {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ca-example__row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--ca-line);
  font-size: 14px;
}

.ca-example__row:first-child {
  border-top: 0;
}

.ca-example__row img {
  display: block;
  width: 48px;
  aspect-ratio: 1;
  object-fit: contain;
}

.ca-example__row b {
  display: block;
  font-weight: 500;
}

.ca-shelf__tag {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--ca-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.ca-shelf__tag--full {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--ca-ink);
  color: var(--ca-ink);
}

.ca-example__price {
  display: grid;
  justify-items: end;
  font-variant-numeric: tabular-nums;
}

.ca-example__price del {
  color: var(--ca-muted);
  font-size: 12px;
}

.ca-example ins {
  text-decoration: none;
}

.ca-example__total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--ca-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ca-example__was {
  margin-right: 8px;
  color: var(--ca-muted);
  font-weight: 400;
}

.ca-example__total small {
  display: block;
  color: var(--ca-accent);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.ca-rules__list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ca-rules__list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  line-height: 1.5;
}

.ca-rules__list li::before {
  content: "";
  width: 28px;
  height: 28px;
  background: currentColor;
  -webkit-mask: url("../icons/icon-checkmark.svg") center / 18px no-repeat;
  mask: url("../icons/icon-checkmark.svg") center / 18px no-repeat;
}

.ca-rules__list b {
  display: block;
  font-weight: 600;
}

.ca-rules__list span {
  display: block;
  color: var(--ca-muted);
}

/* The closing call. */

.ca-end {
  padding-block: clamp(40px, 6vw, 80px) 0;
}

.ca-close {
  display: grid;
  gap: 16px;
  justify-items: center;
  padding: clamp(28px, 4vw, 56px);
  border-radius: 4px;
  background: var(--ca-ink);
  color: #fff;
  text-align: center;
}

.ca-close h2 {
  max-width: 18ch;
  font-size: clamp(1.5rem, 1rem + 2vw, 2.25rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.ca-close p {
  max-width: 44ch;
  color: rgb(255 255 255 / 72%);
}

.ca-close .button {
  color: var(--ca-ink);
  background: #fff;
}

/* Wider screens: the copy sits beside the picture in the hero and beside
   the basket in each step; a step still fills the window. */

@media (min-width: 750px) {
  .ca-hero {
    align-content: center;
    justify-items: start;
    /* Full width always; the height follows the picture's shape until the
       window is too short for it, then the band stops at the fold. */
    width: 100%;
    aspect-ratio: 1672 / 941;
    min-height: 0;
    max-height: calc(var(--ca-screen) - var(--ca-bar));
    padding: 48px 0 96px;
    background-image: url("../images/katlanan-indirim/hero-wide-backdrop.webp");
  }

  /* The baskets a little smaller, anchored to the right and the bottom,
     so the copy never reaches them; the picture's edges fade into the
     band's own olive. */
  .ca-hero__art {
    inset: auto 0 0 auto;
    width: auto;
    max-width: 88%;
    height: 88%;
    aspect-ratio: 1672 / 941; /* The picture whole, sized by the band's height. */
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%), linear-gradient(180deg, transparent, #000 14%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(90deg, transparent, #000 14%), linear-gradient(180deg, transparent, #000 14%);
    mask-composite: intersect;
  }

  .ca-hero__art img {
    object-fit: cover;
    object-position: right bottom;
  }

  /* The copy keeps to the empty olive at the left of the wide picture. */
  .ca-hero > .ca-hero__copy {
    width: 50%;
    margin-inline: 0;
    gap: 18px;
  }

  .ca-hero__title {
    max-width: 14ch;
  }

  .ca-hero__lede {
    max-width: 40ch;
  }

  .ca-step {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-rows: none;
    align-items: center;
    gap: clamp(24px, 4vw, 64px);
    padding: 24px 0;
  }

  .ca-step__visual {
    max-height: calc(var(--ca-screen) - 48px);
    aspect-ratio: 1;
  }

  .ca-step__copy {
    gap: 14px;
  }

  .ca-step__title {
    font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem);
  }

  .ca-step__text {
    font-size: 1.0625rem;
  }

  .ca-focus__frame {
    width: min(100%, 56svh, 420px);
  }

  .ca-rules__inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .ca-rules__inner > h2 {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ca-step.is-active .ca-focus__frame,
  .ca-step.is-active .ca-stamp,
  .ca-step.is-active .ca-focus__price ins,
  .ca-hero .ca-hero__cue {
    animation: none;
  }

  .ca-focus__frame,
  .ca-focus__price ins {
    opacity: 1;
    transform: none;
  }

  .ca-stamp {
    opacity: 1;
    transform: rotate(-6deg);
  }

  .ca-step__next svg {
    transition: none;
  }
}
