/* The guided demo. Uses the site's own colours, font and buttons (styles.css). */
body.demo { height: 100dvh; overflow: hidden; background: var(--canvas); }

/* the screen fills the window. Positions inside are measured from the left in both languages. */
.frame { height: 100%; }
#stage { position: relative; direction: ltr; overflow: hidden; width: 100%; height: 100%; background: #fff; }
#canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; transition: transform .55s cubic-bezier(.22, 1, .36, 1); }
#canvas iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; pointer-events: none; background: #fff; transition: opacity .18s; }
#canvas iframe.is-on { opacity: 1; }
#stage::after { content: ""; position: absolute; inset: 0; background: oklch(0.2 0.02 264 / 45%); opacity: 0; pointer-events: none; transition: opacity .25s; }
#stage.is-dim::after { opacity: 1; }

/* what the step points at; everything else is dimmed */
#ring { position: absolute; z-index: 2; padding: 0; border: 0; background: transparent; border-radius: 12px; cursor: pointer; box-shadow: 0 0 0 2px var(--green), 0 0 0 9999px oklch(0.2 0.02 264 / 45%); opacity: 0; transition: opacity .2s, left .55s cubic-bezier(.22, 1, .36, 1), top .55s cubic-bezier(.22, 1, .36, 1), width .55s cubic-bezier(.22, 1, .36, 1), height .55s cubic-bezier(.22, 1, .36, 1); }
#ring.is-on { opacity: 1; }
#ring::after { content: ""; position: absolute; inset: -2px; border-radius: 14px; border: 2px solid var(--green); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.03, 1.08); opacity: 0; } }

/* the step */
#tip { position: absolute; z-index: 3; width: 320px; max-width: calc(100% - 24px); padding: 16px 18px 14px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 16px; line-height: 1.55; box-shadow: 0 18px 50px -12px oklch(0 0 0 / 50%); opacity: 0; translate: 0 6px; transition: opacity .25s .12s, translate .3s .12s; }
#tip.is-on { opacity: 1; translate: 0 0; }
html[dir="rtl"] #tip { direction: rtl; }
#tip::before { content: ""; position: absolute; width: 14px; height: 14px; background: inherit; border-radius: 3px; rotate: 45deg; }
#tip[data-side="below"]::before { top: -6px; left: calc(var(--ax) - 7px); }
#tip[data-side="above"]::before { bottom: -6px; left: calc(var(--ax) - 7px); }
#tip[data-side="right"]::before { left: -6px; top: calc(var(--ay) - 7px); }
#tip[data-side="left"]::before { right: -6px; top: calc(var(--ay) - 7px); }
#tip[data-side="over"]::before, #tip[data-side="none"]::before { display: none; }
#tip-title { font-size: 22px; line-height: 1.3; }
#tip-title:empty { display: none; }
#tip-text { color: oklch(1 0 0 / 92%); }
.tip__foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
#count { color: oklch(1 0 0 / 60%); font-size: 13.5px; margin-inline-end: auto; }
.tip__foot .btn { height: 34px; padding: 0 14px; font-size: 14.5px; border-radius: 9px; }
#back { background: oklch(1 0 0 / 12%); color: #fff; }
#back:hover { background: var(--hover); }
#next { background: #fff; color: var(--ink); }
#next:hover { background: var(--hover); color: #fff; }
.tip__ctas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.tip__ctas .btn--green { background: var(--green-ink); color: #fff; }
.tip__ctas .btn--line { background: transparent; color: #fff; box-shadow: inset 0 0 0 1px oklch(1 0 0 / 25%); }
.tip__ctas .btn:hover { background: var(--hover); }
#tip.is-end { left: 50%; top: 50%; translate: -50% -46%; width: 380px; padding: 26px 26px 20px; }
#tip.is-end.is-on { translate: -50% -50%; }
#tip.is-end #tip-text { margin-top: 4px; }
#tip :focus-visible, #menu :focus-visible, #launch:focus-visible, #bars :focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* chapters */
#menu { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; padding: 14px; }
.menu__card { width: min(440px, 100%); max-height: 100%; overflow: auto; background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 24px 70px -18px oklch(0 0 0 / 45%); }
html[dir="rtl"] .menu__card { direction: rtl; }
.menu__head { display: flex; align-items: flex-start; gap: 12px; }
.menu__head h1 { margin: 0; font-size: 26px; line-height: 1.3; }
.menu__head p { color: var(--mute); font-size: 15px; line-height: 1.5; margin-top: 4px; }
#menu-close { flex: none; margin-inline-start: auto; width: 34px; height: 34px; border: 0; border-radius: 9px; background: var(--canvas); font-size: 20px; line-height: 1; cursor: pointer; color: var(--mute); }
#chapters { list-style: none; margin: 16px 0 0; padding: 0; }
#chapters li + li { border-top: 1px solid var(--line); }
#chapters button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 11px 8px; border: 0; border-radius: 10px; background: transparent; font: inherit; color: inherit; text-align: start; cursor: pointer; }
#chapters button:hover { background: var(--canvas); }
#chapters .ch-n { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; }
#chapters .is-now .ch-n { background: var(--ink); color: #fff; box-shadow: none; }
#chapters .is-done .ch-n { background: var(--green-ink); color: #fff; box-shadow: none; }
#chapters .ch-t { flex: 1; min-width: 0; }
#chapters b { display: block; font-size: 16px; line-height: 1.35; }
#chapters small { display: block; color: var(--mute); font-size: 13.5px; line-height: 1.4; }
#chapters .ch-d { color: var(--mute); font-size: 13px; }
#start { margin-top: 16px; }
.menu__card [data-try] { margin-top: 8px; }
.tip__ctas [data-try] { grid-column: 1 / -1; }
.tip__ctas [data-try]:not([hidden]) + .btn--green { background: oklch(1 0 0 / 12%); }
.menu__foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; margin-top: 16px; font-size: 14px; color: var(--mute); }
.menu__foot button { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.menu__foot a:hover, .menu__foot button:hover { color: var(--ink); }

/* how it works: a small screen where the frame is clicked again and again */
#how h1 { margin: 18px 0 0; font-size: 26px; line-height: 1.3; }
.how__list { margin: 10px 0 20px; padding: 0; list-style: none; counter-reset: n; }
.how__list li { display: flex; gap: 12px; align-items: baseline; padding: 7px 0; line-height: 1.45; counter-increment: n; }
.how__list li::before { content: counter(n); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13.5px; box-shadow: inset 0 0 0 1px var(--line); }
#how .btn + .btn { margin-top: 8px; }
.how__art { position: relative; direction: ltr; height: 150px; border-radius: 12px; overflow: hidden; background: oklch(0.55 0.005 264); }
.how__art i { position: absolute; left: 8%; right: 8%; height: 26px; border-radius: 7px; background: oklch(0.68 0.003 264); }
.how__art i:nth-child(1) { top: 18px; } .how__art i:nth-child(2) { top: 62px; background: #fff; left: 30%; right: 30%; } .how__art i:nth-child(3) { top: 106px; }
.how__art b { position: absolute; top: 56px; left: calc(30% - 6px); right: calc(30% - 6px); height: 38px; border-radius: 10px; box-shadow: 0 0 0 2px var(--green); animation: how-ring 3.2s infinite; }
.how__art span { position: absolute; left: 52%; top: 72px; animation: how-hand 3.2s cubic-bezier(.4, 0, .2, 1) infinite; }
@keyframes how-hand { 0% { transform: translate(120px, 60px); } 45%, 100% { transform: none; } 52% { transform: scale(.82); } 60% { transform: none; } }
@keyframes how-ring { 0%, 50% { box-shadow: 0 0 0 2px var(--green), 0 0 0 2px oklch(0.68 0.16 152 / 60%); } 75%, 100% { box-shadow: 0 0 0 2px var(--green), 0 0 0 16px oklch(0.68 0.16 152 / 0%); } }

/* over the screen's bottom edge: the chapters button and the chapter's steps */
.low { position: fixed; z-index: 10; inset-inline: 0; bottom: 0; pointer-events: none; }
.low > * { pointer-events: auto; }
#launch { display: inline-flex; align-items: center; gap: 10px; height: 42px; margin: 0 16px 16px; padding: 0 16px; border: 0; border-radius: 11px; background: var(--ink); color: #fff; font: inherit; font-size: 15px; cursor: pointer; box-shadow: 0 10px 30px -10px oklch(0 0 0 / 55%); transition: background .25s; }
#launch:hover { background: var(--hover); }
#launch b { font-size: 13px; padding: 0 7px; border-radius: 99px; background: oklch(1 0 0 / 18%); line-height: 1.6; }
#bars { display: flex; gap: 4px; padding: 0 4px 4px; }
#bars button { flex: 1; height: 10px; padding: 0; border: 0; background: transparent; cursor: pointer; position: relative; }
#bars button::after { content: ""; position: absolute; inset: 6px 0 0; border-radius: 9px; background: oklch(0.8 0 0 / 70%); transition: background .3s; }
#bars button.is-on::after { background: var(--green-ink); }

/* phone and tablet: the camera goes closer, the step sits under the screen (the same sizes as `small` in player.js) */
@media (max-width: 799px), (max-width: 1099px) and (orientation: portrait), (max-height: 519px) {
  .frame { padding-bottom: 222px; }
  #tip:not(.is-end) { position: fixed; left: 12px; right: 12px; bottom: 68px; width: auto; max-width: none; min-height: 150px; display: flex; flex-direction: column; }
  #tip:not(.is-end) .tip__foot { margin-top: auto; padding-top: 14px; }
  #tip:not(.is-end)::before { display: none; }
  .tip__foot .btn { height: 42px; padding: 0 18px; }
  #tip.is-end { width: calc(100% - 28px); max-width: 380px; }
  #launch { margin: 0 12px 8px; }
  #menu { position: fixed; background: oklch(0.2 0.02 264 / 45%); z-index: 20; }
}
/* a phone held sideways: the step sits beside the screen */
@media (max-height: 519px) and (orientation: landscape) {
  html[dir] .frame { padding-block-end: 0; padding-inline-end: 262px; }
  #tip:not(.is-end) { left: auto; right: 10px; top: 10px; bottom: 72px; width: 242px; min-height: 0; }
  html[dir="rtl"] #tip:not(.is-end) { right: auto; left: 10px; }
}
@media (prefers-reduced-motion: reduce) { #canvas, #ring, #tip, #canvas iframe { transition: none; } #ring::after, .how__art * { animation: none; } }
