/**
 * GF Base Theme - shared structure.
 *
 * Loaded on the frontend (wp_enqueue_scripts) and inside the editor canvas
 * (add_editor_style), because parts/header.html and parts/footer.html use these
 * classes and the Site Editor has to match the frontend.
 *
 * Rules here may only depend on theme.json presets (--wp--preset--*) and core
 * block classes. Never reference or redeclare --gf-* variables: those belong to
 * the GF Builder plugin's Design Settings, and duplicating them here would both
 * clobber the user's saved values and break this file when the plugin is off.
 */

body {
  margin: 0;
}

.wp-site-blocks {
  min-height: 100vh;
}

/* Site chrome
   ---------------------------------------------------------------- */

.gf-site-footer {
  border-top: 1px solid color-mix(in srgb, currentColor 15%, transparent);
  padding-block: var(--wp--preset--spacing--md, 2rem);
}

/* Footer
   ---------------------------------------------------------------- */

.gf-base-theme-footer__grid {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--wp--preset--spacing--sm, 1.25rem);
}

.gf-base-theme-footer__brand {
  display: grid;
  gap: var(--wp--preset--spacing--xs, 0.75rem);
  max-width: 26rem;
}

.gf-base-theme-footer__brand .wp-block-site-title {
  margin: 0;
  font-family: var(--wp--preset--font-family--sans, ui-sans-serif, system-ui, sans-serif);
  font-weight: 750;
  line-height: 1.15;
}

.gf-base-theme-footer__brand .wp-block-site-title a {
  color: inherit;
  text-decoration: none;
}

/* Header
   ---------------------------------------------------------------- */

.gf-base-theme-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.gf-base-theme-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.gf-base-theme-header__brand .wp-block-site-title {
  margin: 0;
  font-family: var(--wp--preset--font-family--sans, ui-sans-serif, system-ui, sans-serif);
  font-size: clamp(1rem, 1rem + 0.25vw, 1.25rem);
  font-weight: 750;
  line-height: 1.15;
}

.gf-base-theme-header__brand .wp-block-site-title a {
  color: inherit;
  text-decoration: none;
}

.gf-base-theme-header__brand .wp-block-site-logo {
  flex: 0 0 auto;
}

.gf-base-theme-header__inner > .gf-navigation {
  flex: 1 1 22rem;
}

/* Header zones
   ---------------------------------------------------------------- */

/*
 * NOT A GRID, despite what this used to say.
 *
 * Every piece of markup that carries .gf-header-zones puts it on a core/group
 * with `layout: {type:'flex'}`, and core emits
 * `.wp-block-group-is-layout-flex{display:flex}` UNLAYERED. This rule is
 * unlayered too, so source order decides and core wins -- measured on the front
 * page, `display` computes `flex`, which makes any grid-template-columns here
 * inert by definition.
 *
 * The rules that actually place the zones now live in the plugin
 * (src/styles/groups/navigation.css) and work WITH that flex box rather than
 * against it: `> :first-child { flex: none }`, `> :last-child { margin-inline-start:
 * auto }` and so on. Both spellings are covered there -- .gf-header-layout-* on
 * the wrapper and .gf-header-zones-* on the group.
 *
 * `gap` is left off for the same reason: core's blockGap owns it, measured 16px
 * against the 1.25rem this once asked for.
 */
.gf-header-zones {
  align-items: center;
  width: 100%;
}

.gf-header-zone {
  display: flex;
  align-items: center;
  gap: var(--wp--preset--spacing--xs, 0.75rem);
  min-width: 0;
}

.gf-header-zone-left {
  justify-content: flex-start;
}

.gf-header-zone-center {
  justify-content: center;
  text-align: center;
}

.gf-header-zone-right {
  justify-content: flex-end;
}

.gf-header-zones-center-brand .gf-header-zone-left .gf-navigation-list,
.gf-header-zones-split-actions .gf-header-zone-left .gf-navigation-list {
  justify-content: flex-start;
}

.gf-header-zones-center-brand .gf-header-zone-right .gf-navigation-list,
.gf-header-zones-split-actions .gf-header-zone-right .gf-navigation-list,
.gf-header-zones-brand-left .gf-header-zone-right .gf-navigation-list {
  justify-content: flex-end;
}

/* Content
   ---------------------------------------------------------------- */

.gf-base-theme-post-meta {
  opacity: 0.75;
}

.gf-base-theme-archive-header {
  margin-block-end: var(--wp--preset--spacing--sm, 1.25rem);
}

/* Responsive
   ---------------------------------------------------------------- */

@media (max-width: 700px) {
  .gf-base-theme-header__inner {
    align-items: stretch;
  }

  .gf-base-theme-header__brand,
  .gf-base-theme-header__inner > .gf-navigation {
    width: 100%;
  }

  .gf-header-zones,
  .gf-header-zones-brand-left,
  .gf-header-zones-center-brand,
  .gf-header-zones-split-actions {
    grid-template-columns: 1fr;
  }

  .gf-header-zone,
  .gf-header-zone-left,
  .gf-header-zone-center,
  .gf-header-zone-right {
    justify-content: center;
    width: 100%;
  }

  .gf-base-theme-footer__grid,
  .gf-base-theme-footer__brand,
  .gf-base-theme-footer__grid .gf-navigation {
    width: 100%;
  }

  .gf-base-theme-footer__grid .gf-navigation-list {
    justify-content: flex-start;
  }
}

/*
 * HEADINGS THAT ARE NOT GF BLOCKS.
 *
 * THE DEFECT, MEASURED. GF Builder's base.css ships Tailwind's preflight, which
 * includes `h1,h2,h3,h4,h5,h6 { font-size: inherit; font-weight: inherit }`.
 * That is correct for GF's own blocks -- `.gf-heading` re-dresses them from the
 * `gf-type-*` scale -- and it flattens every OTHER heading on the site to body
 * size. Measured before this rule on a published post: the theme's own
 * `core/post-title` rendered at 16px, a core Heading block at 16px, and a bare
 * `h1` injected into the live page at 16px. The reset is in `@layer base`, and
 * nothing unlayered was putting the size back.
 *
 * That is a plugin reaching outside its own blocks, which is the one thing
 * `docs/silent-failures.md` and the no-walled-garden rule say GF must not do.
 * Until the plugin narrows its reset, the theme it ships with has to restore
 * what was taken.
 *
 * WHY THE BLOCK CLASS AND NOT THE ELEMENT. `styles.elements.h1` in theme.json
 * would work and would be wrong: core emits element styles UNLAYERED, so they
 * would beat GF's own `@layer components` heading rules and override the
 * `gf-type-*` scale on every GF heading. Verified -- a per-element font set
 * through Global Styles does exactly that, deliberately. Keying on
 * `.wp-block-heading` touches core's Heading block and nothing else. GF's
 * headings carry `gf-heading`, never this class.
 *
 * `core/post-title` is handled in theme.json instead, because there the block
 * IS the element and a block-level rule reaches it cleanly.
 *
 * Sizes are the theme's own scale, so a pack retune moves these with it.
 */
h1.wp-block-heading {
  font-size: var(--wp--preset--font-size--heading-xl);
  line-height: 1.15;
}

h2.wp-block-heading {
  font-size: var(--wp--preset--font-size--heading-lg);
  line-height: 1.2;
}

h3.wp-block-heading {
  font-size: var(--wp--preset--font-size--heading-md);
  line-height: 1.25;
}

h4.wp-block-heading {
  font-size: var(--wp--preset--font-size--body-lg);
  line-height: 1.3;
}

h5.wp-block-heading,
h6.wp-block-heading {
  font-size: var(--wp--preset--font-size--body);
  line-height: 1.4;
}
