/* elementnote.app: Element Note's site. It takes its look from the app: the
   App Store slides' pale blue ground, the wordmark's serif, the onboarding's
   wall of hand-drawn example notes, and the gradient inks, which draw one
   swash under a word of each title. Panels that stand for a page of paper
   (the sketch pad, the PDF, the sticker page) go through the app's smart dark
   mode in dark mode, so their ink keeps its color while the paper turns dark. */

:root {
  color-scheme: light dark;

  --bg: #eef2f7;
  --bg-top: #e3ebf5;
  --panel: #f7f9fc;
  --card: #ffffff;
  --paper: #ffffff;
  --note: #ffffff;        /* behind an example note while it loads */
  --ink: #141416;
  --text: #3b4047;
  --muted: #6b717a;
  --line: rgba(20, 24, 31, 0.09);
  --dots: #d3d9e2;
  --shadow: 0 1px 2px rgba(25, 35, 50, 0.06), 0 10px 30px -14px rgba(25, 35, 50, 0.28);
  --lift: 0 2px 6px rgba(25, 35, 50, 0.08), 0 24px 48px -20px rgba(25, 35, 50, 0.4);
  --button: #1c1c1e;
  --button-text: #ffffff;
  --selected: rgba(20, 24, 31, 0.08);
  --hit: rgba(255, 150, 50, 0.42);
  --hit-blend: multiply;
  --tip-alpha: 0.6;       /* a brush icon's tip, tinted with its ink */
  --link: #2f6fed;
  /* The app's smart dark mode, near enough: lightness flips, hue stays. */
  --paper-filter: none;

  --serif: ui-serif, "New York", "Iowan Old Style", "Apple Garamond", Georgia, "Times New Roman", serif;
  --font: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --wrap: 74rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: clamp(1.25rem, 2.6vw, 2rem);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* The icon's own look: charcoal ground, the feather's warm grey. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161618;
    --bg-top: #1c1d21;
    --panel: #1e1e21;
    --card: #252528;
    --note: #121213;
    --ink: #f4f2ef;
    --text: #c9c6c1;
    --muted: #96938e;
    --line: rgba(255, 255, 255, 0.09);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
    --lift: 0 2px 6px rgba(0, 0, 0, 0.3), 0 24px 48px -20px rgba(0, 0, 0, 0.8);
    --button: #f4f2ef;
    --button-text: #141416;
    --selected: rgba(255, 255, 255, 0.1);
    --hit: rgba(255, 150, 50, 0.4);
    --hit-blend: normal;
    --tip-alpha: 1;
    --link: #7aa7ff;
    --paper-filter: invert(1) hue-rotate(180deg);
  }
}

/* -------------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

main { flex: 1 0 auto; }
img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul[role="list"] { list-style: none; padding: 0; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }

:focus-visible { outline: 3px solid #4f8cff; outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-text);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 0.75rem; }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ------------------------------------------------------------------ type */

.display, .title {
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 600;
  text-wrap: balance;
}
.display {
  font-size: clamp(2.75rem, 5.6vw, 4.6rem);
  line-height: 1.04;
  letter-spacing: -0.022em;
}
/* The smallest phones: room for a long word like "придуманный". */
@media (max-width: 359px) { .display { font-size: 2.5rem; } }
.title {
  font-size: clamp(2.1rem, 4.2vw, 3.35rem);
  line-height: 1.08;
  letter-spacing: -0.018em;
}
.lede {
  font-size: clamp(1.0625rem, 1.45vw, 1.22rem);
  line-height: 1.55;
  color: var(--text);
  text-wrap: pretty;
}
.head .lede, .hero-copy .lede { margin-top: 1.1rem; max-width: 33rem; }
.head.center { max-width: 40rem; margin: 0 auto clamp(2.25rem, 4.5vw, 3.5rem); text-align: center; }
.head.center .lede { margin-inline: auto; }

/* Other scripts: no tightened tracking, room for tall marks and stacked
   vowels, and lines that break between words or phrases, not inside them. */
:is(:lang(zh), :lang(ja), :lang(ko), :lang(th), :lang(hi)) :is(.display, .title, .lede) { letter-spacing: 0; }
:is(:lang(zh), :lang(ja), :lang(ko)) .display { line-height: 1.14; }
:is(:lang(zh), :lang(ja), :lang(ko)) .title { line-height: 1.18; }
:is(:lang(th), :lang(hi)) .display { line-height: 1.3; }
:is(:lang(th), :lang(hi)) .title { line-height: 1.32; }
:lang(ko) { word-break: keep-all; }
:lang(ja) :is(.display, .title, .lede) { word-break: auto-phrase; }

/* The swash: a gradient-ink stroke under the marked word, drawn in when its
   section comes into view. */
.inked { position: relative; z-index: 0; white-space: nowrap; }
.swash {
  position: absolute;
  z-index: -1;
  left: -3%;
  bottom: -0.06em;
  width: 106%;
  height: 0.34em;
  overflow: visible;
  pointer-events: none;
}
.swash path {
  fill: none;
  /* In the viewBox's units: 0.13em of the 0.34em-tall, 14-unit box. Not
     non-scaling-stroke, which breaks pathLength's dashes in Chrome. */
  stroke-width: 5.4;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.js .swash path { stroke-dashoffset: 1; transition: stroke-dashoffset 0.9s cubic-bezier(0.6, 0.1, 0.25, 1) 0.35s; }
.js .in .swash path { stroke-dashoffset: 0; }

/* --------------------------------------------------------------- buttons */

.button, .store {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-text);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s var(--ease-out), opacity 0.2s;
}
.button { padding: 0.5rem 1.05rem; font-size: 0.9375rem; }
.store { padding: 0.9rem 1.6rem; font-size: 1.0625rem; }
.button:hover, .store:hover { opacity: 0.88; }
.button:active, .store:active { transform: scale(0.97); }

/* ------------------------------------------------------------------- nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg-top) 74%, transparent);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  backdrop-filter: saturate(1.8) blur(20px);
}
.nav::after {
  content: "";
  position: absolute;
  inset: 100% 0 auto;
  height: 1px;
  background: var(--line);
  opacity: 0;
  transition: opacity 0.3s;
}
.nav.scrolled::after { opacity: 1; }
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 3.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand img { border-radius: 22%; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.nav-links { display: flex; gap: clamp(1rem, 2.6vw, 2rem); margin-left: auto; margin-right: clamp(0.5rem, 2vw, 1.5rem); }
.nav-links a { color: var(--text); font-size: 0.9375rem; text-decoration: none; }
.nav-links a:hover { color: var(--ink); }
@media (max-width: 720px) { .nav-links { display: none; } }
@media (prefers-reduced-transparency: reduce) {
  .nav { background: var(--bg-top); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ------------------------------------------------------------------ hero */

.hero {
  padding-top: clamp(1.5rem, 4vw, 3rem);
  background: linear-gradient(var(--bg-top), var(--bg) 70%);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 4vw, 4rem);
  align-items: center;
}
.hero-icon {
  width: clamp(4rem, 6vw, 5.5rem);
  margin-bottom: clamp(1.25rem, 2.5vw, 2rem);
  border-radius: 22%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 14px 28px -12px rgba(0, 0, 0, 0.45);
}
.cta { margin-top: 2rem; }
.platforms { margin-top: 0.85rem; color: var(--muted); font-size: 0.9375rem; }

/* The onboarding's wall of example notes, its columns drifting past. */
.wall {
  --gap: clamp(0.65rem, 1.3vw, 1.1rem);
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  height: min(86vh, 50rem);
  min-height: 32rem;
  margin-right: calc(-1 * var(--gutter));
  padding-right: var(--gutter);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 9%, #000 91%, transparent);
  mask-image: linear-gradient(transparent, #000 9%, #000 91%, transparent);
}
.wall-col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding-bottom: var(--gap);
  animation: drift calc(70s + var(--i) * 9s) linear infinite;
  animation-delay: calc(var(--i) * -13s);
}
.wall-col:nth-child(even) { animation-direction: reverse; }
.wall.paused .wall-col { animation-play-state: paused; }
@keyframes drift { to { transform: translateY(-50%); } }
.wall .note {
  display: block;
  overflow: hidden;
  border-radius: clamp(0.4rem, 0.8vw, 0.7rem);
  background: var(--note);
  box-shadow: 0 0 0 0.5px var(--line), 0 6px 18px -8px rgba(25, 35, 50, 0.35);
}
.wall .note img { width: 100%; aspect-ratio: 2 / 3; }

@media (max-width: 899px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-copy { display: flex; flex-direction: column; align-items: center; }
  .hero-copy .lede { margin-inline: auto; }
  .wall {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    height: 34rem;
    min-height: 0;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
  }
  .wall-col:nth-child(4) { display: none; }
}

/* -------------------------------------------------------------- sections */

.section { padding-block: clamp(4.5rem, 10vw, 8.5rem); }
.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}
.split.flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.split.flip .head { order: 2; }
@media (max-width: 899px) {
  .split, .split.flip { grid-template-columns: 1fr; }
  .split.flip .head { order: 0; }
}

.panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
}

/* The app's top bar: the document's name in the serif, then its tools. */
.app-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  padding: 0.55rem 0.7rem 0.55rem 1.1rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
/* A long document name gives way to the tools, as in the app. */
.app-doc { min-width: 0; margin-right: auto; line-height: 1.2; }
.app-doc b, .app-doc small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.app-doc b { color: var(--ink); font-family: var(--serif); font-size: 1.05rem; font-weight: 600; }
.app-doc small { color: var(--muted); font-size: 0.75rem; }
.tools, .colors, .actions { display: flex; align-items: center; }
.tools { --tip: #3a3a3c; gap: 0.1rem; }
.tip { fill: var(--tip); fill-opacity: var(--tip-alpha); }
/* The app holds its brush icons at 45°, tip down and to the left. */
.tools svg, .mini-bar svg { rotate: 45deg; }
.tools > * {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.4rem;
  border-radius: 0.7rem;
  color: var(--ink);
  transition: background 0.2s;
}
.tools svg { width: 0.62rem; height: 1.55rem; }
.tools [aria-checked="true"], .tools .on { background: var(--selected); }
.colors { gap: 0.4rem; }
.colors button {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--c);
  transition: box-shadow 0.2s;
}
.colors .gradient { background: conic-gradient(from 200deg, #5fc9a3, #477aff, #b46cff, #ff6b6b, #ffc93c, #5fc9a3); }
.colors [aria-checked="true"] { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--c, #477aff); }
.actions { gap: 0.1rem; }
.actions button { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 0.6rem; color: var(--muted); }
.actions button:hover { color: var(--ink); background: var(--selected); }
.actions svg { width: 1.2rem; height: 1.2rem; }
@media (max-width: 560px) {
  .sketch .app-doc { display: none; }
  .sketch .app-bar { justify-content: center; padding-inline: 0.5rem; }
  .tools > * { width: 2rem; }
}

/* -------------------------------------------------------------- brushes */

.paper {
  position: relative;
  aspect-ratio: 4 / 3;
  background-color: var(--paper);
  background-image: radial-gradient(circle, var(--dots) 1px, transparent 1.4px);
  background-size: 22px 22px;
  background-position: 11px 11px;
  touch-action: none;
  cursor: crosshair;
  filter: var(--paper-filter);
}
.paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hint {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  translate: -50% 0;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(20, 24, 31, 0.08), 0 4px 12px -6px rgba(20, 24, 31, 0.3);
  width: max-content;
  max-width: calc(100% - 1.5rem);
  color: #5b616a;
  font-size: 0.875rem;
  text-align: center;
  text-wrap: balance;
  pointer-events: none;
  transition: opacity 0.4s;
}
.sketch.drawing .hint { opacity: 0; }

/* -------------------------------------------------------------- stickers */

/* A scene: a fixed design canvas 560 units wide; each piece sits at --x/--y,
   is --w wide and turns by --r degrees. */
.enrich { container-type: inline-size; aspect-ratio: 560 / 600; background: var(--paper); filter: var(--paper-filter); }
.page-sheet {
  --u: calc(100cqw / 560);
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--dots) 1px, transparent 1.4px);
  background-size: calc(28 * var(--u)) calc(28 * var(--u));
}
.el {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  rotate: calc(var(--r, 0) * 1deg);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  cursor: grab;
  transition: scale 0.2s var(--ease-out), filter 0.2s;
}
.el.dragging { cursor: grabbing; scale: 1.06; filter: drop-shadow(0 12px 14px rgba(20, 24, 31, 0.25)); z-index: 5; }
.el.selected { outline: 1.5px dashed #8a9099; outline-offset: calc(8 * var(--u)); border-radius: calc(8 * var(--u)); }
.text-el h3 {
  color: #1c1c1e;
  font-family: var(--serif);
  font-size: calc(40 * var(--u));
  font-weight: 600;
  line-height: 1.1;
}
.text-el p { margin-top: calc(8 * var(--u)); color: #4a5059; font-size: calc(16 * var(--u)); line-height: 1.45; }
.photo {
  padding: calc(8 * var(--u)) calc(8 * var(--u)) calc(26 * var(--u));
  background: #fff;
  box-shadow: 0 0 0 0.5px rgba(20, 24, 31, 0.12), 0 calc(8 * var(--u)) calc(20 * var(--u)) calc(-8 * var(--u)) rgba(20, 24, 31, 0.35);
}
.photo img { width: 100%; pointer-events: none; }
.element-menu {
  position: absolute;
  left: calc(14 * 100cqw / 560);
  bottom: calc(14 * 100cqw / 560);
  display: grid;
  gap: calc(2 * 100cqw / 560);
  width: calc(150 * 100cqw / 560);
  padding: calc(12 * 100cqw / 560);
  border-radius: calc(16 * 100cqw / 560);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(20, 24, 31, 0.07), 0 10px 26px -12px rgba(20, 24, 31, 0.35);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: #1c1c1e;
  font-size: calc(14 * 100cqw / 560);
  pointer-events: none;
}
.element-menu b { padding: 0 calc(8 * 100cqw / 560) calc(6 * 100cqw / 560); font-size: calc(16 * 100cqw / 560); }
.element-menu span {
  display: flex;
  align-items: center;
  gap: calc(10 * 100cqw / 560);
  padding: calc(7 * 100cqw / 560) calc(8 * 100cqw / 560);
  border-radius: calc(9 * 100cqw / 560);
}
.element-menu span.on { background: rgba(20, 24, 31, 0.07); }
.element-menu svg { width: calc(20 * 100cqw / 560); height: calc(20 * 100cqw / 560); }

/* ------------------------------------------------------------------- PDF */

.pdf { container-type: inline-size; background: var(--panel); }
.pdf .app-bar { position: relative; z-index: 1; flex-wrap: nowrap; }
.pdf .tools { flex-shrink: 0; }
.pdf-page {
  --u: calc(100cqw / 560);
  position: relative;
  padding: calc(40 * var(--u)) calc(64 * var(--u)) calc(30 * var(--u)) calc(56 * var(--u));
  background: var(--paper);
  color: #2b2e33;
  font-family: var(--serif);
  font-size: calc(15.5 * var(--u));
  line-height: 1.6;
  filter: var(--paper-filter);
}
.pdf-page .running {
  color: #8a8f97;
  font-family: var(--font);
  font-size: calc(10.5 * var(--u));
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pdf-page h3 {
  margin: calc(14 * var(--u)) 0 calc(10 * var(--u));
  color: #15171a;
  font-family: var(--font);
  font-size: calc(23 * var(--u));
  font-weight: 700;
  letter-spacing: -0.01em;
}
.pdf-page p + p, .pdf-page figure + p { margin-top: calc(10 * var(--u)); }
.pdf-page figure { margin: calc(14 * var(--u)) 0 calc(12 * var(--u)); }
.diagram { width: 100%; height: auto; }
.diagram .sea { fill: #cfe3f6; }
.diagram .ground { fill: #dfe8cf; }
.diagram .cloud { fill: #e8ecf1; }
.diagram .flow { fill: none; stroke: #6f8fb0; stroke-width: 1.6; stroke-dasharray: 4 3; }
.diagram text { fill: #59606a; font-family: var(--font); font-size: 9.5px; }
.pdf-page figcaption { margin-top: calc(6 * var(--u)); color: #6e747c; font-size: calc(12 * var(--u)); font-style: italic; }
.pdf-page .folio { margin-top: calc(18 * var(--u)); color: #9aa0a8; font-family: var(--font); font-size: calc(11 * var(--u)); text-align: center; }

/* Ink on the page: marker, pen circle and underline, drawn in on reveal. */
.ink { position: relative; }
.ink.hl {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20' preserveAspectRatio='none'%3E%3Cpath d='M1 4.5C30 2 70 3 99 2.5L98.5 17C70 18.5 30 17.5 1.5 18.5Z' fill='%23ffd84d' fill-opacity='.72'/%3E%3C/svg%3E") no-repeat 0 55% / 100% 92%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.ink.ul {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 8' preserveAspectRatio='none'%3E%3Cpath d='M1 5C6 2 10 7 15 4.5S24 2 29 5 36 6 39 3' fill='none' stroke='%232f6fed' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x 0 100% / 1.6em 0.36em;
  padding-bottom: 0.12em;
}
.ink.circle::after {
  content: "";
  position: absolute;
  inset: -0.32em -0.42em -0.26em -0.5em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 40' preserveAspectRatio='none'%3E%3Cpath d='M86 5C62 0 22 2 8 13S10 37 52 37 117 32 116 19 92 5 68 4' fill='none' stroke='%23f0524f' stroke-width='2.4' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
  pointer-events: none;
}
.margin-mark { position: absolute; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.margin-mark path { stroke-dasharray: 1; stroke-dashoffset: 0; }
.has-note { position: relative; }
.margin-mark.star { right: calc(-50 * var(--u)); top: calc(6 * var(--u)); width: calc(34 * var(--u)); stroke: #f0524f; stroke-width: 2.4; }
.margin-mark.check { right: calc(22 * var(--u)); bottom: calc(52 * var(--u)); width: calc(34 * var(--u)); stroke: #2f6fed; stroke-width: 3; }

.js .pdf .ink.hl { background-size: 0% 92%; transition: background-size 0.7s var(--ease-out); }
.js .pdf .ink.ul { background-size: 1.6em 0.36em; clip-path: inset(0 100% 0 0); transition: clip-path 0.7s var(--ease-out); }
.js .pdf .ink.circle::after { clip-path: inset(0 100% 0 0); transition: clip-path 0.6s var(--ease-out); }
.js .pdf .margin-mark path { stroke-dashoffset: 1; transition: stroke-dashoffset 0.6s ease-out; }
.js .pdf.in .ink.hl { background-size: 100% 92%; }
.js .pdf.in .ink.ul, .js .pdf.in .ink.circle::after { clip-path: inset(0 -0.6em 0 -0.6em); }
.js .pdf.in .margin-mark path { stroke-dashoffset: 0; }
.js .pdf.in .ink:nth-of-type(1) { transition-delay: 0.5s; }
.js .pdf.in .has-note .ink:first-of-type::after { transition-delay: 1.1s; }
.js .pdf.in .has-note .ink.ul { transition-delay: 1.6s; }
.js .pdf.in .star path { transition-delay: 2s; }
.js .pdf.in p:nth-last-of-type(2) .ink { transition-delay: 2.5s; }
.js .pdf.in .check path { transition-delay: 3s; }

/* ---------------------------------------------------------------- search */

.search { container-type: inline-size; padding: clamp(1rem, 2.6vw, 1.6rem); }
.search-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--line);
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 500;
}
.search-field svg { width: 1.2rem; height: 1.2rem; color: var(--muted); }
.caret { width: 2px; height: 1.25em; margin-left: -0.45rem; border-radius: 1px; background: #4f8cff; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.groups { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 3cqw, 1.75rem); margin-top: 1.25rem; }
.group h3 { margin-bottom: 0.6rem; color: var(--ink); font-size: 0.95rem; font-weight: 650; }
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.thumb .note, .zoom {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 0.55rem;
  background: var(--note);
  box-shadow: 0 0 0 0.5px var(--line), 0 6px 16px -8px rgba(25, 35, 50, 0.35);
}
.thumb img { width: 100%; aspect-ratio: 2 / 3; }
.hit {
  position: absolute;
  left: calc(var(--x) * 100%);
  top: calc(var(--y) * 100%);
  width: calc(var(--w) * 100%);
  height: calc(var(--h) * 100%);
  border-radius: 0.2rem;
  background: var(--hit);
  mix-blend-mode: var(--hit-blend);
  transition: opacity 0.35s, scale 0.45s var(--ease-out);
}
/* The hits, magnified: the app's zoomed handwriting crops, overlapping the
   results a little. */
.zooms { display: flex; align-items: flex-start; justify-content: space-between; gap: 4%; margin: -1.6rem 2% 0.4rem; }
.zoom { border-radius: 0.8rem; box-shadow: var(--lift); transition: opacity 0.5s, translate 0.6s var(--ease-out); }
.zoom img { width: 100%; }
.zoom .hit { border-radius: 0.4rem; }
.z1 { width: 52%; rotate: -2deg; }
.z2 { width: 44%; margin-top: 1.4rem; rotate: 2deg; }
.js .search:not(.found) .hit { opacity: 0; scale: 0.6; }
.js .search:not(.found) .zoom { opacity: 0; translate: 0 1rem; }
.search.found .zoom { transition-delay: 0.45s; }
.search.found .z2 { transition-delay: 0.65s; }
@container (max-width: 520px) {
  .zooms { flex-direction: column; align-items: stretch; gap: 0.75rem; margin-top: -1rem; }
  .z1 { width: 82%; }
  .z2 { width: 74%; margin: 0 0 0 auto; }
}

/* ------------------------------------------------------------- dark mode */

.compare {
  --split: 50%;
  position: relative;
  max-width: 60rem;
  margin-inline: auto;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.layer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.6rem, 1.8vw, 1.4rem);
  padding: clamp(2.75rem, 5vw, 3.75rem) clamp(1rem, 3.5vw, 2.75rem);
}
.layer img { width: 100%; aspect-ratio: 2 / 3; border-radius: clamp(0.4rem, 0.8vw, 0.7rem); pointer-events: none; }
.layer.light { background: linear-gradient(160deg, #f4f7fb, #e2eaf4); }
.layer.light img { box-shadow: 0 0 0 0.5px rgba(20, 24, 31, 0.1), 0 10px 24px -12px rgba(25, 35, 50, 0.45); }
.layer.dark { position: absolute; inset: 0; background: linear-gradient(160deg, #1f2024, #121214); clip-path: inset(0 0 0 var(--split)); }
.layer.dark img { box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.12), 0 10px 24px -12px rgba(0, 0, 0, 0.8); }
.divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: 2px;
  translate: -1px 0;
  background: #fff;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.15), 0 0 12px rgba(0, 0, 0, 0.25);
}
.divider:focus-visible { outline: none; }
.divider:focus-visible .knob { outline: 3px solid #4f8cff; outline-offset: 3px; }
.knob {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: max-content;
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.6rem;
  border-radius: 999px;
  background: #fff;
  color: #1c1c1e;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 10px 24px -8px rgba(0, 0, 0, 0.45);
}
.knob svg { width: 1.05rem; height: 1.05rem; max-width: none; }
.tag {
  position: absolute;
  top: clamp(0.8rem, 1.6vw, 1.1rem);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  pointer-events: none;
}
.tag-light { left: clamp(0.8rem, 1.6vw, 1.1rem); background: rgba(255, 255, 255, 0.85); color: #3b4047; }
.tag-dark { right: clamp(0.8rem, 1.6vw, 1.1rem); background: rgba(255, 255, 255, 0.12); color: #e9e6e1; }
.compare-hint { margin-top: 1rem; color: var(--muted); font-size: 0.875rem; text-align: center; }
@media (max-width: 700px) {
  .layer { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layer img:nth-child(4) { display: none; }
}

/* -------------------------------------------------------------- features */

.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(0.85rem, 1.8vw, 1.25rem); }
.feature {
  padding: clamp(1.4rem, 2.6vw, 1.9rem);
  border-radius: calc(var(--radius) * 0.8);
  background: var(--card);
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
}
.feature h3 { margin-top: 1.1rem; color: var(--ink); font-size: 1.12rem; font-weight: 650; letter-spacing: -0.005em; }
.feature p { margin-top: 0.35rem; color: var(--text); font-size: 0.98rem; }
.ico {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.85rem;
  background: color-mix(in srgb, var(--c) 15%, transparent);
  color: var(--c);
}
.ico svg { width: 1.45rem; height: 1.45rem; }
.mini-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  height: 2.75rem;
  padding: 0 0.5rem;
  border-radius: 0.85rem;
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--line);
  color: var(--ink);
}
.mini-bar span { display: grid; place-items: center; width: 1.7rem; height: 2.1rem; border-radius: 0.55rem; }
.mini-bar span.on { background: var(--selected); }
.mini-bar span svg { width: 0.5rem; height: 1.25rem; }
.mini-bar i { width: 1px; height: 1.3rem; margin: 0 0.35rem; background: var(--line); }
.mini-bar b { width: 0.95rem; height: 0.95rem; margin: 0 0.15rem; border-radius: 50%; background: var(--c); }
.mini-bar b.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.25px var(--c); }
@media (prefers-color-scheme: dark) { .mini-bar b[style*="1d1d1f"] { background: #f4f2ef; --c: #f4f2ef; } }
@media (max-width: 899px) { .features { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------- closing */

.closing { text-align: center; background: linear-gradient(var(--bg), var(--bg-top)); }
.closing .wrap { display: flex; flex-direction: column; align-items: center; }
.closing-icon {
  width: clamp(5rem, 9vw, 6.5rem);
  margin-bottom: 1.75rem;
  border-radius: 22%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 18px 36px -14px rgba(0, 0, 0, 0.5);
}
.closing .lede { max-width: 32rem; margin: 1rem auto 2rem; }

/* ---------------------------------------------------------------- footer */

.footer { border-top: 1px solid var(--line); background: var(--bg-top); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  padding-block: 2rem calc(2rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.9375rem;
}
.footer .brand { font-size: 1.1rem; }
.footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.footer nav a { text-decoration: none; }
.footer nav a:hover { color: var(--ink); }
.footer small { margin-left: auto; font-size: 0.875rem; }
.lang-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line);
  color: var(--text);
  font-size: 0.875rem;
}
.lang-button svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6; }
.lang-button { anchor-name: --languages; cursor: pointer; }

/* The language menu opens just above its button, flipping to stay on
   screen. Browsers without anchor positioning show it in the middle. */
.lang-menu {
  min-width: 11rem;
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0.5rem;
  border: 0;
  border-radius: 1rem;
  background: var(--card);
  box-shadow: var(--lift);
  color: var(--text);
  opacity: 0;
  scale: 0.96;
  transition: opacity 0.18s, scale 0.25s var(--ease-out), overlay 0.25s allow-discrete, display 0.25s allow-discrete;
}
.lang-menu:popover-open { opacity: 1; scale: 1; }
@starting-style { .lang-menu:popover-open { opacity: 0; scale: 0.96; } }
@supports (position-area: top) {
  .lang-menu {
    position-anchor: --languages;
    position-area: top span-right;
    position-try-fallbacks: flip-inline, flip-block, flip-block flip-inline;
    inset: auto;
    margin: 0 0 0.5rem;
    transform-origin: bottom left;
  }
  @media (max-width: 640px) { .lang-menu { margin-inline: 0.5rem; } }
}
.lang-menu a { display: block; padding: 0.45rem 0.9rem; border-radius: 0.6rem; text-decoration: none; }
.lang-menu a:hover, .lang-menu [aria-current] { background: var(--selected); color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .lang-menu, .lang-menu:popover-open { scale: none; } }
@media (max-width: 560px) { .footer small { margin-left: 0; width: 100%; } }

/* ----------------------------------------------------------------- legal */

.legal { max-width: calc(46rem + 2 * var(--gutter)); padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(4rem, 8vw, 6rem); }
.legal .title { font-size: clamp(2rem, 4.6vw, 3rem); margin-bottom: 1.5rem; }
.legal-body { color: var(--text); font-size: 1rem; line-height: 1.65; }
.legal-body h2, .legal-body h3, .legal-body h4 { margin: 2.2rem 0 0.6rem; color: var(--ink); font-size: 1.05rem; font-weight: 650; letter-spacing: 0.01em; line-height: 1.35; }
.legal-body h4 { font-size: 1rem; }
.legal-body p, .legal-body ul, .legal-body ol { margin: 0.8rem 0; }
.legal-body li { margin: 0.35rem 0; }
.legal-body a { color: var(--link); }
.english-only { margin-bottom: 1.5rem; padding: 0.75rem 1rem; border-radius: 0.8rem; background: var(--panel); color: var(--muted); font-size: 0.9375rem; }

.missing { display: flex; flex-direction: column; align-items: center; padding-block: clamp(4rem, 12vw, 9rem); text-align: center; }
.missing img { width: 5.5rem; margin-bottom: 1.75rem; border-radius: 22%; box-shadow: var(--lift); }
.missing .lede { margin: 1rem 0 2rem; color: var(--muted); }

/* --------------------------------------------------------------- reveals */

.js .reveal { opacity: 0; transform: translateY(1.5rem); transition: opacity 0.8s var(--ease-out), transform 0.9s var(--ease-out); }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { transform: none; transition: opacity 0.6s; }
  .wall-col { animation: none; }
  .js .swash path, .js .pdf .margin-mark path { transition: none; }
  .js .pdf .ink.hl, .js .pdf .ink.ul, .js .pdf .ink.circle::after { transition: none; }
  .caret { animation: none; }
  .zoom, .hit { transition: opacity 0.3s; }
}
