/* Native card rows cover narrow or short viewports and reduced motion.
   Match the 1100px / 600px cinematic gate in site.js and site.css. */
@media (max-width: 1099px), (max-height: 599px), (prefers-reduced-motion: reduce) {
  .page--home :is(.section--problems:not(.is-cinematic-problems), .section--services, .section--process, .section--projects, .section--team-preview) {
    padding-block: clamp(3.25rem, 7vw, 4.5rem);
  }
  .page--home :is(.section--problems:not(.is-cinematic-problems) .section-heading--problems h2, .section--services .section-heading--services h2, .process-roadmap__heading h2, .team-preview__copy h2) {
    max-width: 18ch;
    font-size: clamp(2rem, 5.2vw, 3.1rem);
    line-height: 1.08;
    letter-spacing: -.045em;
  }
  .page--home .section--services .section-heading--services { margin-bottom: 1.75rem; }
  .page--home .section--problems:not(.is-cinematic-problems) .home-problems__layout { width: min(calc(100% - 2.5rem), var(--container)); }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-title__line--positive { margin-left: 0; }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-list { display: grid; gap: 1rem; }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-list::before { display: none; }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--brand-line);
    border-radius: 1.1rem;
    background: var(--brand-card);
  }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-row::before { display: none; }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-row__label { grid-column: 1 / -1; }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-row h3 { font-size: 1.35rem; line-height: 1.2; }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-row p { font-size: .9375rem; line-height: 1.6; }
  .page--home .problem-row__caption { margin-bottom: .4rem; font-size: .75rem; color: var(--color-text-dark); }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-row__solution { grid-column: auto; padding: 0; }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-row__solution p { color: var(--brand-ink); background: none; font-weight: 500; }
  .page--home .problem-row__solution .problem-row__caption { color: var(--color-text-dark); }

  /* The next card remains visible as an invitation to swipe. */
  .page--home :is(.services-cinema, .project-grid) { width: 100%; max-width: none; }
  .page--home .section--services .services-filmstrip,
  .page--home .section--projects .project-grid {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    /* Native horizontal swipes must override the legacy carousel's pan-y. */
    touch-action: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: max(1.25rem, calc((100vw - var(--container)) / 2));
    padding: 0 max(1.25rem, calc((100vw - var(--container)) / 2)) 1rem;
    scrollbar-width: thin;
    scrollbar-color: #8593ba transparent;
    -webkit-overflow-scrolling: touch;
  }
  .page--home .section--services .service-frame,
  .page--home .section--services .service-frame.is-active {
    flex: 0 0 min(84vw, 23rem);
    scroll-snap-align: start;
    padding: 1.5rem;
    transform: none;
  }
  .page--home .section--services .service-frame h3,
  .page--home .section--services .service-frame.is-active h3,
  .page--home .section--services .service-frame:not(.is-active) h3 {
    font-size: 1.6rem;
    line-height: 1.12;
  }
  .page--home .section--services .service-frame__details,
  .page--home .section--services .service-frame.is-active .service-frame__details {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    max-height: none;
    margin-top: 1.35rem;
    gap: 1rem;
    overflow: visible;
    opacity: 1;
    transform: none;
  }
  .page--home .section--services .service-frame__copy { margin: 0; padding-top: 0; }
  .page--home .section--services .service-frame__offers { grid-template-columns: 1fr; }
  .page--home .section--services .service-frame__offers li { font-size: .9375rem; line-height: 1.45; padding-block: .7rem; }
  .page--home .section--services .service-frame__details a { display: inline-flex; align-items: center; min-height: 44px; font-size: .875rem; align-self: flex-start; }

  .page--home .section--projects .project-card,
  .page--home .section--projects .project-card--wide {
    display: flex;
    flex: 0 0 min(84vw, 23rem);
    flex-direction: column;
    scroll-snap-align: start;
    min-width: 0;
  }
  .page--home .section--projects .project-card:nth-child(n) .project-card__visual {
    flex: 0 0 auto;
    width: 100%;
    min-height: 0;
    height: auto;
    aspect-ratio: 4 / 3;
    transform: none;
    clip-path: none;
  }
  .page--home .project-case__video { width: 100%; height: 100%; object-fit: contain; }
  .page--home .section--projects .project-card:nth-child(n) .project-card__body { flex: 1; min-height: 0; justify-content: flex-start; padding: 1.4rem; }
  .page--home .project-card__body h3 { font-size: 1.35rem; line-height: 1.2; }
  .page--home .project-card__body p { margin-bottom: 1rem; font-size: .9375rem; line-height: 1.6; }
  .page--home .project-card__body .card-link { margin-top: auto; min-height: 44px; display: inline-flex; align-items: center; }
  .page--home .team-preview { gap: 2rem; }
  .page--home .team-preview__copy h2 { max-width: 21ch; margin-bottom: 1.25rem; }
  .page--home .team-preview__copy > p:not(.eyebrow) { font-size: 1rem; line-height: 1.65; margin-bottom: 1.25rem; }
  .page--home .team-preview__portraits { min-height: 0; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .page--home .team-preview__portraits .portrait-placeholder { min-height: 13rem; padding: 1rem; margin: 0; }
  .page--home .team-preview__portraits.is-visible .portrait-placeholder:first-child,
  .page--home .team-preview__portraits.is-visible .portrait-placeholder--offset { transform: none; }
  .page--home .team-preview__portraits .portrait-placeholder > p { font-size: clamp(1.15rem, 4.9vw, 1.8rem); line-height: 1.05; letter-spacing: -.035em; }
  .page--home .team-preview__badge { justify-content: flex-start; padding-top: 1rem; }
  .page--home .team-preview__badge span { font-size: .75rem; line-height: 1.4; }

  /* The fallback is compact; the enhanced intro keeps its scroll transition. */
  .page--leistungen .leistungen-story:not(.is-scroll-ready) .leistungen-story__scene { min-height: 0; }
  .page--leistungen .leistungen-story:not(.is-scroll-ready) .leistungen-story__scene--intro { padding: calc(var(--header-height) + 3rem) 0 2.5rem; }
  .page--leistungen .leistungen-story:not(.is-scroll-ready) .leistungen-story__scene--showcase { padding: 0 0 2rem; }
  .page--leistungen .leistungen-story h1 { font-size: clamp(2.5rem, 8.4vw, 4.8rem); line-height: 1.02; letter-spacing: -.055em; }
  .page--leistungen .leistungen-hero__caption { margin-top: 1.65rem; gap: 1rem; }
  .page--leistungen .leistungen-story__showcase-inner { width: min(calc(100% - 2.5rem), 52rem); }
  .page--leistungen .leistungen-showreel__frame { box-shadow: 0 1rem 2.5rem #382b281c; }
  .page--leistungen .leistungen-selection { padding: .5rem 0 1.5rem; }
  .page--leistungen .leistungen-jump__links a { min-height: 3.5rem; font-size: .8125rem; line-height: 1.3; }
  .page--leistungen .service-detail__sticky { position: static; }
  .page--leistungen .service-detail__grid { gap: 1.75rem; }
  .page--leistungen :is(.detail-card, .compact-grid article) { padding: 1.3rem; min-height: 0; }
  .page--leistungen :is(.detail-card, .compact-grid article) h3 { font-size: 1.25rem; line-height: 1.25; margin-bottom: .65rem; }
  .page--leistungen :is(.detail-card, .compact-grid article) p { font-size: .9375rem; line-height: 1.6; }
}

@media (max-width: 680px) {
  .page--home .home-intro__title { font-size: clamp(1.875rem, 9.6vw, 2.8rem); line-height: 1.1; }
  .page--home .home-intro__actions { align-items: stretch; gap: .5rem; }
  .page--home .home-intro__actions .home-intro__primary { min-width: 0; flex: 1 1 45%; min-height: 48px; padding: .75rem; font-size: .875rem; }
  .page--home .home-intro__secondary { flex: 1 1 45%; font-size: .8125rem; padding-inline: .25rem; line-height: 1.4; }
  .page--home .home-scene__visual { display: flex; flex-direction: column; }
  .page--home .home-scene__controls { display: contents; }
  .page--home .demo-controls { order: -1; margin: .25rem 0 1rem; }
  .page--home .demo-controls label { font-size: .75rem; min-height: 44px; }
  .page--home .laptop { --phone-height: 400px; min-height: calc(var(--phone-height) + 12px); }
  .page--home .home-scene:not(:has(#demo-website:checked):has([name="preview-device"][value="phone"]:checked)) .laptop { padding-top: calc((var(--phone-height) - var(--frame-height)) / 2); }
  .page--home .home-scene:not(:has(#demo-website:checked)) .laptop { padding-top: calc((var(--phone-height) - max(var(--frame-height), 270px)) / 2); }
  .page--home .home-scene:not(:has(#demo-website:checked)) .laptop__lid { height: max(var(--frame-height), 270px); }
  .page--home .example-benefit { margin-top: .6rem; }
  .page--home .home-scene__caption { font-size: .6875rem; }
  .page--home .section--problems:not(.is-cinematic-problems) .home-problems__layout { width: calc(100% - 2.5rem); }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-row { grid-template-columns: 1fr; padding: 1.25rem; gap: 1rem; }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-row__solution { padding-top: 1rem; border-top: 1px solid var(--brand-line); }
  .page--home .section--problems:not(.is-cinematic-problems) .problem-row__label { grid-column: auto; }
  .page--home .team-preview__portraits .portrait-placeholder { min-height: 10.5rem; }
  .page--home .section--projects .section-heading--split { gap: 1rem; }
  .page--leistungen .leistungen-story h1 { font-size: clamp(2.25rem, 10.5vw, 3.75rem); }
  .page--leistungen .leistungen-story:not(.is-scroll-ready) .leistungen-story__scene--intro { padding-top: calc(var(--header-height) + 2.5rem); }
  .page--leistungen .leistungen-jump__links a { font-size: .75rem; min-height: 3.5rem; }
}

/* Retain the existing reveal system with motion sized for a thumb-scroll. */
@media (max-width: 1099px) and (prefers-reduced-motion: no-preference) {
  html.js:where(.has-reveal-controller) .page--home .section--projects .project-card[data-reveal] {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 360ms ease-out, transform 360ms ease-out;
  }
  html.js:where(.has-reveal-controller) .page--home .section--projects .project-card[data-reveal].is-visible { opacity: 1; transform: none; }
  html.js:where(.has-reveal-controller) .page--home .section--projects .project-card[data-reveal] .project-card__visual {
    clip-path: inset(0 0 3% 0);
    transition: clip-path 360ms ease-out;
  }
  html.js:where(.has-reveal-controller) .page--home .section--projects .project-card[data-reveal].is-visible .project-card__visual { clip-path: inset(0); }
  html.js:where(.has-reveal-controller) :is(.page--home, .page--leistungen) main [data-reveal] {
    transition-duration: 360ms;
    transition-delay: 0ms;
  }
  html.js:where(.has-reveal-controller) .page--home .section--problems:not(.is-cinematic-problems) .problem-list[data-reveal] .problem-row { transform: translateY(10px); clip-path: none; transition-duration: 360ms; transition-delay: 0ms; }
  html.js:where(.has-reveal-controller) .page--home .section--problems:not(.is-cinematic-problems) .problem-list[data-reveal].is-visible .problem-row { transform: none; }
  html.js:where(.has-reveal-controller) .page--home .section--problems:not(.is-cinematic-problems) .problem-heading-reveal[data-reveal] > * { transform: translateY(10px); clip-path: none; transition-duration: 360ms; transition-delay: 0ms; }
  html.js:where(.has-reveal-controller) .page--home .section--problems:not(.is-cinematic-problems) .problem-heading-reveal[data-reveal].is-visible > * { transform: none; }
  .page--home .demo-panel { animation-duration: 220ms; }
  .page--home :is(.demo-chat--answer, .demo-record, .demo-task) { animation-duration: 320ms; animation-delay: 120ms; }
}

/* Compact scroll timeline: each step is readable before it becomes active. */
@media (max-width: 1099px), (max-height: 599px) {
  .page--home .process-roadmap-layout { transform: none; }
  .page--home .process-roadmap__heading { margin: 0 0 1.75rem; }
  .page--home .process-roadmap__canvas { min-width: 0; }
  .page--home .process-roadmap { min-height: 0; grid-template-columns: 1fr; gap: 0; padding: 0; }
  .page--home .process-roadmap__route { display: none; }
  .page--home .process-roadmap__step { grid-template-columns: 2.75rem minmax(0, 1fr); grid-template-rows: auto; gap: 1rem; padding: 0 0 clamp(1.75rem, 4.5vh, 2.5rem); }
  .page--home .process-roadmap__step:last-child { padding-bottom: 0; }
  .page--home .process-roadmap__node { grid-column: 1; grid-row: 1; width: 2.75rem; height: 2.75rem; font-size: .8125rem; }
  .page--home .process-roadmap::before, .page--home .process-roadmap::after {
    left: 1.375rem; right: auto; top: 1.375rem; bottom: 1.375rem;
    width: 2px; height: auto; transform-origin: center top;
  }
  .page--home .process-roadmap::after { background: linear-gradient(180deg, #1588d4, #3f63d9 48%, #8b3eae); }
  .page--home .process-roadmap__content,
  .page--home .process-roadmap__step:nth-child(even) .process-roadmap__content {
    width: auto; max-width: none; grid-column: 2; grid-row: 1; align-self: center; justify-self: stretch;
    padding: .35rem 0; text-align: left;
  }
  .page--home .process-roadmap__content h3 { font-size: 1.2rem; line-height: 1.25; letter-spacing: -.035em; }
}
@media (prefers-reduced-motion: no-preference) {
  html.js:where(.has-reveal-controller) .page--home .is-mobile-roadmap .process-roadmap[data-reveal]::before,
  html.js:where(.has-reveal-controller) .page--home .is-mobile-roadmap .process-roadmap[data-reveal]::after {
    top: var(--mobile-roadmap-top, 1.375rem); bottom: auto;
    height: var(--mobile-roadmap-height, calc(100% - 2.75rem));
  }
  html.js:where(.has-reveal-controller) .page--home .is-mobile-roadmap .process-roadmap[data-reveal]::after {
    transform: scaleY(var(--mobile-roadmap-progress, 0)); transition: none;
  }
  html.js:where(.has-reveal-controller) .page--home .is-mobile-roadmap .process-roadmap[data-reveal] .process-roadmap__content {
    opacity: calc(.68 + var(--mobile-step-progress, 0) * .32);
    transform: translate3d(calc((1 - var(--mobile-step-progress, 0)) * 16px), calc((1 - var(--mobile-step-progress, 0)) * 6px), 0);
    transition: none;
  }
  html.js:where(.has-reveal-controller) .page--home .is-mobile-roadmap .process-roadmap[data-reveal] .process-roadmap__node {
    border-color: #a6b3dc; background: var(--brand-soft); color: var(--brand-blue);
    transform: scale(calc(.92 + var(--mobile-step-progress, 0) * .08));
    box-shadow: 0 0 0 0 #425fc700;
    transition: background 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 220ms ease;
    transition-delay: 0ms;
  }
  html.js:where(.has-reveal-controller) .page--home .is-mobile-roadmap .process-roadmap[data-reveal] .is-reached .process-roadmap__node {
    border-color: var(--brand-blue); background: var(--brand-gradient); color: #fff;
  }
  html.js:where(.has-reveal-controller) .page--home .is-mobile-roadmap .process-roadmap[data-reveal] .is-current .process-roadmap__node { box-shadow: 0 0 0 5px #425fc720; }
  .page--home .is-mobile-roadmap .process-roadmap__content h3 { transition: color 180ms ease; }
  .page--home .is-mobile-roadmap .is-current .process-roadmap__content h3 { color: var(--brand-blue); }
}
