
* {
  box-sizing: border-box;
}

:root {
  --night: #0c1728;
  --gold: #e8cb91;
  --ivory: #fff8ec;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Montserrat", Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 75px;
}

body {
  margin: 0;
  background: var(--night);
  color: var(--ivory);
  font-family: var(--sans);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  color: inherit;
}

/* PROGRESS */

.progress-track {
  position: fixed;
  z-index: 1000;
  inset: 0 0 auto;
  height: 3px;
  background: #ffffff22;
}

#progressBar {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold);
}

/* NAVIGATION */

.topbar {
  position: fixed;
  z-index: 100;
  inset: 3px 0 auto;
  height: 70px;
  padding: 0 clamp(18px, 5vw, 75px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(#091321e8, transparent);
  transition: .3s;
}

.topbar.scrolled {
  height: 62px;
  background: #0c1728ed;
  backdrop-filter: blur(12px);
}

.brand {
  font: 600 1.3rem var(--serif);
  letter-spacing: .05em;
}

.main-nav {
  display: flex;
  gap: clamp(15px, 3vw, 40px);
}

.main-nav a,
.language-toggle,
.sound-toggle {
  font-size: .65rem;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.main-nav a {
  opacity: .82;
}

.main-nav a:hover {
  color: var(--gold);
}

.controls {
  display: flex;
  align-items: center;
  gap: 9px;
}

.language-toggle,
.sound-toggle {
  color: var(--ivory);
  border: 1px solid #ffffff55;
  background: #ffffff12;
  border-radius: 25px;
  padding: 10px 13px;
}

.sound-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
}

.sound-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 13px;
}

.sound-bars i {
  width: 2px;
  height: 5px;
  background: var(--gold);
}

.sound-toggle.playing .sound-bars i {
  animation: eq .7s infinite alternate;
}

.sound-bars i:nth-child(2) {
  animation-delay: .15s;
}

.sound-bars i:nth-child(3) {
  animation-delay: .3s;
}

.sound-bars i:nth-child(4) {
  animation-delay: .45s;
}

@keyframes eq {
  to {
    height: 13px;
  }
}

/* GENERAL TEXT */

.eyebrow {
  color: var(--gold);
  font-size: .65rem;
  letter-spacing: .23em;
  text-transform: uppercase;
  font-weight: 600;
  margin: 0 0 16px;
}

/* HERO */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  position: relative;
  display: flex;
  align-items: center;
  padding: 110px clamp(24px, 9vw, 130px);
  overflow: hidden;
  isolation: isolate;
}

.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: -2;
  filter: brightness(.68) saturate(.85);
  transform: scale(1.03);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, #081321e8 0%, #0b192d9c 45%, #0b192d30 100%),
    linear-gradient(0deg, #0c1728 0%, transparent 30%, #0c172855 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 650px;
}

.hero h1 {
  font: 500 clamp(5rem, 11vw, 10.5rem)/.85 var(--serif);
  letter-spacing: -.05em;
  margin: 0;
  background: linear-gradient(
    115deg,
    #fff 5%,
    #b9d5f0 25%,
    #fff 43%,
    #88a9ce 59%,
    #fff 74%,
    #c7dafa
  );
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px #e6f4ff9c;
  filter: drop-shadow(0 9px 16px #0009);
  animation: glassShine 7s ease-in-out infinite;
}

@keyframes glassShine {
  0%, 100% {
    background-position: 0% center;
  }
  50% {
    background-position: 100% center;
  }
}

.hero-subtitle {
  font: italic 1.5rem var(--serif);
  color: #f6ead5;
  margin: 24px 0;
}

.slipper-wrap {
  position: absolute;
  left: min(57vw, 650px);
  top: 50%;
  width: min(34vw, 390px);
  height: 260px;
  transform: translateY(-50%);
  pointer-events: none;
  animation: slipperFloat 5s ease-in-out infinite;
  opacity: .92;
}

.slipper-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 0 22px #b5d8ff88)
    drop-shadow(0 22px 35px #0009);
  mix-blend-mode: screen;
}

.slipper-glint {
  position: absolute;
  inset: 10% 25%;
  background: linear-gradient(
    110deg,
    transparent 35%,
    #ffffff99 49%,
    transparent 60%
  );
  filter: blur(9px);
  transform: skewX(-18deg);
  animation: glint 4.5s ease-in-out infinite;
}

@keyframes slipperFloat {
  0%, 100% {
    translate: 0 0;
    rotate: -5deg;
  }
  50% {
    translate: 0 -17px;
    rotate: 3deg;
  }
}

@keyframes glint {
  0%, 100% {
    opacity: 0;
    translate: -35% 0;
  }
  45% {
    opacity: .8;
  }
  70% {
    opacity: 0;
    translate: 35% 0;
  }
}

.begin-button {
  border: 1px solid var(--gold);
  background: #e8cb91;
  color: #17243a;
  padding: 15px 23px;
  text-transform: uppercase;
  font-size: .65rem;
  letter-spacing: .14em;
  transition: .3s;
}

.begin-button b {
  margin-left: 20px;
}

.begin-button:hover {
  background: transparent;
  color: white;
  transform: translateY(-3px);
}

.scroll-note {
  font-size: .62rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #ffffff9e;
  margin-top: 23px;
}

.hero-bottom-note {
  position: absolute;
  bottom: 27px;
  right: 5vw;
  color: #e8cb91a8;
  font: italic 1rem var(--serif);
}

/* THREE-CARD SECTION */

.cards-section {
  position: relative;
  min-height: 285vh;
  padding: 125px 5vw 110px;
  background: radial-gradient(
    ellipse at 50% 38%,
    #233b5a 0%,
    #14253d 43%,
    #0c1728 82%
  );
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.section-heading {
  text-align: center;
  max-width: 760px;
  width: min(760px, 100%);
  margin: 0 auto 34px;
  position: relative;
  z-index: 4;
  flex: none;
}

.section-heading h2 {
  font: 500 clamp(2.8rem, 5vw, 5.2rem)/.95 var(--serif);
  margin: 0 0 16px;
}

.section-heading > p:last-child {
  font: 1.2rem var(--serif);
  color: #e8e0d2b8;
  margin: 0;
}

/* CARD STAGE */

.card-stage {
  position: sticky;
  top: 14vh;
  width: 100%;
  height: 72vh;
  min-height: 480px;
  max-height: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1600px;
  transform-style: preserve-3d;
}

.story-card {
  position: absolute;
  top: 50%;
  left: 50%;

  width: 320px;
  height: 480px;

  margin: 0;
  transform-style: preserve-3d;
  transform-origin: center center;
  will-change: transform;

  filter: drop-shadow(0 25px 35px #0008);
}

/* CARD INNER */

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;

  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(.2, .7, .2, 1);
}

.story-card.flipped .card-inner {
  transform: rotateY(180deg);
}

/* ARCH SHAPE */

.card-face {
  position: absolute;
  inset: 0;

  overflow: hidden;

  /* Gentle cathedral arch */
  border-radius:
    48% 48% 14px 14px /
    13% 13% 14px 14px;

  border: 1px solid #e8cb91bb;

  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  background: linear-gradient(
    145deg,
    #263e5c,
    #101c30
  );

  box-shadow:
    0 25px 70px #0009,
    0 0 0 5px #d9bd8312,
    0 0 35px #a7cbf51a;
}

/* INNER GOLDEN BORDER */

.card-front::before,
.card-back::before {
  content: "";
  position: absolute;
  inset: 9px;

  border: 1px solid #e8cb9180;

  border-radius:
    48% 48% 9px 9px /
    13% 13% 9px 9px;

  pointer-events: none;
  z-index: 5;
}

/* FRONT IMAGE */

.card-front > img {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  filter: brightness(.78);

  transition: transform .8s ease;
}

.story-card:hover .card-front > img {
  transform: scale(1.045);
}

/* DARK GRADIENT OVER IMAGE */

.card-front::after {
  content: "";
  position: absolute;
  inset: 25% 0 0;

  background: linear-gradient(
    to bottom,
    transparent 0%,
    #07101e55 40%,
    #07101eef 100%
  );

  z-index: 1;
  pointer-events: none;
}

/* CARD NUMBER */

.card-index {
  position: absolute;
  z-index: 6;

  top: 30px;
  left: 28px;

  font: italic 1.2rem var(--serif);
  color: var(--gold);
}

/* FRONT TITLE */

.card-front-title {
  position: absolute;
  z-index: 6;

  bottom: 55px;
  left: 27px;
  right: 27px;
}

.card-front-title span {
  font-size: .6rem;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--gold);
}

.card-front-title h3 {
  font: 500 2.6rem/.98 var(--serif);
  margin: 10px 0;
  color: #fff8ec;
}

/* DISCOVER LABEL */

.card-hint {
  position: absolute;
  z-index: 6;

  bottom: 25px;
  left: 28px;

  font-size: .58rem;
  letter-spacing: .2em;
  text-transform: uppercase;

  color: #ffffffb0;
}


/* CARD BACK — CLEAN, NO SCROLLBAR */

.card-back {
  transform: rotateY(180deg);

  padding: 42px 28px 24px;

  display: flex;
  flex-direction: column;
  align-items: stretch;

  overflow: hidden;
}

/* Smaller headings so they fit */

.card-back h3 {
  font: 500 clamp(1.7rem, 2vw, 2rem)/1.05 var(--serif);

  margin: 0 0 13px;
  color: #fff8ec;
}

/* More compact story text */

.card-back p {
  font: 1rem/1.42 var(--serif);

  color: #fff4e4e0;

  margin: 0 0 12px;
}

/* Supporting image */

.card-detail {
  display: block;

  width: 100%;
  height: 112px;

  flex-shrink: 0;

  object-fit: cover;

  border: 1px solid #e8cb9188;
  border-radius: 6px;

  margin-top: auto;
}

/* Closing sentence */

.card-endnote {
  display: block;

  font: italic .92rem var(--serif);
  color: var(--gold);

  margin-top: 10px;
  padding-bottom: 2px;
}



.card-back::-webkit-scrollbar {
  display: none;
}

.card-back {
  scrollbar-width: none;
  -ms-overflow-style: none;
}


/* ==============================
   SCROLL PROGRESS
================================ */

.card-progress {
  position: sticky;
  top: calc(100vh - 30px);

  margin: 0 auto;

  width: min(260px, 50vw);
  height: 2px;

  background: #ffffff35;
  z-index: 8;
}

.card-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold);
  transition: width .1s linear;
}

.scroll-instruction {
  position: sticky;
  top: calc(100vh - 60px);

  text-align: center;

  text-transform: uppercase;
  font-size: .55rem;
  letter-spacing: .18em;

  color: #e8cb9188;

  margin: 0;
  z-index: 8;
}



/* LOWER SECTIONS */

.feature-section {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(35px, 7vw, 100px);
  align-items: center;
  padding: 130px clamp(25px, 9vw, 130px);
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #101d31, #172b45);
}

.feature-section:before {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: #8cb5e50b;
  filter: blur(25px);
  top: 10%;
  left: 20%;
}

.feature-image-wrap {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-image {
  position: relative;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  filter: drop-shadow(0 25px 45px #0009);
  transform: translateY(35px) scale(.96);
  opacity: 0;
  transition: 1s;
}

.feature-section.visible .feature-image {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.image-glow {
  position: absolute;
  width: 65%;
  height: 55%;
  border-radius: 50%;
  background: #a8cfff20;
  filter: blur(65px);
  z-index: 0;
}

.feature-copy {
  max-width: 510px;
  position: relative;
  z-index: 2;
  opacity: 0;
  transform: translateY(28px);
  transition: 1s .15s;
}

.feature-section.visible .feature-copy {
  opacity: 1;
  transform: translateY(0);
}

.feature-copy h2 {
  font: 500 clamp(3.2rem, 5.3vw, 5.6rem)/.92 var(--serif);
  margin: 0 0 22px;
}

.feature-copy > p:not(.eyebrow) {
  font: 1.35rem/1.55 var(--serif);
  color: #fff4e4d9;
}

.ornament-line {
  width: 105px;
  height: 1px;
  background: var(--gold);
  margin-top: 30px;
  box-shadow: 0 0 12px var(--gold);
}

.ending-section {
  background: radial-gradient(
    ellipse at 70% 50%,
    #314b6a,
    #152740 60%,
    #0c1728
  );
}

.replay-link {
  display: inline-block;
  margin-top: 20px;
  color: var(--gold);
  font-size: .65rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--gold);
  padding-bottom: 8px;
}

/* FOOTER */

.footer {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #080f1b;
  text-align: center;
}

.footer-brand {
  font: 500 2.5rem var(--serif);
  color: var(--gold);
  margin: 0;
}

.footer p:not(.footer-brand) {
  font: italic 1.2rem var(--serif);
  color: #fff4e4c9;
  margin: 0;
}

.footer a {
  font-size: .62rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 8px;
}

.footer small {
  color: #ffffff55;
  font-size: .55rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}

/* FAIRY DUST */

.dust-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
}

.dust {
  position: absolute;
  bottom: -12px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffe7a8;
  box-shadow:
    0 0 8px 2px #f8d98a99,
    0 0 17px 4px #f8d98a44;
  opacity: 0;
  animation: floatDust linear infinite;
}

.dust.big {
  width: 5px;
  height: 5px;
  box-shadow:
    0 0 11px 3px #ffe5a5bb,
    0 0 25px 8px #f8d98a55;
}

@keyframes floatDust {
  0% {
    transform: translate3d(0, 0, 0) scale(.5);
    opacity: 0;
  }
  12% {
    opacity: .8;
  }
  75% {
    opacity: .55;
  }
  100% {
    transform: translate3d(var(--drift), -110vh, 0) scale(1.25);
    opacity: 0;
  }
}

/* ARABIC */

body[dir="rtl"] {
  font-family: "Amiri", serif;
}

body[dir="rtl"] .topbar,
body[dir="rtl"] nav,
body[dir="rtl"] .controls {
  direction: rtl;
}

body[dir="rtl"] .hero-content,
body[dir="rtl"] .feature-copy {
  text-align: right;
}

body[dir="rtl"] h1,
body[dir="rtl"] .feature-copy h2 {
  font-family: "Amiri", serif;
  line-height: 1.15;
}

body[dir="rtl"] .main-nav a,
body[dir="rtl"] .eyebrow,
body[dir="rtl"] button {
  letter-spacing: 0;
}

body[dir="rtl"] .card-back {
  text-align: right;
}

body[dir="rtl"] .card-index {
  left: auto;
  right: 24px;
}

body[dir="rtl"] .card-hint {
  left: auto;
  right: 26px;
}



/* =====================================
   FAIRY GODMOTHER — IMMERSIVE CHARACTER
===================================== */

.card-stage {
  position: sticky;
  isolation: isolate;
}

.fairy-character {
  position: absolute;
  z-index: 30;

  right: 2%;
  bottom: -2%;

  width: clamp(200px, 25vw, 350px);
  height: 90%;

  display: flex;
  align-items: flex-end;
  justify-content: center;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translateX(35px) scale(.94);
  transition:
    opacity 1s ease,
    transform 1s ease,
    visibility 1s;
}

.fairy-character.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
}


.fairy-person {
  position: relative;
  z-index: 2;

  width: 100%;
  height: 100%;

  object-fit: contain;
  object-position: bottom;

  filter:
    drop-shadow(0 0 12px #c9dcff55)
    drop-shadow(0 15px 25px #0008);

  transform-origin: 50% 90%;
  animation: fairyFloat 4s ease-in-out infinite;
}

@keyframes fairyFloat {
  0%, 100% {
    transform: translateY(0) rotate(0);
  }

  50% {
    transform: translateY(-9px) rotate(-1deg);
  }
}

/* Magical glow around wand area */

.fairy-glow {
  position: absolute;
  z-index: 1;

  top: 5%;
  right: 5%;

  width: 55px;
  height: 55px;

  border-radius: 50%;

  background: #ffe8a8;
  filter: blur(22px);

  opacity: .65;
  animation: wandGlow 2s ease-in-out infinite;
}

@keyframes wandGlow {
  0%, 100% {
    opacity: .35;
    transform: scale(.8);
  }

  50% {
    opacity: .95;
    transform: scale(1.35);
  }
}





/* TABLET */

@media (max-width: 850px) {
  .main-nav {
    display: none;
  }

  .topbar {
    padding: 0 15px;
  }

  .brand {
    font-size: 1.1rem;
  }

  .hero {
    padding: 100px 25px;
  }

  .hero h1 {
    font-size: clamp(5rem, 17vw, 8rem);
  }

  .slipper-wrap {
    left: 48%;
    top: 57%;
    width: 50vw;
    opacity: .65;
  }

  .cards-section {
    min-height: 260vh;
    padding: 105px 15px 90px;
  }

  .section-heading {
    padding: 0 12px;
    margin-bottom: 20px;
  }

  .card-stage {
    top: 13vh;
    height: 72vh;
    min-height: 420px;
  }

  .story-card {
    width: min(29vw, 290px);
    height: min(54vh, 440px);
    min-height: 320px;
  }

  .feature-section {
    grid-template-columns: 1fr;
    gap: 25px;
    padding: 100px 25px;
    align-content: center;
  }

  .feature-image {
    max-height: 42vh;
  }

  .feature-copy {
    max-width: 650px;
  }

  .ending-section .feature-copy {
    order: 2;
  }

  .ending-section .feature-image-wrap {
    order: 1;
  }

  .feature-copy h2 {
    font-size: clamp(3.2rem, 12vw, 5rem);
  }
}

/* MOBILE */

@media (max-width: 600px) {
  .cards-section {
    min-height: 245vh;
    padding: 100px 12px 80px;
  }

  .section-heading h2 {
    font-size: 2.7rem;
  }

  .section-heading > p:last-child {
    font-size: 1rem;
  }

  .card-stage {
    top: 17vh;
    height: 65vh;
    min-height: 390px;
  }

  .story-card {
    width: 68vw;
    height: 52vh;
    min-height: 320px;
  }

  .card-back {
    padding: 29px 22px;
  }

  .card-back h3 {
    font-size: 2rem;
  }

  .card-back p {
    font-size: .98rem;
  }

  .card-detail {
    height: 105px;
  }

  .sound-toggle {
    padding: 9px;
  }

  .sound-toggle #soundLabel {
    display: none;
  }

  .language-toggle {
    padding: 9px 11px;
  }

  .hero-subtitle {
    max-width: 270px;
  }

  .slipper-wrap {
    top: 55%;
    left: 42%;
    width: 65vw;
  }
}
@media (max-width: 900px) {
  .fairy-character {
    width: 170px;
    left: auto;
    right: 0;
    bottom: 0;
  }
}

@media (max-width: 600px) {
  .fairy-character {
    width: 125px;
    height: 48%;
    right: 0;
    bottom: 0;
  }
}




@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
