/* ── Help page ──
   Sits on top of style.css so every component render below is the real
   component. Only layout for the page itself and demo-frame overrides live here. */

.help {
  width: 100%;
  min-width: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 12px 48px;
}
@media (min-width: 768px) {
  .help { padding: 16px 24px 64px; }
}

/* Masthead: a small way back, one title, one line of context, a rule ------- */
.help-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  font-family: "AmsiPro-Narw", var(--font);
  font-weight: 700;
  font-size: 15px;
  color: var(--gray-500);
  text-decoration: none;
  transition: color .15s;
}
.help-home:hover { color: var(--gray-900); }
.help-home-logo { width: 22px; height: 22px; }
.help-kicker {
  font-family: "AmsiPro-Narw", var(--font);
  font-weight: 700;
  font-size: clamp(1.9rem, 3.6vw, 2.5rem);
  line-height: 1.1;
  color: var(--gray-900);
  margin: 22px 0 8px;
}
.help-lede {
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-500);
  max-width: 62ch;
  margin: 0 0 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--gray-200);
}
@media (min-width: 768px) {
  .help-home { margin-top: 16px; }
  .help-kicker { margin-top: 28px; }
}

/* Contents: pill row on small screens, sticky sidebar on wide ones -------- */
.help-contents {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 44px;
  padding: 0;
  list-style: none;
}
.help-contents a {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  background: white;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s, transform .1s;
}
.help-contents a:hover,
.help-contents a.is-active {
  border-color: #ed702a;
  color: #c25a1f;
  background: #fff7ed;
}
.help-contents a:active { transform: scale(.97); }
@media (min-width: 1024px) {
  .help {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    column-gap: 40px;
    align-items: start;
  }
  .help > .help-home, .help > .help-kicker, .help > .help-lede { grid-column: 1 / -1; }
  .help > .help-lede { max-width: none; }
  /* Sit the first entry on the first heading's cap line */
  .help-nav { position: sticky; top: 20px; grid-column: 1; padding-top: 4px; }
  .help-body { grid-column: 2; min-width: 0; }
  .help-contents { flex-direction: column; gap: 0; margin: 4px 0 0; }
  .help-contents a {
    height: auto;
    padding: 6px 0 6px 12px;
    border: none;
    border-left: 2px solid var(--gray-200);
    border-radius: 0;
    background: none;
    color: var(--gray-500);
    line-height: 1.35;
  }
  .help-contents a:hover { color: var(--gray-900); border-left-color: var(--gray-400); background: none; }
  .help-contents a.is-active { color: #c25a1f; font-weight: 600; border-left-color: #ed702a; background: none; }
  .help-contents a:active { transform: none; }
}

/* Sections ------------------------------------------------------------- */
.help-section {
  margin: 0 0 56px;
  scroll-margin-top: 16px;
}
.help-section h2 {
  font-family: "AmsiPro-Narw", var(--font);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.15;
  color: var(--gray-900);
  margin: 0 0 6px;
}
.help-section > p,
.help-list,
.help-note {
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-600);
  max-width: 64ch;
}
.help-section > p { margin: 0 0 12px; }
.help-section a { color: #c25a1f; text-decoration-color: rgba(194, 90, 31, .35); text-underline-offset: 2px; }
.help-section a:hover { text-decoration-color: #c25a1f; }
/* Prose lists only. Component lists inside demos and dropdowns are untouched. */
.help-list { padding-left: 22px; margin: 0 0 12px; }
.help-list > li { margin-bottom: 6px; }
.help-list > li::marker { color: var(--gray-400); font-weight: 600; }
.help-section kbd,
.help-ui {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--gray-200);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: white;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  line-height: 20px;
  vertical-align: 1px;
  white-space: nowrap;
}
.help-ui--orange { color: #c25a1f; border-color: rgba(237,112,42,.35); background: #fff7ed; }
.help-ui-icon { width: 11px; height: 11px; vertical-align: -1px; margin-right: 4px; color: #ed702a; }

.help-note {
  border-left: 3px solid var(--amber-500);
  padding: 2px 0 2px 14px;
  margin: 14px 0 0;
  color: var(--gray-600);
}

/* Steps: text + live component render ---------------------------------- */
.help-steps {
  list-style: none;
  padding: 0;
  margin: 22px 0 0;
  counter-reset: step;
}
.help-steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px 24px;
}
.help-section { container-type: inline-size; }
@container (min-width: 560px) { .help-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 860px) { .help-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Each step spans two grid rows (text, demo) so demos line up across a row */
.help-step { display: grid; grid-template-rows: subgrid; grid-row: span 2; gap: 12px; min-width: 0; }
.help-step-text { counter-increment: step; }
.help-step .demo { display: flex; flex-direction: column; height: 100%; }
.help-step .demo .filter-group:last-child,
.help-step .demo > .dropdown-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.help-step .demo .filter-group:last-child > .dropdown-wrapper { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.help-step .demo .dropdown-wrapper > .dropdown-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.help-step .demo .dropdown-list,
.help-step .demo .store-list { flex: 1; max-height: 226px; min-height: 0; overflow-y: auto; }
.help-step .demo-phone { justify-content: flex-start; }
.help-step-text h3 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 6px;
}
.help-step-text h3::before {
  content: counter(step);
  flex-shrink: 0;
  font-family: "AmsiPro-Narw", var(--font);
  font-weight: 900;
  font-size: 22px;
  line-height: 1;
  color: #ed702a;
  min-width: 18px;
}
.help-step-text p {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--gray-600);
  margin: 0 0 8px;
}
.help-step-text p:last-child { margin-bottom: 0; }

/* Demo frame: white card exactly like the filters card, panels forced open */
.demo {
  position: relative;
  isolation: isolate; /* keep the site's dropdown and map z-indexes below the fixed footer */
  z-index: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 14px;
  min-width: 0;
}
.demo .filter-group + .filter-group { margin-top: 14px; }
/* The page's prose link colour must not leak into the rendered components */
.demo a { text-decoration: none; }
.demo a.tray-store-tag { color: var(--gray-700); }
.demo a.tray-store-tag:hover { color: #ed702a; }
.demo .tray-find-btn, .demo .tray-find-btn:hover { color: white; }
.demo-toolbar { padding: 0; max-width: 640px; }
.demo-toolbar .table-toolbar { border-bottom: 1px solid var(--gray-100); }
.demo .dropdown-panel {
  display: block;
  position: static;
  z-index: auto;
  left: auto; right: auto;
  width: auto;
  margin-top: 6px;
  max-height: none;
  animation: none;
  box-shadow: 0 4px 24px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.05);
}
.demo .dropdown-list { max-height: 236px; overflow-y: auto; }
.demo .dropdown-button { cursor: default; }
.demo .store-dropdown-panel { padding: 12px; }
.demo .store-list { max-height: 196px; }
.demo .store-item input[type="checkbox"] { pointer-events: none; }
.demo .store-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo .store-groups-actions { gap: 6px; }
.demo .store-groups-name-form { display: flex; align-items: center; gap: 4px; }
.demo .store-groups-name-form[hidden] { display: none; }
.demo .store-groups-name-input {
  height: 24px;
  width: 120px;
  padding: 0 8px;
  border: 1px solid rgba(237,112,42,.5);
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  outline: none;
}
.demo .store-groups-name-input:focus { box-shadow: 0 0 0 3px rgba(245,158,11,.12); }
.demo .store-groups-name-confirm,
.demo .store-groups-name-cancel {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%; cursor: pointer; padding: 0;
}
.demo .store-groups-name-confirm { background: #ed702a; color: white; }
.demo .store-groups-name-cancel { background: var(--gray-100); color: var(--gray-500); }
.demo .store-groups-name-confirm svg,
.demo .store-groups-name-cancel svg { width: 11px; height: 11px; }
.demo .store-groups-scroll { gap: 6px; }

/* Distance badges arrive one after another when "Near me" resolves */
.demo .store-item-distance {
  opacity: 0;
  transform: translateX(4px);
  transition: opacity .28s ease, transform .28s cubic-bezier(.22,1,.36,1);
}
.demo.located .store-item-distance {
  opacity: 1;
  transform: none;
  transition-delay: calc(var(--i, 0) * 45ms);
}
.demo .store-list.is-sorting .store-item {
  transition: transform .32s cubic-bezier(.22,1,.36,1);
}
@media (prefers-reduced-motion: reduce) {
  .demo .store-item-distance,
  .demo .store-list.is-sorting .store-item { transition: none !important; }
}

/* Phone frame: reproduces the mobile filters bar at any viewport */
.demo-phone {
  max-width: 340px;
  background: var(--gray-100);
  border-radius: 12px;
  padding: 12px;
}
.demo-phone .filters-card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}
.demo-phone .filters-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  gap: 8px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: border-color 250ms cubic-bezier(0.32, 0.72, 0, 1);
}
.demo-phone .filters-toggle:not(.collapsed) { border-bottom-color: var(--gray-100); }
.demo-phone .filters-toggle-summary {
  flex: 1;
  text-align: right;
  font-weight: 400;
  font-size: 12px;
  color: var(--gray-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.demo-phone .filters-toggle-chevron {
  width: 18px; height: 18px; flex-shrink: 0;
  color: var(--gray-400);
  transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1);
}
.demo-phone .filters-toggle.collapsed .filters-toggle-chevron { transform: rotate(-90deg); }
.demo-phone .filters-collapse {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 250ms cubic-bezier(0.32, 0.72, 0, 1);
}
.demo-phone .filters-collapse.collapsed { grid-template-rows: 0fr; }
.demo-phone .filters-collapse > .filters {
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0;
  padding: 12px 16px 12px;
  transition: padding 250ms cubic-bezier(0.32, 0.72, 0, 1);
}
.demo-phone .filters-collapse.collapsed > .filters { padding-top: 0; padding-bottom: 0; }
.demo-phone .filters-toggle .locate-btn { margin-left: auto; }
.demo-phone .filters-toggle .locate-btn .locate-btn-label { display: none; }
.demo-phone .filters-toggle .locate-btn .locate-btn-icon { width: 14px; height: 14px; }
@media (prefers-reduced-motion: reduce) {
  .demo-phone .filters-collapse,
  .demo-phone .filters-toggle-chevron { transition: none !important; }
}

/* Offers table + tray render ------------------------------------------- */
.demo-table { padding: 0; overflow: hidden; }
.demo-table .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.demo-table .offers-table thead { position: static; }
.demo-table .offers-table th { cursor: default; }
.demo-table .offers-table th.sort-desc { color: var(--gray-800); }
.demo-table .row-main { cursor: default; }
.demo-table .row-main td { border-bottom: 1px solid var(--gray-100); }
.demo-table .row-main:last-of-type td { border-bottom: none; }
.demo-table .tray-inner { height: auto !important; }
.demo-table .tray-map-col { min-height: 140px; }
.help-notes {
  list-style: disc;
  padding-left: 18px;
  margin: 18px 0 0 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-600);
  max-width: 64ch;
}
.help-notes li { margin-bottom: 4px; }
.help-notes li::marker { color: var(--gray-400); }

/* URL parameters --------------------------------------------------------- */
.param-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  border-top: 1px solid var(--gray-200);
}
.param {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-200);
}
@media (min-width: 768px) {
  .param { grid-template-columns: 150px minmax(0, 1fr); align-items: start; }
}
.param-body { min-width: 0; }
.param-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-900);
}
.param-name small {
  display: block;
  font-family: var(--font);
  font-weight: 500;
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 2px;
}
.param-body p {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--gray-600);
  margin: 0 0 10px;
  max-width: 60ch;
}
.param-body p:last-child { margin-bottom: 0; }

/* A URL you can copy or open, with the parameter part picked out */
.url {
  display: flex;
  align-items: stretch;
  position: relative;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
  margin: 0 0 8px;
  max-width: 100%;
}
.url code {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--gray-500);
  white-space: normal;
  overflow-wrap: normal;
  word-break: keep-all;
  line-height: 1.5;
}
.url-host, .url-param { white-space: nowrap; }
@media (max-width: 640px) {
  .url-host { display: none; }
  .url code::before { content: "…/"; color: var(--gray-400); }
}
.url code b { font-weight: 600; color: var(--gray-900); }
.url code i { font-style: normal; color: #c25a1f; font-weight: 600; }
.url-actions { display: flex; flex-shrink: 0; border-left: 1px solid var(--gray-200); }
.url-actions a,
.url-actions button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 11px;
  border: none;
  background: white;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-decoration: none;
  cursor: pointer;
  transition: color .15s, background .15s;
  border-left: 1px solid var(--gray-200);
  min-width: 64px;
  justify-content: center;
}
.url-actions a:first-child,
.url-actions button:first-child { border-left: none; }
.url-actions a:last-child { border-top-right-radius: 7px; border-bottom-right-radius: 7px; }
.url-actions a:hover,
.url-actions button:hover { color: #c25a1f; background: #fff7ed; }
.url-actions button.copied { color: var(--spirits-dark); background: #ecfdf5; }
.url-actions svg { width: 13px; height: 13px; }

/* Location slug table */
.slug-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px 28px;
  margin-top: 14px;
}
.slug-group h4 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin: 0 0 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-200);
}
.slug-group h4 code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: #c25a1f;
}
.slug-group ul { list-style: none; padding: 0; margin: 0; }
.slug-group li {
  font-size: 13px;
  line-height: 1.35;
  color: var(--gray-700);
  padding: 5px 0;
  margin: 0;
}
.slug-group li code {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--gray-400);
  margin-top: 1px;
  word-break: break-all;
}
.slug-group li a { color: inherit; text-decoration: none; }
.slug-group li a:hover { color: #c25a1f; }
.slug-group li.unavailable { color: var(--gray-400); }
.slug-group li.unavailable code { color: var(--gray-300); }
.help-details {
  margin-top: 18px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: white;
  padding: 0 16px;
}
.help-details summary {
  cursor: pointer;
  list-style: none;
  padding: 13px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.help-details summary::-webkit-details-marker { display: none; }
.help-details summary svg {
  width: 16px; height: 16px; color: var(--gray-400); flex-shrink: 0;
  transition: transform .2s ease;
}
.help-details[open] summary svg { transform: rotate(180deg); }
.help-details[open] summary { border-bottom: 1px solid var(--gray-100); }
.help-details .slug-groups { padding: 14px 0 18px; margin-top: 0; }

/* Footer overrides for this page */
.help-footer { justify-content: center; gap: 6px 24px; }
.help-footer .footer-link { font-weight: 500; }


/* Deep links --------------------------------------------------------------- */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.help-step, .param, .help-details, .slug-group { scroll-margin-top: 16px; }
.help-section > h2, .help-step-text > h3, .param-name { position: relative; }
.anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  margin-left: 6px;
  border-radius: 6px;
  color: var(--gray-400);
  opacity: 0;
  vertical-align: middle;
  transition: opacity .15s, color .15s, background .15s;
}
.anchor svg { width: 14px; height: 14px; }
.help-section > h2:hover .anchor,
.help-step-text > h3:hover .anchor,
.param-name:hover .anchor,
.anchor:focus-visible { opacity: 1; }
.anchor:hover { color: #c25a1f; background: #fff7ed; }
.help-step-text > h3 .anchor { align-self: center; }
@media (hover: none) { .anchor { opacity: .6; } }

/* Cashback ----------------------------------------------------------------- */
.cashback-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 10px;
}
.cashback-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: white;
  color: var(--gray-700) !important;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 600;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.cashback-link img { height: 22px; width: auto; max-width: 110px; display: block; }
.cashback-link:hover { border-color: #ed702a; box-shadow: var(--shadow-sm); }
.cashback-link:active { transform: scale(.98); }
.cashback-note { font-size: 13px; color: var(--gray-400); max-width: 64ch; }

/* In the narrow step card, the distance badge needs the room the postcode takes */
.demo.located .store-item-postcode { display: none; }

/* Editable values in the URL examples --------------------------------------- */
.url-field { position: relative; display: inline-block; }
.url-value {
  display: inline-block;
  margin: -2px 0;
  padding: 1px 6px 1px 5px;
  border: 1px dashed rgba(237, 112, 42, .45);
  border-radius: 5px;
  background: #fff7ed;
  font: inherit;
  font-weight: 600;
  color: #c25a1f;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.url-value::after {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  margin: 0 0 2px 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: .6;
}
[data-param="q"] .url-value::after { content: none; }
.url-value[hidden] { display: none; }
.url-value:hover, .url-value[aria-expanded="true"] { border-style: solid; border-color: #ed702a; background: #fde0cc; }
.url-value:focus-visible { outline: 2px solid var(--amber-500); outline-offset: 1px; }
@keyframes valueFlash { 0% { background: #fdcfae; } 100% { background: #fff7ed; } }
.url-value.flash { animation: valueFlash .6s ease-out; }
@media (prefers-reduced-motion: reduce) { .url-value.flash { animation: none; } }
.url-input {
  display: inline-block;
  margin: -2px 0;
  padding: 1px 6px 1px 5px;
  border: 1px solid #ed702a;
  border-radius: 5px;
  background: white;
  font: inherit;
  font-weight: 600;
  color: #c25a1f;
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .15);
  min-width: 3ch;
}
.url-field .url-pop {
  top: calc(100% + 6px);
  left: 0; right: auto;
  width: 260px;
  max-height: 300px;
  z-index: 40;
  text-align: left;
  font-family: var(--font);
  font-weight: 400;
  white-space: normal;
}
.url-field .url-pop li { font-size: 13px; padding: 7px 10px; }
/* The site indents rows under state headers; only do that when there are headers */
.url-field .url-pop li:not(.dropdown-group-header) { padding-left: 10px; }
.url-field .url-pop.has-groups li:not(.dropdown-group-header) { padding-left: 18px; }
.url-field .url-pop li.unavailable { color: var(--gray-400); }
@media (max-width: 767px) {
  .url-field .url-pop { position: fixed; left: 12px; right: 12px; width: auto; top: auto; bottom: 12px; max-height: 50vh; }
}
