/*
 * Xmas 2026 offers — one-off page styles (single-xmas-2026-offers.php).
 * Plain CSS on purpose: no build step; inherits site fonts/colours from screen.css.
 * Breakpoints follow the site's: mobile < 768px, 2 columns from 768px, 3 from 992px.
 */

.xmas-offers__intro {
  color: #545d67;
}

/* The intro's T&C button and the General T&C it scrolls to (both from the post content). */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.xmas-offers__tnc-link {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border: 1px solid #000;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
  color: #000;
  text-decoration: none;
  margin: 1.5rem auto;
}

.xmas-offers__tnc-link::after {
  margin-left: 0.5rem;
  font-weight: 400;
}

.xmas-offers__tnc-link:hover,
.xmas-offers__tnc-link:focus {
  background: #000;
  color: #fff;
  text-decoration: none;
}

.xmas-offers__general-tnc {
  scroll-margin-top: 2rem; /* clearance above it when the T&C button scrolls here */
  font-size: 0.875rem;
}

/* ---------- Filters ---------- */

.xmas-offers__filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-bottom: 1px solid #d9d9d9;
  margin-bottom: 1.5rem;
}

.xmas-offers__filter.is--category {
  border-right: 1px solid #d9d9d9;
}

.xmas-offers__filter {
  position: relative;
}

/* What the user sees: the chosen option in the large serif, with a chevron. */
.xmas-offers__filter-label {
  display: block;
  overflow: hidden;
  padding: 0.75rem 1.75rem 0.75rem 0.25rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.2'/%3E%3C/svg%3E") no-repeat right 0.5rem center;
  font-size: 1.25rem;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #000;
}

.xmas-offers__filter.is--format .xmas-offers__filter-label {
  padding-left: 0.75rem;
}

/* What the user clicks: the native select, invisible and stretched over the label,
   at normal text size so its option list renders at normal size too. */
.xmas-offers__filter select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  font-size: 1rem;
  cursor: pointer;
}

.xmas-offers__filter:focus-within .xmas-offers__filter-label {
  outline: 2px solid #000;
  outline-offset: -2px;
}

/* Format tabs: desktop only (mobile uses the format dropdown). */
.xmas-offers__tabs {
  display: none;
}

/* Desktop: like the Happenings page's filter bar. The formats are a row of tabs
   on the left; Category is a small dropdown on the right. */
@media (min-width: 768px) {
  .xmas-offers__filters {
    display: flex;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 0.9375rem 0 0.9375rem 1.25rem;
    border-top: 1px solid #d9d9d9;
  }

  /* The tabs flow like words (inline, not flex items) so that when they need two lines,
     text-wrap: balance evens them out. font-size 0 drops the spaces between the buttons;
     each tab sets its own size and the 1rem gap is its right margin. With the 14px text,
     all formats + Category fit on one line from 1200px. */
  .xmas-offers__tabs {
    display: block; /* hidden on mobile */
    flex: 1 1 auto;
    font-size: 0;
    line-height: 0;
    text-wrap: balance;
  }

  .xmas-offers__tab {
    display: inline-block;
    margin: 0.25rem 1rem 0.25rem 0;
    padding: 0;
    background: none;
    color: #757575;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1.5;
  }

  .xmas-offers__tab.is--active {
    color: #000;
  }

  .xmas-offers__filter.is--format {
    display: none;
  }

  .xmas-offers__filter,
  .xmas-offers__filter.is--category {
    flex: 0 0 auto;
    border: 0;
  }

  .xmas-offers__filters .xmas-offers__filter-label {
    padding: 0 1.25rem 0 0;
    background-position: right 0.125rem center;
    font-family: "nunito-sans", "avenir", Helvetica, Arial, "PingFang HK", "Microsoft JhengHei", sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
  }
}

.xmas-offers__empty {
  padding: 2rem 0;
  color: #545d67;
}

/* ---------- Grid ---------- */

.xmas-offers__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 768px) {
  .xmas-offers__grid {
    /* Each card draws its own left rule; shifting the grid 1px left and clipping
       that 1px hides the rule on the first column, whichever cards are hidden. */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-left: -1px;
    clip-path: inset(0 0 0 1px);
  }
}

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

/* ---------- Card ---------- */

/* Image, body and buttons share row tracks with the other cards in the same grid row
   (subgrid), so the buttons line up across the row, and a row where no card has
   buttons ends right after its text instead of reserving space for them. */
.xmas-offers__card {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  align-content: start;
  padding: 0 0 2.5rem;
}

/* Mobile: the card's text runs exactly as wide as the popup's, so lines break in the same
   places. Popup text = screen − 1rem layer padding − 2rem box padding, each side; the card
   already sits inside 30px of page gutter per side, so it adds the rest (3rem − 30px). The
   cap mirrors the popup box's 560px limit. Desktop/tablet cards are set below. */
@media (max-width: 767px) {
  .xmas-offers__card {
    justify-self: center;
    width: 100%;
    max-width: calc(560px - 4rem + 2 * (3rem - 30px));
    padding: 0 calc(3rem - 30px) 2.5rem;
  }
}

.xmas-offers__card[hidden] {
  display: none;
}

@media (min-width: 768px) {
  .xmas-offers__card {
    padding: 0 1.75rem 2rem; /* none on top: the thumbnail starts the card */
    border-left: 1px solid #d9d9d9;
  }
}

.xmas-offers__image img,
.xmas-offers__noimage {
  display: block;
  width: 100%;
  aspect-ratio: 600 / 375; /* the supplied images' shape, so nothing is cropped */
  object-fit: cover;
  background: #f5f5f5;
}

.xmas-offers__body {
  padding: 1.75rem 0 1.5rem;
}

.xmas-offers__format {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #817345;
}

.xmas-offers__name {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
  line-height: 1.25;
}

/* The store name links to the store's page. */
.xmas-offers__name a {
  color: inherit;
  text-decoration: none;
}

.xmas-offers__name a:hover,
.xmas-offers__name a:focus-visible {
  text-decoration: underline;
}

/* The thumbnail as the Details popup's opener: no button look. */
button.xmas-offers__image {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

/* No fade on hover (the site's global button:hover); the pointer cursor is enough. */
button.xmas-offers__image:hover {
  opacity: 1;
}

.xmas-offers__description {
  margin: 0 0 1.5rem;
  font-size: 1rem; /* the page's body size, also inside the popup (whose base is smaller) */
  line-height: 1.5;
  color: #545d67;
  white-space: pre-line; /* keep the editor's line breaks (plain text from a textarea) */
}

.xmas-offers__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.xmas-offers__meta > span {
  flex: 0 1 50%;
  padding: 0 1rem;
  text-align: center;
  text-wrap: balance;
}

.xmas-offers__period + .xmas-offers__address {
  border-left: 1px solid #d9d9d9;
}

/* ---------- Details (T&C) + Explore More ---------- */

.xmas-offers__actions {
  border-top: 1px solid #d9d9d9;
  font-size: 0.875rem;
  font-weight: 600;
}

.xmas-offers__details,
.xmas-offers__explore {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0.75rem 0;
  border: 0;
  border-bottom: 1px solid #d9d9d9;
  background: none;
  font: inherit;
  line-height: 1.5;
  letter-spacing: normal; /* undo the site's global button styles */
  text-transform: none;
  color: #000;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.xmas-offers__details::after {
  content: "+";
  font-weight: 400;
}

.xmas-offers__details.is--placeholder {
  visibility: hidden;
}

.xmas-offers__explore::after {
  content: "\2192"; /* right arrow */
  font-weight: 400;
}

.xmas-offers__explore:hover,
.xmas-offers__details:hover {
  opacity: 0.5;
}

/* ---------- T&C popup (native popover, top layer) ---------- */

/* The popover itself is a transparent full-screen layer that scrolls, so a long popup
   grows and the whole thing scrolls instead of the box scrolling inside itself. */
.xmas-offers__popup {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 2rem 1rem;
  border: 0;
  background: transparent;
  color: #000;
  font-size: 0.875rem;
  font-weight: 400; /* not the semi-bold of the button row it sits in, so text matches the card */
  overflow-y: auto;
  overscroll-behavior: contain; /* don't scroll the page behind at the ends */
}

/* Only while open: a display value here would otherwise show closed popovers too. */
.xmas-offers__popup:popover-open {
  display: flex;
}

/* The white box: centred while it fits, starts at the top and scrolls with the layer when it doesn't. */
.xmas-offers__popup-box {
  position: relative;
  width: min(560px, 100%);
  margin: auto;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.xmas-offers__popup::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

/* Fade in/out. `display` + `overlay` with allow-discrete keep the popover in the top layer
   while it fades out; @starting-style gives the fade-in its start point. Browsers without
   support simply show/hide instantly (Safari fades in but not out). */
.xmas-offers__popup,
.xmas-offers__popup::backdrop {
  opacity: 0;
  transition: opacity 0.2s ease, display 0.2s allow-discrete, overlay 0.2s allow-discrete;
}

.xmas-offers__popup:popover-open,
.xmas-offers__popup:popover-open::backdrop {
  opacity: 1;
}

@starting-style {
  .xmas-offers__popup:popover-open,
  .xmas-offers__popup:popover-open::backdrop {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .xmas-offers__popup,
  .xmas-offers__popup::backdrop {
    transition: none;
  }
}

/* Floats top-right so the popup body reads exactly like a card. */
.xmas-offers__popup-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #000;
  cursor: pointer;
}

.xmas-offers__popup-close::before {
  content: "\00d7"; /* multiplication sign */
}

.xmas-offers__popup-body {
  padding: 2.5rem 2rem 2rem;
}

.xmas-offers__popup-body .xmas-offers__format,
.xmas-offers__popup-body .xmas-offers__name,
.xmas-offers__popup-body .xmas-offers__description {
  text-align: center;
}

.xmas-offers__popup-body .xmas-offers__meta {
  margin-bottom: 1.5rem;
}

/* An offer without details ends on its meta row. */
.xmas-offers__popup-body > :last-child {
  margin-bottom: 0;
}

/* The offer's Details, as written in the CMS (rich text: paragraphs, headings, lists, links…). */
.xmas-offers__tnc {
  padding-top: 1.25rem;
  border-top: 1px solid #d9d9d9;
  color: #545d67;
}

.xmas-offers__popup-body .xmas-offers__explore {
  margin-top: 1.25rem;
  border-top: 1px solid #d9d9d9;
  font-weight: 600;
}

.xmas-offers__tnc > :first-child {
  margin-top: 0;
}

.xmas-offers__tnc > :last-child {
  margin-bottom: 0;
}

.xmas-offers__tnc p,
.xmas-offers__tnc ol,
.xmas-offers__tnc ul,
.xmas-offers__tnc blockquote {
  margin: 0 0 0.75rem;
}

.xmas-offers__tnc ol,
.xmas-offers__tnc ul {
  padding-left: 1.25rem;
}

/* Subheadings inside Details: small and bold, not the site's large heading styles. */
.xmas-offers__tnc h1,
.xmas-offers__tnc h2,
.xmas-offers__tnc h3,
.xmas-offers__tnc h4,
.xmas-offers__tnc h5,
.xmas-offers__tnc h6 {
  margin: 1.25rem 0 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: normal;
  text-transform: none;
  color: #000;
}

.xmas-offers__tnc strong,
.xmas-offers__tnc b {
  font-weight: 600;
}

.xmas-offers__tnc a {
  color: inherit;
  text-decoration: underline;
}

.xmas-offers__tnc blockquote {
  padding-left: 0.75rem;
  border-left: 2px solid #d9d9d9;
}

.xmas-offers__tnc hr {
  margin: 1rem 0;
  border: 0;
  border-top: 1px solid #d9d9d9;
}

/* The site resets list markers globally; T&C lists need them back. */
.xmas-offers__tnc ol li {
  list-style: decimal;
}

.xmas-offers__tnc ul li {
  list-style: disc;
}
