/* =====================================================================
   Stancliffe Homes — View Developments one-pager.

   Shared layout values are matched to the reference theme (header.css +
   homepage.css) so that clicking a development — which loads page-home.php
   — has no visible jump in the logo, header, cards or band.

   Colour / font values are overridden at runtime from settings.json.
   ===================================================================== */

:root {
  --core-colour: #031d3e;
  --secondary-colour: #ffffff;
  --background-colour: #ffffff;
  --button-colour: #031d3e;
  --client-name-colour: #ffffff;
  --page-heading-colour: #ffffff;
  --font-colour: #ffffff;
  --font-heading: "FuturaPT", Arial, sans-serif;
  --font-body: "FuturaPT", Arial, sans-serif;

  /* Button corner rounding — overridden to 0 at runtime when
     settings.json sets "button_rounded": false. */
  --button-radius: 999px;

  /* Image height — mirrors .card-thumbnail (homepage.css). The width-based
     max-heights are applied per breakpoint below. Drives the image and the
     vertical centring of the nav arrows. */
  --img-h: calc(50vh - 50px);

  /* Space above the images (mirrors .swiper-container padding-top). */
  --img-pad-top: max(0px, calc(22.25vh - 150px));

  /* Gap between the two cards (matches the reference's 100px card spacing). */
  --card-gap: 6.25rem;

  /* Width of a single card. Default is the 2-up width; the 1-up breakpoints
     below override it. Drives the card width, the centring spacers, and the
     nav-arrow positions so they always stay in sync. */
  --card-w: calc((100% - var(--card-gap)) / 2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--background-colour);
  color: var(--core-colour);
  font-family: var(--font-body);
}

/* ---------- Header (mirrors #site-header / .header-inner) ---------- */
.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--core-colour);
}

.site-header img {
  height: 100px;
  width: auto;
  display: block;
}

.header-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

/* .header-title */
.header-text .client-name {
  font-family: var(--font-heading);
  color: var(--client-name-colour);
  font-size: 1.75rem;
  font-weight: 700; /* faux-bold synthesised from the Book weight, per reference */
  line-height: 2.125rem;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

/* .header-sub */
.header-text .page-heading {
  font-family: var(--font-body);
  color: var(--page-heading-colour);
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1.8125rem;
  margin-bottom: 1rem;
}

/* ---------- Main / Carousel (mirrors .swiper-container) ---------- */
main {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--img-pad-top) 2rem 0;
}

/* Navy band behind the top of the images. Tied to the image height (not the
   container height) so it always lands ~65% down the image — matching where
   the reference's band sits — regardless of how tall the page is. */
main::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(var(--img-pad-top) + var(--img-h) * 0.65);
  background: var(--core-colour);
  z-index: 0;
}

.carousel {
  position: relative;
  z-index: 1;
  width: 100%;
}

.carousel-track {
  display: flex;
  gap: var(--card-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  justify-content: center;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

/* When the track overflows, flex centring would clip the start (unscrollable),
   so we switch to start alignment and instead centre the active card with a
   spacer on each end equal to the empty space beside one card. Combined with
   scroll-snap-align: center, every card lands centred as you scroll. */
.carousel-track.is-scrollable {
  justify-content: flex-start;
}

.carousel-track.is-scrollable::before,
.carousel-track.is-scrollable::after {
  content: "";
  flex: 0 0 calc((100% - var(--card-w)) / 2);
}

/* The track's flex `gap` is also inserted between a spacer and its card; cancel
   it with a negative margin so each spacer equals exactly the side gap and the
   active card lands dead-centre. */
.carousel-track.is-scrollable::before {
  margin-right: calc(-1 * var(--card-gap));
}

.carousel-track.is-scrollable::after {
  margin-left: calc(-1 * var(--card-gap));
}

.development {
  flex: 0 0 auto;
  /* Two cards fill the row minus the gap — full-size cards, exact 100px gap,
     no overflow. Overridden to a fixed width in the 1-up phone layouts. */
  width: var(--card-w);
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
}

/* Image link wrapper — carries the URL on the image only. */
.development-img-link {
  display: block;
  width: 100%;
  line-height: 0;
}

.development-img {
  width: 100%;
  height: var(--img-h);
  object-fit: cover;
  display: block;
  border: 5px solid var(--secondary-colour);
}

/* .card-wrapper button — straddles the image's bottom edge */
.development-name {
  margin-top: 0;
  transform: translateY(-50%);
  position: relative;
  z-index: 2;
  width: min(50%, 460px);
  background: var(--button-colour);
  color: var(--font-colour);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: 0.04em;
  padding: 0.9rem 1rem;
  border-radius: var(--button-radius);
  border: none;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: opacity 0.15s ease;
}

.development-name:hover {
  opacity: 0.85;
}

/* .card-description */
.development-description {
  margin-top: 0.25rem;
  max-width: 100%;
  text-align: center;
  color: #000000;
  font-size: 16px;
  line-height: 26px;
}

/* ---------- Nav arrows (overlaid on the image, vertically centred) ---------- */
.carousel-nav {
  position: absolute;
  top: calc(var(--img-h) / 2);
  transform: translateY(-50%);
  z-index: 5;
  width: 56px;
  height: 56px;
  border-radius: 2px; /* matches the reference theme's swiper buttons */
  border: none;
  background: var(--core-colour);
  cursor: pointer;
  /* Hide the entity text — the chevron is drawn with CSS borders below so we
     control the stroke weight exactly and can centre it precisely. */
  font-size: 0;
  display: none;
  align-items: center;
  justify-content: center;
}

/* Chevron drawn from two borders of a rotated square. Stroke thickness =
   border-width (thin, like the reference). */
.carousel-nav::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  border: solid var(--secondary-colour);
  border-width: 0;
}

#prev::before {
  border-left-width: 2px;
  border-bottom-width: 2px;
  /* Nudge toward the tip so the chevron sits optically centred in the box. */
  transform: translateX(4px) rotate(45deg);
}

#next::before {
  border-right-width: 2px;
  border-top-width: 2px;
  transform: translateX(-4px) rotate(45deg);
}

/* Sit each arrow centred on the image's side edge (half the 56px button
   straddles the edge). Driven by the same --card-w so it tracks the card at
   every breakpoint. */
#prev {
  left: calc((100% - var(--card-w)) / 2 - 28px);
}

#next {
  right: calc((100% - var(--card-w)) / 2 - 28px);
}

.carousel-nav:hover {
  opacity: 0.85;
}

.carousel.is-scrollable .carousel-nav {
  display: flex;
}

/* ---------- Footer / disclaimer (mirrors .disclaimer) ---------- */
.site-footer {
  position: absolute;
  bottom: 1.2rem;
  left: 0;
  right: 0;
  padding: 0 2rem;
  text-align: center;
}

.site-footer p {
  margin: 0 auto;
  width: 77%;
  font-size: 12px;
  line-height: 18px;
  color: #666;
}

/* =====================================================================
   Responsive — breakpoints + values mirror the reference theme
   ===================================================================== */

/* Desktop: cap image height to a width-based value (homepage.css min-width:1024) */
@media (min-width: 1024px) {
  :root {
    --img-h: min(calc(50vh - 50px), calc(55vw - 2rem - 25px));
  }
}

/* Tablet / small laptop (header.css max-width:1024) */
@media (max-width: 1024px) {
  .site-header {
    align-items: center;
  }

  .site-header img {
    height: 75px;
  }

  .header-text .client-name {
    margin-bottom: 0.25rem;
  }

  .header-text .page-heading {
    font-size: 1.25rem;
    line-height: 1.5;
  }
}

/* Cards collapse to a single-item swipe carousel; image height uncapped
   (homepage.css max-width:991 → max-height: 100vw - 2rem) */
@media (max-width: 991px) {
  :root {
    --img-h: min(calc(50vh - 50px), calc(100vw - 2rem));
    --card-w: min(90%, 680px);
  }
}

/* Large phone (header.css max-width:767) */
@media (max-width: 767px) {
  .header-text .client-name {
    font-size: 1.5rem;
    line-height: 1.75rem;
    margin: 0;
  }

  .header-text .page-heading {
    font-size: 1rem;
    line-height: normal;
    margin: 0;
  }
}

/* Small phone (header.css max-width:575) */
@media (max-width: 575px) {
  .site-header {
    padding: 0.5rem 1.5rem;
  }

  .site-header img {
    height: 50px;
  }

  .header-text .client-name {
    font-size: 0.9rem;
    line-height: normal;
    margin-top: 0.75rem;
    margin-bottom: 0;
  }

  .header-text .page-heading {
    font-size: 0.8rem;
    margin-bottom: 0.625rem;
  }

  :root {
    --card-w: 92%;
  }
}
