/* The regular website's top bar, its buttons, the admin's way in, and page 3: sharing in the lab.
   Page 3 is no longer a sheet of paper: the notebook's pages turn, the book closes and lies on a
   black table, and the lab's notebooks gather round it (js/share.js moves them). */

:root { --bar: 52px; }
@media (max-width: 759px) { :root { --bar: 48px; } }

.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- buttons ---- */
.btn {
  --btn-bg: #1f3a8a; --btn-fg: #f7f1e3; --btn-line: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 22px;
  font: 400 1rem/1 "Libre Caslon Text", Georgia, serif; letter-spacing: 0.01em;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-line); border-radius: 999px;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.btn:hover { --btn-bg: #2a47b0; }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid #2a47b0; outline-offset: 3px; }
.btn--line { --btn-bg: transparent; --btn-fg: #1b2a6b; --btn-line: rgba(29, 47, 107, 0.35); }
.btn--line:hover { --btn-bg: rgba(29, 47, 107, 0.06); --btn-line: rgba(29, 47, 107, 0.6); }
.btn--sm { min-height: 34px; padding: 0 15px; font-size: 0.86rem; }
/* on the black page (and the bar above it) the main button is brass */
.page--dark .btn--main, .on-dark .bar .btn--main { --btn-bg: #e2b65a; --btn-fg: #16120a; }
.page--dark .btn--main:hover, .on-dark .bar .btn--main:hover { --btn-bg: #f0c873; }
.page--dark .btn--line, .on-dark .bar .btn--line { --btn-fg: #efe7d3; --btn-line: rgba(239, 231, 211, 0.32); }
.page--dark .btn--line:hover, .on-dark .bar .btn--line:hover { --btn-bg: rgba(239, 231, 211, 0.08); --btn-line: rgba(239, 231, 211, 0.6); }
.page--dark .btn:focus-visible, .on-dark .bar .btn:focus-visible { outline-color: #e2b65a; }

/* ---- the top bar ---- */
.bar {
  position: fixed; inset: 0 0 auto; z-index: 7;
  display: flex; align-items: center; gap: 14px;
  height: var(--bar); padding: 0 clamp(10px, 2vw, 24px);
  color: #3a4566;
  background: rgba(247, 241, 227, 0.88);
  -webkit-backdrop-filter: blur(10px) saturate(1.1); backdrop-filter: blur(10px) saturate(1.1);
  box-shadow: 0 1px 0 rgba(29, 47, 107, 0.14);
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s, background-color 0.5s ease, box-shadow 0.5s ease, color 0.5s ease;
}
.ready .bar, .no-webgl .bar {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 0.5s ease 0.4s, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.4s, visibility 0s, background-color 0.5s ease, box-shadow 0.5s ease, color 0.5s ease;
}
.on-dark .bar { color: rgba(239, 231, 211, 0.7); background: rgba(8, 9, 11, 0.74); box-shadow: 0 1px 0 rgba(239, 231, 211, 0.09); }
.bar .exit { position: static; opacity: 1; visibility: inherit; transform: none; flex: none; transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease; }
.on-dark .bar .exit { color: #efe7d3; background: rgba(239, 231, 211, 0.08); border-color: rgba(239, 231, 211, 0.22); box-shadow: none; }
.on-dark .bar .exit:hover { background: rgba(239, 231, 211, 0.16); }
.bar__brand { flex: none; font-family: "Libre Caslon Display", "Libre Caslon Text", serif; font-size: 1.2rem; letter-spacing: 0.01em; color: #16223f; transition: color 0.5s ease; }
.on-dark .bar__brand { color: #efe7d3; }

/* in the story: no strip of its own, only a soft shade behind it, so the scene stays the whole window.
   Ivory over the dark room, the sea and the island; ink over the sky, and over the page as it comes up. */
.bar__home {
  flex: none;
  font: 400 1.2rem/1 "Libre Caslon Display", "Libre Caslon Text", serif; letter-spacing: 0.01em;
  color: inherit; text-decoration: none;
}
.bar__skip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 11px 0 14px; border: 1px solid; border-radius: 999px;
  color: inherit; background: none; cursor: pointer;
  font: 400 0.86rem/1 "Libre Caslon Text", Georgia, serif; letter-spacing: 0.01em; white-space: nowrap;
  border-color: color-mix(in srgb, currentColor 42%, transparent);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.bar__skip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bar__skip:hover { border-color: currentColor; background: color-mix(in srgb, currentColor 12%, transparent); }
.bar__skip:active { transform: scale(0.97); }
.bar__skip:focus-visible, .bar__home:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 999px; }
:root:not(.on-site) .bar .exit, :root:not(.on-site) .bar__brand { display: none; }
.on-site .bar__home, .on-site .bar__skip, .no-webgl .bar__skip { display: none; }

.bar::before {
  content: ""; position: absolute; inset: 0 0 -34px; z-index: -1; pointer-events: none;
  background: linear-gradient(rgba(6, 12, 14, 0.62), rgba(6, 12, 14, 0.4) 45%, rgba(6, 12, 14, 0));
  opacity: 0; transition: opacity 0.5s ease;
}
:root:not(.on-site, .no-webgl) .bar { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
:root:not(.on-site, .no-webgl, .near-site, .cutting, .in-sky) .bar { color: #efe7d3; text-shadow: 0 0 10px rgba(6, 12, 14, 0.75), 0 1px 3px rgba(6, 12, 14, 0.55); }
:root:not(.on-site, .no-webgl, .near-site, .cutting, .in-sky) .bar .btn--main { text-shadow: none; }
:root:not(.on-site, .no-webgl, .near-site, .cutting, .in-sky) .bar::before { opacity: 1; }
:root:not(.on-site, .no-webgl, .near-site, .cutting, .in-sky) .bar .btn--main { --btn-bg: #e2b65a; --btn-fg: #16120a; }
:root:not(.on-site, .no-webgl, .near-site, .cutting, .in-sky) .bar .btn--main:hover { --btn-bg: #f0c873; }
:root:not(.on-site, .no-webgl, .near-site, .cutting, .in-sky) .bar .btn--line { --btn-fg: #efe7d3; --btn-line: rgba(239, 231, 211, 0.42); }
:root:not(.on-site, .no-webgl, .near-site, .cutting, .in-sky) .bar .btn--line:hover { --btn-bg: rgba(239, 231, 211, 0.1); --btn-line: rgba(239, 231, 211, 0.75); }
:root:not(.on-site, .no-webgl, .near-site, .cutting, .in-sky) .bar .bar__nav button:hover { color: #fff; }
:root:not(.on-site, .no-webgl, .near-site, .cutting, .in-sky) .bar :is(.btn, .bar__nav button, .bar__menu):focus-visible { outline-color: #e2b65a; }
.in-sky:not(.on-site) .bar { color: var(--sky-ink); }
/* without the 3D scene the page itself scrolls under the bar, dark parts and light ones */
.no-webgl .bar { color: rgba(239, 231, 211, 0.78); background: rgba(8, 9, 11, 0.82); }
.no-webgl .bar .btn--main { --btn-bg: #e2b65a; --btn-fg: #16120a; }
.no-webgl .bar .btn--line { --btn-fg: #efe7d3; --btn-line: rgba(239, 231, 211, 0.32); }
.no-webgl .bar .bar__nav button:hover, .no-webgl .bar .bar__nav button[aria-current="page"] { color: #efe7d3; }
.bar__links { flex: 1; display: flex; align-items: center; gap: 14px; min-width: 0; }
.bar__nav { flex: 1; display: flex; justify-content: center; gap: clamp(4px, 1.4vw, 22px); }
.bar__nav button {
  position: relative;
  padding: 8px 6px; border: 0; background: none; cursor: pointer;
  font: 400 0.9rem/1 "Libre Caslon Text", Georgia, serif; letter-spacing: 0.01em;
  color: inherit; white-space: nowrap;
  transition: color 0.2s ease;
}
.bar__nav button::after {
  content: ""; position: absolute; left: 6px; right: 6px; bottom: 2px; height: 2px; border-radius: 2px;
  background: currentColor; transform: scaleX(0) rotate(-0.6deg); transform-origin: left; transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.bar__nav button:hover { color: #1b2a6b; }
.bar__nav button[aria-current="page"] { color: #1b2a6b; }
.bar__nav button[aria-current="page"]::after { transform: scaleX(1) rotate(-0.6deg); background: #2a47b0; }
.on-dark .bar__nav button:hover, .on-dark .bar__nav button[aria-current="page"] { color: #efe7d3; }
.on-dark .bar__nav button[aria-current="page"]::after { background: #e2b65a; }
.bar__nav button:focus-visible { outline: 2px solid #2a47b0; outline-offset: 2px; border-radius: 4px; }
.bar__act { flex: none; display: flex; gap: 8px; }
.bar__menu { display: none; }

/* the free Cell Counter: only words, in italics, in the colour of whatever is around it */
.bar__try {
  flex: none; display: inline-flex; align-items: center;
  min-height: 34px; padding: 0 6px;
  font: italic 400 0.94rem/1 "Libre Caslon Text", Georgia, serif; letter-spacing: 0.01em; white-space: nowrap;
  color: inherit; text-decoration: none;
  text-underline-offset: 0.28em; text-decoration-thickness: 1px;
}
.bar__try:hover { text-decoration-line: underline; }
.bar__try:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; border-radius: 4px; }
.share__cta .bar__try { min-height: 44px; padding: 0 12px; font-size: 1.06rem; color: #efe7d3; }
.bar__try--row, .bar__try-short { display: none; }

/* narrow windows: the links fold into a menu (bar.js knows this width too) */
@media (max-width: 1139px) {
  .bar { gap: 10px; }
  .bar__try--row { display: inline-flex; }
  .bar__try--act { display: none; }
  .bar__try--row { order: 1; }
  .bar .bar__menu { order: 2; }
  :root:not(.on-site, .no-webgl) .bar .bar__skip { margin-left: 0; margin-right: auto; }
  .on-site .bar .bar__try--row, .no-webgl .bar .bar__try--row { margin-left: auto; }
  .bar .bar__menu { margin-left: 0; }
  .bar .exit span { display: none; }
  .bar .exit { padding: 6px; }
  .bar__menu {
    display: inline-flex; align-items: center; gap: 8px; margin-left: auto;
    min-height: 36px; padding: 0 12px; border: 1px solid rgba(29, 47, 107, 0.26); border-radius: 999px;
    background: none; color: #1b2a6b; font: 400 0.88rem/1 "Libre Caslon Text", Georgia, serif; cursor: pointer;
  }
  .bar__menu i { width: 12px; height: 8px; border-top: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; position: relative; }
  .bar__menu i::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1.5px solid currentColor; translate: 0 -50%; }
  .on-dark .bar__menu, .no-webgl .bar__menu { color: #efe7d3; border-color: rgba(239, 231, 211, 0.3); }
  :root:not(.on-site) .bar__skip { margin-left: auto; }
  :root:not(.on-site, .no-webgl) .bar__menu { margin-left: 0; color: inherit; border-color: color-mix(in srgb, currentColor 42%, transparent); }
  .bar__links {
    position: fixed; top: var(--bar); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 14px;
    padding: 14px 16px 18px;
    background: rgba(247, 241, 227, 0.98);
    box-shadow: 0 16px 30px -18px rgba(22, 34, 63, 0.5);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
  }
  .on-dark .bar__links, .no-webgl .bar__links, :root:not(.on-site, .near-site, .cutting, .in-sky) .bar__links { background: rgba(12, 13, 16, 0.98); }
  .bar.is-open .bar__links { opacity: 1; visibility: visible; transform: none; transition: opacity 0.2s ease, transform 0.25s ease, visibility 0s; }
  .bar__nav { flex-direction: column; gap: 0; }
  .bar__nav button { padding: 13px 4px; text-align: left; font-size: 1.05rem; border-bottom: 1px solid rgba(29, 47, 107, 0.12); }
  .on-dark .bar__nav button { border-bottom-color: rgba(239, 231, 211, 0.1); }
  .bar__nav button::after { left: 4px; right: auto; width: 2.2em; bottom: 8px; }
  .bar__act { justify-content: stretch; }
  .bar__act .btn { flex: 1; min-height: 44px; }
}

/* phones: everything in the row gets its short form */
@media (max-width: 559px) {
  .bar { gap: 8px; }
  .bar__try-full { display: none; }
  .bar__try-short { display: inline; }
  .bar .bar__try { padding: 0 4px; }
  .bar__skip span::before { content: "Skip"; }
  .bar__skip span { font-size: 0; }
  .bar__skip span::before { font-size: 0.86rem; }
  .bar__menu span { display: none; }
  .bar .bar__menu { padding: 0 12px; }
  .on-site .bar__brand { font-size: 1.05rem; }
}
@media (max-width: 374px) {
  :root:not(.on-site) .bar__home { display: none; }
  .on-site .bar__brand { display: none; }
}

/* ---- the admin's way in: faint on purpose ---- */
.admin {
  position: fixed; right: 8px; bottom: 6px; z-index: 6;
  padding: 6px 8px; border: 0; background: none; cursor: pointer;
  font: 400 0.66rem/1 "Libre Caslon Text", Georgia, serif; letter-spacing: 0.12em;
  color: rgba(22, 34, 63, 0.2);
  opacity: 0; visibility: hidden;
  transition: color 0.3s ease, opacity 0.4s ease, visibility 0s linear 0.4s;
}
.on-site .admin { opacity: 1; visibility: visible; transition: color 0.3s ease, opacity 0.6s ease 0.8s, visibility 0s; }
.admin:hover, .admin:focus-visible { color: rgba(22, 34, 63, 0.6); }
.admin:focus-visible { outline: 1px solid currentColor; outline-offset: 1px; border-radius: 3px; }
.on-dark .admin { color: rgba(239, 231, 211, 0.18); }
.on-dark .admin:hover, .on-dark .admin:focus-visible { color: rgba(239, 231, 211, 0.6); }

.admin-dlg {
  width: min(380px, 100vw - 32px);
  padding: 0; border: 0; border-radius: 8px;
  color: #16223f; background: #fcf9f1;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
  font-family: "Libre Caslon Text", Georgia, serif;
}
.admin-dlg::backdrop { background: rgba(8, 9, 11, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.admin-dlg__form { display: grid; gap: 8px; padding: 24px 24px 20px; }
.admin-dlg h2 { margin: 0; font-family: "Libre Caslon Display", serif; font-weight: 400; font-size: 1.5rem; }
.admin-dlg p { margin: 0 0 6px; font-size: 0.92rem; line-height: 1.5; color: #3a4566; }
.admin-dlg label { font-size: 0.85rem; color: #3a4566; }
.admin-dlg input[type="password"] {
  min-height: 42px; padding: 0 12px;
  font: 400 1rem/1 "Libre Caslon Text", Georgia, serif; color: #16223f;
  background: #fff; border: 1px solid rgba(29, 47, 107, 0.3); border-radius: 6px;
}
.admin-dlg input[type="password"]:focus { outline: 2px solid #2a47b0; outline-offset: 1px; border-color: transparent; }
.admin-dlg .admin-dlg__msg { min-height: 1.4em; margin: 0; font-size: 0.86rem; color: #a3271b; }
.admin-dlg__row { display: flex; justify-content: flex-end; gap: 8px; }
.admin-dlg button[disabled] { opacity: 0.6; cursor: progress; }

/* ---- room for the bar on the paper pages ---- */
.home__intro { padding-top: calc(var(--bar) + max(28px, 4vh)); }
.home-js .tour__tool { top: calc(var(--bar) + 12px); white-space: nowrap; }
.home-js .page.is-done .tour__print { top: calc(var(--bar) + 20px); }
.home__foot--two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
@media (max-width: 759px) {
  .home-js .tour__tool { top: calc(var(--bar) + 8px); }
  .home__foot--two { grid-template-columns: 1fr; gap: 12px; }
}

/* =================================================================================================
   Page 3: sharing in the lab
   ================================================================================================= */
.page--dark { position: relative; color: #efe7d3; background: #07080a; }
.share__anchor.home__intro { height: 0; padding: 0; margin: 0; }
.share { --pw: 300px; --ph: 412px; --g: 26px; --hair: 1px; position: relative; }
.home-js .share { --step: 34svh; height: calc(100svh + (var(--n) - 1) * var(--step)); }
.share__stage { position: relative; height: 100svh; overflow: hidden; background: #07080a; }
.home-js .share__stage { position: sticky; top: 0; }
.share__scene { position: absolute; inset: 0; }
.share.no-tr *, .share.no-tr { transition: none !important; animation: none !important; }

/* the book: an open notebook (left page with the front cover behind it, right page, three leaves) */
.bk {
  position: absolute; left: calc(var(--pw) * -1); top: calc(var(--ph) / -2);
  width: calc(var(--pw) * 2); height: var(--ph);
  transform: translate(var(--bx, 0px), var(--by, 0px)) scale(var(--bs, 1));
  transition: transform var(--bdur, 0.7s) cubic-bezier(0.65, 0, 0.2, 1) var(--bdel, 0s), opacity 0.25s ease var(--bodel, 0s);
  will-change: transform;
}
.bk__shift { position: absolute; inset: 0; transition: transform 0.5s ease; }
.share.is-closed .bk__shift { transform: translateX(calc(var(--pw) / -2)); transition: transform 0.85s cubic-bezier(0.5, 0, 0.2, 1) 2.6s; }
.bk__body { position: absolute; inset: 0; perspective: 2400px; transform-style: preserve-3d; }
.bk__right, .bk__leaf { position: absolute; top: 0; left: 50%; width: var(--pw); height: 100%; }
.bk__right { transform: translateZ(-2px); }
.bk__left {
  position: absolute; top: 0; right: 50%; width: var(--pw); height: 100%;
  transform-origin: 100% 50%; transform-style: preserve-3d;
  transform: translateZ(-1px) rotateY(0deg);
  transition: transform 0.55s cubic-bezier(0.5, 0, 0.3, 1);
}
.share.is-closed .bk__left { transform: translateZ(-1px) rotateY(180deg); transition: transform 1.05s cubic-bezier(0.55, 0, 0.25, 1) 2.05s; }
.bk__leaf {
  transform-origin: 0 50%; transform-style: preserve-3d;
  transform: translateZ(calc(0.6px - var(--i) * 0.3px)) rotateY(0deg);
  transition: transform 0.45s ease, opacity 0.15s ease;
}
.share.is-closed .bk__leaf {
  transform: translateZ(calc(0.6px - var(--i) * 0.3px)) rotateY(-180deg);
  opacity: 0;
  transition: transform 1.05s cubic-bezier(0.42, 0.04, 0.3, 1) calc(0.05s + var(--i) * 0.26s), opacity 0.1s linear 2s;
}
.bk__paper {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background-color: #f7f1e3;
  background-image:
    linear-gradient(90deg, rgba(22, 34, 63, 0.16), rgba(22, 34, 63, 0) 7%),
    linear-gradient(rgba(110, 150, 205, 0.2) var(--hair), transparent var(--hair)),
    linear-gradient(90deg, rgba(110, 150, 205, 0.2) var(--hair), transparent var(--hair));
  background-size: 100% 100%, var(--g) var(--g), var(--g) var(--g);
}
.bk__paper--left, .bk__back {
  background-image:
    linear-gradient(270deg, rgba(22, 34, 63, 0.16), rgba(22, 34, 63, 0) 7%),
    linear-gradient(rgba(110, 150, 205, 0.2) var(--hair), transparent var(--hair)),
    linear-gradient(90deg, rgba(110, 150, 205, 0.2) var(--hair), transparent var(--hair));
}
.bk__back { transform: rotateY(180deg); }
.bk__leaf .bk__paper:first-child { box-shadow: inset 1px 0 0 rgba(22, 34, 63, 0.08); }
/* the right page is about to be the top of a new sheet: its header, as on paper pages */
.bk__head {
  position: absolute; left: calc(var(--g) * 2.2); right: calc(var(--g) * 1.6); top: calc(var(--g) * 3.6);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end;
  padding-bottom: calc(var(--g) * 0.4);
  border-bottom: calc(var(--hair) * 2) solid rgba(29, 47, 107, 0.6);
  font-size: calc(var(--g) * 0.6); color: #3a4566;
}
.bk__head b { font: 400 1.4em/1 "Libre Caslon Display", serif; color: #16223f; }
.bk__head span { letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.82em; }
.bk__head i { justify-self: end; font: 400 1.2em/1 "Kalam", cursive; color: #2a47b0; }

/* a notebook's cover: blue cloth, a darker spine, a printed label; the page block shows at the edge */
.cover {
  background-color: #2a43a0;
  background-image:
    linear-gradient(90deg, rgba(5, 10, 30, 0.42) 0 8%, rgba(255, 255, 255, 0.07) 8% 8.6%, rgba(255, 255, 255, 0) 8.6%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.06) 0 2px, transparent 2px 5px),
    radial-gradient(120% 90% at 30% 20%, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.22));
  border-radius: 3px 9px 9px 3px;
  box-shadow: 5px 4px 0 -1px #e9dfc6, 9px 8px 0 -2px #d6cbb0, inset 0 0 0 2px rgba(255, 255, 255, 0.06);
}
.bk__cover { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; transform: rotateY(180deg); }
.cover__label {
  position: absolute; left: 25%; right: 13%; top: 16%;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 12px 18px;
  text-align: center;
  background: #f4eedf; border-radius: 3px;
  box-shadow: inset 0 0 0 5px #f4eedf, inset 0 0 0 6.5px rgba(29, 47, 107, 0.55), 0 2px 4px rgba(0, 0, 0, 0.25);
}
.cover__label b { font: 400 29px/1.04 "Libre Caslon Display", serif; color: #1b2a6b; }
.cover__label i { font: 400 30px/1 "Kalam", cursive; font-style: normal; color: #2a47b0; }

/* the lab: notebooks, the threads between them, comments travelling along them */
.share__world, .share__other { position: absolute; inset: 0; transform-origin: var(--ox, 50%) var(--oy, 50%); }
.share__world { transition: transform 1.3s cubic-bezier(0.6, 0, 0.2, 1); }
.share.s8 .share__world { transform: translateX(var(--wx, 0px)) scale(var(--wk, 1)); }
.share__threads { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.share__threads line { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.share__threads .inv { stroke: rgba(239, 231, 211, 0.55); stroke-width: 1.2; stroke-dasharray: 2 7; opacity: 0; transition: opacity 0.4s ease; }
.share.s2 .share__threads .inv { opacity: 1; transition: opacity 0.5s ease var(--d); }
.share.s3 .share__threads .inv { opacity: 0; transition: opacity 0.4s ease; }
.share__threads .thr, .share__threads .glow { stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; transition: stroke-dashoffset 0.5s ease, opacity 0.3s ease, stroke 0.4s ease; }
.share__threads .thr { stroke: #e2b65a; stroke-width: 1.7; }
.share__threads .glow { stroke: rgba(242, 193, 78, 0.16); stroke-width: 7; }
.share.s3 .share__threads .thr, .share.s3 .share__threads .glow {
  stroke-dashoffset: 0; opacity: 1;
  transition: stroke-dashoffset 1s cubic-bezier(0.45, 0, 0.2, 1) var(--d), opacity 0.2s linear var(--d), stroke 0.4s ease;
}
.share.s4:not(.s5) .share__threads .thr.is-c { stroke: #ffd27a; stroke-width: 2.6; }
.share.s4:not(.s5) .share__threads .glow.is-c { stroke: rgba(255, 196, 80, 0.32); }
.share__threads--other line { stroke: rgba(150, 170, 220, 0.45); stroke-width: 1.3; }

.nb { position: absolute; left: 0; top: 0; transform: translate(var(--x, 0px), var(--y, 0px)); opacity: 0; transition: opacity 0.35s ease; }
.nb.is-on { opacity: 1; transition: opacity 0.6s ease var(--d, 0s); }
.nb__book {
  position: absolute; left: calc(var(--pw) / -2); top: calc(var(--ph) / -2); width: var(--pw); height: var(--ph);
  transform: scale(var(--s, 0.3)); transform-origin: 50% 50%;
  transition: transform 0.6s cubic-bezier(0.2, 1.3, 0.4, 1), filter 0.8s ease;
}
.nb:not(.is-on) .nb__book { transform: scale(calc(var(--s, 0.3) * 0.7)); }
.nb.is-on .nb__book { transition: transform 0.7s cubic-bezier(0.2, 1.3, 0.4, 1) var(--d, 0s), filter 0.8s ease; }
.share.s3 .nb__book { filter: drop-shadow(0 0 22px rgba(242, 193, 78, 0.28)); }
.nb--other .nb__book { background-color: #4b5a78; filter: none; }
.share.s3 .nb--other .nb__book { filter: none; }
.cover__label--lock { justify-content: center; min-height: 120px; }
.cover__label--lock svg { width: 64px; height: 64px; fill: none; stroke: #4b5a78; stroke-width: 1.8; stroke-linecap: round; }
.nb__name, .nb__left {
  position: absolute; left: 0; top: calc(var(--nh) / 2 + 12px);
  white-space: nowrap; translate: -50% 0;
  font: 400 0.95rem/1.2 "Libre Caslon Text", Georgia, serif; color: rgba(239, 231, 211, 0.78);
  text-shadow: 0 0 4px #07080a, 0 0 8px #07080a, 0 0 12px #07080a;
  transition: opacity 0.5s ease, transform 0.6s ease;
}
.nb__name small { margin-left: 0.35em; font: 400 0.95em/1 "Kalam", cursive; color: #e2b65a; }
.nb[data-id="you"] .nb__name { color: #efe7d3; }
.nb__left { font-family: "Kalam", cursive; color: rgba(239, 231, 211, 0.42); opacity: 0; }
.share.s6 .nb[data-id="bora"] .nb__name { opacity: 0; transform: translateY(10px); }
.share.s6 .nb[data-id="bora"] .nb__left { opacity: 1; transition: opacity 0.6s ease 0.45s; }
.nb__badge {
  position: absolute; left: calc(var(--nw) / 2 - 14px); top: calc(var(--nh) / -2 - 12px);
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 9px 4px 6px; border-radius: 999px;
  font: 600 0.82rem/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #fff;
  background: #b65f06; box-shadow: 0 0 0 2px #07080a, 0 0 18px rgba(242, 160, 50, 0.55);
  opacity: 0; transform: scale(0.6); transition: opacity 0.25s ease, transform 0.25s ease;
}
.nb__badge svg { width: 13px; height: 13px; fill: currentColor; transform-origin: 50% 10%; }
.share.s4 .nb__badge { opacity: 1; transform: scale(1); transition: opacity 0.3s ease 2.3s, transform 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) 2.3s; }
.share.s5 .nb__badge { transition-delay: 0s; transform: scale(1.18); }
.share.s5 .nb__badge svg { animation: ring 0.7s ease 0.2s 3; }
.share.s6 .nb__badge { transform: scale(1); }
@keyframes ring { 0%, 100% { rotate: 0deg; } 25% { rotate: 18deg; } 75% { rotate: -18deg; } }

.share__bubble {
  position: absolute; left: 0; top: 0; width: 34px; height: 28px; margin: -14px 0 0 -17px;
  border-radius: 10px 10px 10px 3px; background: #f2c14e;
  box-shadow: 0 0 22px rgba(242, 193, 78, 0.75);
  opacity: 0; pointer-events: none;
}
.share__bubble::before, .share__bubble::after { content: ""; position: absolute; left: 8px; right: 8px; height: 2.5px; border-radius: 2px; background: rgba(60, 36, 4, 0.55); }
.share__bubble::before { top: 9px; }
.share__bubble::after { top: 15px; right: 13px; }
.share.s4:not(.s5) .share__bubble { animation: travel 1.9s cubic-bezier(0.5, 0, 0.3, 1) var(--d, 0s) both; }
@keyframes travel {
  0% { opacity: 0; transform: translate(var(--x0), var(--y0)) scale(0.4); }
  14% { opacity: 1; transform: translate(var(--x0), var(--y0)) scale(1); }
  84% { opacity: 1; transform: translate(var(--x1), var(--y1)) scale(1); }
  100% { opacity: 0; transform: translate(var(--x1), var(--y1)) scale(0.3); }
}

/* step 7: a notebook's pages come out of it as one PDF (yours, and a labmate's): the sheets rise from behind the cover */
.share__pdf {
  position: absolute; left: 0; top: 0; width: var(--pdf, 64px); aspect-ratio: 210 / 297;
  transform: translate(var(--x, 0px), var(--y, 0px)) translate(-50%, -50%) scale(0.5);
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease, transform 0.5s ease;
}
.share__pdf i {
  position: absolute; inset: 0; border-radius: 2px; background: #fcf9f1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 22px -10px rgba(0, 0, 0, 0.8);
  transform-origin: 50% 100%; transition: transform 0.7s cubic-bezier(0.2, 1.1, 0.4, 1) 0.5s;
}
/* the top sheet is the cover: the two rules, the title and the label of the real one */
.share__pdf i:nth-child(3) {
  background:
    linear-gradient(#26356b, #26356b) 50% 19% / 78% 1.5px no-repeat,
    linear-gradient(#26356b, #26356b) 50% 93% / 78% 1.5px no-repeat,
    linear-gradient(#26356b, #26356b) 50% 41% / 52% 6% no-repeat,
    linear-gradient(#26356b, #26356b) 50% 49% / 44% 6% no-repeat,
    linear-gradient(rgba(38, 53, 107, 0.16), rgba(38, 53, 107, 0.16)) 50% 80% / 64% 17% no-repeat,
    #fcf9f1;
}
.share__pdf b {
  position: absolute; right: -10px; bottom: -8px; padding: 4px 6px 3px; border-radius: 4px;
  font: 700 0.66rem/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: 0.04em;
  color: #16120a; background: #e2b65a;
}
.share.s7:not(.s8) .share__pdf {
  opacity: 1; transform: translate(var(--x1, 0px), var(--y1, 0px)) translate(-50%, -50%) scale(1);
  transition: opacity 0.4s ease var(--d, 0s), transform 0.9s cubic-bezier(0.2, 0.9, 0.3, 1) var(--d, 0s);
}
.share.s7:not(.s8) .share__pdf i:nth-child(1) { transform: rotate(7deg); }
.share.s7:not(.s8) .share__pdf i:nth-child(2) { transform: rotate(3deg); }
.home-js .callout .inset--cover { width: 46%; margin-inline: auto; }

.share__other { opacity: 0; transition: opacity 0.4s ease; }
.share.s8 .share__other { opacity: 1; transition: opacity 0.9s ease 0.8s; }
.share__label {
  position: absolute; left: 0; top: 0; transform: translate(var(--x, 0px), var(--y, 0px)); translate: -50% 0;
  font: 400 1.3rem/1 "Kalam", cursive; color: #efe7d3; white-space: nowrap;
  opacity: 0; transition: opacity 0.4s ease;
}
.share__label[data-for="other"] { color: rgba(170, 186, 228, 0.85); }
.share.s8 .share__label { opacity: 0.9; transition: opacity 0.7s ease 1s; }

/* the page's title, on the black, once the book has closed */
.share__head {
  position: absolute; left: 50%; top: calc(var(--bar) + 4.5svh); z-index: 2;
  width: min(46rem, 100% - 32px); translate: -50% 0;
  text-align: center; color: #efe7d3;
  --pen: #efe7d3; --pen-wet: #f2c14e;
  opacity: 0; transition: opacity 0.35s ease; pointer-events: none;
}
.share.is-closed .share__head { opacity: 1; transition: opacity 0.9s ease 2.2s; }
.share.s1 .share__head { opacity: 0; transition: opacity 0.35s ease; }
.share__head h1.pen { margin: 0 0 0.12em; font-size: clamp(2.8rem, 6.4vw, 5.4rem); }
.home .share__head .lede { margin: 0 auto; max-width: 40ch; color: rgba(239, 231, 211, 0.76); }
.home-js .share__tool { opacity: 0; transition: opacity 0.35s ease; }
.home-js .share.s1 .share__tool { opacity: 1; transition: opacity 0.6s ease 0.6s; }

/* the notes are the same paper slips as on the other pages, lying on the black */
.page--dark .callout { color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 30px 60px -22px rgba(0, 0, 0, 0.95); }

/* step 1: your notebook alone, and where its shared copy is kept */
.nb[data-id="you"] { transition: opacity 0.35s ease, transform 1s cubic-bezier(0.6, 0, 0.2, 1); }
.nb[data-id="you"].is-on { transition: opacity 0.6s ease var(--d, 0s), transform 1s cubic-bezier(0.6, 0, 0.2, 1); }
.nb[data-id="you"] .nb__book { transition: transform 1s cubic-bezier(0.6, 0, 0.2, 1), filter 0.8s ease; }
.share__srv {
  position: absolute; left: 0; top: 0; transform: translate(var(--x, 0px), var(--y, 0px)); translate: -50% -50%;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font: 400 0.9rem/1.2 "Libre Caslon Text", Georgia, serif; color: rgba(239, 231, 211, 0.7); text-align: center; white-space: nowrap;
  opacity: 0; transition: opacity 0.35s ease;
}
.share__srv svg { width: 46px; height: 46px; fill: none; stroke: #e2b65a; stroke-width: 1.6; }
.share__srv small { font: 400 0.95rem/1 "Kalam", cursive; color: #e2b65a; }
.share.s1:not(.s2) .share__srv { opacity: 1; transition: opacity 0.6s ease 1.5s; }
.share__threads .srv { stroke: rgba(226, 182, 90, 0.7); stroke-width: 1.3; stroke-dasharray: 2 6; opacity: 0; transition: opacity 0.3s ease; }
.share.s1:not(.s2) .share__threads .srv { opacity: 1; transition: opacity 0.6s ease 1.3s; }

/* the end: an invitation */
.share__foot { padding-top: clamp(64px, 16vh, 160px); padding-bottom: clamp(80px, 16vh, 160px); text-align: center; --pen: #efe7d3; --pen-wet: #f2c14e; --rule: rgba(239, 231, 211, 0.18); --ballpoint: rgba(239, 231, 211, 0.62); }
.share__foot h2.pen { font-size: clamp(2.6rem, 5.4vw, 4.4rem); }
.home .share__foot p { margin: 0.5em auto 1.6em; color: rgba(239, 231, 211, 0.74); }
.home .share__foot p strong { font-weight: 400; color: #f2c14e; }
.share__cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: clamp(56px, 12vh, 120px); }
.share__foot .page-link:hover { color: #efe7d3; }
.share__foot .page-link:focus-visible { outline-color: #e2b65a; }

/* a finished page 3: the whole lab in view on the left, every note beside it */
.home-js .page.is-done .share { height: auto; }
.home-js .page.is-done .share__stage {
  position: relative; top: auto; height: auto; overflow: visible;
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  column-gap: clamp(20px, 3vw, 56px); row-gap: 26px; align-items: start;
  max-width: 104rem; margin: 0 auto;
  padding: calc(var(--bar) + 36px) clamp(16px, 3vw, 48px) 0;
}
.home-js .page.is-done .share__head { position: static; translate: none; grid-column: 1 / -1; width: auto; opacity: 1; transition: none; }
.home-js .page.is-done .share__head .pen .w { animation: none; color: var(--pen); -webkit-mask-image: none; mask-image: none; }
.home-js .page.is-done .share__tool { display: none; }
.home-js .page.is-done .share__scene { position: sticky; top: var(--bar); height: calc(100svh - var(--bar)); grid-column: 1; grid-row: 2 / span 8; }
.home-js .page.is-done .share__notes { display: contents; }
.home-js .page.is-done .share .callout { grid-column: 2; }
.home-js .page.is-done .share .callout .inset img { max-height: 190px; }
.home-js .page.is-done .bk { display: none; }

/* phones: the lab above, the note below */
@media (max-width: 759px) {
  .home-js .share { --step: 40svh; }
  .share__head { top: calc(var(--bar) + 3svh); }
  .share__head h1.pen { font-size: 2.7rem; }
  .nb__name, .nb__left { font-size: 0.8rem; top: calc(var(--nh) / 2 + 7px); }
  .nb__name small { display: block; margin: 2px 0 0; text-align: center; }
  .share__label { font-size: 1.05rem; }
  .home-js .page.is-done .share__stage { grid-template-columns: minmax(0, 1fr); padding-top: calc(var(--bar) + 20px); }
  .home-js .page.is-done .share__scene { position: relative; top: auto; height: 62svh; grid-row: auto; }
  .home-js .page.is-done .share .callout { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .share *, .share { transition-duration: 0.01s !important; transition-delay: 0s !important; animation: none !important; }
  .bar, .bar__links, .admin { transition-duration: 0.01s !important; }
}

/* page 3's end leads on to page 4 */
.share__turn { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
@media (max-width: 759px) { .share__turn { grid-template-columns: 1fr; gap: 12px; } }

/* the last line of the last page */
.home #p4 .home__foot { padding-bottom: clamp(48px, 10vh, 96px); }
.home .legal { max-width: none; margin: 26px 0 0; font-size: 14px; text-align: center; color: var(--text-soft); }
.home .legal a { color: inherit; }
