/*
 * Baugeschäft Theo Will — supplementary CSS for things theme.json can't express.
 *
 * Loaded via wp_enqueue_style in functions.php (not yet wired — see TODO below).
 * KEEP THIS FILE SHORT. Anything that can live in theme.json should.
 */

/* Root background — Safari's overscroll rubber-band reveals the html bg, not
   the body bg. Setting html to the brand dark means pulling the page down on
   iOS no longer flashes a white strip above the header. Pairs with the
   <meta name="theme-color"> emitted from functions.php. */
html {
    background-color: var(--wp--preset--color--dark);
}

/* Top-level section flush-up — kill WP's auto-injected block-gap between sections.
   WP emits :where(.wp-site-blocks) > * { margin-block-start: var(--block-gap) }
   which inserts ~16px of white space between the header, hero, intro, services,
   recruiting, contact, footer. The mockup expects every section to butt directly
   against the next. The :where(…) selector has 0 specificity; .wp-site-blocks > *
   wins on specificity alone — no !important. */
.wp-site-blocks > * {
    margin-block-start: 0;
}

/* Hero — replace core/cover's solid dim overlay with the mockup's blue→dark
   gradient. The cover block emits a <span class="wp-block-cover__background"
   has-dark-background-color has-background-dim-60> for the dim layer; that
   span gets opacity:0.6 from .has-background-dim-60. The mockup's gradient
   already has alpha baked into the rgba() stops, so we override the span
   to render the gradient at full opacity. */
#home > .wp-block-cover__background {
    background: linear-gradient(rgba(14, 27, 47, 0.55), rgba(8, 59, 123, 0.65));
    opacity: 1;
}

/* Service tiles — equal heights across the row. WP's core/columns block
   defaults to flex with align-items:stretch (so the columns themselves
   match heights), but the tile Group inside each column has intrinsic
   height matching its content. Make the tile fill its column. */
.services-section .wp-block-column {
    display: flex;
}
.services-section .wp-block-column > .service-tile {
    flex: 1;
}

/* Footer — paragraphs and headings should inherit the group's white color,
   not body's default ink. The wrapping <footer class="has-white-color
   has-text-color"> sets color on the footer itself, but theme.json's
   styles.elements.p emits its own color rule for paragraphs which can
   win on specificity. Force descendants to inherit. */
.site-footer,
.site-footer p,
.site-footer h2,
.site-footer h3 {
    color: var(--wp--preset--color--white);
}
.site-footer .legal-bar p {
    color: rgba(255, 255, 255, 0.65);
}

/* Signature red rule under section headings.
   Applied via the heading block style `is-style-with-red-rule`
   (registered in functions.php). Pseudo-element rendered directly under
   the heading, inheriting its text-align — so it's left under left-aligned
   intros and centered under centered .services-head. No standalone
   Separator block needed → no fight with WP's constrained-layout
   auto-centering of HR elements. */
.wp-block-heading.is-style-with-red-rule::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: var(--wp--preset--color--accent);
    margin-top: 16px;
    margin-bottom: 26px;
}
.has-text-align-center.wp-block-heading.is-style-with-red-rule::after {
    margin-left: auto;
    margin-right: auto;
}

/* Service tile hover (Group block with bg + border).
   Applied to .wp-block-group.service-tile (CSS class set in the pattern). */
.wp-block-group.service-tile {
    border: 1px solid var(--wp--preset--color--hairline);
    border-radius: 4px;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.wp-block-group.service-tile:hover {
    transform: translateY(-4px);
    border-color: var(--wp--preset--color--primary);
    box-shadow: 0 8px 24px rgba(8, 59, 123, 0.08);
}

/* Contact form readability — mockup constrains the form to 720px max-width,
   left-anchored under the H2 above.
   The pattern wraps the wp:shortcode in a Group block (.contact-form-wrap),
   so .fluentform is no longer a direct child of the constrained section
   (which would auto-center it via the framework's margin: auto rule).
   Inside the wrapping group, plain CSS controls the form's width and
   left-anchoring — no !important needed. */
#kontakt .contact-form-wrap .fluentform {
    max-width: 720px;
    margin-left: 0;
    margin-right: auto;
}
/* NOTE: NOT narrowing .has-lead-font-size paragraphs.
   With contentSize:1180 + a max-width override, the framework's
   constrained-layout auto-centers them, breaking left-alignment with the
   H2 above. Wider line-lengths are the lesser visual problem vs.
   misaligned columns. To narrow them properly, wrap each lead in a Group
   block — that's a per-pattern restructure, not a CSS fix. */

/* Fluent Forms — apply the brand button style to the form's submit button.
   Fluent Forms ships its own .ff-btn class with hard-coded blue; we override
   with the brand red. The block button style in theme.json doesn't reach
   Fluent Forms output because it's a plugin-rendered <button>, not
   .wp-element-button. */
.fluentform .ff-btn-submit,
.fluentform .ff-btn-submit:hover,
.fluentform .ff-btn-submit:focus {
    background: var(--wp--preset--color--accent);
    color: var(--wp--preset--color--white);
    font-family: var(--wp--preset--font-family--inter);
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 0;
    border-radius: 2px;
    padding: 14px 28px;
    cursor: pointer;
    transition: background 120ms ease, transform 120ms ease;
}
.fluentform .ff-btn-submit:hover {
    background: var(--wp--preset--color--accent-hover);
    transform: translateY(-1px);
}

/* Service tile icon — 72×72 sand-grey rounded box containing a vector
   icon. The inner SVG uses currentColor for stroke + fill, so setting
   .service-icon { color: ... } cascades through to the icon paint. */
.service-tile .service-icon {
    width: 72px;
    height: 72px;
    margin-bottom: 20px;
    background: var(--wp--preset--color--bg-soft);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wp--preset--color--primary);
}
.service-tile .service-icon svg {
    width: 56px;
    height: 56px;
    display: block;
}
/* PNG fallback path (legacy wp:image-via-bgw_image_block); kept so that
   if someone replaces the SVG with a wp:image in the editor it still
   renders correctly. */
.service-tile .service-icon img {
    width: 56px;
    height: 56px;
    display: block;
}

/* Trust strip — checkmark prefix on List items.
   Applied to .wp-block-list.trust-strip. */
.wp-block-list.trust-strip {
    list-style: none;
    padding-left: 0;
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}
.wp-block-list.trust-strip li {
    padding-left: 26px;
    position: relative;
    font-weight: 500;
    font-size: 15px;
}
.wp-block-list.trust-strip li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--wp--preset--color--accent);
    font-weight: 700;
}

/* Recruiting section — content wrapped in .recruit-content so children
   aren't direct constrained-layout descendants (which would auto-center
   anything with a max-width). Inside .recruit-content, plain CSS:
   lead paragraph narrowed for readability, bullet list narrowed too,
   both left-anchored under the H2. */
.recruit-content .has-lead-font-size {
    max-width: 760px;
    margin-right: auto;
}

/* Recruiting block — two-column check-list. */
.recruit-content .wp-block-list.recruit-perks,
.wp-block-list.recruit-perks {
    list-style: none;
    padding-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 28px;
    max-width: 880px;
    margin-right: auto;
}
.wp-block-list.recruit-perks li {
    padding-left: 28px;
    position: relative;
}
.wp-block-list.recruit-perks li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--wp--preset--color--accent);
    font-weight: 700;
}
@media (max-width: 700px) {
    .wp-block-list.recruit-perks { grid-template-columns: 1fr; }
}

/* Header — signature 2px red hairline under the nav bar + sticky positioning.
   Applied to the .site-header Group block inside parts/header.html. */
header.wp-block-template-part {
    position: sticky;
    top: 0;
    z-index: 10;
}
.site-header {
    box-shadow: 0 2px 0 var(--wp--preset--color--accent);
}

/* Site logo — sized to ~48px tall to match the mockup brand mark.
   wp:site-logo block has no width attribute (see parts/header.html), so
   there's no inline style to fight; plain CSS wins on specificity. */
.site-header .wp-block-site-logo img {
    height: 48px;
    width: auto;
}

/* Header nav — animated red underline on hover, matching mockup.
   The navigation block emits each item as <a class="wp-block-navigation-item__content">. */
.site-header .wp-block-navigation-item__content {
    position: relative;
    padding-bottom: 4px;
}
.site-header .wp-block-navigation-item__content::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--wp--preset--color--accent);
    transition: width 180ms ease;
}
.site-header .wp-block-navigation-item__content:hover::after,
.site-header .wp-block-navigation-item.current-menu-item .wp-block-navigation-item__content::after {
    width: 100%;
}

/* Footer — 4px red top-edge bar (mirror of header) */
footer.wp-block-template-part {
    position: relative;
}
footer.wp-block-template-part::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--wp--preset--color--accent);
}

/* Footer links — inherit the surrounding muted-white instead of brand blue.
   theme.json globally maps a:not(.wp-element-button) to --primary; reset here
   for the footer's dark background. No !important needed because we're more
   specific (.site-footer a vs the global a:where rule). */
.site-footer a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}
.site-footer a:hover {
    color: rgba(255, 255, 255, 1);
    text-decoration: underline;
}

/* Footer columns + legal bar share one 2fr:1fr:1fr CSS Grid layout so the
   column boundaries line up between the two rows.
   WP's wp:columns block defaults to flex with `width:50%` only setting
   flex-basis — gaps eat into the remainder unevenly. Override with grid
   for clean 2fr:1fr:1fr distribution that splits the post-gap remainder. */
.site-footer .footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px 32px;
}
.site-footer .footer-grid .wp-block-column {
    /* the WP column wrapper still applies flex-basis from its inline style;
       reset so grid alone determines width */
    flex: initial;
    flex-basis: auto;
}
.site-footer .footer-legal {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
}
.site-footer .footer-legal .legal-left {
    grid-column: 1 / 3;   /* spans col 1 + col 2 (mirrors first row's wide col) */
}
.site-footer .footer-legal .legal-right {
    grid-column: 3 / 4;   /* sits under the 'Rechtliches' column */
}

/* Hyphenation for German body text. Headings use manual (&shy;) only — auto
   hyphenation on H1 wraps it into too many lines on constrained widths.
   See mockup: H1 uses &shy; markers for "Meister­betrieb" and "Mehr­familien­häusern". */
p, li, dd, dt {
    hyphens: auto;
    -webkit-hyphens: auto;
    overflow-wrap: break-word;
}
h1, h2, h3 {
    hyphens: manual;
    -webkit-hyphens: manual;
    overflow-wrap: break-word;
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* Wired via wp_enqueue_style in functions.php — front-end (priority 20) and
   block-editor preview both get this stylesheet, so service-tile / trust-strip
   / red-rule variations render consistently in both contexts. */
