/*
 * Sunrise — global front-end styles.
 * Design tokens come from theme.json (CSS custom props --wp--preset--*).
 * Only put here what theme.json can't express (resets, small global tweaks).
 * Per-block styles belong in blocks/<name>/block.css.
 */

img,
svg,
video {
    max-width: 100%;
    height: auto;
}

:where(.wp-block-group.has-background) {
    padding: var(--wp--preset--spacing--40);
}

/* Smooth anchor scrolling for in-page block anchors. */
html {
    scroll-behavior: smooth;
}

/* Full-bleed page sections stack flush — remove WP's default block-flow top
   gap (var(--wp--preset--spacing--60)) between top-level full-width blocks. */
:root :where(.is-layout-flow) > .alignfull { margin-block-start: 0; }

/* Editor only: preview full-bleed ACF section blocks at their real (frontend)
   width instead of the 760px content column. These selectors exist only inside
   the block editor, so they never affect the front end. */
.block-editor-block-list__layout.is-root-container > [class*="wp-block-acf-"],
.block-editor-block-list__layout.is-root-container > [class*="wp-block-acf-"] > .acf-block-preview {
  max-width: none;
}

/* Root blockGap puts ~17px margin on the footer template part — sections are
   full-bleed, the gap shows as a page-bg stripe above the footer. Kill it. */
footer.wp-block-template-part { margin-top: 0; }

/* Anchor jumps (#demo, #module, TOC …) land below the fixed header. */
html { scroll-padding-top: 96px; }

/* ---------------------------------------------------------------------------
   Scroll-reveal accent — generic utility for inline accent spans.
   Add `.sun-accent-reveal` to any inline span (e.g. next to .sun-sh__accent):
     <span class="sun-sh__accent sun-accent-reveal">auf einen Blick</span>
   The text starts in the surrounding text colour and the highlight colour wipes
   in left→right as the element scrolls through the viewport (CSS scroll-driven
   animation, view() timeline — no JS).
   Default: the phrase starts in muted grey (#b6bac4) and orange wipes in.
   Override per use: --sun-accent-base (start colour) / --sun-accent-hi (highlight).
   Fallback (no scroll-timeline support, or reduced motion): static highlight,
   i.e. identical to the plain .sun-sh__accent look.
   ⚠ GOTCHA: a view() timeline is measured against the nearest ANCESTOR scroll
   container. Any ancestor with `overflow: hidden|auto|scroll` becomes that
   container and FREEZES the wipe (it stops tracking the page). If an accent's
   wrapper needs clipping, use `overflow: clip` (clips without making a scroll
   container). See .sun-aif__panel.
--------------------------------------------------------------------------- */
.sun-accent-reveal {
  /* Outer span: carries the colours + the static fallback. The phrase is split
     into per-word .sun-accent-reveal__w spans (sunrise_accent_reveal()), each of
     which does the actual clip+wipe on its own staggered slice of the scroll. */
  --_accent-base: var(--sun-accent-base, var(--sun-muted));   /* #b6bac4 */
  --_accent-hi:   var(--sun-accent-hi,   var(--wp--preset--color--primary));
  color: var(--_accent-hi);                 /* fallback: static highlight */
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .sun-accent-reveal__w {
      /* Left half = highlight, right half = base; a 200%-wide background whose
         position slides from "all base" (100%) to "all highlight" (0%), so the
         highlight sweeps in from the left. Clipped to the glyphs. Each word owns
         a later slice of the timeline (animation-range set inline per word), so
         words — and therefore wrapped lines — unmask one after another. */
      background-image: linear-gradient(90deg, var(--_accent-hi) 50%, var(--_accent-base) 50%);
      background-size: 200% 100%;
      background-position: 100% 0;
      background-repeat: no-repeat;
      -webkit-box-decoration-break: clone;
              box-decoration-break: clone;
      -webkit-background-clip: text;
              background-clip: text;
      color: transparent;
      -webkit-text-fill-color: transparent; /* Safari honours this over color */
      animation: sun-accent-wipe linear both;
      animation-timeline: view();
      /* animation-range is set inline per word (staggered reading-order reveal) */
    }
  }
  @keyframes sun-accent-wipe {
    to { background-position: 0 0; }
  }
}

/* Contact lines (sunrise_contact_text): round flag before „AT/DE/CH“ lines,
   tel:/mailto: links = site text-link style (--sun-link). */
.sun-contact-line { display: inline-flex; align-items: center; gap: 8px; }
.sun-flag { display: block; flex-shrink: 0; width: 16px; height: 16px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px rgba(19, 33, 64, .08); }
.sun-contact-link { color: var(--sun-link); text-decoration: underline; text-underline-offset: 0.15em; text-decoration-thickness: 1px; transition: color .15s ease; }
.sun-contact-link:hover { color: var(--sun-link-hover); }
.sun-contact-link:focus-visible { outline: 2px solid var(--sun-accent); outline-offset: 2px; }

/* Plain links in page content (editor text, FAQ answers, …): site text-link
   style. Default state comes from theme.json (CI blue, underlined); the navy hover
   lives here because WordPress emits the theme.json :hover selector broken. */
main a:where(:not([class])) { text-decoration: underline; text-underline-offset: 0.15em; text-decoration-thickness: 1px; transition: color .15s ease; }
main a:where(:not([class])):hover { color: var(--sun-link-hover); }

/* Bold in copy = semibold (Atyp 600), not the browser's „bolder" (700) — customer
   2026-11-24. Zero specificity: a block can still set its own weight. */
:where(strong, b) { font-weight: 600; }
