/* Shared frontend and visual-editor rules for editable page/article content. */
body { --homejoy-content-width: 780px; }
body.homejoy-layout-wide { --homejoy-content-width: 1120px; }
body.homejoy-layout-poster { --homejoy-content-width: 750px; }

/* Custom full-width sections meet without WordPress flow gaps. */
.wp-site-blocks #main > .wp-block-post-content > [data-homejoy-section] { margin-block: 0; max-width: none; }
.company-main > .wp-block-post-content > p:empty { display: none; }
.company-page .footer-inner { border-top: 0; }

.homejoy-page-title,
.homejoy-page-content > :not([data-homejoy-section]),
.homejoy-prose,
.homejoy-article-title,
.homejoy-article-date {
  width: min(calc(100% - var(--gutter, 24px) * 2), var(--homejoy-content-width));
  max-width: var(--homejoy-content-width);
  margin-inline: auto;
}
.homejoy-page-title { padding-block: clamp(2.5rem, 6vw, 5rem) 1.5rem; font: 500 clamp(2rem, 4.2vw, 3.6rem)/1.3 var(--font-title); }
.homejoy-page-content { padding-bottom: 0; }
.homejoy-page-content > :not([data-homejoy-section]):first-child { margin-top: 2rem; }
.homejoy-page-content > :not([data-homejoy-section]):last-child { margin-bottom: 3rem; }
.homejoy-page-content > :not([data-homejoy-section]) { margin-block-start: 1.5rem; }
.homejoy-page-content > .alignwide { max-width: 1120px; width: min(calc(100% - var(--gutter, 24px) * 2), 1120px); }
.homejoy-page-content > .alignfull:not([data-homejoy-section]) { max-width: 100%; width: 100%; }
.homejoy-article { padding-block: clamp(2.5rem, 6vw, 5rem); }
.homejoy-article-title { font: 500 clamp(1.8rem, 3.4vw, 3rem)/1.4 var(--font-title); overflow-wrap: anywhere; }
.homejoy-article-date { color: var(--color-subtle); font-size: .9rem; margin-top: .75rem; margin-bottom: 2rem; }
.homejoy-prose { font-size: 1.06rem; line-height: 1.95; overflow-wrap: anywhere; }
.homejoy-prose > * + * { margin-top: 1.4rem; }
.homejoy-prose :is(h2, h3), .homejoy-page-content > :is(h2, h3) { line-height: 1.4; margin-block-start: 2rem; }
.homejoy-prose :is(ul, ol), .homejoy-page-content :is(ul.wp-block-list, ol.wp-block-list) { padding-inline-start: 1.5em; list-style: revert; }
.homejoy-prose a, .homejoy-page-content > p a { text-decoration: underline; text-underline-offset: .2em; }
.homejoy-section-page { padding-block: clamp(2.5rem, 6vw, 5rem); }
.homejoy-section-page h1 { font: 500 clamp(2rem, 4vw, 3.6rem)/1.35 var(--font-title); margin-bottom: 1.5rem; }
.homejoy-section-page p { margin-block: 1rem; }
.homejoy-section-page figure { margin-block: 1.5rem; }

/* Natural dimensions are the default, including images inserted after launch. */
:is(.homejoy-prose, .homejoy-page-content > :not([data-homejoy-section]), .homejoy-section-page) :is(img, video, iframe) { max-width: 100%; }
:is(.homejoy-prose, .homejoy-page-content > :not([data-homejoy-section]), .homejoy-section-page) img { height: auto; max-height: none; }
:is(.homejoy-prose, .homejoy-page-content, .homejoy-section-page) figure.wp-block-image { max-width: 100%; }
:is(.homejoy-prose, .homejoy-page-content, .homejoy-section-page) .wp-block-image img { display: block; object-fit: contain; }
.wp-block-image :is(figcaption) { color: var(--color-subtle, #56695c); font-size: .88rem; line-height: 1.65; text-align: center; margin-top: .6rem; }
.wp-block-image:is(.is-style-homejoy-original, .is-style-homejoy-long-image) img { height: auto !important; max-height: none !important; aspect-ratio: auto !important; object-fit: contain !important; }
.wp-block-image.is-style-homejoy-narrow { max-width: min(100%, 420px) !important; margin-inline: auto; }
.wp-block-image.is-style-homejoy-landscape img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.homejoy-layout-poster :is(.homejoy-prose, .homejoy-page-content) > .wp-block-image { margin-block: 0; }
.homejoy-layout-poster :is(.homejoy-prose, .homejoy-page-content) > .wp-block-image img { height: auto !important; max-height: none !important; aspect-ratio: auto !important; object-fit: contain; }
.homejoy-layout-poster .homejoy-prose > .wp-block-image + .wp-block-image { margin-top: 0; }

/* The editor uses the same readable widths and image styles as the public site. */
.editor-styles-wrapper { --homejoy-content-width: 780px; font: 1.06rem/1.95 var(--font-copy, sans-serif); color: #173a29; }
.editor-styles-wrapper .wp-block { max-width: var(--homejoy-content-width); }
.editor-styles-wrapper .wp-block[data-align="wide"] { max-width: 1120px; }
.editor-styles-wrapper .wp-block[data-align="full"] { max-width: none; }
.editor-styles-wrapper .wp-block-image img { max-width: 100%; height: auto; max-height: none; object-fit: contain; }
.editor-styles-wrapper.homejoy-layout-poster .wp-block-image { margin-block: 0; }

/* Two-level navigation keeps the primary destination clickable. */
.nav-parent { position: relative; display: flex; align-items: center; gap: .15rem; }
.nav-action-group { justify-self: end; }
.nav-toggle { border: 0; padding: .2rem .35rem; background: transparent; color: inherit; line-height: 1.4; border-radius: .3rem; }
.nav-toggle[aria-expanded="true"] { background: var(--color-neighbor); }
.nav-submenu { position: absolute; top: calc(100% + .8rem); left: -.8rem; min-width: 12rem; max-width: min(22rem, 85vw); padding: .5rem; margin: 0; border: 1px solid var(--color-rule); border-radius: .7rem; background: var(--color-paper); box-shadow: 0 .7rem 1.6rem #173a2914; list-style: none; z-index: 30; }
.nav-submenu a { display: block; padding: .6rem .8rem; white-space: normal; }
.nav-submenu a:hover { background: var(--color-neighbor); border-radius: .3rem; }
.nav-action-group .nav-submenu { left: auto; right: 0; }
@media (max-width: 900px) {
  .mobile-nav nav { max-height: calc(100dvh - var(--nav-size) - 2rem); overflow-y: auto; max-width: calc(100vw - 2 * var(--gutter)); }
  .mobile-nav .nav-parent { display: grid; grid-template-columns: 1fr auto; }
  .mobile-nav .nav-submenu { grid-column: 1 / -1; position: static; min-width: 0; margin: .1rem 0 .4rem .65rem; border: 0; border-left: 2px solid var(--color-brand); border-radius: 0; box-shadow: none; padding: 0; }
  .mobile-nav .nav-submenu a { font-size: .92rem; }
  .nav-action-group { justify-self: auto; }
}
@media (max-width: 600px) {
  .homejoy-prose { font-size: 1rem; line-height: 1.85; }
  .homejoy-page-content > .wp-block-columns { gap: 1.5rem; }
}
