/* Locations hero: the 3D model of the sites, its labels, controls and the
   locator panel. Sits on top of styles.css. */

/* Header plus hero fill the first screen. hero.js keeps --header-h in step. */
.hero3d {
  --h-text: #14213D;
  --h-sub: #4A5263;
  --h-line: rgba(20, 33, 61, 0.5);
  position: relative;
  height: calc(100vh - var(--header-h, 77px));
  height: calc(100svh - var(--header-h, 77px));
  min-height: 540px;
  overflow: hidden;
  /* A plain studio backdrop, lit softly from above. */
  background: radial-gradient(120% 90% at 62% 30%, #FBFAF8 0%, #F1EFEA 55%, #E6E3DC 100%);
  color: var(--h-text);
}

.hero3d::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 62% 30%, #2A2E39 0%, #1B1E27 55%, #12141B 100%);
  opacity: 0;
  transition: opacity 1.2s ease;
}

html[data-mode='night'] .hero3d {
  --h-text: #FFFFFF;
  --h-sub: #C9CED9;
  --h-line: rgba(255, 255, 255, 0.6);
  --focus: var(--accent-soft);
}

html[data-mode='night'] .hero3d::before {
  opacity: 1;
}

.hero3d__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
}

/* Headline, top left */

.hero3d__head {
  position: absolute;
  left: 4.4%;
  top: 8%;
  width: 34%;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.3vw, 18px);
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.hero3d.has-site .hero3d__head {
  opacity: 0.16;
}

html[data-mode='night'] .hero3d .eyebrow {
  color: var(--accent-soft);
}

.hero3d__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: min(6.4vw, 11vh);
  line-height: 0.9;
  text-wrap: balance;
  color: var(--h-text);
  transition: color 1.2s ease;
}

.hero3d__sub {
  max-width: 26vw;
  font-size: clamp(16px, 1.25vw, 19px);
  line-height: 1.5;
  color: var(--h-sub);
  transition: color 1.2s ease;
}

/* Site labels: a small tag on a thin leader line. Position comes from the
   translate property and the leader length from --lead. */

.hero3d__tags {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tag {
  --lead: 26px;
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--navy);
  font-family: var(--font-body);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.town .tag {
  --lead: 12px;
  left: var(--x);
  top: var(--y);
}

.tag__box {
  position: absolute;
  left: 0;
  bottom: var(--lead);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  height: 30px;
  padding: 0 10px 0 6px;
  border: 1px solid rgba(20, 33, 61, 0.16);
  border-radius: 5px;
  background: var(--white);
  box-shadow: 0 4px 14px rgba(20, 33, 61, 0.12);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease);
}

/* A 44px touch target round the small tag. */
.tag__box::before {
  content: '';
  position: absolute;
  inset: -8px -4px;
}

.tag:hover .tag__box {
  border-color: var(--navy);
}

.tag[aria-pressed='true'] .tag__box {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--white);
}

.tag:focus-visible {
  outline: none;
}

.tag:focus-visible .tag__box {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.tag__logo {
  display: block;
  flex: none;
  max-width: none;
  border-radius: 3px;
  background: var(--white);
}

/* The logo files are shown as supplied; the BP file is only cropped of its white margin. */
.tag__logo--bp {
  width: 16px;
  height: 20px;
  object-fit: cover;
}

.tag__logo--gulf {
  width: 20px;
  height: 20px;
}

.tag__logo--morrisons {
  box-sizing: content-box;
  width: 56px;
  height: 9px;
  padding: 4px;
}

.tag__lead {
  position: absolute;
  left: -0.5px;
  bottom: 0;
  width: 1px;
  height: var(--lead);
  background: var(--h-line, rgba(20, 33, 61, 0.5));
}

.tag__lead::after {
  content: '';
  position: absolute;
  left: -2px;
  bottom: -2.5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 0 0 1.5px var(--white);
}

/* Controls: three small icon buttons in one corner */

.hero3d__controls {
  position: absolute;
  right: 3%;
  bottom: 5%;
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(20, 33, 61, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px rgba(20, 33, 61, 0.1);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--ease), color var(--ease);
}

.icon-btn:hover {
  background: rgba(20, 33, 61, 0.08);
}

.icon-btn[aria-pressed='true'] {
  background: var(--navy);
  color: var(--white);
}

.icon-btn svg {
  display: block;
  grid-area: 1 / 1;
}

.icon-btn .icon-btn__on,
.icon-btn[aria-pressed='true'] .icon-btn__off,
.icon-btn .icon-btn__sun,
html[data-mode='night'] .icon-btn .icon-btn__moon {
  display: none;
}

.icon-btn[aria-pressed='true'] .icon-btn__on,
html[data-mode='night'] .icon-btn .icon-btn__sun {
  display: block;
}

/* Locator panel, bottom left */

.locator {
  position: absolute;
  left: 4.4%;
  bottom: 6%;
  width: clamp(330px, 25vw, 376px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 18px 44px rgba(20, 33, 61, 0.12);
  --focus: var(--accent);
}

.tour-progress {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
  padding: 0 1px;
}

.tour-progress span {
  height: 3px;
  background: var(--line);
  transition: background-color 0.4s ease;
}

.tour-progress span.is-on {
  background: var(--accent);
}

.locator__top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 22px 0;
}

.locator__tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* Real brand logos, shown as supplied. */
.locator__brands {
  order: -1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}

.locator__brands img {
  max-width: none;
}

.locator__brands img {
  display: block;
  width: auto;
}

#logo-bp {
  width: 22px;
  height: 28px;
  object-fit: cover; /* crops the file's white margin only */
}

#logo-gulf {
  height: 26px;
}

#logo-morrisons {
  height: 13px;
}

.locator__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 22px 18px;
}

.locator__name {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.locator__addr {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.locator__prices {
  margin: 0 22px;
  border-top: 1px solid var(--line);
}

.locator__price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.locator__price dt {
  color: var(--ink-soft);
}

.locator__price dd {
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.locator__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 14px 12px 12px;
}

.locator__nav {
  display: flex;
  align-items: center;
}

.locator__arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--ease);
}

.locator__arrow:hover {
  background: rgba(20, 33, 61, 0.08);
}

.locator__count {
  min-width: 46px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.locator__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.locator__link {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: none;
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  cursor: pointer;
  touch-action: manipulation;
  transition: color var(--ease);
}

.locator__link:hover {
  color: var(--accent-deep);
}

.locator .btn--sm {
  min-height: 40px;
}

/* Static fallback: the SVG drawing, for reduced motion and when WebGL is missing. */

.hero3d__fallback {
  position: absolute;
  right: 3%;
  top: 50%;
  width: min(58%, 860px);
  transform: translateY(-50%);
}

html.hero-3d .hero3d__fallback,
html.hero-static .hero3d__canvas {
  display: none;
}

/* Hidden only while the 3D reveal is being prepared. */
.hero3d.is-intro .hero3d__head,
.hero3d.is-intro .locator,
.hero3d.is-intro .hero3d__controls,
.hero3d.is-intro .hero3d__tags,
.hero3d.is-intro .hero3d__fallback {
  visibility: hidden;
}

/* Phone: headline on top, full-width model, and the panel as a bottom sheet. */

@media (max-width: 759px) {
  .hero3d {
    display: flex;
    flex-direction: column;
    min-height: 470px;
  }

  .site-header__inner {
    position: relative;
    gap: 0 16px;
    padding-top: 8px;
    padding-bottom: 4px;
  }

  /* Wordmark and "Tap in" share the first row, links take the second. */
  .site-nav {
    width: 100%;
  }

  .site-header .btn--nav {
    position: absolute;
    right: var(--gutter);
    top: 10px;
    min-height: 40px;
    padding: 0 16px;
    font-size: 15px;
  }

  .hero3d__head {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    min-width: 0;
    gap: 8px;
    padding: 18px 20px 0;
  }

  .hero3d__title {
    font-size: clamp(38px, 11.5vw, 52px);
  }

  .hero3d__sub {
    max-width: none;
    font-size: 15px;
    line-height: 1.45;
  }

  /* Labels show the brand logo only; the name is in the panel. */
  .tag__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .tag__box {
    padding: 0 6px;
  }

  .hero3d__controls {
    position: relative;
    right: auto;
    bottom: auto;
    margin: auto 12px 10px auto;
  }

  .locator {
    position: relative;
    left: auto;
    bottom: auto;
    width: 100%;
    border-width: 1px 0 0;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -10px 30px rgba(20, 33, 61, 0.12);
  }

  .tour-progress {
    left: 14px;
    right: 14px;
  }

  .locator__top {
    padding: 16px 20px 0;
  }

  .locator__body {
    padding: 8px 20px 14px;
  }

  .locator__name {
    font-size: 22px;
  }

  .locator__prices {
    margin: 0 20px;
  }

  .locator__foot {
    padding: 8px 12px max(10px, env(safe-area-inset-bottom)) 10px;
  }

  .hero3d__fallback {
    position: relative;
    right: auto;
    top: auto;
    width: 100%;
    max-width: 520px;
    margin: auto;
    padding: 0 12px;
    transform: none;
  }

  html.hero-static .hero3d {
    height: auto;
  }
}
