/* The home page: Franki's world is cards on warm paper. Shared tokens, type, buttons, tiles
   and the simple pages live in styles.css. home.js drives the pointer, scroll and demo
   motion; without it every section still reads, and under Reduce Motion nothing moves
   on its own (styles.css stops every animation and transition). */

.home {
  /* Secondary text on a deck colour: dark in both appearances, 4.5:1 on every deck colour. */
  --on-accent-soft: #3d3a33;
}

/* ---------- Paper grain and scroll progress ---------- */

.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .24 0 0 0 0 .16 0 0 0 0 .04 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { .grain { filter: invert(1); opacity: .1; } }

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  height: 3px;
  background: linear-gradient(90deg, var(--peach), var(--butter), var(--mint), var(--sky), var(--lilac), var(--rose));
  transform: scaleX(var(--progress, 0));
  transform-origin: 0 50%;
  pointer-events: none;
}

/* ---------- Header: a floating bar once the page scrolls ---------- */

.home .site-header {
  position: sticky;
  top: 10px;
  z-index: 60;
  flex-wrap: nowrap;
  width: min(calc(var(--content) - 24px), calc(100% - 20px));
  margin: 10px auto 0;
  padding: 8px 8px 8px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: background-color .3s, border-color .3s, box-shadow .3s;
}
.home.scrolled .site-header {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border-color: var(--hair);
  box-shadow: 0 14px 40px -18px var(--shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
}
.home .navlinks a { position: relative; }
.home .navlinks a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .35s var(--spring);
}
.home .navlinks a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Motion vocabulary ---------- */

@keyframes fk-rise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes flip-in { from { opacity: 0; transform: translateY(.3em) rotateX(-85deg); } to { opacity: 1; transform: none; } }
@keyframes mark-sweep { to { background-size: 100% 100%; color: var(--on-accent); } }
@keyframes bob { from { transform: translateY(-7px); } to { transform: translateY(7px); } }
@keyframes pop-in { from { opacity: 0; scale: .4; } }
@keyframes card-in { from { opacity: 0; translate: 0 220px; rotate: 24deg; } }
@keyframes drop-in { from { opacity: 0; translate: 0 -120px; rotate: -10deg; scale: 1.08; } }
@keyframes peek { from { opacity: 0; translate: 0 70px; } }
@keyframes float-chip { from { translate: 0 -7px; } to { translate: 0 9px; } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes nudge-x { 0%, 100% { transform: none; } 50% { transform: translateX(5px); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes wave { 0%, 55%, 100% { transform: rotate(0); } 8%, 24%, 40% { transform: rotate(-24deg); } 16%, 32% { transform: rotate(10deg); } }
@keyframes cheer { from { transform: rotate(-10deg); } to { transform: rotate(14deg); } }
@keyframes jump { from { translate: 0 0; } to { translate: 0 -16px; } }
@keyframes pulse-hint { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }
@keyframes halo { from { opacity: .6; scale: .5; } to { opacity: 0; scale: 1.6; } }

/* Scroll reveals. The class is set before first paint, so nothing flashes. */
.js .reveal {
  opacity: 0;
  translate: 0 40px;
  transition-property: opacity, translate, transform, rotate, box-shadow, background-color, color;
  transition-duration: .8s, 1s, .5s, .5s, .5s, .3s, .3s;
  transition-timing-function: ease, var(--spring), var(--spring), var(--spring), ease, ease, ease;
  transition-delay: var(--delay, 0ms), var(--delay, 0ms), 0s, 0s, 0s, 0s, 0s;
}
.js .reveal.in { opacity: 1; translate: 0 0; }

.magnetic { transition: transform .18s var(--spring), opacity .18s, translate .45s var(--spring); }

/* Franki, as a sticker: a white edge keeps the ink lines visible on any background. */
.franki {
  display: block;
  overflow: visible;
  filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff) drop-shadow(0 10px 12px rgba(30, 20, 0, .25));
}
.franki .f-eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.8s infinite; }
.franki .f-look { transform: translate(calc(var(--ex, 0) * 1px), calc(var(--ey, 0) * 1px)); }
.franki .f-wave { transform-box: view-box; transform-origin: 52px 40px; animation: wave 3.2s ease-in-out infinite; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: clip;
  display: flex;
  align-items: center;
  min-height: min(calc(100svh - 70px), 940px);
  padding: 40px 0 120px;
}
.hero-grid {
  position: relative;
  z-index: 2;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  align-items: center;
  gap: 40px;
}
.hero-copy { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.hero .eyebrow { font-weight: 500; }
.hero-title {
  font-size: clamp(64px, 9.4vw, 146px);
  line-height: .9;
  font-weight: 900;
  letter-spacing: -.055em;
  perspective: 900px;
}
.flipword {
  display: inline-block;
  transform-origin: 50% 100%;
  animation: flip-in 1s var(--spring) both;
  animation-delay: calc(var(--i) * 120ms + 80ms);
}
/* The highlighter swipe from the app's Today screen. */
.flipword.marked {
  margin-left: -.06em;
  padding: 0 .08em .04em .06em;
  border-radius: .14em;
  background: linear-gradient(var(--butter), var(--butter)) no-repeat 0 0 / 0% 100%;
  animation: flip-in 1s var(--spring) both, mark-sweep .9s cubic-bezier(.7, 0, .2, 1) forwards;
  animation-delay: calc(var(--i) * 120ms + 80ms), 1s;
}
.hero-lede { max-width: 520px; font-size: 21px; line-height: 1.45; color: var(--ink2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 8px; }
.hero-in { animation: fk-rise .9s var(--spring) both; animation-delay: calc(var(--i) * 110ms + 250ms); }

/* Word cards drifting past: they follow the pointer at different depths (--d) and turn over
   when clicked. */
.drift { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.drift-card {
  position: absolute;
  left: var(--x);
  top: var(--y);
  pointer-events: auto;
  cursor: pointer;
  perspective: 500px;
  translate: calc(var(--mx, 0) * var(--d) * -48px) calc(var(--my, 0) * var(--d) * -48px + var(--sy, 0) * var(--d) * var(--drift-scroll, -.5px));
  rotate: var(--r);
  animation: bob calc(4.5s + var(--d) * 4s) ease-in-out infinite alternate, pop-in .9s var(--spring) both;
  animation-delay: calc(var(--d) * -7s), calc(var(--d) * 900ms + 600ms);
}
.drift-face {
  position: relative;
  display: block;
  padding: 12px 18px 12px 26px;
  border: 1px solid var(--hair);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 14px 30px -14px var(--shadow), 0 2px 0 var(--hair);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  white-space: nowrap;
  transition: transform .2s ease-in;
}
.drift-face::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 11px;
  bottom: 11px;
  width: 6px;
  border-radius: 3px;
  background: var(--c);
}
.drift-card:hover .drift-face { box-shadow: 0 20px 40px -14px var(--shadow), 0 2px 0 var(--hair); }
.drift-card.turning .drift-face { transform: rotateY(90deg); }

/* The pile: the app's black Due card on a coloured stack, tilting with the pointer. */
.hero-stage {
  --s: 1;
  position: relative;
  display: grid;
  place-items: center;
  min-height: calc(560px * var(--s));
  perspective: 1400px;
}
.pile {
  position: relative;
  width: calc(300px * var(--s));
  height: calc(384px * var(--s));
  transform-style: preserve-3d;
  transform: rotateX(calc(var(--my, 0) * -10deg + 5deg)) rotateY(calc(var(--mx, 0) * 16deg - 9deg));
}
.pile-card {
  position: absolute;
  inset: 0;
  border-radius: calc(34px * var(--s));
  background-color: var(--c);
  background-image: repeating-linear-gradient(transparent 0 calc(30px * var(--s)), rgba(27, 26, 23, .07) calc(30px * var(--s)) calc(31px * var(--s)));
  box-shadow: 0 30px 60px -24px rgba(40, 25, 0, .35), inset 0 0 0 1px rgba(27, 26, 23, .06);
  transform:
    translateZ(calc(-34px - var(--n) * 36px))
    translate(calc(var(--dx) * var(--fan, 1) * var(--s)), calc(var(--dy) * var(--fan, 1) * var(--s)))
    rotate(calc(var(--rot) * var(--fan, 1)));
  transition: transform .8s var(--spring);
  animation: card-in 1.1s var(--spring) both;
  animation-delay: calc(var(--n) * 110ms + 250ms);
}
.pile:hover { --fan: 1.4; }
.due-card {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--s));
  padding: calc(28px * var(--s));
  border-radius: calc(34px * var(--s));
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 50px 80px -30px rgba(30, 20, 0, .55);
  transform: translateZ(40px) rotate(-3deg);
  animation: drop-in 1.1s var(--spring) .7s both;
}
/* A sheen that follows the pointer. */
.due-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at calc(50% + var(--mx, 0) * 70%) calc(30% + var(--my, 0) * 70%), rgba(255, 255, 255, .16), transparent 55%);
}
.due-eyebrow {
  font-family: var(--mono);
  font-size: calc(13px * var(--s));
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .72;
}
.due-count {
  font-size: calc(156px * var(--s));
  line-height: .8;
  font-weight: 900;
  letter-spacing: -.07em;
  font-variant-numeric: tabular-nums;
  margin-left: calc(-6px * var(--s));
}
.due-split { display: flex; gap: calc(4px * var(--s)); height: calc(10px * var(--s)); margin-top: calc(10px * var(--s)); }
.due-split span {
  flex: var(--w);
  border-radius: 999px;
  background: var(--c);
  transform-origin: left;
  animation: grow-x .9s var(--spring) both;
}
.due-split span:nth-child(1) { animation-delay: 1.3s; }
.due-split span:nth-child(2) { animation-delay: 1.4s; }
.due-split span:nth-child(3) { animation-delay: 1.5s; }
.due-breakdown { font-size: calc(14px * var(--s)); opacity: .75; }
.due-breakdown b { font-weight: 700; }
.due-button {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: calc(10px * var(--s));
  padding: calc(15px * var(--s)) calc(20px * var(--s));
  border-radius: 999px;
  background: var(--butter);
  color: var(--on-accent);
  font-size: calc(17px * var(--s));
  font-weight: 700;
}
.due-time { margin-left: auto; font-family: var(--mono); font-size: calc(14px * var(--s)); color: var(--on-accent-soft); }
.due-arrow { display: inline-block; animation: nudge-x 1.6s ease-in-out infinite; }
.hero-franki {
  position: absolute;
  top: calc(-96px * var(--s));
  right: calc(26px * var(--s));
  width: calc(120px * var(--s));
  transform: translateZ(90px) rotate(7deg);
  animation: peek 1s var(--spring) 1.25s both;
}
.orbit-chip {
  position: absolute;
  padding: calc(11px * var(--s)) calc(18px * var(--s));
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 18px 40px -14px var(--shadow);
  font-size: calc(15px * var(--s));
  font-weight: 650;
  white-space: nowrap;
  animation: pop-in .9s var(--spring) both, float-chip 4.5s ease-in-out infinite alternate;
}
.streak-chip { left: calc(-64px * var(--s)); top: calc(78px * var(--s)); transform: translateZ(120px) rotate(-6deg); animation-delay: 1.5s, -1s; }
.retention-chip { right: calc(-50px * var(--s)); bottom: calc(66px * var(--s)); transform: translateZ(150px) rotate(5deg); animation-delay: 1.65s, -3s; }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 3;
  width: 26px;
  height: 42px;
  margin-left: -13px;
  border: 2px solid var(--ink3);
  border-radius: 999px;
  animation: pop-in .8s var(--spring) 2s both;
}
.scroll-cue span {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--ink);
  animation: cue 1.8s ease-in-out infinite;
}

@media (max-width: 960px) {
  .hero { min-height: 0; padding: 32px 0 72px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 64px; }
  /* Narrow screens: the word cards float around the pile, below the words. */
  .drift { --drift-scroll: -.2px; top: auto; height: 52%; }
  .scroll-cue { display: none; }
}
@media (max-width: 520px) {
  .hero-stage { --s: .8; }
  .hero-lede { font-size: 19px; }
  .drift-face { font-size: 16px; padding: 9px 14px 9px 22px; }
  .drift-card:nth-child(n+8) { display: none; }
}
@media (max-width: 380px) { .hero-stage { --s: .72; } }

/* ---------- Sections ---------- */

.section-head { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }

/* Tiles light up under the pointer. */
.home .tile { position: relative; overflow: hidden; isolation: isolate; }
.home .tile::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(460px circle at var(--sx, 50%) var(--sy, -50%), color-mix(in srgb, var(--butter) 34%, transparent), transparent 62%);
  opacity: 0;
  transition: opacity .4s;
}
.home .tile:hover::before { opacity: 1; }
.home .tile:hover { transform: translateY(-4px); box-shadow: 0 36px 60px -36px var(--shadow); }

/* ---------- Try it: a deck you can study ---------- */

.how { padding-top: 128px; padding-bottom: 112px; display: flex; flex-direction: column; gap: 56px; }
.play { display: flex; justify-content: center; }
.play-area { width: min(100%, 680px); display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.play-table {
  position: relative;
  display: grid;
  place-items: center;
  height: 540px;
  border: 1px solid var(--hair);
  border-radius: 40px;
  background-color: var(--surface2);
  background-image: radial-gradient(circle, var(--hair) 1.3px, transparent 1.8px);
  background-size: 22px 22px;
}
.play-deck { position: relative; width: min(300px, 74%); aspect-ratio: 300 / 390; perspective: 1400px; }
.play-deck:focus-visible { outline: 2px solid var(--ink); outline-offset: 14px; border-radius: 38px; }

.fc {
  position: absolute;
  inset: 0;
  z-index: calc(10 - var(--depth));
  /* The top three show; a card coming up from below fades in. */
  opacity: clamp(0, 3 - var(--depth), 1);
  transform: translateY(calc(var(--depth) * 18px)) scale(calc(1 - var(--depth) * .05));
  transition: transform .6s var(--spring), opacity .4s, translate .55s var(--spring), rotate .55s var(--spring);
  touch-action: pan-y;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.fc.dragging { cursor: grabbing; transition: transform .6s var(--spring), opacity .4s; }
.fc-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .7s var(--spring); }
.fc.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: 30px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 34px 50px -30px rgba(40, 25, 0, .5), 0 0 0 1px var(--hair);
}
.fc-front { background: var(--surface); color: var(--ink); }
.fc-back { background: var(--c); color: var(--on-accent); transform: rotateY(180deg); }
.fc-deck {
  align-self: flex-start;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--c);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.fc-back .fc-deck { background: rgba(255, 255, 255, .5); }
.fc-text {
  margin: auto 0;
  text-align: center;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}
.fc-hint { text-align: center; font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink3); }
.fc-back .fc-hint { color: var(--on-accent-soft); }
.play-table:not(.played) .fc-front .fc-hint { animation: pulse-hint 1.6s ease-in-out infinite; }
.fc-stamp {
  position: absolute;
  top: 70px;
  left: 50%;
  z-index: 3;
  padding: 8px 18px;
  border: 3px solid var(--on-accent);
  border-radius: 14px;
  background: var(--c);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  translate: -50% 0;
  rotate: -10deg;
  scale: calc(.7 + var(--lean, 0) * .35);
  opacity: var(--lean, 0);
  pointer-events: none;
}
.fc-stamp:empty { display: none; }

.swipe-hint {
  position: absolute;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink3);
  transition: color .2s, scale .25s var(--spring);
}
.hint-up { top: 18px; left: 50%; translate: -50% 0; }
.hint-down { bottom: 18px; left: 50%; translate: -50% 0; }
.hint-left { left: 14px; top: 50%; translate: 0 -50%; writing-mode: vertical-rl; rotate: 180deg; }
.hint-right { right: 14px; top: 50%; translate: 0 -50%; writing-mode: vertical-rl; }
.play-table[data-lean='again'] .hint-left,
.play-table[data-lean='good'] .hint-right,
.play-table[data-lean='easy'] .hint-up,
.play-table[data-lean='hard'] .hint-down { color: var(--ink); scale: 1.2; }
/* Touch scrolls the page vertically, so only sideways swipes grade there. */
@media (pointer: coarse) { .hint-up, .hint-down { display: none; } }

.fly-tag {
  position: absolute;
  left: 50%;
  top: 46%;
  z-index: 20;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--c);
  color: var(--on-accent);
  box-shadow: 0 16px 30px -14px rgba(40, 25, 0, .5);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  translate: -50% -50%;
  animation: tag-up 1.4s var(--spring) forwards;
}
@keyframes tag-up {
  0% { opacity: 0; scale: .5; }
  14% { opacity: 1; scale: 1.08; }
  28% { scale: 1; }
  72% { opacity: 1; }
  100% { opacity: 0; translate: -50% -230%; }
}

.play-done {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  animation: fk-rise .7s var(--spring) both;
}
.play-done[hidden] { display: none; }
.cheer-franki { width: 116px; margin-bottom: 8px; animation: jump .45s ease-out infinite alternate; }
.cheer-franki .f-cheer-l { transform-box: view-box; transform-origin: 13px 38px; animation: cheer .45s ease-in-out infinite alternate; }
.cheer-franki .f-cheer-r { transform-box: view-box; transform-origin: 51px 38px; animation: cheer .45s ease-in-out infinite alternate-reverse; }
.done-title { font-size: 38px; font-weight: 800; letter-spacing: -.035em; }
.done-note { max-width: 290px; font-size: 16px; line-height: 1.45; color: var(--ink2); }

.play-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.play-controls .btn { min-height: 52px; font: inherit; font-weight: 600; cursor: pointer; }
.grade-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.grade {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 78px;
  min-height: 52px;
  padding: 8px 14px;
  border: 0;
  border-radius: 18px;
  background: var(--c);
  color: var(--on-accent);
  font: inherit;
  cursor: pointer;
}
.grade b { font-size: 15px; }
.grade span { font-family: var(--mono); font-size: 11px; color: var(--on-accent-soft); }
.grade:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 18px; }
.play-controls button:disabled { opacity: .4; cursor: default; transform: none; }
.play-status { min-height: 1.5em; text-align: center; font-family: var(--mono); font-size: 13px; color: var(--ink3); }

.confetto {
  position: absolute;
  left: 50%;
  top: 45%;
  z-index: 30;
  width: 12px;
  height: 16px;
  border-radius: 3px;
  background: var(--c);
  pointer-events: none;
  animation: confetti 1.3s cubic-bezier(.15, .7, .35, 1) both;
}
@keyframes confetti {
  from { opacity: 1; translate: 0 0; rotate: 0deg; }
  to { opacity: 0; translate: var(--tx) var(--ty); rotate: var(--rot); }
}

@media (max-width: 520px) {
  .how { padding-top: 96px; padding-bottom: 80px; }
  .play-table { height: 470px; border-radius: 32px; }
  .grade { min-width: 70px; padding: 8px 10px; }
}

/* ---------- The timing: one card remembered with and without reviews ---------- */

.curve { position: relative; border-top: 1px solid var(--hair); }
.curve-stage { display: flex; align-items: center; padding: 112px 0 96px; }
.curve-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 28px 56px;
}
.curve-copy { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.curve .display { font-size: clamp(40px, 4.8vw, 68px); }
.curve-figure { grid-column: 1 / -1; margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* The two cards and the day between them. */
.memories { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 18px; min-width: 0; }
.memory { margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.memory-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 190px;
  padding: 16px;
  border: 1px solid var(--hair);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 40px -28px rgba(40, 25, 0, .5);
}
.memory-with .memory-card { rotate: 2deg; }
.memory-without .memory-card { rotate: -2deg; }
.memory-deck {
  align-self: flex-start;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--sky);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.memory-q { margin-top: auto; font-size: 24px; font-weight: 800; letter-spacing: -.03em; text-align: center; }
.memory-a {
  margin-bottom: auto;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: pre;
  color: var(--ink2);
}
.memory-reading { display: flex; align-items: center; gap: 10px; }
.memory-meter { position: relative; flex: 1; height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface2); }
.memory-meter span { position: absolute; inset: 0 auto 0 0; width: calc(var(--recall, 1) * 100%); border-radius: inherit; background: var(--mint); }
.memory-without .memory-meter span { background: var(--peach); }
.memory-value { min-width: 4ch; text-align: right; font-family: var(--mono); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.memory-without .memory-value { color: var(--ink3); }
.memory-stamp {
  position: absolute;
  top: -14px;
  right: -10px;
  z-index: 2;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  rotate: 6deg;
  opacity: 0;
  pointer-events: none;
}
.memory-card.reviewing { animation: review-turn .7s var(--spring); }
.memory-card.reviewing .memory-stamp { animation: stamp-pop 1.8s var(--spring) forwards; }
@keyframes review-turn {
  0% { transform: none; }
  45% { transform: rotateY(90deg) scale(1.04); }
  100% { transform: none; box-shadow: 0 0 0 4px var(--mint), 0 24px 40px -28px rgba(40, 25, 0, .5); }
}
@keyframes stamp-pop {
  0% { opacity: 0; scale: .5; }
  15% { opacity: 1; scale: 1.08; }
  25% { scale: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* Like the date tile on Today. */
.day-tile {
  width: 88px;
  overflow: hidden;
  border: 1px solid var(--hair);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 30px -22px rgba(40, 25, 0, .5);
  text-align: center;
}
.day-tile-top {
  display: block;
  padding: 5px 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.day-tile-number { display: block; padding: 8px 0 10px; font-size: 36px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }

/* The chart. home.js draws it at its real size, so these sizes are pixels. */
.curve-svg { display: block; width: 100%; overflow: visible; }
.ch-grid line { stroke: var(--hair); stroke-width: 1; }
.ch-grid text { fill: var(--ink3); font-family: var(--mono); font-size: 12px; }
.ch-ghost-with { fill: none; stroke: var(--ink); stroke-width: 2; opacity: .13; }
.ch-ghost-without { fill: none; stroke: var(--ink3); stroke-width: 2; stroke-dasharray: 1 6; stroke-linecap: round; opacity: .45; }
.ch-keep { fill: url(#ch-hatch); }
.ch-hatch-line { stroke: var(--butter); stroke-width: 3.5; }
.ch-target { stroke: var(--peach); stroke-width: 2; stroke-dasharray: 8 7; }
.ch-target-label { fill: var(--ink2); font-family: var(--mono); font-size: 12px; }
.ch-with { fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; }
.ch-without { fill: none; stroke: var(--ink3); stroke-width: 3; stroke-dasharray: 1 7; stroke-linecap: round; }
.ch-bracket { opacity: .3; transition: opacity .4s; }
.ch-bracket.on { opacity: 1; }
.ch-bracket path { fill: none; stroke: var(--ink3); stroke-width: 1.5; }
.ch-bracket text { fill: var(--ink); font-family: var(--mono); font-size: 12px; font-weight: 600; text-anchor: middle; }
.ch-review { opacity: 0; scale: .3; transform-box: fill-box; transform-origin: center bottom; transition: opacity .3s, scale .6s var(--spring); }
.ch-review.on { opacity: 1; scale: 1; }
.ch-review rect { fill: var(--c); stroke: var(--ink); stroke-width: 1.5; }
.ch-playhead { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 4; opacity: .35; }
.ch-dot { fill: var(--ink); stroke: var(--paper); stroke-width: 3; }
.ch-dot-without { fill: var(--ink3); stroke: var(--paper); stroke-width: 2; }
.ch-halo { fill: var(--butter); transform-box: fill-box; transform-origin: center; animation: halo 1.6s ease-out infinite; }
.ch-keep-label { fill: var(--ink); font-family: var(--mono); font-size: 12px; font-weight: 600; text-anchor: middle; opacity: 0; transition: opacity .5s; }
.ch-keep-label.on { opacity: 1; }
/* A paper edge keeps labels readable over the hatching. */
.ch-keep-label, .ch-target-label, .ch-bracket text { paint-order: stroke; stroke: var(--paper); stroke-width: 5px; stroke-linejoin: round; }
@media (prefers-color-scheme: dark) { .ch-hatch-line { stroke-width: 2.5; } .ch-ghost-with { opacity: .2; } }

@media (max-width: 960px) {
  .curve-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .curve-copy { gap: 10px; }
  .curve .display { font-size: clamp(34px, 9vw, 52px); }
  .curve-copy .lede { font-size: 16px; }
}
@media (max-width: 600px) {
  .memories { gap: 10px; }
  .memory { gap: 8px; }
  .memory .label { font-size: 10px; letter-spacing: .1em; }
  .memory-card { min-height: 128px; padding: 12px 10px; border-radius: 20px; gap: 6px; }
  .memory-deck { font-size: 9px; padding: 4px 8px; }
  .memory-q { font-size: 17px; }
  .memory-a { font-size: 14px; letter-spacing: 0; }
  .memory-value { font-size: 13px; }
  .memory-stamp { font-size: 10px; padding: 5px 9px; }
  .day-tile { width: 60px; border-radius: 14px; }
  .day-tile-top { font-size: 9px; }
  .day-tile-number { font-size: 24px; padding: 6px 0 8px; }
  .curve-figure .fineprint { display: none; }
}

/* ---------- Features ---------- */

.features { padding-top: 112px; padding-bottom: 128px; display: flex; flex-direction: column; gap: 56px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 20px; }
.feature-wide { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 32px; align-items: center; }
.feature-wide-copy { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

/* Notes in: each highlighted line becomes a card on the pile. */
.maker { flex: 1.3 1 380px; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 22px; align-items: center; }
.maker-note {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 24px;
  border: 1px solid var(--hair);
  border-radius: 22px;
  background: var(--paper);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink2);
}
.maker-line mark {
  padding: 0 3px;
  border-radius: 5px;
  background: linear-gradient(var(--butter), var(--butter)) no-repeat 0 0 / 0% 100%;
  color: inherit;
  transition: background-size .6s cubic-bezier(.7, 0, .2, 1), color .3s;
}
.maker-line.on mark { background-size: 100% 100%; color: var(--on-accent); }
.maker-pile { position: relative; height: 200px; }
.made {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--n) * 30px);
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--c);
  color: var(--on-accent);
  rotate: var(--r);
  box-shadow: 0 18px 30px -18px rgba(40, 25, 0, .55);
  animation: made-in .75s var(--spring) both;
}
.made-q { font-size: 15px; font-weight: 700; line-height: 1.3; }
.made-a { margin-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--on-accent-soft); }
@keyframes made-in { from { opacity: 0; translate: -140px 20px; rotate: -24deg; scale: .7; } }
@media (max-width: 600px) {
  .maker { grid-template-columns: minmax(0, 1fr); }
  .maker-pile { height: 170px; }
}

/* A quiz that plays itself. */
.quiz-demo { display: flex; flex-direction: column; gap: 12px; margin-top: auto; padding-top: 12px; }
.quiz-q { min-height: 1.3em; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.quiz-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--hair);
  border-radius: 14px;
  background: var(--paper);
  font-size: 15px;
  font-weight: 600;
  transition: background-color .3s, color .3s, opacity .3s, border-color .3s, transform .35s var(--spring);
  animation: fk-rise .5s var(--spring) both;
  animation-delay: calc(var(--i) * 70ms);
}
.quiz-option .letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--surface2);
  font-family: var(--mono);
  font-size: 12px;
}
.quiz-option.hover { border-color: var(--ink3); transform: scale(1.03); }
.quiz-option.right { border-color: transparent; background: var(--mint); color: var(--on-accent); transform: scale(1.05); }
.quiz-option.right .letter { background: rgba(255, 255, 255, .55); }
.quiz-option.dim { opacity: .35; }

/* With motion off, the headline keeps its highlight. */
@media (prefers-reduced-motion: reduce) {
  .flipword.marked { background-size: 100% 100%; color: var(--on-accent); }
}

.home a.skill-tile { background: var(--ink); color: var(--paper); border-color: transparent; }
.home a.skill-tile:hover { color: var(--paper); }
.skill-tile .label, .skill-tile .body { color: color-mix(in srgb, var(--paper) 72%, transparent); }
.skill-link { padding-top: 8px; font-weight: 700; }
.skill-code {
  overflow-x: auto;
  margin: 8px 0 0;
  padding: 18px 20px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 9%, transparent);
  color: color-mix(in srgb, var(--paper) 75%, transparent);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
}
.skill-code .k { color: var(--sky); }
.skill-code .v { color: var(--butter); }
.skill-code .caret { display: inline-block; width: .55em; height: 1.1em; margin-left: 2px; vertical-align: -.2em; background: var(--peach); animation: caret 1.1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
/* Beside the Anki tile it fills the row, with the code to the side. */
@media (min-width: 760px) {
  .home a.skill-tile { grid-column: span 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); grid-template-rows: auto auto 1fr auto; column-gap: 32px; }
  .skill-tile > :not(.skill-code) { grid-column: 1; }
  .skill-code { grid-column: 2; grid-row: 1 / -1; align-self: center; margin: 0; }
}
.skill-link::after { content: ''; display: inline-block; width: 0; transition: width .4s var(--spring); }
.skill-tile:hover .skill-link::after { width: 10px; }
.home .skill-tile::before { background: radial-gradient(460px circle at var(--sx, 50%) var(--sy, -50%), color-mix(in srgb, var(--lilac) 40%, transparent), transparent 62%); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.chips li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: var(--surface);
  font-size: 15px;
  font-weight: 500;
  transition: background-color .25s, color .25s, transform .35s var(--spring);
}
.chips li::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.chips li:hover { background: var(--c); color: var(--on-accent); transform: translateY(-3px) rotate(-2deg); }

/* ---------- Starter decks ---------- */

.decks { padding-top: 128px; padding-bottom: 72px; display: flex; flex-wrap: wrap; gap: 64px; align-items: flex-start; }
.decks-copy { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
/* The number as a pile of cards. */
.big-number {
  font-size: clamp(130px, 17vw, 230px);
  line-height: .85;
  font-weight: 900;
  letter-spacing: -.06em;
  text-shadow: .03em .03em 0 var(--butter), .06em .06em 0 var(--peach), .09em .09em 0 var(--sky);
}
.decks-lede { max-width: 420px; padding-top: 24px; font-size: 21px; line-height: 1.45; color: var(--ink2); }
.deck-kinds { flex: 1 1 520px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 14px; }
.deck-kind {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 26px 26px 26px 34px;
  border: 1px solid var(--hair);
  border-radius: 24px;
  background: var(--surface);
}
.deck-kind::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  z-index: -1;
  width: 10px;
  background: var(--c);
  transition: width .55s var(--spring);
}
.deck-kind:hover::before { width: 100%; }
.deck-kind:hover { color: var(--on-accent); }
.deck-kind h3 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.deck-kind p { font-size: 15px; line-height: 1.45; color: var(--ink2); transition: color .3s; }
.deck-kind:hover p { color: var(--on-accent-soft); }

/* Two rails of deck cards running opposite ways, faster while you scroll. Without the
   script (or with motion off) they scroll sideways by hand. */
.deck-rails { display: flex; flex-direction: column; gap: 18px; padding: 24px 0 128px; overflow: clip; }
.rail { overflow-x: auto; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rails-moving .rail { overflow: hidden; }
.rail-move { display: flex; width: max-content; will-change: transform; }
.rail-track { display: flex; gap: 18px; margin: 0; padding: 14px 18px 18px 0; list-style: none; }
.rail-track li {
  flex: none;
  min-width: 230px;
  padding: 26px 28px;
  border-radius: 22px;
  background: var(--c);
  color: var(--on-accent);
  box-shadow: 9px 9px 0 -2px color-mix(in srgb, var(--c) 50%, var(--paper));
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -.015em;
  white-space: nowrap;
  rotate: -1.5deg;
  transition: rotate .4s var(--spring), transform .4s var(--spring);
}
.rail-track li:nth-child(even) { rotate: 1.5deg; }
.rail-track li:hover { rotate: 0deg; transform: scale(1.05); }

/* ---------- Download: the pile fans out behind the card ---------- */

.download { overflow: clip; padding: 24px 24px 96px; }
.finale { --spread: 170px; position: relative; max-width: var(--content); margin: 0 auto; padding-top: 150px; }
.finale-pile { position: absolute; left: 50%; top: 150px; width: 0; height: 0; }
.finale-pile span {
  position: absolute;
  left: -90px;
  top: 24px;
  width: 180px;
  height: 230px;
  border-radius: 26px;
  background: var(--c);
  box-shadow: 0 20px 40px -24px rgba(40, 25, 0, .5);
  transform:
    translateX(calc((var(--n) - 2) * var(--fan, 0) * var(--spread)))
    translateY(calc(var(--fan, 0) * -150px + var(--a) * var(--fan, 0) * 30px))
    rotate(calc((var(--n) - 2) * var(--fan, 0) * 12deg));
}
.cta {
  position: relative;
  z-index: 1;
  max-width: var(--content);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  padding: clamp(56px, 8vw, 112px) clamp(28px, 6vw, 88px);
  border-radius: 40px;
  background: var(--ink);
  color: var(--paper);
}
.cta-copy { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.cta h2 { font-size: clamp(56px, 8vw, 120px); line-height: .9; font-weight: 900; letter-spacing: -.05em; }
.cta p { max-width: 520px; font-size: 19px; line-height: 1.5; opacity: .72; }
.btn-cta { position: relative; overflow: hidden; min-height: 64px; padding: 0 32px; background: var(--paper); color: var(--ink); font-size: 19px; }
.btn-cta::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, color-mix(in srgb, var(--butter) 70%, transparent) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform .8s var(--spring);
}
.btn-cta:hover::after { transform: translateX(120%); }
.bye-franki {
  position: absolute;
  top: -96px;
  right: clamp(28px, 8vw, 110px);
  width: 112px;
  opacity: 0;
  translate: 0 60px;
  transition: opacity .4s, translate .8s var(--spring);
}
.finale.in .bye-franki { opacity: 1; translate: 0 0; }
html:not(.js) .bye-franki { opacity: 1; translate: 0 0; }

@media (max-width: 720px) {
  .finale { --spread: 64px; padding-top: 130px; }
  .finale-pile { top: 130px; }
  .finale-pile span { left: -66px; width: 132px; height: 170px; }
  .cta { border-radius: 32px; }
  .cta h2 { font-size: clamp(36px, 11vw, 56px); }
  .bye-franki { width: 88px; top: -76px; }
}
@media (max-width: 420px) {
  /* Full-width pills; on the very narrowest screens the label may wrap inside the pill. */
  .hero-actions .btn, .btn-cta { flex: 1 1 100%; width: 100%; justify-content: center; gap: 10px; padding: 12px 20px; font-size: 16px; white-space: normal; text-align: center; }
  .cta { padding-left: 24px; padding-right: 24px; }
  .hero-title { font-size: clamp(48px, 15vw, 64px); }
}

/* ---------- Footer ---------- */

.home .site-footer { padding-top: 40px; }
