/*
Theme Name: Twenty Twenty-Five Child
Template: twentytwentyfive
*/

/* Responsive base typography
   Keep body and block styles using rem units and your theme.json base = 1.00rem
   This scales the whole typographic rhythm by adjusting the root font-size. 
   If you want absolutely no root scaling, drop the :root media queries and keep only the    fallback body/heading rules.
*/

:root {
  /* baseline — corresponds to theme.json base: 1.00rem */
  --site-root-scale: 1; /* 1 => 100% => 1rem = 16px (user agent) */
  font-size: calc(100% * var(--site-root-scale));
}

/* Small screens — slightly larger readable text */
@media (max-width: 599px) {
  :root { --site-root-scale: 1.05; } /* ~5% up for small devices */
}

/* Medium screens — default (no change) */
@media (min-width: 600px) and (max-width: 1199px) {
  :root { --site-root-scale: 1; }
}

/* Large screens — slightly larger for comfortable reading */
@media (min-width: 1200px) {
  :root { --site-root-scale: 1.0625; } /* ~6.25% up */
}

/* Optional: ensure basic body and heading rules fallback in case editor styles aren't compiled */

/* =========================================================
   Base typography fallbacks
   Provide sensible fallbacks if editor theme.json styles
   are not available.
   ========================================================= */
body {
  font-family: var(--wp--preset--font-family--body-font, "Montserrat Z, Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial);
  font-size: var(--wp--preset--font-size--base, 1rem);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--wp--preset--font-family--heading-font, "Montserrat Z, Montserrat", system-ui, -apple-system, "Segoe UI");
  font-weight: 700;
  line-height: 1.15;
}

/* =========================================================
   Inline language switcher tweaks
   Keep language switcher inline inside menus
   ========================================================= */
.wp-block-polylang-language-switcher,
ul .wp-block-polylang-language-switcher,
.lang-item {
  display: inline;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Anchor defaults */
a:link { text-decoration: none; }
a:visited { text-decoration: none; }
a:hover { text-decoration: none; }
a:active { text-decoration: none; }

/* =========================================================
   Navigation — hide submenus by default and provide
   accessible JS-driven toggle support
   Target: Gutenberg navigation block markup used on site
   - Top-level container: .wp-block-navigation__container
   - Submenu container: .wp-block-navigation__submenu-container
   ========================================================= */

/* Hide submenu containers by default (non-destructive) */
.wp-block-navigation__container .wp-block-navigation__submenu-container {
  display: none;
  visibility: hidden;
  height: 0;
  overflow: hidden;
  transition: height 220ms ease-in-out, visibility 120ms ease-in-out, opacity 160ms ease-in-out;
  opacity: 0;
}

/* When opened via JS add .submenu-open to parent LI (see JS toggle).
   This selector makes the submenu visible. */
.wp-block-navigation__container .has-sub-toggle.submenu-open > .wp-block-navigation__submenu-container,
.wp-block-navigation__container .wp-block-navigation-item.submenu-open > .wp-block-navigation__submenu-container {
  display: block;
  visibility: visible;
  height: auto;
  opacity: 1;
}

/* Ensure nested lists are hidden by default as fallback */
.wp-block-navigation__container ul ul {
  display: none;
}

/* Minimal affordance for links and buttons in nav items */
.wp-block-navigation .wp-block-navigation-item > a,
.wp-block-navigation .wp-block-navigation-item > button {
  cursor: pointer;
}

/* Toggle button base styles */
.nav-sub-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 0 0.5rem;
  margin-left: 0.25rem;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* Chevron indicator (CSS-only) */
.nav-sub-toggle::after {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: 0.25rem;
  transition: transform 180ms ease;
}

/* Rotate on open */
.nav-sub-toggle[aria-expanded="true"]::after {
  transform: rotate(-135deg);
}

/* When submenu open, ensure it's visible (redundant with earlier rule) */
.has-sub-toggle.submenu-open > .wp-block-navigation__submenu-container {
  display: block;
  visibility: visible;
  height: auto;
  opacity: 1;
}

/* Focus style for keyboard users */
.nav-sub-toggle:focus {
  outline: 2px solid rgba(0,0,0,0.9);
  outline-offset: 2px;
  border-radius: 3px;
}

/* =========================================================
   Legacy selector compatibility
   Support older markup that may use .sub-menu or .submenu
   ========================================================= */
.wp-block-navigation .wp-block-navigation-item .sub-menu,
.wp-block-navigation .wp-block-navigation-item .submenu {
  display: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 220ms ease-in-out;
}

.wp-block-navigation .wp-block-navigation-item.is-open > .sub-menu,
.wp-block-navigation .wp-block-navigation-item.is-open > .submenu {
  display: block;
  max-height: 800px;
}

/* =========================================================
   Small layout helpers
   Keep nav container responsive and aligned with theme
   ========================================================= */
.wp-block-navigation__container.is-responsive {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

/* Submenu styling for readability */
.wp-block-navigation__container .wp-block-navigation__submenu-container {
  background: var(--wp--preset--color--base-background, #fff);
  color: var(--wp--preset--color--base, #000);
  padding: 0.5rem 0;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}


/* =========================================================
   Utility and accessibility helpers
   ========================================================= */

/* Visually hide but keep accessible to screen readers */
.screen-reader-text {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* Ensure child stylesheet overrides parent: include this rule
   only if you cannot control stylesheet order. Otherwise enqueue
   this file after parent styles and remove !important usage. */
body .wp-block-navigation__container .wp-block-navigation__submenu-container {
  /* no !important here; keep as final fallback */
}

/* =========================================================
   End of file
   Place this file in the child theme root (style.css) and
   ensure it is enqueued/loaded after parent styles.
   ========================================================= */