/* ==========================================================================
   The opening (home) and the public pages: Examples, Info, Contact.

   The opening has two editions made from the same markup:
   - the still edition (default): three photographs, one under the other;
   - the live edition (.world.is-live, set by world.js): one fixed picture that the
     visitor walks into while scrolling.
   ========================================================================== */

body.page-world { background: var(--mist); }
html:has(body.page-world) { background: var(--mist); }

/* Shared by both editions ------------------------------------------------- */
.world { position: relative; background: var(--mist); }
.world__plate { position: relative; margin: 0; overflow: hidden; background: #cfd1d4; }
.world__plate picture { display: block; width: 100%; height: 100%; }
.world__plate img { width: 100%; height: 100%; object-fit: cover; }
.world__plate--arrival img { object-position: 50% 52%; }
.world__canvas { display: none; }

.world__line { font-size: clamp(2.2rem, 4.4vw, 4.6rem); font-weight: 500; letter-spacing: -0.045em; line-height: 1; max-width: 12ch; }
.world__line span { display: block; }

.world__create { display: inline-flex; gap: 0.6em; align-items: center; min-height: 44px; font-weight: 550; font-size: 0.95rem; border-bottom: 1px solid currentColor; }
.world__create span { transition: transform 0.5s var(--ease-out); }
.world__create:hover span { transform: translateX(5px); }

/* The entry: the first choice of the product, set inside the hall. */
.entry__caption { color: inherit; opacity: 0.7; }
.entry__question { font-size: var(--step-3); font-weight: 500; letter-spacing: -0.04em; line-height: 1.02; margin-top: 0.9rem; }
.entry__choices { display: grid; margin-top: clamp(1.4rem, 3.5vh, 2.6rem); border-top: 1px solid var(--entry-line); }
.entry__choice {
  position: relative; display: grid; gap: 0.3rem; padding: 1.15rem 2.4rem 1.2rem 0;
  border-bottom: 1px solid var(--entry-line); transition: padding 0.5s var(--ease-out);
}
.entry__choice::before { content: ""; position: absolute; left: 0; top: 1.1rem; bottom: 1.1rem; width: 2px; background: var(--lamp-soft); opacity: 0; transition: width 0.5s var(--ease-out), opacity 0.3s; }
.entry__choice::after { content: "→"; position: absolute; right: 0.2rem; top: 1.15rem; font-size: 1.35rem; transition: transform 0.5s var(--ease-out); }
.entry__choice:hover, .entry__choice:focus-visible { padding-left: 1.3rem; }
.entry__choice:hover::before, .entry__choice:focus-visible::before { width: 6px; opacity: 1; }
.entry__choice:hover::after { transform: translateX(5px); }
.entry__title { font-size: var(--step-2); font-weight: 500; letter-spacing: -0.035em; line-height: 1.05; }
.entry__hint { font-size: 0.95rem; opacity: 0.72; }
.entry__more { display: inline-flex; gap: 0.6em; margin-top: 1.5rem; min-height: 44px; align-items: center; font-size: 0.95rem; opacity: 0.8; }
.entry__more:hover { opacity: 1; }

/* Still edition ------------------------------------------------------------
   Three photographs, one under the other. The words sit where they can be read:
   on the pale water, left of the pavilion's reflection (in the sky, on a phone). */
.world:not(.is-live) .world__plate--arrival { height: 100svh; min-height: 34rem; }
.world:not(.is-live) .world__words { position: absolute; z-index: 1; left: var(--gutter); top: calc(100svh - 5.2rem); transform: translateY(-100%); width: min(27vw, 26rem); color: var(--ink); display: grid; gap: 0.9rem; }
.world:not(.is-live) .world__line { max-width: none; }
.world:not(.is-live) .world__line--2 { font-size: var(--step-1); letter-spacing: -0.015em; line-height: 1.3; color: var(--ink); opacity: 0.78; }
.world:not(.is-live) .world__line--3 { display: none; }
.world:not(.is-live) .world__foot { position: absolute; z-index: 1; left: var(--gutter); right: var(--gutter); top: calc(100svh - 3.6rem); display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.world:not(.is-live) .world__cue { display: none; }
.world:not(.is-live) .world__foot .caption { color: inherit; }
.world:not(.is-live) .world__plate--door { height: 78svh; }
.world:not(.is-live) .world__line--static { position: absolute; left: var(--gutter); bottom: 2.2rem; color: #fff; text-shadow: 0 2px 30px rgb(0 0 0 / 0.45); }
.world:not(.is-live) .entry { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100svh; background: var(--plaster); --entry-line: var(--line-strong); }
.world:not(.is-live) .world__plate--hall { min-height: 100svh; }
.world:not(.is-live) .entry__panel { align-self: center; padding: 3rem var(--gutter); max-width: 40rem; }
@media (orientation: portrait), (max-width: 820px) {
  .world:not(.is-live) .world__words { top: calc(var(--bar) + 3.5vh); transform: none; width: min(70vw, 20rem); }
  .world:not(.is-live) .world__foot { color: #f4f1eb; justify-content: flex-end; }
  .world:not(.is-live) .entry { grid-template-columns: 1fr; min-height: 0; }
  .world:not(.is-live) .world__plate--hall { height: 56svh; min-height: 0; }
  .world:not(.is-live) .world__plate--door { height: 64svh; }
  .world:not(.is-live) .world__plate--door img { object-position: 50% 40%; }
}

/* Live edition --------------------------------------------------------------
   The section is as tall as the walk is long; the stage stays on screen (sticky). */
.world.is-live { height: 560vh; }
@media (orientation: portrait) { .world.is-live { height: 480vh; } }
.world.is-live .world__stage { position: sticky; top: 0; height: 100vh; height: 100lvh; overflow: hidden; background: var(--mist); }
.world.is-live .world__plate--arrival { position: absolute; inset: 0; transition: opacity 0.9s var(--ease-out); }
.world.is-live.is-painted .world__plate--arrival { opacity: 0; pointer-events: none; }
.world.is-live .world__plate--door, .world.is-live .world__plate--hall { display: none; }
.world.is-live .world__canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.9s var(--ease-out); touch-action: pan-y; }
.world.is-live.is-painted .world__canvas { opacity: 1; }

/* Words: each line rises out of a mask when its moment comes. */
.world.is-live .world__words { position: absolute; inset: 0; pointer-events: none; }
.world.is-live .world__line { position: absolute; overflow: hidden; padding-bottom: 0.12em; }
.world.is-live .world__line span { transform: translateY(108%); transition: transform 1.1s var(--ease-out); }
.world.is-live .world__line.is-in span { transform: none; }
.world.is-live .world__line.is-out span { transform: translateY(-108%); transition-duration: 0.7s; transition-timing-function: var(--ease-in-out); }
/* On arrival the words sit on the pale water, left of the pavilion's reflection. */
.world.is-live .world__line--1 { left: var(--gutter); bottom: 5.4rem; color: var(--ink); max-width: 27vw; }
.world.is-live .world__line--2 { left: var(--gutter); bottom: 5.4rem; color: #fff; max-width: 34vw; text-shadow: 0 2px 40px rgb(0 0 0 / 0.35); }
.world.is-live .world__line--3 { left: 50%; top: 50%; margin-left: clamp(9rem, 17vw, 20rem); transform: translateY(-50%); color: #fff; text-shadow: 0 2px 40px rgb(0 0 0 / 0.4); white-space: nowrap; max-width: none; }
.world.is-live .world__line--static { display: none; }
@media (orientation: portrait) {
  .world.is-live .world__line { font-size: clamp(2.3rem, 10.5vw, 3.6rem); }
  /* On a phone the arrival words sit in the sky; the stones own the bottom of the frame. */
  .world.is-live .world__line--1 { top: calc(var(--bar) + 3.5vh); bottom: auto; max-width: 9ch; }
  .world.is-live .world__line--2 { bottom: 6.2rem; max-width: 12ch; }
  .world.is-live .world__line--3 { left: var(--gutter); top: auto; bottom: 6.2rem; margin-left: 0; transform: none; }
}

.world.is-live .world__foot {
  /* On a phone the page opens with the browser's toolbar showing: the stage is as tall as the screen
     WITHOUT it (100lvh, so the picture never resizes), so lift the foot by the toolbar's height. */
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 1.35rem; bottom: calc(1.35rem + 100lvh - 100dvh);
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  color: var(--ink); transition: color 0.6s var(--ease-out), opacity 0.6s var(--ease-out);
}
.world.is-live .world__foot .caption { color: inherit; opacity: 1; transition: opacity 0.6s var(--ease-out); }
.world.is-live.is-moving .world__foot .caption { opacity: 0; }   /* it has said "websites" in the first seconds; then the picture is left alone */
.world.is-live[data-tone="light"] .world__foot { color: #f4f1eb; }
.world.is-live.is-inside .world__foot { opacity: 0; pointer-events: none; visibility: hidden; transition: color 0.6s var(--ease-out), opacity 0.6s var(--ease-out), visibility 0s linear 0.6s; }   /* out of the tab order too */
@media (max-width: 640px) { .world__foot .caption { display: none; } .world.is-live .world__foot { justify-content: flex-end; } }
/* On a phone the link sits on stones that are sometimes dark, sometimes pale: give it its own shade. */
@media (orientation: portrait), (max-width: 820px) { .world__create { text-shadow: 0 1px 14px rgb(0 0 0 / 0.6); } }

/* Light words on mid-grey boards need a little shade behind them to stay crisp. */
.page-world .topbar[data-tone="light"]:not([data-open="true"]) { text-shadow: 0 1px 14px rgb(0 0 0 / 0.45); }
.page-world .topbar[data-tone="light"]:not([data-open="true"]) .burger span { box-shadow: 0 1px 10px rgb(0 0 0 / 0.35); }
/* Still edition: the bar stays on the pale sky of the first photograph instead of riding over the dark ones. */
body.page-world:has(.world:not(.is-live)) .topbar:not([data-open="true"]) { position: absolute; }

/* The name at the top meets the timber before the corners do (set by world.js). */
.page-world .topbar .wordmark { transition: color 0.6s var(--ease-out); }
.page-world .topbar[data-centre="light"]:not([data-open="true"]) .wordmark { color: #f4f1eb; }

/* The cue: one hairline that breathes. No words. */
.world.is-live .world__cue { position: absolute; left: 50%; bottom: 0; bottom: calc(100lvh - 100dvh); width: 1px; height: 3.2rem; background: var(--ink); transform-origin: bottom; animation: cue 2.6s var(--ease-in-out) infinite; transition: opacity 0.6s; }
.world.is-live.is-moving .world__cue { opacity: 0; animation: none; }
@keyframes cue { 0%, 100% { transform: scaleY(0.35); opacity: 0.35; } 50% { transform: scaleY(1); opacity: 0.9; } }

/* The entry, inside the hall. Wide screens: words on the dark boards at the left.
   Phones: a sheet of plaster rising from the floor. */
.world.is-live .entry { position: absolute; inset: 0; pointer-events: none; opacity: 0; --entry-line: rgb(244 241 235 / 0.34); }
.world.is-live.is-inside .entry { opacity: 1; pointer-events: auto; }
/* The hall photograph is late or missing: the choice still appears, in ink on the plaster ground. */
.world.is-live.is-bare .entry { --entry-line: var(--line-strong); }
.world.is-live.is-bare .entry__panel { color: var(--ink); }
.world.is-live.is-leaving .entry { pointer-events: none; }
.world.is-live .entry__panel {
  position: absolute; left: var(--gutter); top: 50%; width: min(30vw, 27rem); transform: translateY(-46%);
  color: #f4f1eb; opacity: 0; transition: opacity 0.9s var(--ease-out) 0.15s, transform 1.2s var(--ease-out) 0.15s;
}
.world.is-live.is-inside .entry__panel { opacity: 1; transform: translateY(-50%); }
@media (orientation: portrait), (max-width: 900px) {
  .world.is-live .entry { --entry-line: var(--line-strong); }
  .world.is-live .entry__panel {
    left: 0; right: 0; top: auto; bottom: 0; width: auto; transform: translateY(12%);
    padding: 1.6rem var(--gutter) calc(1.2rem + env(safe-area-inset-bottom)); background: var(--plaster); color: var(--ink);
  }
  .world.is-live.is-inside .entry__panel { transform: none; }
  .world.is-live .entry__question { font-size: clamp(1.7rem, 7.4vw, 2.4rem); margin-top: 0.5rem; }
  .world.is-live .entry__choices { margin-top: 1rem; }
  .world.is-live .entry__choice { padding-block: 0.85rem 0.9rem; }
  .world.is-live .entry__choice::before { background: var(--lamp); top: 0.9rem; bottom: 0.9rem; }
  .world.is-live .entry__title { font-size: 1.35rem; }
  .world.is-live .entry__hint { font-size: 0.9rem; }
  .world.is-live .entry__more { margin-top: 0.6rem; }
}
/* Skipping: the walk is fast-forwarded, so the words stay out of it. */
.world.is-live.is-skipping .world__words { opacity: 0; transition: opacity 0.3s; }

/* Leaving for the product: the picture walks to the far window and whites out. */
.world.is-live.is-leaving .entry__panel { opacity: 0; transition-delay: 0s; transition-duration: 0.35s; }

body.page-world .site-footer { background: var(--plaster); }
