/**
 * Hand-written fixes layered on top of the captured WordPress cascade.
 *
 * wp-head / page-* / wp-tail are lifted verbatim from the old site and should stay untouched.
 * Everything that deliberately departs from how WordPress rendered the pages lives here, loaded
 * last so it wins on source order rather than on specificity tricks.
 */

/* ------------------------------------------------------------------ header bar
 *
 * The theme let the site title and the menu shrink into each other: on every inner page, at every
 * desktop width, "Rubaru Psychotherapy" broke onto two lines and the menu wrapped into two to four
 * rows with no space between them. The title now never wraps, the menu sits on one line where
 * there is room for it, and below that width the hamburger takes over (WordPress only did that
 * under 600px, which is far narrower than the menu actually needs).
 */
/* On the narrowest phones the title is wider than the bar once the menu button is beside it, so
   there it keeps its two-line break. */
@media (min-width: 480px) {
  .wp-block-site-title {
    white-space: nowrap;
  }
}

.wp-block-navigation[data-nav] {
  column-gap: clamp(20px, 2.4vw, 40px);
  row-gap: 10px;
}

@media (min-width: 1100px) {
  .wp-block-navigation[data-nav] .wp-block-navigation__container {
    flex-wrap: nowrap;
  }

  .wp-block-navigation[data-nav] .wp-block-navigation-item__content {
    white-space: nowrap;
  }
}

/* Tighten the tracking slightly in the band where the one-line menu only just fits. */
@media (min-width: 1100px) and (max-width: 1279.98px) {
  .wp-block-navigation[data-nav] .wp-block-navigation-item__content {
    letter-spacing: 2px;
  }
}

/* Keep the hamburger up to 1100px. These undo the theme's `min-width: 600px` rules, so the
   breakpoint here must stay in step with the one in public/js/nav.js. */
@media (min-width: 600px) and (max-width: 1099.98px) {
  .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;
  }
}

/* Which page you are on, and hover feedback — the theme showed neither. */
.wp-block-navigation[data-nav] .wp-block-navigation-item__content:hover,
.wp-block-navigation[data-nav] .wp-block-navigation-item__content[aria-current='page'] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
}

/* ------------------------------------------------------------------ menu overlay
 *
 * The open menu was the block library's default: pure white with black text, on a site that has no
 * white anywhere else, with 24px buttons and 17px-tall links as the only touch targets.
 */
.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) {
  background-color: var(--wp--preset--color--theme-2);
}

.wp-block-navigation:not(.has-text-color) .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) {
  color: var(--wp--preset--color--theme-5);
}

/* 24px icon + 10px padding each side = a 44px target; the negative margin keeps the icon where
   it was. */
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
  padding: 10px;
  margin: -10px;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
  row-gap: 4px;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content {
  padding: 13px 0;
  font-size: 15px;
  white-space: normal;
}

/* ------------------------------------------------------------------ keyboard focus
 *
 * A ring that reads on all three section backgrounds: dark line, light halo.
 */
:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--wp--preset--color--theme-5);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--wp--preset--color--theme-1);
}

/* ------------------------------------------------------------------ body copy
 *
 * Justified paragraphs (FAQ, Professional Contributions). Without hyphenation the browser can only
 * stretch word spaces, which opens rivers in the two-column desktop layout and falls apart
 * completely on a phone, where a line may hold three words.
 */
.has-text-align-justify {
  -webkit-hyphens: auto;
  hyphens: auto;
  hyphenate-limit-chars: 7 3 3;
}

@media (max-width: 781px) {
  .has-text-align-justify {
    text-align: left;
    -webkit-hyphens: manual;
    hyphens: manual;
  }
}

/* Links to the publications themselves, under each summary. */
.publication-link {
  margin-top: 1em;
  font-family: var(--wp--preset--font-family--inter);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.publication-link a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

/* ------------------------------------------------------------------ homepage, small screens */
@media (max-width: 781px) {
  /* A right-aligned heading over left-aligned paragraphs only made sense beside the three desktop
     columns. */
  .home h2.wp-block-heading.has-text-align-right {
    text-align: left;
  }

  /* The video carried the desktop side margins onto phones, leaving it about 250px wide. It now
     lines up with the text column above it. The margins are inline styles on the figure, hence
     !important. */
  .home .wp-block-embed.is-type-video {
    margin-left: var(--wp--preset--spacing--20) !important;
    margin-right: var(--wp--preset--spacing--20) !important;
  }
}

/* ------------------------------------------------------------------ contact form
 *
 * The theme gives every field a light background and `color: currentColor`. On /contact/ the form
 * sits in the dark section, whose text colour is the light one — so what you typed was near-white
 * on near-white. (Jetpack's script used to compute a readable colour at runtime; that script is
 * gone.) The fields are always light, so their text is always the dark colour. The long selector
 * is needed to outrank the theme's `input:not(…):not(…):not(…):not(…)`.
 */
.contact-form .wp-block-jetpack-contact-form .grunion-field-wrap .grunion-field.wp-block-jetpack-input {
  color: var(--wp--preset--color--theme-5);
  caret-color: var(--wp--preset--color--theme-5);
}

.contact-form button[type='submit'][disabled] {
  cursor: progress;
  opacity: 0.7;
}
