/* Section 6, Our work: real 3D Cape Town (js/work.js, js/work/scene.js, js/work/route.js). Light
   theme. The stage sticks while the section scrolls past; the canvas draws Google's 3D tiles with
   the five sites standing in them; the words sit on a glass card, the rail and Google's credit at
   the bottom. Reduced motion, no WebGL or refused tiles: a still and a plain list. */
#work {
  --w-fg: var(--fg);
  --w-muted: var(--fg-2);
  --w-faint: var(--fg-3);
  --w-line: var(--line);
  --w-glass: rgb(255 255 255 / .78);
  --w-glass-edge: rgb(255 255 255 / .92);
  --w-gutter: max(40px, 4.5vw);
  position: relative;
  background: #e6eef7;
  color: var(--w-fg);
}
#work .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- the stage ---------- */
#work .wk-stage { position: sticky; top: 0; height: 100svh; overflow: hidden; isolation: isolate; contain: layout paint; }
/* the sky behind the tiles; its horizon colour is the haze in js/work/scene.js */
#work .wk-sky { position: absolute; inset: 0; background: linear-gradient(180deg, #9fc5ec 0%, #c4dcf3 38%, #e6eef7 64%, #e6eef7 100%); }
#work .wk-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
/* a soft white edge where the levels section hands over, and a little shade under the words */
#work .wk-stage::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    linear-gradient(180deg, rgb(255 255 255 / min(1, calc(2.2 * (1 - var(--enter, 1))))) 0%, rgb(255 255 255 / 0) calc(40% * (1 - var(--enter, 1)))),
    linear-gradient(0deg, rgb(8 22 48 / .26) 0%, rgb(8 22 48 / 0) 16%);
}

/* ---------- loading: the work itself while Cape Town loads ----------
   A still of the first stop, the Ordaily card in its glass exactly where the 3D card will stand
   (it opens the site, as the 3D card does), a word and a thin line. When the 3D is ready it fades
   in behind the card, the still goes, and the card hands over to its 3D twin. */
#work .wk-gl { opacity: 0; transition: opacity .9s var(--ease); }
#work[data-view="shown"] .wk-gl { opacity: 1; }
#work .wk-load { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none;
  transition: visibility 0s linear 1.6s; }
#work .wk-load-still { position: absolute; inset: 0; transition: opacity .9s var(--ease); }
#work .wk-load-still img { display: block; width: 100%; height: 100%; object-fit: cover; }
#work .wk-load-card { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; outline: none; transition: opacity .45s var(--ease) 1s, translate .35s var(--ease); }
#work .wk-load-card:hover, #work .wk-load-card:focus-visible { translate: 0 -6px; }
#work .wk-load-card:focus-visible .wk-load-glass { box-shadow: inset 0 0 0 5px rgb(255 255 255 / .75), 0 0 0 10px var(--blue); }
#work[data-view="shown"] .wk-load-card { pointer-events: none; }
#work .wk-load-card > * { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#work .wk-load-face { width: 1280px; height: 960px; }
#work .wk-load-glass { border-radius: 92px; background: linear-gradient(160deg, rgb(255 255 255 / .42), rgb(255 255 255 / .1) 42%, rgb(214 230 252 / .2));
  box-shadow: inset 0 0 0 5px rgb(255 255 255 / .75), inset 0 26px 40px -10px rgb(255 255 255 / .7), inset 0 -26px 44px -14px rgb(90 120 170 / .35), 0 80px 140px -60px rgb(8 22 48 / .55);
  -webkit-backdrop-filter: blur(5px) saturate(1.4); backdrop-filter: blur(5px) saturate(1.4); }
#work .wk-load-note { position: absolute; left: 50%; bottom: 84px; margin: 0; transform: translateX(-50%); display: grid; justify-items: center; gap: 10px;
  padding: 10px 18px 12px; border-radius: 999px; background: rgb(255 255 255 / .72); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: var(--accent-ink); font-size: .8125rem; font-weight: 600; letter-spacing: .01em; transition: opacity .4s var(--ease); }
#work .wk-load-line { position: relative; display: block; width: 140px; height: 2px; border-radius: 2px; background: rgb(21 80 199 / .16); overflow: hidden; }
#work .wk-load-line::after { content: ''; position: absolute; inset: 0; background: var(--blue); transform-origin: left; transform: scaleX(var(--p, .08)); transition: transform .5s var(--ease); }
#work[data-view="shown"] .wk-load { visibility: hidden; }
#work[data-view="shown"] .wk-load-still, #work[data-view="shown"] .wk-load-note { opacity: 0; }
#work[data-view="shown"] .wk-load-card { opacity: 0; }

/* ---------- the words ---------- */
#work .wk-copy {
  position: absolute; z-index: 3; left: var(--w-gutter); top: calc(var(--header-h) + 44px);
  width: clamp(280px, 26vw, 380px); padding: 26px 28px 24px;
  background: var(--w-glass); border-radius: 22px;
  box-shadow: inset 0 0 0 1px var(--w-glass-edge), 0 30px 60px -30px rgb(8 22 48 / .45);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  opacity: calc(.2 + .8 * var(--enter, 1));
  transform: translate3d(0, calc(40px * (1 - var(--enter, 1))), 0);
}
#work .wk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
#work .wk-head .wk-eyebrow { margin: 0; }
/* the five places as a small timeline on the Our work line (phones; wide screens have the rail) */
#work .wk-steps { display: none; }
#work .wk-steps ol { position: relative; list-style: none; margin: 0; padding: 0; display: flex; }
#work .wk-steps ol::before { content: ''; position: absolute; left: 14px; right: 14px; top: calc(50% - .75px); height: 1.5px; background: rgb(11 30 91 / .18); }
#work .wk-steps button { position: relative; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#work .wk-steps button i { width: 8px; height: 8px; border-radius: 50%; background: #c9d3e6; box-shadow: 0 0 0 2px rgb(255 255 255 / .9); transition: background-color .3s, transform .3s var(--ease); }
#work .wk-steps button.is-on i { background: var(--blue); transform: scale(1.35); box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px rgb(31 111 255 / .22); }
#work .wk-steps button:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 50%; }
#work .wk-eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-size: .8125rem; font-weight: 600; letter-spacing: .02em; color: var(--accent-ink); }
#work .wk-eyebrow span { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px rgb(31 111 255 / .18); }
#work .wk-title { margin: 0; font-weight: 600; letter-spacing: -0.034em; line-height: 1.02; font-size: clamp(2rem, 3vw, 3rem); text-wrap: balance; color: var(--navy); }
#work .wk-now { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--w-line); }
#work .wk-place { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: .8125rem; font-weight: 600; color: var(--accent-ink); }
#work .wk-count { margin-left: auto; font-weight: 500; color: var(--w-muted); font-variant-numeric: tabular-nums; }
#work .wk-count b { color: var(--w-fg); font-weight: 600; }
#work .wk-name { margin: 0; font-size: clamp(1.5rem, 2vw, 2rem); font-weight: 600; letter-spacing: -0.026em; line-height: 1.08; min-height: 1.08em; }
#work .wk-line { margin: 8px 0 0; font-size: 1rem; line-height: 1.45; color: var(--w-muted); }
#work .wk-done { margin: 4px 0 0; font-size: .875rem; line-height: 1.45; color: var(--w-faint); }
#work .wk-visit { display: inline-flex; align-items: center; gap: 7px; margin-top: 16px; padding: 10px 16px; border-radius: 999px; background: var(--blue); color: #fff; font-size: .9375rem; font-weight: 600; text-decoration: none; transition: background-color .25s, transform .25s var(--ease); }
#work .wk-visit:hover { background: #1550c7; transform: translateY(-1px); }
#work .wk-visit:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
#work .wk-hint { margin: 16px 0 0; font-size: .8125rem; line-height: 1.4; color: var(--w-faint); }
#work .wk-hint-phone { display: none; }

/* ---------- the rail: the five places ---------- */
#work .wk-rail { position: absolute; z-index: 3; left: var(--w-gutter); bottom: 22px; padding: 6px; border-radius: 999px;
  background: rgb(255 255 255 / .7); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .9), 0 18px 40px -24px rgb(8 22 48 / .5);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
#work .wk-rail ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
#work .wk-rail button { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px 0 10px; border: 0; border-radius: 999px; background: none; font: inherit; font-size: .8125rem; font-weight: 600; color: var(--w-muted); cursor: pointer; transition: background-color .3s, color .3s; }
#work .wk-rail button i { width: 9px; height: 9px; border-radius: 50%; background: rgb(11 30 91 / .2); transition: background-color .3s, transform .3s var(--ease); }
#work .wk-rail button:hover { color: var(--w-fg); }
#work .wk-rail button.is-on { background: #fff; color: var(--navy); box-shadow: 0 4px 14px -6px rgb(8 22 48 / .35); }
#work .wk-rail button.is-on i { background: var(--blue); transform: scale(1.2); }
#work .wk-rail button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Google's logo and data credits (Map Tiles terms): always on the picture ---------- */
#work .wk-credit { position: absolute; z-index: 3; right: var(--w-gutter); bottom: 26px; max-width: min(46vw, 560px); display: flex; align-items: flex-end; gap: 10px;
  color: #fff; font-size: .6875rem; line-height: 1.35; text-align: right; text-shadow: 0 1px 2px rgb(0 0 0 / .7), 0 0 8px rgb(0 0 0 / .35); pointer-events: none; }
#work .wk-credit img { display: block; flex: none; width: 66px; height: 26px; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .55)); }
#work .wk-data:empty { display: none; }
/* no map on screen while loading, so no credit either */
#work:not([data-view="shown"]) .wk-credit { opacity: 0; }

/* ---------- the still: reduced motion, no WebGL, or tiles refused ---------- */
#work .wk-still { display: none; }
#work[data-mode="still"] { background: var(--bg); }
#work[data-mode="still"] .wk-stage { display: none; }
#work[data-mode="still"] .wk-still { display: block; padding: 0 0 72px; }
#work .wk-still-film { position: relative; margin: 0; }
#work .wk-still-film img { display: block; width: 100%; height: min(62vh, 56.5vw); object-fit: cover; }
#work .wk-still-head { position: absolute; left: var(--w-gutter); bottom: 32px; padding: 22px 26px; border-radius: 20px; background: var(--w-glass); box-shadow: inset 0 0 0 1px var(--w-glass-edge); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
#work .wk-still-head .wk-eyebrow { margin-bottom: 10px; }
#work .wk-list { list-style: none; margin: 0 auto; padding: 40px var(--w-gutter) 0; max-width: 1200px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px 32px; }
#work .wk-list li { padding-top: 18px; border-top: 1px solid var(--w-line); }
#work .wk-list-place { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: .8125rem; font-weight: 600; color: var(--accent-ink); }
#work .wk-list h3 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
#work .wk-list p { margin: 0; color: var(--w-muted); line-height: 1.45; }
#work .wk-list .wk-list-done { color: var(--w-faint); font-size: .875rem; margin-top: 2px; }
#work .wk-list a { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-weight: 600; color: var(--accent-ink); text-decoration: none; }
#work .wk-list a:hover { text-decoration: underline; }
#work .wk-list a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

/* ---------- phones: the words at the bottom, the places as a timeline inside them ---------- */
@media (max-width: 819.98px) {
  #work { --w-gutter: 16px; }
  #work .wk-copy { top: auto; bottom: 40px; left: 12px; right: 12px; width: auto; padding: 16px 18px 16px; border-radius: 18px; transform: none; opacity: 1; }
  #work .wk-copy .wk-eyebrow { margin-bottom: 0; font-size: .75rem; }
  #work .wk-head { margin: -4px 0 0; }
  #work .wk-steps { display: block; margin-right: -6px; }
  /* the card takes sideways swipes; up and down stay the page's scroll */
  #work .wk-copy { touch-action: pan-y; }
  #work .wk-copy .wk-title { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #work .wk-still-head .wk-title { font-size: 1.75rem; }
  #work .wk-now { margin-top: 10px; padding-top: 10px; }
  #work .wk-place { margin-bottom: 6px; }
  #work .wk-name { font-size: 1.375rem; }
  #work .wk-line { margin-top: 4px; font-size: .9375rem; }
  #work .wk-done { display: none; }
  #work .wk-visit { margin-top: 12px; padding: 9px 15px; font-size: .875rem; }
  #work .wk-hint { display: none; }
  #work .wk-rail { display: none; }
  #work .wk-credit { left: 12px; right: 12px; bottom: 8px; max-width: none; gap: 8px; font-size: .625rem; align-items: center; }
  #work .wk-credit img { width: 50px; height: 20px; }
  #work .wk-load-note { bottom: auto; padding: 8px 16px 10px; gap: 8px; }
      #work .wk-still-film img { height: 56vh; }
  #work .wk-still-head { left: 12px; right: 12px; bottom: 16px; padding: 16px 18px; }
  #work .wk-list { padding-top: 28px; gap: 22px; }
}
@media (max-width: 819.98px) and (max-height: 700px) {
  #work .wk-line { display: none; }
}
