/* VacationOS — Exuma 2026 Showcase
   layout.css — continuous product stage, device component, fallback flow,
   responsive rules */

/* ---------- top bar ---------- */

.masthead {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem var(--gutter);
  color: var(--cream);
}

.masthead .wordmark {
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  color: inherit;
  text-decoration: none;
}

.masthead .tagline {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
}

@media (max-width: 640px) {
  .masthead .tagline {
    display: none;
  }
}

/* ---------- device component ---------- */

.device {
  position: relative;
  margin: 0 auto;
  width: min(100%, 22.5rem);
  border-radius: calc(var(--device-radius) + 0.55rem);
  background: #0b1114;
  padding: 0.55rem;
  box-shadow: var(--shadow-device);
}

.device::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.device .screen {
  position: relative;
  overflow: hidden;
  border-radius: var(--device-radius);
  aspect-ratio: 1206 / 2622;
  background: #10222b;
}

.device .screen img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* stacked crossfade screens inside one device */
.screen .frame {
  opacity: 0;
}

.screen .frame.is-active {
  opacity: 1;
}

/* ---------- the continuous stage ---------- */

.stage {
  position: relative;
}

.stage-backdrop {
  position: sticky;
  top: 0;
  height: 100svh;
  margin-bottom: -100svh;
  z-index: 0;
  overflow: hidden;
}

.stage-backdrop .living-world,
.stage-backdrop .atmo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.stage-backdrop .atmo {
  background: transparent;
}

.stage-backdrop .atmo-b {
  opacity: 0;
}

.stage-backdrop .living-world {
  z-index: 2;
}

.stage-body {
  position: relative;
  z-index: 5;
  max-width: 78rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ----- desktop stage layout (wide + motion allowed) ----- */

.stage-on .stage-body {
  display: grid;
  grid-template-columns: minmax(0, 11fr) minmax(0, 9fr);
  gap: clamp(2rem, 6vw, 6rem);
}

.stage-on .story-step {
  min-height: 175svh;
  display: block;
}

.stage-on .story-step--opening {
  min-height: 195svh;
}

.stage-on .story-step--memory {
  min-height: 190svh;
}

.stage-on .step-copy {
  position: sticky;
  top: 20svh;
  max-width: 30rem;
  opacity: 0;
  will-change: opacity, transform;
}

.stage-on .story-step--opening .step-copy h1 {
  transform-origin: left top;
}

/* device column: one pinned phone for the whole story */
.stage-device-col {
  position: relative;
}

.stage-on .stage-device-col .device {
  position: sticky;
  top: max(3.5rem, calc((100svh - min(25rem, (100svh - 9rem) * 0.46) / 0.46) / 2));
  width: min(100%, 25rem, calc((100svh - 9rem) * 0.46));
  transition: transform 900ms ease;
}

/* per-step inline devices only exist in the fallback flow */
.stage-on .step-device {
  display: none;
}

/* ----- fallback flow layout (mobile, reduced motion, static, no-JS) ----- */

.stage-off .stage-backdrop,
html:not(.js) .stage-backdrop {
  position: absolute;
  inset: 0;
  height: auto;
  margin-bottom: 0;
}

.stage-off .stage-backdrop .atmo,
html:not(.js) .stage-backdrop .atmo {
  display: none;
}

.stage-off .stage-backdrop .living-world,
html:not(.js) .stage-backdrop .living-world {
  height: 100svh;
  /* fades into the page background below the opening */
  -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 72%, transparent 100%);
}

.stage-off .stage-device-col,
html:not(.js) .stage-device-col {
  display: none;
}

.stage-off .story-step,
html:not(.js) .story-step {
  padding: clamp(3.2rem, 9vh, 6rem) 0;
}

.stage-off .story-step--opening,
html:not(.js) .story-step--opening {
  min-height: 86svh;
  display: grid;
  align-content: start;
  padding-top: clamp(6rem, 14vh, 8rem);
}

.stage-off .step-copy,
html:not(.js) .step-copy {
  max-width: var(--measure);
}

.stage-off .step-device,
html:not(.js) .step-device {
  margin-top: 1.8rem;
}

.stage-off .step-device .device,
html:not(.js) .step-device .device {
  width: min(88vw, 24rem);
  margin-left: 0;
}

.stage-off .step-device figcaption,
html:not(.js) .step-device figcaption {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: var(--ink-faint);
}

/* dark-atmosphere steps carry readable copy in the fallback too */
.stage-off .story-step,
html:not(.js) .story-step {
  background: transparent;
}

.stage-off .story-step.on-dark,
html:not(.js) .story-step.on-dark {
  background: linear-gradient(180deg, #223c50 0%, #2c4257 100%);
  margin: 0 calc(-1 * var(--gutter));
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* copy internals */
.step-copy > * + * {
  margin-top: 1.1rem;
}

.step-copy h1 {
  font-size: clamp(2.4rem, 5.4vw, 4.2rem);
}

.step-copy h2 {
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
}

/* opening copy is on the Living World (light on blue) in both layouts */
.story-step--opening .step-copy,
.story-step--opening .step-copy p {
  color: var(--cream);
}

.story-step--opening .step-copy .lede,
.story-step--opening .step-copy p {
  color: rgba(247, 244, 236, 0.88);
}

.story-step--opening .step-copy .eyebrow {
  color: rgba(247, 244, 236, 0.7);
}

.story-step--opening .step-copy .footnote {
  color: rgba(247, 244, 236, 0.62);
}

/* ---------- closing ---------- */

.closing {
  position: relative;
  min-height: 92svh;
  display: grid;
  align-items: center;
  overflow: clip;
  color: var(--cream);
  background: var(--deep-night);
}

.closing .living-world {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.closing-inner {
  position: relative;
  z-index: 5;
  text-align: center;
  max-width: 44rem;
  margin: 0 auto;
  padding: var(--section-pad) var(--gutter);
}

.closing-inner > * + * {
  margin-top: 1.4rem;
}

/* ---------- footer ---------- */

.site-foot {
  background: var(--deep-night);
  color: rgba(247, 244, 236, 0.62);
  text-align: center;
  padding: 2.2rem var(--gutter) 3rem;
  font-size: 0.82rem;
}

/* ---------- narrow screens ---------- */

@media (max-width: 900px) {
  .step-copy h1 {
    font-size: clamp(2.3rem, 9vw, 3rem);
  }
}
