/* Each chapter owns the complete approach, reading interval and exit. */
#journey { --panel-radius: 14px; }
#journey #cala .hero-panel,
#journey .chapter .field-case,
#journey #torre .tower-copy,
#journey #contatti .wrap,
dialog#proposal, dialog#dashboard-view { border-radius: 14px; }

#journey .chapter:not(.portfolio-stage) {
  --header-clearance: 124px;
  --rest: clamp(250px, 56svh, 570px);
  --sightline: 21svh;
  --entry: max(var(--header-clearance), min(var(--sightline), calc(100svh - var(--card-height, 380px) - 22px)));
  padding-block: var(--entry) clamp(50px, 9svh, 100px);
  min-height: calc(var(--entry) + var(--card-height, 380px) + var(--rest) + clamp(50px, 9svh, 100px));
}
#journey .chapter:not(.portfolio-stage) > .copy {
  position: sticky;
  top: var(--entry);
  align-self: flex-start;
  max-height: none;
}
#journey .chapter.read-through > .copy { position: static; }
#journey .chapter.read-through { --rest: 0px; }
@media(max-width:760px) {
  #journey .chapter:not(.portfolio-stage) { --header-clearance: max(90px, calc(env(safe-area-inset-top) + 76px)); --sightline: 34svh; --rest: 42svh; }
  #journey .chapter.read-through { --rest: 0px; }
}
@media(prefers-reduced-motion:reduce) {
  #journey .chapter:not(.portfolio-stage) { --rest: 0px; }
  #journey .chapter:not(.portfolio-stage) > .copy { position: static; }
}

#journey #torre #landmarks:not([hidden]) {
  position: static;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 12px 0 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}
#journey #torre #landmarks button {
  position: static;
  transform: none;
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  border-top: 1px solid #adc7bc;
  border-radius: 0;
  text-align: left;
  white-space: normal;
  background: transparent;
  color: #13434a;
  box-shadow: none;
}
#journey #torre #landmarks button::after { display: none; }
#journey #torre #landmarks button:is(:hover, :focus-visible) { background: #e1eee7; }

#journey :is(#metodo, #team) {
  display: block;
  padding-block: 0 clamp(144px, 34svh, 300px);
  background: var(--reading-surface);
  scroll-margin-top: var(--header-clearance, 124px);
}
#metodo { --reading-surface: #123d45; }
#team { --reading-surface: var(--paper); }
.reading-panel {
  position: sticky;
  top: var(--header-clearance, 124px);
  padding-block: clamp(24px, 4svh, 46px);
  background: var(--reading-surface);
}
#metodo .reading-panel { display: grid; gap: clamp(26px, 5svh, 48px); }
#journey .read-through > .reading-panel { position: static; }
#journey :is(#metodo, #team).read-through { padding-bottom: 32px; }
.read-through .reading-panel h2 {
  position: sticky;
  top: var(--header-clearance, 124px);
  z-index: 1;
  padding-block: 10px;
  background: var(--reading-surface);
}
#metodo#metodo.read-through .reading-panel { gap: 22px; }
@media (max-height: 540px), (prefers-reduced-motion: reduce) {
  #journey :is(#metodo, #team) { padding-bottom: 24px; }
  #journey .reading-panel, #journey .reading-panel h2 { position: static; }
}

/* The coast stays visible beside the introduction, then gives way to reading. */
#journey #cala .hero-panel {
  width: min(52vw, 720px);
  background: #f4f7ee;
  padding: clamp(23px, 4vw, 58px);
  border-radius: 14px;
}
#cala .hero-label { margin: 0 0 20px; color: #245856; font-size: 16px; }
#cala h1 { font-size: clamp(56px, 7.2vw, 110px); line-height: .92; margin-bottom: 22px; }
#cala h1 em { display: block; color: #0e696a; }
#cala .lead { max-width: 34ch; }
#cala .hero-actions { gap: 12px; flex-wrap: wrap; margin: 22px 0 0; }
#cala .hero-actions a { min-height: 48px; padding: 10px 16px; border-radius: 8px; }
#cala .hero-explore { border: 1px solid #93aca2; text-decoration: none; gap: 9px; }
#cala .hero-explore:hover { background: #e1eee5; }

#journey .field-case .case-result { border-radius: 8px; }
#journey #torre #landmarks button { display: grid; gap: 4px; padding: 10px 6px; }
#journey #torre #landmarks button span { color: #315e5c; font-size: 16px; }
#journey :is(#metodo, #team) {
  padding-block: var(--header-clearance, 124px) clamp(160px, 38svh, 350px);
}
#metodo.read-through .method-intro { display: contents; }
#metodo .method-steps li { padding-bottom: 10px; margin-bottom: 12px; }
#metodo .method-steps p { margin-top: 7px; }
#team .people article { padding-block: 15px; }
@media (max-width: 760px) {
  #journey #cala .hero-panel { width: 100%; padding: 22px; }
  #cala h1 { font-size: clamp(45px, 12vw, 64px); }
  #cala .hero-label { margin-bottom: 13px; }
  #cala .hero-actions a { padding-inline: 12px; }
  #journey :is(#metodo, #team) .reading-panel { padding-block: 16px; }
  #metodo .reading-panel { gap: 18px; }
  #metodo h2, #team h2 { font-size: clamp(34px, 9vw, 49px); }
  #team h2 { margin-bottom: 17px; }
  #team .people { gap: 14px; }
  #team .people article > p { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce), (max-height: 540px) {
  #journey :is(#metodo, #team) { padding-bottom: 24px; }
}

/* A real trailing block extends the sticky containing area. Section padding cannot. */
@media (min-height: 541px) and (prefers-reduced-motion: no-preference) {
  #journey :is(#metodo, #team) { padding-bottom: 32px; }
  #journey :is(#metodo, #team):not(.read-through)::after {
    content: "";
    display: block;
    height: clamp(160px, 38svh, 350px);
  }
}

/* Keep the timeline in its own gutter, independent of card alignment. */
#journey .chapter:not(.portfolio-stage) {
  --timeline-inset: max(3vw, 16px);
  --chapter-exit: clamp(76px, 11svh, 110px);
  padding-inline-start: max(6vw, 54px);
  padding-bottom: var(--chapter-exit);
  min-height: calc(var(--entry) + var(--card-height, 380px) + var(--rest) + var(--chapter-exit));
}
#journey .chapter::before,
#journey .chapter::after {
  content: "";
  position: absolute;
  inset-inline-start: var(--timeline-inset);
  transform: translateX(-50%);
  pointer-events: none;
}
#journey .chapter::before {
  inset-block: 0;
  width: 2px;
  background: #f6f4dc;
  box-shadow: 0 0 0 1px #174e5336;
}
#journey .chapter::after {
  inset-block-start: calc(var(--entry) + 30px);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #faf4db;
  border: 2px solid #1b5c5d;
}
@media (max-width: 760px) {
  #journey .chapter:not(.portfolio-stage) {
    --timeline-inset: 14px;
    padding-inline: 36px 16px;
  }
  #journey .chapter::after { width: 10px; height: 10px; }
}
#journey .chapter.read-through > .copy { position: relative; top: auto; }
#journey .story-stop, #journey .hero-label {
  margin: 0 0 14px;
  color: #225f5d;
  font-size: 16px;
  line-height: 1.35;
}
#journey #metodo .story-stop, #journey .stock-case .story-stop { color: #aee9d1; }
#journey #cala h1 { font-size: clamp(48px, 6vw, 90px); max-width: 11ch; }
#journey #cala .hero-panel { background: #f1f6eadd; }
#journey .field-case .story-beat {
  border-inline-start: 2px solid currentColor;
  padding-inline-start: 13px;
  margin-block: 14px 20px;
}
#journey #torre #landmarks .station-number { margin-inline-end: 6px; font-variant-numeric: tabular-nums; }
#journey #metodo .method-intro .story-stop { grid-column: 1/-1; }
#journey #metodo .method-intro { row-gap: 8px; }
.service-computer {
  background: #152d35;
  padding: 12px;
  border-radius: 12px;
  margin: 8px 0 22px;
}
#service-screen {
  background: #e4f3e6;
  color: #123d45;
  padding: 18px;
  border-radius: 5px;
}
#service-screen-title { font-weight: 700; margin: 0 0 12px; }
#service-screen-steps { margin: 0; padding-inline-start: 20px; }
#service-screen-steps li + li { margin-top: 8px; }
@media (max-width: 760px) {
  #journey #cala h1 { font-size: clamp(40px, 10vw, 60px); }
  #journey #cala { --sightline: 25svh; }
}
@media (prefers-reduced-motion: no-preference) {
  .story-beat.story-arrived { animation: story-arrival .45s ease-out both; }
  @keyframes story-arrival { from { opacity: .25; transform: translateY(10px); } }
}

@media (min-width: 761px) {
  #journey #torre { justify-content: flex-start; }
  #journey #torre .tower-copy { max-width: min(35vw, 440px); text-align: left; }
}

/* The live interface replaces the pixels of the 3D monitor at the end of the approach. */
body.monitor-visit :is(#journey, .header, .vignette) { opacity: 0; }
#journey, .header, .vignette { transition: opacity .22s ease; }
dialog#proposal {
  position: fixed; inset: auto; margin: 0; padding: 0;
  width: 1px; height: 1px; max-width: none; max-height: none;
  transform: translate(-50%, -50%);
  background: transparent; box-shadow: none; border: none; border-radius: 0;
  overflow: hidden;
}
dialog#proposal[open] { animation: none; }
dialog#proposal::backdrop { background: transparent; }
#proposal .monitor-ui { display: none; }
#proposal.screen-ready .monitor-ui {
  display: grid; grid-template-rows: auto minmax(0,1fr);
  height: 100%; background: #eaf5eb; color: #163f49;
  animation: monitor-on .2s ease-out both;
}
@keyframes monitor-on { from { opacity: 0; } }
#proposal .monitor-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-inline: 14px 5px; background: #183f47; color: #fff; }
#proposal .monitor-bar form { position: static; }
#proposal .monitor-bar h2 { margin: 5px 0; color: inherit; font-size: clamp(14px, 2vw, 23px); }
#proposal .monitor-bar button { padding: 0; width: 44px; min-height: 44px; font-size: 25px; background: transparent; color: inherit; }
#proposal .monitor-bar button:focus-visible { outline-offset: -4px; }
#proposal #service-screen { overflow: auto; overscroll-behavior: contain; background: transparent; padding: clamp(12px,2vw,24px); }
#proposal #proposal-copy { margin: 0 0 12px; font-size: clamp(15px,1.5vw,19px); line-height: 1.4; }
#proposal #service-screen-title { margin: 0 0 9px; font-size: clamp(16px,1.7vw,23px); }
#proposal .monitor-actions { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; }
#proposal .monitor-actions a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
@media(prefers-reduced-motion:reduce) {
  #journey, .header, .vignette { transition: none; }
  #proposal.screen-ready .monitor-ui { animation: none; }
}
