/* MoonTales website. Colours come from the app (DiscoverHomeStyle / AppSky). */
:root {
  --n1: #141239;
  --n2: #1a2161;
  --n3: #2b1c57;
  --gold: #ffd673;
  --play-a: #ff9e52;
  --play-b: #f06b5c;
  --amber: #f57a3d;
  --rose: #d93d6b;
  --magenta: #992e9e;
  --text: #f7f4ff;
  --soft: rgba(247, 244, 255, 0.8);
  --muted: rgba(247, 244, 255, 0.6);
  --line: rgba(255, 255, 255, 0.12);
  --serif: "Fraunces", ui-serif, Georgia, serif;
  --sans: "Nunito", ui-rounded, -apple-system, system-ui, "Segoe UI", sans-serif;
  --wrap: 1160px;
  --night: 0; /* 0 at dusk (top of the page) -> 1 at night; set by site.js on scroll */
  color-scheme: dark;
}

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

html {
  background: var(--n1);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

.wrap {
  width: min(var(--wrap), calc(100% - 40px));
  margin: 0 auto;
}

h1,
h2,
h3 {
  text-wrap: balance;
  font-family: var(--serif);
  font-variation-settings: "SOFT" 100;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

h1 em,
h2 em {
  font-style: italic;
  color: var(--gold);
  font-weight: 500;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---------- the sky: dusk at the top, night further down ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.sky > div {
  position: absolute;
  inset: 0;
}

.sky-dusk {
  background:
    radial-gradient(90% 55% at 72% 100%, rgba(245, 122, 61, 0.55), rgba(217, 61, 107, 0.32) 38%, rgba(153, 46, 158, 0.16) 62%, transparent 82%),
    linear-gradient(180deg, #120f36 0%, #1f1856 40%, #3b216d 72%, #6a2a6e 100%);
}

.sky-night {
  opacity: var(--night);
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(80, 70, 190, 0.22), transparent 70%),
    linear-gradient(160deg, var(--n1) 0%, var(--n2) 55%, var(--n3) 100%);
}

.stars.far {
  background: url("img/stars-far.svg") 0 0 / 900px 900px repeat;
  opacity: calc(0.35 + 0.55 * var(--night));
}

.stars.near {
  background: url("img/stars-near.svg") 0 0 / 1300px 1100px repeat;
  opacity: calc(0.25 + 0.75 * var(--night));
  animation: twinkle 7s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from {
    filter: brightness(0.75);
  }
  to {
    filter: brightness(1.15);
  }
}

/* ---------- header ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.top.scrolled {
  background: rgba(16, 13, 48, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 1px 0 var(--line);
}

.top-in {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-family: var(--serif);
  font-variation-settings: "SOFT" 100;
  font-weight: 600;
  font-size: 23px;
  letter-spacing: -0.01em;
}

.brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 18px -6px rgba(0, 0, 0, 0.6);
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav a {
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  color: var(--soft);
  padding: 8px 12px;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}

.nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.get {
  text-decoration: none;
  font-weight: 800;
  font-size: 15px;
  color: #2a1206;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--play-a), var(--play-b));
  box-shadow: 0 8px 22px -8px rgba(240, 107, 92, 0.8);
  white-space: nowrap;
  transition: transform 0.2s ease;
}

.get:hover {
  transform: translateY(-1px);
}

/* ---------- store badges ---------- */

.stores {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 14px;
  margin-top: 36px;
}

.stores.center {
  justify-content: center;
}

.store {
  position: relative;
  display: inline-block;
  line-height: 0;
  border-radius: 10px;
  transition: transform 0.2s ease;
}

.store img {
  height: 52px;
  width: auto;
}

a.store:hover {
  transform: translateY(-2px);
}

.store.soon img {
  filter: saturate(0.85);
  opacity: 0.88;
}

.store.soon b {
  position: absolute;
  top: -15px;
  right: -6px;
  line-height: 1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3a2300;
  background: var(--gold);
  padding: 5px 8px 4px;
  border-radius: 999px;
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.6);
}

.fine {
  margin: 18px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

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

.hero {
  position: relative;
  overflow-x: hidden;
  overflow-x: clip;
  min-height: min(calc(100vh - 72px), 860px);
  display: flex;
  align-items: center;
  padding: 24px 0 56px;
}

.hero-in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: center;
  gap: 40px;
}

.hero h1 {
  font-size: clamp(46px, 6.4vw, 88px);
  line-height: 0.98;
}

.hero h1 em {
  display: block;
}

.lede {
  margin: 24px 0 0;
  max-width: 30em;
  font-size: clamp(18px, 1.6vw, 21px);
  color: var(--soft);
}

.fan {
  --w: clamp(160px, 16.5vw, 244px);
  position: relative;
  height: calc(var(--w) * 1.9);
}

.fan::before {
  /* warm lamp-light behind the books */
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(150%, 100vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 190, 110, 0.3), rgba(245, 122, 61, 0.1) 42%, transparent 66%);
  pointer-events: none;
}

.cover {
  --abs: max(var(--i), calc(var(--i) * -1));
  --x: calc(var(--i) * 80%);
  --a: calc(var(--i) * 6deg);
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--w);
  aspect-ratio: 1 / 1.6;
  margin: calc(var(--w) * -0.8) 0 0 calc(var(--w) / -2);
  border-radius: 20px;
  overflow: hidden;
  background: #2a2350;
  transform: translate(var(--x), var(--dy)) rotate(var(--a)) scale(calc(1.04 - var(--abs) * 0.17));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 30px 60px -20px rgba(6, 3, 26, 0.9);
  animation: deal 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(0.1s + var(--abs) * 0.18s);
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 38%;
}

.fan:hover .cover {
  --x: calc(var(--i) * 86%);
  --a: calc(var(--i) * 8deg);
}

@keyframes deal {
  from {
    opacity: 0;
    transform: translate(0, 6%) rotate(0deg) scale(0.9);
  }
}

/* ---------- section heads ---------- */

section {
  position: relative;
}

.head {
  max-width: 640px;
}

.head.center {
  margin: 0 auto;
  text-align: center;
}

.head h2 {
  font-size: clamp(34px, 4.4vw, 56px);
  line-height: 1.05;
}

.head p:not(.eyebrow) {
  margin: 18px 0 0;
  font-size: 18px;
  color: var(--soft);
}

/* ---------- reading: iPad + iPhone ---------- */

.read {
  padding: 96px 0 120px;
}

.devices {
  position: relative;
  max-width: 980px;
  margin: 56px auto 0;
  padding-right: 11%;
}

.ipad {
  border-radius: clamp(16px, 2.6vw, 32px);
  padding: clamp(6px, 1vw, 13px);
  background: linear-gradient(160deg, #2c2a45, #0d0c1c);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 60px 110px -40px rgba(0, 0, 0, 0.85),
    0 0 120px -40px rgba(255, 214, 115, 0.25);
}

.ipad img {
  width: 100%;
  aspect-ratio: 2420 / 1668;
  object-fit: cover;
  border-radius: clamp(10px, 1.7vw, 21px);
}

.phone {
  position: absolute;
  right: 0;
  bottom: -9%;
  width: 21%;
  border-radius: clamp(22px, 4vw, 44px);
  padding: clamp(4px, 0.7vw, 8px);
  background: linear-gradient(160deg, #2c2a45, #0d0c1c);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 40px 70px -24px rgba(0, 0, 0, 0.9);
}

.phone img {
  width: 100%;
  aspect-ratio: 1206 / 2622;
  object-fit: cover;
  border-radius: clamp(18px, 3.4vw, 37px);
}

/* ---------- classics shelf ---------- */

.classics {
  padding: 40px 0 110px;
}

.shelf {
  margin-top: 44px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  outline: none;
}

.shelf-track {
  list-style: none;
  margin: 0;
  padding: 10px 0 24px;
  display: flex;
  gap: 18px;
  width: max-content;
  animation: drift 80s linear infinite;
}

.shelf:hover .shelf-track,
.shelf:focus .shelf-track {
  animation-play-state: paused;
}

@keyframes drift {
  to {
    transform: translateX(calc(-50% - 9px));
  }
}

.book {
  position: relative;
  flex: none;
  width: clamp(156px, 15vw, 204px);
  aspect-ratio: 0.64;
  border-radius: 16px;
  overflow: hidden;
  background: #2a2350;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 22px 40px -20px rgba(0, 0, 0, 0.8);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.book:hover {
  transform: translateY(-6px);
}

.book img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 38%;
}

.book span {
  position: absolute;
  inset: auto 0 0;
  padding: 44px 14px 13px;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.22;
  background: linear-gradient(180deg, transparent, rgba(14, 10, 40, 0.72) 45%, rgba(14, 10, 40, 0.92));
}

/* the shelf links to the book pages (/stories/<slug>); free books carry a small tag */

.free {
  display: inline-block;
  line-height: 1;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3a2300;
  background: var(--gold);
  padding: 5px 8px 4px;
  border-radius: 999px;
}

.book a {
  display: block;
  height: 100%;
  text-decoration: none;
}

.book .free {
  position: absolute;
  top: 10px;
  left: 10px;
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.6);
}

/* "Read it or watch it": every book is also a cartoon (landing shelf, /stories) */
.also {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 12px;
  border-radius: 18px;
  background: rgba(255, 214, 115, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 214, 115, 0.3);
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.also svg {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.9;
  stroke-linejoin: round;
}

.head p.also,
.ix-head p.also {
  margin-top: 20px;
  font-size: 15px;
  color: var(--text);
}

.head .shelf-all {
  margin-top: 14px;
}

.shelf-all a,
.more-all a {
  font-weight: 800;
  color: var(--gold);
  text-decoration: none;
}

.shelf-all a::after,
.more-all a::after {
  content: " \2192";
}

.shelf-all a:hover,
.more-all a:hover {
  text-decoration: underline;
}

/* ---------- starring: the sunset card ---------- */

.starring {
  padding: 40px 0 110px;
}

.sunset {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  padding: clamp(28px, 5vw, 64px);
  border-radius: 34px;
  background:
    radial-gradient(80% 90% at 0% 0%, rgba(255, 190, 110, 0.35), transparent 60%),
    linear-gradient(135deg, var(--amber) 0%, var(--rose) 50%, var(--magenta) 100%);
  box-shadow: 0 50px 100px -40px rgba(153, 46, 158, 0.75), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.sunset .eyebrow {
  color: #fff3d1;
}

.sunset h2 {
  font-size: clamp(34px, 4.2vw, 54px);
  line-height: 1.04;
}

.sunset-copy p:not(.eyebrow) {
  margin: 18px 0 0;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.92);
}

.sunset-copy .gift {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 26px !important;
  padding: 10px 16px 10px 12px;
  border-radius: 18px;
  background: rgba(40, 8, 40, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  font-size: 15px !important;
  font-weight: 800;
}

.gift svg {
  width: 22px;
  height: 22px;
  flex: none;
  fill: var(--gold);
}

.ideas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.idea {
  position: relative;
  margin: 0;
  aspect-ratio: 3 / 2;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.2),
    0 18px 30px -16px rgba(50, 0, 40, 0.8);
}

.idea.big {
  grid-column: span 2;
  grid-row: span 2;
  aspect-ratio: auto;
}

.idea img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.idea figcaption {
  position: absolute;
  inset: auto 0 0;
  padding: 26px 12px 9px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
  background: linear-gradient(180deg, transparent, rgba(12, 8, 38, 0.8));
}

.idea.big figcaption {
  padding: 40px 18px 15px;
  font-size: 20px;
}

/* ---------- parents ---------- */

.parents {
  padding: 40px 0 110px;
}

.parents-in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}

.promises {
  list-style: none;
  margin: 0;
  padding: 0;
}

.promises li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.promises li:first-child {
  border-top: 0;
  padding-top: 4px;
}

.ico {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, rgba(255, 214, 115, 0.28), rgba(255, 214, 115, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 214, 115, 0.35);
}

.ico svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.promises h3 {
  font-size: 22px;
  line-height: 1.2;
  margin-top: 2px;
}

.promises p {
  margin: 6px 0 0;
  font-size: 16.5px;
  color: var(--soft);
}

/* ---------- finale: the moon ---------- */

.finale {
  padding: 30px 0 120px;
  text-align: center;
}

.finale-in {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.moon {
  width: clamp(150px, 17vw, 200px);
  aspect-ratio: 1;
  border-radius: 50%;
  margin-bottom: 44px;
  background:
    radial-gradient(circle at 66% 58%, rgba(205, 150, 62, 0.34), transparent 13%),
    radial-gradient(circle at 38% 68%, rgba(205, 150, 62, 0.24), transparent 10%),
    radial-gradient(circle at 47% 33%, rgba(205, 150, 62, 0.2), transparent 8%),
    radial-gradient(circle at 74% 34%, rgba(205, 150, 62, 0.16), transparent 7%),
    radial-gradient(circle at 34% 30%, #fffbec 0%, #ffeab0 34%, #f9d47c 66%, #e7b35a 100%);
  box-shadow:
    inset -14px -16px 34px rgba(190, 120, 40, 0.35),
    inset 8px 8px 24px rgba(255, 255, 240, 0.5),
    0 0 60px 12px rgba(255, 214, 115, 0.38),
    0 0 200px 70px rgba(255, 214, 115, 0.14);
  transition: transform 1.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 1.6s ease;
}

.finale .pre .moon {
  transform: translateY(60px);
  opacity: 0;
}

.finale h2 {
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.05;
}

.finale p {
  margin: 16px 0 0;
  font-size: 19px;
  color: var(--soft);
}

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

.foot {
  border-top: 1px solid var(--line);
  background: rgba(10, 8, 30, 0.55);
  padding: 26px 0 30px;
  font-size: 14px;
  color: var(--muted);
}

.foot-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
}

.foot-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--serif);
  font-variation-settings: "SOFT" 100;
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
}

.foot-brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.foot-links a {
  text-decoration: none;
  font-weight: 700;
  color: var(--soft);
}

.foot-links a:hover {
  color: var(--text);
}

.copy {
  margin: 0 0 0 auto;
}

/* ---------- reveal on scroll (only for things that start below the fold) ---------- */

.reveal {
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal.pre {
  opacity: 0;
  transform: translateY(28px);
}

/* ---------- smaller screens ---------- */

@media (max-width: 980px) {
  .nav {
    display: none;
  }

  .get {
    margin-left: auto;
  }

  .hero {
    min-height: 0;
    padding: 8px 0 64px;
  }

  .hero-in {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .fan {
    order: -1;
    --w: clamp(140px, 30vw, 230px);
  }

  .hero-copy {
    text-align: center;
  }

  .lede {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-copy .stores {
    justify-content: center;
  }

  .sunset,
  .parents-in {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .wrap {
    width: calc(100% - 32px);
  }

  .top-in {
    height: 64px;
  }

  .brand {
    font-size: 21px;
  }

  .brand img {
    width: 34px;
    height: 34px;
  }

  .get {
    font-size: 14px;
    padding: 9px 15px;
  }

  .fan {
    --w: 38vw;
  }

  .cover {
    --x: calc(var(--i) * 74%);
    border-radius: 15px;
  }

  .store img {
    height: 46px;
  }

  .read {
    padding: 64px 0 96px;
  }

  .devices {
    margin-top: 36px;
    padding-right: 13%;
  }

  .phone {
    width: 31%;
    bottom: -16%;
  }

  .classics,
  .starring,
  .parents {
    padding-bottom: 80px;
  }

  .book {
    width: 42vw;
    border-radius: 14px;
  }

  .sunset {
    border-radius: 26px;
    padding: 26px 18px 18px;
  }

  .ideas {
    gap: 8px;
  }

  .idea {
    border-radius: 12px;
  }

  .idea figcaption {
    font-size: 11.5px;
    padding: 18px 7px 6px;
  }

  .idea.big figcaption {
    font-size: 16px;
    padding: 28px 12px 10px;
  }

  .promises li {
    gap: 16px;
    padding: 20px 0;
  }

  .foot-in {
    flex-direction: column;
    align-items: flex-start;
  }

  .copy {
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cover,
  .stars.near {
    animation: none;
  }

  .shelf {
    overflow-x: auto;
  }

  .shelf-track {
    animation: none;
    padding-left: 20px;
    padding-right: 20px;
  }

  .shelf-track [aria-hidden="true"] {
    display: none;
  }

  .reveal,
  .moon {
    transition: none;
  }

  .reveal.pre {
    opacity: 1;
    transform: none;
  }

  .finale .pre .moon {
    transform: none;
    opacity: 1;
  }
}
