/*
Theme Name:   Fylde Council Child
Description:  Child theme — search-first homepage redesign.
Template:     pe-public-institutions
Version:      2.0.0
*/

:root {
  --green:      #1a6e3c;
  --green-dark: #124d2a;
  --green-hover:#155c30;
}

/* ================================================================
   FRONT PAGE — PARENT THEME RESETS
   The nav/header template parts are suppressed in header.php via
   the FYLDE_FRONT_PAGE constant, so these CSS rules are a safety net.
================================================================ */
.home #pe-header,
.home .pe-header,
.home #pe-top1,
.home #pe-top2,
.home #pe-top3,
.home #pe-breadcrumbs { display: none !important; }

/* Remove padding the parent adds for the sticky nav */
.home #pe-main,
.sticky-bar.home #pe-main,
.sticky-bar.top-bar.home #pe-main { padding-top: 0 !important; }

/* Keep WCAG bar out of the normal flow on the front page */
.home #pe-bar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1000 !important;
}

/* Hero must always show its dark background and fill the viewport */
.fylde-hero {
  background: #05120a !important;
  min-height: 100vh !important;
}


/* ================================================================
   HERO — full-viewport with parallax background
================================================================ */
.fylde-hero {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #05120a; /* shows if all images fail */
}

/* Parallax image layer — JS translates on scroll */
.fylde-hero__bg {
  position: absolute;
  inset: -15% 0;
  background-size: cover;
  background-position: center 40%;
  background-repeat: no-repeat;
  will-change: transform;
  transition: transform 0.05s linear;
}

/* Slide divs inside the parallax layer — JS crossfades them */
.fylde-hero__slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 40%;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.fylde-hero__slide.is-active { opacity: 1; }

/* Multi-stop gradient — lighter in the centre to let image breathe */
.fylde-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(5,18,10,0.65) 0%,
    rgba(5,18,10,0.10) 28%,
    rgba(5,18,10,0.32) 48%,
    rgba(5,18,10,0.32) 62%,
    rgba(5,18,10,0.82) 100%
  );
  z-index: 1;
}

/* Gaussian blur behind the search bar only */
.fylde-hero__blur {
  position: absolute;
  inset: 30% 0 20%;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  mask-image: linear-gradient(to bottom, transparent 0%, black 20%, black 80%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 20%, black 80%, transparent 100%);
  z-index: 1;
  pointer-events: none;
}


/* ================================================================
   CUSTOM NAV BAR
   Absolutely positioned inside the hero so it overlays the image
   regardless of parent theme transform contexts.
   JS adds .hero-gone to the nav when the hero scrolls out of view,
   switching it to position:fixed so it stays pinned at the top.
================================================================ */
.fylde-nav {
  position: absolute;
  top: 0; /* WCAG bar not rendered on front page, so nav sits at the very top */
  left: 0;
  right: 0;
  z-index: 900;
  height: 62px;
  padding: 0 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: transparent;
  transition: background 0.4s, backdrop-filter 0.4s, box-shadow 0.4s;
  opacity: 0;
  animation: fyldeNavFadeDown 0.6s ease 0.1s forwards;
}

/* Darken when user scrolls 60px into the hero */
.fylde-nav.scrolled {
  background: rgba(8,22,13,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.4);
}

/* Once hero has scrolled out of view, pin the nav to the top */
.fylde-nav.hero-gone {
  position: fixed;
  top: 0;
  background: rgba(8,22,13,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.4);
}

/* WordPress custom logo output */
.fylde-nav .custom-logo-link { display: flex; align-items: center; }
.fylde-nav .custom-logo      { height: 42px; width: auto; filter: brightness(0) invert(1); }

/* Fallback text logo */
.fylde-nav__logo-text {
  font-family: 'Figtree', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
}

/* wp_nav_menu output wrapper */
.fylde-nav__menu-wrap { display: flex; }

/* The <ul> from wp_nav_menu */
.fylde-nav__menu,
.fylde-nav__menu-wrap ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}

.fylde-nav__menu li a,
.fylde-nav__menu-wrap ul li a {
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  font-weight: 400;
  padding: 7px 16px;
  border-radius: 3px;
  transition: color 0.2s, background 0.2s;
  display: block;
}

.fylde-nav__menu li a:hover,
.fylde-nav__menu-wrap ul li a:hover { color: #fff; }

.fylde-nav__menu li a:focus,
.fylde-nav__menu-wrap ul li a:focus {
  outline: 3px solid #ffdd00;
  outline-offset: 2px;
}


/* ================================================================
   HERO CENTRE — heading + search
================================================================ */
.fylde-hero__centre {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Top padding = nav height (62px) + breathing room */
  padding: 80px 24px 0;
}

.fylde-hero__title {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(38px, 6vw, 76px);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  text-align: center;
  line-height: 1.0;
  margin: 0 0 30px;
  text-shadow: 0 3px 40px rgba(0,0,0,0.45);
  opacity: 0;
  animation: fyldeUp 0.7s cubic-bezier(0.16,1,0.3,1) 0.3s forwards;
}

/* ----------------------------------------------------------------
   SEARCH FORM
---------------------------------------------------------------- */
.fylde-search-wrap {
  width: 100%;
  max-width: 600px;
  opacity: 0;
  animation: fyldeUp 0.7s cubic-bezier(0.16,1,0.3,1) 0.5s forwards;
}

.fylde-search-form {
  display: flex;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.25);
  transition: box-shadow 0.3s;
}

.fylde-search-form:focus-within {
  box-shadow: 0 16px 56px rgba(0,0,0,0.45), 0 0 0 3px #ffdd00;
}

.fylde-search-form__input {
  flex: 1;
  border: none;
  outline: none;
  padding: 18px 22px;
  font-family: 'Figtree', sans-serif;
  font-size: 16px;
  color: #1a1a1a;
  background: #fff;
  min-width: 0;
}

.fylde-search-form__input::placeholder { color: #aaa; }

.fylde-search-form__btn {
  background: var(--green);
  border: none;
  color: #fff;
  padding: 18px 30px;
  font-family: 'Figtree', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  transition: background 0.18s, transform 0.1s;
  flex-shrink: 0;
}

.fylde-search-form__btn:hover  { background: var(--green-hover); }
.fylde-search-form__btn:active { transform: scale(0.98); }
.fylde-search-form__btn:focus  { outline: 3px solid #ffdd00; outline-offset: 0; }
.fylde-search-form__btn svg    { width: 17px; height: 17px; flex-shrink: 0; }


/* ----------------------------------------------------------------
   BROWSE ALL SERVICES — bottom of hero
---------------------------------------------------------------- */
.fylde-hero__browse {
  position: absolute;
  bottom: 48px;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: fyldeUp 0.7s ease 0.9s forwards;
}

.fylde-browse-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.6);
  font-family: 'Figtree', sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
  padding: 8px 16px;
}

.fylde-browse-btn:hover  { color: rgba(255,255,255,0.95); }
.fylde-browse-btn:focus  { outline: 3px solid #ffdd00; }

.fylde-browse__chevron { animation: fyldeBobDown 2.2s ease-in-out infinite; }


/* ================================================================
   PAGE TRANSITION OVERLAY
================================================================ */
.fylde-page-transition {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--green);
  transform: translateY(100%);
  transition: transform 0.55s cubic-bezier(0.76,0,0.24,1);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.fylde-page-transition.sweeping { transform: translateY(0); pointer-events: all; }

.fylde-transition-inner {
  opacity: 0;
  transform: scale(0.88);
  transition: opacity 0.3s ease 0.25s, transform 0.3s ease 0.25s;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fylde-page-transition.sweeping .fylde-transition-inner { opacity: 1; transform: scale(1); }
.fylde-transition-inner img   { height: 52px; filter: brightness(0) invert(1); }
.fylde-transition-logo-text   { font-family: 'Figtree',sans-serif; font-size: 22px; font-weight:600; color:#fff; }

.fylde-transition-dots { display: flex; gap: 7px; margin-top: 20px; }

.fylde-transition-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,0.5);
  animation: fyldeDotPulse 1.2s ease-in-out infinite;
}

.fylde-transition-dots span:nth-child(2) { animation-delay: 0.18s; }
.fylde-transition-dots span:nth-child(3) { animation-delay: 0.36s; }


/* ================================================================
   SERVICE TILES — below hero
================================================================ */
.fylde-top-items {
  background: #fff;
  border-top: 4px solid var(--green);
  padding: 0;
}

.fylde-top-items .pe-container { padding-top: 0; padding-bottom: 0; }

.fylde-top-items__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.fylde-service-tile {
  display: block;
  text-align: center;
  padding: 40px 24px;
  border-right: 1px solid #e0e0e0;
  color: #0b0c0c;
  text-decoration: none;
  transition: background 0.15s;
}

.fylde-service-tile:last-child { border-right: none; }

.fylde-service-tile:hover,
.fylde-service-tile:focus {
  background: #f5faf7;
  text-decoration: none;
  color: #0b0c0c;
  outline: 3px solid #ffdd00;
  outline-offset: -3px;
}

.fylde-service-tile__icon {
  display: block;
  font-size: 44px;
  color: var(--green);
  margin-bottom: 16px;
  line-height: 1;
}

.fylde-service-tile__title {
  font-family: 'Figtree', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #0b0c0c;
  margin: 0 0 10px;
  line-height: 1.3;
}

.fylde-service-tile__desc {
  font-family: 'Figtree', sans-serif;
  font-size: 13px;
  color: #505a5f;
  line-height: 1.45;
  margin: 0;
}


/* ================================================================
   FOOTER
================================================================ */
.fylde-footer {
  background: #2d2d2d;
  color: #c8c8c8;
  padding: 48px 0 32px;
}

.fylde-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}

.fylde-footer__social { display: flex; gap: 16px; }

.fylde-footer__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  color: #fff;
  font-size: 17px;
  text-decoration: none;
  transition: background 0.15s;
}

.fylde-footer__social-link:hover,
.fylde-footer__social-link:focus {
  background: var(--green);
  color: #fff;
  text-decoration: none;
  outline: 3px solid #ffdd00;
  outline-offset: 2px;
}

.fylde-footer__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0; }

.fylde-footer__nav a {
  color: #c8c8c8;
  text-decoration: none;
  font-size: 14px;
  padding: 4px 14px;
  border-right: 1px solid #555;
  line-height: 1.4;
  font-family: 'Figtree', sans-serif;
}

.fylde-footer__nav a:last-child { border-right: none; }
.fylde-footer__nav a:hover { color: #fff; text-decoration: underline; }

.fylde-footer__copy {
  font-size: 13px;
  color: #909090;
  margin: 0;
  line-height: 1.6;
  font-family: 'Figtree', sans-serif;
}

.fylde-footer__copy a { color: #c8c8c8; text-decoration: none; }
.fylde-footer__copy a:hover { color: #fff; text-decoration: underline; }


/* ================================================================
   KEYFRAMES
================================================================ */
@keyframes fyldeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fyldeNavFadeDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fyldeBobDown {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(6px); }
}

@keyframes fyldeDotPulse {
  0%, 80%, 100% { opacity: 0.35; transform: scale(0.85); }
  40%           { opacity: 1;    transform: scale(1); }
}


/* ================================================================
   VIEW TOGGLE PILL
================================================================ */
.fylde-view-toggle {
  display: flex;
  align-items: center;
  margin-top: 16px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 3px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  animation: fyldeUp 0.7s cubic-bezier(0.16,1,0.3,1) 0.65s forwards;
}

.fylde-view-toggle__btn {
  font-family: 'Figtree', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 7px 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  display: inline-block;
}

.fylde-view-toggle__btn--active {
  background: #fff;
  color: var(--green);
  box-shadow: 0 1px 6px rgba(0,0,0,0.2);
}

.fylde-view-toggle__btn--inactive {
  background: transparent;
  color: rgba(255,255,255,0.6);
}

.fylde-view-toggle__btn--inactive:hover { color: #fff; }
.fylde-view-toggle__btn:focus { outline: 3px solid #ffdd00; }


/* ================================================================
   SCREEN-READER UTILITY
================================================================ */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}


/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 1100px) {
  .fylde-nav { padding: 0 32px; }
}

@media (max-width: 900px) {
  .fylde-nav { padding: 0 28px; }
}

@media (max-width: 680px) {
  .fylde-nav { padding: 0 18px; height: 56px; }
  .fylde-nav .custom-logo { height: 34px; }

  .fylde-nav__menu,
  .fylde-nav__menu-wrap ul { display: none; } /* mobile nav handled by parent theme */

  .fylde-hero__centre { padding-top: 100px; }

  .fylde-hero__title {
    font-size: clamp(28px, 9vw, 48px);
    margin-bottom: 20px;
  }

  .fylde-search-wrap  { max-width: 100%; padding: 0 4px; }
  .fylde-search-form  { flex-direction: column; border-radius: 6px; }

  .fylde-search-form__input {
    padding: 15px 16px;
    font-size: 15px;
    border-radius: 6px 6px 0 0;
  }

  .fylde-search-form__btn {
    padding: 15px 18px;
    justify-content: center;
    border-radius: 0 0 6px 6px;
  }

  .fylde-hero__browse { bottom: 36px; }

  .fylde-top-items__grid { grid-template-columns: repeat(2, 1fr); }
  .fylde-service-tile { border-right: none; border-bottom: 1px solid #e0e0e0; }
  .fylde-service-tile:nth-child(odd) { border-right: 1px solid #e0e0e0; }
  .fylde-service-tile:last-child,
  .fylde-service-tile:nth-last-child(2):nth-child(odd) { border-bottom: none; }

  .fylde-footer__nav a { padding: 4px 10px; font-size: 13px; }
}

@media (max-width: 420px) {
  .fylde-top-items__grid { grid-template-columns: 1fr; }
  .fylde-service-tile,
  .fylde-service-tile:nth-child(odd) { border-right: none; }
  .fylde-service-tile:last-child { border-bottom: none; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .fylde-nav { height: 50px; }
  .fylde-nav .custom-logo { height: 28px; }
  .fylde-hero__title { font-size: clamp(22px, 5vw, 38px); margin-bottom: 14px; }
  .fylde-search-form__input,
  .fylde-search-form__btn { padding: 12px 16px; }
  .fylde-hero__browse { display: none; }
}
