/* Overrides to make the design coexist with the parent Next.js root layout.
 * The root layout brings Tailwind preflight + custom font CSS variables.
 * We restore the design's expected baseline on the .w3-new-landing body class.
 */

/* Fallback CSS variables before LandingInit sets data-density on :root.
 * Mirrors the "compact" default chosen by the design's tweak script. */
:root {
  --gutter: 40px;
  --section-pad: 80px;
}

/* Reset body styling Tailwind preflight may have applied. */
body.w3-new-landing {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: var(--leading-normal);
  margin: 0;
}

/* Bilingual visibility is scoped here so it works without relying on
 * the root <body data-lang="..."> attribute being applied before paint. */
body.w3-new-landing[data-lang="fr"] .lang-en { display: none; }
body.w3-new-landing[data-lang="en"] .lang-fr { display: none; }

/* The design CSS targets only `body[data-lang]`. Keep `.lang-en` hidden until
 * the lang is hydrated so we don't briefly flash both languages. */
body:not(.w3-new-landing) .lang-en { display: none; }

/* Italic + background-clip:text bug fix.
 * Serif italics (Instrument Serif) overshoot their advance width on the right.
 * With `-webkit-background-clip: text`, the gradient paints only inside the
 * element's content box, so the visual tail of the last glyph gets clipped.
 * Extending the paint area with padding-inline-end fixes it; the negative
 * margin keeps the layout (gap to the next word) visually unchanged. */
.hero__tagline em,
.section__title em,
.orh__title em,
.contact__title em,
.manifesto__quote em,
.foot__sub em {
  padding-inline-end: 0.08em;
  margin-inline-end: -0.06em;
}

/* ───────── "Mon métier" custom-trade banner ─────────
 * Sits above the .ind grid. Hooks into the sunset gradient so it reads
 * as a hot spot inviting input, while staying in the design system. */
.ind-custom {
  margin-bottom: 16px;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background:
    linear-gradient(135deg,
      color-mix(in oklab, var(--grad-1) 12%, var(--bg-elevated)),
      color-mix(in oklab, var(--grad-2) 8%, var(--bg-elevated)) 60%,
      color-mix(in oklab, var(--grad-3) 5%, var(--bg-elevated)));
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.ind-custom__label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  line-height: 1.2;
  color: var(--ink);
  flex-shrink: 0;
}
.ind-custom__label > span:first-child {
  font-size: 20px;
  filter: drop-shadow(0 1px 4px color-mix(in oklab, var(--grad-2) 60%, transparent));
}
.ind-custom__form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 280px;
  flex-wrap: wrap;
}
.ind-custom__form input {
  flex: 1;
  min-width: 200px;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--r-pill);
  padding: 11px 18px;
  font: inherit;
  color: var(--fg);
  font-size: 14px;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.ind-custom__form input:focus {
  outline: 0;
  border-color: var(--grad-2);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--grad-2) 18%, transparent);
}
.ind-custom__form button[type="submit"] {
  appearance: none;
  border: 0;
  background: linear-gradient(118deg, var(--grad-1), var(--grad-2), var(--grad-3));
  background-size: 180% 180%;
  background-position: 0% 50%;
  color: var(--ink);
  border-radius: var(--r-pill);
  padding: 11px 18px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-position var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out),
              opacity var(--dur-base) var(--ease-out);
}
.ind-custom__form button[type="submit"]:not(:disabled):hover {
  background-position: 100% 50%;
  transform: translateY(-1px);
}
.ind-custom__form button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ind-custom__reset {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--r-pill);
  padding: 9px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.ind-custom__reset:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.ind-custom__error {
  width: 100%;
  font-size: 13px;
  color: var(--tomato-deep);
  font-style: italic;
}

/* Loading state inside the transcript area while the agent generates. */
.ind__transcript--loading {
  align-items: center;
  justify-content: center;
}
.ind-loading {
  text-align: center;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--fg-muted);
}
.ind-loading p {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  line-height: 1.2;
  color: var(--ink);
}
.ind-loading__sub {
  font-family: var(--font-body) !important;
  font-style: normal !important;
  font-size: 13px !important;
  color: var(--fg-muted) !important;
  letter-spacing: 0.04em;
}
.ind-loading__dots {
  display: inline-flex;
  gap: 8px;
}
.ind-loading__dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-2), var(--grad-3));
  animation: ind-pulse 1.2s ease-in-out infinite;
}
.ind-loading__dots span:nth-child(2) { animation-delay: 0.18s; }
.ind-loading__dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes ind-pulse {
  0%, 80%, 100% { opacity: 0.35; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.15); }
}

@media (max-width: 720px) {
  .ind-custom {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  /* A2: allow the reset button to wrap onto its own row, keep input + Voir on the first row */
  .ind-custom__form {
    flex-wrap: wrap;
    gap: 8px;
  }
  .ind-custom__form input { width: 100%; flex: 1 1 100%; min-width: 0; }
  .ind-custom__form button[type="submit"] {
    flex: 1 1 auto;
    min-height: 44px;
    justify-content: center;
  }
  .ind-custom__reset {
    flex: 0 0 auto;
    min-height: 44px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
 * MOBILE IMPROVEMENTS (Axes A, B, D, E from the implementation plan)
 * ───────────────────────────────────────────────────────────────────────── */

/* A4 + D1: enlarge industries sidebar buttons on mobile; signal horizontal scroll */
@media (max-width: 900px) {
  .ind__sidebar {
    gap: 4px;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
            mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
  }
  .ind__btn {
    padding: 12px 16px;
    min-height: 44px;
    font-size: 13px;
  }
}

/* D1: enlarge dot indicators on the work carousel for fat fingers */
@media (max-width: 720px) {
  .car__dots { gap: 4px; padding: 4px 0; }
  .car__dots .dot { padding: 6px; background-clip: content-box; box-sizing: content-box; }
}

/* D1: lang-toggle larger tap targets on mobile */
@media (max-width: 720px) {
  .lang-toggle button { padding: 10px 14px; font-size: 13px; }
  .modal__x { width: 44px; height: 44px; }
  .chat-panel__x { width: 36px; height: 36px; }
}

/* A1: hero shrinks on mobile so the signals strip stays in the first viewport, plus scroll caret */
@media (max-width: 720px) {
  .hero__inner { min-height: clamp(560px, 76vh, 720px); }
  .hero__copy { padding: 56px 0 40px; }
  .hero__eyebrow { margin-bottom: 24px; }
  .hero__lede { margin-top: 24px; }
  .hero__ctas { margin-top: 24px; gap: 10px; }
  .hero__ctas .btn { width: 100%; justify-content: center; }
  .hero__signals { margin-top: 36px; padding-top: 20px; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
  .hero__signals .signal { border-right: 0; border-bottom: 1px solid rgba(244,239,230, 0.18); padding: 0 0 12px; }
  .hero__signals .signal:nth-last-child(-n+2) { border-bottom: 0; padding-bottom: 0; }
  /* B4: hero copy padding reduction */
  .hero__copy { max-width: 100%; }
}

/* A1 (cont.): subtle "scroll for more" caret under the hero — only on mobile */
.hero__scroll {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--cream);
  opacity: 0.7;
  pointer-events: none;
  animation: hero-scroll-bounce 1.8s ease-in-out infinite;
}
@keyframes hero-scroll-bounce {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.55; }
  50%      { transform: translate(-50%, 6px); opacity: 1; }
}
@media (max-width: 720px) {
  .hero__scroll { display: inline-flex; }
}
@media (prefers-reduced-motion: reduce) {
  .hero__scroll { animation: none; }
}

/* A3: ORH caption fits within the screen at 375px */
@media (max-width: 720px) {
  .orh__caption {
    left: 12px;
    right: 12px;
    bottom: 16px;
    max-width: none;
    font-size: 14px;
    padding: 10px 14px;
    line-height: 1.3;
  }
}

/* B1: a bit more breathing room between section heads and content on mobile */
@media (max-width: 720px) {
  :root { --section-pad: 64px !important; }
  .section__head { margin-bottom: 36px; }
}

/* B2: inline the section index with the title on very narrow screens */
@media (max-width: 540px) {
  .section__index {
    font-size: 11px;
    margin-bottom: -8px;
  }
}

/* B3: tighten marquee spacing on small screens, slow it down slightly */
@media (max-width: 720px) {
  .marquee__track { animation-duration: 80s; }
  .marquee__track > span { padding: 0 22px; }
  .marquee__track > span + span::before { margin-right: 22px; margin-left: -22px; }
}

/* D2: focus-visible coverage on interactive controls that miss it */
.ind-custom__form input:focus-visible,
.ind-custom__form button:focus-visible,
.ind-custom__reset:focus-visible,
.book__day:focus-visible,
.book__slot:focus-visible,
.car__dots .dot:focus-visible,
.car__nav button:focus-visible,
.modal__tab:focus-visible,
.chat-panel__suggestions button:focus-visible,
.chat-panel__compose button:focus-visible,
.cform__submit:focus-visible,
.book__cta:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

/* D3: kill all decorative animations when the user prefers reduced motion.
 * The design CSS already wraps a couple — this is a catch-all safety net. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* E3: scroll-driven hero parallax in supporting browsers (Chrome 115+, Safari 26+) */
@supports (animation-timeline: scroll()) {
  .hero__art img {
    animation: hero-parallax linear both;
    animation-timeline: scroll(root);
    animation-range: 0 100vh;
  }
  @keyframes hero-parallax {
    to { transform: scale(1.18) translateY(-3%); }
  }
}

/* E4: spring tap feedback on industry sidebar buttons */
.ind__btn {
  transition:
    background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ind__btn:active { transform: scale(0.95); }

/* E5: subtle fade-out at the right edge of the work carousel, hinting scroll */
@media (min-width: 0px) {
  .car__rail {
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 48px), transparent 100%);
            mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 48px), transparent 100%);
  }
}

/* E7: tone down hero orb on touch devices so the copy reads cleanly */
@media (hover: none) and (pointer: coarse) {
  .hero__orb { opacity: 0.55; }
}

/* ─── Mobile nav drawer (E1) ─── */
.nav__hamburger {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  cursor: pointer;
}
.nav__hamburger:hover { background: color-mix(in oklab, var(--ink) 6%, transparent); }
@media (max-width: 720px) {
  .nav__hamburger { display: inline-flex; }
}

.mnav {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}
.mnav__overlay {
  position: absolute;
  inset: 0;
  background: color-mix(in oklab, var(--ink) 50%, transparent);
  opacity: 0;
  transition: opacity 280ms var(--ease-out);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}
.mnav__sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(20px);
          backdrop-filter: saturate(140%) blur(20px);
  border-top: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 14px 20px 28px;
  transform: translateY(100%);
  transition: transform 320ms var(--ease-out);
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 -16px 40px rgba(0,0,0,0.18);
  max-height: 88vh;
  overflow-y: auto;
}
.mnav[data-open="true"] { pointer-events: auto; }
.mnav[data-open="true"] .mnav__overlay { opacity: 1; }
.mnav[data-open="true"] .mnav__sheet { transform: none; }

.mnav__handle {
  width: 44px; height: 4px;
  border-radius: 2px;
  background: var(--grey-25);
  margin: 0 auto 14px;
  opacity: 0.5;
}
.mnav__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.mnav__title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 26px;
  letter-spacing: var(--tracking-tight);
  margin: 0;
  font-weight: 400;
}
.mnav__title em {
  background: linear-gradient(118deg, var(--grad-1), var(--grad-2), var(--grad-3));
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  font-style: italic;
  padding-inline-end: 0.08em;
  margin-inline-end: -0.06em;
}
.mnav__close {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px; height: 36px;
  cursor: pointer;
  color: var(--fg-muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.mnav__close:hover { color: var(--ink); border-color: var(--ink); }

.mnav__products-label {
  margin: 12px 4px 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.mnav__links {
  list-style: none;
  margin: 4px 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.mnav__links--products {
  margin-top: 4px;
}
.mnav__links a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 17px;
  color: var(--ink);
  transition: padding var(--dur-fast) var(--ease-out);
}
.mnav__links a:active { padding-left: 10px; }
.mnav__links a::after {
  content: "→";
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  color: var(--fg-muted);
}
.mnav__links li:last-child a { border-bottom: 0; }

.mnav__foot {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 6px;
}
.mnav__foot .lang-toggle { flex-shrink: 0; }
.mnav__foot .nav__cta { flex: 1; justify-content: center; min-height: 48px; font-size: 15px; padding: 12px 18px; }

/* ─── Sticky mobile CTA (E2) ─── */
.sticky-cta {
  position: fixed;
  left: 12px; right: 12px;
  bottom: 12px;
  z-index: 70;
  display: none;
  transform: translateY(120%);
  transition: transform 360ms var(--ease-out), opacity 280ms var(--ease-out);
  opacity: 0;
}
.sticky-cta[data-visible="true"] { transform: none; opacity: 1; }
.sticky-cta button {
  appearance: none;
  border: 0;
  width: 100%;
  min-height: 52px;
  border-radius: var(--r-pill);
  background: linear-gradient(118deg, var(--grad-1), var(--grad-2), var(--grad-3));
  background-size: 200% 200%;
  background-position: 0% 50%;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18), 0 0 0 1px rgba(21,18,15,0.06);
  transition: background-position var(--dur-base) var(--ease-out), transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sticky-cta button:active { transform: scale(0.97); }
.sticky-cta button:hover { background-position: 100% 50%; }
@media (max-width: 720px) {
  .sticky-cta { display: block; }
}
/* Make sure the floating chat button doesn't collide with the sticky CTA */
@media (max-width: 720px) {
  .chat-btn { bottom: 88px; }
  .chat-panel { bottom: 152px; }
}

/* ─── GDPR / cookie consent banner ─── */
.cookie {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: var(--ink);
  color: var(--cream);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.22);
  border-top: 1px solid color-mix(in oklab, var(--grad-2) 28%, transparent);
  animation: cookie-rise 320ms var(--ease-out) both;
}
@keyframes cookie-rise {
  from { transform: translateY(100%); }
  to { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cookie { animation: none; }
}
.cookie__text {
  flex: 1 1 320px;
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: color-mix(in oklab, var(--cream) 88%, transparent);
  max-width: 640px;
}
.cookie__link {
  color: var(--cream);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--grad-2) 60%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-fast) var(--ease-out);
}
.cookie__link:hover { text-decoration-color: var(--grad-2); }
.cookie__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.cookie__btn {
  appearance: none;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: var(--r-pill);
  cursor: pointer;
  min-height: 44px;
  transition:
    background var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}
.cookie__btn:hover { transform: translateY(-1px); }
.cookie__btn--ghost {
  border-color: rgba(244, 239, 230, 0.28);
}
.cookie__btn--ghost:hover {
  background: rgba(244, 239, 230, 0.08);
  border-color: rgba(244, 239, 230, 0.6);
}
.cookie__btn--accept {
  background: linear-gradient(118deg, var(--grad-1), var(--grad-2), var(--grad-3));
  background-size: 180% 180%;
  background-position: 0% 50%;
  color: var(--ink);
  font-weight: 500;
  transition: background-position var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
  box-shadow: 0 4px 14px rgba(224, 122, 59, 0.32);
}
.cookie__btn--accept:hover {
  background-position: 100% 50%;
  box-shadow: 0 8px 24px rgba(224, 122, 59, 0.4);
}
.cookie__btn:focus-visible { box-shadow: var(--focus-ring); outline: 0; }

/* While the cookie banner is up, push the floating UI out of its way */
body.has-cookie-banner .chat-btn { display: none; }
body.has-cookie-banner .chat-panel { display: none; }
body.has-cookie-banner .sticky-cta { display: none !important; }

@media (max-width: 720px) {
  .cookie {
    padding: 16px 16px 18px;
    gap: 14px;
    flex-direction: column;
    align-items: stretch;
  }
  .cookie__text { font-size: 13px; max-width: none; }
  .cookie__actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .cookie__btn { padding: 12px 14px; font-size: 13px; justify-content: center; display: inline-flex; align-items: center; }
  .cookie__btn--accept {
    grid-column: 1 / -1;
  }
}

/* ─── Footer mobile fix ───
 * The design CSS has `.foot { padding: var(--section-pad) 0 48px; }` which
 * unintentionally cancels the `.shell` horizontal padding, so the footer
 * sits flush to the left edge of the viewport. Restore the gutter, and
 * compact the 4 columns into a 2×2 grid so the footer stops being a
 * 1000px-tall scroll well on mobile. */
.foot {
  padding-inline: var(--gutter);
}

@media (max-width: 720px) {
  .foot { padding-top: 48px; padding-bottom: 32px; }
  .foot__grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px 20px;
  }
  /* Brand mark spans both columns on the first row, then the 3 link blocks
     flow into 2 cols (col1: Work with us, col2: Our builds, then Contact
     wraps to the next row spanning both for breathing room). */
  .foot__mark { grid-column: 1 / -1; gap: 12px; }
  .foot__mark img { width: 48px !important; height: 48px !important; }
  .foot__sub { font-size: 20px; max-width: none; }
  .foot__col h5 { margin-bottom: 12px; }
  .foot__col ul { gap: 8px; }
  .foot__col a { font-size: 13px; line-height: 1.4; }
  /* Last column (Contact) takes the full bottom row */
  .foot__col:last-of-type { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--border); }
  .foot__col:last-of-type ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
  }
  .foot__base {
    margin-top: 40px;
    padding-top: 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    font-size: 10px;
  }
}
