/*
Theme Name: ESDA
Author: Studio Foster
Text Domain: esda 
*/

.no-underline {
  text-decoration: none !important;
}

/*
 * Outline button defaults. Global element.button styles beat core's :where()
 * outline rules, so the transparent fill has to be restated here. Hover stays
 * in this file for the same reason.
 */
.wp-block-button.is-style-outline .wp-block-button__link {
  background-color: transparent;
  background-image: none;
  color: var(--wp--preset--color--on-background);
  border: 2px solid currentColor;
  /* Match filled button outer size (theme.json padding minus this 2px border). */
  padding-top: calc(0.75rem - 2px);
  padding-right: calc(1.5rem - 2px);
  padding-bottom: calc(0.75rem - 2px);
  padding-left: calc(1.5rem - 2px);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover,
.wp-block-button.is-style-outline-variant-small .wp-block-button__link:hover {
  background-color: var(--wp--preset--color--secondary) !important;
  color: #fff;
  border-color: var(--wp--preset--color--secondary);
}

/*
 * Add vertical section padding only for Group blocks that are direct children of
 * Post Content. This selector needs to exist outside theme.json block scoping.
 */
.wp-block-post-content > .wp-block-group {
  padding-top: var(--wp--preset--spacing--section-padding);
  padding-bottom: var(--wp--preset--spacing--section-padding);
}

/*
 * Shared notice box (empty events, membership payment details).
 */
.esda-notice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--wp--preset--spacing--stack-sm);
  padding: var(--wp--preset--spacing--stack-lg);
  background: var(--wp--preset--color--secondary-container);
  border-radius: var(--wp--custom--rounded--default);
}

.esda-notice p {
  margin: 0;
}

.esda-notice .wp-block-buttons {
  margin-top: var(--wp--preset--spacing--stack-sm);
}

#past-events {
  scroll-margin-top: var(--wp--preset--spacing--stack-lg);
}

.gform_wrapper .gfield--type-html .esda-notice {
  width: 100%;
}

/*
 * Nav link hover: theme.json global styles are emitted as :root :where(...) (zero
 * specificity). Core navigation sets .wp-block-navigation-item__content twice for
 * specificity plus color:inherit — see wp-includes/blocks/navigation/style.css — which
 * overrides those hover rules unless we match that specificity here.
 */
.wp-block-navigation
  .wp-block-navigation-item__content.wp-block-navigation-item__content:hover {
  color: var(--wp--preset--color--secondary);
}

/* Highlight active nav item. */
#masthead .wp-block-navigation .wp-block-navigation-item.current-menu-item > a,
#masthead
  .wp-block-navigation
  .wp-block-navigation-item.current-menu-ancestor
  > a,
#masthead .wp-block-navigation .wp-block-navigation-item.current_page_item > a,
#masthead
  .wp-block-navigation
  .wp-block-navigation-item.current_page_ancestor
  > a {
  color: var(--wp--preset--color--secondary) !important;
  text-decoration: none;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

.wp-block-post-content > .wp-block-group[id] {
  scroll-margin-top: var(--wp--preset--spacing--stack-lg);
}

/* Header dropdown: match surface / outline tokens. */
#masthead .wp-block-navigation .wp-block-navigation__submenu-container {
  background-color: var(--wp--preset--color--surface);
  border: 1px solid var(--wp--preset--color--outline-variant);
  border-radius: var(--wp--custom--rounded--default);
  padding: var(--wp--preset--spacing--stack-sm);
  /* Wider than stack tokens so long labels like “What is Spiritual Direction?” wrap cleanly. */
  min-width: 14rem;
  z-index: 20;
}

#masthead
  .wp-block-navigation
  .wp-block-navigation__submenu-container
  .wp-block-navigation-item__content {
  padding: var(--wp--preset--spacing--stack-sm)
    var(--wp--preset--spacing--stack-md);
}

/* Overlay (hamburger) nav: About is a plain link, no section dropdown. */
#masthead
  .wp-block-navigation__responsive-container.is-menu-open
  .wp-block-navigation__submenu-icon,
#masthead
  .wp-block-navigation__responsive-container.is-menu-open
  .wp-block-navigation-submenu__toggle,
#masthead
  .wp-block-navigation__responsive-container.is-menu-open
  .wp-block-navigation__submenu-container {
  display: none;
}

/*Masthead styles*/
#masthead .logo a,
#masthead .wp-block-site-logo a {
  display: block;
}

/* Set the new custom breakpoint (e.g., 1024px) */
@media (min-width: 950px) {
  .wp-block-navigation__responsive-container-open:not(.always-shown) {
    display: none !important;
  }
  .wp-block-navigation__responsive-container:not(.hidden-by-default):not(
      .is-menu-open
    ) {
    display: block !important;
  }
}

/* Override the default 600px core behaviour */
@media (min-width: 600px) {
  .wp-block-navigation__responsive-container-open:not(.always-shown) {
    display: flex;
  }
  .wp-block-navigation__responsive-container:not(.hidden-by-default):not(
      .is-menu-open
    ) {
    display: none;
  }
}

/*
 * Gravity Forms submit button.
 *
 * Ensure the GF <input type="submit"> matches `styles.elements.button` from theme.json.
 * (Gravity Forms theme CSS may not treat inputs the same as <button>/<a>.)
 */
.gform_wrapper
  :is(input[type="submit"].wp-element-button, button.wp-element-button) {
  padding: 0.75rem 1.5rem;
  font-size: var(--wp--preset--font-size--body-md);
  font-family: var(--wp--preset--font-family--geist);
  font-weight: 600;
  letter-spacing: var(--wp--custom--typography--label-md--letter-spacing);
  line-height: var(--wp--custom--typography--label-md--line-height);
}

/* Gravity Forms sub-labels: increase contrast. */
.gform_wrapper .gform-field-label.gform-field-label--type-sub {
  color: var(--wp--preset--color--on-background);
  font-size: var(--wp--preset--font-size--label-md);
  line-height: var(--wp--custom--typography--label-md--line-height);
}

/* Gravity Forms descriptions + validation: smaller type. */
.gform_wrapper
  :is(
    .gfield_description,
    .gform-field-description,
    .validation_message,
    .gfield_validation_message,
    .gform_submission_error
  ) {
  font-size: var(--wp--preset--font-size--label-md);
  line-height: var(--wp--custom--typography--body-md--line-height);
}

/* Gravity Forms heading area (title/description wrapper): hide. */
.gform_wrapper .gform_heading {
  display: none;
}

/* Gravity Forms checkbox/radio accents. */
.gform_wrapper :is(input[type="checkbox"], input[type="radio"]) {
  accent-color: var(--wp--preset--color--primary);
}

/* Gravity Forms theme framework: primary accents for choice controls. */
.gform_wrapper.gform-theme--framework,
.gform_wrapper.gform-theme--foundation {
  --gf-color-primary: var(--wp--preset--color--primary);
  --gf-ctrl-choice-check-color: var(--wp--preset--color--primary);
}

/* Gravity Forms Orbital choice inputs: enforce accent color. */
.gform_wrapper.gform-theme--framework input.gfield-choice-input,
.gform_wrapper.gform-theme--foundation input.gfield-choice-input {
  accent-color: var(--wp--preset--color--primary) !important;
}

/* Gravity Forms choices: align checkbox/radio with label text. */
.gform_wrapper.gform-theme--framework
  :is(.gfield_radio, .gfield_checkbox)
  .gchoice,
.gform_wrapper.gform-theme--foundation
  :is(.gfield_radio, .gfield_checkbox)
  .gchoice {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.gform_wrapper.gform-theme--framework
  :is(.gfield_radio, .gfield_checkbox)
  .gfield-choice-input,
.gform_wrapper.gform-theme--foundation
  :is(.gfield_radio, .gfield_checkbox)
  .gfield-choice-input {
  margin: 0;
  margin-top: 0.3em;
  flex: 0 0 auto;
}

/*
 * Visible keyboard focus. theme.json has no :focus outline; core :where() rules
 * lose to more specific theme/nav selectors.
 */
:where(a, button, input, textarea, select):focus-visible {
  outline: 2px solid var(--wp--preset--color--primary);
  outline-offset: 3px;
}
