/*
 * storyvoy.com's homepage, in the Storyvoy design system (the app's day and
 * night themes): Figtree for headings, Atkinson Hyperlegible Next for text,
 * both served from this site (no Google Fonts, so no visitor data leaves).
 */
@font-face {
  font-family: Figtree;
  src: url('/fonts/Figtree_600SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Figtree;
  src: url('/fonts/Figtree_700Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('/fonts/AtkinsonHyperlegibleNext_400Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('/fonts/AtkinsonHyperlegibleNext_600SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

:root {
  --paper: #fbf6ec;
  --raised: #ffffff;
  --sunken: #efe5d2;
  --line: #d9c9ad;
  --ink: #1b2a41;
  --muted: #5a6476;
  --lantern: #f2a33a;
  --lantern-edge: #a8600f;
  --aurora: #1d7a66;
  --sea: #2b5d8a;
  --band: #0f1b2d;
  --band-ink: #f4ede0;
  --band-muted: #aab4c5;
  --shadow: 0 18px 40px rgba(27, 42, 65, 0.14);
  --display: Figtree, 'Segoe UI', system-ui, sans-serif;
  --reading: 'Atkinson Hyperlegible Next', Verdana, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1b2d;
    --raised: #18283f;
    --sunken: #0a1422;
    --line: #33486a;
    --ink: #f4ede0;
    --muted: #aab4c5;
    --lantern: #f5b85a;
    --lantern-edge: #f5b85a;
    --aurora: #5fcfae;
    --sea: #8fb9e6;
    --band: #0a1422;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  }
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--reading);
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}
a {
  color: var(--sea);
}
:focus-visible {
  outline: 3px solid var(--sea);
  outline-offset: 3px;
  border-radius: 4px;
}
h1,
h2,
h3 {
  font-family: var(--display);
  margin: 0;
  line-height: 1.15;
}
p {
  margin: 0;
}
.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 16px;
  top: 16px;
  background: var(--raised);
  padding: 8px 16px;
  z-index: 10;
}

/* Header */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 32px;
  padding-top: 20px;
  padding-bottom: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  color: var(--ink);
  text-decoration: none;
  font: 700 24px var(--display);
}
.brand img {
  width: 44px;
  height: 44px;
}
.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  font: 600 16px var(--display);
}
.top nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 8px 0;
}
.top nav a:hover {
  color: var(--sea);
}

/* Hero: the headline, then a whole book's story tree drawing itself out to
   its sixteen endings, then the library's sum. */
.hero {
  padding-top: 32px;
  padding-bottom: 72px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.hero-text {
  display: grid;
  gap: 24px;
  align-items: end;
}
@media (min-width: 900px) {
  .hero {
    padding-top: 56px;
  }
  .hero-text {
    grid-template-columns: 1.15fr 1fr;
    gap: 56px;
  }
}
.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.4rem);
  letter-spacing: -1.5px;
  line-height: 1.02;
  max-width: 12ch;
}
.hero-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.lead {
  font-size: 1.2rem;
  line-height: 1.6;
  max-width: 34rem;
}
.soon {
  font: 600 15px var(--display);
  color: var(--muted);
}

.tree-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tree {
  width: 100%;
  height: auto;
  overflow: visible;
}
.tree.tall {
  display: none;
  max-width: 420px;
  margin: 0 auto;
}
@media (max-width: 699px) {
  .tree.wide {
    display: none;
  }
  .tree.tall {
    display: block;
  }
}
.tree .edge {
  fill: none;
  stroke: var(--line);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 0.45s ease-out forwards;
  animation-delay: calc(var(--d) * 0.32s + 0.2s);
}
/* The walked path, green as in the app's Sagostigen. */
.tree .edge.on {
  stroke: var(--aurora);
  stroke-width: 5;
}
.tree .node {
  fill: var(--sunken);
  stroke: var(--line);
  stroke-width: 2.5;
  opacity: 0;
  animation: appear 0.2s ease-out forwards;
  animation-delay: calc(var(--d) * 0.32s + 0.45s);
}
.tree .chapter {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: pop 0.35s cubic-bezier(0.3, 1.5, 0.6, 1) forwards;
  animation-delay: calc(var(--d) * 0.32s + 0.3s);
}
.tree .chapter rect {
  fill: none;
  stroke: var(--aurora);
  stroke-width: 4;
}
.tree .leaf {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: pop 0.4s cubic-bezier(0.3, 1.5, 0.6, 1) forwards;
  animation-delay: calc(1.45s + var(--i) * 0.045s);
}
.tree .leaf circle {
  fill: none;
  stroke: var(--line);
  stroke-width: 3;
}
.tree .leaf.on circle {
  stroke: var(--aurora);
  stroke-width: 5;
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes appear {
  to {
    opacity: 1;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tree .edge,
  .tree .node,
  .tree .chapter,
  .tree .leaf {
    animation: none;
    stroke-dashoffset: 0;
    opacity: 1;
  }
}
.tree-figure figcaption {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}
.tree-figure em {
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
}

/* The sum: books × endings = endings to find. */
.sum {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 4px 18px;
  font: 600 clamp(1.15rem, 2.4vw, 1.6rem) / 1.2 var(--display);
  color: var(--muted);
  text-align: center;
}
.sum b {
  display: inline-block;
  font-weight: 700;
  font-size: clamp(2.2rem, 5.4vw, 3.8rem);
  color: var(--ink);
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  margin-right: 6px;
}
.sum .op {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  color: var(--lantern-edge);
}
.sum .total b {
  color: var(--aurora);
}
@media (max-width: 560px) {
  .sum .total {
    flex-basis: 100%;
  }
}

/* A phone around a screenshot */
.phone {
  border: 8px solid #1b2a41;
  border-radius: 30px;
  overflow: hidden;
  background: #1b2a41;
  box-shadow: var(--shadow);
}
.phone img {
  width: 100%;
  aspect-ratio: 1080 / 2220;
  border-radius: 22px;
}

/* Sections */
section {
  scroll-margin-top: 16px;
}
.band {
  background: var(--raised);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.section {
  padding-top: 80px;
  padding-bottom: 80px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.section-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 40rem;
}
.section-head h2 {
  font-size: clamp(1.9rem, 3.6vw, 2.5rem);
  letter-spacing: -0.5px;
}
.section-head p {
  color: var(--muted);
  font-size: 1.1rem;
}

/* How it works */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 40px 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.step {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.step .phone {
  width: min(230px, 52%);
  margin: 0 auto 8px;
}
.step .num {
  font: 700 15px var(--display);
  color: var(--aurora);
}
.step h3 {
  font-size: 1.45rem;
}
.step p {
  color: var(--muted);
}

/* The explorer's book: the screen itself, then its three kinds of finds. */
.explorer-layout {
  display: grid;
  gap: 48px;
  align-items: start;
}
@media (min-width: 900px) {
  .explorer-layout {
    grid-template-columns: 260px 1fr;
    gap: 72px;
  }
  .explorer-phone {
    position: sticky;
    top: 32px;
  }
}
.explorer-phone {
  width: min(260px, 70%);
  margin: 0 auto;
}
.explorer-parts {
  display: flex;
  flex-direction: column;
  gap: 56px;
}
.part {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.part h3 {
  font-size: 1.45rem;
}
.part > p {
  color: var(--muted);
  max-width: 34rem;
  margin-bottom: 14px;
}
.endings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 12px;
}
@media (max-width: 560px) {
  .endings {
    grid-template-columns: repeat(2, 1fr);
  }
}
.endings li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  font: 600 15px/1.3 var(--display);
}
.endings img,
.endings .unknown {
  width: min(112px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 4px solid var(--raised);
  box-shadow: var(--shadow);
  object-fit: cover;
}
.endings .unknown {
  display: grid;
  place-items: center;
  background: var(--sunken);
  border: 3px dashed var(--line);
  box-shadow: none;
  font: 700 40px var(--display);
  color: var(--muted);
}
.endings .hidden {
  color: var(--muted);
}

/* Character cards, fanned like a hand of cards. */
.cards-fan {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 560px) {
  .cards-fan {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 14px;
  }
}
.cards-fan li {
  rotate: var(--tilt);
  background: var(--raised);
  border-radius: 18px;
  padding: 8px 8px 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
}
.cards-fan img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 8px;
  background: var(--sunken);
}
.cards-fan b {
  font: 700 1.1rem var(--display);
}
.cards-fan span {
  font-size: 13px;
  line-height: 1.3;
  color: var(--muted);
}

/* Stamps and badges side by side. */
.rewards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px 40px;
}
.stamps {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  display: flex;
  gap: 20px;
}
.stamp {
  width: 140px;
  rotate: var(--tilt);
  filter: drop-shadow(0 8px 14px rgba(27, 42, 65, 0.18));
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
  font: 600 14px/1.3 var(--display);
}
/* The stamp's perforated edge: holes punched in the border, never the picture. */
.stamp img,
.stamp.empty::before {
  padding: 9px;
  background: #fffdf7;
  aspect-ratio: 1;
  object-fit: cover;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    radial-gradient(circle at 7px 7px, transparent 4px, #000 4.6px) -7px -7px / 14px 14px;
  mask:
    linear-gradient(#000 0 0) content-box,
    radial-gradient(circle at 7px 7px, transparent 4px, #000 4.6px) -7px -7px / 14px 14px;
}
.stamp.empty {
  filter: none;
  color: var(--muted);
}
.stamp.empty::before {
  content: '';
  display: block;
  background: var(--line);
  opacity: 0.55;
}
.badges {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 84px);
  gap: 12px;
}
.badges li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  font: 600 14px/1.25 var(--display);
}
.badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
}
.badge svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.badge.lantern {
  background: var(--lantern);
  border: 3px solid var(--lantern-edge);
  color: #1b2a41;
}
.badge.aurora {
  background: #1d7a66;
}
.badge.sea {
  background: #2b5d8a;
}
.badges .locked {
  color: var(--muted);
}
.badges .locked .badge {
  border: 3px dashed var(--line);
  color: var(--line);
}
@media (max-width: 560px) {
  .badges {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* The books: every cover, by age. */
.shelf {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.shelf + .shelf {
  margin-top: 16px;
}
.shelf h3 {
  font-size: 1.35rem;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.shelf h3 span {
  font: 600 15px var(--display);
  color: var(--muted);
}
.covers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px 14px;
}
.covers li {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font: 600 14px/1.3 var(--display);
}
.covers img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 12px;
  background: var(--sunken);
}
@media (max-width: 560px) {
  .covers {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 10px;
  }
  .covers li {
    font-size: 13px;
  }
}

/* Price: three steps, the free shelf first. */
.price-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  counter-reset: price;
  border-top: 2px solid var(--ink);
}
.price-steps li {
  padding: 24px 24px 8px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.price-steps h3 {
  font-size: 1.5rem;
}
.price-steps p {
  color: var(--muted);
  max-width: 22rem;
}
.price-steps .plans p:first-of-type {
  color: var(--ink);
  font-size: 1.15rem;
}
.price-steps b {
  font: 700 1.9rem var(--display);
  letter-spacing: -0.5px;
}
.price-steps .fine {
  font-size: 15px;
}

/* Parents: a calm list. */
.promises {
  margin: 0;
  display: grid;
  gap: 28px 48px;
  max-width: 52rem;
}
@media (min-width: 700px) {
  .promises {
    grid-template-columns: 1fr 1fr;
  }
}
.promises div {
  border-left: 3px solid var(--lantern);
  padding-left: 18px;
}
.promises dt {
  font: 700 1.15rem var(--display);
}
.promises dd {
  margin: 6px 0 0;
  color: var(--muted);
}

/* Closing band and footer */
.closing {
  background: var(--band);
  color: var(--band-ink);
}
.closing .wrap {
  padding-top: 72px;
  padding-bottom: 72px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.closing h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
}
.closing p {
  color: var(--band-muted);
  margin-top: 10px;
}
.closing a {
  color: #8fb9e6;
}
.foot {
  padding-top: 32px;
  padding-bottom: 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  font-size: 14px;
  color: var(--muted);
}
.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font: 600 15px var(--display);
}
.foot nav a {
  text-decoration: none;
}

/* Covers that link to their book pages (/bocker/). */
.covers a {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
}
.covers a:hover span {
  text-decoration: underline;
}
.all-books {
  font: 600 17px var(--display);
}
