/*
 * Scentmore coming-soon page. Colours and fonts are the storefront's
 * (apps/scentmore/app/styles/brand.css). One goal: get people onto WhatsApp.
 * Brass is the only loud colour, and only the WhatsApp button uses it as a fill.
 */

/* Brand fonts, self-hosted (SIL OFL 1.1, licences in /fonts). Latin subset only. */
@font-face {
  font-family: "Marcellus";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/marcellus-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/hanken-grotesk-latin.woff2") format("woff2");
}

:root {
  --oud: #15110d;
  --agarwood: #3b2c21;
  --brass: #bf9b5f;
  --brass-hi: #d6b77f;
  --sand: #e8ddcb;
  --ivory: #f7f3ec;
  --ivory-muted: color-mix(in oklab, var(--ivory) 72%, var(--oud));
  --line: color-mix(in oklab, var(--ivory) 16%, transparent);

  --font-display: "Marcellus", "Optima", Georgia, serif;
  --font-sans: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(20px, 5vw, 64px);

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--oud);
  color: var(--ivory);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Backdrop ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 110%, color-mix(in oklab, var(--agarwood) 55%, transparent), transparent 60%),
    var(--oud);
}

/* Film grain, so the large dark areas don't band on cheap screens. */
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#scene {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.2s var(--ease-out);
  pointer-events: none;
}

.is-3d #scene {
  opacity: 1;
}

/* ---------- Page frame: one screen, header / main / footer ---------- */

.page {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  /* The glow behind the bottle is wider than the screen; never let it scroll sideways. */
  overflow-x: clip;
  padding: max(16px, env(safe-area-inset-top)) var(--gutter) max(16px, env(safe-area-inset-bottom));
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 4px;
}

.wordmark {
  display: block;
  width: clamp(132px, 16vw, 188px);
  height: auto;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ivory-muted);
  white-space: nowrap;
}

.status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--brass) 60%, transparent);
  animation: beacon 2.4s ease-out infinite;
}

/* ---------- Main: copy beside the bottle on wide screens, under it on tall ones ---------- */

.main {
  display: grid;
  align-items: center;
  gap: clamp(8px, 2svh, 24px);
  grid-template-areas:
    "stage"
    "copy";
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(170px, 32svh) auto;
  padding-block: 4px;
}

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .main {
    grid-template-areas: "copy stage";
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-rows: 1fr;
    gap: clamp(24px, 4vw, 72px);
  }
}

.copy {
  grid-area: copy;
  max-width: 34rem;
  text-align: center;
  justify-self: center;
}

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .copy {
    text-align: left;
    justify-self: start;
  }
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 0.8125rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
}

.headline {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 1.2rem + 3.6vw, 4.25rem);
  line-height: 1.06;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.headline em {
  font-style: normal;
  color: var(--brass-hi);
}

/* Teaser lines that rotate by themselves (app.js). */
.teaser {
  position: relative;
  height: 1.6em;
  margin: clamp(12px, 2svh, 20px) 0 0;
  overflow: hidden;
  font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.25rem);
  color: var(--sand);
}

.teaser__line {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(70%);
  transition:
    opacity 0.6s var(--ease-out),
    transform 0.6s var(--ease-out);
}

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .teaser__line {
    justify-content: flex-start;
  }
}

.teaser__line::before {
  content: "";
  flex: none;
  width: 18px;
  height: 1px;
  background: var(--brass);
}

/* Narrow phones: every teaser line must stay on one line (the box is one line tall). */
@media (max-width: 400px) {
  .teaser {
    font-size: 1rem;
  }
  .teaser__line {
    gap: 8px;
  }
  .teaser__line::before {
    width: 12px;
  }
}

@media (max-width: 400px) {
  .follow {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 340px) {
  .teaser {
    font-size: 0.875rem;
  }
}

.teaser__line.is-current {
  opacity: 1;
  transform: none;
}

.teaser__line.is-leaving {
  opacity: 0;
  transform: translateY(-70%);
}

.lead {
  margin: 10px auto 0;
  max-width: 30rem;
  color: var(--ivory-muted);
  font-size: clamp(0.975rem, 0.92rem + 0.3vw, 1.0625rem);
  text-wrap: pretty;
}

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .lead {
    margin-inline: 0;
  }
}

/* ---------- The one call to action ---------- */

.order {
  margin-top: clamp(18px, 3.2svh, 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .order {
    align-items: flex-start;
  }
}

.wa-button {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 60px;
  width: min(100%, 22rem);
  padding: 0 32px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
  color: var(--oud);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  overflow: hidden;
  box-shadow:
    0 1px 0 color-mix(in oklab, white 35%, transparent) inset,
    0 14px 40px -12px color-mix(in oklab, var(--brass) 70%, transparent);
  transition:
    transform 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

/* A slow sheen every few seconds: draws the eye without flashing. */
.wa-button::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 35%, color-mix(in oklab, white 55%, transparent) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: sheen 5.5s var(--ease-out) 2s infinite;
}

/* A soft ring that breathes out from the button. */
.wa-wrap {
  position: relative;
  display: inline-flex;
  width: min(100%, 22rem);
}

.wa-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 1px solid var(--brass);
  animation: ring 3.2s var(--ease-out) 1.4s infinite;
  pointer-events: none;
}

.wa-button svg {
  flex: none;
  width: 24px;
  height: 24px;
}

@media (hover: hover) {
  .wa-button:hover {
    transform: translateY(-2px);
    box-shadow:
      0 1px 0 color-mix(in oklab, white 35%, transparent) inset,
      0 20px 48px -12px color-mix(in oklab, var(--brass) 85%, transparent);
  }
}

.wa-button:active {
  transform: translateY(0) scale(0.98);
}

.wa-number {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ivory-muted);
  font-size: 0.9375rem;
  text-decoration: none;
}

.wa-number strong {
  color: var(--ivory);
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.2s;
}

.wa-number:hover strong {
  border-color: var(--brass);
}

.assurance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 0;
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
}

.assurance svg {
  width: 18px;
  height: 18px;
}

/* ---------- Footer: follow, quietly ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.follow {
  display: flex;
  align-items: center;
  gap: 16px;
}

.follow__label {
  font-size: 0.875rem;
  color: var(--ivory-muted);
}

.socials {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.socials a {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--sand);
  transition:
    color 0.2s,
    border-color 0.2s,
    background-color 0.2s,
    transform 0.25s var(--ease-out);
}

.socials svg {
  width: 20px;
  height: 20px;
}

@media (hover: hover) {
  .socials a:hover {
    color: var(--brass-hi);
    border-color: color-mix(in oklab, var(--brass) 60%, transparent);
    background: color-mix(in oklab, var(--brass) 8%, transparent);
    transform: translateY(-2px);
  }
}

.legal {
  margin: 0;
  font-size: 0.8125rem;
  color: color-mix(in oklab, var(--ivory-muted) 80%, transparent);
}

@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  .footer {
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    text-align: center;
  }
  .follow {
    gap: 14px;
  }
  .legal {
    font-size: 0.75rem;
  }
}

/* ---------- Stage: the bottle ---------- */

.stage {
  grid-area: stage;
  position: relative;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
}

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .stage {
    height: min(72svh, 680px);
  }
}

.poster {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity 1s var(--ease-out);
}

.is-3d .poster {
  opacity: 0;
}

/* Keeps the copy crisp when the 3D mist drifts behind it. */
.is-3d .copy,
.is-3d .header {
  text-shadow:
    0 0 18px color-mix(in oklab, var(--oud) 85%, transparent),
    0 0 4px color-mix(in oklab, var(--oud) 70%, transparent);
}

.is-3d .wa-button {
  text-shadow: none;
}

.glow {
  position: absolute;
  left: 50%;
  top: 52%;
  width: min(150%, 120svh);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--brass) 30%, transparent), transparent);
  animation: glow 7s ease-in-out infinite alternate;
}

.mist {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
}

.mist--a {
  left: 6%;
  top: 22%;
  width: 60%;
  height: 46%;
  background: color-mix(in oklab, var(--ivory) 7%, transparent);
  animation: mist-drift 14s ease-in-out infinite alternate;
}

.mist--b {
  right: 4%;
  bottom: 10%;
  width: 52%;
  height: 36%;
  background: color-mix(in oklab, var(--brass) 10%, transparent);
  animation: mist-drift 18s ease-in-out infinite alternate-reverse;
}

.bottle {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  height: 96%;
  width: auto;
  overflow: visible;
  animation: float 6s ease-in-out infinite;
}

/* Inside the SVG: animated parts transform in their own box. */
.cap,
.actuator,
.puff,
.wave,
.sweep {
  transform-box: fill-box;
}

.cap {
  transform-origin: 50% 100%;
  animation: cap-lift 11s var(--ease-out) 1.2s infinite;
}

.actuator {
  animation: press 11s ease-in-out 1.2s infinite;
}

.puff {
  transform-origin: 100% 50%;
  opacity: 0;
  animation: puff 11s ease-out 1.2s infinite;
}

.puff:nth-of-type(2) {
  animation-delay: 1.35s;
}
.puff:nth-of-type(3) {
  animation-delay: 1.5s;
}

.wave {
  animation: wave 6s linear infinite;
}

.wave--back {
  animation-duration: 9s;
  animation-direction: reverse;
}

.sweep {
  animation: sweep 7s ease-in-out 0.8s infinite;
}

.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sparkles i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s, 3px);
  height: var(--s, 3px);
  border-radius: 50%;
  background: var(--brass-hi);
  box-shadow: 0 0 8px var(--brass);
  opacity: 0;
  animation: sparkle var(--d, 6s) ease-in-out var(--delay, 0s) infinite;
}

/* ---------- Entrance: one staggered reveal on load ---------- */

.reveal {
  opacity: 0;
  translate: 0 14px;
  animation: reveal 0.9s var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 110ms + 150ms);
}

/* ---------- Keyframes ---------- */

@keyframes reveal {
  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes beacon {
  0% {
    box-shadow: 0 0 0 0 color-mix(in oklab, var(--brass) 60%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 9px transparent;
  }
}

@keyframes sheen {
  0% {
    transform: translateX(-120%);
  }
  30%,
  100% {
    transform: translateX(120%);
  }
}

@keyframes ring {
  0% {
    opacity: 0.7;
    transform: scale(1);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.12, 1.35);
  }
}

@keyframes glow {
  from {
    opacity: 0.75;
    scale: 0.94;
  }
  to {
    opacity: 1;
    scale: 1.06;
  }
}

@keyframes mist-drift {
  from {
    transform: translate3d(-4%, 2%, 0) scale(1);
  }
  to {
    transform: translate3d(6%, -4%, 0) scale(1.12);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(-0.6deg);
  }
  50% {
    transform: translateY(-1.6%) rotate(0.6deg);
  }
}

/* One loop: the cap lifts, the spray head is pressed, a puff of mist, the cap returns. */
@keyframes cap-lift {
  0%,
  6% {
    transform: none;
  }
  18%,
  52% {
    transform: translate(18%, -78%) rotate(9deg);
  }
  64%,
  100% {
    transform: none;
  }
}

@keyframes press {
  0%,
  24% {
    transform: none;
  }
  27% {
    transform: translateY(14%);
  }
  31%,
  100% {
    transform: none;
  }
}

@keyframes puff {
  0%,
  26% {
    opacity: 0;
    transform: scale(0.2);
  }
  30% {
    opacity: 0.85;
  }
  50% {
    opacity: 0;
    transform: translateX(-60%) scale(2.6);
  }
  100% {
    opacity: 0;
    transform: translateX(-60%) scale(2.6);
  }
}

@keyframes wave {
  to {
    transform: translateX(-50%);
  }
}

@keyframes sweep {
  0% {
    transform: translateX(-140%) skewX(-18deg);
  }
  45%,
  100% {
    transform: translateX(260%) skewX(-18deg);
  }
}

@keyframes sparkle {
  0%,
  100% {
    opacity: 0;
    transform: translateY(0) scale(0.6);
  }
  40% {
    opacity: 0.9;
    transform: translateY(-14px) scale(1);
  }
  80% {
    opacity: 0;
    transform: translateY(-34px) scale(0.6);
  }
}

/* ---------- Small and short screens: keep everything on one screen ---------- */

@media (max-height: 940px) and (max-aspect-ratio: 1/1) {
  .lead {
    display: none;
  }
}

@media (max-height: 760px) and (max-aspect-ratio: 1/1) {
  .main {
    grid-template-rows: minmax(140px, 28svh) auto;
  }
  .eyebrow {
    margin-bottom: 8px;
  }
  .order {
    margin-top: 16px;
    gap: 2px;
  }
  .wa-number {
    min-height: 36px;
  }
  .legal {
    display: none;
  }
}

.status__short {
  display: none;
}

@media (max-width: 520px) {
  .status {
    padding: 6px 12px;
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
  }
  .status__long {
    display: none;
  }
  .status__short {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
  .sparkles,
  .wa-wrap::before {
    display: none;
  }
}
