/* ==========================================================================
   Wonderliand — Celestial Night (Prelude v0.1)
   Design source: design/wonderliand.pen
   ========================================================================== */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("../assets/fonts/cormorant-garamond-var.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("../assets/fonts/instrument-serif-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("../assets/fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("../assets/fonts/instrument-sans-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("../assets/fonts/geist-mono-var.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Night Palette (from 04 — Celestial identity & interaction) */
  --color-midnight: #061B2C;
  --color-celestial: #123B57;
  --color-starlight: #FFF5DC;
  --color-amber: #E5BC74;
  --color-moonlight: #C9D8DD;

  /* Supporting ink tokens */
  --color-prelude-index: #D5E8E4;
  --color-copy-mobile: #DAE5E4;
  --color-signature: #E8E3D3;
  --color-status: #D6D7C8;
  --color-compact-footer: #E9E1CE;

  /* CTA tokens */
  --cta-bg: #F5EAD1;
  --cta-bg-hover: #FFF5DC;
  --cta-border: #FFF8E5;
  --cta-ink: #112C38;
  --cta-medallion: #D5A45F;
  --cta-medallion-hover: #E5BC74;
  --cta-arrow: #122A36;

  /* Typography */
  --font-wordmark: "Cormorant Garamond", Georgia, serif;
  --font-display: "Instrument Serif", Georgia, serif;
  --font-sans: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, monospace;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --cta-duration: 180ms;
  --entrance-duration: 450ms;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--color-midnight);
  color: var(--color-starlight);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ==========================================================================
   Scene & Backdrop
   ========================================================================== */

.scene {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  width: 100%;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  overflow: hidden;
}

.scene__backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--color-midnight);
}

.scene__picture,
.scene__image {
  display: block;
  width: 100%;
  height: 100%;
}

.scene__image {
  object-fit: cover;
  object-position: center center;
  user-select: none;
}

/* Subtle reading veil on desktop/laptop to ensure text legibility without
   altering the moon, clouds, or seated figure. */
.scene__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      rgba(6, 27, 44, 0.42) 0%,
      rgba(6, 27, 44, 0.22) 38%,
      rgba(6, 27, 44, 0) 64%
    ),
    linear-gradient(
      180deg,
      rgba(6, 27, 44, 0.16) 0%,
      rgba(6, 27, 44, 0) 22%,
      rgba(6, 27, 44, 0) 80%,
      rgba(6, 27, 44, 0.34) 100%
    );
}

/* ==========================================================================
   Optional Sparse Starlight (<=10% luminance shift)
   ========================================================================== */

.scene__stars {
  position: absolute;
  inset: 0 0 42% 0;
  pointer-events: none;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background-color: var(--color-starlight);
  opacity: 0.92;
  will-change: opacity;
  animation: star-twinkle 7s ease-in-out infinite;
}

.star--1  { left: 17%; top: 26%; animation-duration: 6.4s; animation-delay: -1.1s; }
.star--2  { left: 25%; top: 29%; animation-duration: 7.8s; animation-delay: -3.4s; }
.star--3  { left: 29%; top: 28%; animation-duration: 6.9s; animation-delay: -2.0s; }
.star--4  { left: 39%; top: 39%; animation-duration: 8.2s; animation-delay: -4.6s; }
.star--5  { left: 44%; top: 19%; animation-duration: 7.1s; animation-delay: -0.7s; }
.star--6  { left: 53%; top: 19%; animation-duration: 8.6s; animation-delay: -5.2s; }
.star--7  { left: 59%; top: 26%; animation-duration: 6.7s; animation-delay: -2.8s; }
.star--8  { left: 67%; top: 35%; animation-duration: 7.5s; animation-delay: -1.9s; }
.star--9  { left: 85%; top: 9%;  animation-duration: 8.0s; animation-delay: -3.9s; }
.star--10 { left: 95%; top: 6%;  animation-duration: 7.3s; animation-delay: -0.4s; }

@keyframes star-twinkle {
  0%, 100% {
    opacity: 0.96;
  }
  50% {
    opacity: 0.86;
  }
}

/* ==========================================================================
   Foreground Layout — Desktop Default (1440x900 reference)
   ========================================================================== */

.scene__content {
  position: relative;
  flex: 1 0 auto;
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding:
    max(42px, env(safe-area-inset-top))
    max(88px, env(safe-area-inset-right))
    max(44px, env(safe-area-inset-bottom))
    max(88px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.wordmark {
  margin: 0;
  font-family: var(--font-wordmark);
  font-size: clamp(35px, 2.98vw, 43px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -1.3px;
  color: var(--color-starlight);
}

.prelude-index {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 2.2px;
  color: var(--color-prelude-index);
  text-align: right;
  white-space: nowrap;
}

/* Hero block */
.hero {
  margin-top: clamp(44px, 7vh, 72px);
  margin-bottom: auto;
  max-width: 560px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  margin-bottom: clamp(22px, 3.6vh, 36px);
}

.eyebrow__rule {
  display: block;
  width: 31px;
  height: 1px;
  background-color: var(--color-amber);
  flex-shrink: 0;
}

.eyebrow__text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 2.1px;
  color: var(--color-amber);
}

.hero__headline {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--color-starlight);
  line-height: 1;
}

.hero__headline-line {
  display: block;
  font-size: clamp(58px, 5.76vw, 83px);
  letter-spacing: -1.9px;
}

.hero__headline-line--italic {
  font-size: clamp(60px, 5.9vw, 85px);
  font-style: italic;
  letter-spacing: -2px;
  margin-top: 2px;
}

.hero__copy {
  margin: clamp(24px, 4vh, 38px) 0 0;
  max-width: 490px;
  font-family: var(--font-sans);
  font-size: clamp(16px, 1.25vw, 18px);
  font-weight: 400;
  line-height: 1.48;
  color: var(--color-moonlight);
}

/* Primary CTA */
.hero__actions {
  margin-top: clamp(32px, 5vh, 52px);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 26px;
  padding: 7px 7px 7px 25px;
  border-radius: 35px;
  background-color: var(--cta-bg);
  border: 1px solid var(--cta-border);
  color: var(--cta-ink);
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--cta-duration) ease-out,
    transform var(--cta-duration) ease-out,
    box-shadow var(--cta-duration) ease-out;
}

.cta__label {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.cta__medallion {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background-color: var(--cta-medallion);
  color: var(--cta-arrow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color var(--cta-duration) ease-out;
}

.cta__icon {
  width: 20px;
  height: 20px;
  transition: transform var(--cta-duration) ease-out;
}

@media (hover: hover) {
  .cta:hover {
    background-color: var(--cta-bg-hover);
  }

  .cta:hover .cta__medallion {
    background-color: var(--cta-medallion-hover);
  }

  .cta:hover .cta__icon {
    transform: translate(1.5px, -1.5px);
  }
}

.cta:active {
  transform: scale(0.985);
}

.cta:focus-visible {
  outline: 2px solid var(--color-amber);
  outline-offset: 3px;
}

.cta-status {
  margin: 12px 0 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.6px;
  color: var(--color-starlight);
  opacity: 0.9;
}

/* Footer */
.site-footer {
  margin-top: 40px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.footer__signature {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-signature);
}

.footer__status {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 1.5px;
  color: var(--color-status);
  text-align: right;
}

.footer__compact {
  display: none;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-compact-footer);
}

/* ==========================================================================
   Entrance Motion (450ms fade, restrained)
   ========================================================================== */

.hero,
.site-header,
.site-footer {
  animation: prelude-fade var(--entrance-duration) var(--ease-out) both;
}

.hero {
  animation-delay: 60ms;
}

.site-footer {
  animation-delay: 120ms;
}

@keyframes prelude-fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Laptop / Compact Desktop (901px - 1200px)
   ========================================================================== */

@media (max-width: 1200px) and (min-width: 901px) {
  .scene__content {
    padding:
      max(36px, env(safe-area-inset-top))
      max(56px, env(safe-area-inset-right))
      max(36px, env(safe-area-inset-bottom))
      max(56px, env(safe-area-inset-left));
  }
}

/* ==========================================================================
   Tablet Frame (601px - 900px, 768x1024 reference)
   ========================================================================== */

@media (max-width: 900px) {
  .scene__veil {
    background: linear-gradient(
      180deg,
      rgba(6, 27, 44, 0.14) 0%,
      rgba(6, 27, 44, 0) 28%,
      rgba(6, 27, 44, 0) 84%,
      rgba(6, 27, 44, 0.25) 100%
    );
  }

  .scene__image {
    object-position: center bottom;
  }

  .scene__content {
    padding:
      max(34px, env(safe-area-inset-top))
      max(48px, env(safe-area-inset-right))
      max(34px, env(safe-area-inset-bottom))
      max(48px, env(safe-area-inset-left));
  }

  .wordmark {
    font-size: 39px;
    letter-spacing: -1.1px;
  }

  .prelude-index {
    display: none;
  }

  .hero {
    margin-top: 48px;
    max-width: 570px;
  }

  .eyebrow {
    gap: 14px;
    margin-bottom: 30px;
  }

  .eyebrow__rule {
    width: 30px;
  }

  .eyebrow__text {
    font-size: 10.5px;
    letter-spacing: 1.7px;
  }

  .hero__headline-line,
  .hero__headline-line--italic {
    font-size: 72px;
    letter-spacing: -1.4px;
  }

  .hero__headline-line--italic {
    margin-top: 0;
  }

  .hero__copy {
    margin-top: 26px;
    max-width: 570px;
    font-size: 17px;
    line-height: 1.5;
    color: var(--color-copy-mobile);
  }

  .hero__actions {
    margin-top: 40px;
  }

  .cta {
    gap: 22px;
    padding: 6px 6px 6px 24px;
    border-radius: 34px;
  }

  .cta__label {
    font-size: 15.5px;
  }

  .cta__medallion {
    width: 44px;
    height: 44px;
  }

  .cta__icon {
    width: 19px;
    height: 19px;
  }

  .footer__signature,
  .footer__status {
    display: none;
  }

  .footer__compact {
    display: block;
    font-size: 13px;
  }
}

/* ==========================================================================
   Mobile Frame (<= 600px, 390x844 reference)
   ========================================================================== */

@media (max-width: 600px) {
  .scene__content {
    padding:
      max(28px, env(safe-area-inset-top))
      max(24px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(24px, env(safe-area-inset-left));
  }

  .wordmark {
    font-size: 35px;
    letter-spacing: -1px;
  }

  .hero {
    margin-top: 32px;
    max-width: 340px;
  }

  .eyebrow {
    gap: 11px;
    margin-bottom: 24px;
  }

  .eyebrow__rule {
    width: 26px;
  }

  .eyebrow__text {
    font-size: 9.5px;
    letter-spacing: 1.25px;
  }

  .hero__headline-line {
    font-size: clamp(44px, 13.3vw, 52px);
    letter-spacing: -1.1px;
  }

  .hero__headline-line--italic {
    font-size: clamp(43px, 13.1vw, 51px);
    letter-spacing: -1.1px;
    margin-top: 4px;
  }

  .hero__copy {
    margin-top: 22px;
    max-width: 340px;
    font-size: 15.5px;
    line-height: 1.52;
  }

  .hero__actions {
    margin-top: 28px;
  }

  .cta {
    gap: 14px;
    padding: 5px 5px 5px 21px;
    border-radius: 30px;
  }

  .cta__label {
    font-size: 14.5px;
  }

  .cta__medallion {
    width: 43px;
    height: 43px;
  }

  .cta__icon {
    width: 18px;
    height: 18px;
  }

  .site-footer {
    margin-top: 64px;
  }

  .footer__compact {
    font-size: 12.5px;
  }
}

/* ==========================================================================
   Short Viewports & Landscape Mobile
   Allow natural scrolling so text never clips or overlaps the artwork figure.
   ========================================================================== */

@media (max-height: 700px) and (min-width: 901px) {
  .scene__content {
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .hero {
    margin-top: 28px;
  }

  .eyebrow {
    margin-bottom: 18px;
  }

  .hero__copy {
    margin-top: 20px;
  }

  .hero__actions {
    margin-top: 26px;
  }

  .site-footer {
    margin-top: 32px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .scene {
    min-height: 520px;
  }

  .scene__content {
    padding: 20px 32px 24px;
  }

  .hero {
    margin-top: 20px;
  }

  .eyebrow {
    margin-bottom: 12px;
  }

  .hero__headline-line,
  .hero__headline-line--italic {
    font-size: 46px;
  }

  .hero__copy {
    margin-top: 14px;
    font-size: 15px;
  }

  .hero__actions {
    margin-top: 20px;
  }

  .site-footer {
    margin-top: 28px;
  }
}

/* ==========================================================================
   Reduced Motion
   Spec: "Reduced motion: all effects off."
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .star {
    animation: none;
    opacity: 0.92;
  }

  .hero,
  .site-header,
  .site-footer {
    animation: none;
  }

  .cta,
  .cta__medallion,
  .cta__icon {
    transition: none;
  }
}
