/* ============================================================
   SILICA WORKS - the studio booklet
   ------------------------------------------------------------
   "What happens after you say yes", a printed tri-fold that
   carries the studio page on from its intro (studio.html,
   js/studio-booklet.js).

     the intro    the words on the left; the leaflet, shut, lies
                  on the desk in the right-hand column
     the travel   picked up as you scroll, carried into the middle
                  and set down (on a phone it rides up under the
                  words and is caught there)
     the story    the cover swings open; the camera leans in on one
                  page at a time (before, during, after), a paint
                  pen marks each one and a note on the desk says why
                  it matters; then it draws back to the whole open
                  leaflet: "Now you know."

   THE PAPER is drawn by the script, in WebGL, from the pages in
   .sb-leaf: lime stock outside (the cover, the flap's back), an
   ink flood inside, a spot varnish on the cover's mark and its
   "yes.". This file only sets those pages as print - the same
   pages, laid flat, are what you get without WebGL or with motion
   reduced.

   Every size on a page runs off the panel's width (--u is 1% of
   it), so the script can lay the pages out at one fixed size to
   paint them, and a phone's page is the same page, not a squeezed
   one. Nothing on a page uses a pseudo-element or a transform:
   the painter reads boxes, text and SVG paths, nothing else.
   ============================================================ */

.sb {
  /* A panel's height over its width, as cut. */
  --A: 1.6;
  --W: min(21.5rem, 23vw, calc((100svh - 10.5rem - var(--sw-park-off) - var(--sw-bar-h, 60px)) / var(--A)));
  --H: calc(var(--W) * var(--A));
  --Z: 1.1;
  --S: 0.86;
  --foot: calc(var(--sw-park-off) + var(--sw-bar-h, 60px) + 1.25rem);
  position: relative;
}

/* The words take the left of the intro; the right is the
   booklet's place on the desk. */
.sb .tm-intro {
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
}

.sb .tm-intro-text {
  grid-column: 1;
}

.sb-spot--d {
  grid-column: 2;
  grid-row: 1;
  min-height: 100%;
}

.sb-spot--m {
  display: none;
}

/* The story's scroll. */
.sb-run {
  height: 620svh;
}

/* ------------------------------------------------------------
   The stage: one screen, held while the section scrolls under
   it, full bleed across the sheet's gutters. The canvas covers
   it; the paper and its shadows are the only things drawn on it,
   so the page shows through everywhere else.
   ------------------------------------------------------------ */
.sb-pin {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -2.5rem;
  right: -2.5rem;
  z-index: 2;
  pointer-events: none;
}

.sb-stage {
  position: sticky;
  top: 0;
  display: grid;
  place-items: center;
  height: 100svh;
  padding: 1.5rem 0 var(--foot);
  overflow: hidden;
}

.sb-gl {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* One panel at its size on the desk, for the script to measure. */
.sb-gauge {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--W);
  height: var(--H);
  visibility: hidden;
}

.sb-notes {
  grid-area: 1 / 1;
}

/* The pages, while the paper is live: laid out side by side at
   one fixed size for the painter, and kept in the page unseen for
   a screen reader. */
.sb[data-sb-live] .sb-leaf {
  --W: 400px;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: flex-start;
  gap: 24px;
  opacity: 0;
  pointer-events: none;
}

/* ------------------------------------------------------------
   The pages, as printed
   ------------------------------------------------------------ */
.sb-face {
  --u: calc(var(--W) / 100);
  --ink: #17170f;
  --lime: #d9ff3d;
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex: none;
  flex-direction: column;
  width: var(--W);
  height: calc(var(--W) * var(--A));
  padding: calc(var(--u) * 8.5) calc(var(--u) * 7.5) calc(var(--u) * 6.2);
  overflow: hidden;
  font-family: "sohne-normal", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 3.5);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: left;
}

/* The panel that tucks in when it is folded is cut a little
   narrower than the others, as a real roll fold's is. */
.sb-face--tuck {
  width: calc(var(--W) * 0.975);
}

/* Weightless, so every rule below wins over it. */
:where(.sb-face) :where(p, ul, ol, dl, dt, dd, li, h3) {
  margin: 0;
  padding: 0;
}

:where(.sb-face) :where(ul, ol) {
  list-style: none;
}

/* An ink flood inside, knocked out to the paper for the text;
   lime stock outside. */
.sb-in {
  background: var(--ink);
  color: #f4f4f2;
}

.sb-out {
  background: var(--lime);
  color: #14140f;
}

.sb-kick {
  font-family: "sohne-bold", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 2.7);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244, 244, 242, 0.55);
}

.sb-out .sb-kick {
  color: rgba(20, 20, 15, 0.62);
}

/* The chapter word: each page's one loud thing, in the lime. */
.sb-big {
  margin: calc(var(--u) * 2.6) 0 0 calc(var(--u) * -0.9);
  font-family: "sohne-bold", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 19.5);
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: -0.045em;
  text-transform: uppercase;
  color: var(--lime);
}

.sb-lead {
  margin-top: calc(var(--u) * 7.5);
  font-size: calc(var(--u) * 3.6);
  line-height: 1.45;
  color: rgba(244, 244, 242, 0.72);
}

/* Before: the four questions, as asked. */
.sb-qs {
  margin-top: calc(var(--u) * 3.6);
  font-family: "sohne-bold", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 4.9);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -0.012em;
}

.sb-qs li + li {
  margin-top: calc(var(--u) * 2.1);
}

.sb-body {
  margin-top: calc(var(--u) * 4.4);
  font-size: calc(var(--u) * 3.5);
  line-height: 1.5;
  color: rgba(244, 244, 242, 0.74);
}

/* A boxed note at the foot of the page. */
.sb-aside {
  margin-top: auto;
  padding: calc(var(--u) * 3) calc(var(--u) * 3.4);
  border: 1px solid rgba(244, 244, 242, 0.22);
  font-size: calc(var(--u) * 3.1);
  line-height: 1.45;
  color: rgba(244, 244, 242, 0.78);
}

.sb-folio {
  display: flex;
  justify-content: space-between;
  margin-top: calc(var(--u) * 4.6);
  font-family: "sohne-medium", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 2.3);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244, 244, 242, 0.42);
}

/* During: the line, then the credits. Every role is "Us". */
.sb-say {
  margin-top: calc(var(--u) * 7.5);
  font-family: "sohne-bold", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 5.6);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.sb-say + .sb-body {
  margin-top: calc(var(--u) * 3.4);
}

.sb-credits {
  margin-top: calc(var(--u) * 5.6);
}

.sb-credits > div {
  display: flex;
  align-items: baseline;
  gap: calc(var(--u) * 2);
}

.sb-credits > div + div {
  margin-top: calc(var(--u) * 2.6);
}

.sb-credits dt {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: calc(var(--u) * 2);
  font-family: "sohne-bold", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 2.7);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244, 244, 242, 0.55);
}

/* The dotted leader from a role to its name. */
.sb-dots {
  flex: 1;
  border-bottom: calc(var(--u) * 0.5) dotted rgba(244, 244, 242, 0.28);
}

.sb-credits dd {
  font-family: "sohne-bold", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 6);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
}

.sb-small {
  margin-top: auto;
  font-size: calc(var(--u) * 3.1);
  line-height: 1.45;
  color: rgba(244, 244, 242, 0.6);
}

/* After: the line, the list ticked off before launch, what you
   own, and how to start. */
.sb-checks {
  margin-top: calc(var(--u) * 5.2);
  font-family: "sohne-medium", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 3.8);
  font-weight: 500;
  line-height: 1.25;
}

.sb-checks li {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 2.4);
}

.sb-checks li + li {
  margin-top: calc(var(--u) * 2);
}

/* A printed tick box. */
.sb-box {
  display: block;
  flex: none;
  width: calc(var(--u) * 4.2);
  height: calc(var(--u) * 4.2);
  background: var(--lime);
}

.sb-box svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #14140f;
  stroke-width: 2.6;
  stroke-linecap: square;
}

.sb-checks + .sb-small {
  margin-top: calc(var(--u) * 5);
}

.sb-reach {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 4);
  margin-top: auto;
  padding-top: calc(var(--u) * 4.4);
  border-top: 1px solid rgba(244, 244, 242, 0.18);
}

.sb-qr {
  display: block;
  flex: none;
  width: calc(var(--u) * 17);
  height: calc(var(--u) * 17);
}

.sb-reach p {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 1.1);
  font-size: calc(var(--u) * 2.9);
  line-height: 1.3;
  color: rgba(244, 244, 242, 0.6);
}

.sb-reach b {
  font-family: "sohne-bold", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 2.5);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244, 244, 242, 0.55);
}

.sb-mail {
  font-family: "sohne-bold", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 4.3);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--lime);
}

/* The cover: the face you meet on the desk. */
.sb-cover-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: calc(var(--u) * 4);
}

.sb-cover-mark {
  display: block;
  flex: none;
  width: calc(var(--u) * 15);
  height: calc(var(--u) * 12.24);
  fill: #14140f;
}

.sb-cover-kick {
  font-family: "sohne-bold", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 2.6);
  font-weight: 800;
  line-height: 1.55;
  letter-spacing: 0.14em;
  text-align: right;
  text-transform: uppercase;
  color: rgba(20, 20, 15, 0.72);
}

.sb-cover-title {
  margin-top: auto;
  font-family: "sohne-bold", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 12.6);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.025em;
  text-transform: uppercase;
}

/* "yes." in a block of ink, the one word you remember, under a
   gloss varnish. */
.sb-yes {
  display: inline-block;
  margin-top: 0.08em;
  padding: 0.06em 0.12em 0;
  background: #14140f;
  color: var(--lime);
}

.sb-cover-foot {
  display: flex;
  justify-content: space-between;
  gap: calc(var(--u) * 3);
  margin-top: calc(var(--u) * 6.5);
  padding-top: calc(var(--u) * 3);
  border-top: 1px solid rgba(20, 20, 15, 0.3);
  font-family: "sohne-medium", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 2.3);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(20, 20, 15, 0.72);
}

/* The flap's outside: what you see first when the cover opens. */
.sb-short {
  margin-top: calc(var(--u) * 7);
  border-bottom: 1px solid rgba(20, 20, 15, 0.24);
  font-family: "sohne-bold", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 5.3);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.sb-short li {
  padding: calc(var(--u) * 3) 0;
  border-top: 1px solid rgba(20, 20, 15, 0.24);
}

.sb-flap-foot {
  margin-top: auto;
  font-family: "sohne-medium", "Inter Tight", sans-serif;
  font-size: calc(var(--u) * 3.2);
  font-weight: 500;
  line-height: 1.3;
  color: rgba(20, 20, 15, 0.72);
}

/* ------------------------------------------------------------
   The paint pen: lime on the ink. Live, the script draws each
   mark on along its stroke; laid flat, they are simply there.
   ------------------------------------------------------------ */
.sb-mk {
  position: relative;
  white-space: nowrap;
}

.sb-pen {
  position: absolute;
  overflow: visible;
  fill: none;
  stroke: var(--lime);
  stroke-width: calc(var(--u) * 1.05);
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.sb-pen path {
  vector-effect: non-scaling-stroke;
}

.sb-pen--box {
  left: -0.36em;
  top: -0.3em;
  width: calc(100% + 0.62em);
  height: calc(100% + 0.56em);
}

.sb-pen--ring {
  left: -0.4em;
  top: -0.32em;
  width: calc(100% + 0.8em);
  height: calc(100% + 0.62em);
}

.sb-pen--ul {
  left: -0.05em;
  bottom: -0.36em;
  width: calc(100% + 0.1em);
  height: 0.42em;
}

/* ------------------------------------------------------------
   The notes, on the desk. .sb-notes is a point at the middle of
   the stage, where the page being read always sits; each note is
   placed from it in panel widths and heights times the reading
   zoom (--Z), or the pull-back (--S) for the last. The arrow is
   drawn horizontal or vertical (arr-h, arr-v) and turned by
   data-d (desktop) / data-m (phone). Hidden until written.
   ------------------------------------------------------------ */
.sb-notes {
  position: relative;
  width: 0;
  height: 0;
}

.sb-note {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: max-content;
  margin: 0;
  padding: 0.25rem;
  font-family: "Shadows Into Light", "Inter Tight", cursive;
  font-size: clamp(1.45rem, 1.85vw, 2rem);
  line-height: 1.15;
  letter-spacing: 0.035em;
  -webkit-text-stroke: 0.028em currentColor;
  color: var(--sw-ink);
  clip-path: inset(-40% -40% -40% 140%);
}

.sb-note-t {
  display: block;
  transform: rotate(-4deg);
}

.sb-note svg {
  flex: none;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sb-note .arr-h { width: clamp(3.25rem, 4.5vw, 5rem); }
.sb-note .arr-v { width: 1.8rem; margin-left: 1.5rem; }

@media (min-width: 1001px) {
  .sb-note:is([data-d="r"], [data-d="l"]) .arr-v,
  .sb-note:is([data-d="u"], [data-d="d"]) .arr-h { display: none; }
  .sb-note[data-d="l"] { flex-direction: row-reverse; }
  .sb-note[data-d="l"] .arr-h { transform: scaleX(-1); }
  .sb-note[data-d="d"] { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
  .sb-note[data-d="u"] { flex-direction: column-reverse; align-items: flex-start; gap: 0.3rem; }
  .sb-note[data-d="u"] .arr-v { transform: scaleY(-1); }

  /* Shut, in the middle. */
  .sb-note--open {
    left: calc(var(--W) * 0.5 + 1.75rem);
    top: calc(var(--H) * -0.12);
    transform: translateY(-50%);
  }

  /* Before: nothing left of it, so the note goes there. */
  .sb-note--ask {
    left: calc(var(--W) * var(--Z) * -0.5 - 1.75rem);
    top: calc(var(--H) * var(--Z) * 0.06);
    transform: translate(-100%, -50%);
  }

  /* During: pages either side, so over it. */
  .sb-note--same {
    left: calc(var(--W) * var(--Z) * -0.2);
    top: calc(var(--H) * var(--Z) * -0.5 - 0.4rem);
    transform: translateY(-100%);
  }

  /* After: nothing right of it. */
  .sb-note--stay {
    left: calc(var(--W) * var(--Z) * 0.5 + 1.75rem);
    top: calc(var(--H) * var(--Z) * 0.06);
    transform: translateY(-50%);
  }

  /* The whole leaflet, drawn back: under it. */
  .sb-note--end {
    left: calc(var(--W) * var(--S) * -0.35);
    top: calc(var(--H) * var(--S) * 0.5 + 0.5rem);
  }
}

/* ------------------------------------------------------------
   Phone: the intro is words alone; the booklet waits under them,
   rides up into the middle and opens sideways as on a desktop, a
   page nearly the width of the screen. It stays on the last page
   at the end. The notes go over and under the page being read,
   one line each.
   ------------------------------------------------------------ */
@media (max-width: 1000px) {
  .sb {
    --W: min(calc(100vw - 3rem), calc((100svh - 12.5rem - var(--sw-park-off) - var(--sw-bar-h, 60px)) / var(--A)));
    --Z: 1;
    --S: 1;
  }

  .sb .tm-intro {
    grid-template-columns: minmax(0, 1fr);
  }

  .sb-spot--d {
    display: none;
  }

  .sb-spot--m {
    display: block;
    height: 85svh;
  }

  .sb-run {
    height: 580svh;
  }

  .sb-pin {
    left: -1.25rem;
    right: -1.25rem;
  }

  .sb-stage {
    padding-top: 1rem;
  }

  .sb-note {
    font-size: 1.35rem;
  }

  .sb-note br {
    display: none;
  }

  .sb-note .arr-h { display: none; }
  .sb-note .arr-v { width: 1.35rem; }
  .sb-note[data-m="d"] { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
  .sb-note[data-m="u"] { flex-direction: column-reverse; align-items: flex-start; gap: 0.2rem; }
  .sb-note[data-m="u"] .arr-v { transform: scaleY(-1); }

  .sb-note--open {
    left: calc(var(--W) * -0.3);
    top: calc(var(--H) * 0.5 + 0.5rem);
  }

  .sb-note--stay,
  .sb-note--end {
    left: calc(var(--W) * -0.3);
    top: calc(var(--H) * var(--Z) * 0.5 + 0.5rem);
  }

  .sb-note--ask,
  .sb-note--same {
    left: calc(var(--W) * -0.5);
    top: calc(var(--H) * var(--Z) * -0.5 - 0.4rem);
    transform: translateY(-100%);
  }
}

/* ------------------------------------------------------------
   Still (motion reduced, no WebGL or no script): no desk and no
   folds - the three inside pages laid out flat under the intro,
   side by side, or stacked on a phone.
   ------------------------------------------------------------ */
.sb:not([data-sb-live]) :is(.sb-spot--d, .sb-spot--m, .sb-run, .sb-gl, .sb-notes, .sb-out) {
  display: none;
}

.sb:not([data-sb-live]) .sb-pin {
  position: relative;
  inset: auto;
  margin-top: clamp(2.5rem, 6vh, 4rem);
  pointer-events: auto;
}

.sb:not([data-sb-live]) .sb-stage {
  position: relative;
  display: block;
  height: auto;
  padding: 0;
  overflow: visible;
}

.sb:not([data-sb-live]) .sb-leaf {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.sb:not([data-sb-live]) .sb-face--tuck {
  width: var(--W);
}

@media (max-width: 1000px) {
  .sb:not([data-sb-live]) .sb-pin {
    left: auto;
    right: auto;
  }
}
