/*
Theme Name:   HelloHope
Theme URI:    https://www.hellohope.uk
Description:  Child theme for hellohope.uk. Maintained by the HelloHope team.
              Built on Genesis Block Theme by StudioPress.
Author:       HelloHope
Author URI:   https://www.hellohope.uk
Template:     genesis-block-theme
Version:      1.0.0
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  hellohope
*/

/* ==========================================================================
   CONTENTS
   1. Brand tokens
   2. Base styles          — ACTIVE (was parked; see note)
   3. Layout helpers
   4. Buttons
   5. Touch targets
   6. Reduced motion
   7. Site sections
      7.1 Header
      7.2 Footer   — not yet built
      7.3 Archive  — not yet built
      7.4 Single   — not yet built

   NOTE: section 2 is now active. It was previously parked inside an
   impossible media query so it would not restyle Elementor-built pages
   mid-migration. It was switched on because the header needs a consistent
   type scale to sit on. If the live site (with Elementor Pro active) looks
   wrong, wrap section 2 in @media (min-width: 99999px) again — one line,
   fully reversible.
   ========================================================================== */


/* ==========================================================================
   1. BRAND TOKENS
   Every colour, font and spacing value is defined here and nowhere else.
   Never hard-code a hex value below this block.
   ========================================================================== */

:root {

  /* --- Core palette -----------------------------------------------------
     Extracted from the Elementor template exports. Verify against the
     charity's brand document.                                          */
  --hh-green:          #005346;
  --hh-pink:           #FF6AAB;
  --hh-cream:          #F4E7D5;
  --hh-white:          #FFFFFF;

  /* --- Derived tones — starting estimates, adjust by eye -------------- */
  --hh-green-dark:     #003A31;
  --hh-green-light:    #0A6D5C;
  --hh-pink-dark:      #E04F90;
  --hh-cream-dark:     #E8D7BF;

  /* --- Text -------------------------------------------------------------
     Body text on cream must meet WCAG AA (4.5:1).                      */
  --hh-text:           #1A2B27;
  --hh-text-subtle:    #4A5C57;
  --hh-text-on-dark:   #FFFFFF;
  --hh-text-on-pink:   #FFFFFF;

  /* --- Surfaces ---------------------------------------------------------- */
  --hh-bg:             var(--hh-cream);
  --hh-bg-alt:         var(--hh-white);
  --hh-bg-dark:        var(--hh-green);
  --hh-border:         rgba(0, 83, 70, 0.15);

  /* --- Typography -------------------------------------------------------- */
  --hh-font-heading:   'Quicksand', 'Trebuchet MS', sans-serif;
  --hh-font-body:      'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --hh-weight-normal:  400;
  --hh-weight-medium:  500;
  --hh-weight-bold:    700;

  /* Type scale. Base is 1rem = 16px. */
  --hh-size-xs:        0.8125rem;
  --hh-size-sm:        0.9375rem;
  --hh-size-base:      1rem;
  --hh-size-md:        1.0625rem;
  --hh-size-lg:        clamp(1.125rem, 1.6vw, 1.25rem);
  --hh-size-h3:        clamp(1.25rem, 2.2vw, 1.5rem);
  --hh-size-h2:        clamp(1.5rem, 3.2vw, 2.125rem);
  --hh-size-h1:        clamp(2rem, 4.4vw, 3.125rem);

  --hh-leading-tight:  1.2;
  --hh-leading-body:   1.6;

  /* --- Spacing ----------------------------------------------------------- */
  --hh-space-2xs:      0.25rem;
  --hh-space-xs:       0.5rem;
  --hh-space-sm:       0.75rem;
  --hh-space-md:       1rem;
  --hh-space-lg:       1.5rem;
  --hh-space-xl:       2.5rem;
  --hh-space-2xl:      4rem;
  --hh-space-section:  clamp(2.5rem, 6vw, 4.5rem);

  /* --- Layout ------------------------------------------------------------ */
  --hh-content-width:  1200px;
  --hh-narrow-width:   720px;
  --hh-gutter:         clamp(1rem, 4vw, 2rem);

  /* --- Shape and motion --------------------------------------------------- */
  --hh-radius-sm:      6px;
  --hh-radius-md:      12px;
  --hh-radius-pill:    999px;
  --hh-shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.08);
  --hh-shadow-md:      0 4px 16px rgba(0, 0, 0, 0.10);
  --hh-transition:     150ms ease;

  /* --- Touch targets ------------------------------------------------------ */
  --hh-touch-min:      44px;
}


/* ==========================================================================
   2. BASE STYLES
   ========================================================================== */

html {
  font-size: 100%;  /* 1rem = 16px. Do not change — the scale depends on it. */
}

body {
  background-color: var(--hh-bg);
  color: var(--hh-text);
  font-family: var(--hh-font-body);
  font-size: var(--hh-size-base);
  line-height: var(--hh-leading-body);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--hh-font-heading);
  font-weight: var(--hh-weight-bold);
  line-height: var(--hh-leading-tight);
  color: var(--hh-green);
}

h1 { font-size: var(--hh-size-h1); }
h2 { font-size: var(--hh-size-h2); }
h3 { font-size: var(--hh-size-h3); }

a {
  color: var(--hh-green);
  transition: color var(--hh-transition);
}

a:hover,
a:focus {
  color: var(--hh-pink-dark);
}

/* Visible keyboard focus. Do not remove — accessibility requirement. */
:focus-visible {
  outline: 3px solid var(--hh-pink);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
}


/* ==========================================================================
   3. LAYOUT HELPERS
   ========================================================================== */

.hh-container {
  width: 100%;
  max-width: var(--hh-content-width);
  margin-inline: auto;
  padding-inline: var(--hh-gutter);
}

.hh-container--narrow {
  max-width: var(--hh-narrow-width);
}

.hh-section {
  padding-block: var(--hh-space-section);
}

.hh-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link — keyboard users land here first. */
.hh-skip-link {
  position: absolute;
  top: -100px;
  left: var(--hh-space-md);
  z-index: 1000;
  padding: var(--hh-space-sm) var(--hh-space-md);
  background: var(--hh-green);
  color: var(--hh-text-on-dark);
  border-radius: var(--hh-radius-sm);
  text-decoration: none;
}

.hh-skip-link:focus {
  top: var(--hh-space-md);
}


/* ==========================================================================
   4. BUTTONS
   ========================================================================== */

.hh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--hh-space-sm) var(--hh-space-lg);
  font-family: var(--hh-font-heading);
  font-weight: var(--hh-weight-medium);
  font-size: var(--hh-size-base);
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  border: 2px solid transparent;
  border-radius: var(--hh-radius-pill);
  cursor: pointer;
  transition: background-color var(--hh-transition),
              color var(--hh-transition),
              border-color var(--hh-transition);
}

.hh-btn--primary {
  background-color: var(--hh-pink);
  color: var(--hh-text-on-pink);
}

.hh-btn--primary:hover,
.hh-btn--primary:focus {
  background-color: var(--hh-pink-dark);
  color: var(--hh-text-on-pink);
}

.hh-btn--outline {
  background-color: transparent;
  border-color: currentColor;
  color: var(--hh-green);
}

.hh-btn--outline-light {
  background-color: transparent;
  border-color: var(--hh-text-on-dark);
  color: var(--hh-text-on-dark);
}


/* ==========================================================================
   5. TOUCH TARGETS
   Scoped to coarse pointers, not screen width.
   ========================================================================== */

@media (pointer: coarse) {
  .hh-btn,
  .hh-nav a {
    min-height: var(--hh-touch-min);
  }
}


/* ==========================================================================
   6. REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ==========================================================================
   7. SITE SECTIONS
   ========================================================================== */

/* --------------------------------------------------------------------------
   7.1 HEADER
   -------------------------------------------------------------------------- */

.hh-header {
  background-color: var(--hh-cream);
  position: relative;
  z-index: 100;
}

.hh-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hh-space-md);
  padding-block: var(--hh-space-sm);
}

/* --- Brand ------------------------------------------------------------
   flex-shrink: 0 is what stops the logo column being crushed into a
   narrow strip when the nav needs room.
   ---------------------------------------------------------------------- */

.hh-header__brand {
  flex-shrink: 0;
  max-width: 220px;
}

.hh-header__brand .custom-logo-link {
  display: block;
}

.hh-header__brand img,
.hh-header__brand .custom-logo {
  max-height: 56px;
  width: auto;
}

.hh-header__sitename {
  font-family: var(--hh-font-heading);
  font-weight: var(--hh-weight-bold);
  font-size: var(--hh-size-h3);
  text-decoration: none;
  white-space: nowrap;
}

.hh-header__right {
  display: flex;
  align-items: center;
  gap: var(--hh-space-lg);
}

/* --- Desktop navigation ----------------------------------------------
   The gap is deliberately tight. Seven top-level items plus two buttons
   is a lot for one row; if it still wraps, the menu structure is the
   real problem, not the CSS.
   ---------------------------------------------------------------------- */

.hh-nav__list {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--hh-space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Descendant and child selectors here beat the parent theme's
   .main-navigation rules without needing !important. The explicit rem
   value on top-level links is deliberate — it removes any doubt about
   token resolution in this one place. */
.hh-header .hh-nav__list a {
  font-family: var(--hh-font-heading);
  font-weight: var(--hh-weight-medium);
  font-size: var(--hh-size-base);
  text-decoration: none;
  white-space: nowrap;
  color: var(--hh-green);
}

.hh-header .hh-nav__list > li > a {
  font-size: 1.125rem;
}

.hh-header .hh-nav__list a:hover,
.hh-header .hh-nav__list a:focus {
  color: var(--hh-pink-dark);
}

/* --- Submenus ---------------------------------------------------------
   The background colour is an explicit hex rather than a token: this
   panel sits over page content and must be fully opaque, so it should
   not depend on a variable resolving.

   z-index 300 puts it above the drawer overlay (200) and the header
   itself (100).
   ---------------------------------------------------------------------- */

.hh-nav__list li {
  position: relative;
}

.hh-header .hh-nav__list .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 300;
  /* width: max-content sizes the panel to its longest item. min-width
     stops short menus looking cramped; max-width stops a very long item
     running off a narrow viewport. Without max-content the panel takes
     its min-width and block-level links overflow it. */
  width: max-content;
  min-width: 240px;
  max-width: min(360px, 90vw);
  margin: 0;
  padding: var(--hh-space-xs) 0;
  list-style: none;
  background-color: #FFFFFF;
  border-radius: var(--hh-radius-sm);
  box-shadow: var(--hh-shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--hh-transition), visibility var(--hh-transition);
}

/* Remove any pointer arrow or decorative pseudo-element inherited from
   the parent theme or Elementor's menu styles. */
.hh-header .hh-nav__list .sub-menu::before,
.hh-header .hh-nav__list .sub-menu::after,
.hh-header .hh-nav__list li::before,
.hh-header .hh-nav__list li::after {
  display: none;
  content: none;
}

.hh-header .hh-nav__list li:hover > .sub-menu,
.hh-header .hh-nav__list li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
}

.hh-header .hh-nav__list .sub-menu a {
  display: block;
  padding: var(--hh-space-xs) var(--hh-space-md);
  font-size: var(--hh-size-base);
  line-height: 1.35;
  /* normal, not nowrap: a block-level link cannot widen its parent, so
     nowrap makes long items overflow the panel instead of wrapping. */
  white-space: normal;
  background-color: transparent;
}

.hh-header .hh-nav__list .sub-menu a:hover,
.hh-header .hh-nav__list .sub-menu a:focus {
  background-color: var(--hh-cream);
}

/* A submenu near the right edge would otherwise overflow the viewport. */
.hh-header .hh-nav__list > li:last-child .sub-menu,
.hh-header .hh-nav__list > li:nth-last-child(2) .sub-menu {
  left: auto;
  right: 0;
}

/* --- Header buttons ---------------------------------------------------
   Scoped descendant selectors beat the parent theme's link colour rules,
   which would otherwise render pink text on a pink background.
   ---------------------------------------------------------------------- */

.hh-header__actions {
  display: flex;
  align-items: center;
  gap: var(--hh-space-sm);
  flex-shrink: 0;
}

.hh-header .hh-btn,
.hh-drawer .hh-btn {
  font-size: var(--hh-size-base);
  line-height: 1.2;
  color: var(--hh-text-on-pink);
}

.hh-header .hh-btn:hover,
.hh-header .hh-btn:focus,
.hh-drawer .hh-btn:hover,
.hh-drawer .hh-btn:focus {
  color: var(--hh-text-on-pink);
}

/* --- Drawer toggle ---------------------------------------------------- */

.hh-header .hh-header__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--hh-touch-min);
  height: var(--hh-touch-min);
  padding: 0;
  background: none;
  background-color: transparent;
  border: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.hh-header__toggle-bars {
  display: block;
  width: 26px;
}

/* Explicit colour and size. The parent theme styles bare <button> elements
   with a background colour, which is why background-color: transparent is
   repeated above. */
.hh-header .hh-header__toggle-bars span {
  display: block;
  width: 26px;
  height: 3px;
  margin-block: 5px;
  border-radius: 2px;
  background-color: var(--hh-green);
}

/* --- Drawer ----------------------------------------------------------- */

.hh-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 200ms ease;
}

.hh-drawer.is-open {
  opacity: 1;
}

.hh-drawer__panel {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  width: min(320px, 85vw);
  padding: var(--hh-space-xl) var(--hh-space-lg);
  padding-top: calc(var(--hh-space-xl) + env(safe-area-inset-top, 0px));
  overflow-y: auto;
  background: var(--hh-cream);
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.hh-drawer.is-open .hh-drawer__panel {
  transform: translateX(0);
}

.hh-drawer__close {
  position: absolute;
  top: var(--hh-space-md);
  right: var(--hh-space-md);
  width: var(--hh-touch-min);
  height: var(--hh-touch-min);
  font-size: 1.75rem;
  line-height: 1;
  color: var(--hh-green);
  background: none;
  border: 0;
  cursor: pointer;
}

.hh-drawer__list {
  margin: var(--hh-space-xl) 0 0;
  padding: 0;
  list-style: none;
}

.hh-drawer .hh-drawer__list a {
  display: block;
  padding: var(--hh-space-sm) 0;
  font-family: var(--hh-font-heading);
  font-weight: var(--hh-weight-medium);
  font-size: var(--hh-size-lg);
  text-decoration: none;
  color: var(--hh-green);
  border-bottom: 1px solid var(--hh-border);
}

.hh-drawer__list .sub-menu {
  margin: 0;
  padding-inline-start: var(--hh-space-md);
  list-style: none;
}

.hh-drawer .hh-drawer__list .sub-menu a {
  font-size: var(--hh-size-base);
  font-weight: var(--hh-weight-normal);
}

.hh-drawer__actions {
  margin-block-start: var(--hh-space-xl);
}

.hh-drawer__actions .hh-btn {
  width: 100%;
}

/* Stop the page scrolling behind the open drawer. */
body.hh-drawer-open {
  overflow: hidden;
}

/* --- Breakpoint -------------------------------------------------------
   Below 1200px the desktop nav and the secondary button are replaced by
   the drawer. The primary button stays visible at every size.

   1200px rather than 1024px because seven top-level nav items plus two
   buttons wrap onto two rows on a 1366px laptop. If the menu is ever
   shortened, this can come back down.

   NOTE: if you change this value, change the matching 1199px in
   js/header.js too, or the drawer can stay open past the breakpoint.
   ---------------------------------------------------------------------- */

@media (max-width: 1199px) {

  .hh-header .hh-nav,
  .hh-header .hh-header__cta--secondary {
    display: none;
  }

  .hh-header .hh-header__toggle {
    display: flex;
  }

  .hh-header__right {
    gap: var(--hh-space-sm);
  }

  .hh-header__brand img,
  .hh-header__brand .custom-logo {
    max-height: 44px;
  }
}

@media (min-width: 1200px) {
  .hh-drawer {
    display: none;
  }
}

/* Reduced motion — drop the slide, keep the fade. */
@media (prefers-reduced-motion: reduce) {
  .hh-drawer__panel {
    transition: none;
    transform: none;
  }
}


/* --------------------------------------------------------------------------
   7.2 FOOTER
   -------------------------------------------------------------------------- */

.hh-footer {
  background-color: var(--hh-green);
  color: var(--hh-text-on-dark);
}

.hh-footer__main {
  padding-block: var(--hh-space-xl);
}

.hh-footer__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: var(--hh-space-xl);
  align-items: start;
}

/* --- Headings and links ------------------------------------------------
   Scoped selectors beat the parent theme's .site-footer a colour rule.
   ---------------------------------------------------------------------- */

.hh-footer .hh-footer__heading {
  margin: 0 0 var(--hh-space-md);
  font-family: var(--hh-font-heading);
  font-size: var(--hh-size-base);
  font-weight: var(--hh-weight-bold);
  color: var(--hh-white);
}

.hh-footer a {
  color: var(--hh-white);
  text-decoration: none;
}

.hh-footer a:hover,
.hh-footer a:focus {
  color: var(--hh-pink);
  text-decoration: underline;
}

/* Focus ring must stay visible against dark green. */
.hh-footer a:focus-visible,
.hh-footer button:focus-visible {
  outline: 3px solid var(--hh-pink);
  outline-offset: 3px;
}

/* --- Brand column ----------------------------------------------------- */

.hh-footer__logo img,
.hh-footer__logo .custom-logo {
  max-width: 180px;
  height: auto;
  /* The site logo is the pink version. Against dark green the cream
     variant reads better. A cream logo file already exists in the media
     library; swapping to it properly would be better than this filter. */
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.hh-footer__tagline {
  margin: var(--hh-space-md) 0 var(--hh-space-lg);
  font-size: var(--hh-size-sm);
  max-width: 34ch;
}

.hh-footer__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--hh-space-sm);
  margin-bottom: var(--hh-space-lg);
}

.hh-footer .hh-footer__actions .hh-btn {
  color: var(--hh-text-on-dark);
  white-space: normal;
  text-align: center;
}

.hh-footer .hh-footer__actions .hh-btn:hover,
.hh-footer .hh-footer__actions .hh-btn:focus {
  background-color: var(--hh-pink);
  border-color: var(--hh-pink);
  color: var(--hh-text-on-pink);
  text-decoration: none;
}

/* --- Menus ------------------------------------------------------------- */

.hh-footer__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.hh-footer__list li {
  margin-bottom: var(--hh-space-xs);
  font-size: var(--hh-size-sm);
}

.hh-footer .hh-footer__list a {
  display: inline-block;
  padding-block: 2px;
}

/* --- Social icons ------------------------------------------------------ */

.hh-footer__social {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hh-space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

.hh-footer__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--hh-touch-min);
  height: var(--hh-touch-min);
  /* Negative margin keeps the 44px touch target without visually
     indenting the row. */
  margin-left: calc(var(--hh-touch-min) / -4);
}

.hh-footer__social svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  transition: fill var(--hh-transition);
}

.hh-footer__social a:hover svg,
.hh-footer__social a:focus svg {
  fill: var(--hh-pink);
}

/* --- Bottom bar -------------------------------------------------------- */

.hh-footer__bottom {
  padding-block: var(--hh-space-md);
  border-top: 1px solid rgba(244, 231, 213, 0.18);
}

.hh-footer__copyright {
  margin: 0;
  font-size: var(--hh-size-xs);
  text-align: center;
  /* No opacity — dimming white on dark green pushes it towards failing
     the WCAG AA contrast threshold. */
}

/* --- Responsive --------------------------------------------------------
   Four columns to two at tablet, one at phone. The brand column spans
   full width at the two-column stage so the buttons have room.
   ---------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .hh-footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--hh-space-lg);
  }

  .hh-footer__col--brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .hh-footer__grid {
    grid-template-columns: 1fr;
  }

  .hh-footer__actions .hh-btn {
    width: 100%;
  }
}


/* --------------------------------------------------------------------------
   7.3 ARCHIVE  — not yet built
   7.4 SINGLE   — not yet built
   -------------------------------------------------------------------------- */