/* =========================================================================
   Gavekurve – bestillingsflow  ([pbb_gift_basket_order])
   Follows the theme's design tokens (colours and fonts from the Customizer),
   with fallbacks so the page also works with another theme.
   The look borrows from the café's own baskets: a dark box, hot pink tissue
   paper and a pink greeting card.
   ========================================================================= */

.pbb-gift {
  --g-cta: var(--cta, #9b1b4a);
  --g-cta-hover: var(--cta-hover, #7f163d);
  --g-pink: var(--primary, #ff68c7);
  --g-dark: var(--contrast, #3b2a2f);
  --g-text: var(--text, #3b2a2f);
  --g-muted: var(--muted, #6e5f63);
  --g-bg: var(--bg, #fbf6f1);
  --g-card: var(--card, #fffdfb);
  --g-surface: var(--surface, #f7e6ec);
  --g-line: var(--line, rgba(59, 42, 47, 0.1));
  --g-radius: var(--radius, 18px);
  --g-ring: var(--focus-ring, rgba(155, 27, 74, 0.35));
  --g-heading: var(--font-heading, Georgia, 'Times New Roman', serif);
  --g-body: var(--font-body, 'Helvetica Neue', Arial, sans-serif);
  color: var(--g-text);
  font-family: var(--g-body);
  scroll-margin-top: calc(var(--pbb-header-h, 0px) + 16px);
}

.pbb-gift *,
.pbb-gift *::before,
.pbb-gift *::after { box-sizing: border-box; }

.pbb-gift [hidden] { display: none !important; }

.pbb-gift [id] { scroll-margin-top: calc(var(--pbb-header-h, 0px) + 16px); }

.pbb-gift h2,
.pbb-gift h3 { font-family: var(--g-heading); color: var(--g-dark); }

/* ---- Layout: steps on the left, order summary on the right ---- */
.pbb-gift__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}

.pbb-gift__main {
  display: grid;
  gap: 20px;
  min-width: 0;
}

/* ---- Steps ---- */
.pbb-gift__step {
  min-width: 0;
  margin: 0;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--g-line);
  border-radius: var(--g-radius);
  background: var(--g-card);
}

/* A floated legend behaves like a normal heading inside the fieldset. */
.pbb-gift__legend {
  float: left;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0 0 18px;
  padding: 0;
  color: var(--g-dark);
  font-family: var(--g-heading);
  font-size: clamp(1.25rem, 2.2vw, 1.5rem);
  line-height: 1.2;
}

.pbb-gift__step > :not(legend) { clear: both; }

.pbb-gift__legend small {
  color: var(--g-muted);
  font-family: var(--g-body);
  font-size: 0.85rem;
  font-weight: 500;
}

.pbb-gift__num {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--g-cta);
  color: #fff;
  font-family: var(--g-body);
  font-size: 0.95rem;
  font-weight: 700;
}

.pbb-gift__hint {
  margin: 0 0 16px;
  color: var(--g-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.pbb-gift__hint strong { color: var(--g-text); }

.pbb-gift__sub {
  margin: 20px 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
}

.pbb-gift__note,
.pbb-gift__empty {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--g-surface);
  font-size: 0.92rem;
  line-height: 1.5;
}

.pbb-gift__kicker {
  margin: 0 0 8px;
  color: var(--g-cta);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---- Basket cards ---- */
.pbb-gift__baskets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pbb-basket {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--g-line);
  border-radius: calc(var(--g-radius) - 4px);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.pbb-basket:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px -24px rgba(59, 42, 47, 0.45);
}

.pbb-basket.is-selected {
  border-color: var(--g-cta);
  box-shadow: 0 0 0 3px var(--g-ring);
}

.pbb-basket.is-soldout .pbb-basket__media { opacity: 0.55; }

.pbb-basket__media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #efe9dc;
}

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

.pbb-basket__placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  background: linear-gradient(135deg, var(--g-surface), #fff);
  color: var(--g-cta);
}

.pbb-basket__placeholder svg { width: 38%; height: auto; }

.pbb-basket__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--g-dark);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pbb-basket__badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--g-pink);
}

.pbb-basket__check {
  position: absolute;
  top: 12px;
  right: 12px;
  display: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--g-cta);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.5);
}

.pbb-basket.is-selected .pbb-basket__check { display: grid; }

.pbb-basket__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 16px 16px 14px;
}

.pbb-basket__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pbb-gift .pbb-basket__title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.25;
}

.pbb-basket__price {
  margin: 0;
  color: var(--g-cta);
  font-weight: 700;
  white-space: nowrap;
}

.pbb-basket__text {
  margin: 0;
  color: var(--g-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.pbb-basket__contents { font-size: 0.9rem; }

.pbb-basket__contents summary {
  width: fit-content;
  color: var(--g-dark);
  font-weight: 600;
  cursor: pointer;
}

.pbb-basket__contents ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.pbb-basket__contents li {
  position: relative;
  margin: 0 0 4px;
  padding-left: 16px;
  line-height: 1.4;
}

.pbb-basket__contents li::before {
  content: "";
  position: absolute;
  top: 0.5em;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--g-pink);
}

.pbb-basket__note {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--g-surface);
  font-size: 0.85rem;
  line-height: 1.4;
}

.pbb-basket__stock,
.pbb-basket__soldout {
  margin: 0;
  color: var(--g-muted);
  font-size: 0.85rem;
}

.pbb-basket__soldout {
  color: var(--g-cta);
  font-weight: 700;
}

.pbb-basket__buy { margin-top: auto; }

.pbb-basket__variant {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--g-line);
}

.pbb-basket__variant + .pbb-basket__variant { margin-top: 10px; }

.pbb-basket__variant-name {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
}

.pbb-basket__variant-name small {
  display: block;
  color: var(--g-muted);
  font-weight: 500;
}

/* ---- Quantity stepper ---- */
.pbb-stepper {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  border: 1px solid rgba(59, 42, 47, 0.18);
  border-radius: 999px;
  background: #fff;
}

.pbb-stepper__btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--g-cta);
  font: 600 1.35rem/1 var(--g-body);
  cursor: pointer;
}

.pbb-stepper__btn:hover:not(:disabled) { background: var(--g-surface); }

.pbb-stepper__btn:disabled { color: var(--g-muted); cursor: not-allowed; opacity: 0.5; }

.pbb-stepper__input {
  width: 40px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--g-text);
  font: 700 1rem/1 var(--g-body);
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.pbb-stepper__input::-webkit-outer-spin-button,
.pbb-stepper__input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }

.pbb-stepper__btn:focus-visible,
.pbb-stepper__input:focus-visible {
  outline: 3px solid var(--g-ring);
  outline-offset: 1px;
}

/* ---- Day and time chips ---- */
.pbb-gift__month {
  margin: 16px 0 8px;
  color: var(--g-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pbb-gift__dates > .pbb-gift__month:first-child { margin-top: 0; }

.pbb-gift__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pbb-gift-chip {
  position: relative;
  display: inline-flex;
  margin: 0;
  cursor: pointer;
}

.pbb-gift-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.pbb-gift-chip__face {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid rgba(59, 42, 47, 0.16);
  border-radius: 14px;
  background: #fff;
  line-height: 1.2;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pbb-gift-chip--date .pbb-gift-chip__face { min-width: 80px; padding: 9px 12px; }

.pbb-gift-chip__face small {
  color: var(--g-muted);
  font-size: 0.75rem;
  text-transform: capitalize;
}

.pbb-gift-chip__face strong { font-size: 0.98rem; }

.pbb-gift-chip__face em {
  color: var(--g-cta);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 600;
}

.pbb-gift-chip__face em:empty { display: none; }

.pbb-gift-chip--time .pbb-gift-chip__face {
  min-width: 74px;
  border-radius: 999px;
  font-weight: 600;
}

.pbb-gift-chip:hover .pbb-gift-chip__face { border-color: var(--g-cta); }

.pbb-gift-chip input:checked + .pbb-gift-chip__face {
  border-color: var(--g-cta);
  background: var(--g-cta);
  color: #fff;
}

.pbb-gift-chip input:checked + .pbb-gift-chip__face small,
.pbb-gift-chip input:checked + .pbb-gift-chip__face em { color: rgba(255, 255, 255, 0.85); }

.pbb-gift-chip input:focus-visible + .pbb-gift-chip__face {
  outline: 3px solid var(--g-ring);
  outline-offset: 2px;
}

.pbb-gift-chip.is-disabled { cursor: not-allowed; }

.pbb-gift-chip.is-disabled .pbb-gift-chip__face {
  border-style: dashed;
  background: transparent;
  opacity: 0.5;
}

.pbb-gift-chip.is-disabled:hover .pbb-gift-chip__face { border-color: rgba(59, 42, 47, 0.16); }

/* ---- Form fields ---- */
.pbb-gift__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.pbb-gift__fields--single { grid-template-columns: minmax(0, 1fr); }

.pbb-gift__field {
  display: grid;
  gap: 6px;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.pbb-gift__field small {
  color: var(--g-muted);
  font-weight: 500;
}

.pbb-gift__field--wide { grid-column: 1 / -1; }

.pbb-gift__field input,
.pbb-gift__field textarea {
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(59, 42, 47, 0.2);
  border-radius: 12px;
  background: #fff;
  color: var(--g-text);
  font: 400 1rem/1.5 var(--g-body);
}

.pbb-gift__field textarea { min-height: 104px; resize: vertical; }

.pbb-gift__field input:focus,
.pbb-gift__field textarea:focus {
  border-color: var(--g-cta);
  outline: none;
  box-shadow: 0 0 0 4px var(--g-ring);
}

.pbb-gift__field .pbb-gift__count {
  justify-self: end;
  font-size: 0.8rem;
}

.pbb-gift__hp {
  position: absolute !important;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Greeting card preview ---- */
.pbb-gift__card-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 250px);
  gap: 24px;
  align-items: start;
  margin-bottom: 16px;
}

.pbb-gift-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  margin-top: 26px;
  padding: 20px 18px 14px;
  border-radius: 6px;
  background: #f8cfe2;
  color: var(--g-dark);
  box-shadow: 0 20px 32px -20px rgba(59, 42, 47, 0.6);
  transform: rotate(-2deg);
}

@supports (color: color-mix(in srgb, red, blue)) {
  .pbb-gift-card { background: color-mix(in srgb, var(--g-pink) 34%, #fff); }
}

.pbb-gift-card__to {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pbb-gift-card__to:empty { display: none; }

.pbb-gift-card__msg {
  flex: 1;
  margin: 0;
  font-family: var(--g-heading);
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.4;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.pbb-gift-card__msg.is-placeholder { opacity: 0.55; }

.pbb-gift-card__brand {
  align-self: flex-end;
  margin: 0;
  color: var(--g-cta);
  font-family: var(--g-heading);
  font-size: 0.85rem;
}

/* ---- Order summary (a dark "lid" with a strip of pink tissue) ---- */
.pbb-gift__aside {
  position: sticky;
  top: calc(var(--pbb-header-h, 0px) + 20px);
  min-width: 0;
}

.pbb-gift__summary {
  overflow: hidden;
  border: 1px solid var(--g-line);
  border-radius: var(--g-radius);
  background: var(--g-card);
  box-shadow: var(--shadow, 0 24px 48px -28px rgba(59, 42, 47, 0.28));
}

.pbb-gift__summary-head {
  padding: 18px 22px 20px;
  background: var(--g-dark);
  box-shadow: inset 0 -6px 0 var(--g-pink);
}

.pbb-gift .pbb-gift__summary-title {
  margin: 0;
  color: #fff;
  font-size: 1.35rem;
}

.pbb-gift__summary-body { padding: 18px 22px 22px; }

.pbb-gift__summary-empty {
  margin: 0 0 12px;
  color: var(--g-muted);
  font-size: 0.95rem;
}

.pbb-gift__lines {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.pbb-gift__lines li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--g-line);
  font-size: 0.95rem;
}

.pbb-gift__lines strong { white-space: nowrap; }

.pbb-gift__meta {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
}

.pbb-gift__meta div { display: grid; gap: 2px; }

.pbb-gift__meta dt {
  color: var(--g-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pbb-gift__meta dd {
  margin: 0;
  font-weight: 600;
  line-height: 1.4;
}

.pbb-gift__meta dd:first-letter { text-transform: uppercase; }

.pbb-gift__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 2px solid var(--g-line);
  font-size: 1.15rem;
}

.pbb-gift__pay {
  margin: 6px 0 16px;
  color: var(--g-muted);
  font-size: 0.9rem;
}

.pbb-gift__error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.92rem;
  line-height: 1.45;
}

.pbb-gift__small {
  margin: 12px 0 0;
  color: var(--g-muted);
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
}

/* ---- Buttons (own styles so the flow does not depend on the theme) ---- */
.pbb-gift__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 28px;
  border: 2px solid var(--g-cta);
  border-radius: 999px;
  background: var(--g-cta);
  color: #fff !important;
  font: 700 1rem/1.2 var(--g-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.pbb-gift__button:hover {
  border-color: var(--g-cta-hover);
  background: var(--g-cta-hover);
  transform: translateY(-1px);
}

.pbb-gift__button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.pbb-gift__button:focus-visible {
  outline: 3px solid var(--g-ring);
  outline-offset: 3px;
}

.pbb-gift__button--outline {
  background: transparent;
  color: var(--g-cta) !important;
}

.pbb-gift__button--outline:hover { color: #fff !important; }

.pbb-gift__submit { width: 100%; }

/* ---- Messages ---- */
.pbb-gift__alert {
  margin: 0 0 20px;
  padding: 14px 18px;
  border: 1px solid #fecaca;
  border-radius: 14px;
  background: #fef2f2;
  color: #991b1b;
}

.pbb-gift-done {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--g-line);
  border-radius: calc(var(--g-radius) * 1.3);
  background: var(--g-card);
  box-shadow: var(--shadow, 0 24px 48px -28px rgba(59, 42, 47, 0.28));
  text-align: center;
}

.pbb-gift-done:focus { outline: none; }

.pbb-gift-done__icon {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--g-surface);
  color: var(--g-cta);
}

.pbb-gift .pbb-gift-done__title {
  margin: 0 0 14px;
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  line-height: 1.15;
}

.pbb-gift-done p { color: var(--g-muted); }

.pbb-gift-done strong { color: var(--g-text); }

.pbb-gift-done__actions { margin: 24px 0 0; }

/* ---- Phone bottom bar (count + total, jumps to the next step) ---- */
.pbb-gift-bar { display: none; }

@media (max-width: 960px) {
  .pbb-gift__form { grid-template-columns: minmax(0, 1fr); }
  .pbb-gift__aside { position: static; }

  .pbb-gift-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--g-line);
    background: var(--g-bg);
    box-shadow: 0 -8px 20px -14px rgba(59, 42, 47, 0.4);
  }

  .pbb-gift-bar__text { font-size: 0.95rem; font-weight: 700; }

  .pbb-gift-bar__go {
    flex: 0 0 auto;
    padding: 11px 20px;
    border-radius: 999px;
    background: var(--g-cta);
    color: #fff !important;
    font-weight: 700;
    text-decoration: none;
  }

  body:has(.pbb-gift-bar:not([hidden])) .site-footer { padding-bottom: 96px; }
}

@media (max-width: 700px) {
  .pbb-gift__card-layout { grid-template-columns: minmax(0, 1fr); }
  .pbb-gift-card { width: min(100%, 300px); min-height: 150px; margin: 4px auto 0; }
}

/* ---- Phones: compact basket rows with the photo on the left ---- */
@media (max-width: 560px) {
  .pbb-gift__step { padding: 20px 16px; }
  .pbb-gift__fields { grid-template-columns: minmax(0, 1fr); }
  .pbb-gift__baskets { gap: 12px; }

  .pbb-basket {
    display: grid;
    grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
    align-items: start;
  }

  .pbb-basket:hover { transform: none; }
  .pbb-basket__body { gap: 6px; padding: 12px 12px 12px 14px; }
  .pbb-gift .pbb-basket__title { font-size: 1.02rem; }
  .pbb-basket__text { font-size: 0.86rem; line-height: 1.45; }
  .pbb-basket__badge { top: 8px; left: 8px; padding: 4px 8px; font-size: 0.7rem; }
  .pbb-basket__check { top: 8px; right: 8px; width: 28px; height: 28px; }
  .pbb-basket__variant { padding-top: 8px; }
  .pbb-basket__variant--single .pbb-basket__variant-name { font-size: 0.85rem; color: var(--g-muted); }
  .pbb-stepper__btn { width: 40px; height: 40px; }
  .pbb-stepper__input { width: 34px; height: 40px; }
  .pbb-gift-chip--date .pbb-gift-chip__face { min-width: 74px; }
}

@media (prefers-reduced-motion: reduce) {
  .pbb-basket,
  .pbb-gift__button,
  .pbb-gift-chip__face { transition: none; }
  .pbb-basket:hover,
  .pbb-gift__button:hover { transform: none; }
}
