/* ==========================================================================
   Shared layout + components
   ========================================================================== */

.wrap {
  /* V4: ≈1410px content + gutters (tokens.css) */
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* pictures fill their fixed-ratio frames */
.apps__frame picture,
.refs__frame picture,
.method__figure picture,
.values__frame picture,
.mat__media picture {
  display: block;
  height: 100%;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
}

.section {
  position: relative;
  padding-block: var(--section-y);
  color: var(--fg);
}

/* Surfaces — solid per section (V3: no shared viewport stage) */
.section--light {
  background: var(--c-white);
}
.section--paper {
  background: var(--c-paper);
}
.section--dark {
  background: var(--c-black);
}
.section--blue {
  background: var(--c-tech);
}

/* --- Diagonal seam: a section with [data-seam] reaches up into the previous
   one with a wedge of its own surface, rising left → right on the site
   diagonal. The wedge settles as the boundary scrolls in (js/seams.js sets
   --seam-p 0…1, transform only); reduced motion / no JS = settled. */
[data-seam] {
  z-index: 1;
}
[data-seam]::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% - 1px); /* 1px overlap: no hairline gap at fractional DPR */
  height: var(--seam);
  background: inherit;
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
  transform-origin: 0 100%;
  transform: scaleY(var(--seam-p, 1));
  pointer-events: none;
}
/* the copper hairline that runs along a seam (one per section, max) */
[data-seam='copper']::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% - 1px);
  height: var(--seam);
  background: linear-gradient(
    to bottom right,
    transparent calc(50% - 0.75px),
    rgb(194 118 59 / 0.9) 50%,
    transparent calc(50% + 0.75px)
  );
  -webkit-mask-image: linear-gradient(90deg, transparent 8%, #000 40%, #000 62%, transparent 92%);
  mask-image: linear-gradient(90deg, transparent 8%, #000 40%, #000 62%, transparent 92%);
  transform-origin: 0 100%;
  transform: scaleY(var(--seam-p, 1));
  pointer-events: none;
}

/* --- Section label: small square echoes the "intervention point" of the logo mark */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(20px, 2.4vw, 32px);
  font-family: var(--f-text);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--eyebrow);
}
.eyebrow::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  background: var(--mark);
}

/* --- Display headings (Unbounded): V3 = ALL CAPS like the flyer.
   The German strings stay in sentence case in the markup (semantics, search,
   screen readers); caps are visual only. Caps run wider → smaller scale,
   heavier weight, almost neutral tracking. */
.h-section {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.625rem, 0.9rem + 2.65vw, 3.75rem);
  line-height: 1.02;
  letter-spacing: -0.012em;
  text-transform: uppercase;
  text-wrap: balance;
  /* soft hyphens (&shy;) only take effect on very narrow screens */
  hyphens: none;
}
@media (max-width: 479px) {
  .h-section {
    hyphens: manual;
  }
}
.h-section--xl {
  font-size: clamp(1.75rem, 0.8rem + 3.4vw, 4.5rem);
  line-height: 1;
}
/* a line that must break exactly here (designed breaks for caps) */
.h-break {
  display: block;
}
/* short copper rule under a headline — the flyer's single editorial marker */
.rule {
  display: block;
  width: clamp(64px, 8vw, 132px);
  height: 2px;
  margin-top: clamp(22px, 2.4vw, 34px);
  background: linear-gradient(90deg, var(--c-copper), rgb(194 118 59 / 0));
}
.accent {
  color: var(--accent);
}

/* ==========================================================================
   CTA system
   primary   – V4.1: Precision-Blue fill (#0D6FB8, white text 5.27:1) with the
               V3 frame restored: copper hairline ring + one narrow highlight
               (copper-light → white → copper-light) travelling along the
               perimeter in 5.2 s. On light surfaces the highlight core is the
               deep copper #bb4d14, so the travelling light stays visible on
               white (a white glint disappears there). Static for reduced motion.
   secondary – V4.1: ONE style site-wide = the hero's secondary link
               (.link-arrow: text, hairline underline → copper sweep, arrow).
   ========================================================================== */

@property --shine-a {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.btn {
  --cut: 11px;
  --btn-fill: var(--c-cta);
  --btn-ring: rgb(194 118 59 / 0.62); /* V3 copper hairline */
  --btn-glint-edge: var(--c-copper-light);
  --btn-glint: #fff;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 22px 0 24px;
  font-family: var(--f-text);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.1;
  white-space: nowrap;
  color: var(--c-white);
  --focus: var(--c-precision);
  transition:
    color var(--t-mid) var(--ease-out),
    transform 120ms var(--ease-out);
}
/* frame: conic gradient seen only as a 1px rim around the fill */
.btn::before,
.btn::after {
  content: '';
  position: absolute;
  pointer-events: none;
}
.btn::before {
  inset: 0;
  z-index: -2;
  /* V3 stops, restored 1:1 */
  background: conic-gradient(
    from var(--shine-a),
    var(--btn-ring) 0deg 318deg,
    var(--btn-glint-edge) 336deg,
    var(--btn-glint) 342deg,
    var(--btn-glint-edge) 348deg,
    var(--btn-ring) 360deg
  );
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
  animation: btn-shine 5.2s linear infinite;
  transition: opacity var(--t-mid) var(--ease-out);
}
.btn::after {
  inset: 1px;
  z-index: -1;
  background: var(--btn-fill);
  /* inner chamfer = outer cut − (√2 − 1)·1px keeps the diagonal rim 1px wide */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut) + 0.41px), calc(100% - var(--cut) + 0.41px) 100%, 0 100%);
  transition: background-color var(--t-mid) var(--ease-out);
}
@keyframes btn-shine {
  to {
    --shine-a: 360deg;
  }
}
.btn:hover,
.btn:focus-visible {
  --btn-ring: var(--c-copper); /* V3: the ring warms to full copper */
  --btn-fill: var(--c-cta-hover);
}
/* light surfaces (white / paper sections, white header): deep-copper core so
   the travelling highlight reads against white; the ring stays copper */
.tone-light .btn,
.tone-paper .btn,
.site-header[data-state='solid'] .btn {
  --btn-ring: rgb(187 77 20 / 0.55);
  --btn-glint-edge: #d98a5c;
  --btn-glint: var(--cu-a, #bb4d14);
}
.tone-light .btn:is(:hover, :focus-visible),
.tone-paper .btn:is(:hover, :focus-visible),
.site-header[data-state='solid'] .btn:is(:hover, :focus-visible) {
  --btn-ring: var(--cu-a, #bb4d14);
}
/* blue / black panels nested in a light section get the dark-surface frame back */
.tone-blue .btn,
.tone-dark .btn {
  --btn-ring: rgb(194 118 59 / 0.62);
  --btn-glint-edge: var(--c-copper-light);
  --btn-glint: #fff;
}
.tone-blue .btn:is(:hover, :focus-visible),
.tone-dark .btn:is(:hover, :focus-visible) {
  --btn-ring: var(--c-copper);
}
.btn:focus-visible {
  outline: 2px solid var(--focus-ring, var(--c-precision));
  outline-offset: 3px;
}
.tone-dark .btn:focus-visible,
.tone-blue .btn:focus-visible,
.site-header:not([data-state='solid']) .btn:focus-visible {
  --focus-ring: #fff;
}
.btn:active {
  transform: translateY(1px);
}

/* arrow microinteraction: stem grows, head travels */
.btn__arrow {
  flex: none;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  overflow: visible;
}
.btn__arrow-stem {
  transform-origin: 19px 12px;
  transform: scaleX(0.72);
  transition: transform var(--t-mid) var(--ease-out);
}
.btn__arrow-head {
  transition: transform var(--t-mid) var(--ease-out);
}
.btn:hover .btn__arrow-stem,
.btn:focus-visible .btn__arrow-stem {
  transform: translateX(3px) scaleX(1);
}
.btn:hover .btn__arrow-head,
.btn:focus-visible .btn__arrow-head {
  transform: translateX(3px);
}

.btn--lg {
  min-height: 60px;
  padding: 0 26px 0 30px;
  font-size: 1rem;
  --cut: 13px;
}
.btn--sm {
  min-height: 44px;
  padding: 0 16px 0 18px;
  font-size: 0.875rem;
  gap: 10px;
  --cut: 9px;
}
.btn--block {
  width: 100%;
}

/* legacy secondary frame (V4) — no longer used on the homepage in V4.1;
   kept for the placeholder pages only */
.btn--secondary {
  color: var(--fg);
  --btn-ring: var(--line-strong);
  --focus: var(--fg);
}
.btn--secondary::after {
  display: none;
}
.btn--secondary::before {
  clip-path: none;
  padding: 1px;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box exclude,
    linear-gradient(#000 0 0);
  background: conic-gradient(
    from var(--shine-a),
    var(--btn-ring) 0deg 318deg,
    var(--c-precision) 336deg,
    var(--c-blue-tint) 342deg,
    var(--c-precision) 348deg,
    var(--btn-ring) 360deg
  );
  animation-play-state: paused;
  animation-duration: 2.6s;
}
.btn--secondary:hover,
.btn--secondary:focus-visible {
  --btn-ring: var(--fg-muted);
  --btn-fill: transparent;
}
/* at rest a plain hairline; the highlight only travels on hover / focus */
.btn--secondary:not(:hover, :focus-visible)::before {
  background: var(--btn-ring);
}
.btn--secondary:hover::before,
.btn--secondary:focus-visible::before {
  animation-play-state: running;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}

/* --- Secondary CTA (V4.1 single source of truth = hero "Leistungen entdecken"):
   text + hairline underline → copper sweep + arrow. Used for every secondary
   link/button on the homepage; buttons (lightbox) get the same look. */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  color: var(--fg);
  background:
    linear-gradient(var(--c-copper), var(--c-copper)) left calc(100% - 8px) / 0% 1.5px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) left calc(100% - 8px) / 100% 1px no-repeat;
  transition: background-size var(--t-mid) var(--ease-out);
}
.link-arrow:hover,
.link-arrow:focus-visible {
  background-size:
    100% 1.5px,
    100% 1px;
}
.link-arrow__icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  transition: transform var(--t-mid) var(--ease-out);
}
.link-arrow:hover .link-arrow__icon,
.link-arrow:focus-visible .link-arrow__icon {
  transform: translate(3px, 0);
}
.link-arrow:hover .link-arrow__icon--down,
.link-arrow:focus-visible .link-arrow__icon--down {
  transform: translate(0, 3px);
}
/* the supplied arrow turned ↓ / ↑ is a diagonal glyph rotated 135° / −45°:
   a slightly smaller box + side margin keeps its turned corners inside */
.link-arrow .sg-arrow {
  --sg-size: 12px;
  margin-inline: 3px;
}
.link-arrow:hover .sg-arrow--down,
.link-arrow:focus-visible .sg-arrow--down {
  transform: translate(0, 3px) rotate(var(--rot));
}
.link-arrow:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}
button.link-arrow {
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  text-align: left;
}
/* caps variant for menu / navigation context (mega-menu "ALLE LEISTUNGEN") */
.link-arrow--caps {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line-strong);
  color: var(--fg);
  transition:
    border-color var(--t-fast) var(--ease-out),
    opacity var(--t-fast);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.icon-btn:hover:not(:disabled) {
  border-color: var(--c-copper);
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* --- Scroll reveal (only when JS is active; reduced motion = final state) */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity var(--t-slow) var(--ease-out),
    transform var(--t-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
/* mask reveal clips the children: a fully clipped target would never
   report as intersecting, so the observed element itself stays unclipped */
.js [data-reveal='mask'] {
  opacity: 1;
  transform: none;
}
.js [data-reveal='mask'] > * {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1100ms var(--ease-inout);
}
.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}
.js [data-reveal='mask'].is-in > * {
  /* V4.1: negative insets — never clip umlaut dots / overshoot */
  clip-path: inset(-0.5em -0.3em -0.3em -0.3em);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js [data-reveal],
  .js [data-reveal='mask'],
  .js [data-reveal='mask'] > * {
    opacity: 1;
    transform: none;
    clip-path: none;
    transition: none;
  }
  /* static copper frame, no travelling highlight */
  .btn::before {
    animation: none;
    background: var(--btn-ring);
  }
  .btn--secondary::before {
    background: var(--btn-ring);
  }
  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Performance (client preview): decorative loops pause while off screen –
   js/anim-gate.js toggles .is-live via IntersectionObserver. */
.anim-gated .btn:not(.is-live)::before,
.anim-gated .site-footer__symbol:not(.is-live) .site-footer__symbol-glint {
  animation-play-state: paused;
}
