/* Size the pinned scene to the actual viewport, including short desktop windows.
   JS measures the tallest chapter after fonts/layout settle. */
.enhanced .stage {
  min-height: 0;
  grid-template-rows: var(--copy-height, 290px) minmax(0, 1fr);
}
.enhanced .illustration { min-width: 0; }
@media (max-height: 780px) {
  .enhanced .stage {
    padding-top: clamp(84px, 15svh, 112px);
    padding-bottom: 12px;
    gap: clamp(12px, 3svh, 24px);
  }
  .chapter h1, .chapter h2 {
    font-size: clamp(28px, min(5vw, 8svh), 62px);
    margin-bottom: 14px;
  }
  .chapter .lede { font-size: clamp(13px, 2.3svh, 17px); line-height: 1.55; }
  .chapter .primary, .chapter .tags { margin-top: 14px; }
  .chapter.intro { transform: translateY(12px); }
  .enhanced .illustration { transform: none; }
  .nav { height: 72px; }
  .chapters { gap: 2px; }
}
@media (max-width: 700px) and (max-height: 780px) {
  .chapter h1, .chapter h2 { font-size: clamp(28px, min(7.5vw, 7svh), 48px); }
}
/* Landscape phones and very shallow windows need two columns, not a cropped scene. */
@media (min-width: 600px) and (max-height: 480px) {
  .enhanced .stage {
    grid-template-columns: 1.05fr 1fr;
    grid-template-rows: minmax(0, 1fr);
    align-items: center;
    padding: 88px 48px 20px 24px;
    gap: 16px;
  }
  .enhanced .chapter-copy { height: var(--copy-height, 250px); align-self: center; }
  .chapter h1, .chapter h2 { font-size: clamp(26px, 3.5vw, 38px); }
  .chapter .lede { font-size: 13px; }
  .chapter .tags { flex-wrap: wrap; font-size: 8px; gap: 4px; }
  .chapter .tags span { padding: 6px; }
  .chapter.intro { transform: none; }
  .chapter > .eyebrow { top: -22px; font-size: 8px; }
}
/* Services remain normal, readable document content at every size. */
@media (min-width: 701px) and (max-height: 800px) {
  .build { padding-top: clamp(28px, 5svh, 50px); padding-bottom: 32px; }
  .build .section-top { margin-bottom: 18px; }
  .build .section-heading { gap: 30px; }
  .build .section-heading h2 { font-size: clamp(30px, min(4.3vw, 6.5svh), 52px); }
  .build .section-heading > p { font-size: 14px; line-height: 1.5; }
  .build .capabilities { margin-top: 24px; gap: 16px; }
  .build .capabilities article { padding: 22px; }
  .build .capabilities img { width: 52px; height: 52px; margin: 18px 0 14px; }
  .build .capabilities h3 { font-size: clamp(22px, 2.5vw, 28px); margin-bottom: 12px; }
  .build .capabilities p { line-height: 1.55; margin-bottom: 18px; }
  .build .card-foot { padding-top: 12px; }
  .build .principle { margin-top: 20px; }
}

/* A quieter, consistently spaced header. Hit targets stay comfortably sized. */
.nav { padding-inline: 5%; gap: 24px; }
.wordmark { width: 162px; }
.nav > nav { margin-left: 0; gap: 28px; line-height: 1; }
.header-contacts { gap: 12px; }
.nav .theme-toggle { margin-left: -12px; }
.header-contacts .contact-icon, .nav .theme-toggle { width: 40px; height: 40px; flex-basis: 40px; }
.contact-icon svg { width: 20px; height: 20px; }
.nav .theme-toggle > svg { width: 22px; height: 22px; }
/* Align the rail with the communication block rather than the whole canvas. */
.enhanced .chapters { top: clamp(92px, 16svh, 156px); transform: none; gap: clamp(0px, 1svh, 7px); }
@media (max-width: 700px) {
  .nav { padding-inline: 6%; gap: 10px; height: 68px; }
  .wordmark { width: 132px; }
  .nav .theme-toggle { margin-left: auto; }
  .nav .theme-toggle > svg, .menu-symbol { width: 19px; height: 19px; }
  :root .mobile-menu summary { width: 40px; height: 40px; min-height: 40px; }
  .mobile-menu nav { top: 67px; padding-inline: 6%; }
  .mobile-contacts { flex-direction: row; gap: 12px; padding: 8px 0; }
  .mobile-contacts .contact-icon { width: 40px; justify-content: center; }
  .enhanced .chapters { top: clamp(92px, 16svh, 130px); gap: 0; }
}

/* 04 and 05 respond to height too, without making their text microscopic. */
.build { padding-top: clamp(28px, 5svh, 64px); padding-bottom: clamp(24px, 4svh, 48px); }
.build .section-top { margin-bottom: 18px; }
.build .capabilities { margin-top: 28px; }
.build .capabilities article { padding: clamp(20px, 2vw, 28px); }
.build .capabilities img { width: 64px; height: 64px; margin: 22px 0 20px; object-fit: contain; }
.build .capabilities h3 { font-size: clamp(23px, 2.4vw, 28px); }
.build .capabilities p { line-height: 1.6; margin-bottom: 22px; }
.contact { padding-block: clamp(24px, 5svh, 64px); }
.contact-orbit { margin-bottom: clamp(14px, 2svh, 26px); }
.contact h2 { font-size: clamp(40px, min(7vw, 9svh), 80px); margin: 16px 0; }
.contact-copy { font-size: clamp(14px, 2svh, 17px); }
.bottleneck-placeholder { margin-top: 24px; }
@media (max-height: 650px) and (min-width: 701px) {
  .build .capabilities img { width: 48px; height: 48px; margin: 14px 0 16px; }
  .build .capabilities { margin-top: 20px; }
  .build .capabilities article { padding: 20px; }
  .build .principle { margin-top: 16px; }
  .contact { display: grid; grid-template-columns: 150px minmax(0, 625px); justify-content: center; column-gap: 32px; padding-block: 28px; }
  .contact-orbit { grid-column: 1; grid-row: 1 / 5; align-self: center; margin: 0; }
  .contact > :not(.contact-orbit) { grid-column: 2; }
  .contact h2 { font-size: clamp(38px, 8svh, 52px); }
  .bottleneck-placeholder { width: 100%; }
}
@media (max-width: 700px) {
  .build, .contact { padding-inline: 6% 12%; }
  .build .section-heading h2 { font-size: clamp(30px, 8vw, 41px); }
  .build .capabilities { gap: 14px; }
  .build .capabilities article { padding: 24px; }
  .build .capabilities img { width: 56px; height: 56px; margin: 20px 0 18px; }
  .contact h2 { font-size: clamp(38px, 10vw, 56px); }
  .contact-orbit { height: 110px; margin-bottom: 12px; }
}
/* The last morph must be able to reach its end even on very tall displays. */
.contact { min-height: 100svh; }
@media (max-height: 650px) and (min-width: 701px) {
  .contact { align-content: center; }
}
/* Smooth navigation is explicit in navigation.js; measurement scrolls stay instant. */
html { scroll-behavior: auto; }
@media (max-width: 700px) {
  body:has(.mobile-menu[open]) .chapters { visibility: hidden; }
}

/* Final optical alignment: copy-led rail, quieter header and baseline footer. */
@media (min-width: 701px) {
  .nav { gap: 18px; }
  .header-contacts { gap: 6px; }
  .nav .theme-toggle { margin-left: -12px; }
}
.contact-icon[aria-label^="LinkedIn"] svg { width: 19px; height: 19px; }
.contact-icon:is([aria-label^="Email"], [aria-label^="E-Mail"]) svg { width: 22px; height: 22px; }
.enhanced .chapters { top: max(40px, calc(var(--copy-top, 132px) - 40px)); }
.enhanced[data-section="0"] .chapters { top: calc(var(--copy-top, 132px) + 4px); }
:root .input-shell:focus-within .field-label,
:root .input-shell textarea:not(:placeholder-shown) ~ .field-label {
  font-size: 14px;
  transform: translateY(0) scale(.68);
}
footer { align-items: flex-end; padding-bottom: 20px; }
footer > p, footer > span { line-height: 1; }
@media (max-width: 700px) {
  footer { display: grid; grid-template-columns: 1fr auto; gap: 20px 12px; align-items: end; }
  footer > a { grid-column: 1 / -1; }
  footer > p { order: 0; margin: 0; font-size: 9px; line-height: 1.4; }
  footer > span { margin: 0; font-size: 9px; line-height: 1.4; }
}
@media (max-height: 650px) and (min-width: 701px) {
  .contact-orbit { grid-row: 1 / 4; }
}
.intro .lede { max-width: 800px; }
.intro .lede > span { display: block; }
.contact-icon[aria-label^="LinkedIn"] svg { width: 21px; height: 21px; }
.build .section-heading { align-items: center; }
.build .section-heading > p { max-width: 35ch; font-size: 15px; line-height: 1.55; text-wrap: pretty; }
/* One closing composition: centered content and a footer at its lower edge. */
.contact { display: flex; flex-direction: column; padding: 0; min-height: 100svh; }
.contact-content {
  flex: 1; width: 100%; display: flex; flex-direction: column;
  justify-content: center; align-items: center; padding: 48px 7% 16px;
}
.contact .bottleneck-placeholder { width: 100%; }
.contact footer { width: 100%; background: transparent; align-items: center; text-align: left; }
.contact footer > span { align-self: flex-end; }
.enhanced .story .chapter-copy { opacity: calc(1 - var(--copy-handoff, 0)); }
@media (max-height: 650px) and (min-width: 701px) {
  .contact-content {
    display: grid; grid-template-columns: 150px minmax(0, 625px);
    align-content: center; justify-content: center; column-gap: 32px;
    padding: 24px 7% 0;
  }
  .contact-content > :not(.contact-orbit) { grid-column: 2; }
  .contact-content .contact-orbit { grid-column: 1; grid-row: 1 / 4; }
}
@media (max-width: 700px) {
  .contact-content { padding: 40px 6% 24px; }
  .contact .field-space { height: auto; }
  .contact .field-space > .input-shell { position: relative; bottom: auto; }
  .contact footer {
    grid-template-columns: 1fr; justify-items: center; gap: 12px;
    padding: 24px 6% max(28px, env(safe-area-inset-bottom)); text-align: center;
  }
  .contact footer > a { grid-column: 1; }
  .contact footer > .legal-links { grid-column: 1; justify-self: center; gap: 16px; }
  .contact footer > a img { width: 130px; }
  .contact footer > p { margin: 0; font-size: 12px; line-height: 1.5; }
  .contact footer > span {
    grid-column: 1; justify-self: center; align-self: center;
    margin: 4px 0 0; font-size: 11px; line-height: 1.5;
  }
  .build .section-heading > p { max-width: none; font-size: 14px; }
}

/* Contact placeholders share the theme control's restrained optical feedback. */
.contact-icon { transition: color .25s ease; }
.contact-icon > svg { transition: transform .25s ease; transform-origin: center; }
.contact-icon:is(:hover, :focus-visible) { color: var(--mint); }
.contact-icon:is(:hover, :focus-visible) > svg { transform: rotate(8deg) scale(1.1); }
@media (prefers-reduced-motion: reduce) {
  .contact-icon, .contact-icon > svg { transition: none; }
  .contact-icon:is(:hover, :focus-visible) > svg { transform: none; }
}
/* Language is a utility beside the palette control, not a competing CTA. */
.language-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  flex: 0 0 auto; height: 40px; padding: 0 4px; border: 0; background: transparent;
  color: var(--muted); font: 10px "IBM Plex Mono", monospace; cursor: pointer;
}
.language-toggle[hidden] { display: none; }
.language-toggle svg { transition: transform .25s ease; }
.language-toggle:is(:hover, :focus-visible) { color: var(--mint); }
.language-toggle:is(:hover, :focus-visible) svg { transform: rotate(8deg) scale(1.1); }
.language-toggle:focus-visible { text-decoration: underline; text-underline-offset: 5px; }
:root[lang="de"] .chapter h1, :root[lang="de"] .chapter h2 { font-size: clamp(28px, min(4.5vw, 8svh), 64px); }
:root[lang="de"] .card-foot { flex-wrap: wrap; }
@media (max-width: 700px) {
  .nav { gap: 6px; }
  .nav .language-toggle { margin-left: auto; height: 40px; gap: 3px; padding: 0; }
  .nav .language-toggle svg { width: 17px; height: 17px; }
  .nav .theme-toggle { margin-left: 0; }
  :root[lang="de"] .chapter h1, :root[lang="de"] .chapter h2 { font-size: clamp(26px, min(7vw, 6.5svh), 44px); }
}
@media (min-width: 600px) and (max-height: 480px) {
  :root[lang="de"] .chapter h1, :root[lang="de"] .chapter h2 { font-size: clamp(24px, 3vw, 32px); }
}
@media (prefers-reduced-motion: reduce) {
  .language-toggle svg { transition: none; }
  .language-toggle:is(:hover, :focus-visible) svg { transform: none; }
}

/* Preview the destination language inside the same circular footprint. */
.language-globe, .language-flag { transition: opacity .2s ease; }
.language-flag { opacity: 0; }
.language-toggle:is(:hover, :focus-visible) svg { transform: none; }
.language-toggle:is(:hover, :focus-visible) .language-globe { opacity: 0; }
:root[lang="de"] .language-toggle:is(:hover, :focus-visible) .language-flag-en,
:root[lang="en"] .language-toggle:is(:hover, :focus-visible) .language-flag-de { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .language-globe, .language-flag { transition: none; }
}
/* Numbers carry the chapter navigation; only the current chapter has a marker. */
.chapter-links { display: flex; flex-direction: column; gap: clamp(0px, 1svh, 7px); }
:root .chapters a { position: relative; justify-content: flex-start; color: var(--muted); font-weight: 400; min-height: 40px; }
:root .chapters a i { opacity: 0; width: 12px; height: 1px; }
:root .chapters a[aria-current] { color: var(--mint); font-weight: 600; }
:root .chapters a[aria-current] i { opacity: 1; width: 12px; background: currentColor; }
:root .chapters a:is(:hover, :focus-visible) { color: var(--mint); text-decoration: none; }
.chapter-picker { display: none; }
@media (min-width: 701px) {
  .chapters a::before {
    content: attr(aria-label); position: absolute; right: calc(100% + 10px); top: 50%;
    transform: translate(4px, -50%); opacity: 0; pointer-events: none;
    padding: 7px 10px; background: var(--bg); color: var(--text); border-radius: 5px;
    font: 12px "Instrument Sans", sans-serif; white-space: nowrap;
    transition: opacity .18s ease, transform .18s ease;
  }
  .chapters a:is(:hover, :focus-visible)::before { opacity: 1; transform: translate(0, -50%); }
}
@media (max-width: 700px) {
  .enhanced .chapters { right: 8px; }
  .chapter-picker:not([hidden]) {
    display: flex; align-items: center; justify-content: center; gap: 4px; position: relative;
    min-width: 44px; min-height: 44px; border: 0; padding: 8px 4px;
    color: var(--mint); background: transparent; font: 500 10px "IBM Plex Mono", monospace;
  }
  .chapter-picker svg { transition: transform .2s ease; }
  .chapter-picker[aria-expanded="true"] svg { transform: rotate(180deg); }
  .chapter-progress { position: absolute; bottom: 5px; left: 8px; right: 8px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
  .chapter-progress::after { content: ""; display: block; height: 100%; background: var(--mint); transform: scaleX(var(--chapter-progress, .1667)); transform-origin: left; transition: transform .25s ease; }
  .enhanced .chapter-links { display: none; }
  .enhanced .chapters.is-open .chapter-links {
    display: flex; position: absolute; top: 48px; right: 0; width: 220px;
    max-height: calc(100svh - 160px); overflow-y: auto; padding: 8px;
    gap: 0; border-radius: 8px; background: var(--bg); box-shadow: 0 8px 30px #0002;
  }
  :root .chapters .chapter-links a { padding: 0 10px; min-height: 44px; gap: 12px; font-size: 10px; }
  :root .chapters .chapter-links a i { display: none; }
  .chapter-links a::after { content: attr(aria-label); font: 13px "Instrument Sans", sans-serif; }
  .chapter-picker:focus-visible { outline: 1px solid var(--mint); outline-offset: 2px; border-radius: 4px; }
  :root .chapters .chapter-links a:focus-visible { background: var(--line); border-radius: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .chapters a::before, .chapter-picker svg, .chapter-progress::after { transition: none; }
}
@media (min-width: 701px) {
  :root .chapters a { font-size: 10px; }
}

.contact-orbit img { width: 81px; height: 86px; object-fit: contain; }

/* Keep the original centered hero hierarchy with the current service copy. */
.intro .hero-audience { display: block; }
body[data-section="0"] .chapter-links,
body[data-section="0"] .chapter-picker { visibility: hidden; pointer-events: none; }
.build .section-heading { grid-template-columns: 1fr; }

/* One continuous headline on full-width desktop screens. */
@media (min-width: 1200px) {
  .intro h1 { white-space: nowrap; font-size: clamp(44px, 4.4vw, 64px); }
  .intro h1 br { display: none; }
  .intro h1 br::after { content: " "; }
}

/* One compact utility group with balanced visible icon sizes. */
.header-controls { display: flex; align-items: center; gap: 0; margin-left: auto; }
.header-controls .header-contacts { gap: 0; margin-left: 0; }
.nav .header-controls .language-toggle,
.nav .header-controls .theme-toggle { margin-left: 0; }
.header-controls .language-toggle { gap: 4px; padding-inline: 4px; }
.header-controls .contact-icon[aria-label^="LinkedIn"] svg { width: 24px; height: 24px; }
.header-controls .language-toggle svg { width: 24px; height: 24px; }
@media (max-width: 700px) {
  .nav .header-controls .language-toggle svg { width: 20px; height: 20px; }
}
