/* Scribe — the sign-in page's showcase: on a wide screen, the page splits
 * in two, the sign-in form on the left and, on the right, a stack of
 * homework pages that Scribe writes one after another
 * (lib/signin-showcase.js, which sets each sheet's data-place and its
 * is-leaving and is-settling classes). Below WIDE's width it is gone and
 * the sign-in page is one column, as before.
 *
 * Built only from styles.css's tokens. The pages are paper (--paper), white
 * in both themes, as every handwritten page is. */

.showcase { display: none; }

/* lib/signin-showcase.js WIDE: the same width, or the pen writes on a panel nobody sees. */
@media (min-width: 1000px) {
  /* The form and the stack each in the middle of its half, less this much
     at the window's edge, so they stand a little in towards each other:
     about 330 px apart on a 2000 px window, where centred in the whole of
     their halves they stood 420 px apart. Nothing at 1000 px, where the
     card all but fills its half. (Drawn right in to the middle, as Claude's
     are, they were too close, and a turned page crossed the form.) */
  body[data-view="signin"] { --showcase-pull: clamp(0px, (100vw - 1000px) * 0.12, 120px); }
  body[data-view="signin"] .shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  /* The form in the middle of what its half leaves, between the brand
     (where it was, at the window's edge) and the footer links under it. */
  body[data-view="signin"] .signin-view { margin: auto; }
  body[data-view="signin"] .signin-view,
  body[data-view="signin"] .main-col > .site-footer { translate: calc(var(--showcase-pull) / 2) 0; }
  body[data-view="signin"] .main-col > .site-footer { margin-top: 0; }

  /* The stack straight on the page, in the middle of what its half leaves,
     staying in view if the form's side is taller than the window. A turned
     page goes off its right, and is cut there rather than widening the page. */
  body[data-view="signin"] .showcase { position: sticky; top: 20px; display: grid; place-items: center; height: calc(100dvh - 40px); margin: 20px 20px 20px 0; padding-right: var(--showcase-pull); overflow: clip; }
}

/* A page's shape at the size there is room for: as large as leaves room
   for the sheets askew behind it, never taller than about four fifths of
   the window, nor wider than four fifths of what its half leaves. */
.showcase-stack { position: relative; width: min(78%, 61dvh); aspect-ratio: 612 / 792; }

/* A soft shadow under each sheet, not the desk's hairline edge in the dark
   theme (--page-shadow), which drew a dark line round the white paper. */
.showcase-sheet { position: absolute; inset: 0; overflow: hidden; border-radius: 3px; background: var(--paper); box-shadow: 0 6px 24px var(--shadow-mid), 0 1px 3px var(--shadow-soft); transition: transform .45s cubic-bezier(.4, 0, .2, 1), opacity .45s ease-in; }
/* The page, then over it the clear layer the stroke under way is drawn on. */
.showcase-sheet canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.showcase-sheet canvas:first-child { animation: showcase-in .3s ease-out; }
@keyframes showcase-in { from { opacity: 0; } }

/* The stack: the page being written on top, two more askew behind it, and
   the rest out of sight under those. */
.showcase-sheet[data-place="0"] { z-index: 4; transform: none; }
.showcase-sheet[data-place="1"] { z-index: 3; transform: translate(3.5%, -2.5%) rotate(2.6deg); }
.showcase-sheet[data-place="2"] { z-index: 2; transform: translate(-3%, -4%) rotate(-2.2deg); }
.showcase-sheet[data-place="back"] { z-index: 1; transform: translate(-3%, -4%) rotate(-2.2deg); }
/* A finished page flicked off up and to the right, away from the form,
   fading as it goes, over the others; then, wiped, it drops in at the back
   without travelling there. */
.showcase-sheet.is-leaving { z-index: 5; transform: translate(34%, -9%) rotate(8deg); opacity: 0; }
.showcase-sheet.is-settling { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .showcase-sheet { transition: none; }
  .showcase-sheet canvas:first-child { animation: none; }
}
