/* The regular website, page 1: how the notebook works. The page is a sheet of the lab notebook:
   headings written with a dip pen, the app's screens taped on like printouts, notes in ballpoint.
   Two tours: one big screenshot stays in view while scrolling zooms to one part at a time,
   marks it with a highlighter and pops up a note about it beside it. */

@font-face {
  font-family: "Pinyon Script";
  src: url("../fonts/pinyon-script-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

@property --ink {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 0%;
}

.home {
  --paper: #f7f1e3;
  --slip: #fcf9f1;
  --text: #16223f;
  --text-soft: #3a4566;
  --pen: #1b2a6b;          /* blue-black fountain-pen ink, once dry */
  --pen-wet: #3d58c9;      /* the same ink, still wet */
  --ballpoint: #2a47b0;
  --rule: rgba(29, 47, 107, 0.6);
  --tape: rgba(233, 223, 191, 0.82);
  color: var(--text);
  font-family: "Libre Caslon Text", Georgia, serif;
}
.site { scrollbar-width: thin; scrollbar-color: rgba(29, 47, 107, 0.35) transparent; }

.home__intro, .home__foot {
  max-width: 74rem;
  margin: 0 auto;
  padding-inline: clamp(16px, 5vw, 72px);
}
.home__intro { padding-top: max(64px, 6vh); padding-bottom: clamp(4px, 2vh, 20px); }

/* ---- the page's own header, like the printed notebook page ---- */
.home .sheet__head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--rule);
  box-shadow: 0 4px 0 -2px var(--paper), 0 5px 0 -2px var(--rule);
  font-size: 0.95rem;
  color: var(--text-soft);
}
.sheet__brand { font-family: "Libre Caslon Display", "Libre Caslon Text", serif; font-size: 1.35rem; color: var(--text); letter-spacing: 0.01em; }
.sheet__what { letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.78rem; }
.sheet__page { justify-self: end; font-family: "Kalam", cursive; font-size: 1.15rem; color: var(--ballpoint); }

/* ---- the pen ---- */
.pen {
  margin: 0;
  font-family: "Pinyon Script", "Snell Roundhand", cursive;
  font-weight: 400;
  color: var(--pen);
  line-height: 1.12;
  letter-spacing: 0;
  text-wrap: balance;
}
h1.pen { font-size: clamp(3.1rem, 8vw, 6rem); margin: clamp(32px, 6vh, 72px) 0 0.2em; }
.callout h2.pen { font-size: clamp(2.1rem, 3vw, 2.9rem); margin: 0 0 0.3em; padding-right: 2.6rem; }

/* written word by word (home.js splits the heading): each word is uncovered left to right, wet,
   and dries to blue-black */
.home-js .pen[data-write] .w {
  display: inline-block;
  padding: 0.2em 0.14em 0.32em;
  margin: -0.2em -0.14em -0.32em;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--ink) - 0.55em), transparent calc(var(--ink) + 0.05em));
  mask-image: linear-gradient(90deg, #000 calc(var(--ink) - 0.55em), transparent calc(var(--ink) + 0.05em));
}
.home-js .pen[data-write] .w:first-child { padding-left: 0.34em; margin-left: -0.34em; }
.home-js .pen.is-written .w {
  color: var(--pen-wet);
  animation:
    write var(--dur, 0.5s) cubic-bezier(0.45, 0.05, 0.55, 0.95) var(--delay, 0s) forwards,
    dry 1.6s ease-out calc(var(--delay, 0s) + var(--dur, 0.5s)) forwards;
}
@keyframes write { to { --ink: calc(100% + 0.6em); } }
@keyframes dry { from { color: var(--pen-wet); } to { color: var(--pen); } }

/* ---- words ---- */
.home p { margin: 0 0 0.9em; max-width: 62ch; font-size: clamp(1.02rem, 1.15vw, 1.12rem); line-height: 1.6; text-wrap: pretty; }
.home p b { font-weight: 400; font-style: italic; color: var(--pen); }
.home .lede { font-size: clamp(1.12rem, 1.6vw, 1.34rem); max-width: 46ch; margin: 0; }
.note { font-family: "Kalam", cursive; color: var(--ballpoint); font-size: clamp(1rem, 1.2vw, 1.16rem); line-height: 1.2; }

/* ---- prints: the app's screens, taped onto the page ---- */
.print, .tour__print {
  position: relative;
  margin: 0;
  padding: 8px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(22, 34, 63, 0.16), 0 14px 32px -16px rgba(22, 34, 63, 0.45);
}
.print { --r: 0deg; transform: rotate(var(--r)); }
.print img, .tour__shot img { display: block; width: 100%; height: auto; background: #eef0f5; }
.tape {
  position: absolute;
  top: -13px;
  left: var(--x, 50%);
  width: clamp(58px, 8vw, 104px);
  height: 26px;
  translate: -50% 0;
  rotate: var(--t, 0deg);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 6px),
    var(--tape);
  box-shadow: 0 1px 2px rgba(60, 50, 20, 0.12);
  clip-path: polygon(3% 0, 97% 3%, 100% 26%, 97% 50%, 100% 76%, 97% 100%, 3% 97%, 0 74%, 3% 50%, 0 24%);
  pointer-events: none;
}
.print figcaption.note { margin-top: 0.4em; text-align: right; transform: rotate(-1.2deg); }

/* ---- tours ---- */
.tour { position: relative; }
.tour__frame { position: relative; }
.tour__print { width: min(100% - 32px, 72rem); margin: clamp(32px, 6vh, 64px) auto 0; }
.tour__shot { position: relative; overflow: hidden; }
.tour__notes { list-style: none; margin: 0 auto; padding: 0 clamp(16px, 5vw, 72px); max-width: 74rem; }
.callout { margin: clamp(28px, 5vh, 48px) 0; }
.inset { margin: 1.5em 0 0; width: 100%; }
.inset--narrow { width: 62%; }
.inset--small { width: 76%; }
.tour__hl { display: none; }

/* with the script: the screenshot stays put while the page scrolls past, and moves itself */
.home-js .tour { --step: 34svh; height: calc(100svh + (var(--n) - 1) * var(--step)); }
.home-js .tour__frame { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.home-js .tour__print {
  position: absolute;
  left: 0; top: 0;
  width: var(--bw, 80vw);
  margin: 0;
  transform-origin: 0 0;
  transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(var(--z, 1));
  transition: transform 1s cubic-bezier(0.22, 0.8, 0.2, 1);
}
.home-js .tour__shot { border-radius: 1px; }
/* the highlighter: a ballpoint ring round the part, a wash of yellow on it, the rest paled */
.home-js .tour__hl {
  display: block;
  position: absolute;
  left: var(--hx, 0%); top: var(--hy, 0%); width: var(--hw, 100%); height: var(--hh, 100%);
  border: calc(2.6px / var(--z, 1)) solid var(--ballpoint);
  border-radius: calc(12px / var(--z, 1));
  box-shadow: 0 0 0 4000px rgba(247, 241, 227, 0.6);
  opacity: 0;
  transition: left 1s cubic-bezier(0.22, 0.8, 0.2, 1), top 1s cubic-bezier(0.22, 0.8, 0.2, 1),
    width 1s cubic-bezier(0.22, 0.8, 0.2, 1), height 1s cubic-bezier(0.22, 0.8, 0.2, 1), opacity 0.5s ease;
  pointer-events: none;
}
.home-js .tour__hl::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: rgba(255, 216, 60, 0.13); mix-blend-mode: multiply; }
.home-js .tour.has-hl .tour__hl { opacity: 1; }

/* the notes pop up beside what they are about */
.home-js .tour__notes { position: absolute; inset: 0; margin: 0; padding: 0; max-width: none; pointer-events: none; }
.home-js .callout {
  --cr: -0.6deg;
  position: absolute;
  top: 50%;
  width: min(28rem, 33vw);
  margin: 0;
  padding: 30px 30px 26px;
  background: var(--slip);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(22, 34, 63, 0.12), 0 22px 44px -20px rgba(22, 34, 63, 0.5);
  opacity: 0;
  transform: translateY(-44%) rotate(calc(var(--cr) - 2deg)) scale(0.92);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.home-js .callout::before {
  content: "";
  position: absolute;
  top: -12px; left: 50%;
  width: 96px; height: 24px;
  translate: -50% 0; rotate: -2deg;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 6px), var(--tape);
  clip-path: polygon(3% 0, 97% 3%, 100% 26%, 97% 50%, 100% 76%, 97% 100%, 3% 97%, 0 74%, 3% 50%, 0 24%);
}
.home-js .callout:nth-child(even) { --cr: 0.7deg; }
.home-js .callout[data-side="right"] { right: clamp(16px, 4.5vw, 80px); }
.home-js .callout[data-side="left"] { left: clamp(16px, 4.5vw, 80px); }
.home-js .callout.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) rotate(var(--cr)) scale(1);
  transition: opacity 0.35s ease 0.3s, transform 0.65s cubic-bezier(0.2, 1.35, 0.4, 1) 0.3s;
}
.home-js .callout p { font-size: clamp(1rem, 1.05vw, 1.08rem); }
.home-js .callout .inset img { max-height: 30svh; object-fit: contain; }
.home-js .callout .inset { opacity: 0; transform: rotate(var(--r)) translateY(10px); transition: opacity 0.3s ease, transform 0.3s ease; }
.home-js .callout.is-active .inset { opacity: 1; transform: rotate(var(--r)); transition: opacity 0.4s ease 0.75s, transform 0.6s cubic-bezier(0.2, 1.35, 0.4, 1) 0.75s; }

.home__foot { margin-top: clamp(24px, 6vh, 72px); padding-bottom: 22vh; }
.page-link {
  display: block; width: 100%;
  margin: 0; padding: 14px 0 0;
  border: 0; border-top: 1px solid var(--rule);
  background: none;
  font-family: "Kalam", cursive; font-size: clamp(1.05rem, 1.3vw, 1.25rem); line-height: 1.2;
  color: var(--ballpoint);
  text-align: right;
  cursor: pointer;
}
.page-link::after { content: ""; display: inline-block; width: 0.5em; height: 0.5em; margin-left: 0.4em; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: translateY(-0.08em) rotate(45deg); }
.page-link[data-go="p1"] { text-align: left; }
.page-link[data-go="p1"]::after { display: none; }
.page-link[data-go="p1"]::before { content: ""; display: inline-block; width: 0.5em; height: 0.5em; margin-right: 0.45em; border-bottom: 1.5px solid currentColor; border-left: 1.5px solid currentColor; transform: translateY(-0.12em) rotate(45deg); }
.page-link:hover { color: var(--pen); }
.page-link:focus-visible { outline: 2px solid var(--ballpoint); outline-offset: 4px; }

/* a new sheet: its top edge casts a little shadow on the one before */
.page--next { position: relative; border-top: 1px solid rgba(29, 47, 107, 0.22); box-shadow: 0 -16px 28px -22px rgba(22, 34, 63, 0.45); }
.folder-print { width: min(460px, 88%); margin: clamp(28px, 5vh, 48px) auto 0; }

/* the Cell Counter is dark: a gold ring, and the rest dimmed rather than paled */
.home-js .tour--dark .tour__hl { border-color: #f2c14e; box-shadow: 0 0 0 4000px rgba(10, 14, 13, 0.5); }
.home-js .tour--dark .tour__hl::before { background: rgba(255, 216, 60, 0.08); mix-blend-mode: screen; }

/* where each tour step sits on the page (home.js moves the page from one to the next) */
.tour__snap { position: absolute; left: 0; top: calc(var(--k) * var(--step)); width: 1px; height: 1px; pointer-events: none; }

/* each note's place in the order */
.callout { position: relative; }
.callout__n { position: absolute; top: 12px; right: 16px; font-family: "Kalam", cursive; font-size: 0.95rem; line-height: 1; color: var(--ballpoint); opacity: 0.85; }
.home-js .callout .callout__n { top: 14px; right: 18px; }

/* leaving the notebook: a small, deliberate button in the top corner */
.exit {
  position: fixed; top: 14px; left: 14px; z-index: 6;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px 6px 8px;
  font: 400 0.78rem/1 "Libre Caslon Text", Georgia, serif;
  letter-spacing: 0.02em;
  color: #1b2a6b;
  background: rgba(252, 249, 241, 0.94);
  border: 1px solid rgba(29, 47, 107, 0.26);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(22, 34, 63, 0.1), 0 6px 16px -10px rgba(22, 34, 63, 0.42);
  cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s, background-color 0.2s ease, border-color 0.2s ease;
}
.on-site .exit {
  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.2s ease, border-color 0.2s ease;
}
.exit:hover { background: #fff; border-color: rgba(29, 47, 107, 0.5); }
.exit:active { transform: scale(0.97); }
.exit:focus-visible { outline: 2px solid #2a47b0; outline-offset: 2px; }
.exit svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* which tool this is: a label at the top of the tour */
.tour__tool {
  display: flex; align-items: center; gap: 10px;
  width: fit-content; margin: clamp(24px, 4vh, 40px) auto 0;
  padding: 7px 16px 7px 8px;
  background: var(--slip);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(22, 34, 63, 0.12), 0 10px 22px -14px rgba(22, 34, 63, 0.5);
}
.home-js .tour__tool { position: absolute; z-index: 3; top: 16px; left: 50%; margin: 0; translate: -50% 0; pointer-events: none; }
.tour__icon svg { display: block; width: 30px; height: 30px; }
.tour__name { font-family: "Pinyon Script", cursive; font-size: 1.85rem; line-height: 1; color: var(--pen); padding: 0.06em 0.1em 0.14em; }
.tour__part { font-family: "Kalam", cursive; font-size: 1.02rem; color: var(--ballpoint); }
.tour__part::before { content: "\2014"; margin: 0 0.35em 0 0.1em; color: var(--text-soft); }

/* a finished page: every note pinned beside its screenshot, every part ringed and numbered,
   and the page scrolls freely */
.tour__mark { display: none; }
.home-js .page.is-done .tour { height: auto; }
.home-js .page.is-done .tour__frame {
  position: relative; top: auto; height: auto; overflow: visible;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr) minmax(0, 1fr);
  column-gap: clamp(18px, 2.4vw, 40px); row-gap: 26px;
  align-items: start;
  max-width: 104rem; margin: 0 auto;
  padding: clamp(36px, 7vh, 72px) clamp(16px, 3vw, 48px) 8px;
}
.home-js .page.is-done .tour__tool { position: static; translate: none; grid-column: 1 / -1; justify-self: center; }
/* the screenshot stays in view while its notes go by on either side */
.home-js .page.is-done .tour__print { position: sticky; left: auto; top: 72px; align-self: start; width: auto; transform: rotate(-0.4deg); transition: none; grid-column: 2; grid-row: 2 / span 8; }
.home-js .page.is-done .tour__frame:not(:has(.tour__tool)) .tour__print { grid-row: 1 / span 8; }
.home-js .page.is-done .tour__hl, .home-js .page.is-done .tour__snap { display: none; }
.home-js .page.is-done .tour__notes { display: contents; }
.home-js .page.is-done .callout {
  position: relative; top: auto; left: auto; right: auto; bottom: auto;
  width: auto; max-height: none; margin: 0; padding: 24px 20px 18px;
  opacity: 1; pointer-events: auto;
  transform: rotate(var(--cr)); transition: none;
}
.home-js .page.is-done .callout[data-col="left"] { grid-column: 1; }
.home-js .page.is-done .callout[data-col="right"] { grid-column: 3; }
.home-js .page.is-done .callout h2.pen { font-size: clamp(1.65rem, 2vw, 2.15rem); padding-right: 2.2rem; }
.home-js .page.is-done .callout p { font-size: 0.97rem; line-height: 1.52; }
.home-js .page.is-done .callout .inset { opacity: 1; transform: rotate(var(--r)); transition: none; }
.home-js .page.is-done .callout .inset img { max-height: 150px; }
.home-js .page.is-done .tour__mark {
  display: block; position: absolute;
  border: 2px solid var(--ballpoint); border-radius: 8px;
  background: rgba(255, 216, 60, 0.1);
  pointer-events: none;
}
.home-js .page.is-done .tour__mark b {
  position: absolute; top: -13px; left: -13px;
  min-width: 26px; height: 26px; padding: 0 6px;
  border-radius: 13px;
  font: 400 0.95rem/26px "Kalam", cursive; text-align: center;
  color: #fff; background: var(--ballpoint);
  box-shadow: 0 1px 3px rgba(22, 34, 63, 0.35);
}
.home-js .page.is-done .tour--dark .tour__mark { border-color: #f2c14e; background: rgba(242, 193, 78, 0.08); }
.home-js .page.is-done .tour--dark .tour__mark b { color: #1b1408; background: #f2c14e; }

/* nothing glides into place on first paint */
.home-js:not(.home-ready) .tour__print, .home-js:not(.home-ready) .tour__hl,
.home-js:not(.home-ready) .callout, .home-js:not(.home-ready) .callout .inset { transition: none !important; }

/* ---- small screens: the screenshot on top, its note below ---- */
@media (max-width: 759px) {
  .home .sheet__head { grid-template-columns: 1fr auto; }
  .sheet__what { display: none; }
  .home-js .tour { --step: 40svh; }
  .home-js .callout {
    top: auto; bottom: 12px; left: 12px; right: 12px;
    width: auto;
    max-height: 41svh;
    overflow: hidden;
    padding: 20px 18px 14px;
    transform: translateY(14px) rotate(0deg) scale(0.97);
  }
  .home-js .callout.is-active { transform: none; }
  .home-js .callout .inset { display: none; }
  .home-js .tour__tool { top: 52px; padding: 5px 12px 5px 6px; }
  .tour__icon svg { width: 24px; height: 24px; }
  .tour__name { font-size: 1.5rem; }
  .tour__part { font-size: 0.92rem; }
  .home-js .page.is-done .tour__frame { grid-template-columns: minmax(0, 1fr); }
  .home-js .page.is-done .tour__print, .home-js .page.is-done .callout[data-col] { position: relative; top: auto; grid-column: 1; grid-row: auto; }
  .home-js .page.is-done .tour__frame:not(:has(.tour__tool)) .tour__print { grid-row: auto; }
  .home-js .page.is-done .callout .inset { display: block; }
  .callout h2.pen { font-size: 2rem; }
  .home-js .callout p { font-size: 0.98rem; line-height: 1.52; }
}

@media (prefers-reduced-motion: reduce) {
  .home-js .pen[data-write] .w { -webkit-mask-image: none; mask-image: none; }
  .home-js .pen.is-written .w { animation: none; color: var(--pen); }
  .home-js .tour__print, .home-js .tour__hl, .home-js .callout, .home-js .callout .inset { transition-duration: 0.01s !important; transition-delay: 0s !important; }
}
