/*
 * V122 — stabilization layer
 *
 * This is deliberately narrow.  It fixes demonstrated width constraints in
 * the travel-journal drawer and establishes shrinkable layout boundaries;
 * it does not hide horizontal overflow to mask a layout defect.
 */

html,
body,
#root,
.experience,
.chapter-day0,
.chapter-day1,
.chapter-day2,
.chapter-day3,
.chapter-day4,
.journey-menu,
.object-ledger {
  min-width: 0;
}

/* Grid and flex children must be allowed to shrink around long labels. */
.journey-menu :is(section, article, div, button, a, span, p, b, small),
.object-ledger :is(section, article, div, button, a, span, p, b, small) {
  min-width: 0;
}

/* Media must never define the width of a drawer or a scene panel. */
.journey-menu :is(img, video, canvas),
.object-ledger :is(img, video, canvas) {
  max-width: 100%;
}

/*
 * V152 forced 5 × 84–120 px tabs plus a 140 px "J5 → J7" cell.  In the
 * 470 px travel drawer this creates a real 600 px minimum width and the
 * desktop horizontal scrollbar seen in review.  A three-column itinerary
 * preserves the day/location hierarchy while remaining intrinsically fluid.
 */
.v41-journal .journal-day-tabs {
  position: relative;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 7px !important;
  padding: 12px !important;
  border: 1px solid rgba(23, 56, 70, .1);
  border-radius: 20px;
  background: rgba(225, 211, 189, .52);
}

.v41-journal .journal-day-tabs > span {
  grid-column: auto;
}

.v41-journal .journal-day-tabs :is(button, span) {
  position: relative;
  min-height: 70px !important;
  padding: 12px 10px !important;
  border-color: rgba(23, 56, 70, .09) !important;
  border-radius: 14px !important;
  background: rgba(255, 250, 241, .7) !important;
  color: #294b54 !important;
  box-shadow: none !important;
  overflow-wrap: anywhere;
}

.v41-journal .journal-day-tabs button:not(:disabled):hover,
.v41-journal .journal-day-tabs button:focus-visible {
  border-color: rgba(158, 83, 68, .5) !important;
  background: #fffaf1 !important;
  transform: translateY(-1px);
}

.v41-journal .journal-day-tabs button.active {
  border-color: #a75a4c !important;
  background: #fffaf1 !important;
  color: #173846 !important;
  box-shadow: inset 0 3px #a75a4c, 0 9px 20px rgba(67, 49, 36, .09) !important;
}

.v41-journal .journal-day-tabs button:disabled,
.v41-journal .journal-day-tabs > span {
  opacity: 1 !important;
  border-style: dashed !important;
  background: rgba(239, 231, 216, .62) !important;
  color: #8b8379 !important;
}

.v41-journal .journal-day-tabs small {
  margin-top: 4px;
  color: inherit;
  font-size: 9px !important;
  line-height: 1.25;
}

@media (min-width: 521px) and (max-width: 820px) {
  .v41-journal .journal-day-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 520px) {
  .v41-journal .journal-day-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    padding: 9px !important;
  }

  .v41-journal .journal-day-tabs > span {
    grid-column: 1 / -1;
  }

  .v41-journal .journal-title-row {
    align-items: start;
  }

  .v41-journal .journal-title-row h3 {
    font-size: clamp(30px, 9vw, 38px) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .journey-menu {
    animation: none !important;
  }
}

/*
 * The inherited menu was a 470 px white drawer laid over a still-visible
 * scene.  On desktop it read as two unrelated sites.  The travel objects now
 * open as one full-viewport "travel desk" with a single centered surface.
 */
.journey-menu.v38-menu {
  inset: 0 !important;
  /* `inset: 0` already defines the viewport width.  `100vw` also counts the
     desktop scrollbar and can therefore create a real 10–17 px overflow. */
  width: auto !important;
  max-width: none !important;
  height: 100dvh !important;
  padding: clamp(22px, 4vw, 56px) !important;
  background:
    radial-gradient(circle at 78% 12%, rgba(180, 105, 80, .18), transparent 32%),
    linear-gradient(145deg, rgba(6, 24, 32, .97), rgba(17, 53, 63, .985)) !important;
  overflow: auto !important;
  border: 0 !important;
  box-shadow: none !important;
}

.journey-menu.v38-menu > header,
.journey-menu.v38-menu > .journey-menu-home,
.journey-menu.v38-menu > .object-ledger {
  width: min(1120px, 100%) !important;
  margin-inline: auto !important;
}

.journey-menu.v38-menu > header {
  position: relative !important;
  top: auto !important;
  border-radius: 24px 24px 0 0 !important;
  background:
    linear-gradient(120deg, rgba(239, 229, 212, .98), rgba(247, 241, 230, .98)) !important;
  color: #153744 !important;
  border-bottom: 1px solid rgba(21, 55, 68, .12) !important;
}

.journey-menu.v38-menu > .journey-menu-home,
.journey-menu.v38-menu > .object-ledger {
  min-height: calc(100dvh - clamp(170px, 20vh, 220px));
  border-radius: 0 0 24px 24px !important;
  background:
    linear-gradient(180deg, rgba(247, 240, 228, .995), rgba(234, 221, 200, .995)) !important;
  box-shadow: 0 34px 90px rgba(0, 0, 0, .36) !important;
}

.journey-menu.v38-menu > .journey-menu-close {
  position: fixed !important;
  z-index: 240 !important;
  top: max(14px, env(safe-area-inset-top)) !important;
  right: max(14px, env(safe-area-inset-right)) !important;
  width: 50px !important;
  height: 50px !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, .5) !important;
  border-radius: 50% !important;
  background: rgba(8, 31, 39, .76) !important;
  color: #fff !important;
  backdrop-filter: blur(12px);
}

@media (max-width: 700px) {
  .journey-menu.v38-menu {
    padding: 0 !important;
    background: #efe5d4 !important;
  }

  .journey-menu.v38-menu > header {
    border-radius: 0 !important;
    padding-top: max(70px, calc(env(safe-area-inset-top) + 56px)) !important;
  }

  .journey-menu.v38-menu > .journey-menu-home,
  .journey-menu.v38-menu > .object-ledger {
    border-radius: 0 !important;
    min-height: 0;
    box-shadow: none !important;
  }
}

/* Editorial journal layers: overview first, details on demand. */
.v41-journal .journal-detail {
  overflow: hidden;
  border: 1px solid rgba(23, 56, 70, .1);
  border-radius: 18px;
  background: rgba(255, 250, 241, .86);
}

.v41-journal .journal-detail > summary {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  color: #173846;
  cursor: pointer;
  list-style: none;
}

.v41-journal .journal-detail > summary::-webkit-details-marker {
  display: none;
}

.v41-journal .journal-detail > summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8ddca;
  color: #8d5548;
  font: 500 20px/1 Georgia, serif;
}

.v41-journal .journal-detail[open] > summary::after {
  content: "−";
}

.v41-journal .journal-detail > summary > span {
  font: 600 clamp(23px, 2.2vw, 30px)/1.05 Georgia, serif;
}

.v41-journal .journal-detail > summary > small {
  color: #806f62;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.v41-journal .journal-detail-body {
  padding: 0 18px 18px;
}

.v41-journal .journal-detail-body > ul {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.v41-journal .journal-detail-body > ul > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(23, 56, 70, .08);
  font-size: 12px;
  line-height: 1.45;
}

.v41-journal .journal-detail-body > ul > li:last-child {
  border-bottom: 0;
}

.v41-journal .journal-detail-body > ul > li b {
  color: #39715f;
}

.v41-journal .journal-memory-choices .journal-detail-body {
  padding-top: 2px;
}

.v41-journal .journal-language .journal-detail-body > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

@media (max-width: 620px) {
  .v41-journal .journal-detail > summary {
    min-height: 66px;
    grid-template-columns: minmax(0, 1fr) 28px;
    padding: 13px 14px;
  }

  .v41-journal .journal-detail > summary > small {
    display: none;
  }

  .v41-journal .journal-detail-body {
    padding: 0 14px 14px;
  }

  .v41-journal .journal-language .journal-detail-body > div {
    grid-template-columns: 1fr;
  }
}

/*
 * The cruise now uses the illustrated continuity master rather than the
 * photographic legacy clip. Subtle camera drift and moving reflections keep
 * the river alive without turning the scene into a video player.
 */
.v128-cruise-illustrated .v104-bg {
  inset: -3%;
  transform: scale(1.035);
  filter: saturate(.92) contrast(1.03) brightness(.82);
  animation: dobox-cruise-drift 14s ease-in-out infinite alternate;
  transition: transform 1.5s cubic-bezier(.2,.7,.2,1), filter 1.2s ease;
}

.v128-cruise-illustrated.focus-shore .v104-bg,
.v128-cruise-illustrated.focus-yatai .v104-bg {
  animation: none;
  transform: scale(1.075) translate3d(-1.8%, -.2%, 0);
}

.v128-cruise-illustrated.focus-water .v104-bg {
  animation: none;
  transform: scale(1.09) translate3d(0, -2.2%, 0);
  filter: saturate(.86) contrast(1.04) brightness(.74);
}

.v128-cruise-illustrated.focus-voices .v104-bg,
.v128-cruise-illustrated.focus-overhead .v104-bg {
  animation: none;
  transform: scale(1.065) translate3d(.8%, .8%, 0);
  filter: saturate(.82) contrast(1.04) brightness(.7);
}

@keyframes dobox-cruise-drift {
  from { transform: scale(1.035) translate3d(-.2%, 0, 0); }
  to { transform: scale(1.055) translate3d(.3%, -.25%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .v128-cruise-illustrated .v104-bg {
    animation: none !important;
  }
}

/* The taxi route clip is a 9:16 mobile master. Covering a 16:9 desktop with
   it upscaled 2.6× and discarded most of the frame. Desktop uses the existing
   landscape taxi-window master; phone keeps the moving portrait route. */
@media (min-width: 701px) {
  .chapter-day1.d1-ride .taxi-route-video {
    display: none !important;
  }

  .chapter-day1.d1-ride .world-image {
    opacity: 1 !important;
    background-position: center !important;
    animation: dobox-taxi-window-drift 12s ease-in-out infinite alternate !important;
  }
}

@keyframes dobox-taxi-window-drift {
  from { transform: scale(1.035) translate3d(-.25%, 0, 0); }
  to { transform: scale(1.055) translate3d(.3%, -.2%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .chapter-day1.d1-ride .world-image {
    animation: none !important;
  }
}

/*
 * Authentication is part of the journey, not a generic account pop-up.
 * Desktop uses a passport cover as the quiet visual half; phone keeps the
 * form as the only focal point. The old French-only generated helper line is
 * explicitly removed so the English UI cannot inherit untranslated copy.
 */
.auth-mode-login .auth-card header::after {
  content: none !important;
  display: none !important;
}

.auth-shell {
  padding: clamp(16px, 3vw, 42px) !important;
  background:
    radial-gradient(circle at 18% 20%, rgba(72, 137, 151, .2), transparent 30%),
    linear-gradient(135deg, rgba(3, 19, 27, .93), rgba(7, 38, 48, .97)) !important;
}

.auth-card {
  position: relative;
  width: min(920px, 100%) !important;
  max-height: calc(100dvh - clamp(32px, 6vw, 84px)) !important;
  display: grid !important;
  grid-template-columns: minmax(280px, .82fr) minmax(360px, 1.18fr);
  padding: 0 !important;
  overflow: auto !important;
  border: 1px solid rgba(244, 224, 187, .28);
  border-radius: 28px !important;
  background: #f4eadb !important;
  box-shadow: 0 36px 110px rgba(0, 0, 0, .5) !important;
}

.auth-card > header {
  position: relative;
  min-height: 590px;
  display: flex !important;
  align-items: flex-end !important;
  padding: 42px 34px !important;
  overflow: hidden;
  border: 0 !important;
  background:
    linear-gradient(180deg, rgba(6, 27, 38, .08), rgba(4, 23, 32, .84)),
    url("../assets/passeport-ferme.webp") center 42% / 88% auto no-repeat,
    linear-gradient(145deg, #173e4b, #081e2a);
  color: #fff9ed;
}

.auth-card > header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 35% 18%, rgba(245, 193, 105, .16), transparent 30%);
}

.auth-card > header > div {
  position: relative;
  z-index: 1;
}

.auth-card > header small {
  color: #f2c980 !important;
  font-size: 10px !important;
}

.auth-card > header h2 {
  max-width: 9ch;
  margin: 10px 0 12px !important;
  color: #fff9ed !important;
  font-size: clamp(42px, 4.4vw, 62px) !important;
  line-height: .94 !important;
}

.auth-card > header p {
  max-width: 36ch !important;
  color: rgba(255, 249, 237, .78) !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
}

.auth-card > header .auth-close {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 18px;
  width: 48px;
  height: 48px;
  border-color: rgba(255,255,255,.38) !important;
  background: rgba(4, 25, 34, .58) !important;
  color: #fff !important;
  backdrop-filter: blur(10px);
}

.auth-card > .auth-form {
  align-content: center;
  gap: 15px !important;
  margin: 0 !important;
  padding: clamp(34px, 5vw, 62px) !important;
}

.auth-form label {
  gap: 7px !important;
  color: #526a70;
  font-size: 10px !important;
  letter-spacing: .1em !important;
  text-transform: uppercase;
}

.auth-form input {
  min-height: 54px !important;
  border-radius: 12px !important;
  background: rgba(255, 252, 246, .95) !important;
}

.auth-submit {
  min-height: 56px !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #a34f43, #843d36) !important;
  box-shadow: 0 14px 28px rgba(115, 48, 42, .22);
  font-size: 14px !important;
}

.auth-submit:hover:not(:disabled),
.auth-submit:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 17px 34px rgba(115, 48, 42, .28);
}

.auth-forgot {
  min-height: 44px;
  justify-self: start;
  padding: 8px 2px !important;
  font-size: 12px !important;
  text-underline-offset: 4px;
}

.auth-close:focus-visible,
.auth-submit:focus-visible,
.auth-forgot:focus-visible,
.auth-form input:focus-visible {
  outline: 3px solid rgba(238, 177, 136, .72) !important;
  outline-offset: 3px;
}

@media (max-width: 700px) {
  .auth-shell {
    align-items: end !important;
    padding: 0 !important;
  }

  .auth-card {
    width: 100% !important;
    max-height: 96dvh !important;
    display: block !important;
    border-radius: 24px 24px 0 0 !important;
  }

  .auth-card > header {
    min-height: 0;
    padding: 30px 72px 20px 20px !important;
    background:
      radial-gradient(circle at 12% 0, rgba(242, 197, 118, .16), transparent 30%),
      linear-gradient(135deg, #123847, #092631);
  }

  .auth-card > header h2 {
    max-width: 12ch;
    font-size: clamp(34px, 10vw, 44px) !important;
  }

  .auth-card > header p {
    font-size: 12px !important;
  }

  .auth-card > .auth-form {
    padding: 22px 18px max(24px, env(safe-area-inset-bottom)) !important;
  }
}

/*
 * The threshold now contains two journey actions, three proof points and six
 * legal links. The scene shell clips cinematic chapters by design, so the
 * landing needs its own vertical scroll surface on short phones instead of
 * losing the final links below the viewport.
 */
@media (max-width: 700px), (max-height: 720px) {
  .chapter-threshold .interaction-layer {
    overflow-x: clip;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .chapter-threshold .threshold {
    width: 100% !important;
    min-height: 100dvh !important;
    justify-content: flex-end !important;
    box-sizing: border-box;
  }
}

@media (max-width: 390px) {
  .chapter-threshold .threshold {
    padding-right: 18px !important;
    padding-left: 18px !important;
  }

  .chapter-threshold .threshold h1 {
    font-size: clamp(58px, 19vw, 70px) !important;
  }

  .chapter-threshold .tagline {
    font-size: clamp(24px, 7.2vw, 28px) !important;
  }
}
