/*
 * Hoppo Stories public pages (playhoppo.com/stories/..., build/storyPages.ts).
 * A picture-book look in the cast's own palette (docs/stories/bible.md):
 * cream paper, one dark-brown ink for outlines and headings (#381808, the
 * outline every character shares), Hoppo amber and creek turquoise for
 * accents, Fredoka headings and Nunito text. Cards are drawn like stickers:
 * a thick ink outline and a flat offset shadow. Loaded after landing.css,
 * which supplies the site header, footer and skip link.
 */
.sb-body {
  --sb-ink: #381808;
  --sb-text: #4a2a14;
  --sb-soft: #7a5134;
  --sb-paper: #fff8ec;
  --sb-paper-2: #fdeed3;
  --sb-amber: #fda41b;
  --sb-amber-dark: #eb7a02;
  --sb-teal: #02a9bd;
  --sb-sky: #79c8f2;
  --sb-leaf: #8fb339;
  --sb-card: #ffffff;
  --sb-radius: 22px;
  --sb-shadow: 5px 5px 0 var(--sb-ink);
  background: var(--sb-paper);
}

.sb {
  color: var(--sb-text);
  font-family: 'Nunito', 'Inter', system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: clip;
}

.sb h1,
.sb h2,
.sb h3,
.sb-kicker,
.sb-btn,
.sb-chip,
.sb-pill,
.sb-friend-name,
.sb-book-title,
.sb-quote {
  font-family: 'Fredoka', 'Nunito', system-ui, sans-serif;
  color: var(--sb-ink);
}

.sb-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 720px) {
  .sb-wrap {
    padding: 0 28px;
  }
}

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

.sb-hero {
  /* The site nav is fixed at the top. */
  padding: 92px 0 40px;
  background:
    radial-gradient(ellipse 120% 60% at 50% 0%, #d9f1ff 0%, rgba(217, 241, 255, 0) 70%),
    var(--sb-paper);
  border-bottom: 3px dashed rgba(56, 24, 8, 0.18);
}

.sb .breadcrumbs {
  font-size: 0.92rem;
  color: var(--sb-soft);
  margin-bottom: 8px;
}

.sb .breadcrumbs a {
  color: var(--sb-ink);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.sb-hero-grid {
  display: grid;
  gap: 28px;
  align-items: center;
}

@media (min-width: 880px) {
  .sb-hero-grid {
    grid-template-columns: 1fr 1.05fr;
    gap: 40px;
  }
}

.sb-kicker {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 14px;
  border: 2px solid var(--sb-ink);
  border-radius: 999px;
  background: #fff3d6;
  font-weight: 600;
  font-size: 0.95rem;
}

.sb-hero--friend .sb-kicker {
  text-transform: capitalize;
}

.sb h1 {
  font-size: clamp(2.4rem, 7vw, 4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 4px 0 14px;
}

.sb-lede {
  font-size: clamp(1.1rem, 2.4vw, 1.3rem);
  max-width: 38em;
  margin: 0 0 18px;
}

.sb-intro {
  max-width: 42em;
  margin: 0 0 14px;
}

/* The hero picture: a real Sunny Gully background with the cast on it, framed like a book page. */
.sb-hero-art {
  position: relative;
  margin: 0;
  aspect-ratio: 3 / 2;
  border: 4px solid var(--sb-ink);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 8px 8px 0 var(--sb-ink);
  background: var(--sb-sky);
  transform: rotate(0.6deg);
}

.sb-hero-bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sb-cast {
  position: absolute;
  bottom: 6%;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 0 rgba(56, 24, 8, 0.18));
}

.sb-cast-hoppo { left: 30%; height: 72%; }
.sb-cast-kiki { left: 5%; height: 40%; bottom: 8%; }
.sb-cast-wombo { left: 54%; height: 50%; }
.sb-cast-pip { left: 76%; height: 48%; }

@media (prefers-reduced-motion: no-preference) {
  .sb-cast-hoppo {
    animation: sb-hop 2.6s ease-in-out infinite;
  }
}

@keyframes sb-hop {
  0%, 70%, 100% { transform: translateY(0); }
  80% { transform: translateY(-8%); }
  90% { transform: translateY(0) scaleY(0.97); }
}

/* ---------- Buttons, chips, links ---------- */

.sb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 8px 0 0;
}

.sb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 22px;
  border: 3px solid var(--sb-ink);
  border-radius: 999px;
  background: #fff;
  color: var(--sb-ink);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--sb-ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.sb-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--sb-ink);
}

.sb-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--sb-ink);
}

.sb-btn--primary {
  background: var(--sb-amber);
}

.sb-btn--teal {
  background: #9be7ef;
}

.sb a:focus-visible,
.sb button:focus-visible {
  outline: 3px solid var(--sb-teal);
  outline-offset: 3px;
}

.sb-link {
  color: var(--sb-ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--sb-amber);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.sb-chip {
  display: inline-block;
  padding: 2px 12px;
  border: 2px solid var(--sb-ink);
  border-radius: 999px;
  background: #d8f6c8;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
}

.sb-pills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 8px;
  padding: 0;
}

.sb-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 18px;
  border: 2px solid var(--sb-ink);
  border-radius: 999px;
  background: #fff;
  font-weight: 500;
  text-decoration: none;
}

a.sb-pill:hover {
  background: #fff3d6;
}

.sb-pills--static .sb-pill {
  background: #fff3d6;
}

.sb-quote {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 600;
  margin: 12px 0 6px;
  padding-left: 16px;
  border-left: 6px solid var(--sb-amber);
}

.sb-small {
  font-size: 0.95rem;
  color: var(--sb-soft);
}

.sb-more {
  margin-top: 14px;
}

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

.sb-section {
  padding: 44px 0;
}

.sb-section + .sb-section {
  border-top: 3px dashed rgba(56, 24, 8, 0.12);
}

.sb-section--paper {
  background: var(--sb-paper-2);
}

.sb-h2 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  margin: 0 0 18px;
}

.sb-h2::after {
  content: '';
  display: block;
  width: 72px;
  height: 6px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--sb-amber);
}

.sb-h3 {
  font-size: 1.35rem;
  margin: 6px 0 14px;
}

.sb-section p {
  max-width: 46em;
  margin: 0 0 12px;
}

.sb-card {
  background: var(--sb-card);
  border: 3px solid var(--sb-ink);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);
  padding: 20px;
}

.sb-card h3 {
  font-size: 1.3rem;
  margin: 0 0 6px;
}

.sb-list {
  margin: 0;
  padding-left: 1.4em;
  max-width: 46em;
}

.sb-list li {
  margin: 0 0 10px;
}

.sb-list--numbered li::marker {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: var(--sb-amber-dark);
}

/* ---------- The promise ---------- */

.sb-promise {
  display: grid;
  gap: 22px;
}

@media (min-width: 760px) {
  .sb-promise {
    grid-template-columns: repeat(3, 1fr);
  }
}

.sb-promise-card {
  position: relative;
  padding-top: 18px;
}

.sb-promise-art {
  display: block;
  width: auto;
  height: 112px;
  margin: 0 0 8px;
  object-fit: contain;
}

/* ---------- Book cards and the shelf ---------- */

.sb-shelf {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
}

.sb-book {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 3px solid var(--sb-ink);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);
  overflow: hidden;
  text-decoration: none;
  color: var(--sb-text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sb-book:hover {
  transform: translate(-2px, -3px) rotate(-0.4deg);
  box-shadow: 8px 8px 0 var(--sb-ink);
}

.sb-book img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 3px solid var(--sb-ink);
  background: var(--sb-sky);
}

.sb-book-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 18px;
  align-items: flex-start;
}

.sb-book-meta {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--sb-soft);
  margin: 0;
}

.sb-book-title {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

.sb-book-lesson {
  font-style: italic;
}

/* ---------- Newest story ---------- */

.sb-feature {
  display: grid;
  gap: 20px;
  padding: 16px;
  align-items: center;
}

@media (min-width: 820px) {
  .sb-feature {
    grid-template-columns: 1.2fr 1fr;
    gap: 28px;
    padding: 20px;
  }
}

.sb-feature-art img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 3px solid var(--sb-ink);
  border-radius: 16px;
  background: var(--sb-sky);
}

.sb-feature-title {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  margin: 2px 0 8px;
}

/* ---------- Friends ---------- */

.sb-friends {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}

@media (min-width: 720px) {
  .sb-friends {
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  }
}

.sb-friends--small {
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  margin-top: 12px;
}

.sb-friends--grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 22px;
}

.sb-friend {
  --friend: var(--sb-amber);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  padding: 12px 8px 14px;
  border: 3px solid var(--sb-ink);
  border-radius: var(--sb-radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--friend) 22%, #fff) 0%, #fff 70%);
  box-shadow: 4px 4px 0 var(--sb-ink);
  text-decoration: none;
  color: var(--sb-text);
  transition: transform 0.15s ease;
}

.sb-friend:hover {
  transform: translateY(-3px);
}

.sb-friend img {
  width: auto;
  height: 104px;
  max-width: 100%;
  object-fit: contain;
}

.sb-friend-name {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
}

.sb-friend-species {
  font-size: 0.85rem;
  color: var(--sb-soft);
  font-weight: 700;
}

.sb-friend--big {
  padding: 18px 16px 20px;
}

.sb-friend--big img {
  height: 160px;
}

.sb-friend-line {
  margin-top: 6px;
  font-size: 0.95rem;
}

/* Friend page hero: the sticker and a pose, standing on a coloured hill. */
.sb-friend-art {
  position: relative;
  margin: 0;
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4%;
  padding: 20px 12px 0;
  border: 4px solid var(--sb-ink);
  border-radius: 28px;
  box-shadow: 8px 8px 0 var(--sb-ink);
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 30% at 50% 100%, #9ccc4a 0 60%, transparent 61%),
    linear-gradient(180deg, #bfe7fb 0%, color-mix(in srgb, var(--friend) 25%, #fff) 100%);
}

.sb-friend-art img {
  width: auto;
  object-fit: contain;
  max-width: 46%;
}

.sb-friend-front {
  height: 250px;
}

.sb-friend-pose {
  height: 210px;
}

@media (min-width: 880px) {
  .sb-friend-art {
    min-height: 360px;
  }
  .sb-friend-front {
    height: 330px;
  }
  .sb-friend-pose {
    height: 280px;
  }
}

.sb-facts {
  display: grid;
  gap: 12px;
  margin: 14px 0 0;
  max-width: 46em;
}

@media (min-width: 720px) {
  .sb-facts {
    grid-template-columns: repeat(3, 1fr);
  }
}

.sb-facts div {
  padding: 12px 14px;
  border: 2px solid var(--sb-ink);
  border-radius: 16px;
  background: #fff;
}

.sb-facts dt {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--sb-ink);
}

.sb-facts dd {
  margin: 0;
}

.sb-games {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.sb-games li {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
}

/* ---------- Episode page ---------- */

.sb-watch {
  position: relative;
  margin: 18px 0 18px;
  max-width: 880px;
  aspect-ratio: 16 / 9;
  border: 4px solid var(--sb-ink);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 8px 8px 0 var(--sb-ink);
  background: var(--sb-sky);
}

.sb-watch img,
.sb-watch video,
.sb-watch iframe {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}

.sb-play {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 26px 10px 20px;
  border: 3px solid var(--sb-ink);
  border-radius: 999px;
  background: var(--sb-amber);
  color: var(--sb-ink);
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
  text-decoration: none;
  box-shadow: 4px 4px 0 var(--sb-ink);
  cursor: pointer;
}

.sb-play::before {
  content: '';
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent var(--sb-ink);
}

.sb-watch-fallback {
  position: absolute;
  inset: 0;
}

.sb-watch-fallback[hidden] {
  display: none;
}

.sb-watch-note {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 4px 10px;
  font-size: 0.8rem;
  text-align: center;
  background: rgba(255, 248, 236, 0.9);
}

.sb-move {
  display: flex;
  gap: 18px;
  align-items: center;
  max-width: 52em;
  background: #fff7e0;
}

.sb-transcript {
  counter-reset: page;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 44em;
}

.sb-transcript li {
  counter-increment: page;
  position: relative;
  margin: 0 0 14px;
  padding: 14px 18px 14px 56px;
  background: #fffdf7;
  border: 2px solid rgba(56, 24, 8, 0.25);
  border-radius: 14px;
  font-size: 1.12rem;
}

.sb-transcript li::before {
  content: counter(page);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sb-amber);
  border: 2px solid var(--sb-ink);
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 24px;
  text-align: center;
  color: var(--sb-ink);
}

.sb-transcript li.is-move {
  background: #eefbe5;
  border-color: var(--sb-ink);
}

.sb-transcript .sb-chip {
  margin-right: 6px;
}

/* ---------- Topic pages ---------- */

.sb-topic-list {
  display: grid;
  gap: 24px;
}

.sb-topic-item {
  display: grid;
  gap: 16px;
  align-items: center;
  padding: 14px;
}

@media (min-width: 720px) {
  .sb-topic-item {
    grid-template-columns: 300px 1fr;
    gap: 24px;
  }
}

.sb-topic-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 3px solid var(--sb-ink);
  border-radius: 14px;
}

.sb-topic-item h3 a {
  color: var(--sb-ink);
  text-decoration: none;
}

.sb-tips {
  display: grid;
  gap: 20px;
}

@media (min-width: 760px) {
  .sb-tips {
    grid-template-columns: repeat(3, 1fr);
  }
}

.sb-faq h3 {
  font-size: 1.15rem;
  margin: 18px 0 4px;
}

/* ---------- The world ---------- */

.sb-world {
  display: grid;
  gap: 22px;
  align-items: center;
}

@media (min-width: 820px) {
  .sb-world {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

.sb-world-art {
  margin: 0;
}

.sb-world-art img {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid var(--sb-ink);
  border-radius: 22px;
  box-shadow: var(--sb-shadow);
  transform: rotate(-0.8deg);
}

.sb-grownups {
  max-width: 48em;
}

@media (prefers-reduced-motion: reduce) {
  .sb-book,
  .sb-friend,
  .sb-btn {
    transition: none;
  }
}
