/*
Theme Name: Spark
Theme URI: https://carrot.com
Author: Carrot
Author URI: https://carrot.com
Description: Block editor theme
Requires at least: 6.7
Tested up to: 6.7
Requires PHP: 7.2
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: spark
*/

/*
 * Progressive enhancement to reduce widows and orphans
 * https://github.com/WordPress/gutenberg/issues/55190
 */
h1,
h2,
h3,
h4,
h5,
h6,
caption,
figcaption {
  text-wrap: balance;
}

blockquote,
p {
  text-wrap: pretty;
}

/*
 * Link styles
 * https://github.com/WordPress/gutenberg/issues/42319
 */
a {
  text-decoration-thickness: 1px !important;
  text-underline-offset: 0.1em;
}

.mt-0 {
  margin-top: 0 !important;
}
.mb-0 {
  margin-bottom: 0 !important;
}

/* Focus styles */
:where(.wp-site-blocks *:focus) {
  outline-width: 2px;
  outline-style: solid;
}

/*
 * Change the position of the more block on the front, by making it a block level element.
 * https://github.com/WordPress/gutenberg/issues/65934
 */
.more-link {
  display: block;
}

.is-position-sticky {
  top: var(--wp--preset--spacing--40);
}

.wp-block-template-part:has(> .is-position-sticky) {
  position: sticky;
  top: 0px;
  z-index: 100;
}

.admin-bar .wp-block-template-part:has(> .is-position-sticky) {
  top: 55px;
}

.wp-block-column {
  max-width: 100%;
}

/* Increase the bottom margin on submenus, so that the outline is visible. */
.wp-block-navigation
  .wp-block-navigation-submenu
  .wp-block-navigation-item:not(:last-child) {
  margin-bottom: 3px;
}

/* Increase the outline offset on the parent menu items, so that the outline does not touch the text. */
.wp-block-navigation
  .wp-block-navigation-item
  .wp-block-navigation-item__content {
  outline-offset: 4px;
}

/* Remove outline offset from the submenus, otherwise the outline is visible outside the submenu container. */
.wp-block-navigation
  .wp-block-navigation-item
  ul.wp-block-navigation__submenu-container
  .wp-block-navigation-item__content {
  outline-offset: 0;
}

div.wp-site-blocks > .entry-content,
div.wp-site-blocks > footer.wp-block-template-part:last-child {
  margin-block-start: unset;
}

/*
 * Page template: full bleed
 * See assets/scripts/components/template-full-bleed.js
 */
.page-template-page-full-bleed {
  --admin-bar-height: 0px;
  --bleed-height: 0px;
  --header-height: 0px;
  --og-next-element-padding-top: 0px;
}
.page-template-page-full-bleed
  .wp-site-blocks
  > .wp-block-template-part:first-child {
  position: relative;
  z-index: 100;
}
.page-template-page-full-bleed .entry-content > :first-child {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 10;
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100%;
  padding-top: var(--header-height) !important;
}
.page-template-page-full-bleed .entry-content > :nth-child(2) {
  padding-top: calc(
    var(--og-next-element-padding-top) + var(--bleed-height) -
      var(--header-height) - var(--admin-bar-height)
  ) !important;
}
